Re: [PATCH v2 07/22] soc/fsl/bman_portals: defer probe after bman's probe

2018-09-27 Thread Li Yang
On Wed, Sep 26, 2018 at 8:26 AM  wrote:
>
> From: Laurentiu Tudor 
>
> A crash in bman portal probing could not be triggered (as is the case
> with qman portals) but it does make calls [1] into the bman driver so
> lets make sure the bman portal probing happens after bman's.
>
> [1]  bman_p_irqsource_add() (in bman) called by:
>init_pcfg() called by:
>  bman_portal_probe()
>
> Signed-off-by: Laurentiu Tudor 

As this is part of a bug fix for v4.19, applied on soc/fsl for fix.

> ---
>  drivers/soc/fsl/qbman/bman_portal.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/fsl/qbman/bman_portal.c 
> b/drivers/soc/fsl/qbman/bman_portal.c
> index 2f71f7df3465..f9edd28894fd 100644
> --- a/drivers/soc/fsl/qbman/bman_portal.c
> +++ b/drivers/soc/fsl/qbman/bman_portal.c
> @@ -91,7 +91,15 @@ static int bman_portal_probe(struct platform_device *pdev)
> struct device_node *node = dev->of_node;
> struct bm_portal_config *pcfg;
> struct resource *addr_phys[2];
> -   int irq, cpu;
> +   int irq, cpu, err;
> +
> +   err = bman_is_probed();
> +   if (!err)
> +   return -EPROBE_DEFER;
> +   if (err < 0) {
> +   dev_err(>dev, "failing probe due to bman probe 
> error\n");
> +   return -ENODEV;
> +   }
>
> pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL);
> if (!pcfg)
> --
> 2.17.1
>


Re: [PATCH v2 06/22] soc/fsl/qman_portals: defer probe after qman's probe

2018-09-27 Thread Li Yang
On Wed, Sep 26, 2018 at 8:26 AM  wrote:
>
> From: Laurentiu Tudor 
>
> Defer probe of qman portals after qman probing. This fixes the crash
> below, seen on NXP LS1043A SoCs:
>
> Unable to handle kernel NULL pointer dereference at virtual address
> 0004
> Mem abort info:
>   ESR = 0x9604
>   Exception class = DABT (current EL), IL = 32 bits
>   SET = 0, FnV = 0
>   EA = 0, S1PTW = 0
> Data abort info:
>   ISV = 0, ISS = 0x0004
>   CM = 0, WnR = 0
> [0004] user address but active_mm is swapper
> Internal error: Oops: 9604 [#1] PREEMPT SMP
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> 4.18.0-rc1-next-20180622-00200-g986f5c179185 #9
> Hardware name: LS1043A RDB Board (DT)
> pstate: 8005 (Nzcv daif -PAN -UAO)
> pc : qman_set_sdest+0x74/0xa0
> lr : qman_portal_probe+0x22c/0x470
> sp : 0803bbc0
> x29: 0803bbc0 x28: 
> x27: 090c1b88 x26: 0927cb68
> x25: 0927c000 x24: 0927cb60
> x23:  x22: 
> x21: 090e9000 x20: 800073b5c810
> x19: 800027401298 x18: 
> x17: 0001 x16: 
> x15: 090e96c8 x14: 80002740138a
> x13: 090f2000 x12: 0030
> x11: 08f25000 x10: 
> x9 : 80007bdfd2c0 x8 : 4000
> x7 : 80007393cc18 x6 : 0041
> x5 :  x4 : 
> x3 : 0004 x2 : 0927c900
> x1 :  x0 : 0004
> Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
> Call trace:
>  qman_set_sdest+0x74/0xa0
>  platform_drv_probe+0x50/0xa8
>  driver_probe_device+0x214/0x2f8
>  __driver_attach+0xd8/0xe0
>  bus_for_each_dev+0x68/0xc8
>  driver_attach+0x20/0x28
>  bus_add_driver+0x108/0x228
>  driver_register+0x60/0x110
>  __platform_driver_register+0x40/0x48
>  qman_portal_driver_init+0x20/0x84
>  do_one_initcall+0x58/0x168
>  kernel_init_freeable+0x184/0x22c
>  kernel_init+0x10/0x108
>  ret_from_fork+0x10/0x18
> Code: f9400443 11001000 927e4800 8b63 (b9400063)
> ---[ end trace 4f6d50489ecfb930 ]---
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b
>
> Signed-off-by: Laurentiu Tudor 

As this is part of a bug fix for v4.19, applied on soc/fsl for fix.

> ---
>  drivers/soc/fsl/qbman/qman_portal.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/soc/fsl/qbman/qman_portal.c 
> b/drivers/soc/fsl/qbman/qman_portal.c
> index 6d9da3b1b5ad..eef93cab84f1 100644
> --- a/drivers/soc/fsl/qbman/qman_portal.c
> +++ b/drivers/soc/fsl/qbman/qman_portal.c
> @@ -229,6 +229,14 @@ static int qman_portal_probe(struct platform_device 
> *pdev)
> int irq, cpu, err;
> u32 val;
>
> +   err = qman_is_probed();
> +   if (!err)
> +   return -EPROBE_DEFER;
> +   if (err < 0) {
> +   dev_err(>dev, "failing probe due to qman probe 
> error\n");
> +   return -ENODEV;
> +   }
> +
> pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL);
> if (!pcfg)
> return -ENOMEM;
> --
> 2.17.1
>


Re: [PATCH v2 05/22] soc/fsl/qbman: add APIs to retrieve the probing status

2018-09-27 Thread Li Yang
On Wed, Sep 26, 2018 at 8:26 AM  wrote:
>
> From: Laurentiu Tudor 
>
> Add a couple of new APIs to check the probing status of qman and bman:
>  'int bman_is_probed()' and 'int qman_is_probed()'.
> They return the following values.
>  *  1 if qman/bman were probed correctly
>  *  0 if qman/bman were not yet probed
>  * -1 if probing of qman/bman failed
> Drivers that use qman/bman driver services are required to use these
> APIs before calling any functions exported by qman or bman drivers
> or otherwise they will crash the kernel.
> The APIs will be used in the following couple of qbman portal patches
> and later in the series in the dpaa1 ethernet driver.
>
> Signed-off-by: Laurentiu Tudor 

As this is part of a bug fix for v4.19, applied on soc/fsl for fix.

> ---
>  drivers/soc/fsl/qbman/bman_ccsr.c | 11 +++
>  drivers/soc/fsl/qbman/qman_ccsr.c | 11 +++
>  include/soc/fsl/bman.h|  8 
>  include/soc/fsl/qman.h|  8 
>  4 files changed, 38 insertions(+)
>
> diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c 
> b/drivers/soc/fsl/qbman/bman_ccsr.c
> index d180da003e4a..b209c79511bb 100644
> --- a/drivers/soc/fsl/qbman/bman_ccsr.c
> +++ b/drivers/soc/fsl/qbman/bman_ccsr.c
> @@ -121,6 +121,7 @@ static void bm_set_memory(u64 ba, u32 size)
>   */
>  static dma_addr_t fbpr_a;
>  static size_t fbpr_sz;
> +static int __bman_probed;
>
>  static int bman_fbpr(struct reserved_mem *rmem)
>  {
> @@ -167,6 +168,12 @@ static irqreturn_t bman_isr(int irq, void *ptr)
> return IRQ_HANDLED;
>  }
>
> +int bman_is_probed(void)
> +{
> +   return __bman_probed;
> +}
> +EXPORT_SYMBOL_GPL(bman_is_probed);
> +
>  static int fsl_bman_probe(struct platform_device *pdev)
>  {
> int ret, err_irq;
> @@ -177,6 +184,8 @@ static int fsl_bman_probe(struct platform_device *pdev)
> u16 id, bm_pool_cnt;
> u8 major, minor;
>
> +   __bman_probed = -1;
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> dev_err(dev, "Can't get %pOF property 'IORESOURCE_MEM'\n",
> @@ -266,6 +275,8 @@ static int fsl_bman_probe(struct platform_device *pdev)
> return ret;
> }
>
> +   __bman_probed = 1;
> +
> return 0;
>  };
>
> diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c 
> b/drivers/soc/fsl/qbman/qman_ccsr.c
> index 0cfe79f85a66..383a49dcce68 100644
> --- a/drivers/soc/fsl/qbman/qman_ccsr.c
> +++ b/drivers/soc/fsl/qbman/qman_ccsr.c
> @@ -274,6 +274,7 @@ static const struct qman_error_info_mdata error_mdata[] = 
> {
>  static u32 __iomem *qm_ccsr_start;
>  /* A SDQCR mask comprising all the available/visible pool channels */
>  static u32 qm_pools_sdqcr;
> +static int __qman_probed;
>
>  static inline u32 qm_ccsr_in(u32 offset)
>  {
> @@ -689,6 +690,12 @@ static int qman_resource_init(struct device *dev)
> return 0;
>  }
>
> +int qman_is_probed(void)
> +{
> +   return __qman_probed;
> +}
> +EXPORT_SYMBOL_GPL(qman_is_probed);
> +
>  static int fsl_qman_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> @@ -699,6 +706,8 @@ static int fsl_qman_probe(struct platform_device *pdev)
> u16 id;
> u8 major, minor;
>
> +   __qman_probed = -1;
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> dev_err(dev, "Can't get %pOF property 'IORESOURCE_MEM'\n",
> @@ -845,6 +854,8 @@ static int fsl_qman_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> +   __qman_probed = 1;
> +
> return 0;
>  }
>
> diff --git a/include/soc/fsl/bman.h b/include/soc/fsl/bman.h
> index eaaf56df4086..5b99cb2ea5ef 100644
> --- a/include/soc/fsl/bman.h
> +++ b/include/soc/fsl/bman.h
> @@ -126,4 +126,12 @@ int bman_release(struct bman_pool *pool, const struct 
> bm_buffer *bufs, u8 num);
>   */
>  int bman_acquire(struct bman_pool *pool, struct bm_buffer *bufs, u8 num);
>
> +/**
> + * bman_is_probed - Check if bman is probed
> + *
> + * Returns 1 if the bman driver successfully probed, -1 if the bman driver
> + * failed to probe or 0 if the bman driver did not probed yet.
> + */
> +int bman_is_probed(void);
> +
>  #endif /* __FSL_BMAN_H */
> diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h
> index d4dfefdee6c1..597783b8a3a0 100644
> --- a/include/soc/fsl/qman.h
> +++ b/include/soc/fsl/qman.h
> @@ -1186,4 +1186,12 @@ int qman_alloc_cgrid_range(u32 *result, u32 count);
>   */
>  int qman_release_cgrid(u32 id);
>
> +/**
> + * qman_is_probed - Check if qman is probed
> + *
> + * Returns 1 if the qman driver successfully probed, -1 if the qman driver
> + * failed to probe or 0 if the qman driver did not probed yet.
> + */
> +int qman_is_probed(void);
> +
>  #endif /* __FSL_QMAN_H */
> --
> 2.17.1
>


Re: [PATCH v2 08/22] soc/fsl/qbman_portals: add APIs to retrieve the probing status

2018-09-27 Thread Li Yang
On Wed, Sep 26, 2018 at 8:26 AM  wrote:
>
> From: Laurentiu Tudor 
>
> Add a couple of new APIs to check the probing status of the required
> cpu bound qman and bman portals:
>  'int bman_portals_probed()' and 'int qman_portals_probed()'.
> They return the following values.
>  *  1 if qman/bman portals were all probed correctly
>  *  0 if qman/bman portals were not yet probed
>  * -1 if probing of qman/bman portals failed
> Drivers that use qman/bman portal driver services are required to use
> these APIs before calling any functions exported by these drivers or
> otherwise they will crash the kernel.
> First user will be the dpaa1 ethernet driver, coming in a subsequent
> patch.
>
> Signed-off-by: Laurentiu Tudor 
> ---
>  drivers/soc/fsl/qbman/bman_portal.c | 10 ++
>  drivers/soc/fsl/qbman/qman_portal.c | 10 ++
>  include/soc/fsl/bman.h  |  8 
>  include/soc/fsl/qman.h  |  9 +
>  4 files changed, 37 insertions(+)
>
> diff --git a/drivers/soc/fsl/qbman/bman_portal.c 
> b/drivers/soc/fsl/qbman/bman_portal.c
> index f9edd28894fd..8048d35de8a2 100644
> --- a/drivers/soc/fsl/qbman/bman_portal.c
> +++ b/drivers/soc/fsl/qbman/bman_portal.c
> @@ -32,6 +32,7 @@
>
>  static struct bman_portal *affine_bportals[NR_CPUS];
>  static struct cpumask portal_cpus;
> +static int __bman_portals_probed;
>  /* protect bman global registers and global data shared among portals */
>  static DEFINE_SPINLOCK(bman_lock);
>
> @@ -85,6 +86,12 @@ static int bman_online_cpu(unsigned int cpu)
> return 0;
>  }
>
> +int bman_portals_probed(void)
> +{
> +   return __bman_portals_probed;
> +}
> +EXPORT_SYMBOL_GPL(bman_portals_probed);
> +
>  static int bman_portal_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> @@ -148,6 +155,7 @@ static int bman_portal_probe(struct platform_device *pdev)
> spin_lock(_lock);
> cpu = cpumask_next_zero(-1, _cpus);
> if (cpu >= nr_cpu_ids) {
> +   __bman_portals_probed = 1;

What if the last CPU is not used for portals?  Is there a hard
requirement that all CPUs need to be used for portal?  What happens if
the last CPU is offline?

> /* unassigned portal, skip init */
> spin_unlock(_lock);
> return 0;
> @@ -173,6 +181,8 @@ static int bman_portal_probe(struct platform_device *pdev)
>  err_ioremap2:
> memunmap(pcfg->addr_virt_ce);
>  err_ioremap1:
> +__bman_portals_probed = 1;
> +

There are other error paths that not covered.

> return -ENXIO;
>  }
>
> diff --git a/drivers/soc/fsl/qbman/qman_portal.c 
> b/drivers/soc/fsl/qbman/qman_portal.c
> index eef93cab84f1..1b2fc981c269 100644
> --- a/drivers/soc/fsl/qbman/qman_portal.c
> +++ b/drivers/soc/fsl/qbman/qman_portal.c
> @@ -39,6 +39,7 @@ EXPORT_SYMBOL(qman_dma_portal);
>  #define CONFIG_FSL_DPA_PIRQ_FAST  1
>
>  static struct cpumask portal_cpus;
> +static int __qman_portals_probed;
>  /* protect qman global registers and global data shared among portals */
>  static DEFINE_SPINLOCK(qman_lock);
>
> @@ -219,6 +220,12 @@ static int qman_online_cpu(unsigned int cpu)
> return 0;
>  }
>
> +int qman_portals_probed(void)
> +{
> +   return __qman_portals_probed;
> +}
> +EXPORT_SYMBOL_GPL(qman_portals_probed);
> +
>  static int qman_portal_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> @@ -306,6 +313,7 @@ static int qman_portal_probe(struct platform_device *pdev)
> spin_lock(_lock);
> cpu = cpumask_next_zero(-1, _cpus);
> if (cpu >= nr_cpu_ids) {
> +   __qman_portals_probed = 1;

Ditto.

> /* unassigned portal, skip init */
> spin_unlock(_lock);
> return 0;
> @@ -336,6 +344,8 @@ static int qman_portal_probe(struct platform_device *pdev)
>  err_ioremap2:
> memunmap(pcfg->addr_virt_ce);
>  err_ioremap1:
> +   __qman_portals_probed = -1;
> +

Ditto.

> return -ENXIO;
>  }
>
> diff --git a/include/soc/fsl/bman.h b/include/soc/fsl/bman.h
> index 5b99cb2ea5ef..173e4049d963 100644
> --- a/include/soc/fsl/bman.h
> +++ b/include/soc/fsl/bman.h
> @@ -133,5 +133,13 @@ int bman_acquire(struct bman_pool *pool, struct 
> bm_buffer *bufs, u8 num);
>   * failed to probe or 0 if the bman driver did not probed yet.
>   */
>  int bman_is_probed(void);
> +/**
> + * bman_portals_probed - Check if all cpu bound bman portals are probed
> + *
> + * Returns 1 if all the required cpu bound bman portals successfully probed,
> + * -1 if probe errors appeared or 0 if the bman portals did not yet finished
> + * probing.
> + */
> +int bman_portals_probed(void);
>
>  #endif /* __FSL_BMAN_H */
> diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h
> index 597783b8a3a0..7732e48081eb 100644
> --- a/include/soc/fsl/qman.h
> +++ b/include/soc/fsl/qman.h
> @@ -1194,4 +1194,13 @@ int qman_release_cgrid(u32 id);
>   */
>  int qman_is_probed(void);
>

Re: [PATCH] ucc_geth: Add BQL support

2018-06-19 Thread Li Yang
On Tue, Jun 19, 2018 at 11:30 AM, Joakim Tjernlund
 wrote:
> Signed-off-by: Joakim Tjernlund 

Acked-by: Li Yang 

> ---
>  drivers/net/ethernet/freescale/ucc_geth.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c 
> b/drivers/net/ethernet/freescale/ucc_geth.c
> index f77ba9fa257b..6c99a9af6647 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3096,6 +3096,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
> struct net_device *dev)
>
> ugeth_vdbg("%s: IN", __func__);
>
> +   netdev_sent_queue(dev, skb->len);
> spin_lock_irqsave(>lock, flags);
>
> dev->stats.tx_bytes += skb->len;
> @@ -3242,6 +3243,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> struct ucc_geth_private *ugeth = netdev_priv(dev);
> u8 __iomem *bd; /* BD pointer */
> u32 bd_status;
> +   int howmany = 0;
> +   unsigned int bytes_sent = 0;
>
> bd = ugeth->confBd[txQ];
> bd_status = in_be32((u32 __iomem *)bd);
> @@ -3257,7 +3260,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
> if (!skb)
> break;
> -
> +   howmany++;
> +   bytes_sent += skb->len;
> dev->stats.tx_packets++;
>
> dev_consume_skb_any(skb);
> @@ -3279,6 +3283,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> bd_status = in_be32((u32 __iomem *)bd);
> }
> ugeth->confBd[txQ] = bd;
> +   netdev_completed_queue(dev, howmany, bytes_sent);
> return 0;
>  }
>
> --
> 2.13.6
>


Re: [PATCH 1/2] net: ethernet: ucc_geth: fix MEM_PART_MURAM mode

2017-02-09 Thread Li Yang
On Tue, Feb 7, 2017 at 3:05 AM, Christophe Leroy
<christophe.le...@c-s.fr> wrote:
> Since commit 5093bb965a163 ("powerpc/QE: switch to the cpm_muram
> implementation"), muram area is not part of immrbar mapping anymore
> so immrbar_virt_to_phys() is not usable anymore.
>
> Fixes: 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation)
> Signed-off-by: Christophe Leroy <christophe.le...@c-s.fr>

Acked-by: Li Yang <pku@gmail.com>

Regards,
Leo


Re: [PATCH 2/2] soc/fsl/qe: get rid of immrbar_virt_to_phys()

2017-02-09 Thread Li Yang
On Tue, Feb 7, 2017 at 3:05 AM, Christophe Leroy
<christophe.le...@c-s.fr> wrote:
> immrbar_virt_to_phys() is not used anymore
>
> Signed-off-by: Christophe Leroy <christophe.le...@c-s.fr>

Acked-by: Li Yang <pku@gmail.com>

Regards,
Leo


Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

2015-09-24 Thread Li Yang
On Wed, Sep 23, 2015 at 5:03 PM, Thomas Gleixner <t...@linutronix.de> wrote:
> On Wed, 23 Sep 2015, Li Yang wrote:
>> On Mon, Sep 21, 2015 at 11:51 AM, Thomas Gleixner <t...@linutronix.de> wrote:
>> > On Mon, 21 Sep 2015, Manoil Claudiu wrote:
>> >> >The device is set as wakeup capable using proper wakeup API but the
>> >> >driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
>> >> >which is incorrect.
>> >> >
>> >> >This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
>> >> >enable_irq_wake instead.
>> >> >
>> >>
>> >> What would be the purpose of IRQF_NO_SUSPEND flag then?  The flag is a
>> >> friendlier API compared to calling enable_irq_wake().  For older kernels,
>> >
>> > It's not an API, it's just a bandaid for lazy programmers.
>> >
>> >> on PPC architectures, the flag did the job.  When did this change? Since
>> >> when using IRQF_NO_SUSPEND is a "misuse"?
>> >
>> > It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing
>> > to do with wakeup interrupt sources. It's a flag which excludes the
>> > interrupt from the suspend mechanism, but it does not flag it a wakeup
>> > source.
>>
>> It was not very clear on the intended use of IRQF_NO_SUSPEND at the
>> beginning as it was not documented anywhere.  It's good that we have
>> the Documentation/power/suspend-and-interrupts.txt to clarify that
>> now.
>
> This is complete and utter bullshit to put it blunt.
>
> The documentation of IRQF_NO_SUSPEND as non suitable for marking a
> particular device interrupt as wakeup source was added on Feb 20 2015
> with commit 737eb0301f2. Further clarification was added with commit
> 7438b633a6b on Mar 4 2015.
>
> The IRQF_NO_SUSPEND crap was introduced to gianfar with commit
> 614b42426cc3 on Jul 31 2015.

