Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 1 | SUMMARY = "Bletchley Motor control" |
| 2 | PR = "r1" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 5 | |
| 6 | inherit obmc-phosphor-systemd |
| 7 | |
| 8 | RDEPENDS:${PN} += "bash" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 9 | RDEPENDS:${PN} += "i2c-tools" |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 10 | RDEPENDS:${PN} += "libgpiod-tools" |
Potin Lai | dc25166 | 2022-04-01 11:16:50 +0800 | [diff] [blame] | 11 | RDEPENDS:${PN} += "mdio-util" |
Potin Lai | 501f4c7 | 2022-06-13 13:23:57 +0800 | [diff] [blame] | 12 | RDEPENDS:${PN} += "bletchley-common-functions" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 13 | |
| 14 | S = "${WORKDIR}" |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 15 | SRC_URI += " \ |
| 16 | file://motor-ctrl \ |
| 17 | file://motor-init \ |
| 18 | file://power-ctrl \ |
| 19 | " |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 20 | |
| 21 | do_install() { |
| 22 | install -d ${D}${sbindir} |
| 23 | install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir} |
| 24 | |
| 25 | install -d ${D}${libexecdir} |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 26 | install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir} |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 27 | install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir} |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 28 | } |
| 29 | |
Allen.Wang | 8941818 | 2022-01-26 10:54:09 +0800 | [diff] [blame] | 30 | TGT = "${SYSTEMD_DEFAULT_TARGET}" |
| 31 | MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service" |
Potin Lai | ffe5f92 | 2022-04-12 14:21:33 +0800 | [diff] [blame] | 32 | PWR_ON_INSTFMT="../host-poweron@.service:obmc-host-startmin@{0}.target.wants/host-poweron@{0}.service" |
| 33 | PWR_OFF_INSTFMT="../host-poweroff@.service:obmc-host-shutdown@{0}.target.wants/host-poweroff@{0}.service" |
Potin Lai | 2320b0e | 2022-06-28 10:38:37 +0800 | [diff] [blame^] | 34 | PWR_RESET_INSTFMT="host-reset@.service:host-reset@{0}.service" |
| 35 | PWR_CYCLE_INSTFMT="host-cycle@.service:host-cycle@{0}.service" |
Allen.Wang | 8941818 | 2022-01-26 10:54:09 +0800 | [diff] [blame] | 36 | AC_ON_INSTFMT="../host-ac-on@.service:${TGT}.wants/host-ac-on@{0}.service" |
Potin Lai | 016db31 | 2022-01-17 22:32:02 +0800 | [diff] [blame] | 37 | AC_OFF_INSTFMT="host-ac-off@.service:host-ac-off@{0}.service" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 38 | |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 39 | SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service" |
| 40 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 41 | |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 42 | SYSTEMD_SERVICE:${PN} += "host-poweron@.service" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 43 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
| 44 | |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 45 | SYSTEMD_SERVICE:${PN} += "host-poweroff@.service" |
Allen.Wang | 4a0948d | 2021-12-15 13:41:18 +0800 | [diff] [blame] | 46 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
Potin Lai | 016db31 | 2022-01-17 22:32:02 +0800 | [diff] [blame] | 47 | |
Potin Lai | 2320b0e | 2022-06-28 10:38:37 +0800 | [diff] [blame^] | 48 | SYSTEMD_SERVICE:${PN} += "host-reset@.service" |
| 49 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_RESET_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
| 50 | |
| 51 | SYSTEMD_SERVICE:${PN} += "host-cycle@.service" |
| 52 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_CYCLE_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
| 53 | |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 54 | SYSTEMD_SERVICE:${PN} += "host-ac-on@.service" |
| 55 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
Potin Lai | 016db31 | 2022-01-17 22:32:02 +0800 | [diff] [blame] | 56 | |
Patrick Williams | b068a53 | 2022-01-19 10:27:13 -0600 | [diff] [blame] | 57 | SYSTEMD_SERVICE:${PN} += "host-ac-off@.service" |
Potin Lai | 016db31 | 2022-01-17 22:32:02 +0800 | [diff] [blame] | 58 | SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}" |
Potin Lai | 807e2b2 | 2022-04-13 11:24:00 +0800 | [diff] [blame] | 59 | |
| 60 | # Host on requires these chassis on |
| 61 | START_TMPL_CTRL = "obmc-chassis-poweron@.target" |
| 62 | START_TGTFMT_CTRL = "obmc-host-startmin@{0}.target" |
| 63 | START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target" |
| 64 | START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}" |
| 65 | SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" |
| 66 | |
| 67 | # Chassis off requires host off |
| 68 | STOP_TMPL_CTRL = "obmc-host-stop@.target" |
| 69 | STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" |
| 70 | STOP_INSTFMT_CTRL = "obmc-host-stop@{0}.target" |
| 71 | STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}" |
| 72 | SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" |
| 73 | |
| 74 | # Hard power off requires chassis off |
| 75 | HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target" |
| 76 | HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target" |
| 77 | HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" |
| 78 | HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}" |
| 79 | SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" |
| 80 | |
| 81 | # Host on unit configurations |
| 82 | HOST_ON_OVERRIDE_CONF_FMT = "host-poweron.conf:host-poweron@{0}.service.d/host-poweron.conf" |
| 83 | SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_ON_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}" |
| 84 | |
| 85 | # Host off unit configurations |
| 86 | HOST_OFF_OVERRIDE_CONF_FMT = "host-poweroff.conf:host-poweroff@{0}.service.d/host-poweroff.conf" |
| 87 | SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_OFF_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}" |
| 88 | |