2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
10 /* Message Bus Ports */
11 #define MSG_PORT_MEM_ARBITER 0x00
12 #define MSG_PORT_HOST_BRIDGE 0x03
13 #define MSG_PORT_RMU 0x04
14 #define MSG_PORT_MEM_MGR 0x05
15 #define MSG_PORT_USB_AFE 0x14
16 #define MSG_PORT_PCIE_AFE 0x16
17 #define MSG_PORT_SOC_UNIT 0x31
19 /* Port 0x00: Memory Arbiter Message Port Registers */
21 /* Enhanced Configuration Space */
24 /* Port 0x03: Host Bridge Message Port Registers */
26 /* Host Miscellaneous Controls 2 */
29 #define HMISC2_SEGE 0x00000002
30 #define HMISC2_SEGF 0x00000004
31 #define HMISC2_SEGAB 0x00000010
33 /* Host Memory I/O Boundary */
36 /* Extended Configuration Space */
39 /* Port 0x04: Remote Management Unit Message Port Registers */
41 /* ACPI PBLK Base Address Register */
44 /* SPI DMA Base Address Register */
45 #define SPI_DMA_BA 0x7a
47 /* Port 0x05: Memory Manager Message Port Registers */
49 /* eSRAM Block Page Control */
50 #define ESRAM_BLK_CTRL 0x82
51 #define ESRAM_BLOCK_MODE 0x10000000
53 /* Port 0x14: USB2 AFE Unit Port Registers */
55 #define USB2_GLOBAL_PORT 0x4001
56 #define USB2_PLL1 0x7f02
57 #define USB2_PLL2 0x7f03
58 #define USB2_COMPBG 0x7f04
60 /* Port 0x16: PCIe AFE Unit Port Registers */
62 #define PCIE_RXPICTRL0_L0 0x2080
63 #define PCIE_RXPICTRL0_L1 0x2180
65 /* Port 0x31: SoC Unit Port Registers */
67 /* PCIe Controller Config */
69 #define PCIE_CTLR_PRI_RST 0x00010000
70 #define PCIE_PHY_SB_RST 0x00020000
71 #define PCIE_CTLR_SB_RST 0x00040000
72 #define PCIE_PHY_LANE_RST 0x00090000
73 #define PCIE_CTLR_MAIN_RST 0x00100000
76 #define DRAM_BASE 0x00000000
77 #define DRAM_MAX_SIZE 0x80000000
80 #define ESRAM_SIZE 0x80000
82 /* Memory BAR Enable */
83 #define MEM_BAR_EN 0x00000001
86 #define IO_BAR_EN 0x80000000
88 /* 64KiB of RMU binary in flash */
89 #define RMU_BINARY_SIZE 0x10000
91 /* Legacy Bridge PCI Configuration Registers */
93 #define LB_PM1BLK 0x48
94 #define LB_GPE0BLK 0x4c
96 #define LB_PABCDRC 0x60
97 #define LB_PEFGHRC 0x64
105 /* Root Complex Register Block */
120 * qrk_pci_read_config_dword() - Read a configuration value
122 * @dev: PCI device address: bus, device and function
123 * @offset: Dword offset within the device's configuration space
124 * @valuep: Place to put the returned value
126 * Note: This routine is inlined to provide better performance on Quark
128 static inline void qrk_pci_read_config_dword(pci_dev_t dev, int offset,
131 outl(dev | offset | PCI_CFG_EN, PCI_REG_ADDR);
132 *valuep = inl(PCI_REG_DATA);
136 * qrk_pci_write_config_dword() - Write a PCI configuration value
138 * @dev: PCI device address: bus, device and function
139 * @offset: Dword offset within the device's configuration space
140 * @value: Value to write
142 * Note: This routine is inlined to provide better performance on Quark
144 static inline void qrk_pci_write_config_dword(pci_dev_t dev, int offset,
147 outl(dev | offset | PCI_CFG_EN, PCI_REG_ADDR);
148 outl(value, PCI_REG_DATA);
152 * board_assert_perst() - Assert the PERST# pin
154 * The CPU interface to the PERST# signal on Quark is platform dependent.
155 * Board-specific codes need supply this routine to assert PCIe slot reset.
157 * The tricky part in this routine is that any APIs that may trigger PCI
158 * enumeration process are strictly forbidden, as any access to PCIe root
159 * port's configuration registers will cause system hang while it is held
162 void board_assert_perst(void);
165 * board_deassert_perst() - De-assert the PERST# pin
167 * The CPU interface to the PERST# signal on Quark is platform dependent.
168 * Board-specific codes need supply this routine to de-assert PCIe slot reset.
170 * The tricky part in this routine is that any APIs that may trigger PCI
171 * enumeration process are strictly forbidden, as any access to PCIe root
172 * port's configuration registers will cause system hang while it is held
175 void board_deassert_perst(void);
177 #endif /* __ASSEMBLY__ */
179 #endif /* _QUARK_H_ */