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