It is definitely an oversight of us to have missed the new development
on this topic.  It's a problem for us and I'm not trying to defend
that.  But the decision to use IRQF_NO_SUSPEND for wakeup interrupt
was made several years ago. (https://lkml.org/lkml/2012/7/20/174)  I
was just trying to say that it's hard to make the right decision at
the beginning.

Regards,
Leo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

2015-09-23 Thread Li Yang
On Mon, Sep 21, 2015 at 11:51 AM, Thomas Gleixner  wrote:
> On Mon, 21 Sep 2015, Manoil Claudiu wrote:
>> >The device is set as wakeup capable using proper wakeup API but the
>> >driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
>> >which is incorrect.
>> >
>> >This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
>> >enable_irq_wake instead.
>> >
>>
>> What would be the purpose of IRQF_NO_SUSPEND flag then?  The flag is a
>> friendlier API compared to calling enable_irq_wake().  For older kernels,
>
> It's not an API, it's just a bandaid for lazy programmers.
>
>> on PPC architectures, the flag did the job.  When did this change? Since
>> when using IRQF_NO_SUSPEND is a "misuse"?
>
> It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing
> to do with wakeup interrupt sources. It's a flag which excludes the
> interrupt from the suspend mechanism, but it does not flag it a wakeup
> source.

It was not very clear on the intended use of IRQF_NO_SUSPEND at the
beginning as it was not documented anywhere.  It's good that we have
the Documentation/power/suspend-and-interrupts.txt to clarify that
now.

Regards,
Leo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Increase virtual FIFOs in ucc_geth.

2007-12-11 Thread Li Yang
 -Original Message-
 From: Joakim Tjernlund [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, December 11, 2007 2:46 AM
 To: Li Yang-r58472 [EMAIL PROTECTED] Netdev
 Cc: Joakim Tjernlund
 Subject: [PATCH] Increase virtual FIFOs in ucc_geth.
 
 Increase UCC_GETH_URFS_INIT to 1152 and
 UCC_GETH_UTFS_INIT to 896 to avoid HW Overrun/Underrun.

Please be noted that these values are only used for 10/100Mbps speed.
Did you get Overrun in 10/100M mode?

- Leo

 
 Signed-off-by: Joakim Tjernlund [EMAIL PROTECTED]
 ---
  drivers/net/ucc_geth.h |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h 
 index bb4dac8..d3f030b 100644
 --- a/drivers/net/ucc_geth.h
 +++ b/drivers/net/ucc_geth.h
 @@ -923,11 +923,11 @@ struct ucc_geth_hardware_statistics {
  #define PHY_CHANGE_TIME 2
  
  /* Fast Ethernet (10/100 Mbps) */
 -#define UCC_GETH_URFS_INIT  512  /* Rx 
 virtual FIFO size
 +#define UCC_GETH_URFS_INIT  1152 /* Rx 
 virtual FIFO size
*/
  #define UCC_GETH_URFET_INIT 256  /* 1/2 urfs */
  #define UCC_GETH_URFSET_INIT384  /* 3/4 urfs */
 -#define UCC_GETH_UTFS_INIT  512  /* Tx 
 virtual FIFO size
 +#define UCC_GETH_UTFS_INIT  896  /* Tx 
 virtual FIFO size
*/
  #define UCC_GETH_UTFET_INIT 256  /* 1/2 utfs */
  #define UCC_GETH_UTFTT_INIT 128
 --
 1.5.3.6
 
 
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Increase virtual FIFOs in ucc_geth.

2007-12-11 Thread Li Yang
 -Original Message-
 From: Joakim Tjernlund [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, December 11, 2007 6:58 PM
 To: Li Yang
 Cc: netdev@vger.kernel.org
 Subject: RE: [PATCH] Increase virtual FIFOs in ucc_geth.
 
 
 On Tue, 2007-12-11 at 11:11 +0100, Joakim Tjernlund wrote:
  On Tue, 2007-12-11 at 17:49 +0800, Li Yang wrote:
-Original Message-
From: Joakim Tjernlund [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 11, 2007 2:46 AM
To: Li Yang-r58472 [EMAIL PROTECTED] Netdev
Cc: Joakim Tjernlund
Subject: [PATCH] Increase virtual FIFOs in ucc_geth.

Increase UCC_GETH_URFS_INIT to 1152 and
UCC_GETH_UTFS_INIT to 896 to avoid HW Overrun/Underrun.
   
   Please be noted that these values are only used for 
 10/100Mbps speed.
   Did you get Overrun in 10/100M mode?
  
  I get both TX Underrun and RX overrun in 100Mbps, FD, just
  by running a tftp transfer. It feels like the URFET and/or URSFET
  isn't working. Why I don't know. CPU is MPC832x
  
Jocke
 
 I am a bit confused how the RBMR and TBMR is supposed to work. In
 ucc_get there is:
  out_be32(ugeth-p_tx_glbl_pram-tstate, ((u32) 
 function_code)  24);
  ugeth-p_rx_glbl_pram-rstate = function_code;
 First, should not the rx part look the same as tx?

To be consist with the chip RM, type for tstate is u32 and type for
rstate is u8.  Personally I don't think that it will be different to
access tstate as u8, but it will be more readable to be the same as
manual.  Well, rstate probably should be changed to use IO accessor too.

 Does programing rstate/tstate replace RBMR and TBMR?

RBMR and TBMR?  These are for other protocols.

- Leo
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)

2007-11-20 Thread Li Yang
 -Original Message-
 From: Phillips Kim 
 Sent: Tuesday, November 06, 2007 2:16 AM
 To: Li Yang-r58472; Kumar Gala; netdev@vger.kernel.org; 
 [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 
 (RGMII Timing)
 
 Hello all,
 
 the following patches fix RGMII timing for rev. 2.1 of the 
 mpc8360, according to erratum #2 (erratum text included 
 below).  Basically the most intrusive part is the addition of 
 two new RGMII Internal Delay modes; one for TX delay only, 
 and the other for RX delay only (i.e, not both at the same time).
 
 Please review, and since this affects both netdev and powerpc 
 trees, one maintainer should ack them for the other to push 
 upstream (i.e, Kumar acks them, and Leo picks them up to go 
 through netdev or the other way around; either way is fine 
 with me).  I'm hoping they're trivial enough to go in 2.6.24.
 
 Depending on how the review goes, a follow-on patch to u-boot 
 will be sent out that fixes up the phy-connection-type in the 
 device tree (from rgmii-id to rgmii-rxid iff on mpc8360rev2.1).
 

2-4
Acked-by: Li Yang [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth: add support for netpoll

2007-10-31 Thread Li Yang-r58472
 -Original Message-
 From: Anton Vorontsov [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, November 01, 2007 5:59 AM
 To: Li Yang-r58472
 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Subject: Re: [PATCH] ucc_geth: add support for netpoll
 
 On Mon, Oct 29, 2007 at 03:17:44PM +0300, Anton Vorontsov wrote:
 [...]
   Oops.  The original patch happened to hit the Junk mail box. :(
  
  That one as well? http://lkml.org/lkml/2007/10/11/128
  
   I think
   the patch is good to merge after the cosmetic change.  I 
 can do it 
   in next pull request to Jeff.
  
  Ok, great. Thanks.
 
 I'm wondering if you missed that email again. Maybe your mail 
 client/server doing weird things with emails from @ru.mvista.com?

No.  I have explicitly add you to the whitelist. :) Please be patient,
isn't this patch a new feature which can only be integrated in the merge
window?  Thanks.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Fix ethernet multicast for ucc_geth.

2007-10-29 Thread Li Yang-r58472

  @@ -2255,19 +2253,10 @@ static void 
 ucc_geth_set_multi(struct net_device *dev)
  if (!(dmi-dmi_addr[0]  1))
  continue;
   
  -   /* The address in dmi_addr is LSB first,
  -* and taddr is MSB first.  We have to
  -* copy bytes MSB first from dmi_addr.
  -*/
  -   mcptr = (u8 *) dmi-dmi_addr + 5;
  -   tdptr = (u8 *) tempaddr;
  -   for (j = 0; j  6; j++)
  -   *tdptr++ = *mcptr--;
  -
  /* Ask CPM to run CRC and set bit in
   * filter mask.
   */
  -   hw_add_addr_in_hash(ugeth, tempaddr);
  +   hw_add_addr_in_hash(ugeth, 
 dmi-dmi_addr);
 
 did the maintainer ever ACK this?

Yes, I did.  :)

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth: add support for netpoll

2007-10-28 Thread Li Yang-r58472
 -Original Message-
 From: Anton Vorontsov [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, October 27, 2007 10:38 PM
 To: Sergei Shtylyov
 Cc: Anton Vorontsov; netdev@vger.kernel.org; Li Yang-r58472; 
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PATCH] ucc_geth: add support for netpoll
 
 On Sat, Oct 27, 2007 at 05:09:51PM +0400, Sergei Shtylyov wrote:
  Hello.
  
  Anton Vorontsov wrote:
  
   This patch adds netpoll support for the QE UCC Gigabit Ethernet 
   driver. The approach is very similar to the gianfar driver.
  
  It's rather contrarywise -- this is standard approach 
 and gianfar 
  with its
  3 TSEC IRQs has a quite non-standard poll_controller() 
 implementation.
 
 Oh.. well, right -- gianfar a bit more comlex in that regard.
 
  
   Tested using netconsole.
  
  KGDBoE is considered a better test (I hope you've also 
 tested with it).
 
 At the time of posting it was tested using netconsole only, a 
 few days later it's was tested using KGDBoE also. So, it works indeed.
 
   Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] 
 diff --git 
   a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 
   18a6f48..06807ce 100644
   --- a/drivers/net/ucc_geth.c
   +++ b/drivers/net/ucc_geth.c
   @@ -3691,6 +3691,22 @@ static irqreturn_t 
 ucc_geth_irq_handler(int irq, void *info)
 return IRQ_HANDLED;
}

   +#ifdef CONFIG_NET_POLL_CONTROLLER
   +/*
   + * Polling 'interrupt' - used by things like netconsole to send 
   +skbs
   + * without having to re-enable interrupts. It's not called while
   + * the interrupt routine is executing.
   + */
   +static void ucc_netpoll(struct net_device *dev) {
   + struct ucc_geth_private *ugeth = netdev_priv(dev);
   +
   + disable_irq(ugeth-ug_info-uf_info.irq);
   + ucc_geth_irq_handler(ugeth-ug_info-uf_info.irq, dev);
   + enable_irq(ugeth-ug_info-uf_info.irq);
  
  Why not make it less complex (for a reader and gcc too :-) ?
 
 Yup, I'm agree here but it's too late. Again. ;-)
 
 This patch already accepted into the -mm (a week or so after 
 the silence), so.. now I'd rather not bother Andrew with such 
 really cosmetic changes. But if Jeff would directly apply 
 modfied patch, I'll send it. ;-)

Oops.  The original patch happened to hit the Junk mail box. :(  I think
the patch is good to merge after the cosmetic change.  I can do it in
next pull request to Jeff.

Thanks
- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] [POWERPC] ucc_geth: Eliminate compile warnings

2007-10-22 Thread Li Yang-r58472
 -Original Message-
 From: Medve Emilian-EMMEDVE1 
 Sent: Monday, October 22, 2007 9:48 PM
 To: David Miller
 Cc: [EMAIL PROTECTED]; Li Yang-r58472; 
 netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: RE: [PATCH] [POWERPC] ucc_geth: Eliminate compile warnings
 
 Hello David,
 
 
  No piece of code in the kernel should live in a vacuum.
  
  In order to improve overall code quality, every piece of 
 driver code 
  should avoid assuming things about pointer sizes and things of this 
  nature.
 
 I'm afraid we might be talking about orthogonal issues here. 
 I actively agree that all code (not only kernel) should be 
 written up to the coding/quality standards you mention above, 
 but I see a difference between fixing a warning and making a 
 driver portable (to 64-bit PowerPCs, to other platforms, 
 etc.). If there is a kernel todo list somewhere lets add to 
 it the task to make the ucc_geth more portable.
 
  Then the driver can get enabled into the build on every 
 platform, and 
  therefore nobody will break the build of this driver again since it 
  will get hit by allmodconfig
  et al. builds even on platforms other than the one it is meant for.
  
  This hack fix is not acceptable, really.
 
 Are you suggesting we leave those warnings there until 
 somebody decides to fix all the portability issues of this 
 driver? My patch is a small and insignificant improvement and 
 not the revolution you're asking for, but is an small 
 improvement today (I dislike warnings) vs. an improbable big 
 one in the future.

I'd say we can not use our way of doing things while working with the
community.  The community has to consider the kernel as a whole and thus
has its own virtue.  The warning has been there for some time.  It stays
as an indicator that we have something to do to improve the portability.
I will work on a patch to fix this portability issue.

- Leo

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Fix ethernet multicast for ucc_geth.

2007-10-18 Thread Li Yang-r58472
 -Original Message-
 From: Joakim Tjernlund [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 17, 2007 5:06 PM
 To: Netdev; Li Yang-r58472
 Subject: [PATCH] Fix ethernet multicast for ucc_geth.
 
 From 5761a9e5924b34615c748fba2dcb977ed04c1243 Mon Sep 17 
 00:00:00 2001
 From: Joakim Tjernlund [EMAIL PROTECTED]
 Date: Wed, 17 Oct 2007 11:01:44 +0200
 Subject: [PATCH] Fix ethernet multicast for ucc_geth.
  hw_add_addr_in_hash() already swaps byte  order, don't do it 
 in ucc_geth_set_multi() too.
 
 
 Signed-off-by: Joakim Tjernlund [EMAIL PROTECTED]

Acked-by: Li Yang [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] [net] fix gianfar (compile and warning)

2007-10-16 Thread Li Yang-r58472
 -Original Message-
 From: Sebastian Siewior [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 17, 2007 1:25 AM
 To: [EMAIL PROTECTED]
 Cc: Li Yang-r58472; netdev@vger.kernel.org; Grant Likely
 Subject: [PATCH] [net] fix gianfar (compile and warning)
 
 Currently it does not compile because a not declared variable is used.
 struct net_device_stats in driver's private struct is also unsued.
 This patch uses (hopefully) the right stats.
 
 Cc: Li Yang [EMAIL PROTECTED]
 Signed-off-by: Sebastian Siewior [EMAIL PROTECTED]

I have also submitted a patch to fixed this compile error two days
before, and it has been applied on Jeff's netdev tree.  But you can
submit a separate patch to cleanup the struct net_device_stats in
driver's private struct. Thanks.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] [POWERPC] ucc_geth: Fix build break introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0

2007-10-15 Thread Li Yang-r58472
 -Original Message-
 From: Medve Emilian-EMMEDVE1 
 Sent: Saturday, October 13, 2007 7:26 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Li 
 Yang-r58472; netdev@vger.kernel.org; [EMAIL PROTECTED]
 Cc: Medve Emilian-EMMEDVE1
 Subject: [PATCH] [POWERPC] ucc_geth: Fix build break 
 introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
 
 
   CC  drivers/net/ucc_geth.o
 drivers/net/ucc_geth.c: In function 'ucc_geth_startup':
 drivers/net/ucc_geth.c:2614: warning: assignment makes 
 integer from pointer without a cast
 drivers/net/ucc_geth.c:2651: warning: assignment makes 
 integer from pointer without a cast
 drivers/net/ucc_geth.c: In function 'ucc_geth_rx':
 drivers/net/ucc_geth.c:3483: error: 'dev' undeclared (first 
 use in this function)
 drivers/net/ucc_geth.c:3483: error: (Each undeclared 
 identifier is reported only once
 drivers/net/ucc_geth.c:3483: error: for each function it appears in.)
 make[2]: *** [drivers/net/ucc_geth.o] Error 1

Thanks for the patch.  Here are some comments.

The patch fixes the dev undeclared compile error not the warnings.  So
they shouldn't be listed here.

 
 Signed-off-by: Emil Medve [EMAIL PROTECTED]
 ---
 
 Here is a convenient link for the culprit patch: 
 http://git.kernel.org/?p=linux/kernel/git/jgarzik/netdev-2.6.g
 it;a=commit;h=09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
 
 netdev-2.6 scripts/checkpatch.pl 
 0001-POWERPC-ucc_geth-Fix-build-break-introduced-by-co.patch
 Your patch has no obvious style problems and is ready for submission.
 
  drivers/net/ucc_geth.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c 
 index d00e7d4..c43d4d1 100644
 --- a/drivers/net/ucc_geth.c
 +++ b/drivers/net/ucc_geth.c
 @@ -63,7 +63,7 @@
  #define UGETH_MSG_DEFAULT(NETIF_MSG_IFUP  1 ) - 1
  
  void uec_set_ethtool_ops(struct net_device *netdev);
 - 
 +
  static DEFINE_SPINLOCK(ugeth_lock);
  
  static struct {

There are quite a few references to the dev structure.  I would prefer
to add a new variable dev here.

- Leo

 @@ -3480,9 +3480,9 @@ static int ucc_geth_rx(struct 
 ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
   dev_kfree_skb_any(skb);
  
   
 ugeth-rx_skbuff[rxQ][ugeth-skb_currx[rxQ]] = NULL;
 - dev-stats.rx_dropped++;
 + ugeth-dev-stats.rx_dropped++;
   } else {
 - dev-stats.rx_packets++;
 + ugeth-dev-stats.rx_packets++;
   howmany++;
  
   /* Prep the skb for the packet */
 @@ -3491,7 +3491,7 @@ static int ucc_geth_rx(struct 
 ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
   /* Tell the skb what kind of packet this is */
   skb-protocol = eth_type_trans(skb, ugeth-dev);
  
 - dev-stats.rx_bytes += length;
 + ugeth-dev-stats.rx_bytes += length;
   /* Send the packet up the stack */
  #ifdef CONFIG_UGETH_NAPI
   netif_receive_skb(skb);
 @@ -3506,7 +3506,7 @@ static int ucc_geth_rx(struct 
 ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
   if (!skb) {
   if (netif_msg_rx_err(ugeth))
   ugeth_warn(%s: No Rx Data 
 Buffer, __FUNCTION__);
 - dev-stats.rx_dropped++;
 + ugeth-dev-stats.rx_dropped++;
   break;
   }
  
 --
 1.5.3.GIT
 
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2] [POWERPC] ucc_geth: Fix build break introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0

2007-10-15 Thread Li Yang-r58472
 -Original Message-
 From: Medve Emilian-EMMEDVE1 
 Sent: Monday, October 15, 2007 9:44 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Li 
 Yang-r58472; netdev@vger.kernel.org; [EMAIL PROTECTED]
 Cc: Medve Emilian-EMMEDVE1
 Subject: [PATCH v2] [POWERPC] ucc_geth: Fix build break 
 introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
 
 drivers/net/ucc_geth.c: In function 'ucc_geth_rx':
 drivers/net/ucc_geth.c:3483: error: 'dev' undeclared (first 
 use in this function)
 drivers/net/ucc_geth.c:3483: error: (Each undeclared 
 identifier is reported only once
 drivers/net/ucc_geth.c:3483: error: for each function it appears in.)
 make[2]: *** [drivers/net/ucc_geth.o] Error 1
 
 Signed-off-by: Emil Medve [EMAIL PROTECTED]

Acked-by: Li Yang [EMAIL PROTECTED]

 ---
 
 Here is a convenient link for the culprit patch: 
 http://git.kernel.org/?p=linux/kernel/git/jgarzik/netdev-2.6.g
 it;a=commit;h=09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
 
 netdev-2.6 scripts/checkpatch.pl 
 0001-POWERPC-ucc_geth-Fix-build-break-introduced-by-co.patch
 Your patch has no obvious style problems and is ready for submission.
 
  drivers/net/ucc_geth.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c 
 index d00e7d4..bec413b 100644
 --- a/drivers/net/ucc_geth.c
 +++ b/drivers/net/ucc_geth.c
 @@ -63,7 +63,7 @@
  #define UGETH_MSG_DEFAULT(NETIF_MSG_IFUP  1 ) - 1
  
  void uec_set_ethtool_ops(struct net_device *netdev);
 - 
 +
  static DEFINE_SPINLOCK(ugeth_lock);
  
  static struct {
 @@ -3454,9 +3454,12 @@ static int ucc_geth_rx(struct 
 ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
   u16 length, howmany = 0;
   u32 bd_status;
   u8 *bdBuffer;
 + struct net_device * dev;
  
   ugeth_vdbg(%s: IN, __FUNCTION__);
  
 + dev = ugeth-dev;
 +
   /* collect received buffers */
   bd = ugeth-rxBd[rxQ];
  
 --
 1.5.3.GIT
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gianfar: Fix regression caused by new napi interface

2007-10-15 Thread Li Yang
Protect all new napi function calls with CONFIG_GFAR_NAPI.  Otherwise
the driver will stop working when CONFIG_GFAR_NAPI disabled.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/gianfar.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index c15fb1f..cc288d8 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -932,10 +932,14 @@ tx_skb_fail:
 /* Returns 0 for success. */
 static int gfar_enet_open(struct net_device *dev)
 {
+#ifdef CONFIG_GFAR_NAPI
struct gfar_private *priv = netdev_priv(dev);
+#endif
int err;
 
+#ifdef CONFIG_GFAR_NAPI
napi_enable(priv-napi);
+#endif
 
/* Initialize a bunch of registers */
init_registers(dev);
@@ -945,13 +949,17 @@ static int gfar_enet_open(struct net_device *dev)
err = init_phy(dev);
 
if(err) {
+#ifdef CONFIG_GFAR_NAPI
napi_disable(priv-napi);
+#endif
return err;
}
 
err = startup_gfar(dev);
if (err)
+#ifdef CONFIG_GFAR_NAPI
napi_disable(priv-napi);
+#endif
 
netif_start_queue(dev);
 
@@ -1105,7 +1113,9 @@ static int gfar_close(struct net_device *dev)
 {
struct gfar_private *priv = netdev_priv(dev);
 
+#ifdef CONFIG_GFAR_NAPI
napi_disable(priv-napi);
+#endif
 
stop_gfar(dev);
 
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gianfar: Cleanup compile warning caused by 0795af57

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/gianfar.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6d1456a..c15fb1f 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -168,7 +168,6 @@ static int gfar_probe(struct platform_device *pdev)
struct gfar_private *priv = NULL;
struct gianfar_platform_data *einfo;
struct resource *r;
-   int idx;
int err = 0;
DECLARE_MAC_BUF(mac);
 
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gianfar: Fix compile regression caused by bea3348e

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/gianfar.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0db5e6f..2b758fa 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -261,7 +261,9 @@ static int gfar_probe(struct platform_device *pdev)
dev-hard_start_xmit = gfar_start_xmit;
dev-tx_timeout = gfar_timeout;
dev-watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_GFAR_NAPI
netif_napi_add(dev, priv-napi, gfar_poll, GFAR_DEV_WEIGHT);
+#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
dev-poll_controller = gfar_netpoll;
 #endif
@@ -931,6 +933,7 @@ tx_skb_fail:
 /* Returns 0 for success. */
 static int gfar_enet_open(struct net_device *dev)
 {
+   struct gfar_private *priv = netdev_priv(dev);
int err;
 
napi_enable(priv-napi);
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gianfar: Fix compile regression caused by 09f75cd7

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/gianfar.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 2b758fa..6d1456a 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1228,8 +1228,6 @@ static int gfar_change_mtu(struct net_device *dev, int 
new_mtu)
  * starting over will fix the problem. */
 static void gfar_timeout(struct net_device *dev)
 {
-   struct gfar_private *priv = netdev_priv(dev);
-
dev-stats.tx_errors++;
 
if (dev-flags  IFF_UP) {
@@ -1335,8 +1333,9 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, 
struct rxbd8 *bdp)
return skb;
 }
 
-static inline void count_errors(unsigned short status, struct gfar_private 
*priv)
+static inline void count_errors(unsigned short status, struct net_device *dev)
 {
+   struct gfar_private *priv = netdev_priv(dev);
struct net_device_stats *stats = dev-stats;
struct gfar_extra_stats *estats = priv-extra_stats;
 
@@ -1530,7 +1529,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int 
rx_work_limit)
 
dev-stats.rx_bytes += pkt_len;
} else {
-   count_errors(bdp-status, priv);
+   count_errors(bdp-status, dev);
 
if (skb)
dev_kfree_skb_any(skb);
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth: fix compilation

2007-09-18 Thread Li Yang-r58472
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 
 On Behalf Of Kumar Gala
 Sent: Friday, September 14, 2007 10:08 PM
 To: Jeff Garzik
 Cc: [EMAIL PROTECTED] list; netdev
 Subject: Re: [PATCH] ucc_geth: fix compilation
 
 
 On Sep 13, 2007, at 10:23 AM, Anton Vorontsov wrote:
 
  Currently qe_bd_t is used in the macro call -- 
 dma_unmap_single, which 
  is a no-op on PPC32, thus error is hidden today. Starting 
 with 2.6.24, 
  macro will be replaced by the empty static function, and 
 erroneous use 
  of qe_bd_t will trigger compilation error.
 
  Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
  ---
 
 Jeff, I'm going to pick this up via the powerpc.git tree 
 since its currently only broken in our for-2.6.24 branch 
 (because of other changes in there).  Any issues?

Kumar,

Kim Phillips has posted the same patch to netdev list before Anton.
Therefore, I do prefer to use his.  Thanks

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCH] ucc_geth fixes for 2.6.22-rc1

2007-08-03 Thread Li Yang
Please pull from 'ucc_geth' branch of
master.kernel.org:/pub/scm/linux/kernel/git/leo/fsl-soc.git ucc_geth

to receive the following fixes:

 drivers/net/ucc_geth_ethtool.c |1 -
 drivers/net/ucc_geth_mii.c |3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

Domen Puncer (1):
  ucc_geth: fix section mismatch

Jan Altenberg (1):
  ucc_geth: remove get_perm_addr from ucc_geth_ethtool.c


diff --git a/drivers/net/ucc_geth_ethtool.c
b/drivers/net/ucc_geth_ethtool.c
index a8994c7..64bef7c 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -379,7 +379,6 @@ static const struct ethtool_ops uec_ethtool_ops = {
.get_stats_count= uec_get_stats_count,
.get_strings= uec_get_strings,
.get_ethtool_stats  = uec_get_ethtool_stats,
-   .get_perm_addr  = ethtool_op_get_perm_addr,
 };
 
 void uec_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 5f8c2d3..6c257b8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -272,7 +272,8 @@ int __init uec_mdio_init(void)
return of_register_platform_driver(uec_mdio_driver);
 }
 
-void __exit uec_mdio_exit(void)
+/* called from __init ucc_geth_init, therefore can not be __exit */
+void uec_mdio_exit(void)
 {
of_unregister_platform_driver(uec_mdio_driver);
 }

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ucc_geth: add ethtool support

2007-07-18 Thread Li Yang
The patch enables statistics in ucc_geth and adds ethtool support to
ucc_geth driver.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/Makefile   |2 +-
 drivers/net/ucc_geth.c |   19 +-
 drivers/net/ucc_geth.h |6 +
 drivers/net/ucc_geth_ethtool.c |  388 
 drivers/net/ucc_geth_mii.c |6 +-
 5 files changed, 407 insertions(+), 14 deletions(-)
 create mode 100644 drivers/net/ucc_geth_ethtool.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index eb41676..d69f07c 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -18,7 +18,7 @@ gianfar_driver-objs := gianfar.o \
gianfar_sysfs.o
 
 obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
-ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o
+ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o
 
 #
 # link order important here
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e4736a3..4a3fd62 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -43,10 +43,6 @@
 
 #undef DEBUG
 
-#define DRV_DESC QE UCC Gigabit Ethernet Controller
-#define DRV_NAME ucc_geth
-#define DRV_VERSION 1.1
-
 #define ugeth_printk(level, format, arg...)  \
 printk(level format \n, ## arg)
 
@@ -65,6 +61,8 @@
 #define ugeth_vdbg(fmt, args...) do { } while (0)
 #endif /* UGETH_VERBOSE_DEBUG */
 
+void uec_set_ethtool_ops(struct net_device *netdev);
+   
 static DEFINE_SPINLOCK(ugeth_lock);
 
 static struct ucc_geth_info ugeth_primary_info = {
@@ -104,6 +102,7 @@ static struct ucc_geth_info ugeth_primary_info = {
.maxRetransmission = 0xf,
.collisionWindow = 0x37,
.receiveFlowControl = 1,
+   .transmitFlowControl = 1,
.maxGroupAddrInHash = 4,
.maxIndAddrInHash = 4,
.prel = 7,
@@ -139,7 +138,9 @@ static struct ucc_geth_info ugeth_primary_info = {
.numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
.largestexternallookupkeysize =
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
-   .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE,
+   .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
+   UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
+   UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
.vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
.vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
.rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
@@ -1200,7 +1201,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
return 0;
 }
 
-static int init_flow_control_params(u32 automatic_flow_control_mode,
+int init_flow_control_params(u32 automatic_flow_control_mode,
int rx_flow_control_enable,
int tx_flow_control_enable,
u16 pause_period,
@@ -2507,7 +2508,7 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* For more details see the hardware spec.   */
init_flow_control_params(ug_info-aufc,
 ug_info-receiveFlowControl,
-1,
+ug_info-transmitFlowControl,
 ug_info-pausePeriod,
 ug_info-extensionField,
 uf_regs-upsmr,
@@ -3732,8 +3733,6 @@ static int ucc_geth_close(struct net_device *dev)
return 0;
 }
 
-const struct ethtool_ops ucc_geth_ethtool_ops = { };
-
 static phy_interface_t to_phy_interface(const char *phy_connection_type)
 {
if (strcasecmp(phy_connection_type, mii) == 0)
@@ -3896,6 +3895,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
SET_NETDEV_DEV(dev, device);
 
/* Fill in the dev structure */
+   uec_set_ethtool_ops(dev);
dev-open = ucc_geth_open;
dev-hard_start_xmit = ucc_geth_start_xmit;
dev-tx_timeout = ucc_geth_timeout;
@@ -3909,7 +3909,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
 //dev-change_mtu = ucc_geth_change_mtu;
dev-mtu = 1500;
dev-set_multicast_list = ucc_geth_set_multi;
-   dev-ethtool_ops = ucc_geth_ethtool_ops;
 
ugeth-msg_enable = (NETIF_MSG_IFUP  1 ) - 1;
ugeth-phy_interface = phy_interface;
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index a29e1c3..bb4dac8 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -30,6 +30,10 @@
 
 #include ucc_geth_mii.h
 
+#define DRV_DESC QE UCC Gigabit Ethernet Controller
+#define DRV_NAME ucc_geth
+#define DRV_VERSION 1.1
+
 #define NUM_TX_QUEUES   8
 #define NUM_RX_QUEUES   8
 #define NUM_BDS_IN_PREFETCHED_BDS   4
@@ -896,6 +900,7 @@ struct ucc_geth_hardware_statistics

[PATCH 2/2] ucc_geth: add support to netif message level

2007-07-18 Thread Li Yang
Adds netif message level control to the ucc_geth driver.  The level can
be set by module parameter and ethtool.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
 drivers/net/ucc_geth.c |  315 +---
 1 files changed, 190 insertions(+), 125 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 4a3fd62..12e01b2 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -60,11 +60,19 @@
 #else
 #define ugeth_vdbg(fmt, args...) do { } while (0)
 #endif /* UGETH_VERBOSE_DEBUG */
+#define UGETH_MSG_DEFAULT  (NETIF_MSG_IFUP  1 ) - 1
 
 void uec_set_ethtool_ops(struct net_device *netdev);

 static DEFINE_SPINLOCK(ugeth_lock);
 
+static struct {
+   u32 msg_enable;
+} debug = { -1 };
+
+module_param_named(debug, debug.msg_enable, int, 0);
+MODULE_PARM_DESC(debug, Debug verbosity level (0=none, ..., 0x=all));
+
 static struct ucc_geth_info ugeth_primary_info = {
.uf_info = {
.bd_mem_part = MEM_PART_SYSTEM,
@@ -282,7 +290,8 @@ static int fill_init_enet_entries(struct ucc_geth_private 
*ugeth,
 
for (i = 0; i  num_entries; i++) {
if ((snum = qe_get_snum())  0) {
-   ugeth_err(fill_init_enet_entries: Can not get SNUM.);
+   if (netif_msg_ifup(ugeth))
+   ugeth_err(fill_init_enet_entries: Can not get 
SNUM.);
return snum;
}
if ((i == 0)  skip_page_for_first_entry)
@@ -292,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private 
*ugeth,
init_enet_offset =
qe_muram_alloc(thread_size, thread_alignment);
if (IS_ERR_VALUE(init_enet_offset)) {
-   ugeth_err
-   (fill_init_enet_entries: Can not allocate DPRAM memory.);
+   if (netif_msg_ifup(ugeth))
+   ugeth_err(fill_init_enet_entries: Can 
not allocate DPRAM memory.);
qe_put_snum((u8) snum);
return -ENOMEM;
}
@@ -1487,9 +1496,9 @@ static int adjust_enet_interface(struct ucc_geth_private 
*ugeth)
 
ret_val = init_preamble_length(ug_info-prel, ug_regs-maccfg2);
if (ret_val != 0) {
-   ugeth_err
-   (%s: Preamble length must be between 3 and 7 inclusive.,
-__FUNCTION__);
+   if (netif_msg_probe(ugeth))
+   ugeth_err(%s: Preamble length must be between 3 and 7 
inclusive.,
+__FUNCTION__);
return ret_val;
}
 
@@ -1727,7 +1736,8 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, 
enum comm_dir mode)
 
/* check if the UCC number is in range. */
if (ugeth-ug_info-uf_info.ucc_num = UCC_MAX_NUM) {
-   ugeth_err(%s: ucc_num out of range., __FUNCTION__);
+   if (netif_msg_probe(ugeth))
+   ugeth_err(%s: ucc_num out of range., __FUNCTION__);
return -EINVAL;
}
 
@@ -1755,7 +1765,8 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, 
enum comm_dir mode)
 
/* check if the UCC number is in range. */
if (ugeth-ug_info-uf_info.ucc_num = UCC_MAX_NUM) {
-   ugeth_err(%s: ucc_num out of range., __FUNCTION__);
+   if (netif_msg_probe(ugeth))
+   ugeth_err(%s: ucc_num out of range., __FUNCTION__);
return -EINVAL;
}
 
@@ -2307,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
 
if (!((uf_info-bd_mem_part == MEM_PART_SYSTEM) ||
  (uf_info-bd_mem_part == MEM_PART_MURAM))) {
-   ugeth_err(%s: Bad memory partition value., __FUNCTION__);
+   if (netif_msg_probe(ugeth))
+   ugeth_err(%s: Bad memory partition value.,
+   __FUNCTION__);
return -EINVAL;
}
 
@@ -2316,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private 
*ugeth)
if ((ug_info-bdRingLenRx[i]  UCC_GETH_RX_BD_RING_SIZE_MIN) ||
(ug_info-bdRingLenRx[i] %
 UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) {
-   ugeth_err
-   (%s: Rx BD ring length must be multiple of 4,
-no smaller than 8., __FUNCTION__);
+   if (netif_msg_probe(ugeth))
+   ugeth_err
+   (%s: Rx BD ring length must be multiple of 
4, no smaller than 8.,
+   __FUNCTION__);
return -EINVAL;
}
}
@@ -2326,9 +2340,10 @@ static int ucc_struct_init(struct

RE: [PATCH] QE Ethernet driver writes to wrong register to mask interrupts

2007-07-10 Thread Li Yang-r58472
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
 Behalf Of Tabi Timur-B04825
 Sent: Tuesday, July 10, 2007 8:51 PM
 To: [EMAIL PROTECTED]; netdev@vger.kernel.org
 Cc: Tabi Timur-B04825
 Subject: [PATCH] QE Ethernet driver writes to wrong register to mask
interrupts
 
 The QE Ethernet driver was writing to the wrong register to mask
interrupts.
 In ucc_geth_stop(), it was clearing UCCE instead of UCCM.
 
 Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Acked-by: Li Yang [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth.c, make PHY device optional.

2007-07-04 Thread Li Yang-r58472
{snip}
 
 OK, but then a new property in PHY node is needed which holds
 the initial speed and duplex.
 initial-phy-capacity = speed duplex ?
 This should be useful for real PHYs too if, for instance, autoneg
isn't
 working/supported/wanted.
 
 Maybe it should be:
 initial-phy-capacity = speed duplex autoneg
 or
 initial-phy-capability = speed duplex autoneg

How about separate autoneg to a property dumb-phy, which indicates the
PHY/switch doesn't provide MII register interface.  Therefore, it should
use the fixed speed and duplex from device node rather than registers.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth.c, make PHY device optional.

2007-07-03 Thread Li Yang-r58472
 -Original Message-
 From: Joakim Tjernlund [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 03, 2007 7:20 PM
 To: Li Yang-r58472
 Cc: linuxppc-dev Development; Netdev; Fleming Andy-afleming
 Subject: RE: [PATCH] ucc_geth.c, make PHY device optional.
 
 On Tue, 2007-07-03 at 16:22 +0800, Li Yang-r58472 wrote:
   -Original Message-
   From: Joakim Tjernlund [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, July 03, 2007 3:21 PM
   To: Li Yang-r58472
   Cc: linuxppc-dev Development; Netdev; Fleming Andy-afleming
   Subject: RE: [PATCH] ucc_geth.c, make PHY device optional.
  
   On Tue, 2007-07-03 at 11:42 +0800, Li Yang-r58472 wrote:
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
 Behalf Of Joakim Tjernlund
 Sent: Tuesday, July 03, 2007 8:52 AM
 To: 'linuxppc-dev Development'; 'Netdev'; Li Yang-r58472
 Subject: [PATCH] ucc_geth.c, make PHY device optional.

  This patch makes the PHY optional for ucc_geth.c ethernet
  driver.
  This is useful to support a direct mii to mii connection to,
for
example,
  a onboard swicth.
 
  Signed-off-by: Joakim Tjernlund
[EMAIL PROTECTED]
 
Hi Joakim,
   
I'm wondering if we really need to have the option to disable
  phylib.
  
   maybe, but it has to be dynamic too. I need to use PHY on UCC2 and
mii
   on UCC3 and UCC4.
  
Actually we have made phylib selected by default for ucc_geth.
Many
  L2
switch chips have the capacity to be controlled.  Therefore they
can
  be
managed as a phy device.
  
   Yes, they can be but why force a PHY impl. when its is of no use?
The
   only thing the eth driver needs from the it is speed and duplex.
If
   these are fixed, you don't need to talk with a PHY.
 
  The driver needs to get and set the link speed/status on runtime
(such
  as for ethtool interface).  Currently this is implementation through
  phydev interface.  IMHO, it will be easier to maintain if we only
use
  this standard interface, rather than use different interfaces for
  different cases.
 
 hmm maybe, but there is no need to much around with speed/status
 from user space. The speed and duplex must be set before user space
 is up.
 
 
  
For the MII interface which is not
configurable, shouldn't we use the fixed phy support from
Vitaly?
  
   Well, I think the the fixed phy is great when your eth driver
requires
  a
   PHY, but it is a workaround with extra processing overhead. IMHO
the
   best impl. is to make the PHY optional in the eth driver and as
you
  can
   see from the patch, that was really simple.
 
  I agree there is overhead. However, it will have the advantage of
  abstracting all the PHY related stuff out of controller driver.
 
  
   An useful extension would be to add a new propety in the DTS to
hold
   initial speed and duplex(perhaps extend phy-connection-type). This
   would be useful for the fixed driver too as one could derive speed
and
   duplex for the fixed phy from that property instead of creating a
  fixed
   phy for each speed and duplex one want to support.
 
  I agree that there should be a device node to configure it.  The
current
  fixed phy driver is a little bit too complex to emulate the register
  access.  Maybe it's better to have a null phy driver which just
reads
  PHY capacity and status from device node.
 
 A null phy driver is better than the current fixed phy, I agree.
 Where would you like to put initial speed and duplex? In a fake phy
node
 or in the ethernet node?

I think a fake phy node is better.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] phylib: add RGMII-ID mode to the Marvell m88e1111 PHY to fix broken ucc_geth

2007-06-05 Thread Li Yang

From: Kim Phillips [EMAIL PROTECTED]

Support for configuring RGMII-ID (RGMII with internal delay) mode on the
88e and 88e1145.  Ucc_geth on MPC8360EMDS(the main user of ucc_geth)
is broken after changed to use phylib.  It is fixed by adding this
internal delay.

Also renamed 88es - 88e (no references to an 88es part were
found), and fixed some whitespace.

Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
Please push this to Linus before 2.6.22 rc phase ends.  The regression
has caused serious breakage to ucc_geth driver.

drivers/net/phy/marvell.c |   62 +++--
1 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 22aec5c..b87f8d2 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -54,6 +54,12 @@
#define MII_M_PHY_LED_CONTROL   0x18
#define MII_M_PHY_LED_DIRECT0x4100
#define MII_M_PHY_LED_COMBINE   0x411c
+#define MII_M_PHY_EXT_CR   0x14
+#define MII_M_RX_DELAY 0x80
+#define MII_M_TX_DELAY 0x2
+#define MII_M_PHY_EXT_SR   0x1b
+#define MII_M_HWCFG_MODE_MASK  0xf
+#define MII_M_HWCFG_MODE_RGMII 0xb

MODULE_DESCRIPTION(Marvell PHY driver);
MODULE_AUTHOR(Andy Fleming);
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
return err;
}

+static int m88e_config_init(struct phy_device *phydev)
+{
+   int err;
+
+   if ((phydev-interface == PHY_INTERFACE_MODE_RGMII) ||
+   (phydev-interface == PHY_INTERFACE_MODE_RGMII_ID)) {
+   int temp;
+
+   if (phydev-interface == PHY_INTERFACE_MODE_RGMII_ID) {
+   temp = phy_read(phydev, MII_M_PHY_EXT_CR);
+   if (temp  0)
+   return temp;
+
+   temp |= (MII_M_RX_DELAY | MII_M_TX_DELAY);
+
+   err = phy_write(phydev, MII_M_PHY_EXT_CR, temp);
+   if (err  0)
+   return err;
+   }
+
+   temp = phy_read(phydev, MII_M_PHY_EXT_SR);
+   if (temp  0)
+   return temp;
+
+   temp = ~(MII_M_HWCFG_MODE_MASK);
+   temp |= MII_M_HWCFG_MODE_RGMII;
+
+   err = phy_write(phydev, MII_M_PHY_EXT_SR, temp);
+   if (err  0)
+   return err;
+   }
+
+   err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+   if (err  0)
+   return err;
+
+   return 0;
+}
+
static int m88e1145_config_init(struct phy_device *phydev)
{
int err;
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
if (err  0)
return err;

-   if (phydev-interface == PHY_INTERFACE_MODE_RGMII) {
+   if (phydev-interface == PHY_INTERFACE_MODE_RGMII_ID) {
int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
if (temp  0)
return temp;
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
.driver = {.owner = THIS_MODULE,},
};

-static struct phy_driver m88es_driver = {
+static struct phy_driver m88e_driver = {
.phy_id = 0x01410cc0,
.phy_id_mask = 0xfff0,
.name = Marvell 88E,
@@ -216,6 +261,7 @@ static struct phy_driver m88es_driver = {
.read_status = genphy_read_status,
.ack_interrupt = marvell_ack_interrupt,
.config_intr = marvell_config_intr,
+   .config_init = m88e_config_init,
.driver = {.owner = THIS_MODULE,},
};

@@ -241,9 +287,9 @@ static int __init marvell_init(void)
if (ret)
return ret;

-   ret = phy_driver_register(m88es_driver);
+   ret = phy_driver_register(m88e_driver);
if (ret)
-   goto errs;
+   goto err;

ret = phy_driver_register(m88e1145_driver);
if (ret)
@@ -251,9 +297,9 @@ static int __init marvell_init(void)

return 0;

-  err1145:
-   phy_driver_unregister(m88es_driver);
-  errs:
+err1145:
+   phy_driver_unregister(m88e_driver);
+err:
phy_driver_unregister(m88e1101_driver);
return ret;
}
@@ -261,7 +307,7 @@ static int __init marvell_init(void)
static void __exit marvell_exit(void)
{
phy_driver_unregister(m88e1101_driver);
-   phy_driver_unregister(m88es_driver);
+   phy_driver_unregister(m88e_driver);
phy_driver_unregister(m88e1145_driver);
}

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/5] phylib: enable RGMII-ID on the Marvell m88e1111 PHY

2007-05-31 Thread Li Yang-r58472
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
 Behalf Of Kim Phillips
 Sent: Saturday, May 12, 2007 7:25 AM
 To: Jeff Garzik; netdev@vger.kernel.org
 Subject: [PATCH 2/5] phylib: enable RGMII-ID on the Marvell m88e
PHY
 
 Support for configuring RGMII-ID (RGMII with internal delay) mode on
the
 88e and 88e1145.
 
 Also renamed 88es - 88e (no references to an 88es part
were
 found), and fixed some whitespace.
 
 Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Acked-by: Li Yang [EMAIL PROTECTED]

This is truly a fix for MPC8360EMDS board which was working on 2.6.21.
Please push it to Linus in 2.6.22-rc phase rather than waiting until
2.6.23.  Thanks.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Add select PHYLIB to the UCC_GETH Kconfig option

2007-05-24 Thread Li Yang-r58472
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
 Behalf Of Jeff Garzik
 Sent: Friday, May 25, 2007 5:48 AM
 To: Jan Altenberg
 Cc: Phillips Kim-R1AAHA; [EMAIL PROTECTED];
netdev@vger.kernel.org
 Subject: Re: [PATCH] Add select PHYLIB to the UCC_GETH Kconfig option
 
 Jan Altenberg wrote:
  ucc_geth has been migrated to use the common phylib code. So lets
add a
  'select PHYLIB' to the UCC_GETH Kconfig entry.
 
  Signed-off-by: Jan Altenberg [EMAIL PROTECTED]
 
  ---
   drivers/net/Kconfig |1 +
   1 file changed, 1 insertion(+)
 
  Index: linux-2.6/drivers/net/Kconfig
  ===
  --- linux-2.6.orig/drivers/net/Kconfig
  +++ linux-2.6/drivers/net/Kconfig
  @@ -2280,6 +2280,7 @@ config GFAR_NAPI
   config UCC_GETH
  tristate Freescale QE Gigabit Ethernet
  depends on QUICC_ENGINE
  +   select PHYLIB
  select UCC_FAST
 
 Please fix the Kconfig warnings first.
 

I will follow up this.

 Also, I ask again:  WHO IS THE MAINTAINER OF THIS DRIVER?
 
 I am tired of five independent people patching the same driver.

Sorry for the trouble, I will post a patch to the MAINTAINER file and
help to maintain ucc_geth related patches.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] NET: add MAINTAINERS entry for ucc_geth driver

2007-05-24 Thread Li Yang

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
MAINTAINERS |7 +++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4c3277c..3faed72 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1463,6 +1463,13 @@ L:   [EMAIL PROTECTED]
L:  [EMAIL PROTECTED]
S:  Maintained

+FREESCALE QUICC ENGINE UCC ETHERNET DRIVER
+P: Li Yang
+M: [EMAIL PROTECTED]
+L: netdev@vger.kernel.org
+L: [EMAIL PROTECTED]
+S: Maintained
+
FILE LOCKING (flock() and fcntl()/lockf())
P:  Matthew Wilcox
M:  [EMAIL PROTECTED]

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ucc_geth: Fix MODULE_DEVICE_TABLE() duplication

2007-05-22 Thread Li Yang

Fix MODULE_DEVICE_TABLE() duplication in ucc_geth.c and ucc_geth_mii.c
for ucc_geth to be compiled as module.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth_mii.c |2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index f96966d..7bcb82f 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -260,8 +260,6 @@ static struct of_device_id uec_mdio_match[] = {
{},
};

-MODULE_DEVICE_TABLE(of, uec_mdio_match);
-
static struct of_platform_driver uec_mdio_driver = {
.name   = DRV_NAME,
.probe  = uec_mdio_probe,

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ucc_geth:trivial fix

2007-05-22 Thread Li Yang

Remove redundant includes.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 864b1aa..3b27b6d 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -23,11 +23,8 @@
#include linux/skbuff.h
#include linux/spinlock.h
#include linux/mm.h
-#include linux/ethtool.h
-#include linux/delay.h
#include linux/dma-mapping.h
#include linux/fsl_devices.h
-#include linux/ethtool.h
#include linux/mii.h
#include linux/phy.h
#include linux/workqueue.h

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Revert ucc_geth: returns NETDEV_TX_BUSY when BD ring is full

2007-03-18 Thread Li Yang

This reverts commit 18babd38547a042a4bfd4154a014d1ad33373eb0.

Michael Barkowski points out that it's wrong, and I agree.  The
patch causes a problem rather than fixes one after another
patch ucc_geth: Fix BD processing was applied.  Before that
patch, current packet should be blocked.  However after the patch
current packet is ok and we only need to block next.

Reported-by: Michael Barkowski [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
Sorry for the mistake I made.

drivers/net/ucc_geth.c |3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index c2db49b..64e5bb4 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3609,7 +3609,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)
if (bd == ugeth-confBd[txQ]) {
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-   return NETDEV_TX_BUSY;
}

ugeth-txBd[txQ] = bd;
@@ -3625,7 +3624,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)

spin_unlock_irq(ugeth-lock);

-   return NETDEV_TX_OK;
+   return 0;
}

static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int 
rx_work_limit)

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 0/3] ucc_geth updates for 2.6.21-rc2

2007-03-06 Thread Li Yang

Jeff,

Please apply.

Thanks

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 1/3] ucc_geth: Fix BD processing

2007-03-06 Thread Li Yang

Fix broken BD processing code.

Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]

---
drivers/net/ucc_geth.c |   14 +-
1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 885e73d..639e1e6 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3598,9 +3598,9 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)

/* Move to next BD in the ring */
if (!(bd_status  T_W))
-   ugeth-txBd[txQ] = bd + sizeof(struct qe_bd);
+   bd += sizeof(struct qe_bd);
else
-   ugeth-txBd[txQ] = ugeth-p_tx_bd_ring[txQ];
+   bd = ugeth-p_tx_bd_ring[txQ];

/* If the next BD still needs to be cleaned up, then the bds
   are full.  We need to tell the kernel to stop sending us stuff. */
@@ -3609,6 +3609,8 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)
netif_stop_queue(dev);
}

+   ugeth-txBd[txQ] = bd;
+
if (ugeth-p_scheduler) {
ugeth-cpucount[txQ]++;
/* Indicate to QE that there are more Tx bds ready for
@@ -3722,7 +3724,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
/* Handle the transmitted buffer and release */
/* the BD to be used with the current frame  */

-   if ((bd = ugeth-txBd[txQ])  (netif_queue_stopped(dev) == 0))
+   if ((bd == ugeth-txBd[txQ])  (netif_queue_stopped(dev) == 0))
break;

ugeth-stats.tx_packets++;
@@ -3741,10 +3743,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)

/* Advance the confirmation BD pointer */
if (!(bd_status  T_W))
-   ugeth-confBd[txQ] += sizeof(struct qe_bd);
+   bd += sizeof(struct qe_bd);
else
-   ugeth-confBd[txQ] = ugeth-p_tx_bd_ring[txQ];
+   bd = ugeth-p_tx_bd_ring[txQ];
+   bd_status = in_be32((u32 *)bd);
}
+   ugeth-confBd[txQ] = bd;
return 0;
}

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 2/3] ucc_geth: returns NETDEV_TX_BUSY when BD ring is full

2007-03-06 Thread Li Yang

Returns NETDEV_TX_BUSY when BD ring is full.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 639e1e6..dab88b9 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3607,6 +3607,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)
if (bd == ugeth-confBd[txQ]) {
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
+   return NETDEV_TX_BUSY;
}

ugeth-txBd[txQ] = bd;
@@ -3622,7 +3623,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)

spin_unlock_irq(ugeth-lock);

-   return 0;
+   return NETDEV_TX_OK;
}

static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int 
rx_work_limit)

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 3/3] ucc_geth: suppress compile warnings

2007-03-06 Thread Li Yang

Add casts to suppress warnings introduced by kmalloc cast cleanup patch.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |6 --
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dab88b9..c2db49b 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2804,7 +2804,8 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
if (UCC_GETH_TX_BD_RING_ALIGNMENT  4)
align = UCC_GETH_TX_BD_RING_ALIGNMENT;
ugeth-tx_bd_ring_offset[j] =
-   kmalloc((u32) (length + align), GFP_KERNEL);
+   (u32)kmalloc((u32) (length + align),
+GFP_KERNEL);

if (ugeth-tx_bd_ring_offset[j] != 0)
ugeth-p_tx_bd_ring[j] =
@@ -2840,7 +2841,8 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
if (UCC_GETH_RX_BD_RING_ALIGNMENT  4)
align = UCC_GETH_RX_BD_RING_ALIGNMENT;
ugeth-rx_bd_ring_offset[j] =
-   kmalloc((u32) (length + align), GFP_KERNEL);
+   (u32)kmalloc((u32) (length + align),
+GFP_KERNEL);
if (ugeth-rx_bd_ring_offset[j] != 0)
ugeth-p_rx_bd_ring[j] =
(void*)((ugeth-rx_bd_ring_offset[j] +

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Patch 1/3] ucc_geth: Fix BD processing

2007-03-06 Thread Li Yang-r58472

 -Original Message-
 From: Jeff Garzik [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 06, 2007 7:11 PM
 To: Li Yang-r58472
 Cc: netdev@vger.kernel.org
 Subject: Re: [Patch 1/3] ucc_geth: Fix BD processing
 
 Li Yang wrote:
  Fix broken BD processing code.
 
  Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
  Signed-off-by: Li Yang [EMAIL PROTECTED]
 
  ---
  drivers/net/ucc_geth.c |   14 +-
  1 files changed, 9 insertions(+), 5 deletions(-)
 
 applied 1-2 of 3

Thanks.  What's your comment about 3 of 3?

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] ucc_geth updates for 2.6.21

2007-02-08 Thread Li Yang

Remove iopa() patch from previous series which is still in
discussion in powerpc list.

- Leo

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] ucc_geth: Switch kmalloc to kzalloc and clean some redundant kmalloc casts

2007-02-08 Thread Li Yang

From: Ahmed S. Darwish [EMAIL PROTECTED]

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   21 -
1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7e4b23c..ac1266c 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2927,10 +2927,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Tx bds */
for (j = 0; j  ug_info-numQueuesTx; j++) {
/* Setup the skbuff rings */
-   ugeth-tx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenTx[j],
-  GFP_KERNEL);
+   ugeth-tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenTx[j],
+ GFP_KERNEL);

if (ugeth-tx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate tx_skbuff,
@@ -2959,10 +2958,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Rx bds */
for (j = 0; j  ug_info-numQueuesRx; j++) {
/* Setup the skbuff rings */
-   ugeth-rx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenRx[j],
-  GFP_KERNEL);
+   ugeth-rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenRx[j],
+ GFP_KERNEL);

if (ugeth-rx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate rx_skbuff,
@@ -3451,19 +3449,16 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
 * resource.
 * This shadow structure keeps a copy of what was done so that the
 * allocated resources can be released when the channel is freed.
+* *p_init_enet_param_shadow is zeroed by kzalloc
 */
if (!(ugeth-p_init_enet_param_shadow =
-(struct ucc_geth_init_pram *) kmalloc(sizeof(struct 
ucc_geth_init_pram),
- GFP_KERNEL))) {
+ kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
ugeth_err
(%s: Can not allocate memory for
 p_UccInitEnetParamShadows., __FUNCTION__);
ucc_geth_memclean(ugeth);
return -ENOMEM;
}
-   /* Zero out *p_init_enet_param_shadow */
-   memset((char *)ugeth-p_init_enet_param_shadow,
-  0, sizeof(struct ucc_geth_init_pram));

/* Fill shadow InitEnet command parameter structure */


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] ucc_geth: Remove obsolete workaround of link speed change

2007-02-08 Thread Li Yang

The workaround used a long delay of 4s which caused problem
when two link-changes happens at the same time.

Signed-off-by: Li Yang [EMAIL PROTECTED]
Signed-off-by: Wu Xiaochuan [EMAIL PROTECTED]
--- 
drivers/net/ucc_geth.c |   71 +++

drivers/net/ucc_geth_phy.c |2 +
2 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index ac1266c..ce0eab9 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1709,75 +1709,13 @@ static void adjust_link(struct net_device *dev)
if (mii_info-speed != ugeth-oldspeed) {
switch (mii_info-speed) {
case 1000:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this when it is fixed!!! */
-   if (ugeth-ug_info-enet_interface ==
-   ENET_1000_GMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval |= 0x000f;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   } else if (ugeth-ug_info-enet_interface ==
-  ENET_1000_RGMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   }
-   msleep(4000);
-#endif /* CONFIG_MPC8360 */
-   adjust_enet_interface(ugeth);
+   ugeth-ug_info-enet_interface = 
ENET_1000_RGMII;
break;
case 100:
-   case 10:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this lines when it will be fixed!!! */
ugeth-ug_info-enet_interface = ENET_100_RGMII;
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, 0x1b,
-(u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, MII_BMCR,
-(u16) (tempval |
-   BMCR_RESET));
-   msleep(4000);
-#endif

[PATCH 3/3] ucc_geth: Add support to local-mac-address property

2007-02-08 Thread Li Yang

IEEE-1275 defines “local-mac-address” to be a standard
property name to specify preassigned network address.
This patch adds support for it.

Signed-off-by: Li Yang [EMAIL PROTECTED] 
---

drivers/net/ucc_geth.c |8 +++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index ce0eab9..cf93383 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -4070,6 +4070,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
static int mii_mng_configured = 0;
const phandle *ph;
const unsigned int *prop;
+   const void *mac_addr;

ugeth_vdbg(%s: IN, __FUNCTION__);

@@ -4195,7 +4196,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma

ugeth-ug_info = ug_info;
ugeth-dev = dev;
-   memcpy(dev-dev_addr, get_property(np, mac-address, NULL), 6);
+
+   mac_addr = get_property(np, mac-address, NULL);
+   if (mac_addr == NULL)
+   mac_addr = get_property(np, local-mac-address, NULL);
+   if (mac_addr)
+   memcpy(dev-dev_addr, mac_addr, 6);

return 0;
}

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-07 Thread Li Yang-r58472
 On Feb 6, 2007, at 5:31 AM, Li Yang wrote:
 
  Get rid of private immrbar_virt_to_phys() routine and
  use generic iopa().
 
 Nack. iopa() isn't that generic, shouldn't we really be using the dma
 mapping API here?

Do you mean the dma_map_single()?  dma_map_single can map memory space
correctly, but I don't think it can handle ioremap-ed space.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-07 Thread Li Yang-r58472
 -Original Message-
 From: Timur Tabi [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 08, 2007 1:03 AM
 To: Kumar Gala
 Cc: Li Yang-r58472; netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys
to generic
 iopa
 
 Kumar Gala wrote:
 
  If its been mapped with ioremap() you know the physical address
already
  so why do you need iopa().
 
 That's what the original function immrbar_virt_to_phys() does.  We're
trying to
 get rid of it, because we thought is redundant with iopa().
 
 static inline unsigned long immrbar_virt_to_phys(volatile void *
address)
 {
   if ( ((u32)address = (u32)qe_immr) 
   ((u32)address  ((u32)qe_immr + QE_IMMAP_SIZE))
)
   return (unsigned long)(address - (u32)qe_immr +
   (u32)get_qe_base());
   return (unsigned long)virt_to_phys(address);
 }
 
 get_qe_base() does a search of the OF tree the first time it's called.
 
 Here's the code that calls immrbar_virt_to_phys():
 
   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
(u32) immrbar_virt_to_phys(ugeth-
   p_tx_bd_ring[i]));
 
 
 Would it be better to replace this code with something like this:
 
 out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
   get_qe_base() + ((void *) ugeth-p_tx_bd_ring[i] - (void *)
qe_immr));

No, we don't know if the BD ring is in MURAM or main memory as it is
configurable.  iopa() is best choice to handle both case, IMHO.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-07 Thread Li Yang-r58472
 -Original Message-
 From: Kumar Gala [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 08, 2007 1:58 PM
 To: Li Yang-r58472
 Cc: Tabi Timur-B04825; netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys
to generic
 iopa
 
 
 On Feb 7, 2007, at 11:52 PM, Li Yang-r58472 wrote:
 
  -Original Message-
  From: Timur Tabi [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 08, 2007 1:03 AM
  To: Kumar Gala
  Cc: Li Yang-r58472; netdev@vger.kernel.org; [EMAIL PROTECTED]
  Subject: Re: [PATCH 1/4] ucc_geth: Change private
  immrbar_virt_to_phys
  to generic
  iopa
 
  Kumar Gala wrote:
 
  If its been mapped with ioremap() you know the physical address
  already
  so why do you need iopa().
 
  That's what the original function immrbar_virt_to_phys() does.
We're
  trying to
  get rid of it, because we thought is redundant with iopa().
 
  static inline unsigned long immrbar_virt_to_phys(volatile void *
  address)
  {
 if ( ((u32)address = (u32)qe_immr) 
 ((u32)address  ((u32)qe_immr + QE_IMMAP_SIZE))
  )
 return (unsigned long)(address - (u32)qe_immr +
 (u32)get_qe_base());
 return (unsigned long)virt_to_phys(address);
  }
 
  get_qe_base() does a search of the OF tree the first time it's
  called.
 
  Here's the code that calls immrbar_virt_to_phys():
 
 out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
  (u32) immrbar_virt_to_phys(ugeth-
 p_tx_bd_ring[i]));
 
 
  Would it be better to replace this code with something like this:
 
  out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
 get_qe_base() + ((void *) ugeth-p_tx_bd_ring[i] - (void *)
  qe_immr));
 
  No, we don't know if the BD ring is in MURAM or main memory as it is
  configurable.  iopa() is best choice to handle both case, IMHO.
 
 Does MURAM behave differently than normal memory?

MURAM is a mmio region so it don't share the characteristic of main
memory that phy_addr = virt_addr - PAGE_OFFSET.  While they can both be
mapped through page table using iopa().

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-07 Thread Li Yang-r58472
  If its been mapped with ioremap() you know the physical address
  already
  so why do you need iopa().
 
  That's what the original function immrbar_virt_to_phys() does.
  We're
  trying to
  get rid of it, because we thought is redundant with iopa().
 
  static inline unsigned long immrbar_virt_to_phys(volatile void *
  address)
  {
   if ( ((u32)address = (u32)qe_immr) 
   ((u32)address  ((u32)qe_immr + QE_IMMAP_SIZE))
  )
   return (unsigned long)(address - (u32)qe_immr +
   (u32)get_qe_base());
   return (unsigned long)virt_to_phys(address);
  }
 
  get_qe_base() does a search of the OF tree the first time it's
  called.
 
  Here's the code that calls immrbar_virt_to_phys():
 
   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
(u32) immrbar_virt_to_phys(ugeth-
   p_tx_bd_ring[i]));
 
 
  Would it be better to replace this code with something like this:
 
  out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
   get_qe_base() + ((void *) ugeth-p_tx_bd_ring[i] - (void *)
  qe_immr));
 
  No, we don't know if the BD ring is in MURAM or main memory as it
is
  configurable.  iopa() is best choice to handle both case, IMHO.
 
  Does MURAM behave differently than normal memory?
 
  MURAM is a mmio region so it don't share the characteristic of main
  memory that phy_addr = virt_addr - PAGE_OFFSET.  While they can
  both be
  mapped through page table using iopa().
 
 Right, so when do you know if you'll be using MURAM or normal
 memory?  Why not just keep around a token that is the physical
 address at the point you make the decision of MURAM vs normal memory.

Yes, that can be a way.  But as the virt to phy mapping is only used
once, it's nothing bad to do it this way.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-07 Thread Li Yang-r58472
 -Original Message-
 From: Kumar Gala [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 08, 2007 3:16 PM
 To: Li Yang-r58472
 Cc: Tabi Timur-B04825; netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys
to generic
 iopa
 
 
 On Feb 8, 2007, at 1:06 AM, Li Yang-r58472 wrote:
 
  MURAM is a mmio region so it don't share the characteristic of
main
  memory that phy_addr = virt_addr - PAGE_OFFSET.  While they can
  both be
  mapped through page table using iopa().
 
  Right, so when do you know if you'll be using MURAM or normal
  memory?  Why not just keep around a token that is the physical
  address at the point you make the decision of MURAM vs normal
memory.
 
  Yes, that can be a way.  But as the virt to phy mapping is only used
  once, it's nothing bad to do it this way.
 
 The problem as I stated before with using iopa() is that its not
 supported across platforms.

Yes, it is only for PPC32.  But we don't have another API to do it.  How
about make it more generic to add PPC64 version?

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-06 Thread Li Yang

Get rid of private immrbar_virt_to_phys() routine and
use generic iopa().

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   29 ++---
1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7e4b23c..722a89f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3065,21 +3065,11 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
endOfRing =
ugeth-p_tx_bd_ring[i] + (ug_info-bdRingLenTx[i] -
  1) * sizeof(struct qe_bd);
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) virt_to_phys(ugeth-p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
+   iopa((unsigned long)ugeth-p_tx_bd_ring[i]));
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
 last_bd_completed_address,
-(u32) virt_to_phys(endOfRing));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
-last_bd_completed_address,
-(u32) immrbar_virt_to_phys(endOfRing));
-   }
+   iopa((unsigned long)endOfRing));
}

