Andrei Kartashev | c12c397 | 2021-11-28 22:41:06 +0300 | [diff] [blame] | 1 | #!/bin/bash -eu |
| 2 | |
| 3 | function usage() |
| 4 | { |
| 5 | echo "Usage: $(basename "$0") init|reset" |
| 6 | } |
| 7 | |
| 8 | if [ "$#" -ne "1" ] ; then |
| 9 | usage |
| 10 | exit 1; |
| 11 | fi |
| 12 | |
| 13 | cmd="${1}" |
| 14 | UART_ROUTING_PATH="/sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart-routing" |
| 15 | |
| 16 | case "${cmd}" in |
| 17 | init) |
| 18 | echo -n "uart3" > ${UART_ROUTING_PATH}/uart1 |
| 19 | echo -n "uart1" > ${UART_ROUTING_PATH}/uart3 |
| 20 | echo -n "io1" > ${UART_ROUTING_PATH}/uart4 |
| 21 | echo -n "uart4" > ${UART_ROUTING_PATH}/io1 |
| 22 | ;; |
| 23 | reset) |
| 24 | echo -n "io1" > ${UART_ROUTING_PATH}/uart1 |
| 25 | echo -n "io3" > ${UART_ROUTING_PATH}/uart3 |
| 26 | echo -n "io4" > ${UART_ROUTING_PATH}/uart4 |
| 27 | echo -n "uart1" > ${UART_ROUTING_PATH}/io1 |
| 28 | ;; |
| 29 | *) |
| 30 | usage |
| 31 | exit 1; |
| 32 | ;; |
| 33 | esac |