1、在配置设备树得过程中碰到了比较多得问题,已I2C为例,在实例文档中介绍得:
Qualcomm I2C controller
Required properties:
- reg : Offset and length of the register region(s) for the device
For GSBI based controller, GSBI and QUP regions are expected
For BLSP based controller, QUP region offset is expected
- reg-names : Register region name(s) referenced in reg above
BLSP based controller expects QUP region name ("qup_phys_addr")
GSBI controller expects QUP region name and GSBI region name
("gsbi_qup_i2c_addr")
- compatible : should be "qcom,i2c-qup"
- cell-index : I2C bus number used for this controller
- interrupts : QUP core interrupt(s). Core may have 1 error interrupt and flags
for input/output service, or 3 separate interrupts for the 3 services
- interrupt-names: QUP core interrupt name(s) referenced in interrupts above
Expected interrupt resource name(s) are: "qup_err_irq", "qup_in_irq",
and "qup_out_irq"
- qcom,i2c-bus-freq : desired I2C bus clock frequency is Hz
Optional property:
- qcom,i2c-src-freq : Frequency of the source clocking this bus in Hz.
Divider value is set based on soruce-frequency and
desired I2C bus frequency. If this value is not
provided, the source clock is assumed to be running
at 19.2 MHz.
- qcom,scl-gpio : I2C clock GPIO number. Required for execution of bus
recovery procedure.
- qcom,sda-gpio : I2C data GPIO number. Required for execution of bus
recovery procedure.
Example:
i2c-1@f9927000 {
cell-index = <5>;
compatible = "qcom,i2c-qup";
reg = <0xf9966000 0x1000>;
reg-names = "qup_phys_addr";
interrupts = <0 104 0>;
interrupt-names = "qup_err_intr";
qcom,i2c-bus-freq = <100000>;
qcom,i2c-src-freq = <24000000>;
qcom,scl-gpio = ;
qcom,sda-gpio = ;
};
其中: 0xf9966000 寄存器地址需要与对应得 QUP0-5 以及对应得gpio口对应
interrupts应该与对应QUP0-5 对应
i2c-1 可以是任意自定标识 在adb shell中进入 sys/device中查看 ls 时 可以看到对应得名字
bus-freq = 为100K 或者400K 由对应得client 来决定
-src-freq = 为内核提供给bus得时钟 可不做配置 默认19.2M 写死后系统会用配置得进行deide 来进行寄存器得配置
2、在这里配置的是bus规范,实际bus上一般都挂载N个client ,在client得dts文件中需要引用这些来配置
对应得f9966000 地址需要正确如:
i2c-1@f9927000 { /* BLSP1 QUP5 */
my_i2c_name@20 {
compatible = "my_i2c_name,core_name";
reg = <0x20>;
interrupt-parent = ;
interrupts = <17 0x2008>;
vdd-supply = ;
vcc_i2c-supply = ;
my_i2c_name,reset-gpio = ;
my_i2c_name,irq-gpio = ;
my_i2c_name,button-map = <139 102 158>;
my_i2c_name,i2c-pull-up;
my_i2c_name,reg-en;
};
3.End