dts: arm: npcx: add I2C port helper macro
As title. Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
This commit is contained in:
parent
3bccb227ae
commit
2d465707c9
4 changed files with 32 additions and 13 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
#include <zephyr/dt-bindings/flash_controller/npcx_fiu_qspi.h>
|
#include <zephyr/dt-bindings/flash_controller/npcx_fiu_qspi.h>
|
||||||
#include <zephyr/dt-bindings/gpio/gpio.h>
|
#include <zephyr/dt-bindings/gpio/gpio.h>
|
||||||
#include <zephyr/dt-bindings/i2c/i2c.h>
|
#include <zephyr/dt-bindings/i2c/i2c.h>
|
||||||
|
#include <zephyr/dt-bindings/i2c/npcx-i2c.h>
|
||||||
#include <zephyr/dt-bindings/pinctrl/npcx-pinctrl.h>
|
#include <zephyr/dt-bindings/pinctrl/npcx-pinctrl.h>
|
||||||
#include <zephyr/dt-bindings/pwm/pwm.h>
|
#include <zephyr/dt-bindings/pwm/pwm.h>
|
||||||
#include <zephyr/dt-bindings/sensor/npcx_tach.h>
|
#include <zephyr/dt-bindings/sensor/npcx_tach.h>
|
||||||
|
|
@ -484,7 +485,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x00>;
|
port = <NPCX_I2C_CTRL_PORT(0, 0)>;
|
||||||
controller = <&i2c_ctrl0>;
|
controller = <&i2c_ctrl0>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -493,7 +494,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x10>;
|
port = <NPCX_I2C_CTRL_PORT(1, 0)>;
|
||||||
controller = <&i2c_ctrl1>;
|
controller = <&i2c_ctrl1>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -502,7 +503,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x20>;
|
port = <NPCX_I2C_CTRL_PORT(2, 0)>;
|
||||||
controller = <&i2c_ctrl2>;
|
controller = <&i2c_ctrl2>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -511,7 +512,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x30>;
|
port = <NPCX_I2C_CTRL_PORT(3, 0)>;
|
||||||
controller = <&i2c_ctrl3>;
|
controller = <&i2c_ctrl3>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -520,7 +521,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x41>;
|
port = <NPCX_I2C_CTRL_PORT(4, 1)>;
|
||||||
controller = <&i2c_ctrl4>;
|
controller = <&i2c_ctrl4>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -529,7 +530,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x50>;
|
port = <NPCX_I2C_CTRL_PORT(5, 0)>;
|
||||||
controller = <&i2c_ctrl5>;
|
controller = <&i2c_ctrl5>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -538,7 +539,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x51>;
|
port = <NPCX_I2C_CTRL_PORT(5, 1)>;
|
||||||
controller = <&i2c_ctrl5>;
|
controller = <&i2c_ctrl5>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -547,7 +548,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x60>;
|
port = <NPCX_I2C_CTRL_PORT(6, 0)>;
|
||||||
controller = <&i2c_ctrl6>;
|
controller = <&i2c_ctrl6>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -556,7 +557,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x61>;
|
port = <NPCX_I2C_CTRL_PORT(6, 1)>;
|
||||||
controller = <&i2c_ctrl6>;
|
controller = <&i2c_ctrl6>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -565,7 +566,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x70>;
|
port = <NPCX_I2C_CTRL_PORT(7, 0)>;
|
||||||
controller = <&i2c_ctrl7>;
|
controller = <&i2c_ctrl7>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x40>;
|
port = <NPCX_I2C_CTRL_PORT(4, 0)>;
|
||||||
controller = <&i2c_ctrl4>;
|
controller = <&i2c_ctrl4>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
@ -531,7 +531,7 @@
|
||||||
compatible = "nuvoton,npcx-i2c-port";
|
compatible = "nuvoton,npcx-i2c-port";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
port = <0x71>;
|
port = <NPCX_I2C_CTRL_PORT(7, 1)>;
|
||||||
controller = <&i2c_ctrl7>;
|
controller = <&i2c_ctrl7>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,13 @@ properties:
|
||||||
port:
|
port:
|
||||||
type: int
|
type: int
|
||||||
required: true
|
required: true
|
||||||
description: index of i2c port
|
description: |
|
||||||
|
Index of i2c port
|
||||||
|
This property is used to differentiate between multiple I2C ports controlled by the same
|
||||||
|
or different I2C controllers.
|
||||||
|
Bit[7:4] module id (controller).
|
||||||
|
Bit[3:0] port id.
|
||||||
|
Use the macro NPCX_I2C_CTRL_PORT(ctrl, port) to set this property.
|
||||||
|
|
||||||
controller:
|
controller:
|
||||||
type: phandle
|
type: phandle
|
||||||
|
|
|
||||||
12
include/zephyr/dt-bindings/i2c/npcx-i2c.h
Normal file
12
include/zephyr/dt-bindings/i2c/npcx-i2c.h
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Nuvoton Technology Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_I2C_NPCX_H_
|
||||||
|
#define ZEPHYR_INCLUDE_DT_BINDINGS_I2C_NPCX_H_
|
||||||
|
|
||||||
|
|
||||||
|
#define NPCX_I2C_CTRL_PORT(ctrl, port) (((ctrl & 0xf) << 4) | (port & 0xf))
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_I2C_NPCX_H_ */
|
||||||
Loading…
Reference in a new issue