public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <monstr@monstr.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] net: Add LL TEMAC driver to u-boot
Date: Fri, 03 Dec 2010 10:33:37 +0100	[thread overview]
Message-ID: <4CF8B971.2060908@monstr.eu> (raw)
In-Reply-To: <20101128203503.7C6F71352CD@gemini.denx.de>

Dear Wolfgang,

Wolfgang Denk wrote:
> Dear Michal Simek,
> 
> sorry for the long delay.  We're still lacking a (new) network
> custodian...
> 
> In message <1280753377-2894-4-git-send-email-monstr@monstr.eu> you wrote:
>> Add Xilinx LL Temac driver to u-boot.
>>
>> Signed-off-by: Michal Simek <monstr@monstr.eu>
>> +++ b/drivers/net/xilinx_ll_temac.c
>> @@ -0,0 +1,561 @@
>> +/*
>> + *
> 
> Drop blank line.

done

> 
>> + * Copyright (C) 2008 - 2009 Michal Simek <monstr@monstr.eu>
>> + * June 2008 Microblaze optimalization, FIFO mode support
> 
> 2009? Not 2010 ?

done

> 
> 
>> +/* XPS_LL_TEMAC direct registers definition */
>> +#define TEMAC_RAF0		(dev->iobase + 0x00)
>> +#define TEMAC_TPF0		(dev->iobase + 0x04)
>> +#define TEMAC_IFGP0		(dev->iobase + 0x08)
>> +#define TEMAC_IS0		(dev->iobase + 0x0c)
>> +#define TEMAC_IP0		(dev->iobase + 0x10)
>> +#define TEMAC_IE0		(dev->iobase + 0x14)
>> +
>> +#define TEMAC_MSW0		(dev->iobase + 0x20)
>> +#define TEMAC_LSW0		(dev->iobase + 0x24)
>> +#define TEMAC_CTL0		(dev->iobase + 0x28)
>> +#define TEMAC_RDY0		(dev->iobase + 0x2c)
> 
> Please use a C struct to describe the register layout.

not fixed.

> 
>> +/* XPS_LL_TEMAC indirect registers offset definition */
>> +
>> +#define RCW0	0x200

not used

>> +#define RCW1	0x240
>> +#define TC	0x280
>> +#define FCC	0x2c0

not used

>> +#define EMMC	0x300
>> +#define PHYC	0x320

not used

>> +#define MC	0x340
>> +#define UAW0	0x380
>> +#define UAW1	0x384
>> +#define MAW0	0x388

not used

>> +#define MAW1	0x38c

not used

>> +#define AFM	0x390
>> +#define TIS	0x3a0

not used

>> +#define TIE	0x3a4

not used

>> +#define MIIMWD	0x3b0
>> +#define MIIMAI	0x3b4
> 
> Ditto.

They are offset for indirect accesses that's why should be just values.

> 
> 
>> +	out_be32((u32 *)TEMAC_LSW0, phy_data);
>> +	out_be32((u32 *)TEMAC_CTL0, CNTLREG_WRITE_ENABLE_MASK | MIIMWD);
>> +	out_be32((u32 *)TEMAC_LSW0, (phy_addr << 5) | (reg_addr));
>> +	out_be32((u32 *)TEMAC_CTL0, \
>> +			CNTLREG_WRITE_ENABLE_MASK | MIIMAI | (emac << 10));
>> +	while (!(in_be32((u32 *)TEMAC_RDY0) & XTE_RSE_MIIM_WR_MASK))
> 
> The need to have all these casts should ring some alarm bell to you.
> Please use a proper C struct instead.

sure.

> 
>> +	out_be32((u32 *)TEMAC_LSW0, reg_data);
>> +	out_be32((u32 *)TEMAC_CTL0, \
>> +			CNTLREG_WRITE_ENABLE_MASK | (emac << 10) | reg_offset);
> 
> Drop the backslash.

done

> 
>> +		debug ("%d: 0x%x ", j, result);
>> +	}
>> +	debug ("\n");
> 
> No spaces between function name and '('. Please fix globally.
> Consider running your patch through checkpatch...

done

> 
>> +	while (retries-- &&
>> +		((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) == 0x24))
>> +		;
> 
> Bad indentation.

done.

> 
> 
>> +	if (i == 0x7c0a3) {
> ...
>> +	if (i == 0x1410cc2) {
> 
> Please use self-explaining symbolic names for these magic numbers,
> and/or add sufficient comments what these mean.

There is option which I prefer which is phy lib.


> 
>> +static void debugll(int count)
>> +{
>> +	printf ("%d fifo isr 0x%08x, fifo_ier 0x%08x, fifo_rdfr 0x%08x, "
>> +		"fifo_rdfo 0x%08x fifo_rlr 0x%08x\n", count, ll_fifo->isr, \
>> +		ll_fifo->ier, ll_fifo->rdfr, ll_fifo->rdfo, ll_fifo->rlf);
> 
> Drop the backslash.  Please check & fix globally.

done.

> 

I have fixed some simple issues which you reported but not everything.
(microblaze custodian tree)

I am still not convince that I even would like to push this driver 
mainline and keep responsibility for it.

The next thing is that there is missing phy lib support which will be 
good to use.

Microblaze systems are slightly moving to new AXI bus where will be 
different eth IP core which will require new u-boot driver. Not sure
if will be based on this ll_temac driver.

Stephan: If you are willing to fix issues which Wolfgang reported, I am 
happy to test them.

Best regards,
Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

  reply	other threads:[~2010-12-03  9:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 12:49 [U-Boot] [PATCH 1/4] microblaze: Fix microblaze-generic config file Michal Simek
2010-08-02 12:49 ` [U-Boot] [PATCH 2/4] net: Move Emaclite to NET_MULTI Michal Simek
2010-08-02 12:49   ` [U-Boot] [PATCH 3/4] microblaze: Add support for NET_MULTI api Michal Simek
2010-08-02 12:49     ` [U-Boot] [PATCH 4/4] net: Add LL TEMAC driver to u-boot Michal Simek
2010-08-26 12:16       ` Michal Simek
2010-11-28 20:35       ` Wolfgang Denk
2010-12-03  9:33         ` Michal Simek [this message]
2010-08-26 12:16   ` [U-Boot] [PATCH 2/4] net: Move Emaclite to NET_MULTI Michal Simek
2010-09-01  5:48   ` Ben Warren
2010-10-11  1:37     ` Michal Simek

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=4CF8B971.2060908@monstr.eu \
    --to=monstr@monstr.eu \
    --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