Commit 508b4a8c authored by Angus Ainslie's avatar Angus Ainslie

Merge branch 'all-uarts' into 'librem5'

board: purism: librem5: Compile time option for console on any UART

See merge request Librem5/uboot-imx!22
parents 74db1654 b1a017ca
......@@ -31,19 +31,12 @@ DECLARE_GLOBAL_DATA_PTR;
#define ENABLE_TPS_RESET
#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE)
static iomux_v3_cfg_t const wdog_pads[] = {
IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL),
};
static iomux_v3_cfg_t const uart_pads[] = {
IMX8MQ_PAD_UART1_RXD__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART1_TXD__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
};
int board_early_init_f(void)
{
struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
......@@ -53,8 +46,6 @@ int board_early_init_f(void)
imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
set_wdog_reset(wdog);
imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
return 0;
}
......
......@@ -6,7 +6,6 @@
#ifndef __LIBREM5_H__
#define __LIBREM5_H__
/* configured */
#define CAMERA_EN IMX_GPIO_NR(1, 0)
#define SD_EN IMX_GPIO_NR(1, 3)
#define AUDIO_EN IMX_GPIO_NR(1, 4)
......@@ -35,6 +34,15 @@
#define SPI1_MISO IMX_GPIO_NR(5, 8)
#define SPI1_SS0 IMX_GPIO_NR(5, 9)
#define UART1_TX IMX_GPIO_NR(5, 23)
#define UART1_RX IMX_GPIO_NR(5, 22)
#define UART2_TX IMX_GPIO_NR(5, 25)
#define UART2_RX IMX_GPIO_NR(5, 24)
#define UART3_TX IMX_GPIO_NR(5, 27)
#define UART3_RX IMX_GPIO_NR(5, 26)
#define UART4_TX IMX_GPIO_NR(5, 11)
#define UART4_RX IMX_GPIO_NR(5, 10)
#define TPS_RESET IMX_GPIO_NR(3, 24)
static iomux_v3_cfg_t const configure_pads[] = {
......@@ -88,7 +96,6 @@ static inline void init_pinmux(void)
gpio_request(WWAN_EN, "WWAN_EN");
gpio_request(WWAN_nRESET, "WWAN_nRESET");
gpio_request(WIFI_EN, "WIFI_EN");
gpio_request(HUB_EN, "HUB_EN");
gpio_request(HUB_nRESET, "HUB_nRESET");
......@@ -101,7 +108,11 @@ static inline void init_pinmux(void)
gpio_request(DSI_BIAS_EN, "DSI_BIAS_EN");
gpio_request(GPS_EN, "GPS_EN");
gpio_request(BL_EN, "BL_EN");
#endif
#ifndef CONSOLE_ON_UART4
gpio_request(WIFI_EN, "WIFI_EN");
gpio_direction_output(WIFI_EN, 0);
#endif /* CONSOLE_ON_UART4 */
#endif /* CONFIG_DM_GPIO */
gpio_direction_input(VOL_UP);
gpio_direction_input(VOL_DOWN);
......@@ -116,7 +127,6 @@ static inline void init_pinmux(void)
gpio_direction_output(WWAN_EN, 0);
gpio_direction_output(WWAN_nRESET, 1);
gpio_direction_output(WIFI_EN, 0);
gpio_direction_output(HUB_EN, 0);
gpio_direction_output(HUB_nRESET, 1);
......
......@@ -93,6 +93,18 @@ struct i2c_pads_info i2c_pad_info4 = {
},
};
#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
static iomux_v3_cfg_t const uart_pads[] = {
IMX8MQ_PAD_UART1_RXD__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART1_TXD__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART2_RXD__UART2_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART2_TXD__UART2_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART3_RXD__UART3_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_UART3_TXD__UART3_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_ECSPI2_SCLK__UART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
IMX8MQ_PAD_ECSPI2_MOSI__UART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
};
#define USDHC1_PWR_GPIO IMX_GPIO_NR(2, 10)
#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19)
......@@ -382,8 +394,6 @@ static int sdp_mmc_init(void)
extern int board_ecspi_init(void);
void board_init_f(ulong dummy)
{
int ret;
......@@ -393,7 +403,13 @@ void board_init_f(ulong dummy)
arch_cpu_init();
init_uart_clk(0);
init_uart_clk(CONSOLE_UART_CLK);
imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
#ifdef CONSOLE_ON_UART4
gpio_request(WIFI_EN, "WIFI_EN");
gpio_direction_output(WIFI_EN, 1);
#endif
board_early_init_f();
......
......@@ -79,6 +79,32 @@
#endif /* CONFIG_SPL_BUILD*/
#define CONSOLE_ON_UART1
#define CONFIG_MXC_UART
#define CONFIG_BAUDRATE 115200
#ifdef CONSOLE_ON_UART1
#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR
#define CONSOLE_UART_CLK 0
#define CONSOLE "ttymxc0"
#elif defined(CONSOLE_ON_UART2)
#define CONFIG_MXC_UART_BASE UART2_BASE_ADDR
#define CONSOLE_UART_CLK 1
#define CONSOLE "ttymxc1"
#elif defined(CONSOLE_ON_UART3)
#define CONFIG_MXC_UART_BASE UART3_BASE_ADDR
#define CONSOLE_UART_CLK 2
#define CONSOLE "ttymxc2"
#elif defined(CONSOLE_ON_UART4)
#define CONFIG_MXC_UART_BASE UART4_BASE_ADDR
#define CONSOLE_UART_CLK 3
#define CONSOLE "ttymxc3"
#else
#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR
#define CONSOLE_UART_CLK 0
#define CONSOLE "ttymxc0"
#endif
#define CONFIG_REMAKE_ELF
#define CONFIG_BOARD_EARLY_INIT_F
......@@ -126,7 +152,7 @@
"kernel_addr_r=0x80800000\0" \
"fdt_addr_r=0x83000000\0" \
"ramdisk_addr_r=0x83800000\0" \
"console=ttymxc0,115200\0" \
"console=" CONSOLE ",115200\0" \
"bootargs=${console}\0" \
"stdin=nc,serial\0" \
"stdout=nc,serial\0" \
......@@ -167,10 +193,6 @@
PHYS_SDRAM_SIZE - 32*1024*1024)
#define CONFIG_SYS_ALT_MEMTEST
#define CONFIG_BAUDRATE 115200
#define CONFIG_MXC_UART
#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR
/* Monitor Command Prompt */
#undef CONFIG_SYS_PROMPT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment