public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register
@ 2016-04-27  7:02 Stefan Roese
  2016-04-28  6:06 ` Heiko Schocher
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2016-04-27  7:02 UTC (permalink / raw)
  To: u-boot

Some platforms don't implement the enable status register at offset 0x9c.
The SPEAr600 platform is one of them. The recently added check to this
status register can't be performend on these platforms.

This patch introduces a new config option that can be enabled on such
platforms not supporting this register.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
---
 drivers/i2c/designware_i2c.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index 0c7cd0b..e60fd0a 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -36,6 +36,14 @@ struct dw_i2c {
 	struct dw_scl_sda_cfg *scl_sda_cfg;
 };
 
+#ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
+static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
+{
+	u32 ena = enable ? IC_ENABLE_0B : 0;
+
+	writel(ena, &i2c_base->ic_enable);
+}
+#else
 static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
 {
 	u32 ena = enable ? IC_ENABLE_0B : 0;
@@ -56,6 +64,7 @@ static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
 
 	printf("timeout in %sabling I2C adapter\n", enable ? "en" : "dis");
 }
+#endif
 
 /*
  * i2c_set_bus_speed - Set the i2c speed
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register
  2016-04-27  7:02 [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register Stefan Roese
@ 2016-04-28  6:06 ` Heiko Schocher
  2016-04-28  6:10   ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2016-04-28  6:06 UTC (permalink / raw)
  To: u-boot

Hello Stefan,

Am 27.04.2016 um 09:02 schrieb Stefan Roese:
> Some platforms don't implement the enable status register at offset 0x9c.
> The SPEAr600 platform is one of them. The recently added check to this
> status register can't be performend on these platforms.
>
> This patch introduces a new config option that can be enabled on such
> platforms not supporting this register.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> ---
>   drivers/i2c/designware_i2c.c | 9 +++++++++
>   1 file changed, 9 insertions(+)

No objections, but I miss an entry in drivers/i2c/Kconfig or at least an
entry in README. Please add this, thanks!

bye,
Heiko
>
> diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
> index 0c7cd0b..e60fd0a 100644
> --- a/drivers/i2c/designware_i2c.c
> +++ b/drivers/i2c/designware_i2c.c
> @@ -36,6 +36,14 @@ struct dw_i2c {
>   	struct dw_scl_sda_cfg *scl_sda_cfg;
>   };
>
> +#ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
> +static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
> +{
> +	u32 ena = enable ? IC_ENABLE_0B : 0;
> +
> +	writel(ena, &i2c_base->ic_enable);
> +}
> +#else
>   static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
>   {
>   	u32 ena = enable ? IC_ENABLE_0B : 0;
> @@ -56,6 +64,7 @@ static void dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
>
>   	printf("timeout in %sabling I2C adapter\n", enable ? "en" : "dis");
>   }
> +#endif
>
>   /*
>    * i2c_set_bus_speed - Set the i2c speed
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register
  2016-04-28  6:06 ` Heiko Schocher
@ 2016-04-28  6:10   ` Stefan Roese
  2016-04-28  6:22     ` Heiko Schocher
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2016-04-28  6:10 UTC (permalink / raw)
  To: u-boot

Hi Heiko,

On 28.04.2016 08:06, Heiko Schocher wrote:
> Am 27.04.2016 um 09:02 schrieb Stefan Roese:
>> Some platforms don't implement the enable status register at offset 0x9c.
>> The SPEAr600 platform is one of them. The recently added check to this
>> status register can't be performend on these platforms.
>>
>> This patch introduces a new config option that can be enabled on such
>> platforms not supporting this register.
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Heiko Schocher <hs@denx.de>
>> ---
>>   drivers/i2c/designware_i2c.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>
> No objections, but I miss an entry in drivers/i2c/Kconfig or at least an
> entry in README. Please add this, thanks!

Yes, I am aware that this is not available via Kconfig. I hesitate
to add it to the README, as this is a bit outdated. And we should
move to Kconfig anyways.

I'll work on a patch to move this driver and this config option to
Kconfig instead.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register
  2016-04-28  6:10   ` Stefan Roese
@ 2016-04-28  6:22     ` Heiko Schocher
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2016-04-28  6:22 UTC (permalink / raw)
  To: u-boot

Hello Stefan,

Am 28.04.2016 um 08:10 schrieb Stefan Roese:
> Hi Heiko,
>
> On 28.04.2016 08:06, Heiko Schocher wrote:
>> Am 27.04.2016 um 09:02 schrieb Stefan Roese:
>>> Some platforms don't implement the enable status register at offset 0x9c.
>>> The SPEAr600 platform is one of them. The recently added check to this
>>> status register can't be performend on these platforms.
>>>
>>> This patch introduces a new config option that can be enabled on such
>>> platforms not supporting this register.
>>>
>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>> Cc: Heiko Schocher <hs@denx.de>
>>> ---
>>>   drivers/i2c/designware_i2c.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>
>> No objections, but I miss an entry in drivers/i2c/Kconfig or at least an
>> entry in README. Please add this, thanks!
>
> Yes, I am aware that this is not available via Kconfig. I hesitate
> to add it to the README, as this is a bit outdated. And we should
> move to Kconfig anyways.

Yes!

> I'll work on a patch to move this driver and this config option to
> Kconfig instead.

Ok, thanks for the info, so I am fine with this patch:

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-28  6:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27  7:02 [U-Boot] [PATCH] i2c: designware_i2c: Optionally check enable status register Stefan Roese
2016-04-28  6:06 ` Heiko Schocher
2016-04-28  6:10   ` Stefan Roese
2016-04-28  6:22     ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox