18c2ecf20Sopenharmony_ci/****************************************************************************/
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci/*
48c2ecf20Sopenharmony_ci *	m54xxpci.h -- ColdFire 547x and 548x PCI bus support
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci *	(C) Copyright 2011,  Greg Ungerer <gerg@uclinux.org>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
98c2ecf20Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
108c2ecf20Sopenharmony_ci * for more details.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/****************************************************************************/
148c2ecf20Sopenharmony_ci#ifndef	M54XXPCI_H
158c2ecf20Sopenharmony_ci#define	M54XXPCI_H
168c2ecf20Sopenharmony_ci/****************************************************************************/
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/*
198c2ecf20Sopenharmony_ci *	The core set of PCI support registers are mapped into the MBAR region.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci#define	PCIIDR		(CONFIG_MBAR + 0xb00)	/* PCI device/vendor ID */
228c2ecf20Sopenharmony_ci#define	PCISCR		(CONFIG_MBAR + 0xb04)	/* PCI status/command */
238c2ecf20Sopenharmony_ci#define	PCICCRIR	(CONFIG_MBAR + 0xb08)	/* PCI class/revision */
248c2ecf20Sopenharmony_ci#define	PCICR1		(CONFIG_MBAR + 0xb0c)	/* PCI configuration 1 */
258c2ecf20Sopenharmony_ci#define	PCIBAR0		(CONFIG_MBAR + 0xb10)	/* PCI base address 0 */
268c2ecf20Sopenharmony_ci#define	PCIBAR1		(CONFIG_MBAR + 0xb14)	/* PCI base address 1 */
278c2ecf20Sopenharmony_ci#define	PCICCPR		(CONFIG_MBAR + 0xb28)	/* PCI cardbus CIS pointer */
288c2ecf20Sopenharmony_ci#define	PCISID		(CONFIG_MBAR + 0xb2c)	/* PCI subsystem IDs */
298c2ecf20Sopenharmony_ci#define	PCIERBAR	(CONFIG_MBAR + 0xb30)	/* PCI expansion ROM */
308c2ecf20Sopenharmony_ci#define	PCICPR		(CONFIG_MBAR + 0xb34)	/* PCI capabilities pointer */
318c2ecf20Sopenharmony_ci#define	PCICR2		(CONFIG_MBAR + 0xb3c)	/* PCI configuration 2 */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define	PCIGSCR		(CONFIG_MBAR + 0xb60)	/* Global status/control */
348c2ecf20Sopenharmony_ci#define	PCITBATR0	(CONFIG_MBAR + 0xb64)	/* Target base translation 0 */
358c2ecf20Sopenharmony_ci#define	PCITBATR1	(CONFIG_MBAR + 0xb68)	/* Target base translation 1 */
368c2ecf20Sopenharmony_ci#define	PCITCR		(CONFIG_MBAR + 0xb6c)	/* Target control */
378c2ecf20Sopenharmony_ci#define	PCIIW0BTAR	(CONFIG_MBAR + 0xb70)	/* Initiator window 0 */
388c2ecf20Sopenharmony_ci#define	PCIIW1BTAR	(CONFIG_MBAR + 0xb74)	/* Initiator window 1 */
398c2ecf20Sopenharmony_ci#define	PCIIW2BTAR	(CONFIG_MBAR + 0xb78)	/* Initiator window 2 */
408c2ecf20Sopenharmony_ci#define	PCIIWCR		(CONFIG_MBAR + 0xb80)	/* Initiator window config */
418c2ecf20Sopenharmony_ci#define	PCIICR		(CONFIG_MBAR + 0xb84)	/* Initiator control */
428c2ecf20Sopenharmony_ci#define	PCIISR		(CONFIG_MBAR + 0xb88)	/* Initiator status */
438c2ecf20Sopenharmony_ci#define	PCICAR		(CONFIG_MBAR + 0xbf8)	/* Configuration address */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define	PCITPSR		(CONFIG_MBAR + 0x8400)	/* TX packet size */
468c2ecf20Sopenharmony_ci#define	PCITSAR		(CONFIG_MBAR + 0x8404)	/* TX start address */
478c2ecf20Sopenharmony_ci#define	PCITTCR		(CONFIG_MBAR + 0x8408)	/* TX transaction control */
488c2ecf20Sopenharmony_ci#define	PCITER		(CONFIG_MBAR + 0x840c)	/* TX enables */
498c2ecf20Sopenharmony_ci#define	PCITNAR		(CONFIG_MBAR + 0x8410)	/* TX next address */
508c2ecf20Sopenharmony_ci#define	PCITLWR		(CONFIG_MBAR + 0x8414)	/* TX last word */
518c2ecf20Sopenharmony_ci#define	PCITDCR		(CONFIG_MBAR + 0x8418)	/* TX done counts */
528c2ecf20Sopenharmony_ci#define	PCITSR		(CONFIG_MBAR + 0x841c)	/* TX status */
538c2ecf20Sopenharmony_ci#define	PCITFDR		(CONFIG_MBAR + 0x8440)	/* TX FIFO data */
548c2ecf20Sopenharmony_ci#define	PCITFSR		(CONFIG_MBAR + 0x8444)	/* TX FIFO status */
558c2ecf20Sopenharmony_ci#define	PCITFCR		(CONFIG_MBAR + 0x8448)	/* TX FIFO control */
568c2ecf20Sopenharmony_ci#define	PCITFAR		(CONFIG_MBAR + 0x844c)	/* TX FIFO alarm */
578c2ecf20Sopenharmony_ci#define	PCITFRPR	(CONFIG_MBAR + 0x8450)	/* TX FIFO read pointer */
588c2ecf20Sopenharmony_ci#define	PCITFWPR	(CONFIG_MBAR + 0x8454)	/* TX FIFO write pointer */
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define	PCIRPSR		(CONFIG_MBAR + 0x8480)	/* RX packet size */
618c2ecf20Sopenharmony_ci#define	PCIRSAR		(CONFIG_MBAR + 0x8484)	/* RX start address */
628c2ecf20Sopenharmony_ci#define	PCIRTCR		(CONFIG_MBAR + 0x8488)	/* RX transaction control */
638c2ecf20Sopenharmony_ci#define	PCIRER		(CONFIG_MBAR + 0x848c)	/* RX enables */
648c2ecf20Sopenharmony_ci#define	PCIRNAR		(CONFIG_MBAR + 0x8490)	/* RX next address */
658c2ecf20Sopenharmony_ci#define	PCIRDCR		(CONFIG_MBAR + 0x8498)	/* RX done counts */
668c2ecf20Sopenharmony_ci#define	PCIRSR		(CONFIG_MBAR + 0x849c)	/* RX status */
678c2ecf20Sopenharmony_ci#define	PCIRFDR		(CONFIG_MBAR + 0x84c0)	/* RX FIFO data */
688c2ecf20Sopenharmony_ci#define	PCIRFSR		(CONFIG_MBAR + 0x84c4)	/* RX FIFO status */
698c2ecf20Sopenharmony_ci#define	PCIRFCR		(CONFIG_MBAR + 0x84c8)	/* RX FIFO control */
708c2ecf20Sopenharmony_ci#define	PCIRFAR		(CONFIG_MBAR + 0x84cc)	/* RX FIFO alarm */
718c2ecf20Sopenharmony_ci#define	PCIRFRPR	(CONFIG_MBAR + 0x84d0)	/* RX FIFO read pointer */
728c2ecf20Sopenharmony_ci#define	PCIRFWPR	(CONFIG_MBAR + 0x84d4)	/* RX FIFO write pointer */
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define	PACR		(CONFIG_MBAR + 0xc00)	/* PCI arbiter control */
758c2ecf20Sopenharmony_ci#define	PASR		(CONFIG_MBAR + 0xc04)	/* PCI arbiter status */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci *	Definitions for the Global status and control register.
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci#define	PCIGSCR_PE	0x20000000		/* Parity error detected */
818c2ecf20Sopenharmony_ci#define	PCIGSCR_SE	0x10000000		/* System error detected */
828c2ecf20Sopenharmony_ci#define	PCIGSCR_XCLKBIN	0x07000000		/* XLB2CLKIN mask */
838c2ecf20Sopenharmony_ci#define	PCIGSCR_PEE	0x00002000		/* Parity error intr enable */
848c2ecf20Sopenharmony_ci#define	PCIGSCR_SEE	0x00001000		/* System error intr enable */
858c2ecf20Sopenharmony_ci#define	PCIGSCR_RESET	0x00000001		/* Reset bit */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/*
888c2ecf20Sopenharmony_ci *	Bit definitions for the PCICAR configuration address register.
898c2ecf20Sopenharmony_ci */
908c2ecf20Sopenharmony_ci#define	PCICAR_E	0x80000000		/* Enable config space */
918c2ecf20Sopenharmony_ci#define	PCICAR_BUSN	16			/* Move bus bits */
928c2ecf20Sopenharmony_ci#define	PCICAR_DEVFNN	8			/* Move devfn bits */
938c2ecf20Sopenharmony_ci#define	PCICAR_DWORDN	0			/* Move dword bits */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci *	The initiator windows hold the memory and IO mapping information.
978c2ecf20Sopenharmony_ci *	This macro creates the register values from the desired addresses.
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_ci#define	WXBTAR(hostaddr, pciaddr, size)	\
1008c2ecf20Sopenharmony_ci			(((hostaddr) & 0xff000000) | \
1018c2ecf20Sopenharmony_ci			((((size) - 1) & 0xff000000) >> 8) | \
1028c2ecf20Sopenharmony_ci			(((pciaddr) & 0xff000000) >> 16))
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_MEM	0x00000000		/* Window 0 is memory */
1058c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_IO	0x08000000		/* Window 0 is IO */
1068c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_MRD	0x00000000		/* Window 0 memory read */
1078c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_MRDL	0x02000000		/* Window 0 memory read line */
1088c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_MRDM	0x04000000		/* Window 0 memory read mult */
1098c2ecf20Sopenharmony_ci#define	PCIIWCR_W0_E	0x01000000		/* Window 0 enable */
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_MEM	0x00000000		/* Window 0 is memory */
1128c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_IO	0x00080000		/* Window 0 is IO */
1138c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_MRD	0x00000000		/* Window 0 memory read */
1148c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_MRDL	0x00020000		/* Window 0 memory read line */
1158c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_MRDM	0x00040000		/* Window 0 memory read mult */
1168c2ecf20Sopenharmony_ci#define	PCIIWCR_W1_E	0x00010000		/* Window 0 enable */
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/*
1198c2ecf20Sopenharmony_ci *	Bit definitions for the PCIBATR registers.
1208c2ecf20Sopenharmony_ci */
1218c2ecf20Sopenharmony_ci#define	PCITBATR0_E	0x00000001		/* Enable window 0 */
1228c2ecf20Sopenharmony_ci#define	PCITBATR1_E	0x00000001		/* Enable window 1 */
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/*
1258c2ecf20Sopenharmony_ci *	PCI arbiter support definitions and macros.
1268c2ecf20Sopenharmony_ci */
1278c2ecf20Sopenharmony_ci#define	PACR_INTMPRI	0x00000001
1288c2ecf20Sopenharmony_ci#define	PACR_EXTMPRI(x)	(((x) & 0x1f) << 1)
1298c2ecf20Sopenharmony_ci#define	PACR_INTMINTE	0x00010000
1308c2ecf20Sopenharmony_ci#define	PACR_EXTMINTE(x) (((x) & 0x1f) << 17)
1318c2ecf20Sopenharmony_ci#define	PACR_PKMD	0x40000000
1328c2ecf20Sopenharmony_ci#define	PACR_DS		0x80000000
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define	PCICR1_CL(x)	((x) & 0xf)		/* Cacheline size field */
1358c2ecf20Sopenharmony_ci#define	PCICR1_LT(x)	(((x) & 0xff) << 8)	/* Latency timer field */
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/****************************************************************************/
1388c2ecf20Sopenharmony_ci#endif	/* M54XXPCI_H */
139