2 * include/asm-arm/arch-ixp2000/platform.h
4 * Various bits of code used by platform-level code.
6 * Author: Deepak Saxena <dsaxena@plexity.net>
8 * Copyright 2004 (c) MontaVista Software, Inc.
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
18 static inline unsigned long ixp2000_reg_read(volatile void *reg)
20 return *((volatile unsigned long *)reg);
23 static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
25 *((volatile unsigned long *)reg) = val;
29 * Boards may multiplex different devices on the 2nd channel of
30 * the slowport interface that each need different configuration
31 * settings. For example, the IXDP2400 uses channel 2 on the interface
32 * to access the CPLD, the switch fabric card, and the media card. Each
33 * one needs a different mode so drivers must save/restore the mode
34 * before and after each operation.
36 * acquire_slowport(&your_config);
38 * do slowport operations
42 * Note that while you have the slowport, you are holding a spinlock,
43 * so your code should be written as if you explicitly acquired a lock.
45 * The configuration only affects device 2 on the slowport, so the
46 * MTD map driver does not acquire/release the slowport.
49 unsigned long CCR; /* Clock divide */
50 unsigned long WTC; /* Write Timing Control */
51 unsigned long RTC; /* Read Timing Control */
52 unsigned long PCR; /* Protocol Control Register */
53 unsigned long ADC; /* Address/Data Width Control */
57 void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
58 void ixp2000_release_slowport(struct slowport_cfg *);
61 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
62 * tweaking of addresses in the MTD driver.
64 static inline unsigned ixp2000_has_broken_slowport(void)
66 unsigned long id = *IXP2000_PRODUCT_ID;
67 unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
68 IXP2000_MIN_PROD_TYPE_MASK);
70 /* fixed in IXP2400-B0 */
71 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
72 IXP2000_MIN_PROD_TYPE_IXP2400)) &&
73 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
75 /* fixed in IXP2800-B0 */
76 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
77 IXP2000_MIN_PROD_TYPE_IXP2800)) &&
78 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
80 /* fixed in IXP2850-B0 */
81 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
82 IXP2000_MIN_PROD_TYPE_IXP2850)) &&
83 ((id & IXP2000_MAJ_REV_MASK) == 0)));
86 static inline unsigned int ixp2000_has_flash(void)
88 return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
91 static inline unsigned int ixp2000_is_pcimaster(void)
93 return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
96 void ixp2000_map_io(void);
97 void ixp2000_uart_init(void);
98 void ixp2000_init_irq(void);
99 void ixp2000_init_time(unsigned long);
100 unsigned long ixp2000_gettimeoffset(void);
104 u32 *ixp2000_pci_config_addr(unsigned int bus, unsigned int devfn, int where);
105 void ixp2000_pci_preinit(void);
106 int ixp2000_pci_setup(int, struct pci_sys_data*);
107 struct pci_bus* ixp2000_pci_scan_bus(int, struct pci_sys_data*);
108 int ixp2000_pci_read_config(struct pci_bus*, unsigned int, int, int, u32 *);
109 int ixp2000_pci_write_config(struct pci_bus*, unsigned int, int, int, u32);
112 * Several of the IXP2000 systems have banked flash so we need to extend the
113 * flash_platform_data structure with some private pointers
115 struct ixp2000_flash_data {
116 struct flash_platform_data *platform_data;
118 unsigned long (*bank_setup)(unsigned long);
121 struct ixp2000_i2c_pins {
122 unsigned long sda_pin;
123 unsigned long scl_pin;
127 #endif /* !__ASSEMBLY__ */