From b4856a2d0775ebb50948b4f431725b1e92112599 Mon Sep 17 00:00:00 2001 From: hexkyz Date: Mon, 9 Mar 2020 19:38:56 +0000 Subject: [PATCH] exo/fusee/sept: fix uart pinmuxing (thanks @CTCaer and @TuxSH) --- exosphere/src/uart.c | 36 +++++++++++++++++----------------- fusee/fusee-primary/src/uart.c | 32 +++++++++++++++--------------- sept/sept-secondary/src/uart.c | 32 +++++++++++++++--------------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/exosphere/src/uart.c b/exosphere/src/uart.c index 4f4eb5f90..020dbd583 100644 --- a/exosphere/src/uart.c +++ b/exosphere/src/uart.c @@ -21,12 +21,12 @@ static inline void uart_wait_cycles(uint32_t baud, uint32_t num) { - wait((num * 1000000 + 16 * baud - 1) / (16 * baud)); + udelay((num * 1000000 + 16 * baud - 1) / (16 * baud)); } static inline void uart_wait_syms(uint32_t baud, uint32_t num) { - wait((num * 1000000 + baud - 1) / baud); + udelay((num * 1000000 + baud - 1) / baud); } void uart_config(UartDevice dev) { @@ -34,28 +34,28 @@ void uart_config(UartDevice dev) { switch (dev) { case UART_A: - pinmux->uart1_tx = 0; - pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart1_rts = 0; - pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart1_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_UP | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rts = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_B: - pinmux->uart2_tx = 0; - pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart2_rts = 0; - pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart2_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_C: - pinmux->uart3_tx = 0; - pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart3_rts = 0; - pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart3_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_D: - pinmux->uart4_tx = 0; - pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart4_rts = 0; - pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart4_tx = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_E: /* Unused. */ diff --git a/fusee/fusee-primary/src/uart.c b/fusee/fusee-primary/src/uart.c index 4b4bcd35a..020dbd583 100644 --- a/fusee/fusee-primary/src/uart.c +++ b/fusee/fusee-primary/src/uart.c @@ -34,28 +34,28 @@ void uart_config(UartDevice dev) { switch (dev) { case UART_A: - pinmux->uart1_tx = 0; - pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart1_rts = 0; - pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart1_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_UP | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rts = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_B: - pinmux->uart2_tx = 0; - pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart2_rts = 0; - pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart2_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_C: - pinmux->uart3_tx = 0; - pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart3_rts = 0; - pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart3_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_D: - pinmux->uart4_tx = 0; - pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart4_rts = 0; - pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart4_tx = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_E: /* Unused. */ diff --git a/sept/sept-secondary/src/uart.c b/sept/sept-secondary/src/uart.c index 4b4bcd35a..020dbd583 100644 --- a/sept/sept-secondary/src/uart.c +++ b/sept/sept-secondary/src/uart.c @@ -34,28 +34,28 @@ void uart_config(UartDevice dev) { switch (dev) { case UART_A: - pinmux->uart1_tx = 0; - pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart1_rts = 0; - pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart1_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_UP | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_rts = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart1_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_B: - pinmux->uart2_tx = 0; - pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart2_rts = 0; - pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart2_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart2_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_C: - pinmux->uart3_tx = 0; - pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart3_rts = 0; - pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart3_tx = (0 | 0 | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart3_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_NONE | PINMUX_SELECT_FUNCTION0); break; case UART_D: - pinmux->uart4_tx = 0; - pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_PULL_UP); - pinmux->uart4_rts = 0; - pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_PULL_DOWN); + pinmux->uart4_tx = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rx = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_rts = (0 | 0 | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); + pinmux->uart4_cts = (PINMUX_INPUT | PINMUX_TRISTATE | PINMUX_PULL_DOWN | PINMUX_SELECT_FUNCTION0); break; case UART_E: /* Unused. */