/* schedulerbasepointer */
@@ -3331,15 +3321,8 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Setup the table */
/* Assume BD rings are already established */
for (i = 0; i  ug_info-numQueuesRx; i++) {
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) virt_to_phys(ugeth-p_rx_bd_ring[i]));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_rx_bd_ring[i]));
-   }
+   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
+iopa((unsigned long)ugeth-p_rx_bd_ring[i]));
/* rest of fields handled by QE */
}

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] ucc_geth: Switch kmalloc to kzalloc and clean some redundant kmalloc casts

2007-02-06 Thread Li Yang

From: Ahmed S. Darwish [EMAIL PROTECTED]

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   21 -
1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 722a89f..50b1fe9 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2927,10 +2927,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Tx bds */
for (j = 0; j  ug_info-numQueuesTx; j++) {
/* Setup the skbuff rings */
-   ugeth-tx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenTx[j],
-  GFP_KERNEL);
+   ugeth-tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenTx[j],
+ GFP_KERNEL);

if (ugeth-tx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate tx_skbuff,
@@ -2959,10 +2958,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Rx bds */
for (j = 0; j  ug_info-numQueuesRx; j++) {
/* Setup the skbuff rings */
-   ugeth-rx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenRx[j],
-  GFP_KERNEL);
+   ugeth-rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenRx[j],
+ GFP_KERNEL);

