The GPIOs used for UART2 RX and TX were reversed.
[coreboot.git] / src / southbridge / amd / cs5536 / cs5536.c
index 69427f5494b2c48b9e9ba2268d9fe4b06e2cce35..9f4e90ed01d1bfe28b6a9b5c1caa836036f7b205 100644 (file)
@@ -1,21 +1,21 @@
 /*
-* This file is part of the LinuxBIOS project.
-*
-* Copyright (C) 2007 Advanced Micro Devices
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA     02110-1301 USA
-*/
+ * This file is part of the LinuxBIOS project.
+ *
+ * Copyright (C) 2007 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.        See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
 
 #include <arch/io.h>
 #include <device/device.h>
@@ -316,9 +316,6 @@ static void uarts_init(struct southbridge_amd_cs5536_config *sb)
 
        } else {
                /* Reset and disable COM1 */
-               printk_err("Not disabling COM1 due to a bug ...\n");
-               /* for now, don't do this! */
-               return;
                msr = rdmsr(MDD_UART1_CONF);
                msr.lo = 1;     // reset
                wrmsr(MDD_UART1_CONF, msr);
@@ -327,7 +324,7 @@ static void uarts_init(struct southbridge_amd_cs5536_config *sb)
 
                /* Disable the IRQ */
                msr = rdmsr(MDD_LEG_IO);
-               msr.lo |= ~(0xF << 16);
+               msr.lo &= ~(0xF << 16);
                wrmsr(MDD_LEG_IO, msr);
        }
 
@@ -359,19 +356,19 @@ static void uarts_init(struct southbridge_amd_cs5536_config *sb)
                msr.lo |= sb->com2_irq << 28;
                wrmsr(MDD_IRQM_YHIGH, msr);
 
-               /* GPIO3 - UART2_RX */
-               /* Set: Output Enable  (0x4) */
-               outl(GPIOL_3_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
+               /* GPIO4 - UART2_RX */
+               /* Set: Output Enable (0x4) */
+               outl(GPIOL_4_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
                /* Set: OUTAUX1 Select (0x10) */
-               outl(GPIOL_3_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
+               outl(GPIOL_4_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
 
-               /* GPIO4 - UART2_TX */
-               /* Set: Input Enable   (0x20) */
-               outl(GPIOL_4_SET, gpio_addr + GPIOL_INPUT_ENABLE);
-               /* Set: INAUX1 Select  (0x34) */
-               outl(GPIOL_4_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
+               /* GPIO3 - UART2_TX */
+               /* Set: Input Enable (0x20) */
+               outl(GPIOL_3_SET, gpio_addr + GPIOL_INPUT_ENABLE);
+               /* Set: INAUX1 Select (0x34) */
+               outl(GPIOL_3_SET, gpio_addr + GPIOL_IN_AUX1_SELECT);
 
-               /* Set: GPIO 3 + 3 Pull Up         (0x18) */
+               /* Set: GPIO 3 and 4 Pull Up (0x18) */
                outl(GPIOL_3_SET | GPIOL_4_SET,
                     gpio_addr + GPIOL_PULLUP_ENABLE);
 
@@ -391,7 +388,7 @@ static void uarts_init(struct southbridge_amd_cs5536_config *sb)
 
                /* Disable the IRQ */
                msr = rdmsr(MDD_LEG_IO);
-               msr.lo |= ~(0xF << 20);
+               msr.lo &= ~(0xF << 20);
                wrmsr(MDD_LEG_IO, msr);
        }
 }