public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* VIA velocity network driver
@ 2013-04-27  5:30 Tony Prisk
  2013-04-27  8:53 ` Francois Romieu
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Prisk @ 2013-04-27  5:30 UTC (permalink / raw)
  To: Francois Romieu, Mailing List, Arm, netdev,
	linux-kernel@vger.kernel.org

I would like to add support to this driver for platform devices as found 
on VIA's APC8750 board. At the moment, I have a standalone platform 
version that works fine, but wanted to ask a few questions before 
sending a patch to merge this code into one driver.

The current driver is for PCI network cards, and uses pci dma functions. 
Most of the pci dma functions are wrappers around other functions which 
is what I have used for the platform version. For example:

rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data,
                     vptr->rx.buf_sz, PCI_DMA_FROMDEVICE);

is replaced with:
rd_info->skb_dma = dma_map_single(&vptr->plat_dev->dev, rd_info->skb->data,
                     vptr->rx.buf_sz, DMA_FROM_DEVICE);

Is it ok to use the non-pci versions (which are basically just the 
unwrapped pci versions) and pass the struct device *, or will I need to 
use the correct function for the correct instance.

Other than adding some new probe/remove functions, this is all that is 
needed to add platform driver support.

One bug/problem that arose is to do with the EEPROM code in 
velocity_init_registers(), in the case for VELOCITY_INIT_COLD:

         mac_eeprom_reload(regs);
         for (i = 0; i < 6; i++)
             writeb(vptr->dev->dev_addr[i], &(regs->PAR[i]));

I assume this is loading something from an EEPROM, but there is no 
EEPROM on the APC8750. Removing this code, the driver seems to work fine 
on the APC8750.
Could it be avoided with a vptr->has_no_eeprom that defaults to 0 to 
avoid breaking existing support?

Regards
Tony Prisk

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: VIA velocity network driver
  2013-04-27  5:30 VIA velocity network driver Tony Prisk
@ 2013-04-27  8:53 ` Francois Romieu
  0 siblings, 0 replies; 2+ messages in thread
From: Francois Romieu @ 2013-04-27  8:53 UTC (permalink / raw)
  To: Tony Prisk
  Cc: netdev, ShirleyHu, linux-kernel@vger.kernel.org, DavidLv,
	AndersMa, Mailing List, Arm

Tony Prisk <linux@prisktech.co.nz> :
> I would like to add support to this driver for platform devices as
> found on VIA's APC8750 board. At the moment, I have a standalone
> platform version that works fine, but wanted to ask a few questions
> before sending a patch to merge this code into one driver.
> 
> The current driver is for PCI network cards, and uses pci dma
> functions. Most of the pci dma functions are wrappers around other
> functions which is what I have used for the platform version.

[...]
> Is it ok to use the non-pci versions (which are basically just the
> unwrapped pci versions) and pass the struct device *, or will I need
> to use the correct function for the correct instance.

It's ok.

A standalone patch to convert the pci dma functions and check the
returned status code of the new one would be welcome regardless of
any future change in the driver data struct.

[...]
> I assume this is loading something from an EEPROM, but there is no
> EEPROM on the APC8750. Removing this code, the driver seems to work
> fine on the APC8750.

I feel a "no documentation" disturbance in the force.

Via's people Cced.

> Could it be avoided with a vptr->has_no_eeprom that defaults to 0 to
> avoid breaking existing support?

Yes. No unnecessary module option please.

-- 
Ueimor

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-27  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27  5:30 VIA velocity network driver Tony Prisk
2013-04-27  8:53 ` Francois Romieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox