| --- a/git/objects/power_control_obj.c |
| +++ b/git/objects/power_control_obj.c |
| @@ -17,11 +17,15 @@ static const gchar* instance_name = "power0"; |
| static const gchar* dbus_name = "org.openbmc.control.Power"; |
| |
| //This object will use these GPIOs |
| -GPIO power_pin = (GPIO){ "POWER_PIN" }; |
| -GPIO pgood = (GPIO){ "PGOOD" }; |
| -GPIO usb_reset = (GPIO){ "USB_RESET" }; |
| -GPIO pcie_reset = (GPIO){ "PCIE_RESET" }; |
| - |
| +GPIO power_pin = (GPIO){ "BMC_POWER_UP" }; |
| +GPIO pgood = (GPIO){ "SYS_PWROK_BUFF" }; |
| +GPIO bmc_wd_clear_pulse_n = (GPIO){ "BMC_WD_CLEAR_PULSE_N" }; |
| +GPIO cm1_oe_r_n = (GPIO){ "CM1_OE_R_N" }; |
| +GPIO bmc_cp0_reset_n = (GPIO){ "BMC_CP0_RESET_N" }; |
| +GPIO bmc_cfam_reset_n_r = (GPIO){ "BMC_CFAM_RESET_N_R" }; |
| +GPIO pcie_reset = (GPIO){ "PEX8718_DEVICES_RESET_N" }; |
| +GPIO cp0_devices_reset_n = (GPIO){ "CP0_DEVICES_RESET_N" }; |
| +GPIO cp1_devices_reset_n = (GPIO){ "CP1_DEVICES_RESET_N" }; |
| |
| static GDBusObjectManagerServer *manager = NULL; |
| |
| @@ -67,27 +71,36 @@ poll_pgood(gpointer user_data) |
| { |
| control_power_emit_power_lost(control_power); |
| control_emit_goto_system_state(control,"HOST_POWERED_OFF"); |
| - rc = gpio_open(&pcie_reset); |
| - rc = gpio_write(&pcie_reset,0); |
| - gpio_close(&pcie_reset); |
| - |
| - rc = gpio_open(&usb_reset); |
| - rc = gpio_write(&usb_reset,0); |
| - gpio_close(&usb_reset); |
| - |
| } |
| else |
| { |
| control_power_emit_power_good(control_power); |
| control_emit_goto_system_state(control,"HOST_POWERED_ON"); |
| - rc = gpio_open(&pcie_reset); |
| - rc = gpio_write(&pcie_reset,1); |
| - gpio_close(&pcie_reset); |
| - |
| - rc = gpio_open(&usb_reset); |
| - rc = gpio_write(&usb_reset,1); |
| - gpio_close(&usb_reset); |
| } |
| + |
| + gpio_open(&cm1_oe_r_n); |
| + gpio_write(&cm1_oe_r_n, !gpio); |
| + gpio_close(&cm1_oe_r_n); |
| + |
| + gpio_open(&bmc_cp0_reset_n); |
| + gpio_write(&bmc_cp0_reset_n, gpio); |
| + gpio_close(&bmc_cp0_reset_n); |
| + |
| + gpio_open(&bmc_cfam_reset_n_r); |
| + gpio_write(&bmc_cfam_reset_n_r, gpio); |
| + gpio_close(&bmc_cfam_reset_n_r); |
| + |
| + gpio_open(&pcie_reset); |
| + gpio_write(&pcie_reset, gpio); |
| + gpio_close(&pcie_reset); |
| + |
| + gpio_open(&cp0_devices_reset_n); |
| + gpio_write(&cp0_devices_reset_n, gpio); |
| + gpio_close(&cp0_devices_reset_n); |
| + |
| + gpio_open(&cp1_devices_reset_n); |
| + gpio_write(&cp1_devices_reset_n, gpio); |
| + gpio_close(&cp1_devices_reset_n); |
| } |
| } else { |
| printf("ERROR PowerControl: GPIO read error (gpio=%s,rc=%d)\n",pgood.name,rc); |
| @@ -138,11 +151,13 @@ on_set_power_state(ControlPower *pwr, |
| } else { |
| control_emit_goto_system_state(control,"HOST_POWERING_OFF"); |
| } |
| + |
| error = gpio_open(&power_pin); |
| if(error != GPIO_OK) { break; } |
| - error = gpio_write(&power_pin,!state); |
| + error = gpio_write(&power_pin, state); |
| if(error != GPIO_OK) { break; } |
| gpio_close(&power_pin); |
| + |
| control_power_set_state(pwr,state); |
| } while(0); |
| if(error != GPIO_OK) |
| @@ -230,10 +245,21 @@ on_bus_acquired(GDBusConnection *connection, |
| if(rc != GPIO_OK) { break; } |
| rc = gpio_init(connection,&pgood); |
| if(rc != GPIO_OK) { break; } |
| + rc = gpio_init(connection,&bmc_wd_clear_pulse_n); |
| + if(rc != GPIO_OK) { break; } |
| + rc = gpio_init(connection,&cm1_oe_r_n); |
| + if(rc != GPIO_OK) { break; } |
| + rc = gpio_init(connection,&bmc_cp0_reset_n); |
| + if(rc != GPIO_OK) { break; } |
| + rc = gpio_init(connection,&bmc_cfam_reset_n_r); |
| + if(rc != GPIO_OK) { break; } |
| rc = gpio_init(connection,&pcie_reset); |
| if(rc != GPIO_OK) { break; } |
| - rc = gpio_init(connection,&usb_reset); |
| + rc = gpio_init(connection,&cp0_devices_reset_n); |
| if(rc != GPIO_OK) { break; } |
| + rc = gpio_init(connection,&cp1_devices_reset_n ); |
| + if(rc != GPIO_OK) { break; } |
| + |
| |
| uint8_t gpio; |
| rc = gpio_open(&pgood); |