aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/arch-ixp2000/platform.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-arm/arch-ixp2000/platform.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-arm/arch-ixp2000/platform.h')
-rw-r--r--include/asm-arm/arch-ixp2000/platform.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h
new file mode 100644
index 000000000000..509e44d528d8
--- /dev/null
+++ b/include/asm-arm/arch-ixp2000/platform.h
@@ -0,0 +1,166 @@
1/*
2 * include/asm-arm/arch-ixp2000/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista Software, Inc.
9 *
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.
13 */
14
15
16#ifndef __ASSEMBLY__
17
18/*
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
24 * incorrect data.
25 *
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.
28 *
29 */
30#if defined(CONFIG_ARCH_ENP2611) || defined(CONFIG_ARCH_IXDP2400) || defined(CONFIG_ARCH_IXDP2401)
31
32#include <asm/system.h> /* Pickup local_irq_ functions */
33
34static inline void ixp2000_reg_write(volatile unsigned long *reg, unsigned long val)
35{
36 volatile unsigned long dummy;
37 unsigned long flags;
38
39 local_irq_save(flags);
40 *reg = val;
41 barrier();
42 dummy = *reg;
43 local_irq_restore(flags);
44}
45#else
46#define ixp2000_reg_write(reg, val) (*reg = val)
47#endif /* IXDP2400 || IXDP2401 */
48
49/*
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.
56 *
57 * acquire_slowport(&your_config);
58 * ...
59 * do slowport operations
60 * ...
61 * release_slowport();
62 *
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.
65 *
66 * The configuration only affects device 2 on the slowport, so the
67 * MTD map driver does not acquire/release the slowport.
68 */
69struct slowport_cfg {
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 */
75};
76
77
78void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
79void ixp2000_release_slowport(struct slowport_cfg *);
80
81/*
82 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
83 * tweaking of addresses in the MTD driver.
84 */
85static inline unsigned ixp2000_has_broken_slowport(void)
86{
87 unsigned long id = *IXP2000_PROD_ID;
88 unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
89 IXP2000_MIN_PROD_TYPE_MASK);
90 return (((id_prod ==
91 /* fixed in IXP2400-B0 */
92 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
93 IXP2000_MIN_PROD_TYPE_IXP2400)) &&
94 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
95 ((id_prod ==
96 /* fixed in IXP2800-B0 */
97 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
98 IXP2000_MIN_PROD_TYPE_IXP2800)) &&
99 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
100 ((id_prod ==
101 /* fixed in IXP2850-B0 */
102 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
103 IXP2000_MIN_PROD_TYPE_IXP2850)) &&
104 ((id & IXP2000_MAJ_REV_MASK) == 0)));
105}
106
107static inline unsigned int ixp2000_has_flash(void)
108{
109 return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
110}
111
112static inline unsigned int ixp2000_is_pcimaster(void)
113{
114 return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
115}
116
117void ixp2000_map_io(void);
118void ixp2000_init_irq(void);
119void ixp2000_init_time(unsigned long);
120unsigned long ixp2000_gettimeoffset(void);
121
122struct pci_sys_data;
123
124void ixp2000_pci_preinit(void);
125int ixp2000_pci_setup(int, struct pci_sys_data*);
126struct pci_bus* ixp2000_pci_scan_bus(int, struct pci_sys_data*);
127int ixp2000_pci_read_config(struct pci_bus*, unsigned int, int, int, u32 *);
128int ixp2000_pci_write_config(struct pci_bus*, unsigned int, int, int, u32);
129
130/*
131 * Several of the IXP2000 systems have banked flash so we need to extend the
132 * flash_platform_data structure with some private pointers
133 */
134struct ixp2000_flash_data {
135 struct flash_platform_data *platform_data;
136 int nr_banks;
137 unsigned long (*bank_setup)(unsigned long);
138};
139
140/*
141 * GPIO helper functions
142 */
143#define GPIO_IN 0
144#define GPIO_OUT 1
145
146extern void gpio_line_config(int line, int style);
147
148static inline int gpio_line_get(int line)
149{
150 return (((*IXP2000_GPIO_PLR) >> line) & 1);
151}
152
153static inline void gpio_line_set(int line, int value)
154{
155 if (value)
156 ixp2000_reg_write(IXP2000_GPIO_POSR, (1 << line));
157 else
158 ixp2000_reg_write(IXP2000_GPIO_POCR, (1 << line));
159}
160
161struct ixp2000_i2c_pins {
162 unsigned long sda_pin;
163 unsigned long scl_pin;
164};
165
166#endif /* !__ASSEMBLY__ */