[U-Boot] [PATCH] Add NanoBone board support

Mark Jackson mpfj-list at newflow.co.uk
Mon Apr 22 13:39:51 CEST 2013


On 22/04/13 11:04, Mark Jackson wrote:
> On 16/04/13 20:22, Tom Rini wrote:
>> On Tue, Apr 16, 2013 at 08:14:13PM +0100, Mark Jackson wrote:
>>
>>> On 16/04/13 16:48, Tom Rini wrote:
>>>> On Tue, Apr 16, 2013 at 04:02:34PM +0100, Mark Jackson wrote:
> 
> <snip>
> 
>>>>> +static struct cpsw_platform_data cpsw_data = {
>>>>> +	.mdio_base		= CPSW_MDIO_BASE,
>>>>> +	.cpsw_base		= CPSW_BASE,
>>>>> +	.mdio_div		= 0xff,
>>>>> +	.channels		= 8,
>>>>> +	.cpdma_reg_ofs		= 0x800,
>>>>> +	.slaves			= 2,
>>>>
>>>> Is this all that was needed for both interfaces to work in U-Boot, along
>>>> with a config change or two?  If so, I should take a stab at getting
>>>> both working on the EVM-SK.
>>>
>>> Yes ... the config change is just to set CONFIG_PHY_ADDR to the
>>> correct value.
>>>
>>> Unfortunately, since the CONFIG_PHY_ADDR value is "hard-coded" into
>>> quite a bit of the uboot code, to change ports, you need to
>>> re-compile !!  Not ideal, and I don't suppose it's too much work to
>>> get both
>>> working together, but I don't see much demand for it.
>>
>> Ah, so it's not quite right :(  Other platforms support multiple
>> interfaces, but I don't know how they're setup.
> 
> Tom
> 
> I can see in drivers/net/cpsw.c:-
> 
> static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
> {
> ...
> 	phydev = phy_connect(priv->bus,
> 			CONFIG_PHY_ADDR,
> 			dev,
> 			slave->data->phy_if);
> ...
> }
> 
> As you can see the hardcoded CONFIG_PHY_ADDR is being used, despite the
> fact that it might be different for each slave.
> 
> Could you just replace that with "slave->data->phy_id" ?
> 
> I'll give it a try and see what happens.

No, that doesn't fix things.

It looks like the PHY device is stored in the cpsw struct (rather than
in the slave struct) ... from cpsw.c:-

struct cpsw_priv {
	struct eth_device		*dev;
	struct cpsw_platform_data	data;
	int				host_port;

	struct cpsw_regs		*regs;
	void				*dma_regs;
	struct cpsw_host_regs		*host_port_regs;
	void				*ale_regs;

	struct cpdma_desc		*descs;
	struct cpdma_desc		*desc_free;
	struct cpdma_chan		rx_chan, tx_chan;

	struct cpsw_slave		*slaves;
	struct phy_device		*phydev; <<<<<<<<<<<<<<<<<
	struct mii_dev			*bus;

	u32				mdio_link;
	u32				phy_mask;
};

So there's an assumption that you can only have a single PHY (even
though you can have 2 slaves).

I've gone as far as I dare with my limited knowledge.

Regards
Mark J.


More information about the U-Boot mailing list