MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-m68knommu / cs89x0_fct.h
blob9ae90b91dae38a55c0ecf2d22325ce4a92fae6d0
2 /* include/asm-m68knommu/cs89x0_fct.h: arch/platformm specific code for CS89x0
4 * Copyright (C) 2004 Georges Menie
6 */
8 #ifndef _CS89X0_FCT_H_
9 #define _CS89X0_FCT_H_
11 #if defined(CONFIG_UCSIMM)
13 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
15 extern unsigned char *cs8900a_hwaddr;
17 if (unit != 0)
18 return 1; /* only one device */
20 /* set up the chip select */
21 *(volatile unsigned char *)0xfffff42b |= 0x01; /* output /sleep */
22 *(volatile unsigned short *)0xfffff428 |= 0x0101; /* not sleeping */
23 *(volatile unsigned char *)0xfffff42b &= ~0x02; /* input irq5 */
24 *(volatile unsigned short *)0xfffff428 &= ~0x0202; /* irq5 fcn on */
25 *(volatile unsigned short *)0xfffff102 = 0x8000; /* 0x04000000 */
26 *(volatile unsigned short *)0xfffff112 = 0x01e1; /* 128k, 2ws, FLASH, en */
28 dev->base_addr = 0x10000301;
29 dev->irq = IRQ5_IRQ_NUM;
30 memcpy(dev->dev_addr, cs8900a_hwaddr, 6);
32 return 0;
35 static inline int cs89x_set_irq(struct net_device *dev)
37 struct net_local *lp = (struct net_local *)dev->priv;
39 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
40 write_irq(dev, lp->chip_type, dev->irq);
41 *(volatile unsigned short *)0xfffff302 |= 0x0080; /* +ve pol irq */
42 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
43 if (net_debug)
44 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
45 return 1;
47 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
49 return 0;
52 #elif defined(CONFIG_UCDIMM)
54 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
56 extern unsigned char *cs8900a_hwaddr;
58 if (unit != 0)
59 return 1; /* only one device */
61 /* set up the chip select */
62 *(volatile unsigned char *)0xfffff430 |= 0x08;
63 *(volatile unsigned char *)0xfffff433 |= 0x08;
64 *(volatile unsigned char *)0xfffff431 |= (0x08); /* sleep */
65 *(volatile unsigned char *)0xfffff42b &= ~0x02; /* input irq5 */
66 *(volatile unsigned short *)0xfffff428 &= ~0x0202; /* irq5 fcn on */
67 *(volatile unsigned short *)0xfffff102 = 0x8000; /* 0x04000000 */
68 *(volatile unsigned short *)0xfffff112 = 0x01e1; /* 128k, 2ws, FLASH, en */
70 dev->base_addr = 0x10000301;
71 dev->irq = IRQ5_IRQ_NUM;
72 memcpy(dev->dev_addr, cs8900a_hwaddr, 6);
74 return 0;
77 static inline int cs89x_set_irq(struct net_device *dev)
79 struct net_local *lp = (struct net_local *)dev->priv;
81 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
82 write_irq(dev, lp->chip_type, dev->irq);
83 *(volatile unsigned short *)0xfffff302 |= 0x0080; /* +ve pol irq */
84 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
85 if (net_debug)
86 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
87 return 1;
89 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
91 return 0;
94 #elif defined(CONFIG_DRAGEN2)
96 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
98 if (net_debug)
99 printk("cs89x0:cs89x0_hw_init_hook(%d)\n", unit);
101 if (unit != 0)
102 return 1; /* only one device */
104 dev->base_addr = 0x08000041;
105 dev->irq = INT1_IRQ_NUM;
106 memcpy(dev->dev_addr, (void *) 0x400fffa, 6);
108 return 0;
111 static inline int cs89x_set_irq(struct net_device *dev)
113 struct net_local *lp = (struct net_local *)dev->priv;
115 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
116 write_irq(dev, lp->chip_type, dev->irq);
117 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
118 if (net_debug)
119 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
120 return 1;
122 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
124 return 0;
127 #elif defined(CONFIG_EZ328LCD) || defined(CONFIG_VZ328LCD)
129 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
131 if (unit != 0)
132 return 1; /* only one device */
134 dev->base_addr = 0x2000301;
135 dev->irq = IRQ5_IRQ_NUM;
136 dev->dev_addr[0] = 0x00;
137 dev->dev_addr[1] = 0x10;
138 dev->dev_addr[2] = 0x8b;
139 dev->dev_addr[3] = 0xf1;
140 dev->dev_addr[4] = 0xda;
141 dev->dev_addr[5] = 0x01;
143 return 0;
146 static inline int cs89x_set_irq(struct net_device *dev)
148 struct net_local *lp = (struct net_local *)dev->priv;
150 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
151 write_irq(dev, lp->chip_type, dev->irq);
152 *(volatile unsigned short *)0xfffff302 |= 0x0080; /* +ve pol irq */
153 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
154 if (net_debug)
155 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
156 return 1;
158 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
160 return 0;
163 #elif defined(CONFIG_ARCH_TA7S)
165 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
167 if (unit != 0)
168 return 1; /* only one device */
170 dev->base_addr = 0x10000001;
171 dev->irq = IRQ_CSL_USER_0;
173 return 0;
176 static inline int cs89x_set_irq(struct net_device *dev)
178 struct net_local *lp = (struct net_local *)dev->priv;
180 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
181 write_irq(dev, lp->chip_type, dev->irq);
182 if (request_irq(dev->irq, &net_interrupt, SA_INTERRUPT, dev->name, dev)) {
183 if (net_debug)
184 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
185 return 1;
187 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
189 return 0;
192 #elif defined(CONFIG_DRAGONIXVZ)
194 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
196 extern unsigned char cs8900a_hwaddr1[6];
198 if (unit != 0)
199 return 1; /* only one device */
201 /* set up the chip select */
202 *(volatile unsigned char *)0xfffff41b &= ~0x80; /* input irq6 */
203 *(volatile unsigned char *)0x04000105= 0x01; /* nSleep=1 */
205 dev->base_addr = 0x4000001;
206 dev->irq = IRQ6_IRQ_NUM;
207 memcpy(dev->dev_addr, cs8900a_hwaddr1, 6);
209 return 0;
212 static inline int cs89x_set_irq(struct net_device *dev)
214 struct net_local *lp = (struct net_local *)dev->priv;
216 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
217 write_irq(dev, lp->chip_type, dev->irq);
218 *(volatile unsigned short *)0xfffff302 &= ~0x1100; /* -ve pol, level sensitive irq */
219 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
220 if (net_debug)
221 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
222 return 1;
224 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
226 return 0;
229 #elif defined(CONFIG_CWVZ328)
231 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
233 if (unit != 0)
234 return 1; /* only one device */
236 *(volatile unsigned char *)0xfffff42b |= 0x01; /* output /sleep */
237 *(volatile unsigned short *)0xfffff428 |= 0x0101; /* not sleeping */
238 *(volatile unsigned char *)0xfffff42b &= ~0x02; /* input irq5 */
239 *(volatile unsigned short *)0xfffff428 &= ~0x0202; /* irq5 fcn on */
240 *(volatile unsigned short *)0xfffff102 = 0x2000; /* 0x4000000 */
241 *(volatile unsigned short *)0xfffff112 = 0x01e1; /* 128k, 2ws, FLASH, en */
243 dev->base_addr = 0x4000001;
244 dev->irq = IRQ5_IRQ_NUM;
245 dev->dev_addr[0] = 0x00;
246 dev->dev_addr[1] = 0x10;
247 dev->dev_addr[2] = 0x8b;
248 dev->dev_addr[3] = 0xf1;
249 dev->dev_addr[4] = 0xda;
250 dev->dev_addr[5] = 0x01;
252 return 0;
255 static inline int cs89x_set_irq(struct net_device *dev)
257 struct net_local *lp = (struct net_local *)dev->priv;
259 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
260 write_irq(dev, lp->chip_type, dev->irq);
261 *(volatile unsigned short *)0xfffff302 |= 0x0080; /* +ve pol irq */
262 if (request_irq(dev->irq, &net_interrupt, IRQ_FLG_STD, dev->name, dev)) {
263 if (net_debug)
264 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
265 return 1;
267 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
269 return 0;
272 #elif defined(CONFIG_EXCALIBUR)
274 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
276 extern unsigned char *cs8900a_hwaddr;
278 if (unit != 0)
279 return 1; /* only one device */
281 *(char *)na_enet = 0; /* Reset the chip to a usable state. */
282 #if 0 /* this is done in cs89x0_probe1 if (ioaddr & 1) flag is set */
283 dev->base_addr = ioaddr;
284 if (readreg(dev, PP_ChipID) != CHIP_EISA_ID_SIG) {
285 return -ENODEV;
287 #endif
288 #ifdef na_enet_reset_n
289 *(volatile unsigned char*)na_enet_reset_n=3;
290 #endif
292 dev->base_addr = na_enet+1;
293 dev->irq = na_enet_irq;
294 memcpy(dev->dev_addr, cs8900a_hwaddr, 6);
296 return 0;
299 static inline int cs89x_set_irq(struct net_device *dev)
301 struct net_local *lp = (struct net_local *)dev->priv;
303 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
304 write_irq(dev, lp->chip_type, dev->irq);
305 if (request_irq(dev->irq, &net_interrupt, SA_INTERRUPT, dev->name, dev)) {
306 if (net_debug)
307 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
308 return 1;
310 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
312 return 0;
315 #elif defined(CONFIG_HYPERSTONE_CS89X0)
317 static inline int cs89x_hw_init_hook(struct net_device *dev, int unit)
319 if (unit != 0)
320 return 1; /* only one device */
322 dev->base_addr = 0x01000301;
323 dev->irq = CONFIG_HYPERSTONE_CS89X0_IRQ-1;
324 memcpy(dev->dev_addr, "\x48\x79\x4c\x6e\x78\x30", 6); /* FIXME */
326 return 0;
329 static inline int cs89x_set_irq(struct net_device *dev)
331 struct net_local *lp = (struct net_local *)dev->priv;
333 writereg(dev, PP_BusCTL, 0); /* Disable Interrupts. */
334 write_irq(dev, lp->chip_type, dev->irq);
335 if (request_irq(dev->irq, &net_interrupt, SA_INTERRUPT, dev->name, dev)) {
336 if (net_debug)
337 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
338 return 1;
340 writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL)|ENABLE_IRQ );
342 return 0;
345 #endif
347 #endif