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