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 <unicorn_wang@outlook.com>
Reviewed-by: Yuanjie He <943313837@qq.com>
Reviewed-by: Shell <smokewood@qq.com>
This commit is contained in:
Chen Wang 2024-05-24 08:58:09 +08:00 committed by Rbb666
parent 14fb55933b
commit 80668e0ba2
3 changed files with 9 additions and 547 deletions

View File

@ -29,127 +29,12 @@ menu "General Drivers Configuration"
if BSP_USING_I2C if BSP_USING_I2C
config BSP_USING_I2C0 config BSP_USING_I2C0
bool "Enable I2C0" bool "Enable I2C0"
depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
default n 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 config BSP_USING_I2C1
bool "Enable I2C1" bool "Enable I2C1"
default n 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 config I2C_IRQ_BASE
int int
default 32 default 32

View File

@ -42,127 +42,12 @@ menu "General Drivers Configuration"
if BSP_USING_I2C if BSP_USING_I2C
config BSP_USING_I2C0 config BSP_USING_I2C0
bool "Enable I2C0" bool "Enable I2C0"
depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
default n 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 config BSP_USING_I2C1
bool "Enable I2C1" bool "Enable I2C1"
default n 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 config I2C_IRQ_BASE
int int
default 49 default 49

View File

@ -467,327 +467,19 @@ static const struct rt_i2c_bus_device_ops i2c_ops =
.i2c_bus_control = RT_NULL .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 rt_hw_i2c_init(void)
{ {
int result = RT_EOK; 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++) for (rt_size_t i = 0; i < sizeof(_i2c_obj) / sizeof(struct _i2c_bus); i++)
{ {