Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Felix Held | 4b58d14f | 2020-09-11 15:54:30 +0200 | [diff] [blame] | 4 | #include <console/uart.h> |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 5 | #include <device/pci_def.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 6 | #include <device/pci_ops.h> |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 7 | #include <soc/uart.h> |
| 8 | |
| 9 | #define MY_PCI_DEV(SEGBUS, DEV, FN) \ |
| 10 | ((((SEGBUS)&0xFFF) << 20) | (((DEV)&0x1F) << 15) | (((FN)&0x07) << 12)) |
| 11 | |
Felix Held | e3a1247 | 2020-09-11 15:47:09 +0200 | [diff] [blame] | 12 | uintptr_t uart_platform_base(unsigned int idx) |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 13 | { |
| 14 | return (uintptr_t)pci_io_read_config32( |
| 15 | MY_PCI_DEV(0, CONFIG_HSUART_DEV, idx), |
| 16 | PCI_BASE_ADDRESS_1) + |
| 17 | SIZE_OF_HSUART_RES * idx; |
| 18 | } |