From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] Introducing Exynos ChipId driver
Date: Sat, 03 May 2014 17:02:37 +0200 [thread overview]
Message-ID: <13946837.RfnRDPQdge@wuerfel> (raw)
In-Reply-To: <1399097500-4052-1-git-send-email-pankaj.dubey@samsung.com>
On Saturday 03 May 2014 15:11:36 Pankaj Dubey wrote:
> This patch series attempts to get rid of soc_is_exynosXXXX macros
> and eventually with the help of this series we can probably get
> rid of CONFIG_SOC_EXYNOSXXXX in near future.
> Each Exynos SoC has ChipID block which can give information about
> SoC's product Id and revision number. Currently we have single
> DT binding information for this as "samsung,exynos4210-chipid".
> But Exynos4 and Exynos5 SoC series have one small difference in
> chip Id, with resepect to product id bit-masks. So it means we
> should have separate compatible string for these different series
> of SoCs. So I have created new binding information for handling
> this difference. Also currently I can think of putting this driver
> code under "drivers/misc/" but suggestions are welcome.
> Also current form of driver is missing platfrom driver and needs
> init function to be called from machine file (either exynos.c or
> platsmp.c). I hope lot of suggestions and comments to improve this
> further.
>
> This patch series is based on Kukjin Kim's for-next (3.14_rc1 tag)
> and prepared on top of following patch series and it's dependent
> patch series.
I think putting it into drivers/soc would be most appropriate.
We already have a few drivers lined up that we want in there,
although the directory currently doesn't exist.
However, I would ask that you use the infrastructure provided by
drivers/base/soc.c when you add this driver, to also make the
information available to user space using a standard API.
Ideally this should be done by slightly restructuring the DT
source to make all on-chip devices appear below the soc node.
We'd have to think a bit about how to best do this while
preserving compatibility with existing dts files.
Regarding patch 4, this is not what I meant when I asked for
removing the soc_is_exynos* macros. You basically do a 1:1 replacement
using a different interface, but you still have code that does
things differently based on a global identification.
The only user left in device drivers is now the cpufreq driver,
which is going to be replaced anyway, so that is ok. Having
a global variable that is accessible to random device drivers
is probably not a good idea though, it will just lead to
bad coding in drivers again.
To give an example of how I think it should really be restructured,
let's look at one function:
static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
{ 76, BIT(1) }, /* RTC alarm */
{ 77, BIT(2) }, /* RTC tick */
{ /* sentinel */ },
};
static const struct exynos_wkup_irq exynos5250_wkup_irq[] = {
{ 75, BIT(1) }, /* RTC alarm */
{ 76, BIT(2) }, /* RTC tick */
{ /* sentinel */ },
};
static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
{
const struct exynos_wkup_irq *wkup_irq;
if (soc_is_exynos5250())
wkup_irq = exynos5250_wkup_irq;
else
wkup_irq = exynos4_wkup_irq;
...
}
There are multiple problems with this code:
- As mentioned, you depend on a specific SoC identification for
something that could be done completely generic.
- The knowledge about what is a wakeup source or not doesn't
really belong here. We don't have a DT binding for wakeups
as far as I'm aware of, but this should probably be handled
locally in the RTC device node, possibly in the node that
contains the S5P_WAKEUP_MASK register.
Arnd
next prev parent reply other threads:[~2014-05-03 15:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 6:11 [PATCH 0/4] Introducing Exynos ChipId driver Pankaj Dubey
2014-05-03 6:11 ` [PATCH 1/4] ARM: EXYNOS: remove soc_is_exynos4/5 from exynos.c Pankaj Dubey
2014-05-03 6:11 ` [PATCH 2/4] ARM: EXYNOS: remove unused header inclusion from hotplug.c Pankaj Dubey
2014-05-03 6:11 ` [PATCH 3/4] misc: exynos-chipid: Add Exynos Chipid driver support Pankaj Dubey
2014-05-05 7:57 ` Krzysztof Kozlowski
2014-05-05 9:28 ` Pankaj Dubey
2014-05-03 6:11 ` [PATCH 4/4] ARM: EXYNOS: Refactoring to remove soc_is_exynosXXXX macros from exynos Pankaj Dubey
2014-05-03 15:02 ` Arnd Bergmann [this message]
2014-05-05 9:23 ` [PATCH 0/4] Introducing Exynos ChipId driver Pankaj Dubey
2014-05-05 14:58 ` Arnd Bergmann
2014-05-05 15:01 ` Arnd Bergmann
2014-05-06 6:57 ` Pankaj Dubey
2014-05-06 7:24 ` Arnd Bergmann
2014-05-12 1:47 ` Olof Johansson
2014-05-12 9:47 ` Arnd Bergmann
2014-05-05 15:34 ` Rob Herring
2014-05-06 7:22 ` Arnd Bergmann
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=13946837.RfnRDPQdge@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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).