From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Russell King - ARM Linux
<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
Emilio Lopez <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>,
Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
kevin-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCHv4 2/9] i2c: mv64xxx: make the registers offset configurable
Date: Wed, 12 Jun 2013 17:37:36 +0200 [thread overview]
Message-ID: <20130612153736.GL16699@lukather> (raw)
In-Reply-To: <51B88DB0.90302-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi Sebastian,
On Wed, Jun 12, 2013 at 05:03:12PM +0200, Sebastian Hesselbarth wrote:
> On 06/12/13 16:44, Maxime Ripard wrote:
> >Hi Russel,
> >
> >On Wed, Jun 12, 2013 at 02:57:35PM +0100, Russell King - ARM Linux wrote:
> >>On Wed, Jun 12, 2013 at 10:07:11AM +0200, Maxime Ripard wrote:
> >>>The Allwinner i2c controller uses the same logic as the Marvell one, but
> >>>with slightly different register offsets.
> >>>
> >>>Introduce a structure that will be passed by either the pdata or
> >>>associated to the compatible strings, and that holds the various
> >>>registers that might be needed.
> >>
> >>I don't like this change. It introduces further indirection where it's
> >>not really necessary, and it's also using platform data to specify this
> >>which is in the opposite direction to what's required for moving towards
> >>DT.
> >
> >Well, some users of this aren't converted to DT, hence why I made the
> >changes to the platform_data.
>
> Actually, this is not quite true. Yes of course, there are still users
> of non-DT Marvell SoCs and it is still in the progress of full-DT. But
> also ppc is using DT, except that they parse it and put in in
> platform_data. Reasonable since back then, there was no global DT API
> available.
Ah, I see, thanks for the insight. I was here referring more
specifically to Orion that seems to be still stuck with !DT at the
moment, at least partially.
> IMHO for the time in between (i.e. now) check for pdev->dev.of_node
> and !pdev->dev.platform_data will allow you to distinguish all users
> perfectly:
>
> - non-DT has platform_data set only
> - ppc DT has of_node and platform_data set
> - pure DT has of_node set only
>
> This will allow you to limit your register offset modifications to
> Allwinner exclusively and for pure DT (if that is what you want for
> Allwinner).
>
> Checkout mv643xx_eth in net-next where the above discrimination
> strategy was chosen.
>
> [...]
> >>I'd suggest making the default register offsets be the drivers existing
> >>offsets, and allowing it to be overriden. That nicely sorts out the
> >>next comment below, and also gets rid of it in platform data. Moreover,
> >>if you're going to re-use this driver, you should do it via a different
> >>"compatible" name in DT, which the driver can then use to identify the
> >>different register set layout.
> >
> >The logic here will change quite a bit in the next iteration thanks to
> >the comments I received.
> >
> >I'm now using a platform_device_id structure to match the name of the
> >driver just like what was done with the DT in that patchset. This also
> >removes the need to add the regs field to the platform data and ...
>
> Also here, if Allwinner is pure DT, you can call some
> mv643xx_i2c_of_probe() for pure DT only with the above discrimination.
Unless I'm missing something, isn't it what's already in place here?
We have:
if (pdata) {
/* Fill in the driver data structure from pdata */
} else if (pd->dev.of_node) {
/* Fill in the driver data structure from dt */
} else {
return -EFAIL;
}
I guess that should cover all the cases you mentionned, even the PPC
one, right?
Now, the question about what content do we find in these platform_data
is actually a different one. This patch passed the regs offset as a
member of those. We all agreed that it was not the most elegant solution
(and like you mentionned, I will never use this pdata structure anyway
for the Allwinner stuff).
I guess we could just take the marvell offsets when using pdata, and use
different register offsets based on the compatibles when loading from
dt?
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 2/9] i2c: mv64xxx: make the registers offset configurable
Date: Wed, 12 Jun 2013 17:37:36 +0200 [thread overview]
Message-ID: <20130612153736.GL16699@lukather> (raw)
In-Reply-To: <51B88DB0.90302@gmail.com>
Hi Sebastian,
On Wed, Jun 12, 2013 at 05:03:12PM +0200, Sebastian Hesselbarth wrote:
> On 06/12/13 16:44, Maxime Ripard wrote:
> >Hi Russel,
> >
> >On Wed, Jun 12, 2013 at 02:57:35PM +0100, Russell King - ARM Linux wrote:
> >>On Wed, Jun 12, 2013 at 10:07:11AM +0200, Maxime Ripard wrote:
> >>>The Allwinner i2c controller uses the same logic as the Marvell one, but
> >>>with slightly different register offsets.
> >>>
> >>>Introduce a structure that will be passed by either the pdata or
> >>>associated to the compatible strings, and that holds the various
> >>>registers that might be needed.
> >>
> >>I don't like this change. It introduces further indirection where it's
> >>not really necessary, and it's also using platform data to specify this
> >>which is in the opposite direction to what's required for moving towards
> >>DT.
> >
> >Well, some users of this aren't converted to DT, hence why I made the
> >changes to the platform_data.
>
> Actually, this is not quite true. Yes of course, there are still users
> of non-DT Marvell SoCs and it is still in the progress of full-DT. But
> also ppc is using DT, except that they parse it and put in in
> platform_data. Reasonable since back then, there was no global DT API
> available.
Ah, I see, thanks for the insight. I was here referring more
specifically to Orion that seems to be still stuck with !DT at the
moment, at least partially.
> IMHO for the time in between (i.e. now) check for pdev->dev.of_node
> and !pdev->dev.platform_data will allow you to distinguish all users
> perfectly:
>
> - non-DT has platform_data set only
> - ppc DT has of_node and platform_data set
> - pure DT has of_node set only
>
> This will allow you to limit your register offset modifications to
> Allwinner exclusively and for pure DT (if that is what you want for
> Allwinner).
>
> Checkout mv643xx_eth in net-next where the above discrimination
> strategy was chosen.
>
> [...]
> >>I'd suggest making the default register offsets be the drivers existing
> >>offsets, and allowing it to be overriden. That nicely sorts out the
> >>next comment below, and also gets rid of it in platform data. Moreover,
> >>if you're going to re-use this driver, you should do it via a different
> >>"compatible" name in DT, which the driver can then use to identify the
> >>different register set layout.
> >
> >The logic here will change quite a bit in the next iteration thanks to
> >the comments I received.
> >
> >I'm now using a platform_device_id structure to match the name of the
> >driver just like what was done with the DT in that patchset. This also
> >removes the need to add the regs field to the platform data and ...
>
> Also here, if Allwinner is pure DT, you can call some
> mv643xx_i2c_of_probe() for pure DT only with the above discrimination.
Unless I'm missing something, isn't it what's already in place here?
We have:
if (pdata) {
/* Fill in the driver data structure from pdata */
} else if (pd->dev.of_node) {
/* Fill in the driver data structure from dt */
} else {
return -EFAIL;
}
I guess that should cover all the cases you mentionned, even the PPC
one, right?
Now, the question about what content do we find in these platform_data
is actually a different one. This patch passed the regs offset as a
member of those. We all agreed that it was not the most elegant solution
(and like you mentionned, I will never use this pdata structure anyway
for the Allwinner stuff).
I guess we could just take the marvell offsets when using pdata, and use
different register offsets based on the compatibles when loading from
dt?
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2013-06-12 15:37 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 8:07 [PATCHv4 0/9] Add I2C support for Allwinner SoCs Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
[not found] ` <1371024438-16631-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 8:07 ` [PATCHv4 1/9] i2c: mv64xxx: Add macros to access parts of registers Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 2/9] i2c: mv64xxx: make the registers offset configurable Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 10:54 ` Andrew Lunn
2013-06-12 10:54 ` Andrew Lunn
[not found] ` <20130612105431.GS16502-g2DYL2Zd6BY@public.gmane.org>
2013-06-12 11:29 ` Maxime Ripard
2013-06-12 11:29 ` Maxime Ripard
[not found] ` <1371024438-16631-3-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 13:57 ` Russell King - ARM Linux
2013-06-12 13:57 ` Russell King - ARM Linux
[not found] ` <20130612135735.GR18614-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-06-12 14:44 ` Maxime Ripard
2013-06-12 14:44 ` Maxime Ripard
2013-06-12 14:51 ` Russell King - ARM Linux
2013-06-12 14:51 ` Russell King - ARM Linux
[not found] ` <20130612145139.GS18614-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-06-12 15:17 ` Maxime Ripard
2013-06-12 15:17 ` Maxime Ripard
2013-06-12 15:03 ` Sebastian Hesselbarth
2013-06-12 15:03 ` Sebastian Hesselbarth
[not found] ` <51B88DB0.90302-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-12 15:37 ` Maxime Ripard [this message]
2013-06-12 15:37 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 3/9] ARM: orion: pass the i2c registers definition through the platform data Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
[not found] ` <1371024438-16631-4-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 8:39 ` Tomasz Figa
2013-06-12 8:39 ` Tomasz Figa
2013-06-12 8:07 ` [PATCHv4 4/9] i2c: mv64xxx: Add Allwinner sun4i compatible Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
[not found] ` <1371024438-16631-5-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 8:42 ` Tomasz Figa
2013-06-12 8:42 ` Tomasz Figa
2013-06-12 11:27 ` Maxime Ripard
2013-06-12 11:27 ` Maxime Ripard
2013-06-12 10:56 ` Andrew Lunn
2013-06-12 10:56 ` Andrew Lunn
[not found] ` <20130612105613.GT16502-g2DYL2Zd6BY@public.gmane.org>
2013-06-12 11:31 ` Maxime Ripard
2013-06-12 11:31 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 5/9] ARM: sunxi: dt: Add i2c controller nodes to the DTSI Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 6/9] ARM: sun4i: dt: Add i2c muxing options Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 7/9] ARM: sun5i: " Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
[not found] ` <1371024438-16631-8-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 8:29 ` Henrik Nordström
2013-06-12 8:29 ` [linux-sunxi] " Henrik Nordström
2013-06-12 11:20 ` Maxime Ripard
2013-06-12 11:20 ` [linux-sunxi] " Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 8/9] ARM: sun5i: olinuxino: Enable the i2c controllers Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 8:07 ` [PATCHv4 9/9] ARM: sun4i: cubieboard: " Maxime Ripard
2013-06-12 8:07 ` Maxime Ripard
2013-06-12 11:26 ` [PATCHv4 0/9] Add I2C support for Allwinner SoCs Arnd Bergmann
2013-06-12 11:26 ` Arnd Bergmann
2013-06-12 11:38 ` Maxime Ripard
2013-06-12 11:38 ` Maxime Ripard
2013-06-12 12:38 ` Arnd Bergmann
2013-06-12 12:38 ` Arnd Bergmann
[not found] ` <201306121438.12549.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-12 12:44 ` Maxime Ripard
2013-06-12 12:44 ` Maxime Ripard
2013-06-14 14:01 ` Wolfram Sang
2013-06-14 14:01 ` Wolfram Sang
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=20130612153736.GL16699@lukather \
--to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org \
--cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
--cc=kevin-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org \
--cc=sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org \
--cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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 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.