Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google Inc. |
| 5 | * Copyright (C) 2015 Intel Corp. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <soc/gpio.h> |
| 19 | #include <soc/lpc.h> |
| 20 | #include <soc/pci_devs.h> |
| 21 | #include <soc/romstage.h> |
| 22 | |
| 23 | /* |
| 24 | * return family number and internal pad number in that community |
| 25 | * by pad number and which community it is in. |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | |
| 30 | /* family number in high byte and inner pad number in lowest byte */ |
| 31 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 32 | void car_mainboard_pre_console_init(void) |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 33 | { |
| 34 | uint32_t reg; |
| 35 | uint32_t *pad_config_reg; |
| 36 | |
| 37 | /* Enable the UART hardware for COM1. */ |
| 38 | reg = 1; |
| 39 | pci_write_config32(PCI_DEV(0, LPC_DEV, 0), UART_CONT, reg); |
| 40 | |
| 41 | /* |
| 42 | * Set up the pads to select the UART function |
| 43 | * AD12 SW16(UART1_DATAIN/UART0_DATAIN) - Setting Mode 2 for UART0_RXD |
| 44 | * AD10 SW20(UART1_DATAOUT/UART0_DATAOUT) - Setting Mode 2 for UART0_TXD |
| 45 | */ |
| 46 | pad_config_reg = gpio_pad_config_reg(GP_SOUTHWEST, UART1_RXD_PAD); |
| 47 | write32(pad_config_reg, SET_PAD_MODE_SELECTION(PAD_CONFIG0_DEFAULT0, |
| 48 | M2)); |
| 49 | |
| 50 | pad_config_reg = gpio_pad_config_reg(GP_SOUTHWEST, UART1_TXD_PAD); |
| 51 | write32(pad_config_reg, SET_PAD_MODE_SELECTION(PAD_CONFIG0_DEFAULT0, |
| 52 | M2)); |
| 53 | } |