[PATCH] [OneNAND] OTP support re-implementation 1/1

Kyungmin Park kmpark at infradead.org
Mon Aug 31 05:34:54 EDT 2009


Hi,

@@ -2717,16 +2927,21 @@ static int onenand_otp_walk(struct mtd_info
*mtd, loff_t from, size_t len,
       if (density < ONENAND_DEVICE_DENSITY_512Mb)
               otp_pages = 20;
       else
-               otp_pages = 10;
+               otp_pages = 50;

Is it always 50 pages? Is it right? why I think it's 10. please check
the previous OneNAND spec.
At least the latest OneNAND spec say it's 50. flex or not.

> +       /*
> +        * Note: OTP lock operation
> +        *       OTP block : 0xXXFC                     XX 1111 1100
> +        *       1st block : 0xXXF3 (If chip support)   XX 1111 0011
> +        *       Both      : 0xXXF0 (If chip support)   XX 1111 0000
> +        */
> +       if (FLEXONENAND(this)) {
> +
> +#ifdef CONFIG_ONENAND_OTP_AREA
> +               buf[FLEXONENAND_OTP_LOCK_OFFSET] = 0xFC;
> +#elif defined(CONFIG_ONENAND_OTP_BLOCK0)
> +               buf[FLEXONENAND_OTP_LOCK_OFFSET] = 0xF3;
> +#elif defined(CONFIG_ONENAND_OTP_AREA_BLOCK0)
> +               buf[FLEXONENAND_OTP_LOCK_OFFSET] = 0xF0;
> +#endif /* ONENAND_OTP_AREA | ONENAND_OTP_BLOCK0 | ONENAND_OTP_AREA_BLOCK0 */
> +       } else {
> +
> +#ifdef CONFIG_ONENAND_OTP_AREA
> +               buf[ONENAND_OTP_LOCK_OFFSET] = 0xFC;
> +#elif defined(CONFIG_ONENAND_OTP_BLOCK0)
> +               buf[ONENAND_OTP_LOCK_OFFSET] = 0xF3;
> +#elif defined(CONFIG_ONENAND_OTP_AREA_BLOCK0)
> +               buf[ONENAND_OTP_LOCK_OFFSET] = 0xF0;
> +#endif /* ONENAND_OTP_AREA | ONENAND_OTP_BLOCK0 | ONENAND_OTP_AREA_BLOCK0 */
> +       }
> +

it's too much #ifdef, #endif. Introuduce the opt_lock_offset and set
the proper offset based on flex or not.

And the set the buf[otp_lock_offset] = proper value.

Thank you,
Kyungmin Park



More information about the linux-mtd mailing list