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.
19 * The IXP2400 B0 silicon contains an erratum (#66) that causes writes
20 * to on-chip I/O register to not complete fully. What this means is
21 * that if you have a write to on-chip I/O followed by a back-to-back
22 * read or write, the first write will happen twice. OR...if it's
23 * not a back-to-back transaction, the read or write will generate
26 * The official work around for this is to set the on-chip I/O regions
27 * as XCB=101 and then force a read-back from the register.
30 #if defined(CONFIG_ARCH_ENP2611) || defined(CONFIG_ARCH_IXDP2400) || defined(CONFIG_ARCH_IXDP2401)
32 #include <asm/system.h> /* Pickup local_irq_ functions */
34 static inline void ixp2000_reg_write(volatile unsigned long *reg
, unsigned long val
)
36 volatile unsigned long dummy
;
39 local_irq_save(flags
);
43 local_irq_restore(flags
);
46 #define ixp2000_reg_write(reg, val) (*reg = val)
47 #endif /* IXDP2400 || IXDP2401 */
50 * Boards may multiplex different devices on the 2nd channel of
51 * the slowport interface that each need different configuration
52 * settings. For example, the IXDP2400 uses channel 2 on the interface
53 * to access the CPLD, the switch fabric card, and the media card. Each
54 * one needs a different mode so drivers must save/restore the mode
55 * before and after each operation.
57 * acquire_slowport(&your_config);
59 * do slowport operations
63 * Note that while you have the slowport, you are holding a spinlock,
64 * so your code should be written as if you explicitly acquired a lock.
66 * The configuration only affects device 2 on the slowport, so the
67 * MTD map driver does not acquire/release the slowport.
70 unsigned long CCR
; /* Clock divide */
71 unsigned long WTC
; /* Write Timing Control */
72 unsigned long RTC
; /* Read Timing Control */
73 unsigned long PCR
; /* Protocol Control Register */
74 unsigned long ADC
; /* Address/Data Width Control */
78 void ixp2000_acquire_slowport(struct slowport_cfg
*, struct slowport_cfg
*);
79 void ixp2000_release_slowport(struct slowport_cfg
*);
82 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
83 * tweaking of addresses in the MTD driver.
85 static inline unsigned ixp2000_has_broken_slowport(void)
87 unsigned long id
= *IXP2000_PROD_ID
;
88 unsigned long id_prod
= id
& (IXP2000_MAJ_PROD_TYPE_MASK
|
89 IXP2000_MIN_PROD_TYPE_MASK
);
91 /* fixed in IXP2400-B0 */
92 (IXP2000_MAJ_PROD_TYPE_IXP2000
|
93 IXP2000_MIN_PROD_TYPE_IXP2400
)) &&
94 ((id
& IXP2000_MAJ_REV_MASK
) == 0)) ||
96 /* fixed in IXP2800-B0 */
97 (IXP2000_MAJ_PROD_TYPE_IXP2000
|
98 IXP2000_MIN_PROD_TYPE_IXP2800
)) &&
99 ((id
& IXP2000_MAJ_REV_MASK
) == 0)) ||
101 /* fixed in IXP2850-B0 */
102 (IXP2000_MAJ_PROD_TYPE_IXP2000
|
103 IXP2000_MIN_PROD_TYPE_IXP2850
)) &&
104 ((id
& IXP2000_MAJ_REV_MASK
) == 0)));
107 static inline unsigned int ixp2000_has_flash(void)
109 return ((*IXP2000_STRAP_OPTIONS
) & (CFG_BOOT_PROM
));
112 static inline unsigned int ixp2000_is_pcimaster(void)
114 return ((*IXP2000_STRAP_OPTIONS
) & (CFG_PCI_BOOT_HOST
));
117 void ixp2000_map_io(void);
118 void ixp2000_init_irq(void);
119 void ixp2000_init_time(unsigned long);
120 unsigned long ixp2000_gettimeoffset(void);
124 u32
*ixp2000_pci_config_addr(unsigned int bus
, unsigned int devfn
, int where
);
125 void ixp2000_pci_preinit(void);
126 int ixp2000_pci_setup(int, struct pci_sys_data
*);
127 struct pci_bus
* ixp2000_pci_scan_bus(int, struct pci_sys_data
*);
128 int ixp2000_pci_read_config(struct pci_bus
*, unsigned int, int, int, u32
*);
129 int ixp2000_pci_write_config(struct pci_bus
*, unsigned int, int, int, u32
);
132 * Several of the IXP2000 systems have banked flash so we need to extend the
133 * flash_platform_data structure with some private pointers
135 struct ixp2000_flash_data
{
136 struct flash_platform_data
*platform_data
;
138 unsigned long (*bank_setup
)(unsigned long);
142 * GPIO helper functions
147 extern void gpio_line_config(int line
, int style
);
149 static inline int gpio_line_get(int line
)
151 return (((*IXP2000_GPIO_PLR
) >> line
) & 1);
154 static inline void gpio_line_set(int line
, int value
)
157 ixp2000_reg_write(IXP2000_GPIO_POSR
, (1 << line
));
159 ixp2000_reg_write(IXP2000_GPIO_POCR
, (1 << line
));
162 struct ixp2000_i2c_pins
{
163 unsigned long sda_pin
;
164 unsigned long scl_pin
;
167 #endif /* !__ASSEMBLY__ */