public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mark Jackson <mpfj-list@newflow.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Add NanoBone board support
Date: Mon, 22 Apr 2013 12:39:51 +0100	[thread overview]
Message-ID: <51752187.8010602@newflow.co.uk> (raw)
In-Reply-To: <51750B43.8060602@newflow.co.uk>

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.

  reply	other threads:[~2013-04-22 11:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 15:02 [U-Boot] [PATCH] Add NanoBone board support Mark Jackson
2013-04-16 15:48 ` Tom Rini
2013-04-16 19:14   ` Mark Jackson
2013-04-16 19:22     ` Tom Rini
2013-04-22 10:04       ` Mark Jackson
2013-04-22 11:39         ` Mark Jackson [this message]
2013-04-16 19:25     ` Mark Jackson
2013-04-16 19:27       ` Tom Rini
2013-04-16 19:31         ` Mark Jackson
2013-04-19 20:58   ` Mark Jackson
2013-04-19 22:04     ` Tom Rini
2013-04-17  5:27 ` Hebbar, Gururaja
2013-04-17 17:42   ` Mark Jackson
2013-04-18  6:05     ` Hebbar, Gururaja
2013-04-18  6:20       ` Mark Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51752187.8010602@newflow.co.uk \
    --to=mpfj-list@newflow.co.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox