All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Hunter <jon-hunter@ti.com>
To: "Mohammed, Afzal" <afzal@ti.com>
Cc: "tony@atomide.com" <tony@atomide.com>,
	"paul@pwsan.com" <paul@pwsan.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration
Date: Wed, 20 Jun 2012 17:11:39 -0500	[thread overview]
Message-ID: <4FE24A9B.6070203@ti.com> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A93E99C502@DBDE01.ent.ti.com>

Hi Afzal,

On 06/19/2012 12:57 AM, Mohammed, Afzal wrote:
> Hi Jon,
> 
> On Mon, Jun 18, 2012 at 21:31:46, Hunter, Jon wrote:
> 
>>> @@ -95,10 +89,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
>>>  	if (err)
>>>  		return err;
>>>  
>>> -	/* Ensure sync read and sync write are disabled */
>>> -	reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
>>> -	reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
>>> -	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
>>
>> Sorry if I was not clear, but I was still thinking that we keep the
>> above instance of setting async mode.
> :
>>>  static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
>>>  {
>>>  	struct device *dev = &gpmc_onenand_device.dev;
>>> +	u32 reg;
>>> +
>>> +	/* Ensure sync read and sync write are disabled */
>>> +	reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
>>> +	reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
>>> +	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
>>
>> ... and here we should just call omap2_onenand_set_async_mode(), ...
> 
> If omap2_onenand_set_async_mode is called from gpmc_onenand_setup & removed
> from gpmc_onenand_init, when using new gpmc driver interface, i.e. using
> gpmc_onenand_update [1], we lost opportunity to provide gpmc driver with
> configuration details for async mode causing a big warning about each
> timings & configurations that was left by bootloader (which is meant only
> for cases where Kernel can't configure GPMC). Of course, we can put
> omap2_onenand_set_async_mode in gpmc_onenand_update too, but then
> unnecessarily, omap2_onenand_sey_async_mode would be called twice.
> 
> Please note that gpmc_onenand_setup is a callback by onenand driver.

Ok, I see your point. So today the _set_async_mode() is really doing two
things ...

1. It is calculating the timings
2. Programming the timings and setting async mode.

I think that it would be best if we were to make _set_async_mode() into
two functions, for example ...

1. omap2_onenand_get_async_timings()
2. omap2_onenand_set_async_timings()

Where the omap2_onenand_get_async_timings() calculates the timings and
can be used in both legacy mode and with the driver. Then
omap2_onenand_set_sync_timings() is just used in the legacy mode where
we don't have the driver to configure the chip-select.

Do you think that could work?

We could also do the same for omap2_onenand_set_sync_mode().

Cheers
Jon

WARNING: multiple messages have this Message-ID (diff)
From: jon-hunter@ti.com (Jon Hunter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration
Date: Wed, 20 Jun 2012 17:11:39 -0500	[thread overview]
Message-ID: <4FE24A9B.6070203@ti.com> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A93E99C502@DBDE01.ent.ti.com>

Hi Afzal,

On 06/19/2012 12:57 AM, Mohammed, Afzal wrote:
> Hi Jon,
> 
> On Mon, Jun 18, 2012 at 21:31:46, Hunter, Jon wrote:
> 
>>> @@ -95,10 +89,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
>>>  	if (err)
>>>  		return err;
>>>  
>>> -	/* Ensure sync read and sync write are disabled */
>>> -	reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
>>> -	reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
>>> -	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
>>
>> Sorry if I was not clear, but I was still thinking that we keep the
>> above instance of setting async mode.
> :
>>>  static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
>>>  {
>>>  	struct device *dev = &gpmc_onenand_device.dev;
>>> +	u32 reg;
>>> +
>>> +	/* Ensure sync read and sync write are disabled */
>>> +	reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
>>> +	reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
>>> +	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
>>
>> ... and here we should just call omap2_onenand_set_async_mode(), ...
> 
> If omap2_onenand_set_async_mode is called from gpmc_onenand_setup & removed
> from gpmc_onenand_init, when using new gpmc driver interface, i.e. using
> gpmc_onenand_update [1], we lost opportunity to provide gpmc driver with
> configuration details for async mode causing a big warning about each
> timings & configurations that was left by bootloader (which is meant only
> for cases where Kernel can't configure GPMC). Of course, we can put
> omap2_onenand_set_async_mode in gpmc_onenand_update too, but then
> unnecessarily, omap2_onenand_sey_async_mode would be called twice.
> 
> Please note that gpmc_onenand_setup is a callback by onenand driver.

Ok, I see your point. So today the _set_async_mode() is really doing two
things ...

1. It is calculating the timings
2. Programming the timings and setting async mode.

I think that it would be best if we were to make _set_async_mode() into
two functions, for example ...

1. omap2_onenand_get_async_timings()
2. omap2_onenand_set_async_timings()

Where the omap2_onenand_get_async_timings() calculates the timings and
can be used in both legacy mode and with the driver. Then
omap2_onenand_set_sync_timings() is just used in the legacy mode where
we don't have the driver to configure the chip-select.

Do you think that could work?

We could also do the same for omap2_onenand_set_sync_mode().

Cheers
Jon

  reply	other threads:[~2012-06-20 22:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16  8:02 [PATCH v2 0/3] Prepare for GPMC driver conversion Afzal Mohammed
2012-06-16  8:02 ` Afzal Mohammed
2012-06-16  8:03 ` [PATCH v2 1/3] ARM: OMAP2+: nand: unify init functions Afzal Mohammed
2012-06-16  8:03   ` Afzal Mohammed
2012-06-16  8:03 ` [PATCH v2 2/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration Afzal Mohammed
2012-06-16  8:03   ` Afzal Mohammed
2012-06-18 16:01   ` Jon Hunter
2012-06-18 16:01     ` Jon Hunter
2012-06-19  5:57     ` Mohammed, Afzal
2012-06-19  5:57       ` Mohammed, Afzal
2012-06-20 22:11       ` Jon Hunter [this message]
2012-06-20 22:11         ` Jon Hunter
2012-06-21  6:38         ` Mohammed, Afzal
2012-06-21  6:38           ` Mohammed, Afzal
2012-06-16  8:03 ` [PATCH v2 3/3] ARM: OMAP2+: gpmc: handle additional timings Afzal Mohammed
2012-06-16  8:03   ` Afzal Mohammed

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=4FE24A9B.6070203@ti.com \
    --to=jon-hunter@ti.com \
    --cc=afzal@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.