From: ezequiel@vanguardiasur.com.ar (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 05/12] mtd: pxa3xx_nand: rework flash detection and timing setup
Date: Wed, 20 May 2015 11:05:13 -0300 [thread overview]
Message-ID: <555C9499.10606@vanguardiasur.com.ar> (raw)
In-Reply-To: <20150520140348.GL22054@kwain>
On 05/20/2015 11:03 AM, Antoine Tenart wrote:
> Ezequiel,
>
> On Sat, May 16, 2015 at 07:02:45PM -0300, Ezequiel Garcia wrote:
>> On 05/11/2015 11:58 AM, Antoine Tenart wrote:
>
>>> -
>>> ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0;
>>> ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0;
>>> - ndcr |= (f->page_per_block == 64) ? NDCR_PG_PER_BLK : 0;
>>> - ndcr |= (f->page_size == 2048) ? NDCR_PAGE_SZ : 0;
>>> - ndcr |= (f->flash_width == 16) ? NDCR_DWIDTH_M : 0;
>>> - ndcr |= (f->dfc_width == 16) ? NDCR_DWIDTH_C : 0;
>>> + ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0;
>>> + ndcr |= (mtd->writesize == 2048) ? NDCR_PAGE_SZ : 0;
>>
>> By the time you call this, there's no detected flash, so there's
>> no geometry information such as mtd->writesize, chip->page_shift, etc.
>
> I'll move this to pxa3xx_nand_init_timings().
>
Well, please don't call it init_timings() if you are doing more than
timings setup.
>>> @@ -1577,64 +1558,20 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
>>> return ret;
>>> }
>>>
>>> - chip->cmdfunc(mtd, NAND_CMD_READID, 0, 0);
>>> - id = *((uint16_t *)(info->data_buff));
>>> - if (id != 0)
>>> - dev_info(&info->pdev->dev, "Detect a flash id %x\n", id);
>>> - else {
>>> - dev_warn(&info->pdev->dev,
>>> - "Read out ID 0, potential timing set wrong!!\n");
>>> -
>>> - return -EINVAL;
>>> - }
>>> -
>>> - num = ARRAY_SIZE(builtin_flash_types) + pdata->num_flash - 1;
>>> - for (i = 0; i < num; i++) {
>>> - if (i < pdata->num_flash)
>>> - f = pdata->flash + i;
>>> - else
>>> - f = &builtin_flash_types[i - pdata->num_flash + 1];
>>> -
>>> - /* find the chip in default list */
>>> - if (f->chip_id == id)
>>> - break;
>>> - }
>>> -
>>> - if (i >= (ARRAY_SIZE(builtin_flash_types) + pdata->num_flash - 1)) {
>>> - dev_err(&info->pdev->dev, "ERROR!! flash not defined!!!\n");
>>> -
>>> - return -EINVAL;
>>> - }
>>> -
>>> - ret = pxa3xx_nand_config_flash(info, f);
>>
>> This second call to pxa3xx_nand_config_flash was in charge of re-configuring
>> the device after proper identification.
>>
>> I'd say a proper approach is to configure default parameters,
>> call nand_scan_ident, and finally re-configure using the detected values.
>
> That's what is done already, default parameters are setup in
> pxa3xx_nand_sensing(), using onfi_async_timing_mode_to_sdr_timings(0).
> Then once the device is recognized, the proper timings are used by
> calling pxa3xx_nand_init_timings().
>
> Did I miss something here?
>
I'm not talking about the timings but about ndcr configuration. You can
only do that once the device is detected, not before.
The timing stuff look OK.
--
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
next prev parent reply other threads:[~2015-05-20 14:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 14:58 [PATCH v5 00/12] ARM: berlin: add nand support Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 01/12] mtd: pxa3xx_nand: add a non mandatory ECC clock Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 02/12] Documentation: bindings: document the clocks for pxa3xx-nand Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 03/12] mtd: pxa3xx_nand: add a default chunk size Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 04/12] mtd: pxa3xx_nand: add helpers to setup the timings Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 05/12] mtd: pxa3xx_nand: rework flash detection and timing setup Antoine Tenart
2015-05-11 22:10 ` Ezequiel Garcia
2015-05-12 14:39 ` Antoine Tenart
2015-05-16 21:23 ` Ezequiel Garcia
2015-05-20 13:55 ` Antoine Tenart
2015-05-20 13:56 ` Ezequiel Garcia
2015-05-20 14:04 ` Antoine Tenart
2015-05-16 22:02 ` Ezequiel Garcia
2015-05-20 14:03 ` Antoine Tenart
2015-05-20 14:05 ` Ezequiel Garcia [this message]
2015-05-11 14:58 ` [PATCH v5 06/12] mtd: pxa3xx_nand: clean up the pxa3xx timings Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 07/12] mtd: nand: add Samsung K9GBG08U0A-M to nand_ids table Antoine Tenart
2015-05-16 18:57 ` Ezequiel Garcia
2015-05-20 14:06 ` Antoine Tenart
2015-05-20 14:09 ` Ezequiel Garcia
2015-05-20 14:24 ` Antoine Tenart
2015-05-20 14:43 ` Antoine Tenart
2015-05-24 18:42 ` Ezequiel Garcia
2015-07-20 18:08 ` Brian Norris
2015-07-20 18:22 ` Ezequiel Garcia
2015-05-11 14:58 ` [PATCH v5 08/12] mtd: pxa3xx_nand: add support for the Marvell Berlin nand controller Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 09/12] Documentation: bindings: add the Berlin nand controller compatible Antoine Tenart
2015-05-11 14:58 ` [PATCH v5 10/12] mtd: nand: let Marvell Berlin SoCs select the pxa3xx driver Antoine Tenart
2015-05-11 14:59 ` [PATCH v5 11/12] ARM: berlin: add BG2Q node for the nand Antoine Tenart
2015-05-11 14:59 ` [PATCH v5 12/12] ARM: berlin: enable flash on the BG2Q DMP Antoine Tenart
2015-05-16 21:37 ` [PATCH v5 00/12] ARM: berlin: add nand support Ezequiel Garcia
2015-05-20 14:08 ` Antoine Tenart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555C9499.10606@vanguardiasur.com.ar \
--to=ezequiel@vanguardiasur.com.ar \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).