drivers: i2c_mcux: update to compatible with S32K344
Update to shim driver compatible with the hardware block in S32K344. Configure the pins before initializing I2C to avoid happening bus busy. Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
This commit is contained in:
parent
ae72fa7bf6
commit
3d1285bc40
7 changed files with 74 additions and 5 deletions
|
@ -51,6 +51,7 @@ SIUL2 on-chip | pinctrl
|
||||||
LPUART on-chip serial
|
LPUART on-chip serial
|
||||||
QSPI on-chip flash
|
QSPI on-chip flash
|
||||||
FLEXCAN on-chip can
|
FLEXCAN on-chip can
|
||||||
|
LPI2C on-chip i2c
|
||||||
============ ========== ================================
|
============ ========== ================================
|
||||||
|
|
||||||
The default configuration can be found in the Kconfig file
|
The default configuration can be found in the Kconfig file
|
||||||
|
@ -175,6 +176,21 @@ flexcan5 | 8 bytes | 32 MBs | 32 MBs
|
||||||
accomplished using one of the included CAN termination boards. For more details, refer
|
accomplished using one of the included CAN termination boards. For more details, refer
|
||||||
to the section ``6.3 CAN Connectors`` in the Hardware User Manual of `NXP MR-CANHUBK3`_.
|
to the section ``6.3 CAN Connectors`` in the Hardware User Manual of `NXP MR-CANHUBK3`_.
|
||||||
|
|
||||||
|
I2C
|
||||||
|
===
|
||||||
|
|
||||||
|
I2C is provided through LPI2C interface with 2 instances ``lpi2c0`` and ``lpi2c1``
|
||||||
|
on corresponding connectors ``P4``, ``P3``.
|
||||||
|
|
||||||
|
========= ===== ============
|
||||||
|
Connector Pin Pin Function
|
||||||
|
========= ===== ============
|
||||||
|
P3.2 PTD9 LPI2C1_SCL
|
||||||
|
P3.3 PTD8 LPI2C1_SDA
|
||||||
|
P4.3 PTD14 LPI2C0_SCL
|
||||||
|
P4.4 PTD13 LPI2C0_SDA
|
||||||
|
========= ===== ============
|
||||||
|
|
||||||
FS26 SBC Watchdog
|
FS26 SBC Watchdog
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
|
|
@ -176,4 +176,22 @@
|
||||||
output-enable;
|
output-enable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lpi2c0_default: lpi2c0_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <(PTD13_LPI2C0_SDA_I | PTD13_LPI2C0_SDA_O)>,
|
||||||
|
<(PTD14_LPI2C0_SCL_I | PTD14_LPI2C0_SCL_O)>;
|
||||||
|
input-enable;
|
||||||
|
output-enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lpi2c1_default: lpi2c1_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <(PTD8_LPI2C1_SDA_I | PTD8_LPI2C1_SDA_O)>,
|
||||||
|
<(PTD9_LPI2C1_SCL_I | PTD9_LPI2C1_SCL_O)>;
|
||||||
|
input-enable;
|
||||||
|
output-enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -308,3 +308,15 @@
|
||||||
sample-point-data = <875>;
|
sample-point-data = <875>;
|
||||||
sjw-data = <1>;
|
sjw-data = <1>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&lpi2c0 {
|
||||||
|
pinctrl-0 = <&lpi2c0_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&lpi2c1 {
|
||||||
|
pinctrl-0 = <&lpi2c1_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
};
|
||||||
|
|
|
@ -13,3 +13,4 @@ supported:
|
||||||
- gpio
|
- gpio
|
||||||
- uart
|
- uart
|
||||||
- can
|
- can
|
||||||
|
- i2c
|
||||||
|
|
|
@ -494,6 +494,11 @@ static int mcux_lpi2c_init(const struct device *dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
if (clock_control_get_rate(config->clock_dev, config->clock_subsys,
|
if (clock_control_get_rate(config->clock_dev, config->clock_subsys,
|
||||||
&clock_freq)) {
|
&clock_freq)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -513,11 +518,6 @@ static int mcux_lpi2c_init(const struct device *dev)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
|
|
||||||
if (error) {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
config->irq_config_func(dev);
|
config->irq_config_func(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <arm/armv7-m.dtsi>
|
#include <arm/armv7-m.dtsi>
|
||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#include <zephyr/dt-bindings/clock/nxp_s32k344_clock.h>
|
#include <zephyr/dt-bindings/clock/nxp_s32k344_clock.h>
|
||||||
|
#include <zephyr/dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
cpus {
|
cpus {
|
||||||
|
@ -484,6 +485,26 @@
|
||||||
interrupt-names = "ored", "ored_0_31_mb";
|
interrupt-names = "ored", "ored_0_31_mb";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lpi2c0: i2c@40350000 {
|
||||||
|
compatible = "nxp,imx-lpi2c";
|
||||||
|
reg = <0x40350000 0x10000>;
|
||||||
|
clocks = <&clock NXP_S32_LPI2C0_CLK>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
interrupts = <161 0>;
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
lpi2c1: i2c@40354000 {
|
||||||
|
compatible = "nxp,imx-lpi2c";
|
||||||
|
reg = <0x40354000 0x10000>;
|
||||||
|
clocks = <&clock NXP_S32_LPI2C1_CLK>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
interrupts = <162 0>;
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@ config SOC_SERIES_S32K3_M7
|
||||||
select HAS_MCUX
|
select HAS_MCUX
|
||||||
select HAS_MCUX_LPUART
|
select HAS_MCUX_LPUART
|
||||||
select HAS_MCUX_FLEXCAN
|
select HAS_MCUX_FLEXCAN
|
||||||
|
select HAS_MCUX_LPI2C
|
||||||
help
|
help
|
||||||
Enable support for NXP S32K3 MCUs family on Cortex-M7 cores
|
Enable support for NXP S32K3 MCUs family on Cortex-M7 cores
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue