[PATCH v2 3/3][MTD] P4080/mtd: Fix the freescale lbc issue with 36bit mode

Geert Uytterhoeven geert at linux-m68k.org
Thu Sep 9 21:06:00 EST 2010


On Thu, Sep 9, 2010 at 12:20, Roy Zang <tie-fei.zang at freescale.com> wrote:
> From: Lan Chunhe-B25806 <b25806 at 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.

>  /**
> + * 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)
    ^^^^^^^^^^^^
Shouldn't this be u32 or __be32, for consistency with the actual
comparisons below?

> @@ -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;

> @@ -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;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the Linuxppc-dev mailing list