I am updating this post to put the preferred method up front–that is modifying u-boot.
And I’ve expanded it to include:
- UART1 (/dev/ttyS0) Rx/Tx/CTS/RTS on J5
- UART2 (/dev/ttyS1) Rx/Tx on J3
- Other GPIOs as needed
The pin mux can be reconfigured in u-boot (thanks, Antti.)
To do this we edit board/omap3/beagle/beagle.c (changes in bold):
/****************************************************************************** * Routine: set_muxconf_regs * Description: Setting up the configuration Mux registers specific to the * hardware. Many pins need to be moved from protect to primary * mode. *****************************************************************************/ void set_muxconf_regs(void) { MUX_BEAGLE(); if(beagle_revision_c) { MUX_BEAGLE_C(); } /* reset default beagleboard UART configs to avoid conflicts */ MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M7)) /*UART1_TX*/ MUX_VAL(CP(UART1_RX), (IDIS | PTD | DIS | M7)) /*UART1_RX*/ MUX_VAL(CP(UART2_RX), (IDIS | PTD | DIS | M7)) /*UART2_RX*/ /* reset DSS_DATA[0,1,6,7] lines to UART1 mode */ MUX_VAL(CP(DSS_DATA0), (IEN | PTU | EN | M2)) /*UART1_CTS*/ MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M2)) /*UART1_RTS*/ MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M2)) /*UART1_TX*/ MUX_VAL(CP(DSS_DATA7), (IEN | PTD | EN | M2)) /*UART1_RX*/ /* set UART2 lines */ MUX_VAL(CP(UART2_TX), (IDIS | PTD | DIS | M0)) /*UART2_TX*/ MUX_VAL(CP(MCBSP3_FSX), (IEN | PTD | EN | M1)) /*UART2_RX*/ /* setup GPIOs */ /* our (not BB) push buttons */ MUX_VAL(CP(I2C2_SDA), (IEN | PTD | EN | M4)) /*GPIO_183*/ MUX_VAL(CP(I2C2_SCL), (IEN | PTD | EN | M4)) /*GPIO_168*/ /* RYG LEDs */ MUX_VAL(CP(MMC2_DAT7), (IDIS | PTD | EN | M4)) /*GPIO_139*/ MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | EN | M4)) /*GPIO_87*/ MUX_VAL(CP(MMC2_DAT6), (IDIS | PTD | EN | M4)) /*GPIO_138*/ /* 7-SEGMENT LEDs */ MUX_VAL(CP(MMC2_DAT5), (IDIS | PTD | EN | M4)) /*GPIO_137*/ MUX_VAL(CP(MMC2_DAT4), (IDIS | PTD | EN | M4)) /*GPIO_136*/ MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | EN | M4)) /*GPIO_85*/ MUX_VAL(CP(MMC2_DAT3), (IDIS | PTD | EN | M4)) /*GPIO_135*/ MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | EN | M4)) /*GPIO_158*/ MUX_VAL(CP(MMC2_DAT2), (IDIS | PTD | EN | M4)) /*GPIO_134*/ MUX_VAL(CP(MCBSP1_CLKX), (IDIS | PTD | EN | M4)) /*GPIO_162*/ MUX_VAL(CP(MMC2_DAT1), (IDIS | PTD | EN | M4)) /*GPIO_133*/ MUX_VAL(CP(MCBSP_CLKS), (IDIS | PTD | EN | M4)) /*GPIO_161*/ MUX_VAL(CP(MMC2_DAT0), (IDIS | PTD | EN | M4)) /*GPIO_132*/ MUX_VAL(CP(MCBSP1_DR), (IDIS | PTD | EN | M4)) /*GPIO_159*/ MUX_VAL(CP(MMC2_CMD), (IDIS | PTD | EN | M4)) /*GPIO_131*/ MUX_VAL(CP(MCBSP1_CLKR), (IDIS | PTD | EN | M4)) /*GPIO_156*/ MUX_VAL(CP(MMC2_CLK), (IDIS | PTD | EN | M4)) /*GPIO_130*/ /* EXTERNAL RESET */ MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | EN | M4)) /*GPIO_90*/ /* misc */ MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | EN | M4)) /*GPIO_78*/ MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | EN | M4)) /*GPIO_79*/ }
Then rebuild u-boot. (That’s the separate story…)
Alternate Kernel Configuration
Here are the kernel file changes made to support use of UART1 on J4 and J5 connectors of the Rev C2 BeagleBoard. This is based on pp. 817 and 899 of OMAP3 SCM (which just happens to use UART1 as an example of reconfiguring the pin mux settings) and this reference at HY Research.
File arch/arm/mach-omap2/board-omap3beagle.c:
Added function:
static void __init beagle_uart1_init(void) { omap_cfg_reg(AG22_3430_UART1_CTS_UP); omap_cfg_reg(AH22_3430_UART1_RTS); omap_cfg_reg(F28_3430_UART1_RX_DOWN); omap_cfg_reg(E26_3430_UART1_TX); }
At end of the function
static void __init omap3_beagle_init(void)
comment out the line:
/*beagle_display_init();*/
since we are remapping some of the DSS data lines to use the UART instead, then add the line:
beagle_uart1_init();
File arch/arm/plat-omap/include/mach/mux.h:
Additions to enum omap34xx_index shown in bold:
/* UART1 for BeagleBoard on J4/J5 */ AG22_3430_UART1_CTS_UP, AH22_3430_UART1_RTS, E26_3430_UART1_TX, F28_3430_UART1_RX_DOWN }
File arch/arm/mach-omap2/mux.c:
Additions to the end of static struct pin_config __initdata_or_module omap34xx_pins[] shown in bold:
MUX_CFG_34XX("AE5_34XX_GPIO143", 0x172, OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) /* UART1 for BeagleBoard on J4/J5 */ MUX_CFG_34XX("AG22_3430_UART1_CTS_UP", 0x0DC, OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP) MUX_CFG_34XX("AH22_3430_UART1_RTS", 0x0DE, OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_OUTPUT) MUX_CFG_34XX("E26_3430_UART1_TX", 0x0E8, OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_OUTPUT) MUX_CFG_34XX("F28_3430_UART1_RX_DOWN", 0x0EA, OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN) };
Then rebuild the kernel (???) To do this I need to understand where to apply the above changes.
(Turns out kernel mods are more complicated and everything I need can be done with simpler modifications to U-Boot.)