From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Roy Zang <tie-fei.zang@freescale.com>
Cc: B25806@freescale.com, linuxppc-dev@ozlabs.org,
akpm@linux-foundation.org, linux-mtd@lists.infradead.org,
B11780@freescale.com
Subject: Re: [PATCH 3/3][MTD] P4080/nand: Fix the freescale lbc issue with 36bit mode
Date: Fri, 3 Sep 2010 15:36:04 +0400 [thread overview]
Message-ID: <20100903113604.GB11847@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1281063096-26598-3-git-send-email-tie-fei.zang@freescale.com>
On Fri, Aug 06, 2010 at 10:51:36AM +0800, Roy Zang wrote:
[...]
> /**
> + * convert_lbc_address - 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 convert_lbc_address(phys_addr_t addr_base)
> +{
> + void *dev;
> + int compatible;
> +
> + dev = of_find_node_by_name(NULL, "localbus");
Nope, you shouldn't do this. Never search by name.
Also, aren't there already a global dev, which was found by the
_probe() stuff?
> + if (!dev) {
> + printk(KERN_INFO "fsl-lbc: can't find localbus node\n");
> + of_node_put(dev);
> + return 0;
> + }
> +
> + compatible = of_device_is_compatible(dev, "fsl,elbc");
> + of_node_put(dev);
> + if (compatible)
> + return addr_base & 0xffff8000;
> + else
> + return (addr_base & 0x0ffff8000ull) \
> + | ((addr_base & 0x300000000ull) >> 19);
> +}
> +EXPORT_SYMBOL(convert_lbc_address);
> +
> +/**
> * fsl_lbc_find - find Localbus bank
> * @addr_base: base address of the memory bank
> *
> @@ -50,7 +80,8 @@ int fsl_lbc_find(phys_addr_t addr_base)
> __be32 br = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].br);
> __be32 or = in_be32(&fsl_lbc_ctrl_dev->regs->bank[i].or);
>
> - if (br & BR_V && (br & or & BR_BA) == addr_base)
> + if (br & BR_V && (br & or & BR_BA) \
No need for "\" at the end of the line, keep == on the same line.
> + == convert_lbc_address(addr_base))
Would be prettier if you name it fsl_lbc_addr(). Keeps prefix
the same for the rest of the file, plus makes it shorter (so
there probably won't be any need for breaking the line).
> return i;
> }
>
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
> index 7bbcb3f..0e8dc40 100644
> --- a/drivers/mtd/nand/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
> @@ -838,7 +838,7 @@ static int __devinit fsl_elbc_nand_probe(struct of_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)
> + == convert_lbc_address(res.start))
> break;
>
> if (bank >= MAX_BANKS) {
> --
> 1.5.6.5
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2010-09-03 11:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 2:51 [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Roy Zang
2010-08-06 2:51 ` [PATCH 2/3][MTD] P4080/nand: Only make elbc nand driver detect nand flash partitions Roy Zang
2010-08-06 2:51 ` [PATCH 3/3][MTD] P4080/nand: Fix the freescale lbc issue with 36bit mode Roy Zang
2010-09-03 11:36 ` Anton Vorontsov [this message]
2010-09-06 3:56 ` Zang Roy-R61911
2010-09-03 11:43 ` [PATCH 2/3][MTD] P4080/nand: Only make elbc nand driver detect nand flash partitions Anton Vorontsov
2010-09-03 17:33 ` Scott Wood
2010-09-06 3:40 ` Zang Roy-R61911
2010-09-06 4:49 ` Zang Roy-R61911
2010-09-06 8:09 ` Anton Vorontsov
2010-09-06 8:38 ` Zang Roy-R61911
2010-08-09 7:33 ` [PATCH 1/3][MTD] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Zang Roy-R61911
2010-08-29 11:06 ` Artem Bityutskiy
2010-08-11 2:45 ` Zang Roy-R61911
2010-09-03 10:33 ` Zang Roy-R61911
2010-09-03 11:27 ` Anton Vorontsov
2010-09-06 3:38 ` Zang Roy-R61911
2010-09-06 8:21 ` Anton Vorontsov
2010-09-06 9:24 ` Zang Roy-R61911
2010-09-06 9:44 ` Anton Vorontsov
2010-09-06 10:15 ` Zang Roy-R61911
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=20100903113604.GB11847@oksana.dev.rtsoft.ru \
--to=cbouatmailru@gmail.com \
--cc=B11780@freescale.com \
--cc=B25806@freescale.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=tie-fei.zang@freescale.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).