Path: blob/master/arch/arm/mach-ixp4xx/include/mach/platform.h
17683 views
/*1* arch/arm/mach-ixp4xx/include/mach/platform.h2*3* Constants and functions that are useful to IXP4xx platform-specific code4* and device drivers.5*6* Copyright (C) 2004 MontaVista Software, Inc.7*/89#ifndef __ASM_ARCH_HARDWARE_H__10#error "Do not include this directly, instead #include <mach/hardware.h>"11#endif1213#ifndef __ASSEMBLY__1415#include <asm/types.h>1617#ifndef __ARMEB__18#define REG_OFFSET 019#else20#define REG_OFFSET 321#endif2223/*24* Expansion bus memory regions25*/26#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)2728/*29* The expansion bus on the IXP4xx can be configured for either 16 or30* 32MB windows and the CS offset for each region changes based on the31* current configuration. This means that we cannot simply hardcode32* each offset. ixp4xx_sys_init() looks at the expansion bus configuration33* as setup by the bootloader to determine our window size.34*/35extern unsigned long ixp4xx_exp_bus_size;3637#define IXP4XX_EXP_BUS_BASE(region)\38(IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))3940#define IXP4XX_EXP_BUS_END(region)\41(IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)4243/* Those macros can be used to adjust timing and configure44* other features for each region.45*/4647#define IXP4XX_EXP_BUS_RECOVERY_T(x) (((x) & 0x0f) << 16)48#define IXP4XX_EXP_BUS_HOLD_T(x) (((x) & 0x03) << 20)49#define IXP4XX_EXP_BUS_STROBE_T(x) (((x) & 0x0f) << 22)50#define IXP4XX_EXP_BUS_SETUP_T(x) (((x) & 0x03) << 26)51#define IXP4XX_EXP_BUS_ADDR_T(x) (((x) & 0x03) << 28)52#define IXP4XX_EXP_BUS_SIZE(x) (((x) & 0x0f) << 10)53#define IXP4XX_EXP_BUS_CYCLES(x) (((x) & 0x03) << 14)5455#define IXP4XX_EXP_BUS_CS_EN (1L << 31)56#define IXP4XX_EXP_BUS_BYTE_RD16 (1L << 6)57#define IXP4XX_EXP_BUS_HRDY_POL (1L << 5)58#define IXP4XX_EXP_BUS_MUX_EN (1L << 4)59#define IXP4XX_EXP_BUS_SPLT_EN (1L << 3)60#define IXP4XX_EXP_BUS_WR_EN (1L << 1)61#define IXP4XX_EXP_BUS_BYTE_EN (1L << 0)6263#define IXP4XX_EXP_BUS_CYCLES_INTEL 0x0064#define IXP4XX_EXP_BUS_CYCLES_MOTOROLA 0x0165#define IXP4XX_EXP_BUS_CYCLES_HPI 0x026667#define IXP4XX_FLASH_WRITABLE (0x2)68#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)69#define IXP4XX_FLASH_WRITE (0xbcd23c42)7071/*72* Clock Speed Definitions.73*/74#define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */75#define IXP4XX_UART_XTAL 147456007677/*78* This structure provide a means for the board setup code79* to give information to th pata_ixp4xx driver. It is80* passed as platform_data.81*/82struct ixp4xx_pata_data {83volatile u32 *cs0_cfg;84volatile u32 *cs1_cfg;85unsigned long cs0_bits;86unsigned long cs1_bits;87void __iomem *cs0;88void __iomem *cs1;89};9091struct sys_timer;9293#define IXP4XX_ETH_NPEA 0x0094#define IXP4XX_ETH_NPEB 0x1095#define IXP4XX_ETH_NPEC 0x209697/* Information about built-in Ethernet MAC interfaces */98struct eth_plat_info {99u8 phy; /* MII PHY ID, 0 - 31 */100u8 rxq; /* configurable, currently 0 - 31 only */101u8 txreadyq;102u8 hwaddr[6];103};104105/* Information about built-in HSS (synchronous serial) interfaces */106struct hss_plat_info {107int (*set_clock)(int port, unsigned int clock_type);108int (*open)(int port, void *pdev,109void (*set_carrier_cb)(void *pdev, int carrier));110void (*close)(int port, void *pdev);111u8 txreadyq;112};113114/*115* Frequency of clock used for primary clocksource116*/117extern unsigned long ixp4xx_timer_freq;118119/*120* Functions used by platform-level setup code121*/122extern void ixp4xx_map_io(void);123extern void ixp4xx_init_irq(void);124extern void ixp4xx_sys_init(void);125extern void ixp4xx_timer_init(void);126extern struct sys_timer ixp4xx_timer;127extern void ixp4xx_pci_preinit(void);128struct pci_sys_data;129extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);130extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);131132/*133* GPIO-functions134*/135/*136* The following converted to the real HW bits the gpio_line_config137*/138/* GPIO pin types */139#define IXP4XX_GPIO_OUT 0x1140#define IXP4XX_GPIO_IN 0x2141142/* GPIO signal types */143#define IXP4XX_GPIO_LOW 0144#define IXP4XX_GPIO_HIGH 1145146/* GPIO Clocks */147#define IXP4XX_GPIO_CLK_0 14148#define IXP4XX_GPIO_CLK_1 15149150static inline void gpio_line_config(u8 line, u32 direction)151{152if (direction == IXP4XX_GPIO_IN)153*IXP4XX_GPIO_GPOER |= (1 << line);154else155*IXP4XX_GPIO_GPOER &= ~(1 << line);156}157158static inline void gpio_line_get(u8 line, int *value)159{160*value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;161}162163static inline void gpio_line_set(u8 line, int value)164{165if (value == IXP4XX_GPIO_HIGH)166*IXP4XX_GPIO_GPOUTR |= (1 << line);167else if (value == IXP4XX_GPIO_LOW)168*IXP4XX_GPIO_GPOUTR &= ~(1 << line);169}170171#endif // __ASSEMBLY__172173174175