[PATCH 12/12] mtd: nand: provision full ID support

Huang Shijie shijie8 at gmail.com
Tue Mar 5 01:08:41 EST 2013


On Tue, Mar 5, 2013 at 12:42 AM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
>
> Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
> ---
>  include/linux/mtd/nand.h |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 7af6600..951ea0d 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -559,7 +559,9 @@ struct nand_chip {
>  /**
>   * struct nand_flash_dev - NAND Flash Device ID Structure
>   * @name:      Identify the device type
> - * @dev_id:    device ID code
> + * @mfr_id:     manufecturer ID part of the full chip ID array (byte 0)
> + * @dev_id:     device ID part of the full chip ID array (byte 1)
> + * @id:         full device ID array
>   * @pagesize:  Pagesize in bytes. Either 256 or 512 or 0
>   *             If the pagesize is 0, then the real pagesize
>   *             and the eraseize are determined from the
> @@ -570,7 +572,13 @@ struct nand_chip {
>   */
>  struct nand_flash_dev {
>         char *name;
> -       int dev_id;
> +       union {
> +               struct {
> +                       uint8_t mfr_id;
> +                       uint8_t dev_id;
> +               };
> +               uint8_t id[8];
> +       };
>
We can add a new helper like compare_nand_with_devid() to remove the
mfr_id and dev_id, only left the id[8].

The compare_nand_with_devid() can be used in places where your patch
11 does. For example:
   ..............................................................
        if (id == nand_flash_ids[i].dev_id) {

   changed to:

        if (compare_nand_with_devid(id)){

  ...............................................................

By this way, we can remove the mfr_id and dev_id.


thanks
Huang Shijie



More information about the linux-mtd mailing list