162306a36Sopenharmony_ci/****************************************************************************/
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci/*
462306a36Sopenharmony_ci *	m54xxpci.h -- ColdFire 547x and 548x PCI bus support
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci *	(C) Copyright 2011,  Greg Ungerer <gerg@uclinux.org>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
962306a36Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
1062306a36Sopenharmony_ci * for more details.
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/****************************************************************************/
1462306a36Sopenharmony_ci#ifndef	M54XXPCI_H
1562306a36Sopenharmony_ci#define	M54XXPCI_H
1662306a36Sopenharmony_ci/****************************************************************************/
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/*
1962306a36Sopenharmony_ci *	The core set of PCI support registers are mapped into the MBAR region.
2062306a36Sopenharmony_ci */
2162306a36Sopenharmony_ci#define	PCIIDR		(CONFIG_MBAR + 0xb00)	/* PCI device/vendor ID */
2262306a36Sopenharmony_ci#define	PCISCR		(CONFIG_MBAR + 0xb04)	/* PCI status/command */
2362306a36Sopenharmony_ci#define	PCICCRIR	(CONFIG_MBAR + 0xb08)	/* PCI class/revision */
2462306a36Sopenharmony_ci#define	PCICR1		(CONFIG_MBAR + 0xb0c)	/* PCI configuration 1 */
2562306a36Sopenharmony_ci#define	PCIBAR0		(CONFIG_MBAR + 0xb10)	/* PCI base address 0 */
2662306a36Sopenharmony_ci#define	PCIBAR1		(CONFIG_MBAR + 0xb14)	/* PCI base address 1 */
2762306a36Sopenharmony_ci#define	PCICCPR		(CONFIG_MBAR + 0xb28)	/* PCI cardbus CIS pointer */
2862306a36Sopenharmony_ci#define	PCISID		(CONFIG_MBAR + 0xb2c)	/* PCI subsystem IDs */
2962306a36Sopenharmony_ci#define	PCIERBAR	(CONFIG_MBAR + 0xb30)	/* PCI expansion ROM */
3062306a36Sopenharmony_ci#define	PCICPR		(CONFIG_MBAR + 0xb34)	/* PCI capabilities pointer */
3162306a36Sopenharmony_ci#define	PCICR2		(CONFIG_MBAR + 0xb3c)	/* PCI configuration 2 */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define	PCIGSCR		(CONFIG_MBAR + 0xb60)	/* Global status/control */
3462306a36Sopenharmony_ci#define	PCITBATR0	(CONFIG_MBAR + 0xb64)	/* Target base translation 0 */
3562306a36Sopenharmony_ci#define	PCITBATR1	(CONFIG_MBAR + 0xb68)	/* Target base translation 1 */
3662306a36Sopenharmony_ci#define	PCITCR		(CONFIG_MBAR + 0xb6c)	/* Target control */
3762306a36Sopenharmony_ci#define	PCIIW0BTAR	(CONFIG_MBAR + 0xb70)	/* Initiator window 0 */
3862306a36Sopenharmony_ci#define	PCIIW1BTAR	(CONFIG_MBAR + 0xb74)	/* Initiator window 1 */
3962306a36Sopenharmony_ci#define	PCIIW2BTAR	(CONFIG_MBAR + 0xb78)	/* Initiator window 2 */
4062306a36Sopenharmony_ci#define	PCIIWCR		(CONFIG_MBAR + 0xb80)	/* Initiator window config */
4162306a36Sopenharmony_ci#define	PCIICR		(CONFIG_MBAR + 0xb84)	/* Initiator control */
4262306a36Sopenharmony_ci#define	PCIISR		(CONFIG_MBAR + 0xb88)	/* Initiator status */
4362306a36Sopenharmony_ci#define	PCICAR		(CONFIG_MBAR + 0xbf8)	/* Configuration address */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define	PCITPSR		(CONFIG_MBAR + 0x8400)	/* TX packet size */
4662306a36Sopenharmony_ci#define	PCITSAR		(CONFIG_MBAR + 0x8404)	/* TX start address */
4762306a36Sopenharmony_ci#define	PCITTCR		(CONFIG_MBAR + 0x8408)	/* TX transaction control */
4862306a36Sopenharmony_ci#define	PCITER		(CONFIG_MBAR + 0x840c)	/* TX enables */
4962306a36Sopenharmony_ci#define	PCITNAR		(CONFIG_MBAR + 0x8410)	/* TX next address */
5062306a36Sopenharmony_ci#define	PCITLWR		(CONFIG_MBAR + 0x8414)	/* TX last word */
5162306a36Sopenharmony_ci#define	PCITDCR		(CONFIG_MBAR + 0x8418)	/* TX done counts */
5262306a36Sopenharmony_ci#define	PCITSR		(CONFIG_MBAR + 0x841c)	/* TX status */
5362306a36Sopenharmony_ci#define	PCITFDR		(CONFIG_MBAR + 0x8440)	/* TX FIFO data */
5462306a36Sopenharmony_ci#define	PCITFSR		(CONFIG_MBAR + 0x8444)	/* TX FIFO status */
5562306a36Sopenharmony_ci#define	PCITFCR		(CONFIG_MBAR + 0x8448)	/* TX FIFO control */
5662306a36Sopenharmony_ci#define	PCITFAR		(CONFIG_MBAR + 0x844c)	/* TX FIFO alarm */
5762306a36Sopenharmony_ci#define	PCITFRPR	(CONFIG_MBAR + 0x8450)	/* TX FIFO read pointer */
5862306a36Sopenharmony_ci#define	PCITFWPR	(CONFIG_MBAR + 0x8454)	/* TX FIFO write pointer */
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define	PCIRPSR		(CONFIG_MBAR + 0x8480)	/* RX packet size */
6162306a36Sopenharmony_ci#define	PCIRSAR		(CONFIG_MBAR + 0x8484)	/* RX start address */
6262306a36Sopenharmony_ci#define	PCIRTCR		(CONFIG_MBAR + 0x8488)	/* RX transaction control */
6362306a36Sopenharmony_ci#define	PCIRER		(CONFIG_MBAR + 0x848c)	/* RX enables */
6462306a36Sopenharmony_ci#define	PCIRNAR		(CONFIG_MBAR + 0x8490)	/* RX next address */
6562306a36Sopenharmony_ci#define	PCIRDCR		(CONFIG_MBAR + 0x8498)	/* RX done counts */
6662306a36Sopenharmony_ci#define	PCIRSR		(CONFIG_MBAR + 0x849c)	/* RX status */
6762306a36Sopenharmony_ci#define	PCIRFDR		(CONFIG_MBAR + 0x84c0)	/* RX FIFO data */
6862306a36Sopenharmony_ci#define	PCIRFSR		(CONFIG_MBAR + 0x84c4)	/* RX FIFO status */
6962306a36Sopenharmony_ci#define	PCIRFCR		(CONFIG_MBAR + 0x84c8)	/* RX FIFO control */
7062306a36Sopenharmony_ci#define	PCIRFAR		(CONFIG_MBAR + 0x84cc)	/* RX FIFO alarm */
7162306a36Sopenharmony_ci#define	PCIRFRPR	(CONFIG_MBAR + 0x84d0)	/* RX FIFO read pointer */
7262306a36Sopenharmony_ci#define	PCIRFWPR	(CONFIG_MBAR + 0x84d4)	/* RX FIFO write pointer */
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define	PACR		(CONFIG_MBAR + 0xc00)	/* PCI arbiter control */
7562306a36Sopenharmony_ci#define	PASR		(CONFIG_MBAR + 0xc04)	/* PCI arbiter status */
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*
7862306a36Sopenharmony_ci *	Definitions for the Global status and control register.
7962306a36Sopenharmony_ci */
8062306a36Sopenharmony_ci#define	PCIGSCR_PE	0x20000000		/* Parity error detected */
8162306a36Sopenharmony_ci#define	PCIGSCR_SE	0x10000000		/* System error detected */
8262306a36Sopenharmony_ci#define	PCIGSCR_XCLKBIN	0x07000000		/* XLB2CLKIN mask */
8362306a36Sopenharmony_ci#define	PCIGSCR_PEE	0x00002000		/* Parity error intr enable */
8462306a36Sopenharmony_ci#define	PCIGSCR_SEE	0x00001000		/* System error intr enable */
8562306a36Sopenharmony_ci#define	PCIGSCR_RESET	0x00000001		/* Reset bit */
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/*
8862306a36Sopenharmony_ci *	Bit definitions for the PCICAR configuration address register.
8962306a36Sopenharmony_ci */
9062306a36Sopenharmony_ci#define	PCICAR_E	0x80000000		/* Enable config space */
9162306a36Sopenharmony_ci#define	PCICAR_BUSN	16			/* Move bus bits */
9262306a36Sopenharmony_ci#define	PCICAR_DEVFNN	8			/* Move devfn bits */
9362306a36Sopenharmony_ci#define	PCICAR_DWORDN	0			/* Move dword bits */
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci/*
9662306a36Sopenharmony_ci *	The initiator windows hold the memory and IO mapping information.
9762306a36Sopenharmony_ci *	This macro creates the register values from the desired addresses.
9862306a36Sopenharmony_ci */
9962306a36Sopenharmony_ci#define	WXBTAR(hostaddr, pciaddr, size)	\
10062306a36Sopenharmony_ci			(((hostaddr) & 0xff000000) | \
10162306a36Sopenharmony_ci			((((size) - 1) & 0xff000000) >> 8) | \
10262306a36Sopenharmony_ci			(((pciaddr) & 0xff000000) >> 16))
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci#define	PCIIWCR_W0_MEM	0x00000000		/* Window 0 is memory */
10562306a36Sopenharmony_ci#define	PCIIWCR_W0_IO	0x08000000		/* Window 0 is IO */
10662306a36Sopenharmony_ci#define	PCIIWCR_W0_MRD	0x00000000		/* Window 0 memory read */
10762306a36Sopenharmony_ci#define	PCIIWCR_W0_MRDL	0x02000000		/* Window 0 memory read line */
10862306a36Sopenharmony_ci#define	PCIIWCR_W0_MRDM	0x04000000		/* Window 0 memory read mult */
10962306a36Sopenharmony_ci#define	PCIIWCR_W0_E	0x01000000		/* Window 0 enable */
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define	PCIIWCR_W1_MEM	0x00000000		/* Window 0 is memory */
11262306a36Sopenharmony_ci#define	PCIIWCR_W1_IO	0x00080000		/* Window 0 is IO */
11362306a36Sopenharmony_ci#define	PCIIWCR_W1_MRD	0x00000000		/* Window 0 memory read */
11462306a36Sopenharmony_ci#define	PCIIWCR_W1_MRDL	0x00020000		/* Window 0 memory read line */
11562306a36Sopenharmony_ci#define	PCIIWCR_W1_MRDM	0x00040000		/* Window 0 memory read mult */
11662306a36Sopenharmony_ci#define	PCIIWCR_W1_E	0x00010000		/* Window 0 enable */
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/*
11962306a36Sopenharmony_ci *	Bit definitions for the PCIBATR registers.
12062306a36Sopenharmony_ci */
12162306a36Sopenharmony_ci#define	PCITBATR0_E	0x00000001		/* Enable window 0 */
12262306a36Sopenharmony_ci#define	PCITBATR1_E	0x00000001		/* Enable window 1 */
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/*
12562306a36Sopenharmony_ci *	PCI arbiter support definitions and macros.
12662306a36Sopenharmony_ci */
12762306a36Sopenharmony_ci#define	PACR_INTMPRI	0x00000001
12862306a36Sopenharmony_ci#define	PACR_EXTMPRI(x)	(((x) & 0x1f) << 1)
12962306a36Sopenharmony_ci#define	PACR_INTMINTE	0x00010000
13062306a36Sopenharmony_ci#define	PACR_EXTMINTE(x) (((x) & 0x1f) << 17)
13162306a36Sopenharmony_ci#define	PACR_PKMD	0x40000000
13262306a36Sopenharmony_ci#define	PACR_DS		0x80000000
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define	PCICR1_CL(x)	((x) & 0xf)		/* Cacheline size field */
13562306a36Sopenharmony_ci#define	PCICR1_LT(x)	(((x) & 0xff) << 8)	/* Latency timer field */
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/****************************************************************************/
13862306a36Sopenharmony_ci#endif	/* M54XXPCI_H */
139