* [PATCH] ARM: S3C6410: Use device names for both I2C clocks
@ 2011-11-08 16:09 Mark Brown
2011-11-08 16:27 ` Thomas Abraham
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2011-11-08 16:09 UTC (permalink / raw)
To: linux-arm-kernel
When the S3C64xx CPUs were converted to clkdev mappings were added for the
I2C controllers on them. On S3C6410 a device name is specified for I2C
controller 1 but not for controller 0 which makes the code less robust as
we'll falsely return the clock for controller 0 if there's an error in the
request for controller 1.
Improve things by registering a device name for controller 0 as well. Due
to the fact that we change the numbering for controller 0 depending on if
we've registered controller 1 this requires an ifdef to choose the name.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
arch/arm/mach-s3c64xx/clock.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index 39c238d..52b264e 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -138,6 +138,11 @@ static struct clk init_clocks_off[] = {
.ctrlbit = S3C_CLKCON_PCLK_TSADC,
}, {
.name = "i2c",
+#ifdef CONFIG_S3C_DEV_I2C1
+ .devname = "s3c2440-i2c.0",
+#else
+ .devname = "s3c2440-i2c",
+#endif
.parent = &clk_p,
.enable = s3c64xx_pclk_ctrl,
.ctrlbit = S3C_CLKCON_PCLK_IIC,
--
1.7.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] ARM: S3C6410: Use device names for both I2C clocks
2011-11-08 16:09 [PATCH] ARM: S3C6410: Use device names for both I2C clocks Mark Brown
@ 2011-11-08 16:27 ` Thomas Abraham
2011-11-08 16:36 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Abraham @ 2011-11-08 16:27 UTC (permalink / raw)
To: linux-arm-kernel
On 8 November 2011 21:39, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> When the S3C64xx CPUs were converted to clkdev mappings were added for the
> I2C controllers on them. On S3C6410 a device name is specified for I2C
> controller 1 but not for controller 0 which makes the code less robust as
> we'll falsely return the clock for controller 0 if there's an error in the
> request for controller 1.
>
> Improve things by registering a device name for controller 0 as well. Due
> to the fact that we change the numbering for controller 0 depending on if
> we've registered controller 1 this requires an ifdef to choose the name.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> ?arch/arm/mach-s3c64xx/clock.c | ? ?5 +++++
> ?1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
> index 39c238d..52b264e 100644
> --- a/arch/arm/mach-s3c64xx/clock.c
> +++ b/arch/arm/mach-s3c64xx/clock.c
> @@ -138,6 +138,11 @@ static struct clk init_clocks_off[] = {
> ? ? ? ? ? ? ? ?.ctrlbit ? ? ? ?= S3C_CLKCON_PCLK_TSADC,
> ? ? ? ?}, {
> ? ? ? ? ? ? ? ?.name ? ? ? ? ? = "i2c",
> +#ifdef CONFIG_S3C_DEV_I2C1
> + ? ? ? ? ? ? ? .devname ? ? ? ?= "s3c2440-i2c.0",
> +#else
> + ? ? ? ? ? ? ? .devname ? ? ? ?= "s3c2440-i2c",
> +#endif
> ? ? ? ? ? ? ? ?.parent ? ? ? ? = &clk_p,
> ? ? ? ? ? ? ? ?.enable ? ? ? ? = s3c64xx_pclk_ctrl,
> ? ? ? ? ? ? ? ?.ctrlbit ? ? ? ?= S3C_CLKCON_PCLK_IIC,
The #ifdef around the id of the s3c_device_i2c0 structure in
arch/arm/plat-samsung/devs.c file can be removed and id can be fixed
as 0. And devname "s3c2440-i2c.0" can be assigned above without the
#ifdef. Will there be any issues in using .id as 0 even if there is
only one instance of i2c?
Thanks,
Thomas.
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] ARM: S3C6410: Use device names for both I2C clocks
2011-11-08 16:27 ` Thomas Abraham
@ 2011-11-08 16:36 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-11-08 16:36 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Nov 08, 2011 at 09:57:56PM +0530, Thomas Abraham wrote:
> On 8 November 2011 21:39, Mark Brown
> > +#ifdef CONFIG_S3C_DEV_I2C1
> > + ? ? ? ? ? ? ? .devname ? ? ? ?= "s3c2440-i2c.0",
> > +#else
> > + ? ? ? ? ? ? ? .devname ? ? ? ?= "s3c2440-i2c",
> > +#endif
> The #ifdef around the id of the s3c_device_i2c0 structure in
> arch/arm/plat-samsung/devs.c file can be removed and id can be fixed
> as 0. And devname "s3c2440-i2c.0" can be assigned above without the
> #ifdef. Will there be any issues in using .id as 0 even if there is
> only one instance of i2c?
That would be much nicer from my point of view but it's much more
invasive as this device is used by a whole raft of other SoCs, not all
of which have more than one I2C controller and I don't really feel like
changing the idiom over the entire Samsung SoC family right now.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-08 16:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 16:09 [PATCH] ARM: S3C6410: Use device names for both I2C clocks Mark Brown
2011-11-08 16:27 ` Thomas Abraham
2011-11-08 16:36 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox