RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-06 Thread Zang Roy-R61911


> -Original Message-
> From: Anton Vorontsov [mailto:cbouatmai...@gmail.com]
> Sent: Monday, September 06, 2010 17:44 PM
> To: Zang Roy-R61911
> Cc: linux-...@lists.infradead.org; Lan Chunhe-B25806; linuxppc-...@ozlabs.org;
> a...@linux-foundation.org; Gala Kumar-B11780; Wood Scott-B07421
> Subject: Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common
> to elbc devices
> 
> On Mon, Sep 06, 2010 at 05:24:35PM +0800, Zang Roy-R61911 wrote:
> [..]
> > > mxmr = &fsl_lbc_ctrl_dev->regs->mcmr;
> > That makes sense.  A global or local variable for fsl_lbc_ctrl_dev->regs?
> Which one is better?
> 
> The less global variables, the better. So, I'd vote for
> a local one.
I also prefer local one.
> 
> > > [...]
> > > > > > +static int __devinit fsl_lbc_ctrl_probe(struct of_device *ofdev,
> > > > > > +const struct of_device_id 
> > > > > > *match)
> > > > > > +{
> > > > > > +   int ret = 0;
> > > > >
> > > > > no need for the initial value here.
> > > > Any harm?
> > >
> > > Probably not as gcc will likely optimize it away,
> > > but it's not needed, so why keep it there?
> > habit.
> 
> ;-)
:-(.
Thanks for all your comments. That is valuable.
I will update the patch according to your comment and the new platform device 
arch.
Roy
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-06 Thread Anton Vorontsov
On Mon, Sep 06, 2010 at 05:24:35PM +0800, Zang Roy-R61911 wrote:
[..]
> > mxmr = &fsl_lbc_ctrl_dev->regs->mcmr;
> That makes sense.  A global or local variable for fsl_lbc_ctrl_dev->regs? 
> Which one is better?

The less global variables, the better. So, I'd vote for
a local one.

> > [...]
> > > > > +static int __devinit fsl_lbc_ctrl_probe(struct of_device *ofdev,
> > > > > +  const struct of_device_id 
> > > > > *match)
> > > > > +{
> > > > > + int ret = 0;
> > > >
> > > > no need for the initial value here.
> > > Any harm?
> > 
> > Probably not as gcc will likely optimize it away,
> > but it's not needed, so why keep it there?
> habit.

;-)

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-06 Thread Zang Roy-R61911


> -Original Message-
> From: Anton Vorontsov [mailto:cbouatmai...@gmail.com]
> Sent: Monday, September 06, 2010 16:22 PM
> To: Zang Roy-R61911
> Cc: linux-...@lists.infradead.org; Lan Chunhe-B25806; linuxppc-...@ozlabs.org;
> a...@linux-foundation.org; Gala Kumar-B11780; Wood Scott-B07421
> Subject: Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common
> to elbc devices
> 
> On Mon, Sep 06, 2010 at 11:38:09AM +0800, Zang Roy-R61911 wrote:
> [...]
> > > > switch (br & BR_MSEL) {
> > > > case BR_MS_UPMA:
> > > > -   upm->mxmr = &fsl_lbc_regs->mamr;
> > > > +   upm->mxmr = &fsl_lbc_ctrl_dev->regs->mamr;
> > >
> > > Ditto, a very repetitive stuff, desires a variable for regs?
> > But the fact is that the variable represents different reg
> > address according to the condition. It will be ugly to use
> > the reg address directoly.
> 
> I meant a dedicated var for 'fsl_lbc_ctrl_dev->regs'.
> I.e.
> 
> regs = fsl_lbc_ctrl_dev->regs;
> ...
> mxmr = ®s->mamr;
> ...
> mxmr = ®s->mbmr;
> ..
> mxmr = ®s->mcmr;
> 
> Instead of
> 
> mxmr = &fsl_lbc_ctrl_dev->regs->mamr;
> ...
> mxmr = &fsl_lbc_ctrl_dev->regs->mbmr;
> ..
> mxmr = &fsl_lbc_ctrl_dev->regs->mcmr;
That makes sense.  A global or local variable for fsl_lbc_ctrl_dev->regs? Which 
one is better?

> 
> [...]
> > > > +static int __devinit fsl_lbc_ctrl_probe(struct of_device *ofdev,
> > > > +const struct of_device_id 
> > > > *match)
> > > > +{
> > > > +   int ret = 0;
> > >
> > > no need for the initial value here.
> > Any harm?
> 
> Probably not as gcc will likely optimize it away,
> but it's not needed, so why keep it there?
habit.
Thanks.
Roy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-06 Thread Anton Vorontsov
On Mon, Sep 06, 2010 at 11:38:09AM +0800, Zang Roy-R61911 wrote:
[...]
> > >   switch (br & BR_MSEL) {
> > >   case BR_MS_UPMA:
> > > - upm->mxmr = &fsl_lbc_regs->mamr;
> > > + upm->mxmr = &fsl_lbc_ctrl_dev->regs->mamr;
> > 
> > Ditto, a very repetitive stuff, desires a variable for regs?
> But the fact is that the variable represents different reg
> address according to the condition. It will be ugly to use
> the reg address directoly.

I meant a dedicated var for 'fsl_lbc_ctrl_dev->regs'.
I.e.

regs = fsl_lbc_ctrl_dev->regs;
...
mxmr = ®s->mamr;
...
mxmr = ®s->mbmr;
..
mxmr = ®s->mcmr;

Instead of

mxmr = &fsl_lbc_ctrl_dev->regs->mamr;
...
mxmr = &fsl_lbc_ctrl_dev->regs->mbmr;
..
mxmr = &fsl_lbc_ctrl_dev->regs->mcmr;

[...]
> > > +static int __devinit fsl_lbc_ctrl_probe(struct of_device *ofdev,
> > > +  const struct of_device_id *match)
> > > +{
> > > + int ret = 0;
> > 
> > no need for the initial value here.
> Any harm?

Probably not as gcc will likely optimize it away,
but it's not needed, so why keep it there?

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-05 Thread Zang Roy-R61911


> -Original Message-
> From: Anton Vorontsov [mailto:cbouatmai...@gmail.com]
> Sent: Friday, September 03, 2010 19:28 PM
> To: Zang Roy-R61911
> Cc: linux-...@lists.infradead.org; Lan Chunhe-B25806; linuxppc-...@ozlabs.org;
> a...@linux-foundation.org; Gala Kumar-B11780
> Subject: Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common
> to elbc devices
> 
> On Fri, Aug 06, 2010 at 10:51:34AM +0800, Roy Zang wrote:
> > From: Lan Chunhe-B25806 
> >
> > Move Freescale elbc interrupt from nand dirver to elbc driver.
> > Then all elbc devices can use the interrupt instead of ONLY nand.
> >
> > Signed-off-by: Lan Chunhe-B25806 
> > Signed-off-by: Roy Zang 
> > ---
> > send the patch to linux-...@lists.infradead.org
> > it has been posted to linuxppc-...@ozlabs.org and do not get any comment.
> >
> >  arch/powerpc/Kconfig   |7 +-
> >  arch/powerpc/include/asm/fsl_lbc.h |   34 +-
> >  arch/powerpc/sysdev/fsl_lbc.c  |  254 ++---
> ---
> >  3 files changed, 253 insertions(+), 42 deletions(-)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 2031a28..5155b53 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -703,9 +703,12 @@ config 4xx_SOC
> > bool
> >
> >  config FSL_LBC
> > -   bool
> > +   bool "Freescale Local Bus support"
> > +   depends on FSL_SOC
> > help
> > - Freescale Localbus support
> > + Enables reporting of errors from the Freescale local bus
> > + controller.  Also contains some common code used by
> > + drivers for specific local bus peripherals.
> >
> >  config FSL_GTM
> > bool
> [...]
> > diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
> > index dceb8d1..9c9e44f 100644
> > --- a/arch/powerpc/sysdev/fsl_lbc.c
> > +++ b/arch/powerpc/sysdev/fsl_lbc.c
> > @@ -5,6 +5,10 @@
> >   *
> >   * Author: Anton Vorontsov 
> >   *
> > + * Copyright (c) 2010 Freescale Semiconductor
> > + *
> > + * Authors: Jack Lan 
> 
> Would be prettier if you'd group copyright and authorship notices.
> I.e.
> 
> Copyright 2008 MV
> Copyright 2010 FSL
> 
> Authors: Anton
>  Jack
Then how to reflect the relationship of the Author and the company? from email 
address?

> 
> > + *
> >   * This program is free software; you can redistribute it and/or modify
> >   * it under the terms of the GNU General Public License as published by
> >   * the Free Software Foundation; either version 2 of the License, or
> > @@ -23,35 +27,8 @@
> >  #include 
> >
> >  static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
> > -static struct fsl_lbc_regs __iomem *fsl_lbc_regs;
> > -
> > -static char __initdata *compat_lbc[] = {
> > -   "fsl,pq2-localbus",
> > -   "fsl,pq2pro-localbus",
> > -   "fsl,pq3-localbus",
> > -   "fsl,elbc",
> > -};
> > -
> > -static int __init fsl_lbc_init(void)
> > -{
> > -   struct device_node *lbus;
> > -   int i;
> > -
> > -   for (i = 0; i < ARRAY_SIZE(compat_lbc); i++) {
> > -   lbus = of_find_compatible_node(NULL, NULL, compat_lbc[i]);
> > -   if (lbus)
> > -   goto found;
> > -   }
> > -   return -ENODEV;
> > -
> > -found:
> > -   fsl_lbc_regs = of_iomap(lbus, 0);
> > -   of_node_put(lbus);
> > -   if (!fsl_lbc_regs)
> > -   return -ENOMEM;
> > -   return 0;
> > -}
> > -arch_initcall(fsl_lbc_init);
> > +struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev;
> > +EXPORT_SYMBOL(fsl_lbc_ctrl_dev);
> >
> >  /**
> >   * fsl_lbc_find - find Localbus bank
> > @@ -66,12 +43,12 @@ int fsl_lbc_find(phys_addr_t addr_base)
> >  {
> > int i;
> >
> > -   if (!fsl_lbc_regs)
> > +   if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
> > return -ENODEV;
> >
> > -   for (i = 0; i < ARRAY_SIZE(fsl_lbc_regs->bank); i++) {
> > -   __be32 br = in_be32(&fsl_lbc_regs->bank[i].br);
> > -   __be32 or = in_be32(&fsl_lbc_regs->bank[i].or);
> > +   for (i = 0; i < ARRAY_SIZE(fsl_lbc_ctrl_dev->regs->bank); i++) {
> > +   __be32 br = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].br);
> > +   __be32 or = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].or);
> 
> A dedicated variable for regs would make this

Re: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-03 Thread Anton Vorontsov
On Fri, Aug 06, 2010 at 10:51:34AM +0800, Roy Zang wrote:
> From: Lan Chunhe-B25806 
> 
> Move Freescale elbc interrupt from nand dirver to elbc driver.
> Then all elbc devices can use the interrupt instead of ONLY nand.
> 
> Signed-off-by: Lan Chunhe-B25806 
> Signed-off-by: Roy Zang 
> ---
> send the patch to linux-...@lists.infradead.org
> it has been posted to linuxppc-...@ozlabs.org and do not get any comment.
> 
>  arch/powerpc/Kconfig   |7 +-
>  arch/powerpc/include/asm/fsl_lbc.h |   34 +-
>  arch/powerpc/sysdev/fsl_lbc.c  |  254 
> ++--
>  3 files changed, 253 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 2031a28..5155b53 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -703,9 +703,12 @@ config 4xx_SOC
>   bool
>  
>  config FSL_LBC
> - bool
> + bool "Freescale Local Bus support"
> + depends on FSL_SOC
>   help
> -   Freescale Localbus support
> +   Enables reporting of errors from the Freescale local bus
> +   controller.  Also contains some common code used by
> +   drivers for specific local bus peripherals.
>  
>  config FSL_GTM
>   bool
[...]
> diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
> index dceb8d1..9c9e44f 100644
> --- a/arch/powerpc/sysdev/fsl_lbc.c
> +++ b/arch/powerpc/sysdev/fsl_lbc.c
> @@ -5,6 +5,10 @@
>   *
>   * Author: Anton Vorontsov 
>   *
> + * Copyright (c) 2010 Freescale Semiconductor
> + *
> + * Authors: Jack Lan 

Would be prettier if you'd group copyright and authorship notices.
I.e.

Copyright 2008 MV
Copyright 2010 FSL

Authors: Anton
 Jack

> + *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License as published by
>   * the Free Software Foundation; either version 2 of the License, or
> @@ -23,35 +27,8 @@
>  #include 
>  
>  static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
> -static struct fsl_lbc_regs __iomem *fsl_lbc_regs;
> -
> -static char __initdata *compat_lbc[] = {
> - "fsl,pq2-localbus",
> - "fsl,pq2pro-localbus",
> - "fsl,pq3-localbus",
> - "fsl,elbc",
> -};
> -
> -static int __init fsl_lbc_init(void)
> -{
> - struct device_node *lbus;
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(compat_lbc); i++) {
> - lbus = of_find_compatible_node(NULL, NULL, compat_lbc[i]);
> - if (lbus)
> - goto found;
> - }
> - return -ENODEV;
> -
> -found:
> - fsl_lbc_regs = of_iomap(lbus, 0);
> - of_node_put(lbus);
> - if (!fsl_lbc_regs)
> - return -ENOMEM;
> - return 0;
> -}
> -arch_initcall(fsl_lbc_init);
> +struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev;
> +EXPORT_SYMBOL(fsl_lbc_ctrl_dev);
>  
>  /**
>   * fsl_lbc_find - find Localbus bank
> @@ -66,12 +43,12 @@ int fsl_lbc_find(phys_addr_t addr_base)
>  {
>   int i;
>  
> - if (!fsl_lbc_regs)
> + if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
>   return -ENODEV;
>  
> - for (i = 0; i < ARRAY_SIZE(fsl_lbc_regs->bank); i++) {
> - __be32 br = in_be32(&fsl_lbc_regs->bank[i].br);
> - __be32 or = in_be32(&fsl_lbc_regs->bank[i].or);
> + for (i = 0; i < ARRAY_SIZE(fsl_lbc_ctrl_dev->regs->bank); i++) {
> + __be32 br = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].br);
> + __be32 or = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].or);

A dedicated variable for regs would make this much more readable?

>  
>   if (br & BR_V && (br & or & BR_BA) == addr_base)
>   return i;
> @@ -99,17 +76,20 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm 
> *upm)
>   if (bank < 0)
>   return bank;
>  
> - br = in_be32(&fsl_lbc_regs->bank[bank].br);
> + if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
> + return -ENODEV;
> +
> + br = in_be32(&fsl_lbc_ctrl_dev->regs->bank[bank].br);
>  
>   switch (br & BR_MSEL) {
>   case BR_MS_UPMA:
> - upm->mxmr = &fsl_lbc_regs->mamr;
> + upm->mxmr = &fsl_lbc_ctrl_dev->regs->mamr;

Ditto, a very repetitive stuff, desires a variable for regs?

>   break;
>   case BR_MS_UPMB:
> - upm->mxmr = &fsl_lbc_regs->mbmr;
> + upm->mxmr = &fsl_lbc_ctrl_dev->regs->mbmr;
>   break;
>   case BR_MS_UPMC:
> - upm->mxmr = &fsl_lbc_regs->mcmr;
> + upm->mxmr = &fsl_lbc_ctrl_dev->regs->mcmr;
>   break;
>   default:
>   return -EINVAL;
> @@ -143,14 +123,18 @@ EXPORT_SYMBOL(fsl_upm_find);
>   * thus UPM pattern actually executed. Note that mar usage depends on the
>   * pre-programmed AMX bits in the UPM RAM.
>   */
> +
>  int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
>  {
>   int ret = 0;
>   unsigned long flags;
>  

RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-09-03 Thread Zang Roy-R61911


> -Original Message-
> From: Zang Roy-R61911
> Sent: Friday, August 06, 2010 10:52 AM
> To: linux-...@lists.infradead.org
> Cc: linuxppc-...@ozlabs.org; a...@linux-foundation.org; Gala
Kumar-B11780; Lan
> Chunhe-B25806
> Subject: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt
common to
> elbc devices
> 
> From: Lan Chunhe-B25806 
> 
> Move Freescale elbc interrupt from nand dirver to elbc driver.
> Then all elbc devices can use the interrupt instead of ONLY nand.
> 
> Signed-off-by: Lan Chunhe-B25806 
> Signed-off-by: Roy Zang 
> ---
> send the patch to linux-...@lists.infradead.org
> it has been posted to linuxppc-...@ozlabs.org and do not get any
comment.

Hi, Kumar

I can see that this patch delegates to you in the mail list.
Do you have any comment?
Today, I rebase the patch to Linux 2.6.26-rc3.
1/3, 3/3 are still OK for the latest tree.
For patch 2/3, some minor fix needs to change for of_dev to
platform_device.

Should I resend the patch?
Thanks.
Roy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-08-29 Thread Artem Bityutskiy
On Mon, 2010-08-09 at 15:33 +0800, Zang Roy-R61911 wrote:
> Any comment about this serial patches?
> If none, I'd ask Andrew to merge to his mm tree.

Could you please separate out MTD stuff, to the extent it is possible to
do?
-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-08-10 Thread Zang Roy-R61911
 

> -Original Message-
> From: Zang Roy-R61911 
> Sent: Friday, August 06, 2010 10:52 AM
> To: linux-...@lists.infradead.org
> Cc: linuxppc-...@ozlabs.org; a...@linux-foundation.org; Gala 
> Kumar-B11780; Lan Chunhe-B25806
> Subject: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc 
> interrupt common to elbc devices
> 
> From: Lan Chunhe-B25806 
> 
> Move Freescale elbc interrupt from nand dirver to elbc driver.
> Then all elbc devices can use the interrupt instead of ONLY nand.
> 
> Signed-off-by: Lan Chunhe-B25806 
> Signed-off-by: Roy Zang 
> ---
> send the patch to linux-...@lists.infradead.org
> it has been posted to linuxppc-...@ozlabs.org and do not get 
> any comment.
> 
>  arch/powerpc/Kconfig   |7 +-
>  arch/powerpc/include/asm/fsl_lbc.h |   34 +-
>  arch/powerpc/sysdev/fsl_lbc.c  |  254 
> ++--
>  3 files changed, 253 insertions(+), 42 deletions(-)
Who is response to review the nand driver in mtd list?
Please help to  comment on this serial patch.
Thanks.
Roy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-08-09 Thread Zang Roy-R61911
 

> -Original Message-
> From: Zang Roy-R61911 
> Sent: Friday, August 06, 2010 10:52 AM
> To: linux-...@lists.infradead.org
> Cc: linuxppc-...@ozlabs.org; a...@linux-foundation.org; Gala 
> Kumar-B11780; Lan Chunhe-B25806
> Subject: [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc 
> interrupt common to elbc devices
> 
> From: Lan Chunhe-B25806 
> 
> Move Freescale elbc interrupt from nand dirver to elbc driver.
> Then all elbc devices can use the interrupt instead of ONLY nand.
> 
> Signed-off-by: Lan Chunhe-B25806 
> Signed-off-by: Roy Zang 
> ---
> send the patch to linux-...@lists.infradead.org
> it has been posted to linuxppc-...@ozlabs.org and do not get 
> any comment.
Any comment about this serial patches?
If none, I'd ask Andrew to merge to his mm tree.
Thanks.
Roy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices

2010-08-05 Thread Roy Zang
From: Lan Chunhe-B25806 

Move Freescale elbc interrupt from nand dirver to elbc driver.
Then all elbc devices can use the interrupt instead of ONLY nand.

Signed-off-by: Lan Chunhe-B25806 
Signed-off-by: Roy Zang 
---
send the patch to linux-...@lists.infradead.org
it has been posted to linuxppc-...@ozlabs.org and do not get any comment.

 arch/powerpc/Kconfig   |7 +-
 arch/powerpc/include/asm/fsl_lbc.h |   34 +-
 arch/powerpc/sysdev/fsl_lbc.c  |  254 ++--
 3 files changed, 253 insertions(+), 42 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2031a28..5155b53 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -703,9 +703,12 @@ config 4xx_SOC
bool
 
 config FSL_LBC
-   bool
+   bool "Freescale Local Bus support"
+   depends on FSL_SOC
help
- Freescale Localbus support
+ Enables reporting of errors from the Freescale local bus
+ controller.  Also contains some common code used by
+ drivers for specific local bus peripherals.
 
 config FSL_GTM
bool
diff --git a/arch/powerpc/include/asm/fsl_lbc.h 
b/arch/powerpc/include/asm/fsl_lbc.h
index 1b5a210..9b95eab 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -1,9 +1,10 @@
 /* Freescale Local Bus Controller
  *
- * Copyright (c) 2006-2007 Freescale Semiconductor
+ * Copyright (c) 2006-2007, 2010 Freescale Semiconductor
  *
  * Authors: Nick Spence ,
  *  Scott Wood 
+ *  Jack Lan 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +28,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 struct fsl_lbc_bank {
__be32 br; /**< Base Register  */
 #define BR_BA   0x8000
@@ -125,13 +129,23 @@ struct fsl_lbc_regs {
 #define LTESR_ATMW 0x0080
 #define LTESR_ATMR 0x0040
 #define LTESR_CS   0x0008
+#define LTESR_UPM  0x0002
 #define LTESR_CC   0x0001
 #define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC)
+#define LTESR_MASK  (LTESR_BM | LTESR_FCT | LTESR_PAR | LTESR_WP \
+| LTESR_ATMW | LTESR_ATMR | LTESR_CS | LTESR_UPM \
+| LTESR_CC)
+#define LTESR_CLEAR0x
+#define LTECCR_CLEAR   0x
+#define LTESR_STATUS   LTESR_MASK
+#define LTEIR_ENABLE   LTESR_MASK
+#define LTEDR_ENABLE   0x
__be32 ltedr;   /**< Transfer Error Disable Register */
__be32 lteir;   /**< Transfer Error Interrupt Register */
__be32 lteatr;  /**< Transfer Error Attributes Register */
__be32 ltear;   /**< Transfer Error Address Register */
-   u8 res6[0xC];
+   __be32 lteccr;  /**< Transfer Error ECC Register */
+   u8 res6[0x8];
__be32 lbcr;/**< Configuration Register */
 #define LBCR_LDIS  0x8000
 #define LBCR_LDIS_SHIFT31
@@ -265,7 +279,23 @@ static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
cpu_relax();
 }
 
+/* overview of the fsl lbc controller */
+
+struct fsl_lbc_ctrl {
+   /* device info */
+   struct device   *dev;
+   struct fsl_lbc_regs __iomem *regs;
+   int irq;
+   wait_queue_head_t   irq_wait;
+   spinlock_t  lock;
+   void*nand;
+
+   /* status read from LTESR by irq handler */
+   unsigned intirq_status;
+};
+
 extern int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base,
   u32 mar);
+extern struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev;
 
 #endif /* __ASM_FSL_LBC_H */
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index dceb8d1..9c9e44f 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -5,6 +5,10 @@
  *
  * Author: Anton Vorontsov 
  *
+ * Copyright (c) 2010 Freescale Semiconductor
+ *
+ * Authors: Jack Lan 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -23,35 +27,8 @@
 #include 
 
 static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
-static struct fsl_lbc_regs __iomem *fsl_lbc_regs;
-
-static char __initdata *compat_lbc[] = {
-   "fsl,pq2-localbus",
-   "fsl,pq2pro-localbus",
-   "fsl,pq3-localbus",
-   "fsl,elbc",
-};
-
-static int __init fsl_lbc_init(void)
-{
-   struct device_node *lbus;
-   int i;
-
-   for (i = 0; i < ARRAY_SIZE(compat_lbc); i++) {
-   lbus = of_find_compatible_node(NULL, NULL, compat_lbc[i]);
-   if (lbus)
-   goto found;
-   }
-   return -ENODEV;
-