All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: riic: remove fixed clock restriction
@ 2017-09-29 15:32 Chris Brandt
  2017-09-29 16:26   ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Brandt @ 2017-09-29 15:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Simon Horman, Geert Uytterhoeven,
	Chris Brandt

Most systems with this i2c are going to have a clock of either 33.3MHz or
32MHz. That 4% difference is not reason enough to warrant that the driver
to completely fail.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
 drivers/i2c/busses/i2c-riic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index c811af4c8d81..0a61beeb384a 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -299,12 +299,13 @@ static int riic_init_hw(struct riic_dev *riic, u32 spd)
 
 	/*
 	 * TODO: Implement formula to calculate the timing values depending on
-	 * variable parent clock rate and arbitrary bus speed
+	 * variable parent clock rate and arbitrary bus speed.
+	 * For now, just use calculations based on a 33325000Hz clock.
 	 */
 	rate = clk_get_rate(riic->clk);
-	if (rate != 33325000) {
+	if (!rate) {
 		dev_err(&riic->adapter.dev,
-			"invalid parent clk (%lu). Must be 33325000Hz\n", rate);
+			"invalid parent clk (%lu)\n", rate);
 		clk_disable_unprepare(riic->clk);
 		return -EINVAL;
 	}
-- 
2.14.1

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

* Re: [PATCH] i2c: riic: remove fixed clock restriction
  2017-09-29 15:32 [PATCH] i2c: riic: remove fixed clock restriction Chris Brandt
@ 2017-09-29 16:26   ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-09-29 16:26 UTC (permalink / raw)
  To: Chris Brandt; +Cc: Wolfram Sang, Linux I2C, Linux-Renesas, Simon Horman

Hi Chris,

On Fri, Sep 29, 2017 at 5:32 PM, Chris Brandt <chris.brandt@renesas.com> wrote:
> Most systems with this i2c are going to have a clock of either 33.3MHz or
> 32MHz. That 4% difference is not reason enough to warrant that the driver
> to completely fail.
>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
> ---
>  drivers/i2c/busses/i2c-riic.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
> index c811af4c8d81..0a61beeb384a 100644
> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -299,12 +299,13 @@ static int riic_init_hw(struct riic_dev *riic, u32 spd)
>
>         /*
>          * TODO: Implement formula to calculate the timing values depending on
> -        * variable parent clock rate and arbitrary bus speed
> +        * variable parent clock rate and arbitrary bus speed.
> +        * For now, just use calculations based on a 33325000Hz clock.
>          */
>         rate = clk_get_rate(riic->clk);
> -       if (rate != 33325000) {
> +       if (!rate) {
>                 dev_err(&riic->adapter.dev,
> -                       "invalid parent clk (%lu). Must be 33325000Hz\n", rate);
> +                       "invalid parent clk (%lu)\n", rate);

The printed rate is always zero here.

>                 clk_disable_unprepare(riic->clk);
>                 return -EINVAL;
>         }

Gr{oetje,eeting}s,

                        Geert

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

* Re: [PATCH] i2c: riic: remove fixed clock restriction
@ 2017-09-29 16:26   ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-09-29 16:26 UTC (permalink / raw)
  To: Chris Brandt; +Cc: Wolfram Sang, Linux I2C, Linux-Renesas, Simon Horman

Hi Chris,

On Fri, Sep 29, 2017 at 5:32 PM, Chris Brandt <chris.brandt@renesas.com> wrote:
> Most systems with this i2c are going to have a clock of either 33.3MHz or
> 32MHz. That 4% difference is not reason enough to warrant that the driver
> to completely fail.
>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
> ---
>  drivers/i2c/busses/i2c-riic.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
> index c811af4c8d81..0a61beeb384a 100644
> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -299,12 +299,13 @@ static int riic_init_hw(struct riic_dev *riic, u32 spd)
>
>         /*
>          * TODO: Implement formula to calculate the timing values depending on
> -        * variable parent clock rate and arbitrary bus speed
> +        * variable parent clock rate and arbitrary bus speed.
> +        * For now, just use calculations based on a 33325000Hz clock.
>          */
>         rate = clk_get_rate(riic->clk);
> -       if (rate != 33325000) {
> +       if (!rate) {
>                 dev_err(&riic->adapter.dev,
> -                       "invalid parent clk (%lu). Must be 33325000Hz\n", rate);
> +                       "invalid parent clk (%lu)\n", rate);

The printed rate is always zero here.

>                 clk_disable_unprepare(riic->clk);
>                 return -EINVAL;
>         }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH] i2c: riic: remove fixed clock restriction
  2017-09-29 16:26   ` Geert Uytterhoeven
  (?)
@ 2017-09-29 17:07   ` Chris Brandt
  -1 siblings, 0 replies; 4+ messages in thread
From: Chris Brandt @ 2017-09-29 17:07 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Wolfram Sang, Linux I2C, Linux-Renesas, Simon Horman

Hi Geert,

On Friday, September 29, 2017 1, Geert Uytterhoeven wrote:
> > -       if (rate != 33325000) {
> > +       if (!rate) {
> >                 dev_err(&riic->adapter.dev,
> > -                       "invalid parent clk (%lu). Must be 33325000Hz\n",
> rate);
> > +                       "invalid parent clk (%lu)\n", rate);
> 
> The printed rate is always zero here.

OK, I will change to just:

"invalid parent clock rate of 0\n"

Chris


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

end of thread, other threads:[~2017-09-29 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 15:32 [PATCH] i2c: riic: remove fixed clock restriction Chris Brandt
2017-09-29 16:26 ` Geert Uytterhoeven
2017-09-29 16:26   ` Geert Uytterhoeven
2017-09-29 17:07   ` Chris Brandt

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.