* [PATCH 1/2] ARM: imx: santaro: select i2c @ 2017-09-15 9:07 Lucas Stach 2017-09-15 9:07 ` [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only Lucas Stach 0 siblings, 1 reply; 4+ messages in thread From: Lucas Stach @ 2017-09-15 9:07 UTC (permalink / raw) To: barebox The board support tries to access a i2c bus to find out which touchscreen is connected. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- arch/arm/mach-imx/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 06a6aeee43a4..01975ef579ce 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -301,6 +301,8 @@ config MACH_DFI_FS700_M60 config MACH_GUF_SANTARO bool "Garz+Fricke Santaro Board" select ARCH_IMX6 + select I2C + select I2C_IMX config MACH_REALQ7 bool "DataModul i.MX6Q Real Qseven Board" -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only 2017-09-15 9:07 [PATCH 1/2] ARM: imx: santaro: select i2c Lucas Stach @ 2017-09-15 9:07 ` Lucas Stach 2017-09-16 13:48 ` Sam Ravnborg 0 siblings, 1 reply; 4+ messages in thread From: Lucas Stach @ 2017-09-15 9:07 UTC (permalink / raw) To: barebox This code may be compiled without ARCH_IMX6 present, so it must not depend on any functions provided by the architecture support. Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- common/imx-bbu-nand-fcb.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 7218c5e1ccda..bd539bafa7f7 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -38,9 +38,12 @@ #include <io.h> #include <crc.h> #include <mach/generic.h> -#include <mach/imx6.h> #include <mtd/mtd-peb.h> +#ifdef CONFIG_ARCH_IMX6 +#include <mach/imx6.h> +#endif + struct dbbt_block { uint32_t Checksum; uint32_t FingerPrint; @@ -141,7 +144,8 @@ static uint8_t reverse_bit(uint8_t b) return b; } -static void encode_bch_ecc(void *buf, struct fcb_block *fcb, int eccbits) +static void __maybe_unused encode_bch_ecc(void *buf, struct fcb_block *fcb, + int eccbits) { int i, j, m = 13; int blocksize = 128; @@ -441,9 +445,11 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) goto err; } +#if IS_ENABLED(CONFIG_ARCH_IMX6) if (cpu_is_mx6ul() || cpu_is_mx6ull()) fcb = read_fcb_bch(rawpage, 40); else +#endif fcb = read_fcb_hamming_13_8(rawpage); if (IS_ERR(fcb)) { @@ -899,10 +905,13 @@ static int imx_bbu_write_fcbs_dbbts(struct mtd_info *mtd, struct fcb_block *fcb) fcb_raw_page = xzalloc(mtd->writesize + mtd->oobsize); +#if IS_ENABLED(CONFIG_ARCH_IMX6) if (cpu_is_mx6ul() || cpu_is_mx6ull()) { /* 40 bit BCH, for i.MX6UL(L) */ encode_bch_ecc(fcb_raw_page + 32, fcb, 40); - } else { + } else +#endif + { memcpy(fcb_raw_page + 12, fcb, sizeof(struct fcb_block)); encode_hamming_13_8(fcb_raw_page + 12, fcb_raw_page + 12 + 512, 512); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only 2017-09-15 9:07 ` [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only Lucas Stach @ 2017-09-16 13:48 ` Sam Ravnborg 2017-09-20 6:50 ` Sascha Hauer 0 siblings, 1 reply; 4+ messages in thread From: Sam Ravnborg @ 2017-09-16 13:48 UTC (permalink / raw) To: Lucas Stach; +Cc: barebox Hi Lucas. On Fri, Sep 15, 2017 at 11:07:08AM +0200, Lucas Stach wrote: > This code may be compiled without ARCH_IMX6 present, so it must not > depend on any functions provided by the architecture support. > > Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul) > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > --- > common/imx-bbu-nand-fcb.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c > index 7218c5e1ccda..bd539bafa7f7 100644 > --- a/common/imx-bbu-nand-fcb.c > +++ b/common/imx-bbu-nand-fcb.c > @@ -38,9 +38,12 @@ > #include <io.h> > #include <crc.h> > #include <mach/generic.h> > -#include <mach/imx6.h> > #include <mtd/mtd-peb.h> > > +#ifdef CONFIG_ARCH_IMX6 > +#include <mach/imx6.h> > +#endif > + > struct dbbt_block { > uint32_t Checksum; > uint32_t FingerPrint; > @@ -141,7 +144,8 @@ static uint8_t reverse_bit(uint8_t b) > return b; > } > > -static void encode_bch_ecc(void *buf, struct fcb_block *fcb, int eccbits) > +static void __maybe_unused encode_bch_ecc(void *buf, struct fcb_block *fcb, > + int eccbits) > { > int i, j, m = 13; > int blocksize = 128; > @@ -441,9 +445,11 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) > goto err; > } > > +#if IS_ENABLED(CONFIG_ARCH_IMX6) > if (cpu_is_mx6ul() || cpu_is_mx6ull()) > fcb = read_fcb_bch(rawpage, 40); > else > +#endif > fcb = read_fcb_hamming_13_8(rawpage); ifdef out an if else like this is ugly and confusing. Consider using the much more readable variant: if (IS_ENABLED(CONFIG_ARCH_IMX6) && (cpu_is_mx6ul() || cpu_is_mx6ull())) fcb = read_fcb_bch(rawpage, 40); else fcb = read_fcb_hamming_13_8(rawpage); Same goes for next chunk in this patch. Sam _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only 2017-09-16 13:48 ` Sam Ravnborg @ 2017-09-20 6:50 ` Sascha Hauer 0 siblings, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2017-09-20 6:50 UTC (permalink / raw) To: Sam Ravnborg; +Cc: barebox On Sat, Sep 16, 2017 at 03:48:09PM +0200, Sam Ravnborg wrote: > Hi Lucas. > > On Fri, Sep 15, 2017 at 11:07:08AM +0200, Lucas Stach wrote: > > This code may be compiled without ARCH_IMX6 present, so it must not > > depend on any functions provided by the architecture support. > > > > Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul) > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > > --- > > common/imx-bbu-nand-fcb.c | 15 ++++++++++++--- > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c > > index 7218c5e1ccda..bd539bafa7f7 100644 > > --- a/common/imx-bbu-nand-fcb.c > > +++ b/common/imx-bbu-nand-fcb.c > > @@ -38,9 +38,12 @@ > > #include <io.h> > > #include <crc.h> > > #include <mach/generic.h> > > -#include <mach/imx6.h> > > #include <mtd/mtd-peb.h> > > > > +#ifdef CONFIG_ARCH_IMX6 > > +#include <mach/imx6.h> > > +#endif > > + > > struct dbbt_block { > > uint32_t Checksum; > > uint32_t FingerPrint; > > @@ -141,7 +144,8 @@ static uint8_t reverse_bit(uint8_t b) > > return b; > > } > > > > -static void encode_bch_ecc(void *buf, struct fcb_block *fcb, int eccbits) > > +static void __maybe_unused encode_bch_ecc(void *buf, struct fcb_block *fcb, > > + int eccbits) > > { > > int i, j, m = 13; > > int blocksize = 128; > > @@ -441,9 +445,11 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) > > goto err; > > } > > > > +#if IS_ENABLED(CONFIG_ARCH_IMX6) > > if (cpu_is_mx6ul() || cpu_is_mx6ull()) > > fcb = read_fcb_bch(rawpage, 40); > > else > > +#endif > > fcb = read_fcb_hamming_13_8(rawpage); > > ifdef out an if else like this is ugly and confusing. I agree. > > Consider using the much more readable variant: > if (IS_ENABLED(CONFIG_ARCH_IMX6) && (cpu_is_mx6ul() || cpu_is_mx6ull())) > fcb = read_fcb_bch(rawpage, 40); > else > fcb = read_fcb_hamming_13_8(rawpage); Using IS_ENABLED() is not possible here since cpu_is_mx6ul() is not declared on i.MX28. The following should work. Untested though. Sascha ------------------------8<--------------------------------- From 97a3b800b02f441e13c23872cc2eebde1a475b4d Mon Sep 17 00:00:00 2001 From: Sascha Hauer <s.hauer@pengutronix.de> Date: Wed, 20 Sep 2017 08:46:17 +0200 Subject: [PATCH] imx-bbu-nand-fcb: fix build on MX28 only This code may be compiled without ARCH_IMX6 present, so it must not depend on any functions provided by the architecture support. Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- common/imx-bbu-nand-fcb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 7218c5e1cc..7bf8aaa5ed 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -38,9 +38,21 @@ #include <io.h> #include <crc.h> #include <mach/generic.h> -#include <mach/imx6.h> #include <mtd/mtd-peb.h> +#ifdef CONFIG_ARCH_IMX6 +#include <mach/imx6.h> +static inline int fcb_is_bch_encoded(void) +{ + return cpu_is_mx6ul() || cpu_is_mx6ull(); +} +#else +static inline int fcb_is_bch_encoded(void) +{ + return 0; +} +#endif + struct dbbt_block { uint32_t Checksum; uint32_t FingerPrint; @@ -441,7 +453,7 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) goto err; } - if (cpu_is_mx6ul() || cpu_is_mx6ull()) + if (fcb_is_bch_encoded()) fcb = read_fcb_bch(rawpage, 40); else fcb = read_fcb_hamming_13_8(rawpage); @@ -899,7 +911,7 @@ static int imx_bbu_write_fcbs_dbbts(struct mtd_info *mtd, struct fcb_block *fcb) fcb_raw_page = xzalloc(mtd->writesize + mtd->oobsize); - if (cpu_is_mx6ul() || cpu_is_mx6ull()) { + if (fcb_is_bch_encoded()) { /* 40 bit BCH, for i.MX6UL(L) */ encode_bch_ecc(fcb_raw_page + 32, fcb, 40); } else { -- 2.11.0 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-20 6:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-09-15 9:07 [PATCH 1/2] ARM: imx: santaro: select i2c Lucas Stach 2017-09-15 9:07 ` [PATCH 2/2] imx-bbu-nand-fcb: fix build on MX28 only Lucas Stach 2017-09-16 13:48 ` Sam Ravnborg 2017-09-20 6:50 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox