--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: kernel-image-2.4.27: [PATCH] lne390 for Jensen Alphas
- From: Carsten Jacobi <carsten@ccac.rwth-aachen.de>
- Date: Sat, 29 Mar 2008 20:31:27 +0100
- Message-id: <E1Jfgm3-0000e0-00@carlin.dynalias.org>
Package: kernel-image-2.4.27
Version: jensen.1.0
Severity: normal
The patch has already made public in 1998
(http://lkml.org/lkml/1998/8/9/16) and again in 2003
(http://linux.derkeiler.com/Mailing-Lists/Kernel/2003-10/2341.html). I
am running the adapter ever since in my Jensen Alpha and it had been
working just fine during the last 10 years.
Now, since I posted the patch twice to the linux-kernel mailing list
without having any snippet of the code getting into the official kernel
I wonder if it could at least be possible to include it into a patch
set. Currently, I keep the patch in a file 998_lne390.c.diff.bz2 and
configured it as a patch set for "2.4.27-10sarge8".
Here comes the patch:
--- kernel-source/drivers/net/lne390.c.orig 2003-09-21 18:49:55.000000000 +0200
+++ kernel-source/drivers/net/lne390.c 2003-10-10 23:38:48.000000000 +0200
@@ -94,6 +94,7 @@
#define LNE390_DEBUG 0
static unsigned char irq_map[] __initdata = {15, 12, 11, 10, 9, 7, 5, 3};
+static unsigned char irq_reverse_map[] __initdata = {0xff, 0xff, 0xff, 7, 0xff, 6, 0xff, 5, 0xff, 4, 3, 2, 1, 0xff, 0xff, 0};
static unsigned int shmem_mapA[] __initdata = {0xff, 0xfe, 0xfd, 0xfff, 0xffe, 0xffc, 0x0d, 0x0};
static unsigned int shmem_mapB[] __initdata = {0xff, 0xfe, 0x0e, 0xfff, 0xffe, 0xffc, 0x0d, 0x0};
@@ -221,6 +222,10 @@
printk("%dkB memory at physical address %#lx\n",
LNE390_STOP_PG/4, dev->mem_start);
+#ifdef CONFIG_ALPHA_JENSEN
+ /* On the Jensen board EISA cards will see their own address
+ * space */
+#else
/*
BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
the card mem within the region covered by `normal' RAM !!!
@@ -246,6 +251,7 @@
printk("lne390.c: remapped %dkB card memory to virtual address %#lx\n",
LNE390_STOP_PG/4, dev->mem_start);
}
+#endif /* CONFIG_ALPHA_JENSEN */
dev->mem_end = dev->rmem_end = dev->mem_start
+ (LNE390_STOP_PG - LNE390_START_PG)*256;
@@ -352,7 +358,24 @@
unsigned long shmem = dev->mem_start + ((start_page - LNE390_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
+#ifndef CONFIG_ALPHA_JENSEN
isa_memcpy_toio(shmem, buf, count);
+#else
+ /* The mylex lne390 adapter requires 32bit access (see above) for every
+ * operation to the shared mem buffer. Since the block buffer is hardly
+ * aligned to a 32bit boundary isa_memcpy_toio() will use 16bit
+ * operations to access the buffer ... we must use something else here. */
+
+ const void *from = buf;
+ count -= 4;
+ do {
+ __raw_writel(*(const u16 *)from | (*(const u16 *)(from+2))<<16, (unsigned long) shmem);
+ count -= 4;
+ (unsigned long) shmem += 4;
+ from += 4;
+ } while (count >= 0);
+#endif
+
}
static int lne390_open(struct net_device *dev)
@@ -377,19 +400,23 @@
static int io[MAX_LNE_CARDS];
static int irq[MAX_LNE_CARDS];
static int mem[MAX_LNE_CARDS];
+static int activate[MAX_LNE_CARDS];
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
+MODULE_PARM(activate, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(mem, "memory base address(es)");
+MODULE_PARM_DESC(activate, "activate the board(s) to use indicated configuration(s)\n\tAttention: This overwrites the settings of your EISA Configuration!");
MODULE_DESCRIPTION("Mylex LNE390A/B EISA Ethernet driver");
MODULE_LICENSE("GPL");
int init_module(void)
{
- int this_dev, found = 0;
+ int this_dev, index, found = 0;
+ unsigned char lne390_config;
for (this_dev = 0; this_dev < MAX_LNE_CARDS; this_dev++) {
struct net_device *dev = &dev_lne[this_dev];
@@ -397,6 +424,52 @@
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev];
dev->init = lne390_probe;
+
+ /* Activate the adapter, this may overwrite the settings
+ * done in the EISA Configuration Utility! */
+
+ if (activate[this_dev]) {
+
+ if (inb_p(dev->base_addr + LNE390_ID_PORT) == 0xff) return -ENODEV;
+ if (dev->mem_start & 0xffff) {
+ printk (KERN_ERR "The lne390 shared mem buffer must be on a 16-bit boundary,\nwill try to initialize 0x%lx instead of 0x%lx\n", dev->mem_start & 0xffff0000, dev->mem_start);
+ dev->mem_start = dev->mem_start & 0xffff0000;
+ }
+ printk("Trying to activate LNE390 card in slot %d with irq %d and shared mem at 0x%lx\n", (int)dev->base_addr>>12, dev->irq, dev->mem_start);
+
+ /* Verify the irq number */
+ if ((dev->irq < 16) && (irq_reverse_map[dev->irq]!=0xff)) lne390_config = irq_reverse_map[dev->irq]<<3;
+ else {
+ printk(KERN_ERR "Sorry, the irq of lne390 cards can not be mapped to %d\n", dev->irq);
+ return -ENXIO;
+ }
+
+ /* Verify shared memory */
+ int revision = (inl(dev->base_addr + LNE390_ID_PORT) >> 24) & 0x01;
+ if (revision) {
+ for (index = 0; (index < 8) && (dev->mem_start >> 16 != shmem_mapB[index]); index++);
+ if (index > 7) {
+ printk (KERN_ERR "The lne390B adapter can not map shared mem at 0x%lx\n", dev->mem_start);
+ return -ENXIO;
+ }
+ else lne390_config = lne390_config | index;
+ }
+ else {
+ for (index = 0; (index < 8) && (dev->mem_start >> 16 != shmem_mapA[index]); index++);
+ if (index > 7) {
+ printk (KERN_ERR "The lne390A adapter can not map shared mem at 0x%lx\n", dev->mem_start);
+ return -ENXIO;
+ }
+ else lne390_config = lne390_config | index;
+ }
+
+ /* Now activate the adapter */
+ outb (0x0, dev->base_addr + LNE390_RESET_PORT);
+ outb (0x1, dev->base_addr + LNE390_RESET_PORT);
+ outb (lne390_config, dev->base_addr + LNE390_CFG2);
+ printk ("lne390 in slot %d has been activated\n", dev->base_addr>>12);
+ }
+
/* Default is to only install one card. */
if (io[this_dev] == 0 && this_dev != 0) break;
if (register_netdev(dev) != 0) {
-- System Information:
Debian Release: 3.1
Architecture: alpha
Kernel: Linux 2.4.27
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Versions of packages kernel-image-2.4.27 depends on:
ii coreutils [fileutils] 5.2.1-2 The GNU core utilities
ii fileutils 5.97-5.3 The GNU file management utilities
ii initrd-tools 0.1.81.1 tools to create initrd image for p
-- no debconf information
--- End Message ---
--- Begin Message ---
- To: 473292-done@bugs.debian.org
- Subject: Re: Bug#473292: kernel-image-2.4.27: [PATCH] lne390 for Jensen?Alphas
- From: Moritz Muehlenhoff <jmm@inutil.org>
- Date: Wed, 17 Feb 2010 19:30:24 +0100
- Message-id: <20100217183024.GA3525@galadriel.inutil.org>
- In-reply-to: <20090717230312.GA11161@galadriel.inutil.org>
- References: <E1Jfgm3-0000e0-00@carlin.dynalias.org> <20080620174616.GA2999@deprecation.cyrius.com> <200806281439.49234.carsten@ccac.rwth-aachen.de> <20080630081239.GN22629@deprecation.cyrius.com> <20090717230312.GA11161@galadriel.inutil.org>
On Sat, Jul 18, 2009 at 01:03:12AM +0200, Moritz Muehlenhoff wrote:
> On Mon, Jun 30, 2008 at 10:12:39AM +0200, Martin Michlmayr wrote:
> > * Carsten Jacobi <carsten@ccac.rwth-aachen.de> [2008-06-28 14:39]:
> > > Indeed, the same problem will also occur on 2.6 kernels. I have reported that
> > > to the linux-net mailing list:
> > >
> > > http://marc.info/?l=linux-netdev&m=120680212932082&w=2
> > >
> > > I am already used to apply the patch I need for my NIC any time a new debian
> > > kernel package is released (right, now this was the last one I guess), but
> > > indeed it would be nice to go into the 2.6-line in future.
> >
> > Ivan Kokshaysky has been doing a lot of Alpha kernel work recently.
> > Maybe he can help you get this patch into the mainline kernel.
>
> Ivan, if you find the time can you review Carsten's patch for
> inclusion?
No further feedback, closing. Alpha is no longer a release arch anyway.
Cheers,
Moritz
--- End Message ---