From: jon-hunter@ti•com (Jon Hunter)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v4 01/39] ARM: OMAP2+: gpmc: driver conversion
Date: Fri, 4 May 2012 11:27:10 -0500 [thread overview]
Message-ID: <4FA4035E.6020308@ti.com> (raw)
In-Reply-To: <363273a9ef82d6836197929157aa9a8eb8f5171a.1335874494.git.afzal@ti.com>
Hi Afzal,
On 05/01/2012 07:19 AM, Afzal Mohammed wrote:
[...]
> +static int gpmc_setup_cs_waitpin(struct gpmc *gpmc, struct gpmc_device *gd,
> + unsigned cs, unsigned conf)
> +{
> + u32 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
> + unsigned idx = ~0x0;
> + int polarity = 0;
>
> - l = gpmc_read_reg(GPMC_REVISION);
> - printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f);
> - /* Set smart idle mode and automatic L3 clock gating */
> - l = gpmc_read_reg(GPMC_SYSCONFIG);
> - l &= 0x03 << 3;
> - l |= (0x02 << 3) | (1 << 0);
> - gpmc_write_reg(GPMC_SYSCONFIG, l);
> - gpmc_mem_init();
> + switch (conf & GPMC_WAITPIN_MASK) {
> + case GPMC_WAITPIN_0:
> + idx = GPMC_WAITPIN_IDX0;
> + break;
> + case GPMC_WAITPIN_1:
> + idx = GPMC_WAITPIN_IDX1;
> + break;
> + case GPMC_WAITPIN_2:
> + idx = GPMC_WAITPIN_IDX2;
> + break;
> + case GPMC_WAITPIN_3:
> + idx = GPMC_WAITPIN_IDX3;
> + break;
> + /* no waitpin */
> + case 0:
> + break;
> + default:
> + dev_err(gpmc->dev, "multiple waitpins selected on CS:%u\n", cs);
> + return -EINVAL;
> + break;
> + }
Why not combined case 0 and default? Both are invalid configurations so
just report invalid selection.
>
> - /* initalize the irq_chained */
> - irq = OMAP_GPMC_IRQ_BASE;
> - for (cs = 0; cs < GPMC_CS_NUM; cs++) {
> - irq_set_chip_and_handler(irq, &dummy_irq_chip,
> - handle_simple_irq);
> - set_irq_flags(irq, IRQF_VALID);
> - irq++;
> + switch (conf & GPMC_WAITPIN_POLARITY_MASK) {
> + case GPMC_WAITPIN_ACTIVE_LOW:
> + polarity = LOW;
> + break;
> + case GPMC_WAITPIN_ACTIVE_HIGH:
> + polarity = HIGH;
> + break;
> + /* no waitpin */
> + case 0:
> + break;
> + default:
> + dev_err(gpmc->dev, "waitpin polarity set to low & high\n");
> + return -EINVAL;
> + break;
> }
Again, combine case 0 and default as these are invalid.
>
> - ret = request_irq(gpmc_irq, gpmc_handle_irq, IRQF_SHARED, "gpmc", NULL);
> - if (ret)
> - pr_err("gpmc: irq-%d could not claim: err %d\n",
> - gpmc_irq, ret);
> - return ret;
> + if (idx != ~0x0) {
If you combine the above cases, then you can drop the idx test here.
> + if (gd->have_waitpin) {
> + if (gd->waitpin != idx ||
> + gd->waitpin_polarity != polarity) {
> + dev_err(gpmc->dev, "error: conflict: waitpin %u with polarity %d on device %s.%d\n",
> + gd->waitpin, gd->waitpin_polarity,
> + gd->name, gd->id);
> + return -EBUSY;
> + }
> + } else {
Don't need the else as you are going to return in the above.
> + gd->have_waitpin = true;
> + gd->waitpin = idx;
> + gd->waitpin_polarity = polarity;
> + }
> +
> + l &= ~GPMC_CONFIG1_WAIT_PIN_SEL_MASK;
> + l |= GPMC_CONFIG1_WAIT_PIN_SEL(idx);
> + gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
> + } else if (polarity) {
> + dev_err(gpmc->dev, "error: waitpin polarity specified with out wait pin number on device %s.%d\n",
> + gd->name, gd->id);
> + return -EINVAL;
Drop this else-if. The above switch statements will report the bad
configuration. This seems a bit redundant.
Cheers
Jon
next prev parent reply other threads:[~2012-05-04 16:27 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-01 12:19 [PATCH v4 00/39] OMAP GPMC driver conversion Afzal Mohammed
2012-05-01 12:19 ` [PATCH v4 01/39] ARM: OMAP2+: gpmc: " Afzal Mohammed
2012-05-01 17:53 ` Jon Hunter
2012-05-03 8:23 ` Mohammed, Afzal
2012-05-04 16:20 ` Jon Hunter
2012-05-07 10:57 ` Mohammed, Afzal
2012-05-07 16:23 ` Jon Hunter
2012-05-08 6:27 ` Mohammed, Afzal
2012-05-04 16:27 ` Jon Hunter [this message]
2012-05-07 11:01 ` Mohammed, Afzal
2012-05-07 16:02 ` Jon Hunter
2012-05-08 6:18 ` Mohammed, Afzal
2012-05-08 15:08 ` Jon Hunter
2012-05-10 5:10 ` Mohammed, Afzal
2012-05-01 12:19 ` [PATCH v4 02/39] ARM: OMAP2+: gpmc: Adapt to HWMOD Afzal Mohammed
2012-05-01 20:41 ` Jon Hunter
2012-05-03 8:37 ` Mohammed, Afzal
2012-05-04 16:30 ` Jon Hunter
2012-05-07 11:02 ` Mohammed, Afzal
2012-05-07 16:12 ` Jon Hunter
2012-05-08 6:24 ` Mohammed, Afzal
2012-05-08 15:13 ` Jon Hunter
2012-05-10 5:17 ` Mohammed, Afzal
2012-05-01 12:19 ` [PATCH v4 03/39] ARM: OMAP2+: gpmc: register details for nand driver Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 04/39] ARM: OMAP2+: gpmc: Acquire NAND CS value Afzal Mohammed
2012-05-01 21:16 ` Jon Hunter
2012-05-03 8:42 ` Mohammed, Afzal
2012-05-01 12:20 ` [PATCH v4 05/39] ARM: OMAP2+: nand: create platform data structure Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 06/39] ARM: OMAP2+: onenand: return value in init function Afzal Mohammed
2012-05-01 16:49 ` Sergei Shtylyov
2012-05-03 8:54 ` Mohammed, Afzal
2012-05-01 12:20 ` [PATCH v4 07/39] ARM: OMAP2+: gpmc-nand: Adapt to use gpmc driver Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 08/39] ARM: OMAP2+: gpmc-onenand: " Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 09/39] ARM: OMAP2+: flash: Adapt to " Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 10/39] ARM: OMAP2+: gpmc-smsc911x: Adapt to use " Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 11/39] ARM: OMAP2+: gpmc-smc91x: " Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 12/39] ARM: OMAP2+: gpmc-tusb6010: Adapt to " Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 13/39] ARM: OMAP3: hwmod data: add gpmc Afzal Mohammed
2012-05-06 2:09 ` Paul Walmsley
2012-05-01 12:21 ` [PATCH v4 14/39] ARM: OMAP2xxx: " Afzal Mohammed
2012-05-06 2:09 ` Paul Walmsley
2012-05-01 12:21 ` [PATCH v4 15/39] mtd: nand: omap2: obtain memory from resource Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 16/39] mtd: nand: omap2: use gpmc provided irqs Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 17/39] mtd: nand: omap2: handle nand on gpmc Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 18/39] mtd: onenand: omap: obtain memory from resource Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 19/39] ARM: OMAP2+: board omap3evm: gpmc driver adaptation Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 20/39] ARM: OMAP2+: board omap3beagle: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 21/39] ARM: OMAP2+: board apollon: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 22/39] ARM: OMAP2+: board h4: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 23/39] ARM: OMAP2+: board 3630sdp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 24/39] ARM: OMAP2+: board 3430sdp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 25/39] ARM: OMAP2+: board 2430sdp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 26/39] ARM: OMAP2+: board cm-t3517: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 27/39] ARM: OMAP2+: board cm-t35: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 28/39] ARM: OMAP2+: board ldp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 29/39] ARM: OMAP2+: board n8x0: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 30/39] ARM: OMAP2+: board omap3logic: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 31/39] ARM: OMAP2+: board omap3pandora: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 32/39] ARM: OMAP2+: board omap3stalker: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 33/39] ARM: OMAP2+: board omap4pcm049: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 34/39] ARM: OMAP2+: board overo: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 35/39] ARM: OMAP2+: board rm680: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 36/39] ARM: OMAP2+: board rx51: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 37/39] ARM: OMAP2+: board zoom-debugboard: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 38/39] OMAP3: igep0020: Add support for Micron NAND Flash storage memory Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 39/39] ARM: OMAP2+: board igep0020: gpmc driver adaptation Afzal Mohammed
2012-05-08 11:27 ` [PATCH v4 00/39] OMAP GPMC driver conversion 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=4FA4035E.6020308@ti.com \
--to=jon-hunter@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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