1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * arch/arm/mach-ixp4xx/include/mach/platform.h
4  *
5  * Constants and functions that are useful to IXP4xx platform-specific code
6  * and device drivers.
7  *
8  * Copyright (C) 2004 MontaVista Software, Inc.
9  */
10 
11 #ifndef __ASM_ARCH_HARDWARE_H__
12 #error "Do not include this directly, instead #include <mach/hardware.h>"
13 #endif
14 
15 #ifndef __ASSEMBLY__
16 
17 #include <linux/reboot.h>
18 #include <linux/platform_data/eth_ixp4xx.h>
19 
20 #include <asm/types.h>
21 
22 #ifndef	__ARMEB__
23 #define	REG_OFFSET	0
24 #else
25 #define	REG_OFFSET	3
26 #endif
27 
28 /*
29  * Expansion bus memory regions
30  */
31 #define IXP4XX_EXP_BUS_BASE_PHYS	(0x50000000)
32 
33 /*
34  * The expansion bus on the IXP4xx can be configured for either 16 or
35  * 32MB windows and the CS offset for each region changes based on the
36  * current configuration. This means that we cannot simply hardcode
37  * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
38  * as setup by the bootloader to determine our window size.
39  */
40 extern unsigned long ixp4xx_exp_bus_size;
41 
42 #define	IXP4XX_EXP_BUS_BASE(region)\
43 		(IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
44 
45 #define IXP4XX_EXP_BUS_END(region)\
46 		(IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)
47 
48 /* Those macros can be used to adjust timing and configure
49  * other features for each region.
50  */
51 
52 #define IXP4XX_EXP_BUS_RECOVERY_T(x)	(((x) & 0x0f) << 16)
53 #define IXP4XX_EXP_BUS_HOLD_T(x)	(((x) & 0x03) << 20)
54 #define IXP4XX_EXP_BUS_STROBE_T(x)	(((x) & 0x0f) << 22)
55 #define IXP4XX_EXP_BUS_SETUP_T(x)	(((x) & 0x03) << 26)
56 #define IXP4XX_EXP_BUS_ADDR_T(x)	(((x) & 0x03) << 28)
57 #define IXP4XX_EXP_BUS_SIZE(x)		(((x) & 0x0f) << 10)
58 #define IXP4XX_EXP_BUS_CYCLES(x)	(((x) & 0x03) << 14)
59 
60 #define IXP4XX_EXP_BUS_CS_EN		(1L << 31)
61 #define IXP4XX_EXP_BUS_BYTE_RD16	(1L << 6)
62 #define IXP4XX_EXP_BUS_HRDY_POL		(1L << 5)
63 #define IXP4XX_EXP_BUS_MUX_EN		(1L << 4)
64 #define IXP4XX_EXP_BUS_SPLT_EN		(1L << 3)
65 #define IXP4XX_EXP_BUS_WR_EN		(1L << 1)
66 #define IXP4XX_EXP_BUS_BYTE_EN		(1L << 0)
67 
68 #define IXP4XX_EXP_BUS_CYCLES_INTEL	0x00
69 #define IXP4XX_EXP_BUS_CYCLES_MOTOROLA	0x01
70 #define IXP4XX_EXP_BUS_CYCLES_HPI	0x02
71 
72 #define IXP4XX_FLASH_WRITABLE	(0x2)
73 #define IXP4XX_FLASH_DEFAULT	(0xbcd23c40)
74 #define IXP4XX_FLASH_WRITE	(0xbcd23c42)
75 
76 /*
77  * Clock Speed Definitions.
78  */
79 #define IXP4XX_PERIPHERAL_BUS_CLOCK 	(66) /* 66MHzi APB BUS   */
80 #define IXP4XX_UART_XTAL        	14745600
81 
82 /*
83  * This structure provide a means for the board setup code
84  * to give information to th pata_ixp4xx driver. It is
85  * passed as platform_data.
86  */
87 struct ixp4xx_pata_data {
88 	volatile u32	*cs0_cfg;
89 	volatile u32	*cs1_cfg;
90 	unsigned long	cs0_bits;
91 	unsigned long	cs1_bits;
92 	void __iomem	*cs0;
93 	void __iomem	*cs1;
94 };
95 
96 /*
97  * Frequency of clock used for primary clocksource
98  */
99 extern unsigned long ixp4xx_timer_freq;
100 
101 /*
102  * Functions used by platform-level setup code
103  */
104 extern void ixp4xx_map_io(void);
105 extern void ixp4xx_init_early(void);
106 extern void ixp4xx_init_irq(void);
107 extern void ixp4xx_sys_init(void);
108 extern void ixp4xx_timer_init(void);
109 extern void ixp4xx_restart(enum reboot_mode, const char *);
110 extern void ixp4xx_pci_preinit(void);
111 struct pci_sys_data;
112 extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
113 extern struct pci_ops ixp4xx_ops;
114 
115 #endif // __ASSEMBLY__
116 
117