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 void ixp2000_reg_write(volatile void *reg, unsigned long val)
20 *((volatile unsigned long *)reg) = val;
22 #define ixp2000_reg_read(reg) (*((volatile unsigned long *)reg))
25 * Boards may multiplex different devices on the 2nd channel of
26 * the slowport interface that each need different configuration
27 * settings. For example, the IXDP2400 uses channel 2 on the interface
28 * to access the CPLD, the switch fabric card, and the media card. Each
29 * one needs a different mode so drivers must save/restore the mode
30 * before and after each operation.
32 * acquire_slowport(&your_config);
34 * do slowport operations
38 * Note that while you have the slowport, you are holding a spinlock,
39 * so your code should be written as if you explicitly acquired a lock.
41 * The configuration only affects device 2 on the slowport, so the
42 * MTD map driver does not acquire/release the slowport.
45 unsigned long CCR; /* Clock divide */
46 unsigned long WTC; /* Write Timing Control */
47 unsigned long RTC; /* Read Timing Control */
48 unsigned long PCR; /* Protocol Control Register */
49 unsigned long ADC; /* Address/Data Width Control */
53 void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
54 void ixp2000_release_slowport(struct slowport_cfg *);
57 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
58 * tweaking of addresses in the MTD driver.
60 static inline unsigned ixp2000_has_broken_slowport(void)
62 unsigned long id = *IXP2000_PRODUCT_ID;
63 unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
64 IXP2000_MIN_PROD_TYPE_MASK);
66 /* fixed in IXP2400-B0 */
67 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
68 IXP2000_MIN_PROD_TYPE_IXP2400)) &&
69 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
71 /* fixed in IXP2800-B0 */
72 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
73 IXP2000_MIN_PROD_TYPE_IXP2800)) &&
74 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
76 /* fixed in IXP2850-B0 */
77 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
78 IXP2000_MIN_PROD_TYPE_IXP2850)) &&
79 ((id & IXP2000_MAJ_REV_MASK) == 0)));
82 static inline unsigned int ixp2000_has_flash(void)
84 return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
87 static inline unsigned int ixp2000_is_pcimaster(void)
89 return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
92 void ixp2000_map_io(void);
93 void ixp2000_uart_init(void);
94 void ixp2000_init_irq(void);
95 void ixp2000_init_time(unsigned long);
96 unsigned long ixp2000_gettimeoffset(void);
100 u32 *ixp2000_pci_config_addr(unsigned int bus, unsigned int devfn, int where);
101 void ixp2000_pci_preinit(void);
102 int ixp2000_pci_setup(int, struct pci_sys_data*);
103 struct pci_bus* ixp2000_pci_scan_bus(int, struct pci_sys_data*);
104 int ixp2000_pci_read_config(struct pci_bus*, unsigned int, int, int, u32 *);
105 int ixp2000_pci_write_config(struct pci_bus*, unsigned int, int, int, u32);
108 * Several of the IXP2000 systems have banked flash so we need to extend the
109 * flash_platform_data structure with some private pointers
111 struct ixp2000_flash_data {
112 struct flash_platform_data *platform_data;
114 unsigned long (*bank_setup)(unsigned long);
117 struct ixp2000_i2c_pins {
118 unsigned long sda_pin;
119 unsigned long scl_pin;
123 #endif /* !__ASSEMBLY__ */