Skip to content

Commit b18aefd

Browse files
danieldegrassecfriedt
authored andcommitted
dts: rt685: enabled flexcomm15
the RT685 contains an additional flexcomm peripheral, that supports only I2C. This commit adds this peripheral to the device tree, and enables pins and clocks for flexcomm15. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent 5c2bdfb commit b18aefd

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

boards/arm/mimxrt685_evk/pinmux.c

+44
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,50 @@ static int mimxrt685_evk_pinmux_init(const struct device *dev)
961961
IOPCTL_PinMuxSet(IOPCTL, 2U, 9U, port2_pin9_config);
962962
#endif
963963

964+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(pmic_i2c), nxp_lpc_i2c, okay) && CONFIG_I2C
965+
const uint32_t fc15_i2c_scl_config = (/* Pin is configured as I2C_SCL */
966+
IOPCTL_PIO_FUNC0 |
967+
/* Enable pull-up / pull-down function */
968+
IOPCTL_PIO_PUPD_EN |
969+
/* Enable pull-up function */
970+
IOPCTL_PIO_PULLUP_EN |
971+
/* Enables input buffer function */
972+
IOPCTL_PIO_INBUF_EN |
973+
/* Normal mode */
974+
IOPCTL_PIO_SLEW_RATE_NORMAL |
975+
/* Normal drive */
976+
IOPCTL_PIO_FULLDRIVE_DI |
977+
/* Analog mux is disabled */
978+
IOPCTL_PIO_ANAMUX_DI |
979+
/* Pseudo Output Drain is enabled */
980+
IOPCTL_PIO_PSEDRAIN_EN |
981+
/* Input function is not inverted */
982+
IOPCTL_PIO_INV_DI);
983+
/* FC15_SCL PIN (coords: E16) is configured as I2C SCL */
984+
IOPCTL->FC15_I2C_SCL = fc15_i2c_scl_config;
985+
986+
const uint32_t fc15_i2c_sda_config = (/* Pin is configured as I2C_SDA */
987+
IOPCTL_PIO_FUNC0 |
988+
/* Enable pull-up / pull-down function */
989+
IOPCTL_PIO_PUPD_EN |
990+
/* Enable pull-up function */
991+
IOPCTL_PIO_PULLUP_EN |
992+
/* Enables input buffer function */
993+
IOPCTL_PIO_INBUF_EN |
994+
/* Normal mode */
995+
IOPCTL_PIO_SLEW_RATE_NORMAL |
996+
/* Normal drive */
997+
IOPCTL_PIO_FULLDRIVE_DI |
998+
/* Analog mux is disabled */
999+
IOPCTL_PIO_ANAMUX_DI |
1000+
/* Pseudo Output Drain is enabled */
1001+
IOPCTL_PIO_PSEDRAIN_EN |
1002+
/* Input function is not inverted */
1003+
IOPCTL_PIO_INV_DI);
1004+
/* FC15_SDA PIN (coords: F16) is configured as I2C SDA */
1005+
IOPCTL->FC15_I2C_SDA = fc15_i2c_sda_config;
1006+
#endif
1007+
9641008
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpadc0), okay) && CONFIG_ADC
9651009
/*
9661010
* The current test and sample applications uses a single channel for

drivers/clock_control/clock_control_mcux_syscon.c

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
6464
case MCUX_FLEXCOMM7_CLK:
6565
*rate = CLOCK_GetFlexCommClkFreq(7);
6666
break;
67+
case MCUX_PMIC_I2C_CLK:
68+
*rate = CLOCK_GetFlexCommClkFreq(15);
69+
break;
6770
case MCUX_HS_SPI_CLK:
6871
#if defined(FSL_FEATURE_FLEXCOMM8_SPI_INDEX)
6972
*rate = CLOCK_GetHsLspiClkFreq();

dts/arm/nxp/nxp_rt6xx_common.dtsi

+9
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@
189189
status = "disabled";
190190
};
191191

192+
pmic_i2c: i2c@127000 {
193+
compatible = "nxp,lpc-i2c";
194+
reg = <0x127000 0x1000>;
195+
interrupts = <21 0>;
196+
label = "PMIC_I2C";
197+
clocks = <&clkctl1 MCUX_PMIC_I2C_CLK>;
198+
status = "disabled";
199+
};
200+
192201
usbhs: usbhs@144000 {
193202
compatible = "nxp,mcux-usbd";
194203
reg = <0x144000 0x1000>;

include/dt-bindings/clock/mcux_lpc_syscon_clock.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define MCUX_FLEXCOMM5_CLK 5
1616
#define MCUX_FLEXCOMM6_CLK 6
1717
#define MCUX_FLEXCOMM7_CLK 7
18+
#define MCUX_PMIC_I2C_CLK 16
1819
#define MCUX_HS_SPI_CLK 8
1920
#define MCUX_USDHC1_CLK 9
2021
#define MCUX_USDHC2_CLK 10

soc/arm/nxp_imx/rt6xx/soc.c

+4
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ static ALWAYS_INLINE void clock_init(void)
235235
CLOCK_AttachClk(kSFRO_to_FLEXCOMM2);
236236
#endif
237237

238+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(pmic_i2c), nxp_lpc_i2c, okay)
239+
CLOCK_AttachClk(kFFRO_to_FLEXCOMM15);
240+
#endif
241+
238242
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_usart, okay)
239243
CLOCK_AttachClk(kSFRO_to_FLEXCOMM4);
240244
#endif

0 commit comments

Comments
 (0)