Skip to content
Permalink
Browse files

soc: nxp: ke1xf: add I2C support

Add support for the Low Power Inter-Integrated Circuit (LPI2C)
controllers found in the NXP Kinetis KE1xF SoC series.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
  • Loading branch information...
henrikbrixandersen authored and MaureenHelm committed May 14, 2019
1 parent 18ab73d commit efa2b23fcd54035ae61f0e538de51b33888a1b74
@@ -14,6 +14,8 @@
uart-0 = &uart0;
uart-1 = &uart1;
uart-2 = &uart2;
i2c-0 = &i2c0;
i2c-1 = &i2c1;
pinmux-a = &pinmux_a;
pinmux-b = &pinmux_b;
pinmux-c = &pinmux_c;
@@ -115,6 +117,30 @@
status = "disabled";
};

i2c0: i2c@40066000 {
compatible = "nxp,imx-lpi2c";
clock-frequency = <I2C_BITRATE_STANDARD>;
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40066000 0x1000>;
interrupts = <24 0>;
clocks = <&pcc 0x198>;
label = "I2C_0";
status = "disabled";
};

i2c1: i2c@40067000 {
compatible = "nxp,imx-lpi2c";
clock-frequency = <I2C_BITRATE_STANDARD>;
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40067000 0x1000>;
interrupts = <25 0>;
clocks = <&pcc 0x19c>;
label = "I2C_1";
status = "disabled";
};

pinmux_a: pinmux@40049000 {
compatible = "nxp,kinetis-pinmux";
reg = <0x40049000 0x1000>;
@@ -70,6 +70,13 @@ config UART_MCUX_LPUART

endif # SERIAL

if I2C

config I2C_MCUX_LPI2C
default y

endif # I2C

source "soc/arm/nxp_kinetis/ke1xf/Kconfig.defconfig.mke*"

endif # SOC_SERIES_KINETIS_KE1XF
@@ -15,6 +15,7 @@ config SOC_SERIES_KINETIS_KE1XF
select HAS_MCUX
select HAS_MCUX_CACHE
select HAS_MCUX_FTFX
select HAS_MCUX_LPI2C
select HAS_MCUX_LPUART
select HAS_MCUX_PCC
select HAS_MCUX_RTC
@@ -59,3 +59,18 @@
#define DT_UART_MCUX_LPUART_2_CLOCK_NAME DT_NXP_KINETIS_LPUART_4006C000_CLOCK_CONTROLLER
#define DT_UART_MCUX_LPUART_2_CLOCK_SUBSYS DT_NXP_KINETIS_LPUART_4006C000_CLOCK_NAME

#define CONFIG_I2C_0_NAME DT_NXP_IMX_LPI2C_40066000_LABEL
#define DT_I2C_MCUX_LPI2C_0_BASE_ADDRESS DT_NXP_IMX_LPI2C_40066000_BASE_ADDRESS
#define DT_I2C_MCUX_LPI2C_0_IRQ DT_NXP_IMX_LPI2C_40066000_IRQ_0
#define DT_I2C_MCUX_LPI2C_0_IRQ_PRI DT_NXP_IMX_LPI2C_40066000_IRQ_0_PRIORITY
#define DT_I2C_MCUX_LPI2C_0_BITRATE DT_NXP_IMX_LPI2C_40066000_CLOCK_FREQUENCY
#define DT_I2C_MCUX_LPI2C_0_CLOCK_NAME DT_NXP_IMX_LPI2C_40066000_CLOCK_CONTROLLER
#define DT_I2C_MCUX_LPI2C_0_CLOCK_SUBSYS DT_NXP_IMX_LPI2C_40066000_CLOCK_NAME

#define CONFIG_I2C_1_NAME DT_NXP_IMX_LPI2C_40067000_LABEL
#define DT_I2C_MCUX_LPI2C_1_BASE_ADDRESS DT_NXP_IMX_LPI2C_40067000_BASE_ADDRESS
#define DT_I2C_MCUX_LPI2C_1_IRQ DT_NXP_IMX_LPI2C_40067000_IRQ_0
#define DT_I2C_MCUX_LPI2C_1_IRQ_PRI DT_NXP_IMX_LPI2C_40067000_IRQ_0_PRIORITY
#define DT_I2C_MCUX_LPI2C_1_BITRATE DT_NXP_IMX_LPI2C_40067000_CLOCK_FREQUENCY
#define DT_I2C_MCUX_LPI2C_1_CLOCK_NAME DT_NXP_IMX_LPI2C_40067000_CLOCK_CONTROLLER
#define DT_I2C_MCUX_LPI2C_1_CLOCK_SUBSYS DT_NXP_IMX_LPI2C_40067000_CLOCK_NAME
@@ -202,6 +202,12 @@ static ALWAYS_INLINE void clk_init(void)
#ifdef CONFIG_UART_MCUX_LPUART_2
CLOCK_SetIpSrc(kCLOCK_Lpuart2, kCLOCK_IpSrcFircAsync);
#endif
#ifdef CONFIG_I2C_0
CLOCK_SetIpSrc(kCLOCK_Lpi2c0, kCLOCK_IpSrcFircAsync);
#endif
#ifdef CONFIG_I2C_1
CLOCK_SetIpSrc(kCLOCK_Lpi2c1, kCLOCK_IpSrcFircAsync);
#endif
#ifdef DT_NXP_KINETIS_SCG_0_CLKOUT_SOURCE
CLOCK_SetClkOutSel(DT_NXP_KINETIS_SCG_0_CLKOUT_SOURCE);
#endif

0 comments on commit efa2b23

Please sign in to comment.
You can’t perform that action at this time.