From: "ivan.khoronzhuk" <ivan.khoronzhuk@ti.com>
To: Sekhar Nori <nsekhar@ti.com>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
grygorii.strashko@ti.com, linux@arm.linux.org.uk,
pawel.moll@arm.com, swarren@wwwdotorg.org,
ijc+devicetree@hellion.org.uk, galak@kernel.crashing.org,
rob.herring@calxeda.com, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org, rob@landley.net,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif
Date: Wed, 27 Nov 2013 13:01:22 +0200 [thread overview]
Message-ID: <5295D102.2010101@ti.com> (raw)
In-Reply-To: <5295AECB.7040503@ti.com>
On 11/27/2013 10:35 AM, Sekhar Nori wrote:
> + MTD maintainers
>
> On Tuesday 26 November 2013 01:30 AM, Ivan Khoronzhuk wrote:
>> The problem that the set timings code contains the call of Davinci
>> platform function davinci_aemif_setup_timing() which is not
>> accessible if kernel is built for another platform like Keystone.
>>
>> The Keysone platform is going to use TI AEMIF driver.
>> If TI AEMIF is used we don't need to set timings and bus width.
>> It is done by AEMIF driver.
>>
>> To get rid of davinci-nand driver dependency on aemif platform code
>> we moved aemif code to davinci platform.
>>
>> The platform AEMIF code (aemif.c) has to be removed once Davinci
>> will be converted to DT and use ti-aemif.c driver.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>> ---
>> arch/arm/mach-davinci/aemif.c | 73 ++++++++++++++++++++++-
>> arch/arm/mach-davinci/board-da830-evm.c | 3 +
>> arch/arm/mach-davinci/board-da850-evm.c | 3 +
>> arch/arm/mach-davinci/board-dm355-evm.c | 5 ++
>> arch/arm/mach-davinci/board-dm355-leopard.c | 5 ++
>> arch/arm/mach-davinci/board-dm365-evm.c | 4 ++
>> arch/arm/mach-davinci/board-dm644x-evm.c | 5 ++
>> arch/arm/mach-davinci/board-dm646x-evm.c | 3 +
>> arch/arm/mach-davinci/board-mityomapl138.c | 3 +
>> arch/arm/mach-davinci/board-neuros-osd2.c | 9 ++-
>> arch/arm/mach-davinci/devices-tnetv107x.c | 3 +
>> drivers/mtd/nand/davinci_nand.c | 23 -------
>> include/linux/platform_data/mtd-davinci-aemif.h | 5 +-
>> 13 files changed, 116 insertions(+), 28 deletions(-)
>
> [...]
>
>> +
>> +/**
>> + * davinci_aemif_setup - setup AEMIF interface by davinci_nand_pdata
>> + * @pdev - link to platform device to setup settings for
>> + *
>> + * This function does not use any locking while programming the AEMIF
>> + * because it is expected that there is only one user of a given
>> + * chip-select.
>> + *
>> + * Returns 0 on success, else negative errno.
>> + */
>> +int davinci_aemif_setup(struct platform_device *pdev)
>> +{
>> + struct davinci_nand_pdata *pdata = dev_get_platdata(&pdev->dev);
>> + uint32_t val;
>> + struct resource *res;
>> + void __iomem *base;
>> + int ret = 0;
>> +
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>> + if (!res) {
>> + dev_err(&pdev->dev, "cannot get IORESOURCE_MEM\n");
>> + return -ENOMEM;
>> + }
>> +
>> + base = ioremap(res->start, resource_size(res));
>> + if (!base) {
>> + dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res);
>> + ret = -ENOMEM;
>> + goto err;
>> + }
>> +
>> + /*
>> + * Setup Async configuration register in case we did not boot
>> + * from NAND and so bootloader did not bother to set it up.
>> + */
>> + val = davinci_aemif_readl(base, A1CR_OFFSET + pdev->id * 4);
>
> The AEMIF clock has to be enabled before this. The NAND driver might
> load much later.
>
Ok
>> + /*
>> + * Extended Wait is not valid and Select Strobe mode is not
>> + * used
>> + */
>> + val &= ~(ACR_ASIZE_MASK | ACR_EW_MASK | ACR_SS_MASK);
>> + if (pdata->options & NAND_BUSWIDTH_16)
>> + val |= 0x1;
>> +
>> + davinci_aemif_writel(base, A1CR_OFFSET + pdev->id * 4, val);
>> +
>> + if (pdata->timing)
>> + ret = davinci_aemif_setup_timing(pdata->timing, base, pdev->id);
>> +
>> + if (ret < 0)
>> + dev_dbg(&pdev->dev, "NAND timing values setup fail\n");
>> +
>> +err:
>> + iounmap(base);
>> + return ret;
>> +}
>> +EXPORT_SYMBOL(davinci_aemif_setup);
>
> No need to export this symbol as nothing apart from platform code uses it.
>
Ok
>> static const short mityomap_mii_pins[] = {
>> diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
>> index bb680af..a7d6668 100644
>> --- a/arch/arm/mach-davinci/board-neuros-osd2.c
>> +++ b/arch/arm/mach-davinci/board-neuros-osd2.c
>> @@ -31,6 +31,7 @@
>> #include <linux/platform_data/mmc-davinci.h>
>> #include <linux/platform_data/mtd-davinci.h>
>> #include <linux/platform_data/usb-davinci.h>
>> +#include <linux/platform_data/mtd-davinci-aemif.h>
>>
>> #include <asm/mach-types.h>
>> #include <asm/mach/arch.h>
>> @@ -192,9 +193,15 @@ static __init void davinci_ntosd2_init(void)
>> davinci_cfg_reg(DM644X_ATAEN_DISABLE);
>>
>> /* only one device will be jumpered and detected */
>> - if (HAS_NAND)
>> + if (HAS_NAND) {
>> platform_device_register(
>> &davinci_ntosd2_nandflash_device);
>> +
>> + if (davinci_aemif_setup(
>> + &davinci_ntosd2_nandflash_device))
>> + pr_warn("%s: Cannot configure AEMIF.\n",
>> + __func__);
>
> This is looking really ugly. Can you shorten
> davinci_ntosd2_nandflash_device to just "ntosd2_nandflash" or similar?
The rename is not related to the patch, so I won't do this.
>
> I am yet to test this. Will test once the next version is posted.
>
> Overall, I cannot say I am fan of this approach (mostly because we are
> ending up having two drivers for the same hardware in kernel). But given
> that the other option of adding platform device support to AEMIF driver
> is not acceptable to you, I guess I will live with this.
>
> Thanks,
> Sekhar
>
--
Regards,
Ivan Khoronzhuk
next prev parent reply other threads:[~2013-11-27 11:01 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1384187188-5776-1-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 16:47 ` [PATCH 00/12] Introduce davinci AEMIF driver Khoronzhuk, Ivan
[not found] ` <1384187188-5776-2-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 16:52 ` [PATCH 01/12] mtd: nand: davinci: fix driver registration Khoronzhuk, Ivan
2013-11-12 15:45 ` Santosh Shilimkar
[not found] ` <1384187188-5776-3-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 16:53 ` [PATCH 02/12] mtd: nand: davinci: check required ti,davinci-chipselect property Khoronzhuk, Ivan
2013-11-12 15:50 ` [PATCH 02/12] mtd: nand: davinci: check required ti, davinci-chipselect property Santosh Shilimkar
2013-11-18 18:25 ` ivan.khoronzhuk
[not found] ` <1384187188-5776-4-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 16:54 ` [PATCH 03/12] mtd: nand: davinci: simplify error handling Khoronzhuk, Ivan
[not found] ` <4F5844B3A985794BA902E12C070812375F8CFB-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-11-12 15:52 ` Santosh Shilimkar
[not found] ` <1384187188-5776-5-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 16:55 ` [PATCH 04/12] mtd: nand: davinci: move bindings under mtd Khoronzhuk, Ivan
[not found] ` <4F5844B3A985794BA902E12C070812375F8D08-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-11-12 15:53 ` Santosh Shilimkar
[not found] ` <1384187188-5776-6-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-6-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 16:58 ` [PATCH 05/12] mtd: nand: davinci: extend description of bindings Khoronzhuk, Ivan
[not found] ` <4F5844B3A985794BA902E12C070812375F8D14-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-11-12 15:55 ` Santosh Shilimkar
[not found] ` <1384187188-5776-7-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 17:01 ` [PATCH 06/12] mtd: nand: davinci: adjust DT properties to MTD generic Khoronzhuk, Ivan
2013-11-26 7:03 ` Sekhar Nori
2013-11-26 10:30 ` Grygorii Strashko
[not found] ` <52947832.3080309-l0cyMroinI0@public.gmane.org>
2013-11-26 10:49 ` ivan.khoronzhuk
[not found] ` <1384187188-5776-8-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-8-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 17:06 ` [PATCH 07/12] memory: davinci-aemif: introduce AEMIF driver Khoronzhuk, Ivan
[not found] ` <4F5844B3A985794BA902E12C070812375F8D2E-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-11-12 16:08 ` Santosh Shilimkar
2013-11-18 19:15 ` ivan.khoronzhuk
2013-11-26 7:20 ` Sekhar Nori
2013-11-26 15:05 ` Santosh Shilimkar
2013-11-26 17:21 ` Sekhar Nori
[not found] ` <5294D8AD.5030106-l0cyMroinI0@public.gmane.org>
2013-11-26 18:26 ` Santosh Shilimkar
2013-11-26 18:29 ` ivan.khoronzhuk
[not found] ` <5294E7E4.3060600-l0cyMroinI0@public.gmane.org>
2013-11-27 0:37 ` Brian Norris
2013-11-27 10:22 ` ivan.khoronzhuk
2013-11-26 17:44 ` ivan.khoronzhuk
2013-11-26 18:30 ` Santosh Shilimkar
[not found] ` <5294E8B6.5000102-l0cyMroinI0@public.gmane.org>
2013-11-26 18:30 ` ivan.khoronzhuk
2013-11-27 4:05 ` Sekhar Nori
[not found] ` <1384187188-5776-9-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-9-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 17:09 ` [PATCH 08/12] memory: davinci-aemif: add bindings for " Khoronzhuk, Ivan
[not found] ` <1384187188-5776-10-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-10-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 17:09 ` [PATCH 09/12] mtd: nand: davinci: reuse driver for Keystone arch Khoronzhuk, Ivan
2013-11-12 16:09 ` Santosh Shilimkar
[not found] ` <1384187188-5776-11-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-11-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 17:10 ` [PATCH 10/12] mtd: nand: davinci: don't set timings if AEMIF is used Khoronzhuk, Ivan
[not found] ` <4F5844B3A985794BA902E12C070812375F8D53-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-11-12 16:13 ` Santosh Shilimkar
[not found] ` <528253B7.2060408-l0cyMroinI0@public.gmane.org>
2013-11-18 11:35 ` Grygorii Strashko
2013-11-18 14:08 ` Santosh Shilimkar
2013-11-18 19:32 ` ivan.khoronzhuk
2013-11-13 5:02 ` Sekhar Nori
2013-11-13 14:14 ` Santosh Shilimkar
[not found] ` <52838941.4060207-l0cyMroinI0@public.gmane.org>
2013-11-14 10:53 ` Sekhar Nori
[not found] ` <5284ABB9.70608-l0cyMroinI0@public.gmane.org>
2013-11-14 14:36 ` Santosh Shilimkar
2013-11-18 19:35 ` ivan.khoronzhuk
2013-11-21 17:07 ` Sekhar Nori
[not found] ` <528E3DD4.7030607-l0cyMroinI0@public.gmane.org>
2013-11-22 17:38 ` Santosh Shilimkar
2013-11-24 9:46 ` Sekhar Nori
2013-11-25 20:00 ` [PATCH] ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif Ivan Khoronzhuk
2013-11-27 8:35 ` Sekhar Nori
2013-11-27 11:01 ` ivan.khoronzhuk [this message]
2013-11-27 13:07 ` Sekhar Nori
2013-11-27 13:21 ` ivan.khoronzhuk
2013-11-26 0:55 ` [PATCH 10/12] mtd: nand: davinci: don't set timings if AEMIF is used Santosh Shilimkar
[not found] ` <1384187188-5776-12-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-11 17:12 ` [PATCH 11/12] mtd: nand: davinci: don't request AEMIF address range Khoronzhuk, Ivan
2013-11-12 16:15 ` Santosh Shilimkar
[not found] ` <1384187188-5776-13-git-send-email-ivan.khoronzhuk@ti.com>
[not found] ` <1384187188-5776-13-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-11-11 17:13 ` [PATCH 12/12] arm: dts: keystone: add AEMIF/NAND device entry Khoronzhuk, Ivan
2013-11-12 16:19 ` Santosh Shilimkar
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=5295D102.2010101@ti.com \
--to=ivan.khoronzhuk@ti.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@kernel.crashing.org \
--cc=grygorii.strashko@ti.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=nsekhar@ti.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=swarren@wwwdotorg.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).