Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | #ifndef __ARMEB__ |
| 19 | #define REG_OFFSET 0 |
| 20 | #else |
| 21 | #define REG_OFFSET 3 |
| 22 | #endif |
| 23 | |
| 24 | /* |
| 25 | * Expansion bus memory regions |
| 26 | */ |
| 27 | #define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000) |
| 28 | |
| 29 | #define IXP4XX_EXP_BUS_CSX_REGION_SIZE (0x01000000) |
| 30 | |
| 31 | #define IXP4XX_EXP_BUS_CS0_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000) |
| 32 | #define IXP4XX_EXP_BUS_CS1_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000) |
| 33 | #define IXP4XX_EXP_BUS_CS2_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000) |
| 34 | #define IXP4XX_EXP_BUS_CS3_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000) |
| 35 | #define IXP4XX_EXP_BUS_CS4_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000) |
| 36 | #define IXP4XX_EXP_BUS_CS5_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000) |
| 37 | #define IXP4XX_EXP_BUS_CS6_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000) |
| 38 | #define IXP4XX_EXP_BUS_CS7_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000) |
| 39 | |
| 40 | #define IXP4XX_FLASH_WRITABLE (0x2) |
| 41 | #define IXP4XX_FLASH_DEFAULT (0xbcd23c40) |
| 42 | #define IXP4XX_FLASH_WRITE (0xbcd23c42) |
| 43 | |
| 44 | /* |
| 45 | * Clock Speed Definitions. |
| 46 | */ |
| 47 | #define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */ |
| 48 | #define IXP4XX_UART_XTAL 14745600 |
| 49 | |
| 50 | /* |
| 51 | * The IXP4xx chips do not have an I2C unit, so GPIO lines are just |
| 52 | * used to |
| 53 | * Used as platform_data to provide GPIO pin information to the ixp42x |
| 54 | * I2C driver. |
| 55 | */ |
| 56 | struct ixp4xx_i2c_pins { |
| 57 | unsigned long sda_pin; |
| 58 | unsigned long scl_pin; |
| 59 | }; |
| 60 | |
| 61 | |
| 62 | struct sys_timer; |
| 63 | |
| 64 | /* |
| 65 | * Functions used by platform-level setup code |
| 66 | */ |
| 67 | extern void ixp4xx_map_io(void); |
| 68 | extern void ixp4xx_init_irq(void); |
| 69 | extern void ixp4xx_sys_init(void); |
| 70 | extern struct sys_timer ixp4xx_timer; |
| 71 | extern void ixp4xx_pci_preinit(void); |
| 72 | struct pci_sys_data; |
| 73 | extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); |
| 74 | extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); |
| 75 | |
| 76 | /* |
| 77 | * GPIO-functions |
| 78 | */ |
| 79 | /* |
| 80 | * The following converted to the real HW bits the gpio_line_config |
| 81 | */ |
| 82 | /* GPIO pin types */ |
| 83 | #define IXP4XX_GPIO_OUT 0x1 |
| 84 | #define IXP4XX_GPIO_IN 0x2 |
| 85 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | /* GPIO signal types */ |
| 87 | #define IXP4XX_GPIO_LOW 0 |
| 88 | #define IXP4XX_GPIO_HIGH 1 |
| 89 | |
| 90 | /* GPIO Clocks */ |
| 91 | #define IXP4XX_GPIO_CLK_0 14 |
| 92 | #define IXP4XX_GPIO_CLK_1 15 |
| 93 | |
Deepak Saxena | bdf82b5 | 2005-08-29 22:46:30 +0100 | [diff] [blame] | 94 | static inline void gpio_line_config(u8 line, u32 direction) |
| 95 | { |
Deepak Saxena | ce12467 | 2005-10-04 16:32:38 -0700 | [diff] [blame] | 96 | if (direction == IXP4XX_GPIO_IN) |
Deepak Saxena | bdf82b5 | 2005-08-29 22:46:30 +0100 | [diff] [blame] | 97 | *IXP4XX_GPIO_GPOER |= (1 << line); |
| 98 | else |
| 99 | *IXP4XX_GPIO_GPOER &= ~(1 << line); |
| 100 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | static inline void gpio_line_get(u8 line, int *value) |
| 103 | { |
| 104 | *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1; |
| 105 | } |
| 106 | |
| 107 | static inline void gpio_line_set(u8 line, int value) |
| 108 | { |
| 109 | if (value == IXP4XX_GPIO_HIGH) |
| 110 | *IXP4XX_GPIO_GPOUTR |= (1 << line); |
| 111 | else if (value == IXP4XX_GPIO_LOW) |
| 112 | *IXP4XX_GPIO_GPOUTR &= ~(1 << line); |
| 113 | } |
| 114 | |
| 115 | static inline void gpio_line_isr_clear(u8 line) |
| 116 | { |
| 117 | *IXP4XX_GPIO_GPISR = (1 << line); |
| 118 | } |
| 119 | |
| 120 | #endif // __ASSEMBLY__ |
| 121 | |