From 80668e0ba20572d98300fdbaeb31a7aaf698b443 Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Fri, 24 May 2024 08:58:09 +0800 Subject: [PATCH] bsp:cvitek: revert add i2c pinmux config for c906 The contents of the SOC type part in the Kconfig configuration are retained, and other parts related to I2C pin multiplexing selection have been rolled back. Signed-off-by: Chen Wang Reviewed-by: Yuanjie He <943313837@qq.com> Reviewed-by: Shell --- bsp/cvitek/c906_little/board/Kconfig | 115 --------- bsp/cvitek/cv18xx_risc-v/board/Kconfig | 115 --------- bsp/cvitek/drivers/drv_hw_i2c.c | 326 +------------------------ 3 files changed, 9 insertions(+), 547 deletions(-) diff --git a/bsp/cvitek/c906_little/board/Kconfig b/bsp/cvitek/c906_little/board/Kconfig index 52fdc2d2a9..06d8214321 100755 --- a/bsp/cvitek/c906_little/board/Kconfig +++ b/bsp/cvitek/c906_little/board/Kconfig @@ -29,127 +29,12 @@ menu "General Drivers Configuration" if BSP_USING_I2C config BSP_USING_I2C0 bool "Enable I2C0" - depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR default n - if BSP_USING_I2C0 - choice - prompt "SCL" - - config BSP_USING_IIC0_SCL__IIC0_SCL - bool "IIC0_SCL/GP0" - endchoice - - choice - prompt "SDA" - - config BSP_USING_IIC0_SDA__IIC0_SDA - bool "IIC0_SDA/GP1" - endchoice - endif - config BSP_USING_I2C1 bool "Enable I2C1" default n - if BSP_USING_I2C1 - choice - prompt "SCL" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_D2__IIC1_SCL - bool "SD1_D2/GP4" - config BSP_USING_SD1_D3__IIC1_SCL - bool "SD1_D3/GP9" - config BSP_USING_PAD_MIPIRX0N__IIC1_SCL - bool "PAD_MIPIRX0N/GP11" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_D2__IIC1_SCL - bool "SD1_D2/GP4" - config BSP_USING_SD1_D3__IIC1_SCL - bool "SD1_D3/GP9" - endif - - endchoice - - choice - prompt "SDA" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_D1__IIC1_SDA - bool "SD1_D1/GP5" - config BSP_USING_SD1_D0__IIC1_SDA - bool "SD1_D0/GP8" - config BSP_USING_PAD_MIPIRX1P__IIC1_SDA - bool "PAD_MIPIRX1P/GP10" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_D1__IIC1_SDA - bool "SD1_D1/GP5" - config BSP_USING_SD1_D0__IIC1_SDA - bool "SD1_D0/GP8" - endif - endchoice - endif - - config BSP_USING_I2C2 - bool "Enable I2C2" - depends on BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - default n - - if BSP_USING_I2C2 - choice - prompt "SCL" - - config BSP_USING_PAD_MIPI_TXP1__IIC2_SCL - bool "PAD_MIPI_TXP1/GP11" - endchoice - - choice - prompt "SDA" - - config BSP_USING_PAD_MIPI_TXM1__IIC2_SDA - bool "PAD_MIPI_TXM1/GP10" - endchoice - endif - - config BSP_USING_I2C3 - bool "Enable I2C3" - default n - - if BSP_USING_I2C3 - choice - prompt "SCL" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_CMD__IIC3_SCL - bool "SD1_CMD/GP7" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_CMD__IIC3_SCL - bool "SD1_CMD/GP7" - endif - endchoice - - choice - prompt "SDA" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_CLK__IIC3_SDA - bool "SD1_CLK/GP6" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_CLK__IIC3_SDA - bool "SD1_CLK/GP6" - endif - endchoice - endif - config I2C_IRQ_BASE int default 32 diff --git a/bsp/cvitek/cv18xx_risc-v/board/Kconfig b/bsp/cvitek/cv18xx_risc-v/board/Kconfig index 50efa0e0b0..bc213c777e 100755 --- a/bsp/cvitek/cv18xx_risc-v/board/Kconfig +++ b/bsp/cvitek/cv18xx_risc-v/board/Kconfig @@ -42,127 +42,12 @@ menu "General Drivers Configuration" if BSP_USING_I2C config BSP_USING_I2C0 bool "Enable I2C0" - depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR default n - if BSP_USING_I2C0 - choice - prompt "SCL" - - config BSP_USING_IIC0_SCL__IIC0_SCL - bool "IIC0_SCL/GP0" - endchoice - - choice - prompt "SDA" - - config BSP_USING_IIC0_SDA__IIC0_SDA - bool "IIC0_SDA/GP1" - endchoice - endif - config BSP_USING_I2C1 bool "Enable I2C1" default n - if BSP_USING_I2C1 - choice - prompt "SCL" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_D2__IIC1_SCL - bool "SD1_D2/GP4" - config BSP_USING_SD1_D3__IIC1_SCL - bool "SD1_D3/GP9" - config BSP_USING_PAD_MIPIRX0N__IIC1_SCL - bool "PAD_MIPIRX0N/GP11" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_D2__IIC1_SCL - bool "SD1_D2/GP4" - config BSP_USING_SD1_D3__IIC1_SCL - bool "SD1_D3/GP9" - endif - - endchoice - - choice - prompt "SDA" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_D1__IIC1_SDA - bool "SD1_D1/GP5" - config BSP_USING_SD1_D0__IIC1_SDA - bool "SD1_D0/GP8" - config BSP_USING_PAD_MIPIRX1P__IIC1_SDA - bool "PAD_MIPIRX1P/GP10" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_D1__IIC1_SDA - bool "SD1_D1/GP5" - config BSP_USING_SD1_D0__IIC1_SDA - bool "SD1_D0/GP8" - endif - endchoice - endif - - config BSP_USING_I2C2 - bool "Enable I2C2" - depends on BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - default n - - if BSP_USING_I2C2 - choice - prompt "SCL" - - config BSP_USING_PAD_MIPI_TXP1__IIC2_SCL - bool "PAD_MIPI_TXP1/GP11" - endchoice - - choice - prompt "SDA" - - config BSP_USING_PAD_MIPI_TXM1__IIC2_SDA - bool "PAD_MIPI_TXM1/GP10" - endchoice - endif - - config BSP_USING_I2C3 - bool "Enable I2C3" - default n - - if BSP_USING_I2C3 - choice - prompt "SCL" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_CMD__IIC3_SCL - bool "SD1_CMD/GP7" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_CMD__IIC3_SCL - bool "SD1_CMD/GP7" - endif - endchoice - - choice - prompt "SDA" - - if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR - config BSP_USING_SD1_CLK__IIC3_SDA - bool "SD1_CLK/GP6" - endif - - if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR - config BSP_USING_SD1_CLK__IIC3_SDA - bool "SD1_CLK/GP6" - endif - endchoice - endif - config I2C_IRQ_BASE int default 49 diff --git a/bsp/cvitek/drivers/drv_hw_i2c.c b/bsp/cvitek/drivers/drv_hw_i2c.c index 3189de4579..022a050c74 100644 --- a/bsp/cvitek/drivers/drv_hw_i2c.c +++ b/bsp/cvitek/drivers/drv_hw_i2c.c @@ -467,327 +467,19 @@ static const struct rt_i2c_bus_device_ops i2c_ops = .i2c_bus_control = RT_NULL }; -static void rt_hw_i2c_pinmux_config_i2c0() -{ -#ifdef BSP_USING_I2C0 - - // SCL - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_IIC0_SCL__IIC0_SCL) - PINMUX_CONFIG(IIC0_SCL, IIC0_SCL); - #elif defined(BSP_USING_PWR_GPIO2__IIC0_SCL) - PINMUX_CONFIG(PWR_GPIO2, IIC0_SCL); - #elif defined(BSP_USING_PAD_MIPIRX4N__IIC0_SCL) - PINMUX_CONFIG(PAD_MIPIRX4N, IIC0_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP2__IIC0_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP2, IIC0_SCL); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_IIC0_SCL__IIC0_SCL) - PINMUX_CONFIG(IIC0_SCL, IIC0_SCL); - #endif - #endif // SOC_TYPE_SG2002 - - // SDA - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_IIC0_SDA__IIC0_SDA) - PINMUX_CONFIG(IIC0_SDA, IIC0_SDA); - #elif defined(BSP_USING_PWR_GPIO1__IIC0_SDA) - PINMUX_CONFIG(PWR_GPIO1, IIC0_SDA); - #elif defined(BSP_USING_PAD_MIPIRX4P__IIC0_SDA) - PINMUX_CONFIG(PAD_MIPIRX4P, IIC0_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM2__IIC0_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM2, IIC0_SDA); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_IIC0_SDA__IIC0_SDA) - PINMUX_CONFIG(IIC0_SDA, IIC0_SDA); - #endif - #endif // SOC_TYPE_SG2002 - -#endif /* BSP_USING_I2C0 */ -} - -static void rt_hw_i2c_pinmux_config_i2c1() -{ -#ifdef BSP_USING_I2C1 - - // SCL - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_SD0_CMD__IIC1_SCL) - PINMUX_CONFIG(SD0_CMD, IIC1_SCL); - #elif defined(BSP_USING_SD0_D2__IIC1_SCL) - PINMUX_CONFIG(SD0_D2, IIC1_SCL); - #elif defined(BSP_USING_SD1_D3__IIC1_SCL) - PINMUX_CONFIG(SD1_D3, IIC1_SCL); - #elif defined(BSP_USING_SD1_D2__IIC1_SCL) - PINMUX_CONFIG(SD1_D2, IIC1_SCL); - #elif defined(BSP_USING_MUX_SPI1_MOSI__IIC1_SCL) - PINMUX_CONFIG(MUX_SPI1_MOSI, IIC1_SCL); - #elif defined(BSP_USING_PAD_ETH_TXP__IIC1_SCL) - PINMUX_CONFIG(PAD_ETH_TXP, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPIRX4P__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPIRX4P, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPIRX0N__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP2__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP2, IIC1_SCL); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_SD0_CMD__IIC1_SCL) - PINMUX_CONFIG(SD0_CMD, IIC1_SCL); - #elif defined(BSP_USING_SD0_D2__IIC1_SCL) - PINMUX_CONFIG(SD0_D2, IIC1_SCL); - #elif defined(BSP_USING_SD1_D3__IIC1_SCL) - PINMUX_CONFIG(SD1_D3, IIC1_SCL); - #elif defined(BSP_USING_SD1_D2__IIC1_SCL) - PINMUX_CONFIG(SD1_D2, IIC1_SCL); - #elif defined(BSP_USING_MUX_SPI1_MOSI__IIC1_SCL) - PINMUX_CONFIG(MUX_SPI1_MOSI, IIC1_SCL); - #elif defined(BSP_USING_PAD_ETH_TXP__IIC1_SCL) - PINMUX_CONFIG(PAD_ETH_TXP, IIC1_SCL); - #elif defined(BSP_USING_VIVO_D9__IIC1_SCL) - PINMUX_CONFIG(VIVO_D9, IIC1_SCL); - #elif defined(BSP_USING_VIVO_D3__IIC1_SCL) - PINMUX_CONFIG(VIVO_D3, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPIRX4P__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPIRX4P, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPIRX0N__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP4__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP4, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP3__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP3, IIC1_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP2__IIC1_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP2, IIC1_SCL); - #endif - #endif // SOC_TYPE_SG2002 - - // SDA - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_SD0_CLK__IIC1_SDA) - PINMUX_CONFIG(SD0_CLK, IIC1_SDA); - #elif defined(BSP_USING_SD0_D1__IIC1_SDA) - PINMUX_CONFIG(SD0_D1, IIC1_SDA); - #elif defined(BSP_USING_SD1_D1__IIC1_SDA) - PINMUX_CONFIG(SD1_D1, IIC1_SDA); - #elif defined(BSP_USING_SD1_D0__IIC1_SDA) - PINMUX_CONFIG(SD1_D0, IIC1_SDA); - #elif defined(BSP_USING_MUX_SPI1_MISO__IIC1_SDA) - PINMUX_CONFIG(MUX_SPI1_MISO, IIC1_SDA); - #elif defined(BSP_USING_PAD_ETH_TXM__IIC1_SDA) - PINMUX_CONFIG(PAD_ETH_TXM, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPIRX4N__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPIRX4N, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPIRX1P__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM2__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM2, IIC1_SDA); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_SD0_CLK__IIC1_SDA) - PINMUX_CONFIG(SD0_CLK, IIC1_SDA); - #elif defined(BSP_USING_SD0_D1__IIC1_SDA) - PINMUX_CONFIG(SD0_D1, IIC1_SDA); - #elif defined(BSP_USING_SD1_D1__IIC1_SDA) - PINMUX_CONFIG(SD1_D1, IIC1_SDA); - #elif defined(BSP_USING_SD1_D0__IIC1_SDA) - PINMUX_CONFIG(SD1_D0, IIC1_SDA); - #elif defined(BSP_USING_MUX_SPI1_MISO__IIC1_SDA) - PINMUX_CONFIG(MUX_SPI1_MISO, IIC1_SDA); - #elif defined(BSP_USING_PAD_ETH_TXM__IIC1_SDA) - PINMUX_CONFIG(PAD_ETH_TXM, IIC1_SDA); - #elif defined(BSP_USING_VIVO_D10__IIC1_SDA) - PINMUX_CONFIG(VIVO_D10, IIC1_SDA); - #elif defined(BSP_USING_VIVO_D4__IIC1_SDA) - PINMUX_CONFIG(VIVO_D4, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPIRX4N__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPIRX4N, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPIRX1P__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM4__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM4, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM3__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM3, IIC1_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM2__IIC1_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM2, IIC1_SDA); - #endif - #endif // SOC_TYPE_SG2002 - -#endif /* BSP_USING_I2C1 */ -} - -static void rt_hw_i2c_pinmux_config_i2c2() -{ -#ifdef BSP_USING_I2C2 - - // SCL - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_PWR_GPIO1__IIC2_SCL) - PINMUX_CONFIG(PWR_GPIO1, IIC2_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP1__IIC2_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP1, IIC2_SCL); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_PWR_GPIO1__IIC2_SCL) - PINMUX_CONFIG(PWR_GPIO1, IIC2_SCL); - #elif defined(BSP_USING_IIC2_SCL__IIC2_SCL) - PINMUX_CONFIG(IIC2_SCL, IIC2_SCL); - #elif defined(BSP_USING_VIVO_D8__IIC2_SCL) - PINMUX_CONFIG(VIVO_D8, IIC2_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP3__IIC2_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP3, IIC2_SCL); - #elif defined(BSP_USING_PAD_MIPI_TXP1__IIC2_SCL) - PINMUX_CONFIG(PAD_MIPI_TXP1, IIC2_SCL); - #endif - #endif // SOC_TYPE_SG2002 - - // SDA - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_PWR_GPIO2__IIC2_SDA) - PINMUX_CONFIG(PWR_GPIO2, IIC2_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM1__IIC2_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM1, IIC2_SDA); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_PWR_GPIO2__IIC2_SDA) - PINMUX_CONFIG(PWR_GPIO2, IIC2_SDA); - #elif defined(BSP_USING_IIC2_SDA__IIC2_SDA) - PINMUX_CONFIG(IIC2_SDA, IIC2_SDA); - #elif defined(BSP_USING_VIVO_D7__IIC2_SDA) - PINMUX_CONFIG(VIVO_D7, IIC2_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM3__IIC2_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM3, IIC2_SDA); - #elif defined(BSP_USING_PAD_MIPI_TXM1__IIC2_SDA) - PINMUX_CONFIG(PAD_MIPI_TXM1, IIC2_SDA); - #endif - #endif // SOC_TYPE_SG2002 - -#endif /* BSP_USING_I2C2 */ -} - -static void rt_hw_i2c_pinmux_config_i2c3() -{ -#ifdef BSP_USING_I2C3 - - // SCL - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_SD1_CMD__IIC3_SCL) - PINMUX_CONFIG(SD1_CMD, IIC3_SCL); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_IIC3_SCL__IIC3_SCL) - PINMUX_CONFIG(IIC3_SCL, IIC3_SCL); - #elif defined(BSP_USING_SD1_CMD__IIC3_SCL) - PINMUX_CONFIG(SD1_CMD, IIC3_SCL); - #elif defined(BSP_USING_VIVO_D0__IIC3_SCL) - PINMUX_CONFIG(VIVO_D0, IIC3_SCL); - #endif - #endif // SOC_TYPE_SG2002 - - // SDA - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_SD1_CLK__IIC3_SDA) - PINMUX_CONFIG(SD1_CLK, IIC3_SDA); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_IIC3_SDA__IIC3_SDA) - PINMUX_CONFIG(IIC3_SDA, IIC3_SDA); - #elif defined(BSP_USING_SD1_CLK__IIC3_SDA) - PINMUX_CONFIG(SD1_CLK, IIC3_SDA); - #elif defined(BSP_USING_VIVO_D1__IIC3_SDA) - PINMUX_CONFIG(VIVO_D1, IIC3_SDA); - #endif - #endif // SOC_TYPE_SG2002 - -#endif /* BSP_USING_I2C3 */ -} - -static void rt_hw_i2c_pinmux_config_i2c4() -{ -#ifdef BSP_USING_I2C4 - - // SCL - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_PWR_WAKEUP0__IIC4_SCL) - PINMUX_CONFIG(PWR_WAKEUP0, IIC4_SCL); - #elif defined(BSP_USING_PAD_MIPIRX2N__IIC4_SCL) - PINMUX_CONFIG(PAD_MIPIRX2N, IIC4_SCL); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_CAM_RST0__IIC4_SCL) - PINMUX_CONFIG(CAM_RST0, IIC4_SCL); - #elif defined(BSP_USING_PWR_WAKEUP0__IIC4_SCL) - PINMUX_CONFIG(PWR_WAKEUP0, IIC4_SCL); - #elif defined(BSP_USING_PWR_WAKEUP1__IIC4_SCL) - PINMUX_CONFIG(PWR_WAKEUP1, IIC4_SCL); - #elif defined(BSP_USING_ADC3__IIC4_SCL) - PINMUX_CONFIG(ADC3, IIC4_SCL); - #elif defined(BSP_USING_VIVO_D1__IIC4_SCL) - PINMUX_CONFIG(VIVO_D1, IIC4_SCL); - #endif - #endif // SOC_TYPE_SG2002 - - // SDA - #if defined(SOC_TYPE_CV180X) - #if defined(BSP_USING_PWR_BUTTON1__IIC4_SDA) - PINMUX_CONFIG(PWR_BUTTON1, IIC4_SDA); - #elif defined(BSP_USING_PAD_MIPIRX2P__IIC4_SDA) - PINMUX_CONFIG(PAD_MIPIRX2P, IIC4_SDA); - #endif - #endif // SOC_TYPE_CV180X - - #if defined(SOC_TYPE_SG2002) - #if defined(BSP_USING_CAM_PD1__IIC4_SDA) - PINMUX_CONFIG(CAM_PD1, IIC4_SDA); - #elif defined(BSP_USING_PWR_BUTTON1__IIC4_SDA) - PINMUX_CONFIG(PWR_BUTTON1, IIC4_SDA); - #elif defined(BSP_USING_PWR_ON__IIC4_SDA) - PINMUX_CONFIG(PWR_ON, IIC4_SDA); - #elif defined(BSP_USING_ADC2__IIC4_SDA) - PINMUX_CONFIG(ADC2, IIC4_SDA); - #elif defined(BSP_USING_VIVO_D0__IIC4_SDA) - PINMUX_CONFIG(VIVO_D0, IIC4_SDA); - #elif defined(BSP_USING_PAD_MIPIRX2P__IIC4_SDA) - PINMUX_CONFIG(PAD_MIPIRX2P, IIC4_SDA); - #endif - #endif // SOC_TYPE_SG2002 - -#endif /* BSP_USING_I2C4 */ -} - -static void rt_hw_i2c_pinmux_config() -{ - rt_hw_i2c_pinmux_config_i2c0(); - rt_hw_i2c_pinmux_config_i2c1(); - rt_hw_i2c_pinmux_config_i2c2(); - rt_hw_i2c_pinmux_config_i2c3(); - rt_hw_i2c_pinmux_config_i2c4(); -} - int rt_hw_i2c_init(void) { int result = RT_EOK; - rt_hw_i2c_pinmux_config(); +#ifdef BSP_USING_I2C0 + PINMUX_CONFIG(IIC0_SCL, IIC0_SCL); + PINMUX_CONFIG(IIC0_SDA, IIC0_SDA); +#endif /* BSP_USING_I2C0 */ + +#ifdef BSP_USING_I2C1 + PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA); + PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL); +#endif /* BSP_USING_I2C1 */ for (rt_size_t i = 0; i < sizeof(_i2c_obj) / sizeof(struct _i2c_bus); i++) {