I test with my custom board based on sabrelite and sabreauto.
my board mainly based on sabrelite but some part are based on sabreauto.
so I want to merge some code from sabreauto to sabrelite for i2c3 usage.
first I configure pad and gpio
#define SABREAUTO_I2C3_STEER IMX_GPIO_NR(5, 4) // from sabreauto
MX6Q_PAD_EIM_A24__GPIO_5_4, // to steer to weim and i2c3
then
1290 ret = gpio_request(SABREAUTO_I2C3_STEER, "i2c3-steer"); //SABREAUTO_I2C3_STEER
1291 printk("silee gpio request = %d \n",ret, "i2c3-steer");
gpio_request retun EINVAL
what is needed more?
gpio_request return 0 when I run sabreauto binary.
thanks.
已解决! 转到解答。
It’s working now the problem is I set gpio output so early before gpio chip not initialized.
I move gpio_request and output to end of board_init then It works.
Your reply is really helpful to solve it. Thanks.
BR
Seungik Lee
OK, Lee,
don't worry ! Could you share your schematic with me ? Let me see .
My Email : weidong.sun@freescale.com
Regards,
Weidong
Hello,lee,
I checked your schematic, Then compared it with sabreAI board and BSP, I feel iomuxing is correct, but It seems that "mxc_iomux_v3_setup_multiple_pads()" functions was not run in "mx6_board_init(void)".
See following code in board-mx6q_sabreauto.c:
/*If at least one NOR memory is selected we don't
* configure IC23 PADS for rev B */
if (spinor_en) {
BUG_ON(!spinor_pads);
mxc_iomux_v3_setup_multiple_pads(spinor_pads, spinor_pads_cnt);
} else if (weimnor_en) {
BUG_ON(!weimnor_pads);
mxc_iomux_v3_setup_multiple_pads(weimnor_pads,
weimnor_pads_cnt);
} else {
if (!board_is_mx6_reva()) {
BUG_ON(!i2c3_pads);
mxc_iomux_v3_setup_multiple_pads(i2c3_pads,
i2c3_pads_cnt);
}
}
Please trace that above code and check if mxc_iomux_v3_setup_multiple_pads(weimnor_pads, weimnor_pads_cnt) function was run.
Weidong
code runs properly
I defined pad
342 #if __SILEE_275_I2C3__
343 static iomux_v3_cfg_t mx6q_i2c3_pads[] __initdata = {
344 MX6Q_PAD_GPIO_3__I2C3_SCL,
345 MX6Q_PAD_EIM_D18__I2C3_SDA,
346 };
347 static iomux_v3_cfg_t mx6q_extra_pads[] __initdata = {
348 MX6Q_PAD_EIM_A24__GPIO_5_4, // steering i2c3
349 };
350
351 #endif
and run folloing code in board_init function
1276 #if __SILEE_275_I2C3__
1277 iomux_v3_cfg_t *i2c3_pads = NULL;
1278 iomux_v3_cfg_t *extra_pads = NULL;
1279 int i2c3_pads_cnt;
1280 int extra_pads_cnt;
1281
1282 i2c3_pads = mx6q_i2c3_pads;
1283 i2c3_pads_cnt = ARRAY_SIZE(mx6q_i2c3_pads);
1284 extra_pads = mx6q_extra_pads;
1285 extra_pads_cnt = ARRAY_SIZE(mx6q_extra_pads);
1286 mxc_iomux_v3_setup_multiple_pads(extra_pads, extra_pads_cnt);
1287
1288 BUG_ON(!i2c3_pads);
1289 mxc_iomux_v3_setup_multiple_pads(i2c3_pads, i2c3_pads_cnt);
1290 printk("silee
with same board I tested I2C3 read/write without pullup pin with compiled as sabreauto.
I think the problem start from "gpio_request retunning EINVAL". I want to know what cause EINVAL return?
Thanks
seungik Lee
Hello, Lee,
OK, Can you send your BSP file to me ? Let me see it !
My personal email: weidong.sun@freescale.com
weidong
Hello,lee,
try to adjust the following:
#define __SILEE_275_UART4__ 1
#define __SILEE_275_ENET__ 1
#define __SILEE_275_WEIM_NOR__ 0
#define __SILEE_275_OPTIMIZE__ 1
#define __SILEE_275_I2C3__ 1
#define MX6Q_SABRELITE_SD3_CD IMX_GPIO_NR(7, 0)
#define MX6Q_SABRELITE_SD3_WP IMX_GPIO_NR(7, 1)
#define MX6Q_SABRELITE_SD4_CD IMX_GPIO_NR(2, 6)
#define MX6Q_SABRELITE_SD4_WP IMX_GPIO_NR(2, 7)
#define MX6Q_SABRELITE_USB_OTG_PWR IMX_GPIO_NR(3, 22)
#define MX6Q_SABRELITE_USB_HUB_RESET IMX_GPIO_NR(7, 12)
#define MX6Q_SABRELITE_ECSPI1_CS1 IMX_GPIO_NR(3, 19)
#define MX6Q_SABRELITE_CAP_TCH_INT1 IMX_GPIO_NR(1, 9)
#define MX6Q_SABRELITE_CSI0_RST IMX_GPIO_NR(1, 8)
#define MX6Q_SABRELITE_CSI0_PWN IMX_GPIO_NR(1, 6)
#define MX6Q_SABRELITE_CAN1_STBY IMX_GPIO_NR(1, 2)
#define MX6Q_SABRELITE_CAN1_EN IMX_GPIO_NR(1, 4)
//#if __SILEE_275_WEIM_NOR__
#define SABREAUTO_WEIM_NOR_WDOG1 IMX_GPIO_NR(4, 29)
#define SABREAUTO_I2C3_STEER IMX_GPIO_NR(5, 4)
//#endif
/*#if __SILEE_275_I2C3__
#define SABREAUTO_I2C3_STEER IMX_GPIO_NR(5, 4)
#endif*/
I can't confirm the issue is here, but let us try .
Weidong
It’s working now the problem is I set gpio output so early before gpio chip not initialized.
I move gpio_request and output to end of board_init then It works.
Your reply is really helpful to solve it. Thanks.
BR
Seungik Lee