lkml.org 
[lkml]   [2004]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] H8/300 update (3/3) smc9194 driver
- H8/300 target support
- fixed irq support
- high address (>0xffff) i/o fix
--
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -ru -X .exclude-diff linux-2.6.7/drivers/net/smc9194.c linux-2.6.7-h8300/drivers/net/smc9194.c
--- linux-2.6.7/drivers/net/smc9194.c 2004-06-16 14:19:44.000000000 +0900
+++ linux-2.6.7-h8300/drivers/net/smc9194.c 2004-06-17 18:17:36.000000000 +0900
@@ -94,16 +94,51 @@
#define USE_32_BIT 1
#endif

+#if defined(__H8300H__) || defined(__H8300S__)
+#define NO_AUTOPROBE
+#undef insl
+#undef outsl
+#define insl(a,b,l) io_insl_noswap(a,b,l)
+#define outsl(a,b,l) io_outsl_noswap(a,b,l)
+#endif
+
/*
.the SMC9194 can be at any of the following port addresses. To change,
.for a slightly different card, you can add it to the array. Keep in
.mind that the array must end in zero.
*/
-static unsigned int smc_portlist[] __initdata = {
- 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
- 0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0, 0x3C0, 0x3E0, 0
+
+struct devlist {
+ unsigned int port;
+ unsigned int irq;
};

+#if defined(CONFIG_H8S_EDOSK2674)
+static struct devlist smc_devlist[] __initdata = {
+ {.port = 0xf80000, .irq = 16},
+ {.port = 0, .irq = 0 },
+};
+#else
+static struct devlist smc_devlist[] __initdata = {
+ {.port = 0x200, .irq = 0},
+ {.port = 0x220, .irq = 0},
+ {.port = 0x240, .irq = 0},
+ {.port = 0x260, .irq = 0},
+ {.port = 0x280, .irq = 0},
+ {.port = 0x2A0, .irq = 0},
+ {.port = 0x2C0, .irq = 0},
+ {.port = 0x2E0, .irq = 0},
+ {.port = 0x300, .irq = 0},
+ {.port = 0x320, .irq = 0},
+ {.port = 0x340, .irq = 0},
+ {.port = 0x360, .irq = 0},
+ {.port = 0x380, .irq = 0},
+ {.port = 0x3A0, .irq = 0},
+ {.port = 0x3C0, .irq = 0},
+ {.port = 0x3E0, .irq = 0},
+ {.port = 0, .irq = 0},
+};
+#endif
/*
. Wait time for memory to be free. This probably shouldn't be
. tuned that much, as waiting for this means nothing else happens
@@ -466,7 +501,7 @@
static int smc_wait_to_send_packet( struct sk_buff * skb, struct net_device * dev )
{
struct smc_local *lp = netdev_priv(dev);
- unsigned short ioaddr = dev->base_addr;
+ unsigned int ioaddr = dev->base_addr;
word length;
unsigned short numPages;
word time_out;
@@ -580,7 +615,7 @@
byte packet_no;
struct sk_buff * skb = lp->saved_skb;
word length;
- unsigned short ioaddr;
+ unsigned int ioaddr;
byte * buf;

ioaddr = dev->base_addr;
@@ -635,7 +670,11 @@
#ifdef USE_32_BIT
if ( length & 0x2 ) {
outsl(ioaddr + DATA_1, buf, length >> 2 );
+#if !defined(__H8300H__) && !defined(__H8300S__)
outw( *((word *)(buf + (length & 0xFFFFFFFC))),ioaddr +DATA_1);
+#else
+ ctrl_outw( *((word *)(buf + (length & 0xFFFFFFFC))),ioaddr +DATA_1);
+#endif
}
else
outsl(ioaddr + DATA_1, buf, length >> 2 );
@@ -691,9 +730,12 @@
struct net_device * __init smc_init(int unit)
{
struct net_device *dev = alloc_etherdev(sizeof(struct smc_local));
- unsigned *port;
+ static struct devlist *smcdev = smc_devlist;
int err = 0;

+#ifndef NO_AUTOPROBE
+ smcdev = smc_devlist;
+#endif
if (!dev)
return ERR_PTR(-ENODEV);

@@ -711,11 +753,11 @@
} else if (io != 0) { /* Don't probe at all. */
err = -ENXIO;
} else {
- for (port = smc_portlist; *port; port++) {
- if (smc_probe(dev, *port) == 0)
+ for (;smcdev->port; smcdev++) {
+ if (smc_probe(dev, smcdev->port) == 0)
break;
}
- if (!*port)
+ if (!smcdev->port)
err = -ENODEV;
}
if (err)
@@ -741,6 +783,7 @@
*/
int __init smc_findirq( int ioaddr )
{
+#ifndef NO_AUTOPROBE
int timeout = 20;
unsigned long cookie;

@@ -795,6 +838,14 @@

/* and return what I found */
return probe_irq_off(cookie);
+#else /* NO_AUTOPROBE */
+ struct devlist *smcdev;
+ for (smcdev = smc_devlist; smcdev->port; smcdev++) {
+ if (smcdev->port == ioaddr)
+ return smcdev->irq;
+ }
+ return 0;
+#endif
}

/*----------------------------------------------------------------------
@@ -863,6 +914,7 @@
retval = -ENODEV;
goto err_out;
}
+#if !defined(CONFIG_H8S_EDOSK2674)
/* well, we've already written once, so hopefully another time won't
hurt. This time, I need to switch the bank register to bank 1,
so I can access the base address register */
@@ -877,6 +929,10 @@
retval = -ENODEV;
goto err_out;
}
+#else
+ (void)base_address_register; /* Warning suppression */
+#endif
+

/* check if the revision register is something that I recognize.
These might need to be added to later, as future revisions
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site