meta-ampere: Remove uart-mux control scripts

This commit removes support for controlling uart muxes from Host. The
uart muxes will now be default to connect to BMC on AC/DC. This
therefore can remove all the mux control scripts in obmc-console recipe.

Tested:
Upon BMC AC/DC
Can successfully ssh to Host's uart consoles via BMC's IP
Example: ssh root@<BMC_IP> -p 2200

Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: Ia4f421956f182dcb5d8e2e2ef8cb4eb404a15f2d
diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh
deleted file mode 100644
index 6976263..0000000
--- a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Ampere Computing LLC: UART MUX/DEMUX for CPU0 UART0,1,4 and CPU1 UART1
-# Usage: ampere_uartmux_ctrl.sh <CPU UART port number> <UARTx_MODE>
-#        <UARTx_MODE> of 1 sets CPU To HDR_CONN
-#        <UARTx_MODE> of 2 sets BMC to CPU (eg dropbear ssh server on port 2200)
-#
-# This can be called to set uart mux manually
-
-# shellcheck disable=SC2046
-
-if [ $# -lt 2 ]; then
-	exit 1
-fi
-
-case "$1" in
-	1) GPIO_UARTx_MODE0="uart1-mode0"
-		GPIO_UARTx_MODE1="uart1-mode1"
-	;;
-	2) GPIO_UARTx_MODE0="uart2-mode0"
-		GPIO_UARTx_MODE1="uart2-mode1"
-	;;
-	3) GPIO_UARTx_MODE0="uart3-mode0"
-		GPIO_UARTx_MODE1="uart3-mode1"
-	;;
-	4) GPIO_UARTx_MODE0="uart4-mode0"
-		GPIO_UARTx_MODE1="uart4-mode1"
-	;;
-	*) echo "Invalid UART port selection"
-		exit 1
-	;;
-esac
-
-echo "Ampere UART MUX CTRL UART port $1 to mode $2"
-
-case "$2" in
-	# To HDR
-	1) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=1
-		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=0
-		exit 0
-	;;
-	# To BMC
-	2) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=0
-		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=1
-		exit 0
-	;;
-	*) echo "Invalid UART mode selection"
-		exit 1
-	;;
-esac
diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service
deleted file mode 100644
index 64d443f..0000000
--- a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=%i Console Server
-ConditionPathExists=/etc/obmc-console/server.%i.conf
-
-[Service]
-# Instance ID is the VUART basename
-ExecStartPre=/usr/sbin/ampere_uart_console_setup.sh %i
-ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i
-SyslogIdentifier=%i-console-server
-Restart=always
diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend
index dd857f2..dc60e1a 100644
--- a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend
@@ -5,23 +5,9 @@
 CONSOLE_SERVER_CONF_FMT = "file://server.{0}.conf"
 CONSOLE_CLIENT_CONF_FMT = "file://client.{0}.conf"
 
-SRC_URI += " \
-             file://ampere_uartmux_ctrl.sh \
-             file://obmc-console@.service \
-           "
-
 SYSTEMD_SERVICE:${PN}:remove = "obmc-console-ssh.socket"
 
 FILES:${PN}:remove = "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf"
 
 PACKAGECONFIG:append = " concurrent-servers"
 
