From: Roy Zang <tie-fei.zang@freescale.com> To: linux-mtd@lists.infradead.org Cc: B07421@freescale.com, dedekind1@gmail.com, B25806@freescale.com, linuxppc-dev@ozlabs.org, akpm@linux-foundation.org, dwmw2@infradead.org, B11780@freescale.com Subject: [PATCH v2 3/3][MTD] P4080/mtd: Fix the freescale lbc issue with 36bit mode Date: Thu, 9 Sep 2010 18:20:32 +0800 [thread overview] Message-ID: <1284027632-32573-3-git-send-email-tie-fei.zang@freescale.com> (raw) In-Reply-To: <1284027632-32573-2-git-send-email-tie-fei.zang@freescale.com> From: Lan Chunhe-B25806 <b25806@freescale.com> When system uses 36bit physical address, res.start is 36bit physical address. But the function of in_be32 returns 32bit physical address. Then both of them compared each other is wrong. So by converting the address of res.start into the right format fixes this issue. Signed-off-by: Lan Chunhe-B25806 <b25806@freescale.com> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> --- Comparing with v1, according to the feedback, add some decorations. arch/powerpc/include/asm/fsl_lbc.h | 1 + arch/powerpc/sysdev/fsl_lbc.c | 26 +++++++++++++++++++++++++- drivers/mtd/nand/fsl_elbc_nand.c | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h index 9b95eab..bff85c8 100644 --- a/arch/powerpc/include/asm/fsl_lbc.h +++ b/arch/powerpc/include/asm/fsl_lbc.h @@ -249,6 +249,7 @@ struct fsl_upm { int width; }; +extern unsigned int fsl_lbc_addr(phys_addr_t addr_base); extern int fsl_lbc_find(phys_addr_t addr_base); extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm); diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index f4eca8d..3a09e90 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c @@ -31,6 +31,30 @@ struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev; EXPORT_SYMBOL(fsl_lbc_ctrl_dev); /** + * fsl_lbc_addr - convert the base address + * @addr_base: base address of the memory bank + * + * This function converts a base address of lbc into the right format for the BR + * registers. If the SOC has eLBC then it returns 32bit physical address else + * it returns 34bit physical address for local bus(Example: MPC8641). + */ +unsigned int fsl_lbc_addr(phys_addr_t addr_base) +{ + void *dev; + int compatible; + + dev = fsl_lbc_ctrl_dev->dev->of_node; + compatible = of_device_is_compatible(dev, "fsl,elbc"); + + if (compatible) + return addr_base & 0xffff8000; + else + return (addr_base & 0x0ffff8000ull) + | ((addr_base & 0x300000000ull) >> 19); +} +EXPORT_SYMBOL(fsl_lbc_addr); + +/** * fsl_lbc_find - find Localbus bank * @addr_base: base address of the memory bank * @@ -52,7 +76,7 @@ int fsl_lbc_find(phys_addr_t addr_base) __be32 br = in_be32(&lbc->bank[i].br); __be32 or = in_be32(&lbc->bank[i].or); - if (br & BR_V && (br & or & BR_BA) == addr_base) + if (br & BR_V && (br & or & BR_BA) == fsl_lbc_addr(addr_base)) return i; } diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 64c840f..6dec268 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -851,7 +851,7 @@ static int __devinit fsl_elbc_nand_probe(struct platform_device *dev, (in_be32(&lbc->bank[bank].br) & BR_MSEL) == BR_MS_FCM && (in_be32(&lbc->bank[bank].br) & in_be32(&lbc->bank[bank].or) & BR_BA) - == res.start) + == fsl_lbc_addr(res.start)) break; if (bank >= MAX_BANKS) { -- 1.5.6.5
WARNING: multiple messages have this Message-ID (diff)
From: Roy Zang <tie-fei.zang@freescale.com> To: linux-mtd@lists.infradead.org Cc: B07421@freescale.com, dedekind1@gmail.com, B25806@freescale.com, linuxppc-dev@ozlabs.org, cbouatmailru@gmail.com, akpm@linux-foundation.org, dwmw2@infradead.org, B11780@freescale.com Subject: [PATCH v2 3/3][MTD] P4080/mtd: Fix the freescale lbc issue with 36bit mode Date: Thu, 9 Sep 2010 18:20:32 +0800 [thread overview] Message-ID: <1284027632-32573-3-git-send-email-tie-fei.zang@freescale.com> (raw) In-Reply-To: <1284027632-32573-2-git-send-email-tie-fei.zang@freescale.com> From: Lan Chunhe-B25806 <b25806@freescale.com> When system uses 36bit physical address, res.start is 36bit physical address. But the function of in_be32 returns 32bit physical address. Then both of them compared each other is wrong. So by converting the address of res.start into the right format fixes this issue. Signed-off-by: Lan Chunhe-B25806 <b25806@freescale.com> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> --- Comparing with v1, according to the feedback, add some decorations. arch/powerpc/include/asm/fsl_lbc.h | 1 + arch/powerpc/sysdev/fsl_lbc.c | 26 +++++++++++++++++++++++++- drivers/mtd/nand/fsl_elbc_nand.c | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h index 9b95eab..bff85c8 100644 --- a/arch/powerpc/include/asm/fsl_lbc.h +++ b/arch/powerpc/include/asm/fsl_lbc.h @@ -249,6 +249,7 @@ struct fsl_upm { int width; }; +extern unsigned int fsl_lbc_addr(phys_addr_t addr_base); extern int fsl_lbc_find(phys_addr_t addr_base); extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm); diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index f4eca8d..3a09e90 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c @@ -31,6 +31,30 @@ struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev; EXPORT_SYMBOL(fsl_lbc_ctrl_dev); /** + * fsl_lbc_addr - convert the base address + * @addr_base: base address of the memory bank + * + * This function converts a base address of lbc into the right format for the BR + * registers. If the SOC has eLBC then it returns 32bit physical address else + * it returns 34bit physical address for local bus(Example: MPC8641). + */ +unsigned int fsl_lbc_addr(phys_addr_t addr_base) +{ + void *dev; + int compatible; + + dev = fsl_lbc_ctrl_dev->dev->of_node; + compatible = of_device_is_compatible(dev, "fsl,elbc"); + + if (compatible) + return addr_base & 0xffff8000; + else + return (addr_base & 0x0ffff8000ull) + | ((addr_base & 0x300000000ull) >> 19); +} +EXPORT_SYMBOL(fsl_lbc_addr); + +/** * fsl_lbc_find - find Localbus bank * @addr_base: base address of the memory bank * @@ -52,7 +76,7 @@ int fsl_lbc_find(phys_addr_t addr_base) __be32 br = in_be32(&lbc->bank[i].br); __be32 or = in_be32(&lbc->bank[i].or); - if (br & BR_V && (br & or & BR_BA) == addr_base) + if (br & BR_V && (br & or & BR_BA) == fsl_lbc_addr(addr_base)) return i; } diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 64c840f..6dec268 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -851,7 +851,7 @@ static int __devinit fsl_elbc_nand_probe(struct platform_device *dev, (in_be32(&lbc->bank[bank].br) & BR_MSEL) == BR_MS_FCM && (in_be32(&lbc->bank[bank].br) & in_be32(&lbc->bank[bank].or) & BR_BA) - == res.start) + == fsl_lbc_addr(res.start)) break; if (bank >= MAX_BANKS) { -- 1.5.6.5
next prev parent reply other threads:[~2010-09-09 10:58 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-09-09 10:20 [PATCH 1/3 v2][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Roy Zang 2010-09-09 10:20 ` Roy Zang 2010-09-09 10:20 ` [PATCH 2/3 v2][MTD] P4080/mtd: Only make elbc nand driver detect nand flash partitions Roy Zang 2010-09-09 10:20 ` Roy Zang 2010-09-09 10:20 ` Roy Zang [this message] 2010-09-09 10:20 ` [PATCH v2 3/3][MTD] P4080/mtd: Fix the freescale lbc issue with 36bit mode Roy Zang 2010-09-09 11:06 ` Geert Uytterhoeven 2010-09-09 11:06 ` Geert Uytterhoeven 2010-09-13 7:22 ` Zang Roy-R61911 2010-09-13 7:22 ` Zang Roy-R61911 2010-09-13 16:27 ` Scott Wood 2010-09-13 16:27 ` Scott Wood 2010-09-14 4:09 ` Zang Roy-R61911 2010-09-14 4:09 ` Zang Roy-R61911 2010-09-14 11:56 ` Timur Tabi 2010-09-14 11:56 ` Timur Tabi 2010-09-09 11:41 ` Anton Vorontsov 2010-09-13 7:30 ` Zang Roy-R61911 2010-09-13 7:30 ` Zang Roy-R61911 2010-09-13 14:10 ` Timur Tabi 2010-09-13 14:10 ` Timur Tabi 2010-09-13 14:27 ` Artem Bityutskiy 2010-09-13 14:27 ` Artem Bityutskiy 2010-09-13 14:35 ` Timur Tabi 2010-09-13 14:35 ` Timur Tabi 2010-09-13 16:45 ` Artem Bityutskiy 2010-09-13 16:45 ` Artem Bityutskiy 2010-09-13 18:36 ` Timur Tabi 2010-09-13 18:36 ` Timur Tabi 2010-09-13 18:46 ` Artem Bityutskiy 2010-09-13 18:46 ` Artem Bityutskiy 2010-09-13 20:04 ` Scott Wood 2010-09-13 20:04 ` Scott Wood 2010-09-14 6:20 ` Zang Roy-R61911 2010-09-14 6:20 ` Zang Roy-R61911 2010-09-09 11:23 ` [PATCH 2/3 v2][MTD] P4080/mtd: Only make elbc nand driver detect nand flash partitions Anton Vorontsov 2010-09-09 11:53 ` [PATCH 1/3 v2][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Anton Vorontsov 2010-09-10 6:58 ` Zang Roy-R61911 2010-09-10 6:58 ` Zang Roy-R61911 2010-09-10 9:31 ` Anton Vorontsov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1284027632-32573-3-git-send-email-tie-fei.zang@freescale.com \ --to=tie-fei.zang@freescale.com \ --cc=B07421@freescale.com \ --cc=B11780@freescale.com \ --cc=B25806@freescale.com \ --cc=akpm@linux-foundation.org \ --cc=dedekind1@gmail.com \ --cc=dwmw2@infradead.org \ --cc=linux-mtd@lists.infradead.org \ --cc=linuxppc-dev@ozlabs.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.