blob: 7f804c7e8e15c01672e29a17215c1c696dc2f619 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Mariusz Szafranskia4041332017-08-02 17:28:17 +02002
3#include <stdint.h>
Felix Held4b58d14f2020-09-11 15:54:30 +02004#include <console/uart.h>
Mariusz Szafranskia4041332017-08-02 17:28:17 +02005#include <device/pci_def.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02006#include <device/pci_ops.h>
Mariusz Szafranskia4041332017-08-02 17:28:17 +02007#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 Helde3a12472020-09-11 15:47:09 +020012uintptr_t uart_platform_base(unsigned int idx)
Mariusz Szafranskia4041332017-08-02 17:28:17 +020013{
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}