NAND FSL elbc: Use virt_to_phys to determine which bank is in use
Subsystems (2)
PATCH 3/3 NAND FSL elbc: Use virt_to_phys to determine which bank is in use
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.
--- 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
drivers/mtd/nand/fsl_elbc_nand.c +4 -2
@@ -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 ; }
Signature · 1 line
1.5.6.5
PATCH 3/3 NAND FSL elbc: Use virt_to_phys to determine which bank is in use
drivers/mtd/nand/fsl_elbc_nand.c static void fsl_elbc_ctrl_init(void) · line 721
Quoted 10 lines · Kumar Gala
drivers/mtd/nand/fsl_elbc_nand.c +1
-1@@ -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.
drivers/mtd/nand/fsl_elbc_nand.c int board_nand_init(struct nand_chip *nand) · line 746
Quoted 12 lines
drivers/mtd/nand/fsl_elbc_nand.c +3
-1@@ -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
PATCH 3/3 NAND FSL elbc: Use virt_to_phys to determine which bank is in use
Quoted 15 lines · Scott Wood
drivers/mtd/nand/fsl_elbc_nand.c static void fsl_elbc_ctrl_init(void) · line 721
Quoted 11 lines · Kumar Gala
drivers/mtd/nand/ renamed from drivers/mtd/nand/fsl_elbc_nand.c +0
-0
fsl_elbc_nand.c
index 367c7d7..3f318e0 100644drivers/mtd/nand/fsl_elbc_nand.c +1
-1@@ -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