2 /* include/asm-m68knommu/cs89x0_fct.h: arch/platformm specific code for CS89x0
4 * Copyright (C) 2004 Georges Menie
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
;
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);
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
)) {
44 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
47 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
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
;
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);
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
)) {
86 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
89 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
94 #elif defined(CONFIG_DRAGEN2)
96 static inline int cs89x_hw_init_hook(struct net_device
*dev
, int unit
)
99 printk("cs89x0:cs89x0_hw_init_hook(%d)\n", unit
);
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);
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
)) {
119 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
122 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
127 #elif defined(CONFIG_EZ328LCD) || defined(CONFIG_VZ328LCD)
129 static inline int cs89x_hw_init_hook(struct net_device
*dev
, int unit
)
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;
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
)) {
155 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
158 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
163 #elif defined(CONFIG_ARCH_TA7S)
165 static inline int cs89x_hw_init_hook(struct net_device
*dev
, int unit
)
168 return 1; /* only one device */
170 dev
->base_addr
= 0x10000001;
171 dev
->irq
= IRQ_CSL_USER_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
)) {
184 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
187 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
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];
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);
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
)) {
221 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
224 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
229 #elif defined(CONFIG_CWVZ328)
231 static inline int cs89x_hw_init_hook(struct net_device
*dev
, int unit
)
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;
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
)) {
264 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
267 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
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
;
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
) {
288 #ifdef na_enet_reset_n
289 *(volatile unsigned char*)na_enet_reset_n
=3;
292 dev
->base_addr
= na_enet
+1;
293 dev
->irq
= na_enet_irq
;
294 memcpy(dev
->dev_addr
, cs8900a_hwaddr
, 6);
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
)) {
307 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
310 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);
315 #elif defined(CONFIG_HYPERSTONE_CS89X0)
317 static inline int cs89x_hw_init_hook(struct net_device
*dev
, int unit
)
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 */
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
)) {
337 printk(KERN_DEBUG
"cs89x0: request_irq(%d) failed\n", dev
->irq
);
340 writereg(dev
, PP_BusCTL
, readreg(dev
, PP_BusCTL
)|ENABLE_IRQ
);