i2c: mcux: Remove usage of CONFIG_I2C_x_DEFAULT_CFG
Stop using CONFIG_I2C_x_DEFAULT_CFG to get the initial value. Since we only support master mode we always default to it for initial config and we get the bitrate from the device tree. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
250e674a66
commit
54933b3833
14 changed files with 27 additions and 47 deletions
|
@ -78,23 +78,9 @@ if I2C
|
||||||
config I2C_0
|
config I2C_0
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
if I2C_0
|
|
||||||
|
|
||||||
config I2C_0_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_0
|
|
||||||
|
|
||||||
config I2C_1
|
config I2C_1
|
||||||
def_bool n
|
def_bool n
|
||||||
|
|
||||||
if I2C_1
|
|
||||||
|
|
||||||
config I2C_1_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_1
|
|
||||||
|
|
||||||
endif # I2C
|
endif # I2C
|
||||||
|
|
||||||
if ADC
|
if ADC
|
||||||
|
|
|
@ -78,13 +78,6 @@ if I2C
|
||||||
config I2C_0
|
config I2C_0
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
if I2C_0
|
|
||||||
|
|
||||||
config I2C_0_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_0
|
|
||||||
|
|
||||||
endif # I2C
|
endif # I2C
|
||||||
|
|
||||||
if ADC
|
if ADC
|
||||||
|
|
|
@ -60,13 +60,6 @@ if I2C
|
||||||
config I2C_1
|
config I2C_1
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
if I2C_1
|
|
||||||
|
|
||||||
config I2C_1_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_1
|
|
||||||
|
|
||||||
endif # I2C
|
endif # I2C
|
||||||
|
|
||||||
if ADC
|
if ADC
|
||||||
|
|
|
@ -78,23 +78,9 @@ if I2C
|
||||||
config I2C_0
|
config I2C_0
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
if I2C_0
|
|
||||||
|
|
||||||
config I2C_0_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_0
|
|
||||||
|
|
||||||
config I2C_1
|
config I2C_1
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
if I2C_1
|
|
||||||
|
|
||||||
config I2C_1_DEFAULT_CFG
|
|
||||||
default 0x12
|
|
||||||
|
|
||||||
endif # I2C_1
|
|
||||||
|
|
||||||
endif # I2C
|
endif # I2C
|
||||||
|
|
||||||
if ADC
|
if ADC
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <fsl_i2c.h>
|
#include <fsl_i2c.h>
|
||||||
#include <fsl_clock.h>
|
#include <fsl_clock.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
#include "i2c-priv.h"
|
||||||
|
|
||||||
#define DEV_CFG(dev) \
|
#define DEV_CFG(dev) \
|
||||||
((const struct i2c_mcux_config * const)(dev)->config->config_info)
|
((const struct i2c_mcux_config * const)(dev)->config->config_info)
|
||||||
|
@ -22,7 +23,7 @@ struct i2c_mcux_config {
|
||||||
I2C_Type *base;
|
I2C_Type *base;
|
||||||
clock_name_t clock_source;
|
clock_name_t clock_source;
|
||||||
void (*irq_config_func)(struct device *dev);
|
void (*irq_config_func)(struct device *dev);
|
||||||
union dev_config default_cfg;
|
u32_t bitrate;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct i2c_mcux_data {
|
struct i2c_mcux_data {
|
||||||
|
@ -155,7 +156,7 @@ static int i2c_mcux_init(struct device *dev)
|
||||||
I2C_Type *base = DEV_BASE(dev);
|
I2C_Type *base = DEV_BASE(dev);
|
||||||
const struct i2c_mcux_config *config = DEV_CFG(dev);
|
const struct i2c_mcux_config *config = DEV_CFG(dev);
|
||||||
struct i2c_mcux_data *data = DEV_DATA(dev);
|
struct i2c_mcux_data *data = DEV_DATA(dev);
|
||||||
u32_t clock_freq;
|
u32_t clock_freq, bitrate_cfg;
|
||||||
i2c_master_config_t master_config;
|
i2c_master_config_t master_config;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -167,7 +168,9 @@ static int i2c_mcux_init(struct device *dev)
|
||||||
I2C_MasterTransferCreateHandle(base, &data->handle,
|
I2C_MasterTransferCreateHandle(base, &data->handle,
|
||||||
i2c_mcux_master_transfer_callback, dev);
|
i2c_mcux_master_transfer_callback, dev);
|
||||||
|
|
||||||
error = i2c_mcux_configure(dev, config->default_cfg.raw);
|
bitrate_cfg = _i2c_map_dt_bitrate(config->bitrate);
|
||||||
|
|
||||||
|
error = i2c_mcux_configure(dev, I2C_MODE_MASTER | bitrate_cfg);
|
||||||
if (error) {
|
if (error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +192,7 @@ static const struct i2c_mcux_config i2c_mcux_config_0 = {
|
||||||
.base = (I2C_Type *)CONFIG_I2C_MCUX_0_BASE_ADDRESS,
|
.base = (I2C_Type *)CONFIG_I2C_MCUX_0_BASE_ADDRESS,
|
||||||
.clock_source = I2C0_CLK_SRC,
|
.clock_source = I2C0_CLK_SRC,
|
||||||
.irq_config_func = i2c_mcux_config_func_0,
|
.irq_config_func = i2c_mcux_config_func_0,
|
||||||
.default_cfg.raw = CONFIG_I2C_0_DEFAULT_CFG,
|
.bitrate = CONFIG_I2C_MCUX_0_BITRATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct i2c_mcux_data i2c_mcux_data_0;
|
static struct i2c_mcux_data i2c_mcux_data_0;
|
||||||
|
@ -217,7 +220,7 @@ static const struct i2c_mcux_config i2c_mcux_config_1 = {
|
||||||
.base = (I2C_Type *)CONFIG_I2C_MCUX_1_BASE_ADDRESS,
|
.base = (I2C_Type *)CONFIG_I2C_MCUX_1_BASE_ADDRESS,
|
||||||
.clock_source = I2C1_CLK_SRC,
|
.clock_source = I2C1_CLK_SRC,
|
||||||
.irq_config_func = i2c_mcux_config_func_1,
|
.irq_config_func = i2c_mcux_config_func_1,
|
||||||
.default_cfg.raw = CONFIG_I2C_1_DEFAULT_CFG,
|
.bitrate = CONFIG_I2C_MCUX_1_BITRATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct i2c_mcux_data i2c_mcux_data_1;
|
static struct i2c_mcux_data i2c_mcux_data_1;
|
||||||
|
|
|
@ -62,3 +62,4 @@
|
||||||
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_0_BITRATE NXP_KINETIS_I2C_40066000_CLOCK_FREQUENCY
|
||||||
|
|
|
@ -10,3 +10,4 @@
|
||||||
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_0_BITRATE NXP_KINETIS_I2C_40066000_CLOCK_FREQUENCY
|
||||||
|
|
|
@ -15,3 +15,4 @@
|
||||||
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_1_BITRATE NXP_KINETIS_I2C_40067000_CLOCK_FREQUENCY
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_0_BASE_ADDRESS NXP_KINETIS_I2C_40066000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
#define CONFIG_I2C_MCUX_0_IRQ NXP_KINETIS_I2C_40066000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_0_IRQ_PRI NXP_KINETIS_I2C_40066000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_0_BITRATE NXP_KINETIS_I2C_40066000_CLOCK_FREQUENCY
|
||||||
|
|
||||||
#define CONFIG_I2C_1_NAME NXP_KINETIS_I2C_40067000_LABEL
|
#define CONFIG_I2C_1_NAME NXP_KINETIS_I2C_40067000_LABEL
|
||||||
#define CONFIG_FXOS8700_I2C_NAME NXP_KINETIS_I2C_40067000_LABEL
|
#define CONFIG_FXOS8700_I2C_NAME NXP_KINETIS_I2C_40067000_LABEL
|
||||||
|
@ -69,3 +70,4 @@
|
||||||
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_1_BITRATE NXP_KINETIS_I2C_40067000_CLOCK_FREQUENCY
|
||||||
|
|
|
@ -14,3 +14,4 @@
|
||||||
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
#define CONFIG_I2C_MCUX_1_BASE_ADDRESS NXP_KINETIS_I2C_40067000_BASE_ADDRESS_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
#define CONFIG_I2C_MCUX_1_IRQ NXP_KINETIS_I2C_40067000_IRQ_0
|
||||||
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
#define CONFIG_I2C_MCUX_1_IRQ_PRI NXP_KINETIS_I2C_40067000_IRQ_0_PRIORITY
|
||||||
|
#define CONFIG_I2C_MCUX_1_BITRATE NXP_KINETIS_I2C_40067000_CLOCK_FREQUENCY
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <arm/armv7-m.dtsi>
|
#include <arm/armv7-m.dtsi>
|
||||||
|
#include <dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
cpus {
|
cpus {
|
||||||
|
@ -76,6 +77,7 @@
|
||||||
|
|
||||||
i2c0: i2c@40066000 {
|
i2c0: i2c@40066000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40066000 0x1000>;
|
reg = <0x40066000 0x1000>;
|
||||||
|
@ -86,6 +88,7 @@
|
||||||
|
|
||||||
i2c1: i2c@40067000 {
|
i2c1: i2c@40067000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40067000 0x1000>;
|
reg = <0x40067000 0x1000>;
|
||||||
|
@ -96,6 +99,7 @@
|
||||||
|
|
||||||
i2c2: i2c@400e6000 {
|
i2c2: i2c@400e6000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x400e6000 0x1000>;
|
reg = <0x400e6000 0x1000>;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "armv6-m.dtsi"
|
#include "armv6-m.dtsi"
|
||||||
|
#include <dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
cpus {
|
cpus {
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
|
|
||||||
i2c0: i2c@40066000 {
|
i2c0: i2c@40066000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40066000 0x1000>;
|
reg = <0x40066000 0x1000>;
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
|
|
||||||
i2c1: i2c@40067000 {
|
i2c1: i2c@40067000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40067000 0x1000>;
|
reg = <0x40067000 0x1000>;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "armv6-m.dtsi"
|
#include "armv6-m.dtsi"
|
||||||
|
#include <dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
cpus {
|
cpus {
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
|
|
||||||
i2c0: i2c@40066000 {
|
i2c0: i2c@40066000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40066000 0x1000>;
|
reg = <0x40066000 0x1000>;
|
||||||
|
@ -62,6 +64,7 @@
|
||||||
|
|
||||||
i2c1: i2c@40067000 {
|
i2c1: i2c@40067000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40067000 0x1000>;
|
reg = <0x40067000 0x1000>;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <arm/armv6-m.dtsi>
|
#include <arm/armv6-m.dtsi>
|
||||||
|
#include <dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
cpus {
|
cpus {
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
|
|
||||||
i2c0: i2c@40066000 {
|
i2c0: i2c@40066000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40066000 0x1000>;
|
reg = <0x40066000 0x1000>;
|
||||||
|
@ -62,6 +64,7 @@
|
||||||
|
|
||||||
i2c1: i2c@40067000 {
|
i2c1: i2c@40067000 {
|
||||||
compatible = "nxp,kinetis-i2c";
|
compatible = "nxp,kinetis-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
reg = <0x40067000 0x1000>;
|
reg = <0x40067000 0x1000>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue