From: Arnd Bergmann <arnd@arndb.de>
To: "Lothar Waßmann" <LW@karo-electronics.de>
Cc: s.hauer@pengutronix.de, w.sang@pengutronix.de,
thierry.nolf.barco@gmail.com, Huang Shijie <b32955@freescale.com>,
linux-mtd@lists.infradead.org, u.kleine-koenig@pengutronix.de,
Linus Walleij <linus.walleij@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 1/3] ARM: mxs: add GPMI-NFC support for imx23/imx28
Date: Fri, 1 Jul 2011 00:22:26 +0200 [thread overview]
Message-ID: <201107010022.26597.arnd@arndb.de> (raw)
In-Reply-To: <19980.36638.134045.743619@ipc1.ka-ro>
On Thursday 30 June 2011 16:58:38 Lothar Waßmann wrote:
> >
> > When adding new infrastructure, always keep in mind how you want it to look
> > after the device tree conversion. The partitions and min/max_* are easily covered
> > with that, but the init/exit function pointers are somewhat problematic.
> >
> > Fortunately, you don't really require these functions for this driver. The _exit
> > function is completely unused, so just get rid of it.
> >
> > The init function is used only to set up iomux, so the logical replacement is
> > a pointer to the iomux data, and calling mxs_iomux_setup_multiple_pads
> > directly from the driver.
> >
> NO! I strongly object that. mxs_iomux_setup_multiple_pads() is a
> platform specific function and has no business inside a device driver
> that should be platform agnostic.
> Consider the same controller being part of a different SoC that
> requires you to call mxs_iomux_v2_setup_multiple_pads() instead. You
> would then have to check for the SoC type inside the driver to find
> the right function to call which is quite obscene.
Won't this problem just go away as soon as we get the mxs converted to the
generic pinmux subsystem that Linus Walleij is doing?
Obviously, you would not have to check the soc type really, you would have
to instead check for different versions of the gpmi, which you most likely
have to anyway because reusing the same hardware block in a new chip usually
comes with other changes as well.
Note how the driver already does this with code like
+ if (GPMI_IS_MX23(this) || GPMI_IS_MX28(this))
+ nfc = &gpmi_nfc_hal_mxs;
If you really want to call out obsceneties, how about the fact that this
driver comes with an 805 line patch to add a HAL for a single chip!
Such abstractions should not be introduced as long as there is only
a single instance of the hardware.
> I would rather live with the iomux statically configured in the
> platform init code than having direct calls into platform specific
> code from device drivers.
That would certainly work until we have the pinmux subsystem to
take care of it.
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 1/3] ARM: mxs: add GPMI-NFC support for imx23/imx28
Date: Fri, 1 Jul 2011 00:22:26 +0200 [thread overview]
Message-ID: <201107010022.26597.arnd@arndb.de> (raw)
In-Reply-To: <19980.36638.134045.743619@ipc1.ka-ro>
On Thursday 30 June 2011 16:58:38 Lothar Wa?mann wrote:
> >
> > When adding new infrastructure, always keep in mind how you want it to look
> > after the device tree conversion. The partitions and min/max_* are easily covered
> > with that, but the init/exit function pointers are somewhat problematic.
> >
> > Fortunately, you don't really require these functions for this driver. The _exit
> > function is completely unused, so just get rid of it.
> >
> > The init function is used only to set up iomux, so the logical replacement is
> > a pointer to the iomux data, and calling mxs_iomux_setup_multiple_pads
> > directly from the driver.
> >
> NO! I strongly object that. mxs_iomux_setup_multiple_pads() is a
> platform specific function and has no business inside a device driver
> that should be platform agnostic.
> Consider the same controller being part of a different SoC that
> requires you to call mxs_iomux_v2_setup_multiple_pads() instead. You
> would then have to check for the SoC type inside the driver to find
> the right function to call which is quite obscene.
Won't this problem just go away as soon as we get the mxs converted to the
generic pinmux subsystem that Linus Walleij is doing?
Obviously, you would not have to check the soc type really, you would have
to instead check for different versions of the gpmi, which you most likely
have to anyway because reusing the same hardware block in a new chip usually
comes with other changes as well.
Note how the driver already does this with code like
+ if (GPMI_IS_MX23(this) || GPMI_IS_MX28(this))
+ nfc = &gpmi_nfc_hal_mxs;
If you really want to call out obsceneties, how about the fact that this
driver comes with an 805 line patch to add a HAL for a single chip!
Such abstractions should not be introduced as long as there is only
a single instance of the hardware.
> I would rather live with the iomux statically configured in the
> platform init code than having direct calls into platform specific
> code from device drivers.
That would certainly work until we have the pinmux subsystem to
take care of it.
Arnd
next prev parent reply other threads:[~2011-06-30 22:22 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 3:53 [PATCH v5 0/3] add the GPMI-NFC support for imx23/imx28 Huang Shijie
2011-06-30 3:53 ` Huang Shijie
2011-06-30 3:53 ` [PATCH v5 1/3] ARM: mxs: add " Huang Shijie
2011-06-30 3:53 ` Huang Shijie
2011-06-30 13:55 ` Arnd Bergmann
2011-06-30 13:55 ` Arnd Bergmann
2011-06-30 14:58 ` Lothar Waßmann
2011-06-30 14:58 ` Lothar Waßmann
2011-06-30 22:22 ` Arnd Bergmann [this message]
2011-06-30 22:22 ` Arnd Bergmann
2011-07-01 5:59 ` Lothar Waßmann
2011-07-01 5:59 ` Lothar Waßmann
2011-07-01 6:03 ` Wolfram Sang
2011-07-01 6:03 ` Wolfram Sang
2011-07-01 7:53 ` Huang Shijie
2011-07-01 7:53 ` Huang Shijie
2011-07-01 8:01 ` Wolfram Sang
2011-07-01 8:01 ` Wolfram Sang
2011-07-01 8:39 ` Huang Shijie
2011-07-01 8:39 ` Huang Shijie
2011-07-01 8:45 ` Huang Shijie
2011-07-01 8:45 ` Huang Shijie
2011-07-01 9:25 ` Arnd Bergmann
2011-07-01 9:25 ` Arnd Bergmann
2011-07-08 7:31 ` Uwe Kleine-König
2011-07-08 7:31 ` Uwe Kleine-König
2011-07-08 7:40 ` Huang Shijie
2011-07-08 7:40 ` Huang Shijie
2011-07-08 9:09 ` Uwe Kleine-König
2011-07-08 9:09 ` Uwe Kleine-König
2011-07-08 9:27 ` Huang Shijie
2011-07-08 9:27 ` Huang Shijie
2011-07-08 10:16 ` Uwe Kleine-König
2011-07-08 10:16 ` Uwe Kleine-König
2011-07-08 10:24 ` Lothar Waßmann
2011-07-08 10:24 ` Lothar Waßmann
2011-07-11 8:00 ` Uwe Kleine-König
2011-07-11 8:00 ` Uwe Kleine-König
2011-07-11 8:30 ` Huang Shijie
2011-07-11 8:30 ` Huang Shijie
2011-07-11 8:37 ` Lothar Waßmann
2011-07-11 8:37 ` Lothar Waßmann
2011-07-08 9:02 ` Arnd Bergmann
2011-07-08 9:02 ` Arnd Bergmann
2011-06-30 3:53 ` [PATCH v5 2/3] ARM: mxs/mx23evk: add GPMI-NFC device Huang Shijie
2011-06-30 3:53 ` Huang Shijie
2011-06-30 7:55 ` Uwe Kleine-König
2011-06-30 7:55 ` Uwe Kleine-König
2011-06-30 8:37 ` Huang Shijie
2011-06-30 8:37 ` Huang Shijie
2011-06-30 3:53 ` [PATCH v5 3/3] ARM: mxs/mx28evk: " Huang Shijie
2011-06-30 3:53 ` Huang Shijie
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=201107010022.26597.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=LW@karo-electronics.de \
--cc=b32955@freescale.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=thierry.nolf.barco@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=w.sang@pengutronix.de \
/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.