if (ugeth-rx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate rx_skbuff,
@@ -3434,19 +3432,16 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
 * resource.
 * This shadow structure keeps a copy of what was done so that the
 * allocated resources can be released when the channel is freed.
+* *p_init_enet_param_shadow is zeroed by kzalloc
 */
if (!(ugeth-p_init_enet_param_shadow =
-(struct ucc_geth_init_pram *) kmalloc(sizeof(struct 
ucc_geth_init_pram),
- GFP_KERNEL))) {
+ kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
ugeth_err
(%s: Can not allocate memory for
 p_UccInitEnetParamShadows., __FUNCTION__);
ucc_geth_memclean(ugeth);
return -ENOMEM;
}
-   /* Zero out *p_init_enet_param_shadow */
-   memset((char *)ugeth-p_init_enet_param_shadow,
-  0, sizeof(struct ucc_geth_init_pram));

/* Fill shadow InitEnet command parameter structure */


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ucc_geth: Remove obsolete workaround of link speed change

2007-02-06 Thread Li Yang

The workaround used a long delay of 4s which caused problem
when two link-changes happens at the same time.

Signed-off-by: Li Yang [EMAIL PROTECTED]
Signed-off-by: Wu Xiaochuan [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   71 +++
drivers/net/ucc_geth_phy.c |2 +
2 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 50b1fe9..dcec66d 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1709,75 +1709,13 @@ static void adjust_link(struct net_device *dev)
if (mii_info-speed != ugeth-oldspeed) {
switch (mii_info-speed) {
case 1000:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this when it is fixed!!! */
-   if (ugeth-ug_info-enet_interface ==
-   ENET_1000_GMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval |= 0x000f;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   } else if (ugeth-ug_info-enet_interface ==
-  ENET_1000_RGMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   }
-   msleep(4000);
-#endif /* CONFIG_MPC8360 */
-   adjust_enet_interface(ugeth);
+   ugeth-ug_info-enet_interface = 
ENET_1000_RGMII;
break;
case 100:
-   case 10:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this lines when it will be fixed!!! */
ugeth-ug_info-enet_interface = ENET_100_RGMII;
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, 0x1b,
-(u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, MII_BMCR,
-(u16) (tempval |
-   BMCR_RESET));
-   msleep(4000);
-#endif

[PATCH 4/4] ucc_geth: Add support to local-mac-address property

2007-02-06 Thread Li Yang

IEEE-1275 defines “local-mac-address” to be a standard
property name to specify preassigned network address.
This patch adds support for it.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |8 +++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dcec66d..62512fc 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -4053,6 +4053,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
static int mii_mng_configured = 0;
const phandle *ph;
const unsigned int *prop;
+   const void *mac_addr;

ugeth_vdbg(%s: IN, __FUNCTION__);

@@ -4178,7 +4179,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma

ugeth-ug_info = ug_info;
ugeth-dev = dev;
-   memcpy(dev-dev_addr, get_property(np, mac-address, NULL), 6);
+
+   mac_addr = get_property(np, mac-address, NULL);
+   if (mac_addr == NULL)
+   mac_addr = get_property(np, local-mac-address, NULL);
+   if (mac_addr)
+   memcpy(dev-dev_addr, mac_addr, 6);

return 0;
}

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [git patches] net driver fixes

2007-01-08 Thread Li Yang-r58472
Hi Jeff,

Could you apply the updates for ucc_geth driver?

The patches from Timur that make the driver compile correctly on 2.6.20.
[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c
[PATCH] Update ucc_geth.c for new workqueue structure

The patch from Ahmed that cleans up some unnecessary casts.
[PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups


- Leo

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Garzik
 Sent: Monday, January 08, 2007 5:48 PM
 To: Andrew Morton; Linus Torvalds
 Cc: netdev@vger.kernel.org; LKML
 Subject: [git patches] net driver fixes
 
 
 Please pull from 'upstream-linus' branch of
 master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
 upstream-linus
 
 to receive the following updates:
 
  drivers/net/e1000/e1000_main.c  |6 
  drivers/net/ixgb/ixgb.h |1 +
  drivers/net/ixgb/ixgb_ethtool.c |1 +
  drivers/net/ixgb/ixgb_hw.c  |3 +-
  drivers/net/ixgb/ixgb_main.c|   57
++
  drivers/net/qla3xxx.c   |   38 +++--
  drivers/net/wireless/ipw2100.c  |2 +-
  drivers/s390/net/qeth_main.c|   13 +---
  include/net/ieee80211.h |2 +-
  9 files changed, 88 insertions(+), 35 deletions(-)
 
 Aaron Salter (1):
   ixgb: Write RA register high word first, increment version
 
 Heiko Carstens (1):
   qeth: fix uaccess handling and get rid of unused variable
 
 Jeff Garzik (1):
   Revert e1000: disable TSO on the 82544 with slab debugging
 
 Jesse Brandeburg (2):
   ixgb: Fix early TSO completion
   ixgb: Maybe stop TX if not enough free descriptors
 
 Ron Mercer (2):
   qla3xxx: Remove NETIF_F_LLTX from driver features.
   qla3xxx: Add delay to NVRAM register access.
 
 Zhu Yi (2):
   ieee80211: WLAN_GET_SEQ_SEQ fix (select correct region)
   ipw2100: Fix dropping fragmented small packet problem
 
 diff --git a/drivers/net/e1000/e1000_main.c
b/drivers/net/e1000/e1000_main.c
 index 4c1ff75..c6259c7 100644
 --- a/drivers/net/e1000/e1000_main.c
 +++ b/drivers/net/e1000/e1000_main.c
 @@ -995,12 +995,6 @@ e1000_probe(struct pci_dev *pdev,
  (adapter-hw.mac_type != e1000_82547))
   netdev-features |= NETIF_F_TSO;
 
 -#ifdef CONFIG_DEBUG_SLAB
 - /* 82544's work arounds do not play nicely with DEBUG SLAB */
 - if (adapter-hw.mac_type == e1000_82544)
 - netdev-features = ~NETIF_F_TSO;
 -#endif
 -
  #ifdef NETIF_F_TSO6
   if (adapter-hw.mac_type  e1000_82547_rev_2)
   netdev-features |= NETIF_F_TSO6;
 diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
 index 50ffe90..f4aba43 100644
 --- a/drivers/net/ixgb/ixgb.h
 +++ b/drivers/net/ixgb/ixgb.h
 @@ -171,6 +171,7 @@ struct ixgb_adapter {
 
   /* TX */
   struct ixgb_desc_ring tx_ring cacheline_aligned_in_smp;
 + unsigned int restart_queue;
   unsigned long timeo_start;
   uint32_t tx_cmd_type;
   uint64_t hw_csum_tx_good;
 diff --git a/drivers/net/ixgb/ixgb_ethtool.c
b/drivers/net/ixgb/ixgb_ethtool.c
 index cd22523..82c044d 100644
 --- a/drivers/net/ixgb/ixgb_ethtool.c
 +++ b/drivers/net/ixgb/ixgb_ethtool.c
 @@ -79,6 +79,7 @@ static struct ixgb_stats ixgb_gstrings_stats[] = {
   {tx_window_errors, IXGB_STAT(net_stats.tx_window_errors)},
   {tx_deferred_ok, IXGB_STAT(stats.dc)},
   {tx_timeout_count, IXGB_STAT(tx_timeout_count) },
 + {tx_restart_queue, IXGB_STAT(restart_queue) },
   {rx_long_length_errors, IXGB_STAT(stats.roc)},
   {rx_short_length_errors, IXGB_STAT(stats.ruc)},
  #ifdef NETIF_F_TSO
 diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
 index 02089b6..ecbf458 100644
 --- a/drivers/net/ixgb/ixgb_hw.c
 +++ b/drivers/net/ixgb/ixgb_hw.c
 @@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
   /* Zero out the other 15 receive addresses. */
   DEBUGOUT(Clearing RAR[1-15]\n);
   for(i = 1; i  IXGB_RAR_ENTRIES; i++) {
 - IXGB_WRITE_REG_ARRAY(hw, RA, (i  1), 0);
 + /* Write high reg first to disable the AV bit first */
   IXGB_WRITE_REG_ARRAY(hw, RA, ((i  1) + 1), 0);
 + IXGB_WRITE_REG_ARRAY(hw, RA, (i  1), 0);
   }
 
   return;
 diff --git a/drivers/net/ixgb/ixgb_main.c
b/drivers/net/ixgb/ixgb_main.c
 index e628126..a083a91 100644
 --- a/drivers/net/ixgb/ixgb_main.c
 +++ b/drivers/net/ixgb/ixgb_main.c
 @@ -36,7 +36,7 @@ static char ixgb_driver_string[] = Intel(R)
PRO/10GbE Network
 Driver;
  #else
  #define DRIVERNAPI -NAPI
  #endif
 -#define DRV_VERSION  1.0.117-k2DRIVERNAPI
 +#define DRV_VERSION  1.0.126-k2DRIVERNAPI
  char ixgb_driver_version[] = DRV_VERSION;
  static char ixgb_copyright[] = Copyright (c) 1999-2006 Intel
Corporation.;
 
 @@ -1287,6 +1287,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct
sk_buff
 *skb,
   struct ixgb_buffer *buffer_info;
   int len = skb-len;

[PATCH] ucc_geth: kmalloc casting cleanups

2007-01-08 Thread Li Yang

From: Ahmed S. Darwish [EMAIL PROTECTED]

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8243150..0f58f5f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2926,10 +2926,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Tx bds */
for (j = 0; j  ug_info-numQueuesTx; j++) {
/* Setup the skbuff rings */
-   ugeth-tx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenTx[j],
-  GFP_KERNEL);
+   ugeth-tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenTx[j],
+ GFP_KERNEL);

if (ugeth-tx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate tx_skbuff,
@@ -2958,10 +2957,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Rx bds */
for (j = 0; j  ug_info-numQueuesRx; j++) {
/* Setup the skbuff rings */
-   ugeth-rx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenRx[j],
-  GFP_KERNEL);
+   ugeth-rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenRx[j],
+ GFP_KERNEL);

if (ugeth-rx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate rx_skbuff,
@@ -3450,19 +3448,16 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
 * resource.
 * This shadow structure keeps a copy of what was done so that the
 * allocated resources can be released when the channel is freed.
+* *p_init_enet_param_shadow is zeroed by kzalloc
 */
-   if (!(ugeth-p_init_enet_param_shadow =
-(struct ucc_geth_init_pram *) kmalloc(sizeof(struct 
ucc_geth_init_pram),
- GFP_KERNEL))) {
+	if (!(ugeth-p_init_enet_param_shadow = 
+	  kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {

ugeth_err
(%s: Can not allocate memory for
 p_UccInitEnetParamShadows., __FUNCTION__);
ucc_geth_memclean(ugeth);
return -ENOMEM;
}
-   /* Zero out *p_init_enet_param_shadow */
-   memset((char *)ugeth-p_init_enet_param_shadow,
-  0, sizeof(struct ucc_geth_init_pram));

/* Fill shadow InitEnet command parameter structure */

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ucc_geth: kmalloc casting cleanups

2007-01-08 Thread Li Yang-r58472
 -Original Message-
 From: Jeff Garzik [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, January 09, 2007 3:16 PM
 To: Li Yang-r58472
 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [PATCH] ucc_geth: kmalloc casting cleanups
 
 Li Yang wrote:
  From: Ahmed S. Darwish [EMAIL PROTECTED]
 
  Switch kmalloc to kzalloc and clean some redundant kmalloc
  casts.
 
  Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
  Signed-off-by: Li Yang [EMAIL PROTECTED]
  ---
 
 
 I should wait for Kumar to resend ucc_geth fixes before applying this,
 right?

Ok.  The patch is based on 2.6.20-rc3, but I think it can still apply.
If not, please ping me.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups

2007-01-08 Thread Li Yang-r58472
 -Original Message-
 From: Ahmed S. Darwish [mailto:[EMAIL PROTECTED]
 Sent: Saturday, January 06, 2007 9:19 PM
 To: Li Yang-r58472
 Cc: linux-kernel@vger.kernel.org
 Subject: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups
 
 [Please inform me if you are not the maintaner cause I'm not sure:)]
 
 Hi,
 A kmalloc casting cleanup patch.
 
 I wasn't able to compile the file drivers/net/ucc_geth.c cause of
 some not found headers (asm/of_platform.h, asm/qe.h, and others )

You need to use ARCH=powerpc to compile this driver.  I don't know how
you could select this driver without using powerpc arch.

 
 Signed-off-by: Ahmed Darwish [EMAIL PROTECTED]
 
 diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
 index 8243150..001109e 100644
 --- a/drivers/net/ucc_geth.c
 +++ b/drivers/net/ucc_geth.c
 @@ -2864,8 +2864,8 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
   if (UCC_GETH_TX_BD_RING_ALIGNMENT  4)
   align = UCC_GETH_TX_BD_RING_ALIGNMENT;
   ugeth-tx_bd_ring_offset[j] =
 - (u32) (kmalloc((u32) (length + align),
 - GFP_KERNEL));
 + kmalloc((u32) (length + align),
GFP_KERNEL);
 +
   if (ugeth-tx_bd_ring_offset[j] != 0)
   ugeth-p_tx_bd_ring[j] =

(void*)((ugeth-tx_bd_ring_offset[j] +
 @@ -2900,7 +2900,7 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
   if (UCC_GETH_RX_BD_RING_ALIGNMENT  4)
   align = UCC_GETH_RX_BD_RING_ALIGNMENT;
   ugeth-rx_bd_ring_offset[j] =
 - (u32) (kmalloc((u32) (length + align),
GFP_KERNEL));
 + kmalloc((u32) (length + align),
GFP_KERNEL);

NACK about the 2 clean-ups above.  Cast from pointer to integer is
required here.

   if (ugeth-rx_bd_ring_offset[j] != 0)
   ugeth-p_rx_bd_ring[j] =

(void*)((ugeth-rx_bd_ring_offset[j] +
 @@ -2926,10 +2926,9 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
   /* Init Tx bds */
   for (j = 0; j  ug_info-numQueuesTx; j++) {
   /* Setup the skbuff rings */
 - ugeth-tx_skbuff[j] =
 - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *)
*
 -
ugeth-ug_info-bdRingLenTx[j],
 -GFP_KERNEL);
 + ugeth-tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
 +
ugeth-ug_info-bdRingLenTx[j],
 +   GFP_KERNEL);
 
   if (ugeth-tx_skbuff[j] == NULL) {
   ugeth_err(%s: Could not allocate tx_skbuff,
 @@ -2958,10 +2957,9 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
   /* Init Rx bds */
   for (j = 0; j  ug_info-numQueuesRx; j++) {
   /* Setup the skbuff rings */
 - ugeth-rx_skbuff[j] =
 - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *)
*
 -
ugeth-ug_info-bdRingLenRx[j],
 -GFP_KERNEL);
 + ugeth-rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
 +
ugeth-ug_info-bdRingLenRx[j],
 +   GFP_KERNEL);
 
   if (ugeth-rx_skbuff[j] == NULL) {
   ugeth_err(%s: Could not allocate rx_skbuff,
 @@ -3452,8 +3450,7 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
* allocated resources can be released when the channel is
freed.
*/
   if (!(ugeth-p_init_enet_param_shadow =
 -  (struct ucc_geth_init_pram *) kmalloc(sizeof(struct
 ucc_geth_init_pram),
 -   GFP_KERNEL))) {
 +   kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
   ugeth_err
   (%s: Can not allocate memory for
p_UccInitEnetParamShadows., __FUNCTION__);
 
 --
 Ahmed S. Darwish
 http://darwish-07.blogspot.com

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups

2007-01-07 Thread Li Yang-r58472
 -Original Message-
 From: Ahmed S. Darwish [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 08, 2007 12:27 PM
 To: Li Yang-r58472
 Cc: linux-kernel@vger.kernel.org; netdev@vger.kernel.org
 Subject: Re: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting
cleanups
 
 On Mon, Jan 08, 2007 at 11:12:28AM +0800, Li Yang-r58472 wrote:
   From: Ahmed S. Darwish [mailto:[EMAIL PROTECTED]
  
   Hi,
   A kmalloc casting cleanup patch.
   Signed-off-by: Ahmed Darwish [EMAIL PROTECTED]
 
 [..]
 
   - (u32) (kmalloc((u32) (length + align),
   - GFP_KERNEL));
   + kmalloc((u32) (length + align),
GFP_KERNEL);
   +
 if (ugeth-tx_bd_ring_offset[j] != 0)
 ugeth-p_tx_bd_ring[j] =
 
 [..]
 
   - (u32) (kmalloc((u32) (length + align),
GFP_KERNEL));
   + kmalloc((u32) (length + align),
GFP_KERNEL);
 
  NACK about the 2 clean-ups above.  Cast from pointer to integer is
  required here.
 
 Are the casts from pointer to integer just needed to suppress gcc
 warnings or there's something technically important about them ?

It is to suppress the warnings.  IMHO, most type casts are not
technically important but for sanity check.

- Leo
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/3] Freescale QE UCC gigabit ethernet driver

2006-07-07 Thread Li Yang-r58472
 -Original Message-
 From: Kumar Gala [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 06, 2006 9:45 PM
 To: Li Yang-r58472
 Cc: Andrew Morton; [EMAIL PROTECTED]; netdev@vger.kernel.org;
 [EMAIL PROTECTED]
 Subject: Re: [PATCH 1/3] Freescale QE UCC gigabit ethernet driver
 
 Nack.  Here are some high level things that should be addressed:
 * There is a ton of debug code that should probably be stripped out,
 such as dump_regs, etc..

The reason I left these debug code in is that, QE is very flexible.
User probably needs to fine tune parameters for their own application.
It will be good to give them some clue doing that.  It's fine to remove
them, if you do think they are too verbose.
 * The phy support should use the phylib instead

I'll do this when I do get some time. ;)
 * convert from being a platform_device to of_device

I'm not up against moving to use of_device.  But why are we putting
extra effort in closing the door to backward compatibility with ppc
arch, and doesn't provide any new feature. ;)
 
 - kumar
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html