summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Semjonovs <asemjonovs@google.com>2022-09-02 09:06:39 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-02 21:03:38 +0000
commit5f27f39b7b9074cb6c78f1f1ebdde0513537615f (patch)
tree62864fca8618fcdd4e068ca9a61d5850a4d04beb
parent9a323c7407d407c64bbd8499b50926695651049b (diff)
downloadchrome-ec-5f27f39b7b9074cb6c78f1f1ebdde0513537615f.tar.gz
zephyr: drivers: Fix GPIO pin numbering
The max pins per GPIO is 32. Renumber pins to prevent buffer overflow. BUG=None BRANCH=NONE TEST=./twister -T zephyr/test Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I39394f09083fb31038d2fb98080bec2771ccd29a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3871738 Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com>
-rw-r--r--zephyr/test/drivers/boards/native_posix.overlay84
1 files changed, 49 insertions, 35 deletions
diff --git a/zephyr/test/drivers/boards/native_posix.overlay b/zephyr/test/drivers/boards/native_posix.overlay
index cc7aa02a42..dcf64de292 100644
--- a/zephyr/test/drivers/boards/native_posix.overlay
+++ b/zephyr/test/drivers/boards/native_posix.overlay
@@ -53,7 +53,7 @@
compatible = "named-gpios";
gpio_acok_od: acok_od {
- gpios = <&gpio0 2 GPIO_INPUT>;
+ gpios = <&gpio0 0 GPIO_INPUT>;
enum-name = "GPIO_AC_PRESENT";
};
/* In test WP is output because CBI use it, but it is also
@@ -61,132 +61,146 @@
* protection.
*/
gpio_wp_l: wp_l {
- gpios = <&gpio0 3 (GPIO_INPUT | GPIO_OUTPUT |
+ gpios = <&gpio0 1 (GPIO_INPUT | GPIO_OUTPUT |
GPIO_ACTIVE_LOW)>;
};
gpio_ec_kso_02_inv: ec_kso_02_inv {
- gpios = <&gpio0 4 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 2 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
pg_ec_dsw_pwrok {
- gpios = <&gpio0 4 GPIO_INPUT>;
+ gpios = <&gpio0 3 GPIO_INPUT>;
enum-name = "GPIO_TEMP_SENSOR_POWER";
};
gpio_ec_pch_wake_odl: ec_pch_wake_odl {
- gpios = <&gpio0 5 GPIO_OUTPUT_HIGH>;
+ gpios = <&gpio0 4 GPIO_OUTPUT_HIGH>;
};
/* Setup USB C1 pin as output to check their state in test */
usb_c1_ls_en: usb_c1_ls_en {
- gpios = <&gpio0 6 (GPIO_INPUT_PULL_UP |
+ gpios = <&gpio0 5 (GPIO_INPUT_PULL_UP |
GPIO_OUTPUT)>;
};
usb_c1_rt_rst_odl: usb_c1_rt_rst_odl {
- gpios = <&gpio0 7 (GPIO_OUTPUT | GPIO_INPUT)>;
+ gpios = <&gpio0 6 (GPIO_OUTPUT | GPIO_INPUT)>;
};
gpio_usb_c1_frs_en: usb_c1_frs_en {
- gpios = <&gpio0 8 (GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 7 (GPIO_OUTPUT_LOW)>;
};
usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl {
- gpios = <&gpio0 9 GPIO_INPUT>;
+ gpios = <&gpio0 8 GPIO_INPUT>;
};
usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl {
- gpios = <&gpio0 10 GPIO_INPUT>;
+ gpios = <&gpio0 9 GPIO_INPUT>;
};
usb_c0_tcpc_rst_l: usb_c0_tcpc_rst_l {
- gpios = <&gpio0 11 (GPIO_OUTPUT_HIGH | GPIO_INPUT)>;
+ gpios = <&gpio0 10 (GPIO_OUTPUT_HIGH | GPIO_INPUT)>;
};
usb_c1_tcpc_rst_l: usb_c1_tcpc_rst_l {
- gpios = <&gpio0 12 (GPIO_OUTPUT_HIGH | GPIO_INPUT)>;
+ gpios = <&gpio0 11 (GPIO_OUTPUT_HIGH | GPIO_INPUT)>;
};
gpio_usb_c1_ppc_int: usb_c1_ppc_int {
- gpios = <&gpio0 13 GPIO_INPUT>;
+ gpios = <&gpio0 12 GPIO_INPUT>;
};
gpio_usb_c0_ppc_int: usb_c0_ppc_int {
- gpios = <&gpio0 14 GPIO_INPUT>;
+ gpios = <&gpio0 13 GPIO_INPUT>;
};
gpio_switchcap_pg_int_l: switchcap_pg_int_l {
- gpios = <&gpio0 15 (GPIO_OUTPUT | GPIO_INPUT)>;
+ gpios = <&gpio0 14 (GPIO_OUTPUT | GPIO_INPUT)>;
};
gpio_ap_rst_l: ap_rst_l {
- gpios = <&gpio0 16 GPIO_INPUT>;
+ gpios = <&gpio0 15 GPIO_INPUT>;
enum-name = "GPIO_AP_RST_L";
};
gpio_ps_hold: ps_hold {
- gpios = <&gpio0 17 (GPIO_INPUT | GPIO_PULL_DOWN)>;
+ gpios = <&gpio0 16 (GPIO_INPUT | GPIO_PULL_DOWN)>;
enum-name = "GPIO_PS_HOLD";
};
gpio_mb_power_good: mb_power_good {
- gpios = <&gpio0 18 (GPIO_OUTPUT | GPIO_INPUT |
+ gpios = <&gpio0 17 (GPIO_OUTPUT | GPIO_INPUT |
GPIO_PULL_DOWN)>;
enum-name = "GPIO_POWER_GOOD";
};
gpio_ap_suspend: ap_suspend {
- gpios = <&gpio0 19 GPIO_INPUT>;
+ gpios = <&gpio0 18 GPIO_INPUT>;
enum-name = "GPIO_AP_SUSPEND";
};
gpio_pmic_kpd_pwr_odl: pmic_kpd_pwr_odl {
- gpios = <&gpio0 20 GPIO_ODR_HIGH>;
+ gpios = <&gpio0 19 GPIO_OUTPUT_HIGH>;
enum-name = "GPIO_PMIC_KPD_PWR_ODL";
};
gpio_pmic_resin_l: pmic_resin_l {
- gpios = <&gpio0 21 GPIO_ODR_HIGH>;
+ gpios = <&gpio0 20 GPIO_OUTPUT_HIGH>;
enum-name = "GPIO_PMIC_RESIN_L";
};
gpio_warm_reset_l: warm_reset_l {
- gpios = <&gpio0 22 GPIO_INPUT>;
+ gpios = <&gpio0 21 GPIO_INPUT>;
enum-name = "GPIO_WARM_RESET_L";
};
gpio_lid_open_ec: lid_open_ec {
/* GPIO_PULL_UP will cause this start asserted. */
- gpios = <&gpio0 23 (GPIO_INPUT | GPIO_PULL_UP)>;
+ gpios = <&gpio0 22 (GPIO_INPUT | GPIO_PULL_UP)>;
enum-name = "GPIO_LID_OPEN";
};
gpio_switchcap_on: switchcap_on {
- gpios = <&gpio0 24 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 23 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ec_pwr_btn_odl: ec_pwr_btn_odl {
/* GPIO_PULL_UP will cause this start asserted,
* i.e. not pressed.
*/
- gpios = <&gpio0 25 (GPIO_INPUT | GPIO_PULL_UP)>;
+ gpios = <&gpio0 24 (GPIO_INPUT | GPIO_PULL_UP)>;
enum-name = "GPIO_POWER_BUTTON_L";
};
gpio_src_vph_pwr_pg: src_vph_pwr_pg {
- gpios = <&gpio0 26 (GPIO_INPUT | GPIO_OUTPUT |
+ gpios = <&gpio0 25 (GPIO_INPUT | GPIO_OUTPUT |
GPIO_PULL_DOWN)>;
};
gpio_test: test {
- gpios = <&gpio0 27 (GPIO_INPUT | GPIO_OUTPUT)>;
+ gpios = <&gpio0 26 (GPIO_INPUT | GPIO_OUTPUT)>;
};
ec_batt_pres_odl {
- gpios = <&gpio0 28 GPIO_INPUT>;
+ gpios = <&gpio0 27 GPIO_INPUT>;
enum-name = "GPIO_BATT_PRES_ODL";
};
gpio_no_init: no_init {
- gpios = <&gpio0 29 (GPIO_ACTIVE_LOW | GPIO_INPUT)>;
+ gpios = <&gpio0 28 (GPIO_ACTIVE_LOW | GPIO_INPUT)>;
no-auto-init;
};
gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
#led-pin-cells = <1>;
- gpios = <&gpio0 30 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 29 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 {
#led-pin-cells = <1>;
- gpios = <&gpio0 31 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 30 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ec_chg_led_y_c1: ec_chg_led_y_c1 {
#led-pin-cells = <1>;
- gpios = <&gpio0 32 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio0 31 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
+ /* gpio1 */
gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 {
#led-pin-cells = <1>;
- gpios = <&gpio0 33 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
+ gpios = <&gpio1 0 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
ap_ec_int_l {
- gpios = <&gpio0 34 GPIO_ODR_HIGH>;
+ gpios = <&gpio1 1 GPIO_OUTPUT_HIGH>;
enum-name = "GPIO_EC_INT_L";
};
};
+ gpio1: gpio@101 {
+ status = "okay";
+ compatible = "zephyr,gpio-emul";
+ reg = <0x101 0x4>;
+ rising-edge;
+ falling-edge;
+ high-level;
+ low-level;
+ gpio-controller;
+ #gpio-cells = <2>;
+ ngpios = <2>;
+ };
+
gpio-interrupts {
compatible = "cros-ec,gpio-interrupts";
@@ -874,7 +888,7 @@
};
&gpio0 {
- ngpios = <35>;
+ ngpios = <32>;
};
&i2c0 {