-do_install:append() {
-    # Script to switch host's uart muxes by GPIOs
-    install -d ${D}${sbindir}
-    install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}
-
-    # Overriding service to call ampere_uart_console_setup.sh at ExecStartPre
-    install -d ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/obmc-console@.service ${D}${systemd_system_unitdir}
-}
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/mtjade_platform_gpios_init.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/mtjade_platform_gpios_init.sh
index 76e4600..f3f7344 100644
--- a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/mtjade_platform_gpios_init.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/mtjade_platform_gpios_init.sh
@@ -37,6 +37,10 @@
 
 export output_high_gpios_in_bmc_reboot=(
     "bmc-vga-en-n"
+    "uart1-mode1"
+    "uart2-mode1"
+    "uart3-mode1"
+    "uart4-mode1"
 )
 
 export output_low_gpios_in_bmc_reboot=(
diff --git a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh b/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh
deleted file mode 100644
index 5a48d49..0000000
--- a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh -e
-#
-# Platform can add tty ports for console server to OBMC_CONSOLE_TTYS in their
-# bbappend. The target tty devices exposed by kernel will then start their
-# corresponding obmc-console-server instance and the
-# obmc-console@<tty-port>.service will execute this script to direct the uart
-# port of the <tty-port> to BMC
-
-tty="$1"
-uart=0
-
-case "${tty}" in
- "ttyS0") uart=1
- ;;
- "ttyS1") uart=2
- ;;
- "ttyS2") uart=3
- ;;
- "ttyS3") uart=4
- ;;
- *) echo "Invalid tty passed to $0. Exiting!"
-    exit 0;
- ;;
-esac
-
-# Default the host routing through the mux to use the BMC (2)
-# This allows the SoL console in webui, and the ssh port 2200, to work
-# upon startup. If UART transcievers are installed on the header and required,
-# this value should be set to 1
-/usr/sbin/ampere_uartmux_ctrl.sh ${uart} 2
diff --git a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
index bd75de6..77cd4b9 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
@@ -8,7 +8,6 @@
 SRC_URI += " \
              ${@compose_list(d, 'CONSOLE_SERVER_CONF_FMT', 'OBMC_CONSOLE_TTYS')} \
              ${@compose_list(d, 'CONSOLE_CLIENT_CONF_FMT', 'CONSOLE_CLIENT')} \
-             file://ampere_uart_console_setup.sh \
            "
 
 SYSTEMD_SERVICE:${PN}:append = " \
@@ -16,9 +15,6 @@
                                 "
 
 do_install:append() {
-    # Script to set host's uart muxes to BMC
-    install -m 0755 ${WORKDIR}/ampere_uart_console_setup.sh ${D}${sbindir}
-
     # Install the console client configurations
     install -m 0644 ${WORKDIR}/client.*.conf ${D}${sysconfdir}/${BPN}
 }
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
index 3bb4e1e..5b5b33a 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
@@ -70,6 +70,10 @@
     "cpld-user-mode"
     "jtag-srst-n"
     "host0-shd-req-n"
+    "uart1-mode1"
+    "uart2-mode1"
+    "uart3-mode1"
+    "uart4-mode1"
 )
 
 export output_low_gpios_in_bmc_reboot=(
@@ -79,6 +83,10 @@
     "led-fault"
     "spi-nor-access"
     "host0-special-boot"
+    "uart1-mode0"
+    "uart2-mode0"
+    "uart3-mode0"
+    "uart4-mode0"
 )
 
 export input_gpios_in_bmc_reboot=(
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh
deleted file mode 100644
index fa8d5e9..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uart_console_setup.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh -e
-#
-# Platform can add tty ports for console server to OBMC_CONSOLE_TTYS in their
-# bbappend. The target tty devices exposed by kernel will then start their
-# corresponding obmc-console-server instance and the
-# obmc-console@<tty-port>.service will execute this script to direct the uart
-# port of the <tty-port> to BMC
-
-tty="$1"
-uart=0
-
-case "${tty}" in
- "ttyS0") uart=1
- ;;
- "ttyS1") uart=2
- ;;
- "ttyS2") uart=3
- ;;
- "ttyS3") uart=4
- ;;
- "ttyS7")
-   # Socket 1 UART 1 connects directly to BMC UART 8
-   echo "Ampere UART MUX CTRL UART port 8 to mode 2"
-   exit 0
- ;;
- "ttyS8")
-   # Socket 1 UART 4 connects directly to BMC UART 9
-   echo "Ampere UART MUX CTRL UART port 9 to mode 2"
-   exit 0
- ;;
- *) echo "Invalid tty passed to $0. Exiting!"
-    exit 1;
- ;;
-esac
-
-# Default the host routing through the mux to use the BMC (2)
-# This allows the SoL console in webui, and the ssh port 2200, to work
-# upon startup. If UART transcievers are installed on the header and required,
-# this value should be set to 1
-/usr/sbin/ampere_uartmux_ctrl.sh ${uart} 2
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend
index c45db95..993b753 100644
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend
@@ -8,7 +8,6 @@
 SRC_URI += " \
              ${@compose_list(d, 'CONSOLE_SERVER_CONF_FMT', 'OBMC_CONSOLE_TTYS')} \
              ${@compose_list(d, 'CONSOLE_CLIENT_CONF_FMT', 'CONSOLE_CLIENT')} \
-             file://ampere_uart_console_setup.sh \
            "
 
 SYSTEMD_SERVICE:${PN}:append = " \
@@ -16,9 +15,6 @@
                                 "
 
 do_install:append() {
-    # Script to set host's uart muxes to BMC
-    install -m 0755 ${WORKDIR}/ampere_uart_console_setup.sh ${D}${sbindir}
-
     # Install the console client configurations
     install -m 0644 ${WORKDIR}/client.*.conf ${D}${sysconfdir}/${BPN}
 }