83xx HDLC Driver Dev - Multiple PHYs?

Andy Fleming afleming at freescale.com
Tue Feb 5 11:39:24 EST 2008


On Jan 29, 2008, at 23:10, Russell McGuire wrote:

>
> All,
>
> I have gotten my HDLC driver up to the point where it can register  
> itself
> with the Linux kernel. However now I am faced with a dilemma and style
> question, that is probably best answered by you driver developers  
> that have
> more experience.
>
> I am putting support for multiple PHY's into the HDLC driver, but  
> after
> converting it to use the of_device tree, and inserting a UCC at 5000  
> for a
> single UCC HDLC driver, it occurred to me that if I insert more  
> devices
> (UCC at 6000, UCC at 7000, UCC at 8000) that the driver will attempt to load  
> multiple
> times.

There is already a mechanism to ensure modules aren't loaded again  
when a new device is found.  Look at the gianfar support again.  The  
mpc8548 CDS has 4 eTSEC devices and one driver which handles them all  
(gianfar).  The driver is initialized once.  The probe function will  
be called for each instance of the device.  You need to make sure  
your driver's probe function can be called once per device.

>
> Solution 3:
> Have phy-count=4; defined in the driver header, or a module  
> parameter, and
> have a single module instance of the driver itself responsible for  
> creating
> a single private data structure and setting up multiple UCC's and  
> PHY's?

No, please.  If the PHYs aren't discoverable, you might need  
something like that.  But I suspect you just have one PHY per  
device.  If you have more, how is that configured?  Is the hardware  
aware of the number of PHYs?  Or are you just selecting between  
different PHY addresses?

>
> This also feeds into a question on SET_NETDEV_DEV. How does it  
> react to
> multiple net devices attached to a single base driver?

SET_NETDEV_DEV declares the base *device* of the net device.  The  
driver is a separate issue.  And it shouldn't be a problem, because  
each device instance has its own private structure.

Andy


More information about the Linuxppc-embedded mailing list