]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/asm-arm/arch-ixp2000/platform.h
[ARM] 3050/1: remove ixp2000_reg_write erratum #66 workaround
[karo-tx-linux.git] / include / asm-arm / arch-ixp2000 / platform.h
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 static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
19 {
20         *((volatile unsigned long *)reg) = val;
21 }
22 #define ixp2000_reg_read(reg)   (*((volatile unsigned long *)reg))
23
24 /*
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.  
31  *
32  * acquire_slowport(&your_config);
33  * ...
34  * do slowport operations
35  * ...
36  * release_slowport();
37  *
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.
40  *
41  * The configuration only affects device 2 on the slowport, so the
42  * MTD map driver does not acquire/release the slowport.  
43  */
44 struct slowport_cfg {
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 */
50 };
51
52
53 void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
54 void ixp2000_release_slowport(struct slowport_cfg *);
55
56 /*
57  * IXP2400 A0/A1 and  IXP2800 A0/A1/A2 have broken slowport that requires
58  * tweaking of addresses in the MTD driver.
59  */
60 static inline unsigned ixp2000_has_broken_slowport(void)
61 {
62         unsigned long id = *IXP2000_PRODUCT_ID;
63         unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
64                                       IXP2000_MIN_PROD_TYPE_MASK);
65         return (((id_prod ==
66                   /* fixed in IXP2400-B0 */
67                   (IXP2000_MAJ_PROD_TYPE_IXP2000 |
68                    IXP2000_MIN_PROD_TYPE_IXP2400)) &&
69                  ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
70                 ((id_prod ==
71                   /* fixed in IXP2800-B0 */
72                   (IXP2000_MAJ_PROD_TYPE_IXP2000 |
73                    IXP2000_MIN_PROD_TYPE_IXP2800)) &&
74                  ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
75                 ((id_prod ==
76                   /* fixed in IXP2850-B0 */
77                   (IXP2000_MAJ_PROD_TYPE_IXP2000 |
78                    IXP2000_MIN_PROD_TYPE_IXP2850)) &&
79                  ((id & IXP2000_MAJ_REV_MASK) == 0)));
80 }
81
82 static inline unsigned int ixp2000_has_flash(void)
83 {
84         return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
85 }
86
87 static inline unsigned int ixp2000_is_pcimaster(void)
88 {
89         return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
90 }
91
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);
97
98 struct pci_sys_data;
99
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);
106
107 /*
108  * Several of the IXP2000 systems have banked flash so we need to extend the
109  * flash_platform_data structure with some private pointers
110  */
111 struct ixp2000_flash_data {
112         struct flash_platform_data *platform_data;
113         int nr_banks;
114         unsigned long (*bank_setup)(unsigned long);
115 };
116
117 struct ixp2000_i2c_pins {
118         unsigned long sda_pin;
119         unsigned long scl_pin;
120 };
121
122
123 #endif /*  !__ASSEMBLY__ */