* [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use
@ 2008-11-24 16:25 Kumar Gala
2008-11-24 16:34 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2008-11-24 16:25 UTC (permalink / raw)
To: u-boot
The current code that determines which bank/chipselect is used for a
given NAND instance only worked for 32-bit addresses and assumed
a 1:1 mapping. This breaks in 36-bit physical configs.
The proper way to handle this is to use the virt_to_phys() and
BR_PHYS_ADDR() routinues to match the 34-bit lbc bus address
with the the virtual address the NAND code uses.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
drivers/mtd/nand/fsl_elbc_nand.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
This patch puts the plumbing in place to work properly for 36-bit phys
support in the future. This requires a proper version of virt_to_phys().
- k
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 367c7d7..3f318e0 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -718,7 +718,7 @@ static void fsl_elbc_ctrl_init(void)
int board_nand_init(struct nand_chip *nand)
{
struct fsl_elbc_mtd *priv;
- uint32_t br, or;
+ uint32_t br = 0, or = 0;
if (!elbc_ctrl) {
fsl_elbc_ctrl_init();
@@ -737,11 +737,13 @@ int board_nand_init(struct nand_chip *nand)
* if we could pass more than one datum to the NAND driver...
*/
for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
+ phys_addr_t base_addr = virt_to_phys(nand->IO_ADDR_R);
+
br = in_be32(&elbc_ctrl->regs->bank[priv->bank].br);
or = in_be32(&elbc_ctrl->regs->bank[priv->bank].or);
if ((br & BR_V) && (br & BR_MSEL) == BR_MS_FCM &&
- (br & or & BR_BA) == (phys_addr_t)nand->IO_ADDR_R)
+ (br & or & BR_BA) == BR_PHYS_ADDR(base_addr))
break;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use
2008-11-24 16:25 [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use Kumar Gala
@ 2008-11-24 16:34 ` Scott Wood
2008-11-24 16:36 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2008-11-24 16:34 UTC (permalink / raw)
To: u-boot
Kumar Gala wrote:
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
> index 367c7d7..3f318e0 100644
> --- a/drivers/mtd/nand/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
> @@ -718,7 +718,7 @@ static void fsl_elbc_ctrl_init(void)
> int board_nand_init(struct nand_chip *nand)
> {
> struct fsl_elbc_mtd *priv;
> - uint32_t br, or;
> + uint32_t br = 0, or = 0;
Which GCC version complains about this? Seems like it's getting worse
about false positives.
> @@ -737,11 +737,13 @@ int board_nand_init(struct nand_chip *nand)
> * if we could pass more than one datum to the NAND driver...
> */
> for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
> + phys_addr_t base_addr = virt_to_phys(nand->IO_ADDR_R);
> +
> br = in_be32(&elbc_ctrl->regs->bank[priv->bank].br);
> or = in_be32(&elbc_ctrl->regs->bank[priv->bank].or);
>
> if ((br & BR_V) && (br & BR_MSEL) == BR_MS_FCM &&
> - (br & or & BR_BA) == (phys_addr_t)nand->IO_ADDR_R)
> + (br & or & BR_BA) == BR_PHYS_ADDR(base_addr))
ACK to go via whichever tree the BR_PHYS_ADDR patch goes through.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use
2008-11-24 16:34 ` Scott Wood
@ 2008-11-24 16:36 ` Kumar Gala
0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-11-24 16:36 UTC (permalink / raw)
To: u-boot
On Nov 24, 2008, at 10:34 AM, Scott Wood wrote:
> Kumar Gala wrote:
>> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/
>> fsl_elbc_nand.c
>> index 367c7d7..3f318e0 100644
>> --- a/drivers/mtd/nand/fsl_elbc_nand.c
>> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
>> @@ -718,7 +718,7 @@ static void fsl_elbc_ctrl_init(void)
>> int board_nand_init(struct nand_chip *nand)
>> {
>> struct fsl_elbc_mtd *priv;
>> - uint32_t br, or;
>> + uint32_t br = 0, or = 0;
>
> Which GCC version complains about this? Seems like it's getting
> worse about false positives.
Yeah, I was annoyed by this. gcc-4.3
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use
2008-12-16 20:59 ` [U-Boot] [PATCH 2/3] ppc: Use addrmap in virt_to_phys and map_physmem Kumar Gala
@ 2008-12-16 20:59 ` Kumar Gala
0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-12-16 20:59 UTC (permalink / raw)
To: u-boot
The current code that determines which bank/chipselect is used for a
given NAND instance only worked for 32-bit addresses and assumed
a 1:1 mapping. This breaks in 36-bit physical configs.
The proper way to handle this is to use the virt_to_phys() and
BR_PHYS_ADDR() routinues to match the 34-bit lbc bus address
with the the virtual address the NAND code uses.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Scott Wood <scottwood@freescale.com>
---
drivers/mtd/nand/fsl_elbc_nand.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 367c7d7..3f318e0 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -718,7 +718,7 @@ static void fsl_elbc_ctrl_init(void)
int board_nand_init(struct nand_chip *nand)
{
struct fsl_elbc_mtd *priv;
- uint32_t br, or;
+ uint32_t br = 0, or = 0;
if (!elbc_ctrl) {
fsl_elbc_ctrl_init();
@@ -737,11 +737,13 @@ int board_nand_init(struct nand_chip *nand)
* if we could pass more than one datum to the NAND driver...
*/
for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
+ phys_addr_t base_addr = virt_to_phys(nand->IO_ADDR_R);
+
br = in_be32(&elbc_ctrl->regs->bank[priv->bank].br);
or = in_be32(&elbc_ctrl->regs->bank[priv->bank].or);
if ((br & BR_V) && (br & BR_MSEL) == BR_MS_FCM &&
- (br & or & BR_BA) == (phys_addr_t)nand->IO_ADDR_R)
+ (br & or & BR_BA) == BR_PHYS_ADDR(base_addr))
break;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-16 20:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 16:25 [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use Kumar Gala
2008-11-24 16:34 ` Scott Wood
2008-11-24 16:36 ` Kumar Gala
-- strict thread matches above, loose matches on Subject: below --
2008-12-16 20:59 [U-Boot] [PATCH 1/3] 85xx: Add support to populate addr map based on TLB settings Kumar Gala
2008-12-16 20:59 ` [U-Boot] [PATCH 2/3] ppc: Use addrmap in virt_to_phys and map_physmem Kumar Gala
2008-12-16 20:59 ` [U-Boot] [PATCH 3/3] NAND FSL elbc: Use virt_to_phys to determine which bank is in use Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox