Hi All,
I am using imx6Q Sabre SD board,
I am a beginner in this.
I wants to implement GPIO support in U-Boot.
Plz advice me from where to start.
Regards
Divya
Hi
Divya
You need to first setup PAD for GPIO.
Than you can use gpio_direction_output or gpio_direction_input according to your GPIO functionality.
I hope this helps.
Thanks
Saurabh
Hi Saurabh,
Thanks for your quick reply.
As I mentioned in the earlier message ,am a beginner in this.
So could you plz provide any helpful link or note on how to set up all these PAD and how I can use gpio_direction_output or gpio_direction_input .
Regards
Divya
Hi
Divya
uboot-imx\board\freescale\mx6q_sabreauto\mx6q_sabreauto.c
GPIO can be configured in input or output according to our requirement.
Suppose if I want to control LED using GPIO than I need to setup gpio_direction_output.
Thanks
Saurabh
Hi Saurabh,
Thanks for your quick reply.
I found the file mx6q_sabreauto.c.In that file there is no method named gpio_direction_output or gpio_direction_input .
Only i could found below code snippet
#ifdef CONFIG_I2C_MXC
if (!mx6_board_is_reva()) {
mxc_iomux_v3_setup_multiple_pads(gpio_pads,
ARRAY_SIZE(gpio_pads));
gpio_direction_output(I2C_EXP_RST, 1);
gpio_direction_output(I2C3_STEER, 1);
}
setup_i2c(CONFIG_SYS_I2C_PORT);
/* Enable lvds power */
setup_lvds_poweron();
/* restore path for weim/spi nor */
if (!mx6_board_is_reva())
gpio_direction_output(I2C3_STEER, 0);
#endif
void udc_pins_setting(void)
{
mxc_iomux_v3_setup_pad(MX6X_IOMUX(PAD_ENET_RX_ER__ANATOP_USBOTG_ID));
/* USB_OTG_PWR = 0 */
gpio_direction_output(SABREAUTO_USB_OTG_PWR, 0);
/* USB_H1_POWER = 1 */
gpio_direction_output(SABREAUTO_USB_HOST1_PWR, 1);
mxc_iomux_set_gpr_register(1, 13, 1, 0);
}
if I want to control LED using GPIO then how will i setup gpio_direction_output.
Regards
Divya
Hi
If gpio_direction_output(SABREAUTO_USB_OTG_PWR, 0); mean SABREAUTO_USB_OTG_PWR GPIO set to Low.
And gpio_direction_output(SABREAUTO_USB_OTG_PWR, 1) mean SABREAUTO_USB_OTG_PWR GPIO set to High.
Same way you can set your GPIO.
Hi
As Saurabh said, you can configure GPIOs using:
gpio_direction_output(IMX_GPIO_NR((bank,number), 0));
gpio_direction_output(IMX_GPIO_NR((bank,number), 1));
gpio_direction_output is defined in u-boot\drivers\gpio\mxc_gpio.c
Regards,
Jayaram