VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-arm / arch-ixp4xx / platform.h
1 /*
2  * include/asm-arm/arch-ixp4xx/platform.h
3  *
4  * Constants and functions that are useful to IXP4xx platform-specific code
5  * and device drivers.
6  *
7  * Copyright (C) 2004 MontaVista Software, Inc.
8  */
9
10 #ifndef __ASM_ARCH_HARDWARE_H__
11 #error "Do not include this directly, instead #include <asm/hardware.h>"
12 #endif
13
14 #ifndef __ASSEMBLY__
15
16 #include <asm/types.h>
17
18 /*
19  * Expansion bus memory regions
20  */
21 #define IXP4XX_EXP_BUS_BASE_PHYS        (0x50000000)
22
23 #define IXP4XX_EXP_BUS_CSX_REGION_SIZE  (0x01000000)
24
25 #define IXP4XX_EXP_BUS_CS0_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000)
26 #define IXP4XX_EXP_BUS_CS1_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000)
27 #define IXP4XX_EXP_BUS_CS2_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
28 #define IXP4XX_EXP_BUS_CS3_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
29 #define IXP4XX_EXP_BUS_CS4_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
30 #define IXP4XX_EXP_BUS_CS5_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
31 #define IXP4XX_EXP_BUS_CS6_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
32 #define IXP4XX_EXP_BUS_CS7_BASE_PHYS    (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
33
34 #define IXP4XX_FLASH_WRITABLE   (0x2)
35 #define IXP4XX_FLASH_DEFAULT    (0xbcd23c40)
36 #define IXP4XX_FLASH_WRITE      (0xbcd23c42)
37
38 /*
39  * Clock Speed Definitions.
40  */
41 #define IXP4XX_PERIPHERAL_BUS_CLOCK     (66) /* 66Mhzi APB BUS   */ 
42 #define IXP4XX_UART_XTAL                14745600
43
44 /*
45  * The IXP4xx chips do not have an I2C unit, so GPIO lines are just
46  * used to 
47  * Used as platform_data to provide GPIO pin information to the ixp42x
48  * I2C driver.
49  */
50 struct ixp4xx_i2c_pins {
51         unsigned long sda_pin;
52         unsigned long scl_pin;
53 };
54
55
56 /*
57  * Functions used by platform-level setup code
58  */
59 extern void ixp4xx_map_io(void);
60 extern void ixp4xx_init_irq(void);
61 extern void ixp4xx_init_time(void);
62 extern void ixp4xx_pci_preinit(void);
63 struct pci_sys_data;
64 extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
65 extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
66
67 /*
68  * GPIO-functions
69  */
70 /*
71  * The following converted to the real HW bits the gpio_line_config
72  */
73 /* GPIO pin types */
74 #define IXP4XX_GPIO_OUT                 0x1
75 #define IXP4XX_GPIO_IN                  0x2
76
77 #define IXP4XX_GPIO_INTSTYLE_MASK       0x7C  /* Bits [6:2] define interrupt style */
78
79 /* 
80  * GPIO interrupt types.
81  */
82 #define IXP4XX_GPIO_ACTIVE_HIGH         0x4 /* Default */
83 #define IXP4XX_GPIO_ACTIVE_LOW          0x8
84 #define IXP4XX_GPIO_RISING_EDGE         0x10
85 #define IXP4XX_GPIO_FALLING_EDGE        0x20
86 #define IXP4XX_GPIO_TRANSITIONAL        0x40
87
88 /* GPIO signal types */
89 #define IXP4XX_GPIO_LOW                 0
90 #define IXP4XX_GPIO_HIGH                1
91
92 /* GPIO Clocks */
93 #define IXP4XX_GPIO_CLK_0               14
94 #define IXP4XX_GPIO_CLK_1               15
95
96 extern void gpio_line_config(u8 line, u32 style);
97
98 static inline void gpio_line_get(u8 line, int *value)
99 {
100         *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
101 }
102
103 static inline void gpio_line_set(u8 line, int value)
104 {
105         if (value == IXP4XX_GPIO_HIGH)
106             *IXP4XX_GPIO_GPOUTR |= (1 << line);
107         else if (value == IXP4XX_GPIO_LOW)
108             *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
109 }
110
111 static inline void gpio_line_isr_clear(u8 line)
112 {
113         *IXP4XX_GPIO_GPISR = (1 << line);
114 }
115
116 #endif // __ASSEMBLY__
117