你好,
我們的環境是DM385+bq32000,想透過I2C3介面來控制
我們在board-dm385evm.c裡,增加了一些參數
static struct i2c_board_info __initdata ti814x_i2c_boardinfo[] = {
#ifdef CONFIG_RTC_DRV_BQ32K
{
I2C_BOARD_INFO("bq32000", 0x68),
},
#endif
…….
}
omap_register_i2c_bus(3, 100, ti814x_i2c_boardinfo,ARRAY_SIZE(ti814x_i2c_boardinfo));
…..
但執行結果在console裡會出現
omap_i2c omap_i2c.3: controller timed out
bq32k: probe of 3-0068 failed with error -5
執行command
>hwclock
hwclock: can't open '/dev/misc/rtc': No such file or directory
>ls /sys/bus/i2c/devices
2-0018 3-0068 i2c-2 i2c-3
看起來I2C3裝置有建立起,但是內核卻無法順利抓到後段裝置,
請問還有哪個地方需要建立的?謝謝
Best Regards,
Byron
Chris Meng:
你好,
请问你是否有参考过下面的链接的信息?
Byron Tien:
回复 Chris Meng:
您好,
請問在 arch/arm/mach-omap2/i2c.c裡omap2_i2c_mux_pins function中
void __init omap2_i2c_mux_pins(int bus_id){ char mux_name[100]; /* First I2C bus is not muxable */
if (bus_id == 1) return;
if (cpu_is_ti814x() && bus_id == 3) {sprintf(mux_name, "i2c3_scl_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP);sprintf(mux_name, "i2c3_sda_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP); } else {sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id-1, bus_id-1); omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id-1, bus_id-1); omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); }}
i2c3的mux_name要怎麼去決定呢?我參考了mux814.c裡的名稱,但不確定是否正確...Best Regards,
Chris Meng:
回复 Byron Tien:
你好,
请问你是否有参考下面的信息?
processors.wiki.ti.com/…/DM814x_AM387x_PSP_User_Guide
The names of multiplexed signals are specified in arch/arm/mach-omap2/mux814x.c file in kernel source directory.
Byron Tien:
回复 Chris Meng:
你好,
是的,我是參考那一份文件,在i2c.c裡omap2_i2c_mux_pins中增加一些mux,而名稱亦是參考mux814.c裡的參數.只是不確定我要如何選定哪些參數設定
void __init omap2_i2c_mux_pins(int bus_id){ char mux_name[100]; /* First I2C bus is not muxable */
if (bus_id == 1) return;
if (cpu_is_ti814x() && bus_id == 3) { sprintf(mux_name, "i2c3_scl_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP); sprintf(mux_name, "i2c3_sda_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP); } else {sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id-1, bus_id-1); omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id-1, bus_id-1); omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); }}
看起來這樣的設定並不正確,因為系統啟動仍然找不到I2C3後端的設備.請問要怎麼參考設定呢..
Chris Meng:
回复 Byron Tien:
你好, 每个I2C instance都有自己的ti814x_i2c_boardinfo,你代码是把原来i2c1的ti814x_i2c_boardinfo修改为i2c3的了么?
Byron Tien:
回复 Chris Meng:
你好,
static struct i2c_board_info __initdata ti814x_i2c0_boardinfo[] = {#ifdef CONFIG_RTC_DRV_BQ32K { //I2C_BOARD_INFO("bq32000", 0xD0 >> 1), I2C_BOARD_INFO("bq32000", 0x68), },#endif};
static struct i2c_board_info __initdata ti814x_i2c1_boardinfo[] = {#ifdef CONFIG_SND_SOC_TLV320AIC3X { I2C_BOARD_INFO("tlv320aic3104", 0x18), },#endif};
static void __init ti814x_evm_i2c_init(void){ /* There are 4 instances of I2C in TI814X but currently only one * instance is being used on the TI8148 EVM */ omap_register_i2c_bus(3, 100, ti814x_i2c0_boardinfo, ARRAY_SIZE(ti814x_i2c0_boardinfo)); omap_register_i2c_bus(2, 100, ti814x_i2c1_boardinfo, ARRAY_SIZE(ti814x_i2c1_boardinfo));}
我將omap_register_i2c_bus(1, 100, ti814x_i2c0_boardinfo, ARRAY_SIZE(ti814x_i2c0_boardinfo)); 改為
omap_register_i2c_bus(3, 100, ti814x_i2c0_boardinfo, ARRAY_SIZE(ti814x_i2c0_boardinfo));
而boardinfo並沒有改變
另外就是pin mux就是增加了
sprintf(mux_name, "i2c3_scl_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP); sprintf(mux_name, "i2c3_sda_mux3"); omap_mux_init_signal(mux_name, TI814X_PULL_UP);
在開機時有量測了SCL及SDA角位,確實有被拉High.
但就是開機後的bq32k driver還是抓不到後端的設備,所以不清楚是需要哪裡再修改..
Chris Meng:
回复 Byron Tien:
你好,
你有回读过pinmux设置的寄存器,看是否生效了么?
Byron Tien:
回复 Chris Meng:
你好.
請問以我上面的例子,是哪裡的暫存器需要讀出?