From 6e311d3c6e79b782f3232504262f5674445493db Mon Sep 17 00:00:00 2001 From: Delphine CC Chiu Date: Wed, 15 Nov 2023 15:40:58 +0800 Subject: yosemite4: Support gpio monitor for server board device probing If 12v stby power state was off when bmc boot up, server board device driver will not be probed. so add gpio monitor support for server board device probing Tested: devices on server board were probed after 12v on or hot-pluged Change-Id: I9e2a6cee966dd1c64cbff53b368fa6686a8c3924 Signed-off-by: Delphine CC Chiu --- .../gpio/phosphor-gpio-monitor/probe-slot-device | 14 ++++ .../probe-slot-device@.service | 8 +++ .../yosemite4-phosphor-multi-gpio-monitor.json | 80 ++++++++++++++++++++++ .../gpio/phosphor-gpio-monitor_%.bbappend | 9 +++ 4 files changed, 111 insertions(+) create mode 100644 meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device create mode 100644 meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device@.service diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device new file mode 100644 index 0000000000..d83772094e --- /dev/null +++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device @@ -0,0 +1,14 @@ +#!/bin/bash + +HOST_BUS=$(($1 - 1)) +HOST_VIRTUAL_BUS=$(($1 + 15)) +# probe server board cpld I/O expander +echo $HOST_BUS-0020 > /sys/bus/i2c/drivers/pca953x/bind +echo $HOST_BUS-0021 > /sys/bus/i2c/drivers/pca953x/bind +echo $HOST_BUS-0022 > /sys/bus/i2c/drivers/pca953x/bind +echo $HOST_BUS-0023 > /sys/bus/i2c/drivers/pca953x/bind +# probe server board I/O expander and eeprom behind i2c-mux +echo $HOST_VIRTUAL_BUS-0049 > /sys/bus/i2c/drivers/pca953x/bind +echo $HOST_VIRTUAL_BUS-0050 > /sys/bus/i2c/drivers/at24/bind +echo $HOST_VIRTUAL_BUS-0051 > /sys/bus/i2c/drivers/at24/bind +echo $HOST_VIRTUAL_BUS-0054 > /sys/bus/i2c/drivers/at24/bind diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device@.service b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device@.service new file mode 100644 index 0000000000..0e1d2bbc7d --- /dev/null +++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/probe-slot-device@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Probe Device For Slot%i + +[Service] +Type=oneshot +ExecStart=/usr/libexec/phosphor-gpio-monitor/probe-slot-device %i +SyslogIdentifier=probe-slot-device%i + diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json index 008eddd3d4..96a06f2ff0 100644 --- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json +++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json @@ -8,5 +8,85 @@ "RISING": ["set-button-sled.service"] }, "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT1", + "ChipId": "0", + "GpioNum": 10, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@1.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT2", + "ChipId": "0", + "GpioNum": 11, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@2.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT3", + "ChipId": "0", + "GpioNum": 12, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@3.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT4", + "ChipId": "0", + "GpioNum": 13, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@4.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT5", + "ChipId": "0", + "GpioNum": 190, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@5.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT6", + "ChipId": "0", + "GpioNum": 191, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@6.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT7", + "ChipId": "0", + "GpioNum": 195, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@7.service"] + }, + "Continue": true + }, + { + "Name": "PWROK_STBY_BMC_SLOT8", + "ChipId": "0", + "GpioNum": 202, + "EventMon": "RISING", + "Targets": { + "RISING": ["probe-slot-device@8.service"] + }, + "Continue": true } ] diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend index 7580795d12..c6240c7f1a 100644 --- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend +++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend @@ -4,13 +4,19 @@ inherit obmc-phosphor-systemd systemd SRC_URI += "file://yosemite4-phosphor-multi-gpio-monitor.json \ file://set-button-sled.service \ + file://probe-slot-device@.service \ + file://probe-slot-device \ " +RDEPENDS:${PN}:append:yosemite4 = " bash" + FILES:${PN} += "${systemd_system_unitdir}/*" SYSTEMD_SERVICE:${PN} += " \ set-button-sled.service \ + probe-slot-device@.service \ " + SYSTEMD_AUTO_ENABLE = "enable" do_install:append:() { @@ -18,4 +24,7 @@ do_install:append:() { install -m 0644 ${WORKDIR}/yosemite4-phosphor-multi-gpio-monitor.json \ ${D}${datadir}/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json install -m 0644 ${WORKDIR}/set-button-sled.service ${D}${systemd_system_unitdir}/set-button-sled.service + install -m 0644 ${WORKDIR}/probe-slot-device@.service ${D}${systemd_system_unitdir}/probe-slot-device@.service + install -d ${D}${libexecdir}/${PN} + install -m 0777 ${WORKDIR}/probe-slot-device ${D}${libexecdir}/${PN}/ } -- cgit v1.2.3