From 4d7ec579157e9af5b512dcf9c2fb5f0c71140d57 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 30 Apr 2020 12:18:34 -0600 Subject: [PATCH] board: arm: google_kukui: Enable I2C Kukui has two I2C ports with various peripherals including a battery charger and a TCPCi-compatible port controller Enable I2C so that these can be used. No drivers are provided so far. Also update the GPIO documentation while we are here. Signed-off-by: Simon Glass --- boards/arm/google_kukui/Kconfig.board | 2 +- boards/arm/google_kukui/doc/index.rst | 5 +++++ boards/arm/google_kukui/google_kukui.dts | 10 ++++++++++ boards/arm/google_kukui/google_kukui_defconfig | 3 +++ boards/arm/google_kukui/pinmux.c | 8 ++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/boards/arm/google_kukui/Kconfig.board b/boards/arm/google_kukui/Kconfig.board index 4c4efa07cc..d3585a6bc2 100644 --- a/boards/arm/google_kukui/Kconfig.board +++ b/boards/arm/google_kukui/Kconfig.board @@ -11,4 +11,4 @@ config BOARD_GOOGLE_KUKUI Duet and 10e Chromebook Tablet. The EC handles battery charging, keyboard scanning, USB Power Delivery and sensors. - So far for Zephyr only a simple serial console is supported. + So far for Zephyr only a simple serial console and I2C are supported. diff --git a/boards/arm/google_kukui/doc/index.rst b/boards/arm/google_kukui/doc/index.rst index 5bcd7af27c..434541c4f6 100644 --- a/boards/arm/google_kukui/doc/index.rst +++ b/boards/arm/google_kukui/doc/index.rst @@ -61,6 +61,11 @@ Default Zephyr Peripheral Mapping: ---------------------------------- - UART_1 TX/RX : PA10/PA9 +- I2C_1 SCL/SDA : PB8/PB9 +- I2C_2 SCL/SDA : PA11/PA12 +- Volume down : GPIOB pin 11 +- Volume up : GPIOB pin 10 +- Power : GPIOA pin 0 Programming and Debugging ************************* diff --git a/boards/arm/google_kukui/google_kukui.dts b/boards/arm/google_kukui/google_kukui.dts index f5b2e76eae..dde8dd3e4c 100644 --- a/boards/arm/google_kukui/google_kukui.dts +++ b/boards/arm/google_kukui/google_kukui.dts @@ -37,3 +37,13 @@ }; }; }; + +&i2c1 { + status = "okay"; + clock-frequency = ; +}; + +&i2c2 { + status = "okay"; + clock-frequency = ; +}; diff --git a/boards/arm/google_kukui/google_kukui_defconfig b/boards/arm/google_kukui/google_kukui_defconfig index c1f9406076..a1456c3f7d 100644 --- a/boards/arm/google_kukui/google_kukui_defconfig +++ b/boards/arm/google_kukui/google_kukui_defconfig @@ -11,6 +11,9 @@ CONFIG_BOARD_GOOGLE_KUKUI=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y +# I2C support +CONFIG_I2C=y + # Enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/arm/google_kukui/pinmux.c b/boards/arm/google_kukui/pinmux.c index 8350d00ebc..c0a3389417 100644 --- a/boards/arm/google_kukui/pinmux.c +++ b/boards/arm/google_kukui/pinmux.c @@ -17,6 +17,14 @@ static const struct pin_config pinconf[] = { {STM32_PIN_PA9, STM32F0_PINMUX_FUNC_PA9_USART1_TX}, {STM32_PIN_PA10, STM32F0_PINMUX_FUNC_PA10_USART1_RX}, #endif +#if DT_HAS_NODE(DT_NODELABEL(i2c1)) + {STM32_PIN_PB8, STM32F0_PINMUX_FUNC_PB8_I2C1_SCL}, + {STM32_PIN_PB9, STM32F0_PINMUX_FUNC_PB9_I2C1_SDA}, +#endif +#if DT_HAS_NODE(DT_NODELABEL(i2c2)) + {STM32_PIN_PA11, STM32F0_PINMUX_FUNC_PA11_I2C2_SCL}, + {STM32_PIN_PA12, STM32F0_PINMUX_FUNC_PA12_I2C2_SDA}, +#endif }; static int pinmux_stm32_init(struct device *port)