From 9da324f4146f2539f20fb13f583e31dd5c698269 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Fri, 24 May 2019 13:26:26 +0800 Subject: meta-quanta: gsj :Override default settings of TimeOwner and TimeSyncMethod in gsj. - Set default TimeOwner to "Host" - Set default TimeSyncMethod to "Manual" (From meta-quanta rev: 5b11c82db0edf49711a8e81af12efb579b2c64fd) Signed-off-by: Tony Lee Change-Id: Id9ed58fd24d064f798d8e01b2239dfdc516c4d00 Signed-off-by: Brad Bishop --- .../phosphor-settings-manager/time-default.override.yml | 12 ++++++++++++ .../settings/phosphor-settings-manager_%.bbappend | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml create mode 100644 meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml b/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml new file mode 100644 index 000000000..abb1316c8 --- /dev/null +++ b/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml @@ -0,0 +1,12 @@ +--- +/xyz/openbmc_project/time/owner: + - Interface: xyz.openbmc_project.Time.Owner + Properties: + TimeOwner: + Default: Owner::Owners::Host + +/xyz/openbmc_project/time/sync_method: + - Interface: xyz.openbmc_project.Time.Synchronization + Properties: + TimeSyncMethod: + Default: Synchronization::Method::Manual diff --git a/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend b/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend new file mode 100644 index 000000000..da834423f --- /dev/null +++ b/meta-quanta/meta-gsj/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend_gsj := "${THISDIR}/${BPN}:" +SRC_URI_append_gsj = " file://time-default.override.yml" -- cgit v1.2.3 From 9a393799b9428d85e67331b2a32a5dd26c97d77e Mon Sep 17 00:00:00 2001 From: Samuel Jiang Date: Thu, 23 May 2019 14:59:35 +0800 Subject: meta-gsj: quanta-nvme-powerctrl: add shared script Add shared nvme_powerctrl_library script for mantain function It could be easy review steps with specification. (From meta-quanta rev: a9607d7703020f46598b28a4d1cea7be6997b47a) Change-Id: I7d7471005d253a3a0cca6bbcc083d0bfcf7efbc6 Signed-off-by: Samuel Jiang Signed-off-by: Brad Bishop --- .../files/nvme_powerctrl_library.sh | 63 ++++++++++++++++++++++ .../quanta-nvme-powerctrl/quanta-nvme-powerctrl.bb | 6 ++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh new file mode 100644 index 000000000..3737aacc1 --- /dev/null +++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +U2_PRESENT=( 148 149 150 151 152 153 154 155 ) +POWER_U2=( 195 196 202 199 198 197 127 126 ) +PWRGD_U2=( 161 162 163 164 165 166 167 168 ) +RST_BMC_U2=( 72 73 74 75 76 77 78 79 ) +PLUGGED=0 +I2C_BUS=8 +CHIP_ADDR=0x68 +CLOCK_GEN_VALUE=$(i2cget -y $I2C_BUS $CHIP_ADDR 0 i 2|cut -f3 -d' ') + +function set_gpio_direction() +{ + #$1 gpio pin, $2 'in','high','low' + echo $2 > /sys/class/gpio/gpio$1/direction +} + +function read_gpio_input() +{ + #$1 read input gpio pin + echo $(cat /sys/class/gpio/gpio$1/value) +} + +function enable_nvme_power() +{ + set_gpio_direction "${POWER_U2[$1]}" "high" + sleep 0.04 + check_powergood $1 +} + +function check_powergood() +{ + if [ $(read_gpio_input ${PWRGD_U2[$1]}) == 1 ];then + sleep 0.005 + update_clock_gen_chip_register $1 1 + sleep 0.1 + set_gpio_direction "${RST_BMC_U2[$1]}" "high" + else + disable_nvme_power $1 + fi +} + +function disable_nvme_power() +{ + set_gpio_direction "${RST_BMC_U2[$1]}" "low" + sleep 0.1 + update_clock_gen_chip_register $1 0 + sleep 0.005 + set_gpio_direction "${POWER_U2[$1]}" "low" +} + +function update_clock_gen_chip_register(){ + #$1 nvme slot number, $2 enable/disable + update_value=$(printf '%x\n' "$((0x01 <<$1))") + if [ $2 -eq 1 ];then + CLOCK_GEN_VALUE=$(printf '0x%x\n' \ + "$(($CLOCK_GEN_VALUE | 0x$update_value))") + else + CLOCK_GEN_VALUE=$(printf '0x%x\n' \ + "$(($CLOCK_GEN_VALUE & ~0x$update_value))") + fi + i2cset -y $I2C_BUS $CHIP_ADDR 0 $CLOCK_GEN_VALUE s +} diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/quanta-nvme-powerctrl.bb b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/quanta-nvme-powerctrl.bb index 8d0aa8c72..ada2a6a36 100644 --- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/quanta-nvme-powerctrl.bb +++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/quanta-nvme-powerctrl.bb @@ -14,6 +14,7 @@ RDEPENDS_${PN} += "bash" SRC_URI += "file://init_once.sh \ file://nvme_powermanager.sh \ + file://nvme_powerctrl_library.sh \ file://nvme_gpio.service \ file://nvme_powermanager.service \ " @@ -23,9 +24,12 @@ do_install () { install -m 0755 ${WORKDIR}/init_once.sh ${D}${bindir}/ install -m 0755 ${WORKDIR}/nvme_powermanager.sh ${D}${bindir}/ + install -d ${D}${libexecdir} + install -m 0755 ${WORKDIR}/nvme_powerctrl_library.sh ${D}${libexecdir}/ + install -d ${D}${systemd_unitdir}/system/ install -m 0644 ${WORKDIR}/nvme_gpio.service ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/nvme_powermanager.service ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/nvme_powermanager.service ${D}${systemd_unitdir}/system } SYSTEMD_PACKAGES = "${PN}" -- cgit v1.2.3 From efc4e1d65b2f08847b7ac961dde18904173b396f Mon Sep 17 00:00:00 2001 From: Samuel Jiang Date: Thu, 25 Apr 2019 14:43:23 +0800 Subject: meta-gsj: quanta-nvme-powerctrl: Update package process Update quanata-nvme-powerctrl process and delete two duplication function and variable init_once.sh: 1. Dump input pin information because of confirming HW signal. 2. HW POWER_U2 default is output high. If detect SSD is plugged, don't need to initialize POWER_U2 again. 3. Add RST_BMC_U2 steps, check PWRGD_U2 is fine, wait 100ms then st RST_BMC_U2 high. nvme_powermanager.sh: 1. Add RST_BMC_U2 steps, check PWRGD_U2 is fine, wait 100ms then set RST_BMC_U2 high. 2. Independent package for power control delete nvme_main DBus property trigger and tranfer led trigger to nvem_main package. (From meta-quanta rev: e689ff4990c9d76bb54c89f37831d23ff31993d2) Change-Id: Idb1faff9f30785c5cc168adfe18173ea93e7a146 Signed-off-by: Samuel Jiang Signed-off-by: Brad Bishop --- .../quanta-nvme-powerctrl/files/init_once.sh | 78 ++++++++++---------- .../files/nvme_powermanager.sh | 82 ++++++++-------------- 2 files changed, 66 insertions(+), 94 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh index 2ea02ef8d..71116fbe9 100644 --- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh +++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh @@ -1,60 +1,58 @@ #!/bin/bash +source /usr/libexec/nvme_powerctrl_library.sh + function set_gpio() { #$1 gpio pin echo $1 > /sys/class/gpio/export } -function set_gpio_direction(){ - #$1 gpio pin, $2 'in','high','low' - echo $2 > /sys/class/gpio/gpio$1/direction -} - -function read_gpio_input(){ - #$1 read input gpio pin - cat /sys/class/gpio/gpio$1/value -} - -function read_present_set_related_power(){ - #$1 read present gpio, $2 output power gpio,$3 output direction - var=$(cat /sys/class/gpio/gpio$1/value) - # present 0 is plugged,present 1 is removal - if [ "$var" == "0" ];then - set_gpio_direction $2 "high" - else - set_gpio_direction $2 "low" - fi -} - +echo "Read Clock Gen Value is: $CLOCK_GEN_VALUE" -## Initial U2_PRESNET_N -U2_PRESENT=( 148 149 150 151 152 153 154 155 ) -for i in "${U2_PRESENT[@]}"; -do - set_gpio $i; - set_gpio_direction $i 'in'; +## Initial U2_PRESENT_N +for i in ${!U2_PRESENT[@]}; +do + set_gpio ${U2_PRESENT[$i]}; + set_gpio_direction ${U2_PRESENT[$i]} 'in'; + echo "Read $i SSD present: $(read_gpio_input ${U2_PRESENT[$i]})" done ## Initial POWER_U2_EN -POWER_U2=( 195 196 202 199 198 197 127 126 ) -for i in "${POWER_U2[@]}"; +for i in ${!POWER_U2[@]}; do - set_gpio $i; + set_gpio ${POWER_U2[$i]}; done ## Initial PWRGD_U2 -PWRGD_U2=( 161 162 163 164 165 166 167 168 ) -for i in "${PWRGD_U2[@]}"; -do - set_gpio $i; - set_gpio_direction $i 'in'; +for i in ${!PWRGD_U2[@]}; +do + set_gpio ${PWRGD_U2[$i]}; + set_gpio_direction ${PWRGD_U2[$i]} 'in'; + echo "Read $i SSD Power Good: $(read_gpio_input ${PWRGD_U2[$i]})" done -### Initial SSD Power reference U2_PRESNET_N -for i in {0..7}; +## Initial RST_BMC_U2 +for i in ${!RST_BMC_U2[@]}; do - read_present_set_related_power "${U2_PRESENT[$i]}" "${POWER_U2[$i]}"; -done + set_gpio ${RST_BMC_U2[$i]}; +done +### Initial related Power by Present +for i in {0..7}; +do + update_value=$(printf '%x\n' "$((0x01 <<$i))") + if [ $(read_gpio_input ${U2_PRESENT[$i]}) == $PLUGGED ];then + CLOCK_GEN_VALUE=$(printf '0x%x\n' \ + "$(($CLOCK_GEN_VALUE | 0x$update_value))") + else + set_gpio_direction "${RST_BMC_U2[$1]}" "low" + set_gpio_direction "${POWER_U2[$1]}" "low" + + CLOCK_GEN_VALUE=$(printf '0x%x\n' \ + "$(($CLOCK_GEN_VALUE & ~0x$update_value))") + fi +done +i2cset -y $I2C_BUS $CHIP_ADDR 0 $CLOCK_GEN_VALUE s +echo "Read Clock Gen Value again is: $CLOCK_GEN_VALUE" -exit 0; \ No newline at end of file +exit 0; diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh index 91beec566..753c6c4cf 100644 --- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh +++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh @@ -1,73 +1,47 @@ #!/bin/bash +source /usr/libexec/nvme_powerctrl_library.sh U2_PRESENT_STATUS=( 1 1 1 1 1 1 1 1 ) -U2_PRESENT=( 148 149 150 151 152 153 154 155 ) -POWER_U2=( 195 196 202 199 198 197 127 126 ) -PWRGD_U2=( 161 162 163 164 165 166 167 168 ) - -function set_gpio_direction(){ - #$1 gpio pin, $2 'in','high','low' - echo $2 > /sys/class/gpio/gpio$1/direction -} - -function read_present_set_related_power(){ - #$1 read present number, $2 output power gpio - var="${U2_PRESENT_STATUS[$1]}" - # present 0 is plugged,present 1 is removal - if [ "$var" == "0" ];then - set_gpio_direction $2 "high" - else - set_gpio_direction $2 "low" - fi -} - -function update_u2_status(){ - #$1 read present gpio - var=$(cat /sys/class/gpio/gpio$2/value) - U2_PRESENT_STATUS[$1]="$var" +function recovery_power() +{ + set_gpio_direction "${POWER_U2[$1]}" "low" + sleep 0.2 + set_gpio_direction "${POWER_U2[$1]}" "high" + sleep 0.2 + check_powergood $1 } -function check_present_and_powergood(){ - #$2 present gpio, $3 powergood gpio - present=$(cat /sys/class/gpio/gpio$2/value) - pwrgd=$(cat /sys/class/gpio/gpio$3/value) - path=`expr $1` - if [ "$present" -eq 0 ] && [ "$pwrgd" -eq 1 ];then - busctl set-property xyz.openbmc_project.nvme.manager /xyz/openbmc_project/nvme/$path xyz.openbmc_project.Inventory.Item Present b true - else - busctl set-property xyz.openbmc_project.nvme.manager /xyz/openbmc_project/nvme/$path xyz.openbmc_project.Inventory.Item Present b false - if [ "$present" -eq "$pwrgd" ];then - #set fault led - busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/led\_u2\_$1\_fault xyz.openbmc_project.Led.Group Asserted b true - else - busctl set-property xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/led\_u2\_$1\_fault xyz.openbmc_project.Led.Group Asserted b false - fi - - fi - - -} ##Initial U2 present status for i in {0..7}; -do - update_u2_status $i "${U2_PRESENT[$i]}" +do + U2_PRESENT_STATUS[$i]=$(read_gpio_input ${U2_PRESENT[$i]}) done - ## Loop while while : do for i in {0..7}; do - ## 1 scend scan all loop + ## 1 second scan all loop sleep 0.125 - read=$(cat /sys/class/gpio/gpio${U2_PRESENT[$i]}/value) - if [ "${U2_PRESENT_STATUS[$1]}" != read ];then - update_u2_status $i "${U2_PRESENT[$i]}" - read_present_set_related_power $i "${POWER_U2[$i]}" - check_present_and_powergood $i "${U2_PRESENT[$i]}" "${POWER_U2[$i]}" - fi + read_present=$(read_gpio_input ${U2_PRESENT[$i]}) + if [ "$read_present" != "${U2_PRESENT_STATUS[$i]}" ];then + U2_PRESENT_STATUS[$i]="$read_present" + if [ "$read_present" == $PLUGGED ];then + echo "NVME $i Enable Power" + enable_nvme_power $i + else + echo "NVME $i Disable Power" + disable_nvme_power $i + fi + else + if [ "${U2_PRESENT_STATUS[$i]}" == $PLUGGED ] && + [ $(read_gpio_input ${PWRGD_U2[$i]}) == 0 ];then + echo "NVME $i Recovery Power" + recovery_power $i + fi + fi done done -- cgit v1.2.3