blob: feab2242620b9bd5622bb5eb6810b5734dcc6201 [file] [log] [blame]
Allen.Wang4a0948d2021-12-15 13:41:18 +08001SUMMARY = "Bletchley Motor control"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit obmc-phosphor-systemd
7
8RDEPENDS:${PN} += "bash"
Allen.Wang4a0948d2021-12-15 13:41:18 +08009RDEPENDS:${PN} += "i2c-tools"
Patrick Williamsb068a532022-01-19 10:27:13 -060010RDEPENDS:${PN} += "libgpiod-tools"
Potin Laidc251662022-04-01 11:16:50 +080011RDEPENDS:${PN} += "mdio-util"
Potin Lai501f4c72022-06-13 13:23:57 +080012RDEPENDS:${PN} += "bletchley-common-functions"
Allen.Wang4a0948d2021-12-15 13:41:18 +080013
14S = "${WORKDIR}"
Patrick Williamsb068a532022-01-19 10:27:13 -060015SRC_URI += " \
16 file://motor-ctrl \
17 file://motor-init \
18 file://power-ctrl \
19 "
Allen.Wang4a0948d2021-12-15 13:41:18 +080020
21do_install() {
22 install -d ${D}${sbindir}
23 install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir}
24
25 install -d ${D}${libexecdir}
Allen.Wang4a0948d2021-12-15 13:41:18 +080026 install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir}
Patrick Williamsb068a532022-01-19 10:27:13 -060027 install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir}
Allen.Wang4a0948d2021-12-15 13:41:18 +080028}
29
Allen.Wang89418182022-01-26 10:54:09 +080030TGT = "${SYSTEMD_DEFAULT_TARGET}"
31MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service"
Potin Laiffe5f922022-04-12 14:21:33 +080032PWR_ON_INSTFMT="../host-poweron@.service:obmc-host-startmin@{0}.target.wants/host-poweron@{0}.service"
33PWR_OFF_INSTFMT="../host-poweroff@.service:obmc-host-shutdown@{0}.target.wants/host-poweroff@{0}.service"
Potin Lai2320b0e2022-06-28 10:38:37 +080034PWR_RESET_INSTFMT="host-reset@.service:host-reset@{0}.service"
35PWR_CYCLE_INSTFMT="host-cycle@.service:host-cycle@{0}.service"
Allen.Wang89418182022-01-26 10:54:09 +080036AC_ON_INSTFMT="../host-ac-on@.service:${TGT}.wants/host-ac-on@{0}.service"
Potin Lai016db312022-01-17 22:32:02 +080037AC_OFF_INSTFMT="host-ac-off@.service:host-ac-off@{0}.service"
Allen.Wang4a0948d2021-12-15 13:41:18 +080038
Patrick Williamsb068a532022-01-19 10:27:13 -060039SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service"
40SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
Allen.Wang4a0948d2021-12-15 13:41:18 +080041
Patrick Williamsb068a532022-01-19 10:27:13 -060042SYSTEMD_SERVICE:${PN} += "host-poweron@.service"
Allen.Wang4a0948d2021-12-15 13:41:18 +080043SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
44
Patrick Williamsb068a532022-01-19 10:27:13 -060045SYSTEMD_SERVICE:${PN} += "host-poweroff@.service"
Allen.Wang4a0948d2021-12-15 13:41:18 +080046SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
Potin Lai016db312022-01-17 22:32:02 +080047
Potin Lai2320b0e2022-06-28 10:38:37 +080048SYSTEMD_SERVICE:${PN} += "host-reset@.service"
49SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_RESET_INSTFMT', 'OBMC_HOST_INSTANCES')}"
50
51SYSTEMD_SERVICE:${PN} += "host-cycle@.service"
52SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_CYCLE_INSTFMT', 'OBMC_HOST_INSTANCES')}"
53
Patrick Williamsb068a532022-01-19 10:27:13 -060054SYSTEMD_SERVICE:${PN} += "host-ac-on@.service"
55SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
Potin Lai016db312022-01-17 22:32:02 +080056
Patrick Williamsb068a532022-01-19 10:27:13 -060057SYSTEMD_SERVICE:${PN} += "host-ac-off@.service"
Potin Lai016db312022-01-17 22:32:02 +080058SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
Potin Lai807e2b22022-04-13 11:24:00 +080059
60# Host on requires these chassis on
61START_TMPL_CTRL = "obmc-chassis-poweron@.target"
62START_TGTFMT_CTRL = "obmc-host-startmin@{0}.target"
63START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target"
64START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}"
65SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
66
67# Chassis off requires host off
68STOP_TMPL_CTRL = "obmc-host-stop@.target"
69STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
70STOP_INSTFMT_CTRL = "obmc-host-stop@{0}.target"
71STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}"
72SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
73
74# Hard power off requires chassis off
75HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target"
76HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target"
77HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
78HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}"
79SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
80
81# Host on unit configurations
82HOST_ON_OVERRIDE_CONF_FMT = "host-poweron.conf:host-poweron@{0}.service.d/host-poweron.conf"
83SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_ON_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}"
84
85# Host off unit configurations
86HOST_OFF_OVERRIDE_CONF_FMT = "host-poweroff.conf:host-poweroff@{0}.service.d/host-poweroff.conf"
87SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_OFF_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}"
88