MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-arm / arch-ixp4xx / platform.h
blobd5f71f04ee2629da519c65368528155f86721709
1 /*
2 * include/asm-arm/arch-ixp4xx/platform.h
4 * Constants and functions that are useful to IXP4xx platform-specific code
5 * and device drivers.
7 * Copyright (C) 2004 MontaVista Software, Inc.
8 */
10 #ifndef __ASM_ARCH_HARDWARE_H__
11 #error "Do not include this directly, instead #include <asm/hardware.h>"
12 #endif
14 #ifndef __ASSEMBLY__
16 #include <asm/types.h>
18 #ifndef __ARMEB__
19 #define REG_OFFSET 0
20 #else
21 #define REG_OFFSET 3
22 #endif
25 * Expansion bus memory regions
27 #define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
30 * The expansion bus on the IXP4xx can be configured for either 16 or
31 * 32MB windows and the CS offset for each region changes based on the
32 * current configuration. This means that we cannot simply hardcode
33 * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
34 * as setup by the bootloader to determine our window size.
36 extern unsigned long ixp4xx_exp_bus_size;
38 #define IXP4XX_EXP_BUS_BASE(region)\
39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
41 #define IXP4XX_EXP_BUS_END(region)\
42 (IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)
44 /* Those macros can be used to adjust timing and configure
45 * other features for each region.
48 #define IXP4XX_EXP_BUS_RECOVERY_T(x) (((x) & 0x0f) << 16)
49 #define IXP4XX_EXP_BUS_HOLD_T(x) (((x) & 0x03) << 20)
50 #define IXP4XX_EXP_BUS_STROBE_T(x) (((x) & 0x0f) << 22)
51 #define IXP4XX_EXP_BUS_SETUP_T(x) (((x) & 0x03) << 26)
52 #define IXP4XX_EXP_BUS_ADDR_T(x) (((x) & 0x03) << 28)
53 #define IXP4XX_EXP_BUS_SIZE(x) (((x) & 0x0f) << 10)
54 #define IXP4XX_EXP_BUS_CYCLES(x) (((x) & 0x03) << 14)
56 #define IXP4XX_EXP_BUS_CS_EN (1L << 31)
57 #define IXP4XX_EXP_BUS_BYTE_RD16 (1L << 6)
58 #define IXP4XX_EXP_BUS_HRDY_POL (1L << 5)
59 #define IXP4XX_EXP_BUS_MUX_EN (1L << 4)
60 #define IXP4XX_EXP_BUS_SPLT_EN (1L << 3)
61 #define IXP4XX_EXP_BUS_WR_EN (1L << 1)
62 #define IXP4XX_EXP_BUS_BYTE_EN (1L << 0)
64 #define IXP4XX_EXP_BUS_CYCLES_INTEL 0x00
65 #define IXP4XX_EXP_BUS_CYCLES_MOTOROLA 0x01
66 #define IXP4XX_EXP_BUS_CYCLES_HPI 0x02
68 #define IXP4XX_FLASH_WRITABLE (0x2)
69 #define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
70 #define IXP4XX_FLASH_WRITE (0xbcd23c42)
73 * Clock Speed Definitions.
75 #define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */
76 #define IXP4XX_UART_XTAL 14745600
79 * The IXP4xx chips do not have an I2C unit, so GPIO lines are just
80 * used to
81 * Used as platform_data to provide GPIO pin information to the ixp42x
82 * I2C driver.
84 struct ixp4xx_i2c_pins {
85 unsigned long sda_pin;
86 unsigned long scl_pin;
90 struct sys_timer;
93 * Frequency of clock used for primary clocksource
95 extern unsigned long ixp4xx_timer_freq;
98 * Functions used by platform-level setup code
100 extern void ixp4xx_map_io(void);
101 extern void ixp4xx_init_irq(void);
102 extern void ixp4xx_sys_init(void);
103 extern struct sys_timer ixp4xx_timer;
104 extern void ixp4xx_pci_preinit(void);
105 struct pci_sys_data;
106 extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
107 extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
110 * GPIO-functions
113 * The following converted to the real HW bits the gpio_line_config
115 /* GPIO pin types */
116 #define IXP4XX_GPIO_OUT 0x1
117 #define IXP4XX_GPIO_IN 0x2
119 /* GPIO signal types */
120 #define IXP4XX_GPIO_LOW 0
121 #define IXP4XX_GPIO_HIGH 1
123 /* GPIO Clocks */
124 #define IXP4XX_GPIO_CLK_0 14
125 #define IXP4XX_GPIO_CLK_1 15
127 static inline void gpio_line_config(u8 line, u32 direction)
129 if (direction == IXP4XX_GPIO_IN)
130 *IXP4XX_GPIO_GPOER |= (1 << line);
131 else
132 *IXP4XX_GPIO_GPOER &= ~(1 << line);
135 static inline void gpio_line_isr_clear(u8 line)
137 *IXP4XX_GPIO_GPISR = (1 << line);
140 static inline void gpio_line_get(u8 line, int *value)
142 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
145 static inline void gpio_line_set(u8 line, int value)
147 if (value == IXP4XX_GPIO_HIGH)
148 *IXP4XX_GPIO_GPOUTR |= (1 << line);
149 else if (value == IXP4XX_GPIO_LOW)
150 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
153 #endif // __ASSEMBLY__