summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Lin <tim2.lin@ite.corp-partner.google.com>2022-04-28 13:23:04 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-16 17:03:49 +0000
commitefe5cba4b8f9dbb1ff0fc173453a5154ab210d5b (patch)
treefb79c590c6fa52cdd06282094d8d3ddcf70d37e6
parent57bf696401be0c937d90930c2e8fc79eaa43b08b (diff)
downloadchrome-ec-efe5cba4b8f9dbb1ff0fc173453a5154ab210d5b.tar.gz
zephyr: krabby: Add pinctrl-0 property setting
The pinctrl driver has been added, so we need to add pinctrl-0 alternate function settings to each driver node. For the I2C related GPIO setting, we can add the property to the &pinctrl node. So remove the I2C related gpios=<...>. BUG=none BRANCH=none TEST=zmake build krabby --clobber Make sure these pins have been set as alternate function. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I52403b22fadf27e93436ef63d7db7ed5bade9a7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3612831 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Tested-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/boards/riscv/it8xxx2/it8xxx2.dts3
-rw-r--r--zephyr/projects/corsola/adc_krabby.dts5
-rw-r--r--zephyr/projects/corsola/gpio_krabby.dts65
-rw-r--r--zephyr/projects/corsola/i2c_krabby.dts20
-rw-r--r--zephyr/projects/corsola/led_krabby.dts6
-rw-r--r--zephyr/projects/corsola/src/krabby/hooks.c4
6 files changed, 62 insertions, 41 deletions
diff --git a/zephyr/boards/riscv/it8xxx2/it8xxx2.dts b/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
index aeeda0a2fe..2f2f1551ce 100644
--- a/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
+++ b/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
@@ -34,6 +34,9 @@
&ite_uart1_wrapper {
status = "okay";
+ pinctrl-0 = <&uart1_rx_gpb0_default
+ &uart1_tx_gpb1_default>;
+ pinctrl-names = "default";
};
&cros_kb_raw {
diff --git a/zephyr/projects/corsola/adc_krabby.dts b/zephyr/projects/corsola/adc_krabby.dts
index f9cab10cf1..68336f0a70 100644
--- a/zephyr/projects/corsola/adc_krabby.dts
+++ b/zephyr/projects/corsola/adc_krabby.dts
@@ -34,4 +34,9 @@
&adc0 {
status = "okay";
+ pinctrl-0 = <&adc0_ch0_gpi0_default
+ &adc0_ch1_gpi1_default
+ &adc0_ch2_gpi2_default
+ &adc0_ch7_gpi7_default>;
+ pinctrl-names = "default";
};
diff --git a/zephyr/projects/corsola/gpio_krabby.dts b/zephyr/projects/corsola/gpio_krabby.dts
index 9fd347a751..7246e8a40c 100644
--- a/zephyr/projects/corsola/gpio_krabby.dts
+++ b/zephyr/projects/corsola/gpio_krabby.dts
@@ -133,42 +133,6 @@
usb_a0_fault_odl: usb_a0_fault_odl {
gpios = <&gpioj 6 GPIO_INPUT>;
};
- i2c_a_scl: i2c_a_scl {
- gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- i2c_a_sda: i2c_a_sda {
- gpios = <&gpiob 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- i2c_b_scl: i2c_b_scl {
- gpios = <&gpioc 1 GPIO_INPUT>;
- };
- i2c_b_sda: i2c_b_sda {
- gpios = <&gpioc 2 GPIO_INPUT>;
- };
- i2c_c_scl: i2c_c_scl {
- gpios = <&gpiof 6 GPIO_INPUT>;
- };
- i2c_c_sda: i2c_c_sda {
- gpios = <&gpiof 7 GPIO_INPUT>;
- };
- i2c_d_scl: i2c_d_scl {
- gpios = <&gpiof 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- i2c_d_sda: i2c_d_sda {
- gpios = <&gpiof 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- i2c_e_scl: i2c_e_scl {
- gpios = <&gpioe 0 GPIO_INPUT>;
- };
- i2c_e_sda: i2c_e_sda {
- gpios = <&gpioe 7 GPIO_INPUT>;
- };
- i2c_f_scl: i2c_f_scl {
- gpios = <&gpioa 4 GPIO_INPUT>;
- };
- i2c_f_sda: i2c_f_sda {
- gpios = <&gpioa 5 GPIO_INPUT>;
- };
gpio_ec_x_gpio1: ec_x_gpio1 {
gpios = <&gpioh 4 GPIO_OUTPUT_LOW>;
};
@@ -238,3 +202,32 @@
<&gpiog 7 GPIO_OUTPUT_LOW>;
};
};
+
+&pinctrl {
+ /* I2C property setting */
+ i2c0_clk_gpb3_default: i2c0_clk_gpb3_default {
+ gpio-voltage = "1v8";
+ };
+ i2c0_data_gpb4_default: i2c0_data_gpb4_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_clk_gpf2_default: i2c3_clk_gpf2_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_data_gpf3_default: i2c3_data_gpf3_default {
+ gpio-voltage = "1v8";
+ };
+ /* SHI property setting */
+ shi_mosi_gpm0_default: shi_mosi_gpm0_default {
+ gpio-voltage = "1v8";
+ };
+ shi_miso_gpm1_default: shi_miso_gpm1_default {
+ gpio-voltage = "1v8";
+ };
+ shi_clk_gpm4_default: shi_clk_gpm4_default {
+ gpio-voltage = "1v8";
+ };
+ shi_cs_gpm5_default: shi_cs_gpm5_default {
+ gpio-voltage = "1v8";
+ };
+};
diff --git a/zephyr/projects/corsola/i2c_krabby.dts b/zephyr/projects/corsola/i2c_krabby.dts
index dd12e11f2c..75cf3834eb 100644
--- a/zephyr/projects/corsola/i2c_krabby.dts
+++ b/zephyr/projects/corsola/i2c_krabby.dts
@@ -53,6 +53,9 @@ i2c_pwr_cbi: &i2c0 {
label = "I2C_PWR_CBI";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c0_clk_gpb3_default
+ &i2c0_data_gpb4_default>;
+ pinctrl-names = "default";
};
&i2c1 {
@@ -60,6 +63,9 @@ i2c_pwr_cbi: &i2c0 {
label = "I2C_BATTERY";
status = "okay";
clock-frequency = <50000>;
+ pinctrl-0 = <&i2c1_clk_gpc1_default
+ &i2c1_data_gpc2_default>;
+ pinctrl-names = "default";
};
&i2c2 {
@@ -67,6 +73,9 @@ i2c_pwr_cbi: &i2c0 {
label = "I2C_USB_C0";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c2_clk_gpf6_default
+ &i2c2_data_gpf7_default>;
+ pinctrl-names = "default";
};
&i2c3 {
@@ -74,9 +83,11 @@ i2c_pwr_cbi: &i2c0 {
label = "I2C_SENSOR";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
- gpio-dev = <&gpiof>;
- pinctrl-0 = <&pinctrl_i2c_clk3_gpf2 /* GPF2 */
- &pinctrl_i2c_data3_gpf3>; /* GPF3 */
+ scl-gpios = <&gpiof 2 0>;
+ sda-gpios = <&gpiof 3 0>;
+ pinctrl-0 = <&i2c3_clk_gpf2_default
+ &i2c3_data_gpf3_default>;
+ pinctrl-names = "default";
prescale-scl-low = <1>;
};
@@ -85,5 +96,8 @@ i2c_pwr_cbi: &i2c0 {
label = "I2C_USB_C1";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c4_clk_gpe0_default
+ &i2c4_data_gpe7_default>;
+ pinctrl-names = "default";
prescale-scl-low = <1>;
};
diff --git a/zephyr/projects/corsola/led_krabby.dts b/zephyr/projects/corsola/led_krabby.dts
index b6761e56e5..9ee879b404 100644
--- a/zephyr/projects/corsola/led_krabby.dts
+++ b/zephyr/projects/corsola/led_krabby.dts
@@ -23,16 +23,22 @@
&pwm0 {
status = "okay";
prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm0_gpa0_default>;
+ pinctrl-names = "default";
};
/* LED2 */
&pwm1 {
status = "okay";
prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm1_gpa1_default>;
+ pinctrl-names = "default";
};
/* LED3 */
&pwm2 {
status = "okay";
prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm2_gpa2_default>;
+ pinctrl-names = "default";
};
diff --git a/zephyr/projects/corsola/src/krabby/hooks.c b/zephyr/projects/corsola/src/krabby/hooks.c
index f6b748d6b1..9fae7c8bb5 100644
--- a/zephyr/projects/corsola/src/krabby/hooks.c
+++ b/zephyr/projects/corsola/src/krabby/hooks.c
@@ -15,8 +15,8 @@
static void board_i2c3_ctrl(bool enable)
{
- if (DEVICE_DT_GET(DT_PHANDLE(DT_NODELABEL(i2c3), gpio_dev)) ==
- DEVICE_DT_GET(DT_NODELABEL(gpiof))) {
+ if (DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(DT_NODELABEL(i2c3),
+ scl_gpios, 0)) == DEVICE_DT_GET(DT_NODELABEL(gpiof))) {
/*
* TODO(b/226296649):
* Use pinctrl APIs to enable/disable an interface.