Re: [PATCH 0/1] Fix OMAP2 NAND ONFI device detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 06, 2013 at 10:00:09PM +0000, Gupta, Pekon wrote:
> > From: Ezequiel Garcia
> [...]
> 
> > But: on the other hand, I'd really like you to convince me as to
> > why is it so bad to require the DTB to have the proper GPMC bus width.
> > 
> No its not at all bad, all I want is either of the one way (not mixture of both).
> - Either depend on DT completely (which is current case for all drivers)
> - OR depend on ONFI and nand_flash_id[] for bus-width detection.
> 
> 
> > Once again:
> > 1. the NAND devices aren't hot-pluggable
> > 2. the "user" (who is actually an engineer, not some regular dummy user)
> > knows perfectly well the width of the device.
> > 
> > What's the problem with describing the hardware in the DT and saving us
> > lots of runtime re-configuration trouble?
> 
> I agree with both your arguments above.
> So shouldn't we kill NAND_BUSWIDTH_AUTO ?
> And probably therefore  NAND_BUSWIDTH_AUTO isn't that popular.
> 
> Now what remains is ONFI probe, which should always happen in x8 mode.
> So for that below patch should be sufficient ..
> 

Hm.. that might work. Maybe you should submit this as RFC/PATCH to catch
the attention of some more people. And we can keep discussing on this
new idea...

I should get an 8-bit module for the BBB, so this means I'll be able
to run 8-bit and 16-bit tests.

> ----------------------
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index ec1db1e..d1220fb 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2942,14 +2942,8 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
>                 chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I')
>                 return 0;
> 
> -       /*
> -        * ONFI must be probed in 8-bit mode or with NAND_BUSWIDTH_AUTO, not
> -        * with NAND_BUSWIDTH_16
> -        */
> -       if (chip->options & NAND_BUSWIDTH_16) {
> -               pr_err("ONFI cannot be probed in 16-bit mode; aborting\n");
> -               return 0;
> -       }
> +       /* ONFI must be probed in 8-bit mode only */
> +       nand_set_defaults(chip, 0);
> 
>         chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
>         for (i = 0; i < 3; i++) {
> @@ -2962,7 +2956,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
> 
>         if (i == 3) {
>                 pr_err("Could not find valid ONFI parameter page; aborting\n");
> -               return 0;
> +               goto return_error;
>         }
> 
>         /* Check version */
> @@ -2980,7 +2974,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
> 
>         if (!chip->onfi_version) {
>                 pr_info("%s: unsupported ONFI version: %d\n", __func__, val);
> -               return 0;
> +               goto return_error;
>         }
> 
>         sanitize_string(p->manufacturer, sizeof(p->manufacturer));
> @@ -3033,6 +3027,12 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
>         }
> 
>         return 1;
> +
> +return_error:
> +       /* revert original bus-width */
> +       nand_set_defaults( chip->options & NAND_BUSWIDTH_16);
> +       return 0;
> +
>  }
> 
>  /*
> ------------------------- 
> 
> 
> with regards, pekon

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux