My custom hardware has the option for me to enable or disable serial output to help save power if no debugging output messages are needed. I have successfully modified U-Boot code to toggle the appropriate GPIO line high and enable serial output. The kernel seems to assume that GPIOs haven't been configured yet and so resets them to some "default" state which disables my serial output. After some examination, it seems that arch/arm/mach-davinci/board-evm.c is the appropriate file to modify in order to ensure that this line gets toggled high. I've added the following code to the end of the board_init() function:
#define GPIO_DIR01 __REG(0x01C67010)
#define GPIO_OUT_DATA01 __REG(0x01C67014)
#define GPIO_DIR23 __REG(0x01C67038)
#define GPIO_OUT_DATA23 __REG(0x01C6703C)
#define XPINMUX0 __REG(0x01C40000)
#define XPINMUX1 __REG(0x01C40004)
// Turn on serial I/O
XPINMUX0 &= ~((1<<22) | (1<<23) | (1<<24) | (1<<25)); // Ensure GPIOs 0, 3, and 47 are GPIOs
XPINMUX1 &= ~((1<<6) | (1<<9));
GPIO_DIR01 &= ~((1<<0) | (1<<2) | (1<<3));
GPIO_DIR23 &= ~(1<<15);
// Enable UART level shifter
GPIO_OUT_DATA01 |= (1<<0);
I also set up some GPIOs that control voltage translation to some other on-board peripherals that are not always on so that I can control their state to save power. I have also tried placing this code at the end the evm_init() function, but probing the appropriate pins on the board show that they are not being toggled no matter which function the code is in. I'm pretty confident the code is OK because it's the same code I use in U-Boot (save for how registers are defined) and have verified that the pin on my board toggles correctly.
Is there some other function that disables or resets the state of GPIO registers and/or am I just putting my code in the wrong place? I'd like to have this done at kernel boot so I can view kernel messages for debugging purposes during development.
Thanks