boards: nios2: Add dts support for i2c
patch add dts suppoer for i2c. Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
This commit is contained in:
parent
81d3a4ff97
commit
955781b896
4 changed files with 22 additions and 3 deletions
|
@ -22,3 +22,8 @@
|
|||
status = "ok";
|
||||
current-speed = <115200>;
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_ULTRA>;
|
||||
};
|
||||
|
|
|
@ -157,14 +157,14 @@ static struct i2c_driver_api i2c_nios2_driver_api = {
|
|||
|
||||
static struct i2c_nios2_config i2c_nios2_cfg = {
|
||||
.i2c_dev = {
|
||||
.i2c_base = (alt_u32 *)I2C_0_BASE,
|
||||
.i2c_base = (alt_u32 *)DT_I2C_0_BASE_ADDRESS,
|
||||
.irq_controller_ID = I2C_0_IRQ_INTERRUPT_CONTROLLER_ID,
|
||||
.irq_ID = I2C_0_IRQ,
|
||||
.ip_freq_in_hz = I2C_0_FREQ,
|
||||
.ip_freq_in_hz = DT_I2C_0_BITRATE,
|
||||
},
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(i2c_nios2_0, CONFIG_I2C_0_NAME, &i2c_nios2_init,
|
||||
DEVICE_AND_API_INIT(i2c_nios2_0, DT_I2C_0_NAME, &i2c_nios2_init,
|
||||
NULL, &i2c_nios2_cfg,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&i2c_nios2_driver_api);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "skeleton.dtsi"
|
||||
#include <dt-bindings/i2c/i2c.h>
|
||||
|
||||
/ {
|
||||
cpus {
|
||||
|
@ -38,5 +39,14 @@
|
|||
status = "disabled";
|
||||
};
|
||||
|
||||
i2c0: i2c@100200 {
|
||||
compatible = "nios2,i2c";
|
||||
clock-frequency = <I2C_BITRATE_ULTRA>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0x100200 0x400>;
|
||||
label = "I2C_0";
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -9,3 +9,7 @@
|
|||
#define _ROM_ADDR CONFIG_FLASH_BASE_ADDRESS
|
||||
|
||||
#define _ROM_SIZE (CONFIG_FLASH_SIZE *1024)
|
||||
|
||||
#define DT_I2C_0_NAME DT_NIOS2_I2C_100200_LABEL
|
||||
#define DT_I2C_0_BASE_ADDRESS DT_NIOS2_I2C_100200_BASE_ADDRESS
|
||||
#define DT_I2C_0_BITRATE DT_NIOS2_I2C_100200_CLOCK_FREQUENCY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue