diff options
author | jmbills <jason.m.bills@intel.com> | 2021-06-25 18:34:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 18:34:41 +0300 |
commit | c6b1c6ba7a01b7987d65d61c262c44c320193108 (patch) | |
tree | c31fba338a65c86741b16e061d66e0e060e3b768 /meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh | |
parent | e7436234669703196c5ed56f33050d2dc19127cd (diff) | |
parent | defdca82c107f46e980c84bffb1b2c1263522fa0 (diff) | |
download | openbmc-c6b1c6ba7a01b7987d65d61c262c44c320193108.tar.xz |
Update
Diffstat (limited to 'meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh')
-rw-r--r-- | meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh b/meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh new file mode 100644 index 000000000..27407783e --- /dev/null +++ b/meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) 2020 Ampere Computing LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Ampere Computing LLC mtjade: 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 BSP +# <UARTx_MODE> of 2 sets SCP1 to SI2 +function set_gpio_ctrl() { + echo $1 > /sys/class/gpio/export + echo $2 > /sys/class//gpio/gpio$1/direction + echo $3 > /sys/class/gpio/gpio$1/value + echo $1 > /sys/class/gpio/unexport +} + + +if [ $# -lt 1 ]; then + exit 1 +fi + +echo "Ampere UART MUX CTRL UART port $1 to mode" > /dev/ttyS0 + +case "$1" in + ttyS1) + set_gpio_ctrl 167 out 1 + ;; + ttyS3) + set_gpio_ctrl 161 out 1 + set_gpio_ctrl 183 out 1 + set_gpio_ctrl 198 out 0 + ;; + *) + echo "Invalid tty passed to $0. Exiting!" > /dev/ttyS0 + ;; +esac + |