Message ID | 1437466521-27856-2-git-send-email-Peng.Fan@freescale.com |
---|---|
State | Changes Requested |
Delegated to: | Scott Wood |
Headers | show |
On Tue, Jul 21, 2015 at 1:15 AM, Peng Fan <Peng.Fan@freescale.com> wrote: > Check maximum ecc strength for each platfrom to avoid the calculated ecc > exceed the limitation. > > Signed-off-by: Peng Fan <Peng.Fan@freescale.com> > Signed-off-by: Han Xu <b45815@freescale.com> > Reviewed-by: Marek Vasut <marex@denx.de> > --- > > Changes v2: > Add Marek's reviewed by. > > drivers/mtd/nand/mxs_nand.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c > index 33ce817..97011b2 100644 > --- a/drivers/mtd/nand/mxs_nand.c > +++ b/drivers/mtd/nand/mxs_nand.c > @@ -149,6 +149,13 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, > uint32_t page_oob_size) > { > int ecc_strength; > + int max_ecc_strength_supported; > + > + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ > + if (is_cpu_type(MXC_CPU_MX6SX)) > + max_ecc_strength_supported = 62; > + else > + max_ecc_strength_supported = 40; > > /* > * Determine the ECC layout with the formula: > @@ -162,7 +169,7 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, > / (galois_field * > mxs_nand_ecc_chunk_cnt(page_data_size)); > > - return round_down(ecc_strength, 2); > + return min(round_down(ecc_strength, 2), max_ecc_strength_supported); > } > > static inline uint32_t mxs_nand_get_mark_offset(uint32_t page_data_size, > -- > 1.8.4 > Tested on IMX6 with MT29F16G08 16Gb and MT29F2G08 2Gb NAND devices. Tested-By: Tim Harvey <tharvey@gateworks.com>
On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote: > Check maximum ecc strength for each platfrom to avoid the calculated ecc > exceed the limitation. > > Signed-off-by: Peng Fan <Peng.Fan@freescale.com> > Signed-off-by: Han Xu <b45815@freescale.com> > Reviewed-by: Marek Vasut <marex@denx.de> > --- > > Changes v2: > Add Marek's reviewed by. > > drivers/mtd/nand/mxs_nand.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c > index 33ce817..97011b2 100644 > --- a/drivers/mtd/nand/mxs_nand.c > +++ b/drivers/mtd/nand/mxs_nand.c > @@ -149,6 +149,13 @@ static inline uint32_t > mxs_nand_get_ecc_strength(uint32_t page_data_size, > uint32_t page_oob_size) > { > int ecc_strength; > + int max_ecc_strength_supported; > + > + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ > + if (is_cpu_type(MXC_CPU_MX6SX)) > + max_ecc_strength_supported = 62; > + else > + max_ecc_strength_supported = 40; arm: + mx28evk_nand +drivers/mtd/nand/mxs_nand.c:155:18: error: 'MXC_CPU_MX6SX' undeclared (first use in this function) +drivers/mtd/nand/mxs_nand.c:155:18: note: each undeclared identifier is reported only once for each function it appears in +make[2]: *** [drivers/mtd/nand/mxs_nand.o] Error 1 +make[1]: *** [drivers/mtd/nand] Error 2 +make: *** [sub-make] Error 2 (among other failed targets) I tried to fix it by including asm/arch-imx/cpu.h, but then got undefined reference to is_cpu_type(). -Scott
Hi Scott, On Tue, Aug 25, 2015 at 04:05:56PM -0500, Scott Wood wrote: >On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote: >> Check maximum ecc strength for each platfrom to avoid the calculated ecc >> exceed the limitation. >> >> Signed-off-by: Peng Fan <Peng.Fan@freescale.com> >> Signed-off-by: Han Xu <b45815@freescale.com> >> Reviewed-by: Marek Vasut <marex@denx.de> >> --- >> >> Changes v2: >> Add Marek's reviewed by. >> >> drivers/mtd/nand/mxs_nand.c | 9 ++++++++- >> 1 file changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c >> index 33ce817..97011b2 100644 >> --- a/drivers/mtd/nand/mxs_nand.c >> +++ b/drivers/mtd/nand/mxs_nand.c >> @@ -149,6 +149,13 @@ static inline uint32_t >> mxs_nand_get_ecc_strength(uint32_t page_data_size, >> uint32_t page_oob_size) >> { >> int ecc_strength; >> + int max_ecc_strength_supported; >> + >> + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ >> + if (is_cpu_type(MXC_CPU_MX6SX)) >> + max_ecc_strength_supported = 62; >> + else >> + max_ecc_strength_supported = 40; > > arm: + mx28evk_nand >+drivers/mtd/nand/mxs_nand.c:155:18: error: 'MXC_CPU_MX6SX' undeclared (first use in this function) >+drivers/mtd/nand/mxs_nand.c:155:18: note: each undeclared identifier is reported only once for each function it appears in >+make[2]: *** [drivers/mtd/nand/mxs_nand.o] Error 1 >+make[1]: *** [drivers/mtd/nand] Error 2 >+make: *** [sub-make] Error 2 My bad. I only take mx6 into consideration when I did this patch. > >(among other failed targets) > >I tried to fix it by including asm/arch-imx/cpu.h, but then got undefined >reference to is_cpu_type(). Now is_cpu_type() is common to all i.MXes, but need this patch http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commitdiff;h=bf3303c98b23a29d99acc5e28865db604873b699 which is still in imx tree now. After applying the following patches, is_cpu_type should work. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=7c015efa7f28911d538ddd7d12926edd95176791 http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=8b647df9cae0ca65656cca19d4bd43239a9eca42 http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=3e26a2224a828cd07d1d1df46cbea7e99cc87993 http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=11caa3fa9dae79864726fcb763f100b4fd713884 http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=bf3303c98b23a29d99acc5e28865db604873b699 Then do you need me to repost this patch after the upper five patches in imx tree merge into uboot master branch, or the 3 patches in this patchset go through imx tree? https://patchwork.ozlabs.org/patch/498048/ https://patchwork.ozlabs.org/patch/498049/ https://patchwork.ozlabs.org/patch/498050/ Thanks, Peng. > >-Scott >
On Tue, Aug 25, 2015 at 09:14:58PM -0500, Scott Wood wrote: >On Wed, 2015-08-26 at 08:33 +0800, Peng Fan wrote: >> Hi Scott, >> >> On Tue, Aug 25, 2015 at 04:05:56PM -0500, Scott Wood wrote: >> > On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote: >> > > Check maximum ecc strength for each platfrom to avoid the calculated ecc >> > > exceed the limitation. >> > > >> > > Signed-off-by: Peng Fan <Peng.Fan@freescale.com> >> > > Signed-off-by: Han Xu <b45815@freescale.com> >> > > Reviewed-by: Marek Vasut <marex@denx.de> >> > > --- >> > > >> > > Changes v2: >> > > Add Marek's reviewed by. >> > > >> > > drivers/mtd/nand/mxs_nand.c | 9 ++++++++- >> > > 1 file changed, 8 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c >> > > index 33ce817..97011b2 100644 >> > > --- a/drivers/mtd/nand/mxs_nand.c >> > > +++ b/drivers/mtd/nand/mxs_nand.c >> > > @@ -149,6 +149,13 @@ static inline uint32_t >> > > mxs_nand_get_ecc_strength(uint32_t page_data_size, >> > > uint32_t page_oob_size) >> > > { >> > > int ecc_strength; >> > > + int max_ecc_strength_supported; >> > > + >> > > + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ >> > > + if (is_cpu_type(MXC_CPU_MX6SX)) >> > > + max_ecc_strength_supported = 62; >> > > + else >> > > + max_ecc_strength_supported = 40; >> > >> > arm: + mx28evk_nand >> > +drivers/mtd/nand/mxs_nand.c:155:18: error: 'MXC_CPU_MX6SX' undeclared >> > (first use in this function) >> > +drivers/mtd/nand/mxs_nand.c:155:18: note: each undeclared identifier is >> > reported only once for each function it appears in >> > +make[2]: *** [drivers/mtd/nand/mxs_nand.o] Error 1 >> > +make[1]: *** [drivers/mtd/nand] Error 2 >> > +make: *** [sub-make] Error 2 >> >> My bad. I only take mx6 into consideration when I did this patch. >> >> > >> > (among other failed targets) >> > >> > I tried to fix it by including asm/arch-imx/cpu.h, but then got undefined >> > reference to is_cpu_type(). >> >> Now is_cpu_type() is common to all i.MXes, but need this patch >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commitdiff;h=bf3303c98b23a29d99acc5e28865db604873b699 >> which is still in imx tree now. >> After applying the following patches, is_cpu_type should work. >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=7c015efa7f28911d538ddd7d12926edd95176791 >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=8b647df9cae0ca65656cca19d4bd43239a9eca42 >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=3e26a2224a828cd07d1d1df46cbea7e99cc87993 >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=11caa3fa9dae79864726fcb763f100b4fd713884 >> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=bf3303c98b23a29d99acc5e28865db604873b699 >> >> Then do you need me to repost this patch after the upper five patches in >> imx tree merge into uboot master branch, or the 3 patches in this patchset >> go through imx tree? >> https://patchwork.ozlabs.org/patch/498048/ >> https://patchwork.ozlabs.org/patch/498049/ >> https://patchwork.ozlabs.org/patch/498050/ > >Acked-by: Scott Wood <scottwood@freescale.com> > >I already have patches 1 and 3 applied locally, and will probably send a pull >request as soon as buildman finishes. Let me know if you want me to send >that, and then you can send patch 2 through imx, or if you want me to pull >patches 1 and 3 out so all can go via imx. You can send pull request for patch 1 and 3. The 3 patches are independent on each other. I'll repost patch 2 when the is_cpu_type patch set merged to uboot upstream master branch with your Acked-by. Then imx or nand tree, both are ok. Regards, Peng. > >-Scott >
On Wed, 2015-08-26 at 08:33 +0800, Peng Fan wrote: > Hi Scott, > > On Tue, Aug 25, 2015 at 04:05:56PM -0500, Scott Wood wrote: > > On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote: > > > Check maximum ecc strength for each platfrom to avoid the calculated ecc > > > exceed the limitation. > > > > > > Signed-off-by: Peng Fan <Peng.Fan@freescale.com> > > > Signed-off-by: Han Xu <b45815@freescale.com> > > > Reviewed-by: Marek Vasut <marex@denx.de> > > > --- > > > > > > Changes v2: > > > Add Marek's reviewed by. > > > > > > drivers/mtd/nand/mxs_nand.c | 9 ++++++++- > > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c > > > index 33ce817..97011b2 100644 > > > --- a/drivers/mtd/nand/mxs_nand.c > > > +++ b/drivers/mtd/nand/mxs_nand.c > > > @@ -149,6 +149,13 @@ static inline uint32_t > > > mxs_nand_get_ecc_strength(uint32_t page_data_size, > > > uint32_t page_oob_size) > > > { > > > int ecc_strength; > > > + int max_ecc_strength_supported; > > > + > > > + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ > > > + if (is_cpu_type(MXC_CPU_MX6SX)) > > > + max_ecc_strength_supported = 62; > > > + else > > > + max_ecc_strength_supported = 40; > > > > arm: + mx28evk_nand > > +drivers/mtd/nand/mxs_nand.c:155:18: error: 'MXC_CPU_MX6SX' undeclared > > (first use in this function) > > +drivers/mtd/nand/mxs_nand.c:155:18: note: each undeclared identifier is > > reported only once for each function it appears in > > +make[2]: *** [drivers/mtd/nand/mxs_nand.o] Error 1 > > +make[1]: *** [drivers/mtd/nand] Error 2 > > +make: *** [sub-make] Error 2 > > My bad. I only take mx6 into consideration when I did this patch. > > > > > (among other failed targets) > > > > I tried to fix it by including asm/arch-imx/cpu.h, but then got undefined > > reference to is_cpu_type(). > > Now is_cpu_type() is common to all i.MXes, but need this patch > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commitdiff;h=bf3303c98b23a29d99acc5e28865db604873b699 > which is still in imx tree now. > After applying the following patches, is_cpu_type should work. > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=7c015efa7f28911d538ddd7d12926edd95176791 > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=8b647df9cae0ca65656cca19d4bd43239a9eca42 > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=3e26a2224a828cd07d1d1df46cbea7e99cc87993 > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=11caa3fa9dae79864726fcb763f100b4fd713884 > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=bf3303c98b23a29d99acc5e28865db604873b699 > > Then do you need me to repost this patch after the upper five patches in > imx tree merge into uboot master branch, or the 3 patches in this patchset > go through imx tree? > https://patchwork.ozlabs.org/patch/498048/ > https://patchwork.ozlabs.org/patch/498049/ > https://patchwork.ozlabs.org/patch/498050/ Acked-by: Scott Wood <scottwood@freescale.com> I already have patches 1 and 3 applied locally, and will probably send a pull request as soon as buildman finishes. Let me know if you want me to send that, and then you can send patch 2 through imx, or if you want me to pull patches 1 and 3 out so all can go via imx. -Scott
On 26/08/2015 03:30, Peng Fan wrote: > On Tue, Aug 25, 2015 at 09:14:58PM -0500, Scott Wood wrote: >> On Wed, 2015-08-26 at 08:33 +0800, Peng Fan wrote: >>> Hi Scott, >>> >>> On Tue, Aug 25, 2015 at 04:05:56PM -0500, Scott Wood wrote: >>>> On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote: >>>>> Check maximum ecc strength for each platfrom to avoid the calculated ecc >>>>> exceed the limitation. >>>>> >>>>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com> >>>>> Signed-off-by: Han Xu <b45815@freescale.com> >>>>> Reviewed-by: Marek Vasut <marex@denx.de> >>>>> --- >>>>> >>>>> Changes v2: >>>>> Add Marek's reviewed by. >>>>> >>>>> drivers/mtd/nand/mxs_nand.c | 9 ++++++++- >>>>> 1 file changed, 8 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c >>>>> index 33ce817..97011b2 100644 >>>>> --- a/drivers/mtd/nand/mxs_nand.c >>>>> +++ b/drivers/mtd/nand/mxs_nand.c >>>>> @@ -149,6 +149,13 @@ static inline uint32_t >>>>> mxs_nand_get_ecc_strength(uint32_t page_data_size, >>>>> uint32_t page_oob_size) >>>>> { >>>>> int ecc_strength; >>>>> + int max_ecc_strength_supported; >>>>> + >>>>> + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ >>>>> + if (is_cpu_type(MXC_CPU_MX6SX)) >>>>> + max_ecc_strength_supported = 62; >>>>> + else >>>>> + max_ecc_strength_supported = 40; >>>> >>>> arm: + mx28evk_nand >>>> +drivers/mtd/nand/mxs_nand.c:155:18: error: 'MXC_CPU_MX6SX' undeclared >>>> (first use in this function) >>>> +drivers/mtd/nand/mxs_nand.c:155:18: note: each undeclared identifier is >>>> reported only once for each function it appears in >>>> +make[2]: *** [drivers/mtd/nand/mxs_nand.o] Error 1 >>>> +make[1]: *** [drivers/mtd/nand] Error 2 >>>> +make: *** [sub-make] Error 2 >>> >>> My bad. I only take mx6 into consideration when I did this patch. >>> >>>> >>>> (among other failed targets) >>>> >>>> I tried to fix it by including asm/arch-imx/cpu.h, but then got undefined >>>> reference to is_cpu_type(). >>> >>> Now is_cpu_type() is common to all i.MXes, but need this patch >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commitdiff;h=bf3303c98b23a29d99acc5e28865db604873b699 >>> which is still in imx tree now. >>> After applying the following patches, is_cpu_type should work. >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=7c015efa7f28911d538ddd7d12926edd95176791 >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=8b647df9cae0ca65656cca19d4bd43239a9eca42 >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=3e26a2224a828cd07d1d1df46cbea7e99cc87993 >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=11caa3fa9dae79864726fcb763f100b4fd713884 >>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=bf3303c98b23a29d99acc5e28865db604873b699 >>> >>> Then do you need me to repost this patch after the upper five patches in >>> imx tree merge into uboot master branch, or the 3 patches in this patchset >>> go through imx tree? >>> https://patchwork.ozlabs.org/patch/498048/ >>> https://patchwork.ozlabs.org/patch/498049/ >>> https://patchwork.ozlabs.org/patch/498050/ >> >> Acked-by: Scott Wood <scottwood@freescale.com> >> >> I already have patches 1 and 3 applied locally, and will probably send a pull >> request as soon as buildman finishes. Let me know if you want me to send >> that, and then you can send patch 2 through imx, or if you want me to pull >> patches 1 and 3 out so all can go via imx. > > You can send pull request for patch 1 and 3. The 3 patches are independent on each other. > I'll repost patch 2 when the is_cpu_type patch set merged to uboot upstream master branch with your Acked-by. Then imx or nand tree, both are ok. Fine with me. Regards, Stefano
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c index 33ce817..97011b2 100644 --- a/drivers/mtd/nand/mxs_nand.c +++ b/drivers/mtd/nand/mxs_nand.c @@ -149,6 +149,13 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, uint32_t page_oob_size) { int ecc_strength; + int max_ecc_strength_supported; + + /* Refer to Chapter 17 for i.MX6DQ, Chapter 18 for i.MX6SX */ + if (is_cpu_type(MXC_CPU_MX6SX)) + max_ecc_strength_supported = 62; + else + max_ecc_strength_supported = 40; /* * Determine the ECC layout with the formula: @@ -162,7 +169,7 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, / (galois_field * mxs_nand_ecc_chunk_cnt(page_data_size)); - return round_down(ecc_strength, 2); + return min(round_down(ecc_strength, 2), max_ecc_strength_supported); } static inline uint32_t mxs_nand_get_mark_offset(uint32_t page_data_size,