Jazzsonic driver updates
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Linux Kernel Mailing List
ChangeSet 1.1986, 2005/01/28 00:12:28-05:00, [email protected]
[PATCH] Jazzsonic driver updates
o Resurrect the Jazz SONIC driver after years of it not having been tested
o Convert fromSpace.cinitialization tomodule_init/ platform device.Signed-off-by Jeff Garzik <[email protected]>
drivers/net/sonic.c line 119
Quoted 5 lines
drivers/net/sonic.c +1
-1@@ -116,7 +116,7 @@/* * Map the packet data into the logical DMA address space */ -if ((laddr =vdma_alloc (PHYSADDR (skb->data), skb->len)) == ~0UL ) { +if ((laddr =vdma_alloc (CPHYSADDR (skb->data), skb->len)) == ~0UL ) {
^^^^^^^^^
This part broke compilation for Mac/m68k.
drivers/net/sonic.c line 122
Quoted 3 lines
drivers/net/sonic.c +0
-0printk ("%s: no VDMA entry for transmit available.\n" , dev->name);dev_kfree_skb (skb);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 19 lines · Geert Uytterhoeven
Quoted 12 lines · Linux Kernel Mailing List
ChangeSet 1.1986, 2005/01/28 00:12:28-05:00, [email protected]
[PATCH] Jazzsonic driver updates
o Resurrect the Jazz SONIC driver after years of it not having been tested
o Convert fromSpace.cinitialization tomodule_init/ platform device.Signed-off-by Jeff Garzik <[email protected]>drivers/net/sonic.c line 119
Quoted 5 lines
drivers/net/sonic.c +1
-1@@ -116,7 +116,7 @@/* * Map the packet data into the logical DMA address space */ -if ((laddr =vdma_alloc (PHYSADDR (skb->data), skb->len)) == ~0UL ) { +if ((laddr =vdma_alloc (CPHYSADDR (skb->data), skb->len)) == ~0UL ) {^^^^^^^^^
Quoted 2 lines
This part broke compilation for Mac/m68k.
Compilation is easily fixed, a patch is below.
BTW, this will still leave the macsonic driver in a non-working state. I have a patch to make it work again, which also re-introduces the support for 16-bit cards that went missing way back in 2.4.something (jazzsonic cards are all 32-bit, as are some mac cards). My patch basically ports the current macsonic driver from mac68k 2.2 branch, and has been widely tested on macs. Problem is, it hasn't yet been tested on MIPS, and it makes a lot of changes to sonic.c, which is shared by jazzsonic and macsonic.
Can anyone with a Jazz machine help out with this?
One of the difficulties is that MIPS and m68k architectures each have their own repo, and last time I looked, the SONIC code in the MIPS repo didn't agree with the SONIC code in the m68k repo. But, it shouldn't be difficult to make macsonic and jazzsonic work with the same core driver code again. Besides, we already have two SONIC drivers in the tree, seperating jazzsonic and macsonic would add a third.
-f
drivers/net/macsonic.c +1 -0
@@ -638,6 +638,7 @@#define vdma_free (baz)#define sonic_chiptomem (bat) (bat)#define PHYSADDR (quux) (quux) +#define CPHYSADDR (quux) (quux)#define sonic_request_irq request_irq#define sonic_free_irq free_irq
Quoted 19 lines · Geert Uytterhoeven
Quoted 12 lines · Linux Kernel Mailing List
ChangeSet 1.1986, 2005/01/28 00:12:28-05:00, [email protected]
[PATCH] Jazzsonic driver updates
o Resurrect the Jazz SONIC driver after years of it not having been tested
o Convert fromSpace.cinitialization tomodule_init/ platform device.Signed-off-by Jeff Garzik <[email protected]>drivers/net/sonic.c line 119
Quoted 5 lines
drivers/net/sonic.c +1
-1@@ -116,7 +116,7 @@/* * Map the packet data into the logical DMA address space */ -if ((laddr =vdma_alloc (PHYSADDR (skb->data), skb->len)) == ~0UL ) { +if ((laddr =vdma_alloc (CPHYSADDR (skb->data), skb->len)) == ~0UL ) {^^^^^^^^^
Quoted 5 lines
This part broke compilation for Mac/m68k.
Quoted 3 lines
drivers/net/sonic.c +0
-0printk ("%s: no VDMA entry for transmit available.\n" , dev->name);dev_kfree_skb (skb);
Oh funny. vdma_alloc() was created 10 years ago as an internal API for the Jazz machines. Didn't realize m68k had cloned it :-) If anything it seems this should be converted to the modern DMA API.
Ralf
Quoted 23 lines · Ralf Baechle
Quoted 21 lines · Geert Uytterhoeven
Quoted 12 lines · Linux Kernel Mailing List
ChangeSet 1.1986, 2005/01/28 00:12:28-05:00, [email protected]
[PATCH] Jazzsonic driver updates
o Resurrect the Jazz SONIC driver after years of it not having been tested
o Convert fromSpace.cinitialization tomodule_init/ platform device.Signed-off-by Jeff Garzik <[email protected]>drivers/net/sonic.c line 119
Quoted 5 lines
drivers/net/sonic.c +1
-1@@ -116,7 +116,7 @@/* * Map the packet data into the logical DMA address space */ -if ((laddr =vdma_alloc (PHYSADDR (skb->data), skb->len)) == ~0UL ) { +if ((laddr =vdma_alloc (CPHYSADDR (skb->data), skb->len)) == ~0UL ) {^^^^^^^^^This part broke compilation for Mac/m68k.
Quoted 6 lines
Quoted 3 lines
drivers/net/sonic.c line 122
Quoted 3 lines
drivers/net/sonic.c +0
-0printk ("%s: no VDMA entry for transmit available.\n" , dev->name);dev_kfree_skb (skb);Oh funny.
vdma_alloc()was created 10 years ago as an internal API for the Jazz machines. Didn't realize m68k had cloned it :-)
m68k doesn't clone it. This is from macsonic.c,
#define vdma_alloc(foo, bar) ((u32)foo)
Quoted 1 line
If anything it seems this should be converted to the modern DMA API.
Sure, but until that happens, it would be nice if the upstream kernel had the MIPS repo versions of sonic.c, sonic.h and jazzsonic.c. That way it might be possible for me to put together a patch for macsonic that both archs are happy with.
It doesn't require a new DMA API to fix all the built-in ethernet ports on 68k Macs.
-f
Quoted 1 line
Ralf
Quoted 23 lines · Ralf Baechle
Quoted 21 lines · Geert Uytterhoeven
Quoted 12 lines · Linux Kernel Mailing List
ChangeSet 1.1986, 2005/01/28 00:12:28-05:00, [email protected]
[PATCH] Jazzsonic driver updates
o Resurrect the Jazz SONIC driver after years of it not having been tested
o Convert fromSpace.cinitialization tomodule_init/ platform device.Signed-off-by Jeff Garzik <[email protected]>drivers/net/sonic.c line 119
Quoted 5 lines
drivers/net/sonic.c +1
-1@@ -116,7 +116,7 @@/* * Map the packet data into the logical DMA address space */ -if ((laddr =vdma_alloc (PHYSADDR (skb->data), skb->len)) == ~0UL ) { +if ((laddr =vdma_alloc (CPHYSADDR (skb->data), skb->len)) == ~0UL ) {^^^^^^^^^This part broke compilation for Mac/m68k.
Quoted 7 lines
Quoted 3 lines
drivers/net/sonic.c line 122
Quoted 3 lines
drivers/net/sonic.c +0
-0printk ("%s: no VDMA entry for transmit available.\n" , dev->name);dev_kfree_skb (skb);Oh funny.
vdma_alloc()was created 10 years ago as an internal API for the Jazz machines. Didn't realize m68k had cloned it :-) If anything it seems this should be converted to the modern DMA API.
I've just started merging my Mac sonic work into 2.6.12-rc6. m68k doesn't yet implement the modern DMA API, but it is easy to fake it for a while for macsonic.c. So I don't mind converting macsonic, jazzsonic and the shared sonic driver core to the new API.
But, I knowing nothing about the Jazz DMA controller. I need some help from the MIPS people:
Would I be right to say that vdma_{alloc,free}() can be changed to dma_{,un}map_single? The other Jazz specific routine that sonic uses is vdma_log2phys, and I don't know if that has a better alternative.
-f
Quoted 6 lines
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Finn Thain
Quoted 3 lines
Oh funny.
vdma_alloc()was created 10 years ago as an internal API for the Jazz machines. Didn't realize m68k had cloned it :-) If anything it seems this should be converted to the modern DMA API.I've just started merging my Mac sonic work into 2.6.12-rc6. m68k doesn't yet implement the modern DMA API, but it is easy to fake it for a while for
macsonic.c. So I don't mind converting macsonic, jazzsonic and the shared sonic driver core to the new API.But, I knowing nothing about the Jazz DMA controller. I need some help from the MIPS people:
It's a while since I last touched that machine, so remember this is from 10 year old memory ...
The Jazz DMA hardware is an MMU that translates virtual DMA to physical addresses. It's virtual DMA address space is 16MB in size, it's page size is 4kB. That's a set of capabilities that nicely translates into the DMA API.
Quoted 3 lines
Would I be right to say that vdma_{alloc,free}() can be changed to dma_{,un}map_single? The other Jazz specific routine that sonic uses is
vdma_log2phys, and I don't know if that has a better alternative.
The use of that call should simply be eleminated entirely. DMA API functions such as dma_alloc_coherent or dma_map_single will return a dma_handle which along with the virtual address returned is everything ever needed to program a DMA engine.
Ralf
Quoted 9 lines · Ralf Baechle
Quoted 7 lines · Finn Thain
Quoted 3 lines
Oh funny.
vdma_alloc()was created 10 years ago as an internal API for the Jazz machines. Didn't realize m68k had cloned it :-) If anything it seems this should be converted to the modern DMA API.I've just started merging my Mac sonic work into 2.6.12-rc6. m68k doesn't yet implement the modern DMA API, but it is easy to fake it for a while for
macsonic.c.
Roman Zippel has since posted an implementation of that API for m68k, BTW. So I'll use that for macsonic, and possibly the driver core as well if I can figure out how to do this with jazzsonic.
Quoted 6 lines
Quoted 5 lines
So I don't mind converting macsonic, jazzsonic and the shared sonic driver core to the new API.
But, I knowing nothing about the Jazz DMA controller. I need some help from the MIPS people:
Quoted 7 lines
It's a while since I last touched that machine, so remember this is from 10 year old memory ...
The Jazz DMA hardware is an MMU that translates virtual DMA to physical addresses. It's virtual DMA address space is 16MB in size, it's page size is 4kB. That's a set of capabilities that nicely translates into the DMA API.
I gather that someone has already put this hardware under the control of the generic DMA API?
Quoted 8 lines
Quoted 3 lines
Would I be right to say that vdma_{alloc,free}() can be changed to dma_{,un}map_single? The other Jazz specific routine that sonic uses is
vdma_log2phys, and I don't know if that has a better alternative.The use of that call should simply be eleminated entirely. DMA API functions such as
dma_alloc_coherentordma_map_singlewill return adma_handlewhich along with the virtual address returned is everything ever needed to program a DMA engine.
The sonic chip stores packets inside a "receive resource area" at a physical address that depends on the packets it previously stored there.
So the chip determines that address and the driver has to convert it from a physical to a virtual address with KSEG1ADDR(vdma_log2phys(x)), in order to memcpy the received packet.
Quoted 1 line
From what code I've looked at, and from what you've told me, I'm guessing
that bus_to_virt() won't cut it here (?)
-f
Quoted 3 lines
Ralf
Quoted 7 lines · Finn Thain
Quoted 4 lines
The Jazz DMA hardware is an MMU that translates virtual DMA to physical addresses. It's virtual DMA address space is 16MB in size, it's page size is 4kB. That's a set of capabilities that nicely translates into the DMA API.
I gather that someone has already put this hardware under the control of the generic DMA API?
That's being worked on.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
Would I be right to say that vdma_{alloc,free}() can be changed to dma_{,un}map_single? The other Jazz specific routine that sonic uses is
vdma_log2phys, and I don't know if that has a better alternative.The use of that call should simply be eleminated entirely. DMA API functions such as
dma_alloc_coherentordma_map_singlewill return adma_handlewhich along with the virtual address returned is everything ever needed to program a DMA engine.
Quoted 6 lines
The sonic chip stores packets inside a "receive resource area" at a physical address that depends on the packets it previously stored there.
So the chip determines that address and the driver has to convert it from a physical to a virtual address with KSEG1ADDR(vdma_log2phys(x)), in order to memcpy the received packet.
Wrong. The Sonic only does DMA to DMA addresses which will be translated to physical addresses by the IOMMU. That is it never ever deals with physical addresses directly.
When transmitting or receiving a buffer it has to be mapped into the DMA controller's address space first, for example through dma_map_single.
As the result you will obtain a DMA address which you will feed to the Sonic or put into a rx or tx ring, whatever. And you need to remember it in the driver private data, just like the virtual address of the buffer or the struct sk_buff pointer. So all you need is to look at your private data to find that virtual address you need for memcpy.
tg3 is a reasonable example of a driver - albeit not a simple one.
Quoted 2 lines
Quoted 1 line
From what code I've looked at, and from what you've told me, I'm guessing
that
bus_to_virt()won't cut it here (?)
bus_to_virt and virt_to_bus are shooting offences these days, no less.
Ralf
Quoted 11 lines · Ralf Baechle
Quoted 7 lines · Finn Thain
Quoted 4 lines
The Jazz DMA hardware is an MMU that translates virtual DMA to physical addresses. It's virtual DMA address space is 16MB in size, it's page size is 4kB. That's a set of capabilities that nicely translates into the DMA API.
I gather that someone has already put this hardware under the control of the generic DMA API?
That's being worked on.
OK, I guess I should code for it then. It is difficult to avoid converting the sonic core to the DMA API if I'm going to adopt it for macsonic. It just means that my changes to jazzsonic can't be tested yet, and so my work will remain out-of-tree.
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 4 lines
Would I be right to say that vdma_{alloc,free}() can be changed to dma_{,un}map_single? The other Jazz specific routine that sonic uses is
vdma_log2phys, and I don't know if that has a better alternative.The use of that call should simply be eleminated entirely. DMA API functions such as
dma_alloc_coherentordma_map_singlewill return adma_handlewhich along with the virtual address returned is everything ever needed to program a DMA engine.The sonic chip stores packets inside a "receive resource area" at a physical address that depends on the packets it previously stored there.
Quoted 7 lines
Quoted 3 lines
So the chip determines that address and the driver has to convert it from a physical to a virtual address with KSEG1ADDR(vdma_log2phys(x)), in order to memcpy the received packet.
Wrong. The Sonic only does DMA to DMA addresses which will be translated to physical addresses by the IOMMU. That is it never ever deals with physical addresses directly.
OK.
Quoted 8 lines
When transmitting or receiving a buffer it has to be mapped into the DMA controller's address space first, for example through
dma_map_single.As the result you will obtain a DMA address which you will feed to the Sonic or put into a rx or tx ring, whatever. And you need to remember it in the driver private data, just like the virtual address of the buffer or the struct
sk_buffpointer. So all you need is to look at your private data to find that virtual address you need for memcpy.
Not quite. The virtual address you are talking about is the beginning of the receive resource area, which is mapped as you describe. But, the chip then decides where in that area the recieved packet gets buffered, and the chip reports the address of that packet as a pointer. And this is why vdma_log2phys is used to convert the location of the packet (in IOMMU virtual address space) into CPU virtual address where the packet can be found by memcpy. And that is why I was asking for an alternative to vdma_log2phys. But I think calculating the offset of the packet with some IOMMU virtual pointer arithmetic will suffice in this case, since the initial mapping is probably going to be linear.
-f
Quoted 13 lines
tg3 is a reasonable example of a driver - albeit not a simple one.
Quoted 2 lines
Quoted 1 line
From what code I've looked at, and from what you've told me, I'm guessing
that
bus_to_virt()won't cut it here (?)
bus_to_virtandvirt_to_busare shooting offences these days, no less.Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-mips" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · On Thu, 16 Jun 2005, I wrote:
... the chip then decides where in that area the recieved packet gets buffered ... and that is why I was asking for an alternative to
vdma_log2phys...
But I forgot that it is possible to have the sonic chip store no more than one packet in each buffer before moving to the next one in the ring (though this isn't the case at present). So, as you say, vdma_log2phys isn't really required.
-f
Quoted 8 lines · Finn Thain
Quoted 3 lines
... the chip then decides where in that area the recieved packet gets buffered ... and that is why I was asking for an alternative to
vdma_log2phys...But I forgot that it is possible to have the sonic chip store no more than one packet in each buffer before moving to the next one in the ring (though this isn't the case at present). So, as you say,
vdma_log2physisn't really required.
Using that option doesn't really seem a good idea anyway.
Ralf
Quoted 6 lines · Ralf Baechle
Quoted 4 lines · Finn Thain
Quoted 3 lines
... the chip then decides where in that area the recieved packet gets buffered ... and that is why I was asking for an alternative to
vdma_log2phys...
Quoted 6 lines
Quoted 4 lines
But I forgot that it is possible to have the sonic chip store no more than one packet in each buffer before moving to the next one in the ring (though this isn't the case at present). So, as you say,
vdma_log2physisn't really required.Using that option doesn't really seem a good idea anyway.
Sorry, I mislead you (it has been 4 months since I looked at this). The existing code does only permit one packet per buffer. I did the same in my zero-copy version. So vdma_log2phys really isn't needed, and my patch actually removed it along with the memcpy.
-f
Quoted 7 lines
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-mips" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 macsonic/jazzsonic drivers update
Here is the latest sonic driver update, which I've been rattling on about for some time now. There are several reasons for this patch,
- Adopt the DMA API (jazzsonic, macsonic & core driver)
- Adopt the driver model (macsonic)
This part was cribbed from jazzsonic. As a consequence, macsonic once again works as a module. Driver model is also used by the DMA calls.
- Support 16 bit cards (macsonic & core driver, also affects jazzsonic)
This code was adapted from the mac68k linux 2.2 kernel, where it has languished for a long time.
- Support more mac cards (macsonic)
Also from mac68k repo.
- Zero-copy buffer handling (core driver)
Provides a nice performance improvement. The new algorithm incidentally helped to replace the old Jazz DMA code.
A nice consequence of this patch is that one can now diff jazzsonic.c and macsonic.c and get a comprehensible result. Maybe that will make them easier to maintain.
The patch has been tested on a variety of macs (several 32-bit quadra built-in NICs, a 16-bit LC PDS NIC and a 16-bit comm-slot NIC), but only compile tested for MIPS Jazz.
The DMA API has been implemented for m68k by Roman Zippel, and his patch is now required for macsonic to function. There is also a patch available which implements that API for Jazz machines (by Thomas I believe).
It would be nice if someone could test this on a little endian Jazz machine.
Comments and criticism welcomed.
-f
drivers/net/Space.c +0 -4
@@ -87,7 +87,6 @@extern struct net_device *tc515_probe (int unit);extern struct net_device *lance_probe (int unit);extern struct net_device *mace_probe (int unit); -extern struct net_device *macsonic_probe (int unit);extern struct net_device *mac8390_probe (int unit);extern struct net_device *mac89x0_probe (int unit);extern struct net_device *mc32_probe (int unit);
@@ -289,9 +288,6 @@#endif #ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */ {mace_probe, 0}, -#endif -#ifdef CONFIG_MACSONIC /* Mac SONIC-based Ethernet of all sorts */ - {macsonic_probe, 0}, #endif #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ {mac8390_probe, 0},
drivers/net/jazzsonic.c +74 -112
316 lines not on this page · raw message
drivers/net/macsonic.c +271 -271
781 lines not on this page · raw message
drivers/net/sonic.c +414 -260
908 lines not on this page · raw message
drivers/net/sonic.h +214 -246
523 lines not on this page · raw message
Re: [PATCH] macsonic/jazzsonic drivers update
Quoted 29 lines · Finn Thain
Here is the latest sonic driver update, which I've been rattling on about for some time now. There are several reasons for this patch,
- Adopt the DMA API (jazzsonic, macsonic & core driver)
- Adopt the driver model (macsonic)
This part was cribbed from jazzsonic. As a consequence, macsonic once again works as a module. Driver model is also used by the DMA calls.
- Support 16 bit cards (macsonic & core driver, also affects jazzsonic)
This code was adapted from the mac68k linux 2.2 kernel, where it has languished for a long time.
- Support more mac cards (macsonic)
Also from mac68k repo.
- Zero-copy buffer handling (core driver)
Provides a nice performance improvement. The new algorithm incidentally helped to replace the old Jazz DMA code.
A nice consequence of this patch is that one can now diff
jazzsonic.candmacsonic.cand get a comprehensible result. Maybe that will make them easier to maintain.The patch has been tested on a variety of macs (several 32-bit quadra built-in NICs, a 16-bit LC PDS NIC and a 16-bit comm-slot NIC), but only compile tested for MIPS Jazz.
The DMA API has been implemented for m68k by Roman Zippel, and his patch is now required for macsonic to function. There is also a patch available which implements that API for Jazz machines (by Thomas I believe).
Quoted 8 lines
It would be nice if someone could test this on a little endian Jazz machine.
Comments and criticism welcomed.
-f
Signed-off-by Finn Thain <[email protected]>
Patch looks OK to me. Comments:
1) Either Geert or Ralf can merge this, with my ACK.
2) Would be nice to get it tested on the machines you list as untested.
3) [possible problem in driver, not your changes] I wonder if IRQ_HANDLED is ever returned for shared interrupts? I don't know enough about the platform interrupt architecture to answer this question.
4) Remove casts to/from void. This is especially noticable in all the casts of the netdev_priv() return value.
5) If it doesn't cause too much patch noise, consider using enums rather than #defines, for numeric constants. This gives the compiler more type information and makes the symbols visible in a debugger. This is a -maintainer preference- issue overall, so don't sweat it if you disagree.
Re: [PATCH] macsonic/jazzsonic drivers update
Quoted 9 lines · Jeff Garzik
Patch looks OK to me. Comments:
1) Either Geert or Ralf can merge this, with my ACK.
2) Would be nice to get it tested on the machines you list as untested.
3) [possible problem in driver, not your changes] I wonder if
IRQ_HANDLEDis ever returned for shared interrupts? I don't know enough about the platform interrupt architecture to answer this question.
I don't know about jazz machines, but macsonic uses one of two IRQs, and neither one can be shared.
Quoted 2 lines
4) Remove casts to/from void. This is especially noticable in all the casts of the
netdev_priv()return value.
OK. I'll wait to hear from the other interested parties and if there's no objection to the first patch, I'll post a second patch that just removes the unecessary casts.
Thanks for your review.
-f
Quoted 10 lines
5) If it doesn't cause too much patch noise, consider using enums rather than #defines, for numeric constants. This gives the compiler more type information and makes the symbols visible in a debugger. This is a
drivers/net/jazzsonic.c +0
-2-maintainer preference- issue overall, so don't sweat it if you disagree. -To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] macsonic/jazzsonic drivers update (part 2)
In reply to Jeff GarzikQuoted 10 lines · Jeff Garzik
Patch looks OK to me. Comments:
1) Either Geert or Ralf can merge this, with my ACK.
2) Would be nice to get it tested on the machines you list as untested.
3) [possible problem in driver, not your changes] I wonder if
IRQ_HANDLEDis ever returned for shared interrupts? I don't know enough about the platform interrupt architecture to answer this question.
Quoted 7 lines
4) Remove casts to/from void. This is especially noticable in all the casts of the
netdev_priv()return value.5) If it doesn't cause too much patch noise, consider using enums rather than #defines, for numeric constants. This gives the compiler more type information and makes the symbols visible in a debugger. This is a -maintainer preference- issue overall, so don't sweat it if you disagree.
This patch removes the unecessary void* casts introduced in the first patch.
drivers/net/jazzsonic.c +4 -4
@@ -93,7 +93,7 @@static unsigned version_printed;unsigned int silicon_revision;unsigned int val; -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int err = -ENODEV ;int i;
@@ -145,7 +145,7 @@/* Allocate the entire chunk of memory for the descriptors. Note that this cannot cross a 64K boundary. */ -if ((lp->descriptors = (void *)dma_alloc_coherent (lp->device, +if ((lp->descriptors =dma_alloc_coherent (lp->device,SIZEOF_SONIC_DESC *SONIC_BUS_SCALE (lp->dma_bitmode), &lp->descriptors_laddr,GFP_KERNEL )) ==NULL ) {printk (KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n" , lp->device->bus_id);
@@ -211,7 +211,7 @@if (!dev)return -ENOMEM ; - lp = (struct sonic_local *)netdev_priv (dev); + lp =netdev_priv (dev); lp->device = device;SET_NETDEV_DEV (dev, device);SET_MODULE_OWNER (dev);
@@ -267,7 +267,7 @@ static int __devexit jazz_sonic_device_remove (struct device *device) {struct net_device *dev = device->driver_data; -struct sonic_local * lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local * lp =netdev_priv (dev);unregister_netdev (dev); dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
drivers/net/macsonic.c +7 -7
@@ -135,11 +135,11 @@int __init macsonic_init (struct net_device * dev) { -struct sonic_local * lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local * lp =netdev_priv (dev);/* Allocate the entire chunk of memory for the descriptors. Note that this cannot cross a 64K boundary. */ -if ((lp->descriptors = (void *)dma_alloc_coherent (lp->device, +if ((lp->descriptors =dma_alloc_coherent (lp->device,SIZEOF_SONIC_DESC *SONIC_BUS_SCALE (lp->dma_bitmode), &lp->descriptors_laddr,GFP_KERNEL )) ==NULL ) {printk (KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n" , lp->device->bus_id);
@@ -183,7 +183,7 @@int __init mac_onboard_sonic_ethernet_addr (struct net_device * dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);const int prom_addr =ONBOARD_SONIC_PROM_BASE ;int i;
@@ -255,7 +255,7 @@ {/* Bwahahaha */ static int once_is_more_than_enough; -struct sonic_local * lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local * lp =netdev_priv (dev);int sr;int commslot =0 ;
@@ -416,7 +416,7 @@ {static int slots;struct nubus_dev * ndev =NULL ; -struct sonic_local * lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local * lp =netdev_priv (dev);unsigned long base_addr, prom_addr;u16 sonic_dcr;int id =-1 ;
@@ -536,7 +536,7 @@if (!dev)return -ENOMEM ; - lp = (struct sonic_local *)netdev_priv (dev); + lp =netdev_priv (dev); lp->device = device;SET_NETDEV_DEV (dev, device);SET_MODULE_OWNER (dev);
@@ -582,7 +582,7 @@ static int __devexit mac_sonic_device_remove (struct device *device) {struct net_device *dev = device->driver_data; -struct sonic_local * lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local * lp =netdev_priv (dev);unregister_netdev (dev); dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
drivers/net/sonic.c +9 -9
@@ -44,7 +44,7 @@*/ static int sonic_open (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int i;if (sonic_debug >2 )
@@ -131,7 +131,7 @@*/ static int sonic_close (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int i;if (sonic_debug >2 )
@@ -177,7 +177,7 @@static void sonic_tx_timeout (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int i;/* Stop the interrupts for this */ SONIC_WRITE (SONIC_IMR ,0 );
@@ -221,7 +221,7 @@static int sonic_send_packet (struct sk_buff *skb,struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);dma_addr_t laddr;int length;int entry = lp->next_tx;
@@ -297,7 +297,7 @@static irqreturn_t sonic_interrupt (int irq,void *dev_id,struct pt_regs *regs) {struct net_device *dev = (struct net_device *) dev_id; -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int status;if (dev ==NULL ) {
@@ -436,7 +436,7 @@*/ static void sonic_rx (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int status;int entry = lp->cur_rx;
@@ -539,7 +539,7 @@*/ static struct net_device_stats *sonic_get_stats (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);/* read the tally counter from the SONIC and reset them */ lp->stats.rx_crc_errors +=SONIC_READ (SONIC_CRCT );
@@ -558,7 +558,7 @@*/ static void sonic_multicast_list (struct net_device *dev) { -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);unsigned int rcr;struct dev_mc_list *dmi = dev->mc_list;unsigned char *addr;
@@ -604,7 +604,7 @@static int sonic_init (struct net_device *dev) {unsigned int cmd; -struct sonic_local *lp = (struct sonic_local *)netdev_priv (dev); +struct sonic_local *lp =netdev_priv (dev);int i;/*
Re: [PATCH] macsonic/jazzsonic drivers update (part 2)
Quoted 15 lines · Finn Thain
Quoted 13 lines · Jeff Garzik
Patch looks OK to me. Comments:
1) Either Geert or Ralf can merge this, with my ACK.
2) Would be nice to get it tested on the machines you list as untested.
3) [possible problem in driver, not your changes] I wonder if
IRQ_HANDLEDis ever returned for shared interrupts? I don't know enough about the platform interrupt architecture to answer this question.4) Remove casts to/from void. This is especially noticable in all the casts of the
netdev_priv()return value.
Quoted 7 lines
Quoted 4 lines
5) If it doesn't cause too much patch noise, consider using enums rather than #defines, for numeric constants. This gives the compiler more type information and makes the symbols visible in a debugger. This is a -maintainer preference- issue overall, so don't sweat it if you disagree.
This patch removes the unecessary void* casts introduced in the first patch.
Update:
The two patches referred to above have been tested on Jazz MIPS and ack'd off-list by Thomas Bogendorfer. He also added the cosmetic change below.
I think this is ready to be merged (Jeff?)
Roman, is your m68k DMA implementation ready for commit? Thomas will take care of the Jazz one.
Thanks
-f
Acked-off: by Thomas Bogendoerfer <[email protected]>
jazzsonic.c renamed from jazzsonic.c.orig +2 -2
@@ -123,7 +123,7 @@if (sonic_debug && version_printed++ ==0 )printk (version); -printk ("%s: Sonic ethernet found at 0x%08lx, " , lp->device->bus_id, dev->base_addr); +printk (KERN_INFO "%s: Sonic ethernet found at 0x%08lx, " , lp->device->bus_id, dev->base_addr);/* * Put the sonic into software reset, then
@@ -238,7 +238,7 @@if (err) goto out1; -printk (KERN_INFO "%s: MAC " , dev->name); +printk ("%s: MAC " , dev->name);for (i =0 ; i <6 ; i++) {printk ("%2.2x" , dev->dev_addr[i]);if (i <5 )
Re: [PATCH] macsonic/jazzsonic drivers update (part 2)
Quoted 29 lines · Finn Thain
Quoted 16 lines · Finn Thain
Quoted 13 lines · Jeff Garzik
Patch looks OK to me. Comments:
1) Either Geert or Ralf can merge this, with my ACK.
2) Would be nice to get it tested on the machines you list as untested.
3) [possible problem in driver, not your changes] I wonder if
IRQ_HANDLEDis ever returned for shared interrupts? I don't know enough about the platform interrupt architecture to answer this question.4) Remove casts to/from void. This is especially noticable in all the casts of the
netdev_priv()return value.Quoted 7 lines
Quoted 4 lines
5) If it doesn't cause too much patch noise, consider using enums rather than #defines, for numeric constants. This gives the compiler more type information and makes the symbols visible in a debugger. This is a -maintainer preference- issue overall, so don't sweat it if you disagree.
This patch removes the unecessary void* casts introduced in the first patch.
Quoted 8 lines
Update:
The two patches referred to above have been tested on Jazz MIPS and ack'd off-list by Thomas Bogendorfer. He also added the cosmetic change below.
I think this is ready to be merged (Jeff?)
Roman, is your m68k DMA implementation ready for commit? Thomas will take care of the Jazz one.
Can you please resend with full description and sign-off list?
i.e. rule #6 of
http://linux.yyz.us/patch-format.html
Regards,
Jeff
Re: [PATCH 1/1 RESEND] macsonic/jazzsonic network drivers update
The purpose of this patch:
- Adopt the DMA API (jazzsonic, macsonic & core driver).
- Adopt the driver model (macsonic).
This part was cribbed from jazzsonic. As a consequence, macsonic once again works as a module. Driver model is also used by the DMA calls.
- Support 16 bit cards (macsonic & core driver, also affects jazzsonic)
This code was adapted from the mac68k linux 2.2 kernel, where it has languished for a long time.
- Support more 32-bit mac cards (macsonic)
Also from mac68k repo.
- Zero-copy buffer handling (core driver)
Provides a nice performance improvement. The new algorithm incidentally helped to replace the old Jazz DMA code.
The patch was tested on a variety of macs (several 32-bit quadra built-in NICs, a 16-bit LC PDS NIC and a 16-bit comm-slot NIC), and also on MIPS Jazz.
This patch combines the three previous patches in this thread.
drivers/net/Space.c +0 -4
@@ -87,7 +87,6 @@extern struct net_device *tc515_probe (int unit);extern struct net_device *lance_probe (int unit);extern struct net_device *mace_probe (int unit); -extern struct net_device *macsonic_probe (int unit);extern struct net_device *mac8390_probe (int unit);extern struct net_device *mac89x0_probe (int unit);extern struct net_device *mc32_probe (int unit);
@@ -289,9 +288,6 @@#endif #ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */ {mace_probe, 0}, -#endif -#ifdef CONFIG_MACSONIC /* Mac SONIC-based Ethernet of all sorts */ - {macsonic_probe, 0}, #endif #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ {mac8390_probe, 0},
drivers/net/jazzsonic.c +74 -112
316 lines not on this page · raw message
drivers/net/macsonic.c +271 -271
781 lines not on this page · raw message
drivers/net/sonic.c +414 -260
908 lines not on this page · raw message
drivers/net/sonic.h +214 -246
523 lines not on this page · raw message
Jeff Garzik
AppliedRe: [PATCH 1/1 RESEND] macsonic/jazzsonic network drivers update
applied