From: Jon Hunter <jon-hunter@ti.com>
To: "Mohammed, Afzal" <afzal@ti.com>
Cc: "Hilman, Kevin" <khilman@ti.com>, "Menon, Nishanth" <nm@ti.com>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
"sameo@linux.intel.com" <sameo@linux.intel.com>,
"tony@atomide.com" <tony@atomide.com>,
"artem.bityutskiy@linux.intel.com"
<artem.bityutskiy@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Hiremath, Vaibhav" <hvaibhav@ti.com>,
"dbaryshkov@gmail.com" <dbaryshkov@gmail.com>,
"vimal.newwork@gmail.com" <vimal.newwork@gmail.com>,
"grinberg@compulab.co.il" <grinberg@compulab.co.il>,
"mike@compulab.co.il" <mike@compulab.co.il>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 1/9] ARM: OMAP2+: gpmc: driver conversion
Date: Wed, 11 Apr 2012 10:47:10 -0500 [thread overview]
Message-ID: <4F85A77E.30203@ti.com> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A9317C6F4B@DBDE01.ent.ti.com>
Hi Afzal,
On 04/11/2012 12:11 AM, Mohammed, Afzal wrote:
> Hi Jon,
>
> On Wed, Apr 11, 2012 at 00:53:14, Hunter, Jon wrote:
>> I agree with your argument but I was thinking today only OMAP uses the
>> GPMC so we could not worry about this. Ok, leave as-is, but can we
>> modify the code as follows as the "else if" is not really needed...
>>
>> if (gpmc->num_irq < GPMC_NR_IRQ) {
>> dev_warn(gpmc->dev, "Insufficient interrupts for device\n");
>> return -EINVAL;
>> }
>>
>> gpmc->num_irq = GPMC_NR_IRQ;
>
> Yes, it is better
>
>>
>>>>
>>>> Furthermore, GPMC_NR_IRQ is defined as 6 which is correct for OMAP2/3
>>>> but not for OMAP4/5, it is 5. Therefore, we need to detect whether we
>>>> are using an OMAP2/3 or OMAP4+ and set num_irqs based upon this. This
>>>> could be done in the probe and we can avoid passing this.
>>>
>>> Is it dependent on OMAPX or GPMC IP version? if it is IP version, then driver
>>> can be enhanced to handle it, if not, platform has to pass this information.
>>
>> Here are the GPMC IP revisions ...
>>
>> OMAP5430 = 0x00000060
>> OMAP4430 = 0x00000060
>> OMAP3630 = 0x00000050
>> OMAP3430 = 0x00000050
>>
>> So this should work for OMAP. We should check OMAP2 as well. What about
>> the AMxxx devices?
>
>
> I badly needed this information, thanks.
>
> AM3359 = 0x00000060, it has only 2 waitpin interrupts
Great so this is consistent!
>>>>>>> + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>>>>>> + if (res == NULL)
>>>>>>> + dev_warn(gpmc->dev, "Failed to get resource: irq\n");
>>>>>>> + else
>>>>>>> + gpmc->master_irq = res->start;
>>>>>>
>>>>>> Why not return an error if the IRQ is not found? We don't know if anyone
>>>>>> will be trying to use them.
>>>>>
>>>>> Why do you want to do that ?
>>>>
>>>> Because this indicates a BUG :-)
>>>
>>> I disagree, this need not be considered a bug always,
>>> for eg. If gpmc irq is not connected to intc
>>
>> Ok, so for devices existing today this indicates a bug ;-)
>
> I do not want to consider that case to be bug enough for probe
> to fail, there are other drivers which does similar enhancing
> its use cases,
>
> eg. 1e351a9 mfd: Make TPS65910 usable without interrupts
Ok, fine.
>>
>> At a minimum you need to improve the error handing here. If the
>> platform_get_resource fails you are still calling "gpmc_setup_irq()"
>> which appears to be pointless. It would be better if the gpmc irq chip
>> is not initialised in this case so that drivers attempting to request
>> these irqs failed.
>
> Please see gpmc_setup_irq, if irq is not present, it returns in the
> beginning, and gpmc_irq_chip is not initialized in that case.
Yes you are right.
>>>>>>> + for (gdq = gp->device_pdata, gd = gpmc->device; *gdq; gdq++, i++) {
>>>>>>> + ret = gpmc_setup_device(*gdq, gd, gpmc);
>>>>>>> + if (IS_ERR_VALUE(ret))
>>>>>>> + dev_err(gpmc->dev, "gpmc setup on %s failed\n",
>>>>>>> + (*gdq)->name);
>>>>>>> + else
>>>>>>> + gd++;
>>>>>>> + }
>>>>>>
>>>>>> Would a while loop be simpler?
>>>>>
>>>>> My preference is to go with "for"
>>>>
>>>> Ok, just wondering if this could be cleaned up a little.
>>>
>>> For travelling through array of pointers, for looks natural to me, if you
>>> have a better way, please send it, it can be folded in next version.
>>
>> Could you have num_devices to indicate how many platform devices there
>> are and then a simple for-loop of 0 to num_devices?
>
> This will cause coding to be done by platform to be less simple, and my
> preference is not to use another variable
Hehe, I wondered if that would make life a little more difficult. Ok
lets leave it for now.
Jon
WARNING: multiple messages have this Message-ID (diff)
From: Jon Hunter <jon-hunter@ti.com>
To: "Mohammed, Afzal" <afzal@ti.com>
Cc: "tony@atomide.com" <tony@atomide.com>,
"Hilman, Kevin" <khilman@ti.com>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"sameo@linux.intel.com" <sameo@linux.intel.com>,
"grinberg@compulab.co.il" <grinberg@compulab.co.il>,
"mike@compulab.co.il" <mike@compulab.co.il>,
"Menon, Nishanth" <nm@ti.com>,
"artem.bityutskiy@linux.intel.com"
<artem.bityutskiy@linux.intel.com>,
"vimal.newwork@gmail.com" <vimal.newwork@gmail.com>,
"dbaryshkov@gmail.com" <dbaryshkov@gmail.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Hiremath, Vaibhav" <hvaibhav@ti.com>
Subject: Re: [PATCH v3 1/9] ARM: OMAP2+: gpmc: driver conversion
Date: Wed, 11 Apr 2012 10:47:10 -0500 [thread overview]
Message-ID: <4F85A77E.30203@ti.com> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A9317C6F4B@DBDE01.ent.ti.com>
Hi Afzal,
On 04/11/2012 12:11 AM, Mohammed, Afzal wrote:
> Hi Jon,
>
> On Wed, Apr 11, 2012 at 00:53:14, Hunter, Jon wrote:
>> I agree with your argument but I was thinking today only OMAP uses the
>> GPMC so we could not worry about this. Ok, leave as-is, but can we
>> modify the code as follows as the "else if" is not really needed...
>>
>> if (gpmc->num_irq < GPMC_NR_IRQ) {
>> dev_warn(gpmc->dev, "Insufficient interrupts for device\n");
>> return -EINVAL;
>> }
>>
>> gpmc->num_irq = GPMC_NR_IRQ;
>
> Yes, it is better
>
>>
>>>>
>>>> Furthermore, GPMC_NR_IRQ is defined as 6 which is correct for OMAP2/3
>>>> but not for OMAP4/5, it is 5. Therefore, we need to detect whether we
>>>> are using an OMAP2/3 or OMAP4+ and set num_irqs based upon this. This
>>>> could be done in the probe and we can avoid passing this.
>>>
>>> Is it dependent on OMAPX or GPMC IP version? if it is IP version, then driver
>>> can be enhanced to handle it, if not, platform has to pass this information.
>>
>> Here are the GPMC IP revisions ...
>>
>> OMAP5430 = 0x00000060
>> OMAP4430 = 0x00000060
>> OMAP3630 = 0x00000050
>> OMAP3430 = 0x00000050
>>
>> So this should work for OMAP. We should check OMAP2 as well. What about
>> the AMxxx devices?
>
>
> I badly needed this information, thanks.
>
> AM3359 = 0x00000060, it has only 2 waitpin interrupts
Great so this is consistent!
>>>>>>> + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>>>>>> + if (res == NULL)
>>>>>>> + dev_warn(gpmc->dev, "Failed to get resource: irq\n");
>>>>>>> + else
>>>>>>> + gpmc->master_irq = res->start;
>>>>>>
>>>>>> Why not return an error if the IRQ is not found? We don't know if anyone
>>>>>> will be trying to use them.
>>>>>
>>>>> Why do you want to do that ?
>>>>
>>>> Because this indicates a BUG :-)
>>>
>>> I disagree, this need not be considered a bug always,
>>> for eg. If gpmc irq is not connected to intc
>>
>> Ok, so for devices existing today this indicates a bug ;-)
>
> I do not want to consider that case to be bug enough for probe
> to fail, there are other drivers which does similar enhancing
> its use cases,
>
> eg. 1e351a9 mfd: Make TPS65910 usable without interrupts
Ok, fine.
>>
>> At a minimum you need to improve the error handing here. If the
>> platform_get_resource fails you are still calling "gpmc_setup_irq()"
>> which appears to be pointless. It would be better if the gpmc irq chip
>> is not initialised in this case so that drivers attempting to request
>> these irqs failed.
>
> Please see gpmc_setup_irq, if irq is not present, it returns in the
> beginning, and gpmc_irq_chip is not initialized in that case.
Yes you are right.
>>>>>>> + for (gdq = gp->device_pdata, gd = gpmc->device; *gdq; gdq++, i++) {
>>>>>>> + ret = gpmc_setup_device(*gdq, gd, gpmc);
>>>>>>> + if (IS_ERR_VALUE(ret))
>>>>>>> + dev_err(gpmc->dev, "gpmc setup on %s failed\n",
>>>>>>> + (*gdq)->name);
>>>>>>> + else
>>>>>>> + gd++;
>>>>>>> + }
>>>>>>
>>>>>> Would a while loop be simpler?
>>>>>
>>>>> My preference is to go with "for"
>>>>
>>>> Ok, just wondering if this could be cleaned up a little.
>>>
>>> For travelling through array of pointers, for looks natural to me, if you
>>> have a better way, please send it, it can be folded in next version.
>>
>> Could you have num_devices to indicate how many platform devices there
>> are and then a simple for-loop of 0 to num_devices?
>
> This will cause coding to be done by platform to be less simple, and my
> preference is not to use another variable
Hehe, I wondered if that would make life a little more difficult. Ok
lets leave it for now.
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 v3 1/9] ARM: OMAP2+: gpmc: driver conversion
Date: Wed, 11 Apr 2012 10:47:10 -0500 [thread overview]
Message-ID: <4F85A77E.30203@ti.com> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A9317C6F4B@DBDE01.ent.ti.com>
Hi Afzal,
On 04/11/2012 12:11 AM, Mohammed, Afzal wrote:
> Hi Jon,
>
> On Wed, Apr 11, 2012 at 00:53:14, Hunter, Jon wrote:
>> I agree with your argument but I was thinking today only OMAP uses the
>> GPMC so we could not worry about this. Ok, leave as-is, but can we
>> modify the code as follows as the "else if" is not really needed...
>>
>> if (gpmc->num_irq < GPMC_NR_IRQ) {
>> dev_warn(gpmc->dev, "Insufficient interrupts for device\n");
>> return -EINVAL;
>> }
>>
>> gpmc->num_irq = GPMC_NR_IRQ;
>
> Yes, it is better
>
>>
>>>>
>>>> Furthermore, GPMC_NR_IRQ is defined as 6 which is correct for OMAP2/3
>>>> but not for OMAP4/5, it is 5. Therefore, we need to detect whether we
>>>> are using an OMAP2/3 or OMAP4+ and set num_irqs based upon this. This
>>>> could be done in the probe and we can avoid passing this.
>>>
>>> Is it dependent on OMAPX or GPMC IP version? if it is IP version, then driver
>>> can be enhanced to handle it, if not, platform has to pass this information.
>>
>> Here are the GPMC IP revisions ...
>>
>> OMAP5430 = 0x00000060
>> OMAP4430 = 0x00000060
>> OMAP3630 = 0x00000050
>> OMAP3430 = 0x00000050
>>
>> So this should work for OMAP. We should check OMAP2 as well. What about
>> the AMxxx devices?
>
>
> I badly needed this information, thanks.
>
> AM3359 = 0x00000060, it has only 2 waitpin interrupts
Great so this is consistent!
>>>>>>> + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>>>>>> + if (res == NULL)
>>>>>>> + dev_warn(gpmc->dev, "Failed to get resource: irq\n");
>>>>>>> + else
>>>>>>> + gpmc->master_irq = res->start;
>>>>>>
>>>>>> Why not return an error if the IRQ is not found? We don't know if anyone
>>>>>> will be trying to use them.
>>>>>
>>>>> Why do you want to do that ?
>>>>
>>>> Because this indicates a BUG :-)
>>>
>>> I disagree, this need not be considered a bug always,
>>> for eg. If gpmc irq is not connected to intc
>>
>> Ok, so for devices existing today this indicates a bug ;-)
>
> I do not want to consider that case to be bug enough for probe
> to fail, there are other drivers which does similar enhancing
> its use cases,
>
> eg. 1e351a9 mfd: Make TPS65910 usable without interrupts
Ok, fine.
>>
>> At a minimum you need to improve the error handing here. If the
>> platform_get_resource fails you are still calling "gpmc_setup_irq()"
>> which appears to be pointless. It would be better if the gpmc irq chip
>> is not initialised in this case so that drivers attempting to request
>> these irqs failed.
>
> Please see gpmc_setup_irq, if irq is not present, it returns in the
> beginning, and gpmc_irq_chip is not initialized in that case.
Yes you are right.
>>>>>>> + for (gdq = gp->device_pdata, gd = gpmc->device; *gdq; gdq++, i++) {
>>>>>>> + ret = gpmc_setup_device(*gdq, gd, gpmc);
>>>>>>> + if (IS_ERR_VALUE(ret))
>>>>>>> + dev_err(gpmc->dev, "gpmc setup on %s failed\n",
>>>>>>> + (*gdq)->name);
>>>>>>> + else
>>>>>>> + gd++;
>>>>>>> + }
>>>>>>
>>>>>> Would a while loop be simpler?
>>>>>
>>>>> My preference is to go with "for"
>>>>
>>>> Ok, just wondering if this could be cleaned up a little.
>>>
>>> For travelling through array of pointers, for looks natural to me, if you
>>> have a better way, please send it, it can be folded in next version.
>>
>> Could you have num_devices to indicate how many platform devices there
>> are and then a simple for-loop of 0 to num_devices?
>
> This will cause coding to be done by platform to be less simple, and my
> preference is not to use another variable
Hehe, I wondered if that would make life a little more difficult. Ok
lets leave it for now.
Jon
next prev parent reply other threads:[~2012-04-11 15:47 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1333640054.git.afzal@ti.com>
2012-04-05 15:45 ` [PATCH v3 1/9] ARM: OMAP2+: gpmc: driver conversion Afzal Mohammed
2012-04-05 15:45 ` Afzal Mohammed
2012-04-05 15:45 ` Afzal Mohammed
2012-04-05 15:45 ` Afzal Mohammed
2012-04-05 20:21 ` Jon Hunter
2012-04-05 20:21 ` Jon Hunter
2012-04-05 20:21 ` Jon Hunter
2012-04-05 20:21 ` Jon Hunter
2012-04-05 20:34 ` Jon Hunter
2012-04-05 20:34 ` Jon Hunter
2012-04-05 20:34 ` Jon Hunter
2012-04-06 6:52 ` Mohammed, Afzal
2012-04-06 6:52 ` Mohammed, Afzal
2012-04-06 6:52 ` Mohammed, Afzal
2012-04-09 19:50 ` Jon Hunter
2012-04-09 19:50 ` Jon Hunter
2012-04-09 19:50 ` Jon Hunter
2012-04-10 11:00 ` Mohammed, Afzal
2012-04-10 11:00 ` Mohammed, Afzal
2012-04-10 11:00 ` Mohammed, Afzal
2012-04-10 19:23 ` Jon Hunter
2012-04-10 19:23 ` Jon Hunter
2012-04-10 19:23 ` Jon Hunter
2012-04-11 5:11 ` Mohammed, Afzal
2012-04-11 5:11 ` Mohammed, Afzal
2012-04-11 5:11 ` Mohammed, Afzal
2012-04-11 15:47 ` Jon Hunter [this message]
2012-04-11 15:47 ` Jon Hunter
2012-04-11 15:47 ` Jon Hunter
2012-04-05 15:46 ` [PATCH v3 2/9] ARM: OMAP2+: gpmc: registers for nand driver Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` [PATCH v3 3/9] ARM: OMAP2+: nand: create platform data structure Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` [PATCH v3 4/9] ARM: OMAP2+: gpmc-nand: populate gpmc configs Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-10 19:24 ` Jon Hunter
2012-04-10 19:24 ` Jon Hunter
2012-04-10 19:24 ` Jon Hunter
2012-04-10 19:24 ` Jon Hunter
2012-04-11 5:15 ` Mohammed, Afzal
2012-04-11 5:15 ` Mohammed, Afzal
2012-04-11 5:15 ` Mohammed, Afzal
2012-04-05 15:46 ` [PATCH v3 5/9] ARM: OMAP2+: gpmc-smsc911x: gpmc driver information Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` [PATCH v3 6/9] mtd: nand: omap2: obtain memory from resource Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:46 ` Afzal Mohammed
2012-04-05 15:47 ` [PATCH v3 7/9] mtd: nand: omap2: use gpmc provided irqs Afzal Mohammed
2012-04-05 15:47 ` Afzal Mohammed
2012-04-05 15:47 ` Afzal Mohammed
2012-04-05 15:47 ` [PATCH v3 8/9] mtd: nand: omap2: handle nand on gpmc Afzal Mohammed
2012-04-05 15:47 ` Afzal Mohammed
2012-04-05 15:47 ` Afzal Mohammed
2012-04-05 15:47 ` [TMP] OMAP3EVM: Test gpmc nand & smsc911x Afzal Mohammed
2012-04-05 16:05 ` Afzal Mohammed
2012-04-05 15:47 ` Afzal Mohammed
2012-04-25 16:47 ` Tony Lindgren
2012-04-25 16:47 ` Tony Lindgren
2012-04-25 16:47 ` Tony Lindgren
2012-04-26 5:21 ` Mohammed, Afzal
2012-04-26 5:21 ` Mohammed, Afzal
2012-04-26 5:21 ` Mohammed, Afzal
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=4F85A77E.30203@ti.com \
--to=jon-hunter@ti.com \
--cc=afzal@ti.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=grinberg@compulab.co.il \
--cc=hvaibhav@ti.com \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mike@compulab.co.il \
--cc=nm@ti.com \
--cc=sameo@linux.intel.com \
--cc=tony@atomide.com \
--cc=vimal.newwork@gmail.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.