1.2.6.29内核使用的mux系统:
(1)定义arch/arm/mach-omap2/mux.c:
MUX_CFG_34XX("GP142_UART2_TX", 0x170,
OMAP34XX_MUX_MODE1 | OMAP34XX_PIN_OUTPUT) /* GP142 UART2_TX */
MUX_CFG_34XX("GP143_UART2_RX", 0x172,
OMAP34XX_MUX_MODE1 | OMAP34XX_PIN_INPUT) /* GP143 UART2_RX */
(2)添加arch/arm/plat-omap/include/mach/mux.h:
GP142_UART2_TX,
GP14333_UART2_RX,
(3)在主文件设置arch/arm/mach-omap2/board-omap3evm.c:
omap_cfg_reg(GP142_UART2_TX);
omap_cfg_reg(GP143_UART2_RX);
======================================================================
2.2.6.32内核使用的新的mux系统
(1)定义arch/arm/mach-omap2/mux34xx.c
#ifdef CONFIG_OMAP_MUX
#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
{ \
.reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \
.gpio = (g), \
.muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \
}
#else
#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
{ \
.reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \
.gpio = (g), \
}
#endif
关注红色部分,M0指的是主名称,g代表gpio,m0-m7是他们的别名
如:
_OMAP3_MUXENTRY(SDMMC2_DAT6, 138,
"sdmmc2_dat6", "sdmmc2_dir_cmd", "cam_shutter", "sdmmc3_dat2",
"gpio_138", "hsusb3_tll_dir", NULL, "safe_mode"),
(2)使用主名初始化
OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
(3)使用别名初始化
omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal("hsusb3_tll_dir",
OMAP_PIN_INPUT_PULLDOWN);
======================================================================
3.在omap系统初始化gpio的流程为:
(1)定义,如果复杂的初始化就需要用上面的方法去初始化。
omap_mux_init_gpio(OMAP3STALKER_ETHR_GPIO_IRQ, OMAP_PIN_INPUT_PULLUP);
(2)申请
gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0)
(3)方向
gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ);
(4)gpio转irq
OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ)
阅读(3781) | 评论(0) | 转发(1) |