18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
38c2ecf20Sopenharmony_ci * reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two
68c2ecf20Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the NetLogic
98c2ecf20Sopenharmony_ci * license below:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
138c2ecf20Sopenharmony_ci * are met:
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
168c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
178c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
188c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
198c2ecf20Sopenharmony_ci *    the documentation and/or other materials provided with the
208c2ecf20Sopenharmony_ci *    distribution.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
238c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
248c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
258c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
268c2ecf20Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
278c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
288c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
298c2ecf20Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
308c2ecf20Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
318c2ecf20Sopenharmony_ci * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
328c2ecf20Sopenharmony_ci * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef __NLM_HAL_BRIDGE_H__
368c2ecf20Sopenharmony_ci#define __NLM_HAL_BRIDGE_H__
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/**
398c2ecf20Sopenharmony_ci* @file_name mio.h
408c2ecf20Sopenharmony_ci* @author Netlogic Microsystems
418c2ecf20Sopenharmony_ci* @brief Basic definitions of XLP memory and io subsystem
428c2ecf20Sopenharmony_ci*/
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * BRIDGE specific registers
468c2ecf20Sopenharmony_ci *
478c2ecf20Sopenharmony_ci * These registers start after the PCIe header, which has 0x40
488c2ecf20Sopenharmony_ci * standard entries
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_ci#define BRIDGE_MODE			0x00
518c2ecf20Sopenharmony_ci#define BRIDGE_PCI_CFG_BASE		0x01
528c2ecf20Sopenharmony_ci#define BRIDGE_PCI_CFG_LIMIT		0x02
538c2ecf20Sopenharmony_ci#define BRIDGE_PCIE_CFG_BASE		0x03
548c2ecf20Sopenharmony_ci#define BRIDGE_PCIE_CFG_LIMIT		0x04
558c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR0		0x05
568c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR1		0x06
578c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR2		0x07
588c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR3		0x08
598c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR4		0x09
608c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR5		0x0a
618c2ecf20Sopenharmony_ci#define BRIDGE_BUSNUM_BAR6		0x0b
628c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_BAR0		0x0c
638c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_BAR1		0x0d
648c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_BAR2		0x0e
658c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_BAR3		0x0f
668c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_LIMIT0		0x10
678c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_LIMIT1		0x11
688c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_LIMIT2		0x12
698c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_LIMIT3		0x13
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define BRIDGE_DRAM_BAR(i)		(0x14 + (i))
728c2ecf20Sopenharmony_ci#define BRIDGE_DRAM_LIMIT(i)		(0x1c + (i))
738c2ecf20Sopenharmony_ci#define BRIDGE_DRAM_NODE_TRANSLN(i)	(0x24 + (i))
748c2ecf20Sopenharmony_ci#define BRIDGE_DRAM_CHNL_TRANSLN(i)	(0x2c + (i))
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE0		0x34
778c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE1		0x35
788c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE2		0x36
798c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE3		0x37
808c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT0		0x38
818c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT1		0x39
828c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT2		0x3a
838c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT3		0x3b
848c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE0		0x3c
858c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE1		0x3d
868c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE2		0x3e
878c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE3		0x3f
888c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT0		0x40
898c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT1		0x41
908c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT2		0x42
918c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT3		0x43
928c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE4		0x44
938c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE5		0x45
948c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_BASE6		0x46
958c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT4		0x47
968c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT5		0x48
978c2ecf20Sopenharmony_ci#define BRIDGE_PCIEMEM_LIMIT6		0x49
988c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE4		0x4a
998c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE5		0x4b
1008c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_BASE6		0x4c
1018c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT4		0x4d
1028c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT5		0x4e
1038c2ecf20Sopenharmony_ci#define BRIDGE_PCIEIO_LIMIT6		0x4f
1048c2ecf20Sopenharmony_ci#define BRIDGE_NBU_EVENT_CNT_CTL	0x50
1058c2ecf20Sopenharmony_ci#define BRIDGE_EVNTCTR1_LOW		0x51
1068c2ecf20Sopenharmony_ci#define BRIDGE_EVNTCTR1_HI		0x52
1078c2ecf20Sopenharmony_ci#define BRIDGE_EVNT_CNT_CTL2		0x53
1088c2ecf20Sopenharmony_ci#define BRIDGE_EVNTCTR2_LOW		0x54
1098c2ecf20Sopenharmony_ci#define BRIDGE_EVNTCTR2_HI		0x55
1108c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_MATCH0		0x56
1118c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_MATCH1		0x57
1128c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_MATCH_LOW	0x58
1138c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_MATCH_HI	0x59
1148c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_CTRL		0x5a
1158c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_INIT		0x5b
1168c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_ACCESS		0x5c
1178c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_READ_DATA0	0x5d
1188c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_READ_DATA1	0x5d
1198c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_READ_DATA2	0x5f
1208c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_READ_DATA3	0x60
1218c2ecf20Sopenharmony_ci#define BRIDGE_TRACEBUF_STATUS		0x61
1228c2ecf20Sopenharmony_ci#define BRIDGE_ADDRESS_ERROR0		0x62
1238c2ecf20Sopenharmony_ci#define BRIDGE_ADDRESS_ERROR1		0x63
1248c2ecf20Sopenharmony_ci#define BRIDGE_ADDRESS_ERROR2		0x64
1258c2ecf20Sopenharmony_ci#define BRIDGE_TAG_ECC_ADDR_ERROR0	0x65
1268c2ecf20Sopenharmony_ci#define BRIDGE_TAG_ECC_ADDR_ERROR1	0x66
1278c2ecf20Sopenharmony_ci#define BRIDGE_TAG_ECC_ADDR_ERROR2	0x67
1288c2ecf20Sopenharmony_ci#define BRIDGE_LINE_FLUSH0		0x68
1298c2ecf20Sopenharmony_ci#define BRIDGE_LINE_FLUSH1		0x69
1308c2ecf20Sopenharmony_ci#define BRIDGE_NODE_ID			0x6a
1318c2ecf20Sopenharmony_ci#define BRIDGE_ERROR_INTERRUPT_EN	0x6b
1328c2ecf20Sopenharmony_ci#define BRIDGE_PCIE0_WEIGHT		0x2c0
1338c2ecf20Sopenharmony_ci#define BRIDGE_PCIE1_WEIGHT		0x2c1
1348c2ecf20Sopenharmony_ci#define BRIDGE_PCIE2_WEIGHT		0x2c2
1358c2ecf20Sopenharmony_ci#define BRIDGE_PCIE3_WEIGHT		0x2c3
1368c2ecf20Sopenharmony_ci#define BRIDGE_USB_WEIGHT		0x2c4
1378c2ecf20Sopenharmony_ci#define BRIDGE_NET_WEIGHT		0x2c5
1388c2ecf20Sopenharmony_ci#define BRIDGE_POE_WEIGHT		0x2c6
1398c2ecf20Sopenharmony_ci#define BRIDGE_CMS_WEIGHT		0x2c7
1408c2ecf20Sopenharmony_ci#define BRIDGE_DMAENG_WEIGHT		0x2c8
1418c2ecf20Sopenharmony_ci#define BRIDGE_SEC_WEIGHT		0x2c9
1428c2ecf20Sopenharmony_ci#define BRIDGE_COMP_WEIGHT		0x2ca
1438c2ecf20Sopenharmony_ci#define BRIDGE_GIO_WEIGHT		0x2cb
1448c2ecf20Sopenharmony_ci#define BRIDGE_FLASH_WEIGHT		0x2cc
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* FIXME verify */
1478c2ecf20Sopenharmony_ci#define BRIDGE_9XX_FLASH_BAR(i)		(0x11 + (i))
1488c2ecf20Sopenharmony_ci#define BRIDGE_9XX_FLASH_BAR_LIMIT(i)	(0x15 + (i))
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define BRIDGE_9XX_DRAM_BAR(i)		(0x19 + (i))
1518c2ecf20Sopenharmony_ci#define BRIDGE_9XX_DRAM_LIMIT(i)	(0x29 + (i))
1528c2ecf20Sopenharmony_ci#define BRIDGE_9XX_DRAM_NODE_TRANSLN(i)	(0x39 + (i))
1538c2ecf20Sopenharmony_ci#define BRIDGE_9XX_DRAM_CHNL_TRANSLN(i)	(0x49 + (i))
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define BRIDGE_9XX_ADDRESS_ERROR0	0x9d
1568c2ecf20Sopenharmony_ci#define BRIDGE_9XX_ADDRESS_ERROR1	0x9e
1578c2ecf20Sopenharmony_ci#define BRIDGE_9XX_ADDRESS_ERROR2	0x9f
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_BASE0	0x59
1608c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_BASE1	0x5a
1618c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_BASE2	0x5b
1628c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_BASE3	0x5c
1638c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_LIMIT0	0x5d
1648c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_LIMIT1	0x5e
1658c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_LIMIT2	0x5f
1668c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEMEM_LIMIT3	0x60
1678c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_BASE0		0x61
1688c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_BASE1		0x62
1698c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_BASE2		0x63
1708c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_BASE3		0x64
1718c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_LIMIT0	0x65
1728c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_LIMIT1	0x66
1738c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_LIMIT2	0x67
1748c2ecf20Sopenharmony_ci#define BRIDGE_9XX_PCIEIO_LIMIT3	0x68
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define nlm_read_bridge_reg(b, r)	nlm_read_reg(b, r)
1798c2ecf20Sopenharmony_ci#define nlm_write_bridge_reg(b, r, v)	nlm_write_reg(b, r, v)
1808c2ecf20Sopenharmony_ci#define nlm_get_bridge_pcibase(node)	nlm_pcicfg_base(cpu_is_xlp9xx() ? \
1818c2ecf20Sopenharmony_ci		XLP9XX_IO_BRIDGE_OFFSET(node) : XLP_IO_BRIDGE_OFFSET(node))
1828c2ecf20Sopenharmony_ci#define nlm_get_bridge_regbase(node)	\
1838c2ecf20Sopenharmony_ci			(nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ)
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
1868c2ecf20Sopenharmony_ci#endif /* __NLM_HAL_BRIDGE_H__ */
187