Re: [PATCH v2 00/10] i2c: rcar: tackle race conditions in the driver

2015-11-12 Thread Kuninori Morimoto

Hi

> Hello RCar Fans!
> 
> So, here is V2 of this series. Thanks to Geert's MSTP clock manipulation
> series, I could finally reproduce something which looks like the issues 
> Laurent
> was seeing with his Koelsch board. The outcome is Patch 1/10 which fixes also
> issues reported by Morimoto-san using a Salvator board. I tested these patches
> with my Lager and Salvator board (latter one with scope) and Magnus' Koelsch
> via remote connection. A branch for testing can be found here:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
> renesas/rcar-i2c-rework-v2

I tested this branch on Lagar and Salvator-X with Sound.
(Sound uses I2C for ak4642, ak4613, and CS2000)
Actually, above branch is missing some necessary sound patch,
but anyway, I2C works good for sound.

For all patches

Tested-by: Kuninori Morimoto 

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init

2015-11-11 Thread Kuninori Morimoto

Hi Wolfram

> > On SH-Mobile case, it automatically power-off:ed if all driver
> > user was gone.
> 
> It does that without calling some callback?

Do you mean you can call init() in callback ?
I don't care detail of design. But my concern was that
register value might be disappear during many get/put if
power-domain was implemented

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init

2015-11-11 Thread Kuninori Morimoto

Hi Wolfram

> >  pm_runtime_get_sync()
> >  myfunc_A()
> >  pm_runtime_put()
> >  ...
> >  pm_runtime_get_sync()
> >  myfunc_B()
> >  pm_runtime_put()
> > 
> > It should be this ?
> > 
> >  pm_runtime_get_sync()
> >  myfunc_A()
> >  myfunc_B()
> >  pm_runtime_put()
> 
> This is for power-off case, right? Wouldn't it be clearer then to add a
> resume function to pm_ops of the I2C driver which reinit the registers?
> Doing it before every transfer might be simpler but is also a bit
> implicit or subtle, I'd think.
> 
> And for completeness: The above is only for the power-off case. In
> module-standby (MSTP bits), register values are always retained.
> Correct?

I'm not sure detail of pm_runtime, but it depends on
power-domain support ?
On SH-Mobile case, it automatically power-off:ed if all driver
user was gone. This feature is not yet supported on R-Car case I think.
So, both case are not problem at this point, but 1st case will be
problem if power-domain was suppored.
(If my memory was correct...)
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i2c: rcar: make sure clocks are on when doing hw init

2015-10-29 Thread Kuninori Morimoto

Hi Wolfram Sang wrote:
> 
> From: Wolfram Sang 
> 
> Reported-by: Kuninori Morimoto 
> Signed-off-by: Wolfram Sang 
> ---

Please add explain why this patch is needed, and what happen
without this patch.
And my previous patch didn't explain this, but please add
93c659d820ef291f6ca5e628f44b26cfb2226aba
was cause of this issue.

>  drivers/i2c/busses/i2c-rcar.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 616433d387cdb2..58dbd30c24d1cc 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -612,7 +612,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>   if (IS_ERR(priv->io))
>   return PTR_ERR(priv->io);
>  
> + pm_runtime_enable(dev);
> + pm_runtime_get_sync(dev);
>   rcar_i2c_init(priv);
> + pm_runtime_put(dev);
>  
>   irq = platform_get_irq(pdev, 0);
>   init_waitqueue_head(&priv->wait);
> @@ -631,22 +634,24 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>  dev_name(dev), priv);
>   if (ret < 0) {
>   dev_err(dev, "cannot get irq %d\n", irq);
> - return ret;
> + goto out_pm_disable;
>   }
>  
> - pm_runtime_enable(dev);
>   platform_set_drvdata(pdev, priv);
>  
>   ret = i2c_add_numbered_adapter(adap);
>   if (ret < 0) {
>   dev_err(dev, "reg adap failed: %d\n", ret);
> - pm_runtime_disable(dev);
> - return ret;
> + goto out_pm_disable;
>   }
>  
>   dev_info(dev, "probed\n");
>  
>   return 0;
> +
> + out_pm_disable:
> + pm_runtime_disable(dev);
> + return ret;
>  }
>  
>  static int rcar_i2c_remove(struct platform_device *pdev)
> -- 
> 2.1.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: rcar: call rcar_i2c_init() after pm_runtime_get_sync()

2015-10-29 Thread Kuninori Morimoto

Hi Geert

> > From: Kuninori Morimoto 
> >
> > rcar_i2c_init() initializes I2C device, but it should be called
> > *after* pm_runtime_get_sync(). Otherwise it outputs very hi speed
> > clock. This patch solved this issue,
> > This patch also removes pointless rcar_i2c_init()
> > from rcar_i2c_probe()
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >  drivers/i2c/busses/i2c-rcar.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > index 616433d..edbfefc 100644
> > --- a/drivers/i2c/busses/i2c-rcar.c
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -474,6 +474,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter 
> > *adap,
> >
> > pm_runtime_get_sync(dev);
> >
> > +   rcar_i2c_init(priv);
> 
> Hence now it's done again for every transfer?
> 
> What about moving it just before the call to i2c_add_numbered_adapter(),
> and wrapping it inside pm_runtime_get_sync(dev)/pm_runtime_put()?

In my experience, it should be called again for every transfer.
Because SoC/IP might doesn't keep register setting value if you call 
pm_runtime_put()
(I fought with this behavior when sh_mobile IP :P )
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: rcar: make sure clocks are on when doing hw init

2015-10-29 Thread Kuninori Morimoto

Hi, Wolfram

> From: Wolfram Sang 
> 
> Reported-by: Kuninori Morimoto 
> Signed-off-by: Wolfram Sang 
> ---
>  drivers/i2c/busses/i2c-rcar.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 616433d387cdb2..ef26e933b1e9cb 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -612,7 +612,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>   if (IS_ERR(priv->io))
>   return PTR_ERR(priv->io);
>  
> + pm_runtime_enable(dev);
> + pm_runtime_get_sync(dev);
>   rcar_i2c_init(priv);
> + pm_runtime_put(dev);

Please correct me if I'm misunderstanding, but in my experience,
above rcar_i2c_init() result can be removed if SoC has power-off feature,
and if IP doesn't keep register value power-off case ?
This case register doesn't keep myfunc_A's setting,
because it calls pm_runtime_put()

 pm_runtime_get_sync()
 myfunc_A()
 pm_runtime_put()
 ...
 pm_runtime_get_sync()
 myfunc_B()
 pm_runtime_put()

It should be this ?

 pm_runtime_get_sync()
 myfunc_A()
 myfunc_B()
 pm_runtime_put()
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] i2c: rcar: call rcar_i2c_init() after pm_runtime_get_sync()

2015-10-29 Thread Kuninori Morimoto

From: Kuninori Morimoto 

rcar_i2c_init() initializes I2C device, but it should be called
*after* pm_runtime_get_sync(). Otherwise it outputs very hi speed
clock. This patch solved this issue, 
This patch also removes pointless rcar_i2c_init()
from rcar_i2c_probe()

Signed-off-by: Kuninori Morimoto 
---
 drivers/i2c/busses/i2c-rcar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 616433d..edbfefc 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -474,6 +474,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 
pm_runtime_get_sync(dev);
 
+   rcar_i2c_init(priv);
+
ret = rcar_i2c_bus_barrier(priv);
if (ret < 0)
goto out;
@@ -612,8 +614,6 @@ static int rcar_i2c_probe(struct platform_device *pdev)
if (IS_ERR(priv->io))
return PTR_ERR(priv->io);
 
-   rcar_i2c_init(priv);
-
irq = platform_get_irq(pdev, 0);
init_waitqueue_head(&priv->wait);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT 0/2] i2c: add support for r8a7795 (RCar H3)

2015-09-16 Thread Kuninori Morimoto

Hi Wolfram

> Here are the driver updates to support this new SoC. Since I don't have HW
> access, this is a request for testing. The IP cores are backwards compatible 
> to
> Gen2. So, as long as the clocks are properly setup and the bus speed is OK,
> the rest should work out of the box.
> 
> Question: Shall I prototype the dtsi additions for these modules? On the one
> hand, this is quite some change for not being able to test. On the other hand,
> other people might be so busy setting up the rest, so it may be useful after
> all.
> 
> 
> Wolfram Sang (2):
>   i2c: rcar: add support for r8a7795 (R-Car H3)
>   i2c: sh_mobile: add support for r8a7795 (R-Car H3)
> 
>  Documentation/devicetree/bindings/i2c/i2c-rcar.txt  | 1 +
>  Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt | 1 +
>  drivers/i2c/busses/i2c-rcar.c   | 3 +++
>  drivers/i2c/busses/i2c-sh_mobile.c  | 1 +
>  4 files changed, 6 insertions(+)

For all patches, on Salvator-X board with ak4613 / cs2000 chip

Tested-by: Kuninori Morimoto 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver

2015-06-10 Thread Kuninori Morimoto

Hi Wolfram

> This series moves the errata handling from the setup function into the driver.
> It has been tested that this changeset does not cause a regression on the
> armadillo board we had access to. Unfortunately, this board did not need the
> workaround at all, only some revisions of the r8a7740 are affected.
> 
> After a short discussion with Simon, we agreed this should go via I2C.
> 
> Wolfram Sang (2):
>   i2c: sh_mobile: add errata workaround
>   ARM: shmobile: r8a7740: remove I2C errata handling
> 
>  arch/arm/mach-shmobile/setup-r8a7740.c | 55 
> --
>  drivers/i2c/busses/i2c-sh_mobile.c | 40 +
>  2 files changed, 40 insertions(+), 55 deletions(-)

Thank you for your patches

For all patches

Acked-by: Kuninori Morimoto 


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-07 Thread Kuninori Morimoto

Hi Magnus

> With this in mind I think the best way forward is as follows:
> A) Keep on using per-SoC compatible string unless it is documented somewhere
> and in parallel
> B) Work on getting per-device hardware version number from hardware device 
> team
(snip)
> From my point of view your proposal adds problematic dependencies for
> each device without too much upside. The problem will happen over time
> when adding features. It is in my opinion easier to just add the
> compatible string entry for a new SoC together with the rest of the
> SoC support activity. There is no easy way out when the hardware is
> changing - we have to modify the code anyway! Of course, if the
> hardware is not changing then it is a different story. But in such
> case we need to have documented compatibility somewhere...
> 
> What is your opinion about "B) per-device hardware version number"?

According to HW team, they are creating 2 type of datasheet now.
One is "R-Car Gen2 common datasheet",
and the other is "R-Car SoC specify datasheet".
Not, HW version though.

I could understand about your concern.
But, it is always happen on all code
which is used from many platform/driver/framework.
It is not only DT compatible issue.

I still can't give up adding generation level compatible.
So how about this idea ?
Now, our driver / platform are like this.
SoC level matching only.

driver
{ .compatible = "renesas,xxx-r8a7790", .data = xxx_gen2_dt_config },
{ .compatible = "renesas,xxx-r8a7791", .data = xxx_gen2_dt_config },
{ .compatible = "renesas,xxx-r8a7792", .data = xxx_gen2_dt_config },

platform
compatible = "renesas,xxx-r8a7790";


Now, we add generation level compatible to platform side only.
We don't know what is "gen2" mean at this point.
But, this is no problem, because driver matching is happen on SoC level.

driver
{ .compatible = "renesas,xxx-r8a7790", .data = xxx_gen2_dt_config },
{ .compatible = "renesas,xxx-r8a7791", .data = xxx_gen2_dt_config },
{ .compatible = "renesas,xxx-r8a7792", .data = xxx_gen2_dt_config },

platform
-   compatible = "renesas,xxx-r8a7790";
+   compatible = "renesas,xxx-r8a7790", "renesas,xxx-gen2";

In the future, if our driver are growup enough,
and we could confirm there is no difference between r8a7790/1/2 in HW,
and we could confirm there is no drfference between r8a7790/1/2 in SW,
then, we can add generation level compatible,
and remove SoC level compatible in driver side,

driver
+   { .compatible = "renesas,xxx-gen2",.data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7790", .data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7791", .data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7792", .data = xxx_gen2_dt_config },

platform
compatible = "renesas,xxx-r8a7790", "renesas,xxx-gen2";

If there is non-compatible feature, we can keep it.
like this

driver
+   { .compatible = "renesas,xxx-gen2",.data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7790", .data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7791", .data = xxx_gen2_dt_config },
-   { .compatible = "renesas,xxx-r8a7792", .data = xxx_gen2_dt_config },
+   { .compatible = "renesas,xxx-r8a7792", .data = xxx_r8a7792_dt_config },

platform
compatible = "renesas,xxx-r8a7790", "renesas,xxx-gen2";

This approach has no effect to current feature,
and can keep compatible for current and future,
and can reduce / cleanup driver in the future.

>> But yes, we want to know which SoC is supported.
>> We can use Document/devicetree/...txt for this purpose
>
> I agree about that portion. =)

Thank you :)

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-06 Thread Kuninori Morimoto

Hi Magnus

> The problem is that "gen2" is not something that is pre-defined. As
> you may have noticed earlier, new SoCs keep on coming and even though
> they may be part of "gen2" they may or may not be compatible with the
> "gen2" compatible string. So based on that, if we use the SoC part
> number in the compatible string we at least know what the support
> status is.

Do you mean "driver" table ?
This patch doesn't remove SoC level compatible from driver.

And additionally,
we can check support status in Document/devicetree/...txt
and Geert is doing it now ?
(Which SoC is working/supporting)

> So I agree that sharing hardware makes sense from a resource saving
> point of view. However in reality there may be smaller differences
> between devices used for each version within the generation though.

Yes, "maybe" it has smaller difference, but what is the problem ?
Driver is already have SoC level compatible.
Why we can't update it ?

Or, "maybe" we can add new property for it ?
It can keep compatible anyway, because current code is already working.

In my opinion, we can use SoC level compatible name if it was special,
otherwise, we can use generation level compatible.
Platform side DTS file should include SoC and generation level compatible
from first support patch. If possible, series compatible too.
like this

compatible = "renesas,i2c-r8a7790", "renesas,i2c-rcar-gen2", 
"renesas,i2c-rcar"

But, it is too late for Gen1/Gen2.
I don't want to have more pointless string in driver in Gen3 or later.

But yes, we want to know which SoC is supported.
We can use Document/devicetree/...txt for this purpose

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-06 Thread Kuninori Morimoto

Hi Simon

> At our face-to-face meeting in Montpellier we discussed the
> idea of generation bindings. And my recollection is that Magnus
> and I had strong reservations about declaring what generation compatibility
> is without it being explicitly stated in hardware documentation.
> 
> From observation we can say that the i2c controllers on r8a7778 and r8a7779
> appear to be compatible. But can we say that in fact they are in fact
> compatible hardware. That they are different hardware instances of a common
> i2c controller whose name may or may not be is known to us? If not
> I do not think that using a common binding describes the hardware,
> which is the intention of DT bindings.
> 
> A second problem is the using the generation as a name.  Assuming the
> answer to the above question is yes can we further say with certainty
> that all variants of Gen1 SoCs that currently exist or will exist in the
> future are compatible?  If not then using Gen1 as the name does not seem
> to accurately describe the hardware.

This is the reason why SoC side have multi compatible name ?
My understanding is that, generation compatibility support
common feature, SoC compatibility support specific feature.

   compatible = "renesas,i2c-r8a7790", renesas,i2c-rcar-gen2"

If r8a7790 has special feature, then, it match to first compatible name
(or it can have special property)
If it is same as other Gen2, then, it can match to 2nd name.

HW doesn't have IP specific version, but latest datasheet
is indicating all H2/M2/E2/V2.
And, from HW team point of view, they don't want to create
same name but multi feature IP in same generation.
Creating and Testing new IP needs too much time / money / paper work.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-06 Thread Kuninori Morimoto

Hi Simon

> > From: Kuninori Morimoto 
> > 
> > This patch adds DT compatible for Renesas R-Car Gen1/Gen2.
> > Current driver has SoC level .compatible
> > (r8a7778/r8a7779/r8a7790/r8a7791/r8a7792/r8a7793/r8a7794),
> > but these can be match as generation level.
> 
> Hi Morimoto-san,
> 
> is this compatibility explicitly documented somewhere?

?
Do you mean ${LINUX}/Documentation/devicetree/bindings/xxx ?
[1/5] patch have it, but is it not enough ?

> > Signed-off-by: Kuninori Morimoto 
> > ---
> >  Documentation/devicetree/bindings/i2c/i2c-rcar.txt |4 +++-
> >  drivers/i2c/busses/i2c-rcar.c  |2 ++
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
> > b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > index 16b3e07..0f9e812 100644
> > --- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > +++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > @@ -3,6 +3,8 @@ I2C for R-Car platforms
> >  Required properties:
> >  - compatible: Must be one of
> > "renesas,i2c-rcar"
> > +   "renesas,i2c-rcar-gen1"
> > +   "renesas,i2c-rcar-gen2"
> > "renesas,i2c-r8a7778"
> > "renesas,i2c-r8a7779"
> > "renesas,i2c-r8a7790"
> > @@ -24,7 +26,7 @@ Examples :
> >  i2c0: i2c@e6508000 {
> > #address-cells = <1>;
> > #size-cells = <0>;
> > -   compatible = "renesas,i2c-r8a7791";
> > +   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
> > reg = <0 0xe6508000 0 0x40>;
> > interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
> > clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > index f3c7139..6f805f8 100644
> > --- a/drivers/i2c/busses/i2c-rcar.c
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -487,6 +487,8 @@ static const struct i2c_algorithm rcar_i2c_algo = {
> >  
> >  static const struct of_device_id rcar_i2c_dt_ids[] = {
> > { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
> > +   { .compatible = "renesas,i2c-rcar-gen1", .data = (void *)I2C_RCAR_GEN1 
> > },
> > +   { .compatible = "renesas,i2c-rcar-gen2", .data = (void *)I2C_RCAR_GEN2 
> > },
> > { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
> > { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
> > { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
> > -- 
> > 1.7.9.5
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] ARM: shmobile: r8a7790: add generation level compatible for i2c

2014-08-05 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 arch/arm/boot/dts/r8a7790.dtsi |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 7218bff..02d07b7 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -252,7 +252,7 @@
i2c0: i2c@e6508000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7790";
+   compatible = "renesas,i2c-r8a7790", "renesas,i2c-rcar-gen2";
reg = <0 0xe6508000 0 0x40>;
interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7790_CLK_I2C0>;
@@ -262,7 +262,7 @@
i2c1: i2c@e6518000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7790";
+   compatible = "renesas,i2c-r8a7790", "renesas,i2c-rcar-gen2";
reg = <0 0xe6518000 0 0x40>;
interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7790_CLK_I2C1>;
@@ -272,7 +272,7 @@
i2c2: i2c@e653 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7790";
+   compatible = "renesas,i2c-r8a7790", "renesas,i2c-rcar-gen2";
reg = <0 0xe653 0 0x40>;
interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7790_CLK_I2C2>;
@@ -282,7 +282,7 @@
i2c3: i2c@e654 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7790";
+   compatible = "renesas,i2c-r8a7790", "renesas,i2c-rcar-gen2";
reg = <0 0xe654 0 0x40>;
interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7790_CLK_I2C3>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] ARM: shmobile: r8a7791: add generation level compatible for i2c

2014-08-05 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 arch/arm/boot/dts/r8a7791.dtsi |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 1e97113..854eca2 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -245,7 +245,7 @@
i2c0: i2c@e6508000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6508000 0 0x40>;
interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
@@ -255,7 +255,7 @@
i2c1: i2c@e6518000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6518000 0 0x40>;
interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C1>;
@@ -265,7 +265,7 @@
i2c2: i2c@e653 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe653 0 0x40>;
interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C2>;
@@ -275,7 +275,7 @@
i2c3: i2c@e654 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe654 0 0x40>;
interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C3>;
@@ -285,7 +285,7 @@
i2c4: i2c@e652 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe652 0 0x40>;
interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C4>;
@@ -296,7 +296,7 @@
/* doesn't need pinmux */
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6528000 0 0x40>;
interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C5>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] ARM: shmobile: r8a7779: add generation level compatible for i2c

2014-08-05 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 arch/arm/boot/dts/r8a7779.dtsi |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 463e3fd..ac89e42 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -159,7 +159,7 @@
i2c0: i2c@ffc7 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7779";
+   compatible = "renesas,i2c-r8a7779", "renesas,i2c-rcar-gen1";
reg = <0xffc7 0x1000>;
interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7779_CLK_I2C0>;
@@ -169,7 +169,7 @@
i2c1: i2c@ffc71000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7779";
+   compatible = "renesas,i2c-r8a7779", "renesas,i2c-rcar-gen1";
reg = <0xffc71000 0x1000>;
interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7779_CLK_I2C1>;
@@ -179,7 +179,7 @@
i2c2: i2c@ffc72000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7779";
+   compatible = "renesas,i2c-r8a7779", "renesas,i2c-rcar-gen1";
reg = <0xffc72000 0x1000>;
interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7779_CLK_I2C2>;
@@ -189,7 +189,7 @@
i2c3: i2c@ffc73000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7779";
+   compatible = "renesas,i2c-r8a7779", "renesas,i2c-rcar-gen1";
reg = <0xffc73000 0x1000>;
interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp0_clks R8A7779_CLK_I2C3>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] ARM: shmobile: r8a7778: add generation level compatible for i2c

2014-08-05 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 arch/arm/boot/dts/r8a7778.dtsi |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index ecfdf4b..1379a59 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -123,7 +123,7 @@
i2c0: i2c@ffc7 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7778";
+   compatible = "renesas,i2c-r8a7778", "renesas,i2c-rcar-gen1";
reg = <0xffc7 0x1000>;
interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
@@ -132,7 +132,7 @@
i2c1: i2c@ffc71000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7778";
+   compatible = "renesas,i2c-r8a7778", "renesas,i2c-rcar-gen1";
reg = <0xffc71000 0x1000>;
interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
@@ -141,7 +141,7 @@
i2c2: i2c@ffc72000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7778";
+   compatible = "renesas,i2c-r8a7778", "renesas,i2c-rcar-gen1";
reg = <0xffc72000 0x1000>;
interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
@@ -150,7 +150,7 @@
i2c3: i2c@ffc73000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7778";
+   compatible = "renesas,i2c-r8a7778", "renesas,i2c-rcar-gen1";
reg = <0xffc73000 0x1000>;
interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-05 Thread Kuninori Morimoto
From: Kuninori Morimoto 

This patch adds DT compatible for Renesas R-Car Gen1/Gen2.
Current driver has SoC level .compatible
(r8a7778/r8a7779/r8a7790/r8a7791/r8a7792/r8a7793/r8a7794),
but these can be match as generation level.

Signed-off-by: Kuninori Morimoto 
---
 Documentation/devicetree/bindings/i2c/i2c-rcar.txt |4 +++-
 drivers/i2c/busses/i2c-rcar.c  |2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index 16b3e07..0f9e812 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -3,6 +3,8 @@ I2C for R-Car platforms
 Required properties:
 - compatible: Must be one of
"renesas,i2c-rcar"
+   "renesas,i2c-rcar-gen1"
+   "renesas,i2c-rcar-gen2"
"renesas,i2c-r8a7778"
"renesas,i2c-r8a7779"
"renesas,i2c-r8a7790"
@@ -24,7 +26,7 @@ Examples :
 i2c0: i2c@e6508000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6508000 0 0x40>;
interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index f3c7139..6f805f8 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -487,6 +487,8 @@ static const struct i2c_algorithm rcar_i2c_algo = {
 
 static const struct of_device_id rcar_i2c_dt_ids[] = {
{ .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-rcar-gen1", .data = (void *)I2C_RCAR_GEN1 
},
+   { .compatible = "renesas,i2c-rcar-gen2", .data = (void *)I2C_RCAR_GEN2 
},
{ .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible

2014-08-05 Thread Kuninori Morimoto

Hi Wolfram, Simon

These patches add R-Car generatoin level
DT compatible on i2c-rcar driver and platform.

Kuninori Morimoto (5):
  i2c: rcar: add renesas,i2c-rcar-gen1/gen2 in DT compatible
  ARM: shmobile: r8a7778: add generation level compatible for i2c
  ARM: shmobile: r8a7779: add generation level compatible for i2c
  ARM: shmobile: r8a7790: add generation level compatible for i2c
  ARM: shmobile: r8a7791: add generation level compatible for i2c

 Documentation/devicetree/bindings/i2c/i2c-rcar.txt |4 +++-
 arch/arm/boot/dts/r8a7778.dtsi |8 
 arch/arm/boot/dts/r8a7779.dtsi |8 
 arch/arm/boot/dts/r8a7790.dtsi |8 
 arch/arm/boot/dts/r8a7791.dtsi |   12 ++--
 drivers/i2c/busses/i2c-rcar.c  |2 ++
 6 files changed, 23 insertions(+), 19 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/11] i2c: rcar: cleanup series

2014-05-28 Thread Kuninori Morimoto

Hi

> Here are some patches to let the rcar driver have a diet without losing
> functionality. IMO the code becomes more readable, too, although mileages may
> vary about this or that change. Bus-free handling is improved, too. Tested 
> with
> renesas-devel-v3.15-rc7-20140526 on a Lager and Koelsch board. The git tree 
> can
> be found here, including one proof-of-concept enablement patch:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
> renesas/rcar-cleanup
> 
> Please test, review, comment.
> 
> Thanks,
> 
>Wolfram
> 
> 
> Wolfram Sang (11):
>   i2c: rcar: not everything needs to be a function
>   i2c: rcar: no need to store irq number
>   i2c: rcar: refactor bus state machine
>   i2c: rcar: refactor irq state machine
>   i2c: rcar: check bus free before first message
>   i2c: rcar: refactor setting up msg
>   i2c: rcar: refactor status bit handling
>   i2c: rcar: remove spinlock
>   i2c: rcar: reuse status bits as enable bits
>   i2c: rcar: janitorial cleanup after refactoring
>   i2c: rcar: update copyright and license information
> 
>  drivers/i2c/busses/i2c-rcar.c | 252 
> ------
>  1 file changed, 48 insertions(+), 204 deletions(-)

For all patches

Acked-by: Kuninori Morimoto 


My small opinion is that keeping comment of "Arbitration lost"
(= "When arbitration lost, device become _slave_ mode")
is helpful for non-renesas freak.
I forgot detail, but, this behavior is not documented (?)

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] I2C: rcar: add R-Car Gen2 and r8a7791 support for DT

2014-04-10 Thread Kuninori Morimoto

Hi Wolfram

Please ignore this
I noticed that it is already included on linux-next

> From: Kuninori Morimoto 
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/i2c/busses/i2c-rcar.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 0282d4d..e7c798e 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -635,9 +635,11 @@ static const struct i2c_algorithm rcar_i2c_algo = {
>  
>  static const struct of_device_id rcar_i2c_dt_ids[] = {
>   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
> + { .compatible = "renesas,i2c-rcar-gen2", .data = (void *)I2C_RCAR_GEN2 
> },
>   { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
>   { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
>   { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
> + { .compatible = "renesas,i2c-r8a7791", .data = (void *)I2C_RCAR_GEN2 },
>   {},
>  };
>  MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] I2C: rcar: add R-Car Gen2 and r8a7791 support for DT

2014-04-10 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 drivers/i2c/busses/i2c-rcar.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 0282d4d..e7c798e 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -635,9 +635,11 @@ static const struct i2c_algorithm rcar_i2c_algo = {
 
 static const struct of_device_id rcar_i2c_dt_ids[] = {
{ .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-rcar-gen2", .data = (void *)I2C_RCAR_GEN2 
},
{ .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
+   { .compatible = "renesas,i2c-r8a7791", .data = (void *)I2C_RCAR_GEN2 },
{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH resend] i2c: rcar: fixup rcar type naming

2013-10-30 Thread Kuninori Morimoto

Hi Wolfram

Thank you for your review

> >  static struct platform_device_id rcar_i2c_id_table[] = {
> > -   { "i2c-rcar",   I2C_RCAR_H1 },
> > -   { "i2c-rcar_h1",I2C_RCAR_H1 },
> > -   { "i2c-rcar_h2",I2C_RCAR_H2 },
> > +   { "i2c-rcar",   I2C_RCAR_GEN1 },
> > +   { "i2c-rcar_gen1",  I2C_RCAR_GEN1 },
> > +   { "i2c-rcar_gen2",  I2C_RCAR_GEN2 },
> > {},
> 
> Renaming the platform_device_ids will cause regressions, too!

The user who is using this driver is using "i2c-rcar" only at this point.
"i2c-rcar_h1/i2c-rcar_h2" user will appear. but not exist now.
So, I think it can keep compatible.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH resend] i2c: rcar: fixup rcar type naming

2013-10-21 Thread Kuninori Morimoto
b720423a2627f045133bec39a31fe2bc0dab86f3
(i2c: rcar: add rcar-H2 support)
added R-Car H2 support on i2c-rcar.

The R-Car I2C type is based on SoC generation
(Gen1 = E1/M1/H1, Gen2 = E2/M2/H2),
but added naming was H1/H2 instead of Gen1/Gen2.
Gen1/Gen2 is better naming on this driver.

Signed-off-by: Kuninori Morimoto 
---
resend
 - exchanged Wolfram's email address

 drivers/i2c/busses/i2c-rcar.c |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 8603f5e..2c2fd7c 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -103,8 +103,8 @@ enum {
 #define ID_NACK(1 << 4)
 
 enum rcar_i2c_type {
-   I2C_RCAR_H1,
-   I2C_RCAR_H2,
+   I2C_RCAR_GEN1,
+   I2C_RCAR_GEN2,
 };
 
 struct rcar_i2c_priv {
@@ -240,10 +240,10 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv 
*priv,
}
 
switch (priv->devtype) {
-   case I2C_RCAR_H1:
+   case I2C_RCAR_GEN1:
cdf_width = 2;
break;
-   case I2C_RCAR_H2:
+   case I2C_RCAR_GEN2:
cdf_width = 3;
break;
default:
@@ -640,10 +640,10 @@ static const struct i2c_algorithm rcar_i2c_algo = {
 };
 
 static const struct of_device_id rcar_i2c_dt_ids[] = {
-   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_H2 },
+   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
@@ -731,9 +731,9 @@ static int rcar_i2c_remove(struct platform_device *pdev)
 }
 
 static struct platform_device_id rcar_i2c_id_table[] = {
-   { "i2c-rcar",   I2C_RCAR_H1 },
-   { "i2c-rcar_h1",I2C_RCAR_H1 },
-   { "i2c-rcar_h2",I2C_RCAR_H2 },
+   { "i2c-rcar",   I2C_RCAR_GEN1 },
+   { "i2c-rcar_gen1",  I2C_RCAR_GEN1 },
+   { "i2c-rcar_gen2",  I2C_RCAR_GEN2 },
{},
 };
 MODULE_DEVICE_TABLE(platform, rcar_i2c_id_table);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ARM: shmobile: r8a7778/r8a7779: add I2C support on DT

2013-10-03 Thread Kuninori Morimoto

I'm sorry
I miss send this email, please ignore it

> Hi Simon
> 
> These patches add I2C support on r8a7778,
> and tidyup missing I2C on r8a7779
> These are based on
>  1) my previous DT patches.
>  2) git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git :: for-next 
> branch
> 
> These is no compile error without 2)..
> 
> Kuninori Morimoto (4):
>   ARM: shmobile: r8a7778: add I2C clock for DT
>   ARM: shmobile: r8a7778: add I2C support on DTSI
>   ARM: shmobile: r8a7779: tidyup I2C driver name on DTSI
>   ARM: shmobile: r8a7779: add I2C clock for DT
> 
>  arch/arm/boot/dts/r8a7778.dtsi |   40 
> 
>  arch/arm/boot/dts/r8a7779.dtsi |8 +++
>  arch/arm/mach-shmobile/clock-r8a7778.c |4 
>  arch/arm/mach-shmobile/clock-r8a7779.c |4 
>  4 files changed, 52 insertions(+), 4 deletions(-)
> 
> Best regards
> ---
> Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] ARM: shmobile: r8a7778/r8a7779: add I2C support on DT

2013-10-03 Thread Kuninori Morimoto

Hi Simon

These patches add I2C support on r8a7778,
and tidyup missing I2C on r8a7779
These are based on
 1) my previous DT patches.
 2) git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git :: for-next 
branch

These is no compile error without 2)..

Kuninori Morimoto (4):
  ARM: shmobile: r8a7778: add I2C clock for DT
  ARM: shmobile: r8a7778: add I2C support on DTSI
  ARM: shmobile: r8a7779: tidyup I2C driver name on DTSI
  ARM: shmobile: r8a7779: add I2C clock for DT

 arch/arm/boot/dts/r8a7778.dtsi |   40 
 arch/arm/boot/dts/r8a7779.dtsi |8 +++
 arch/arm/mach-shmobile/clock-r8a7778.c |4 
 arch/arm/mach-shmobile/clock-r8a7779.c |4 
 4 files changed, 52 insertions(+), 4 deletions(-)

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] i2c: rcar: fixup rcar type naming

2013-10-03 Thread Kuninori Morimoto
b720423a2627f045133bec39a31fe2bc0dab86f3
(i2c: rcar: add rcar-H2 support)
added R-Car H2 support on i2c-rcar.
But the added i2c type naming was H1/H2,
instead of Gen1/Gen2 (Generation 1/2)
Gen1/Gen2 is better naming on this driver.

This patch exchanges rcar_i2c_id_table[],
but it still can keep compatible, since still there is no user
for i2c-rcar_h1/h2 at this point.

Signed-off-by: Kuninori Morimoto 
---
 drivers/i2c/busses/i2c-rcar.c |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 8603f5e..2c2fd7c 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -103,8 +103,8 @@ enum {
 #define ID_NACK(1 << 4)
 
 enum rcar_i2c_type {
-   I2C_RCAR_H1,
-   I2C_RCAR_H2,
+   I2C_RCAR_GEN1,
+   I2C_RCAR_GEN2,
 };
 
 struct rcar_i2c_priv {
@@ -240,10 +240,10 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv 
*priv,
}
 
switch (priv->devtype) {
-   case I2C_RCAR_H1:
+   case I2C_RCAR_GEN1:
cdf_width = 2;
break;
-   case I2C_RCAR_H2:
+   case I2C_RCAR_GEN2:
cdf_width = 3;
break;
default:
@@ -640,10 +640,10 @@ static const struct i2c_algorithm rcar_i2c_algo = {
 };
 
 static const struct of_device_id rcar_i2c_dt_ids[] = {
-   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_H1 },
-   { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_H2 },
+   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
+   { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
@@ -731,9 +731,9 @@ static int rcar_i2c_remove(struct platform_device *pdev)
 }
 
 static struct platform_device_id rcar_i2c_id_table[] = {
-   { "i2c-rcar",   I2C_RCAR_H1 },
-   { "i2c-rcar_h1",I2C_RCAR_H1 },
-   { "i2c-rcar_h2",I2C_RCAR_H2 },
+   { "i2c-rcar",   I2C_RCAR_GEN1 },
+   { "i2c-rcar_gen1",  I2C_RCAR_GEN1 },
+   { "i2c-rcar_gen2",  I2C_RCAR_GEN2 },
{},
 };
 MODULE_DEVICE_TABLE(platform, rcar_i2c_id_table);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] i2c: rcar: modify I2C driver

2013-07-11 Thread Kuninori Morimoto

Hi Wolfram, Dung-san

# I added Wolfram's email address

> From: Nguyen Viet Dung 
> 
> This patch modify calculate for clock in I2C driver.
> 
> Signed-off-by: Nguyen Viet Dung 
> ---

You forgot to add Wolfram's email address on this patch :)

Acked-by: Kuninori Morimoto 

>  drivers/i2c/busses/i2c-rcar.c |   17 +++--
>  include/linux/i2c/i2c-rcar.h  |4 
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 4ba4a95..85987c1 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -221,15 +221,28 @@ static int rcar_i2c_clock_calculate(struct 
> rcar_i2c_priv *priv,
>   struct device *dev)
>  {
>   struct clk *clkp = clk_get(NULL, "peripheral_clk");
> + struct i2c_rcar_platform_data *pdata = dev->platform_data;
>   u32 scgd, cdf;
>   u32 round, ick;
>   u32 scl;
> + u32 cdf_width;
> + u32 flags = pdata ? pdata->flags : 0;
>  
>   if (!clkp) {
>   dev_err(dev, "there is no peripheral_clk\n");
>   return -EIO;
>   }
>  
> + switch (flags & I2C_RCAR_FLAGS_ICCCR_MASK) {
> + default:
> + case I2C_RCAR_FLAGS_ICCCR_IS_2BIT:
> + cdf_width = 2;
> + break;
> + case I2C_RCAR_FLAGS_ICCCR_IS_3BIT:
> + cdf_width = 3;
> + break;
> + }
> +
>   /*
>* calculate SCL clock
>* see
> @@ -245,7 +258,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv 
> *priv,
>* clkp : peripheral_clk
>* F[]  : integer up-valuation
>*/
> - for (cdf = 0; cdf < 4; cdf++) {
> + for (cdf = 0; cdf < (1 << cdf_width); cdf++) {
>   ick = clk_get_rate(clkp) / (1 + cdf);
>   if (ick < 2000)
>   goto ick_find;
> @@ -287,7 +300,7 @@ scgd_find:
>   /*
>* keep icccr value
>*/
> - priv->icccr = (scgd << 2 | cdf);
> + priv->icccr = (scgd << (cdf_width) | cdf);
>  
>   return 0;
>  }
> diff --git a/include/linux/i2c/i2c-rcar.h b/include/linux/i2c/i2c-rcar.h
> index 496f5c2..572a6e5 100644
> --- a/include/linux/i2c/i2c-rcar.h
> +++ b/include/linux/i2c/i2c-rcar.h
> @@ -5,6 +5,10 @@
>  
>  struct i2c_rcar_platform_data {
>   u32 bus_speed;
> + u32 flags;
> +#define I2C_RCAR_FLAGS_ICCCR_MASK(0xF << 0)
> +#define I2C_RCAR_FLAGS_ICCCR_IS_2BIT (0 << 0) /* default */
> +#define I2C_RCAR_FLAGS_ICCCR_IS_3BIT (1 << 0)
>  };
>  
>  #endif /* __I2C_R_CAR_H__ */
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] i2c: rcar: fixup section mismatch on rcar_i2c_probe/remove()

2012-10-30 Thread Kuninori Morimoto
This patch fixup below WARNING

make CONFIG_DEBUG_SECTION_MISMATCH=y
...
WARNING: vmlinux.o(.data+0x11798): Section mismatch in reference from the 
variable rcar_i2c_drv to the function .devinit.text:rcar_i2c_probe()
The variable rcar_i2c_drv references
the function __devinit rcar_i2c_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: vmlinux.o(.data+0x1179c): Section mismatch in reference from the 
variable rcar_i2c_drv to the function .devexit.text:rcar_i2c_remove()
The variable rcar_i2c_drv references
the function __devexit rcar_i2c_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Reported-by: Simon Horman 
Signed-off-by: Kuninori Morimoto 
---
Simon

Is this patch solve your issue ?

 drivers/i2c/busses/i2c-rcar.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index f9399d1..e10e04b 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -613,7 +613,7 @@ static const struct i2c_algorithm rcar_i2c_algo = {
.functionality  = rcar_i2c_func,
 };
 
-static int __devinit rcar_i2c_probe(struct platform_device *pdev)
+static int rcar_i2c_probe(struct platform_device *pdev)
 {
struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;
struct rcar_i2c_priv *priv;
@@ -682,7 +682,7 @@ static int __devinit rcar_i2c_probe(struct platform_device 
*pdev)
return 0;
 }
 
-static int __devexit rcar_i2c_remove(struct platform_device *pdev)
+static int rcar_i2c_remove(struct platform_device *pdev)
 {
struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] i2c: rcar: used devm_request_and_ioremap() instead of devm_ioremap()

2012-10-10 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
based on latest linus/master

 drivers/i2c/busses/i2c-rcar.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index f9399d1..2bce56d 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -642,7 +642,7 @@ static int __devinit rcar_i2c_probe(struct platform_device 
*pdev)
if (ret < 0)
return ret;
 
-   priv->io = devm_ioremap(dev, res->start, resource_size(res));
+   priv->io = devm_request_and_ioremap(dev, res);
if (!priv->io) {
dev_err(dev, "cannot ioremap\n");
return -ENODEV;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] i2c: add Renesas R-Car I2C driver

2012-09-27 Thread Kuninori Morimoto
R-Car I2C is similar with SH7760 I2C.
But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
Thus, it was pointless to keep compatible between SH7760 and R-Car I2C drivers.
This patch creates new Renesas R-Car I2C driver.

Signed-off-by: Kuninori Morimoto 
---
v2 -> v3

 - used simple comment on rcar_i2c_irq_recv()
 - used LOOP_TIMEOUT
 - used pm_runtime_put()
 - used devm_request_irq()

 drivers/i2c/busses/Kconfig|   10 +
 drivers/i2c/busses/Makefile   |1 +
 drivers/i2c/busses/i2c-rcar.c |  709 +
 include/linux/i2c/i2c-rcar.h  |   10 +
 4 files changed, 730 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-rcar.c
 create mode 100644 include/linux/i2c/i2c-rcar.h

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index b4aaa1b..51baa08 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -709,6 +709,16 @@ config I2C_XLR
  This driver can also be built as a module.  If so, the module
  will be called i2c-xlr.
 
+config I2C_RCAR
+   tristate "Renesas R-Car I2C Controller"
+   depends on ARCH_SHMOBILE && I2C
+   help
+ If you say yes to this option, support will be included for the
+ R-Car I2C controller.
+
+ This driver can also be built as a module.  If so, the module
+ will be called i2c-rcar.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index ce3c2be..e98ff51 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE)   += i2c-versatile.o
 obj-$(CONFIG_I2C_OCTEON)   += i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)   += i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)  += i2c-xlr.o
+obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
new file mode 100644
index 000..f9399d1
--- /dev/null
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -0,0 +1,709 @@
+/*
+ *  drivers/i2c/busses/i2c-rcar.c
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * This file is based on the drivers/i2c/busses/i2c-sh7760.c
+ * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
+ *
+ * This file used out-of-tree driver i2c-rcar.c
+ * Copyright (C) 2011-2012 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* register offsets */
+#define ICSCR  0x00/* slave ctrl */
+#define ICMCR  0x04/* master ctrl */
+#define ICSSR  0x08/* slave status */
+#define ICMSR  0x0C/* master status */
+#define ICSIER 0x10/* slave irq enable */
+#define ICMIER 0x14/* master irq enable */
+#define ICCCR  0x18/* clock dividers */
+#define ICSAR  0x1C/* slave address */
+#define ICMAR  0x20/* master address */
+#define ICRXTX 0x24/* data port */
+
+/* ICMCR */
+#define MDBS   (1 << 7)/* non-fifo mode switch */
+#define FSCL   (1 << 6)/* override SCL pin */
+#define FSDA   (1 << 5)/* override SDA pin */
+#define OBPC   (1 << 4)/* override pins */
+#define MIE(1 << 3)/* master if enable */
+#define TSBE   (1 << 2)
+#define FSB(1 << 1)/* force stop bit */
+#define ESG(1 << 0)/* en startbit gen */
+
+/* ICMSR */
+#define MNR(1 << 6)/* nack received */
+#define MAL(1 << 5)/* arbitration lost */
+#define MST(1 << 4)/* sent a stop */
+#define MDE(1 << 3)
+#define MDT(1 << 2)
+#define MDR(1 << 1)
+#define MAT(1 << 0)/* slave addr xfer done */
+
+/* ICMIE */
+#define MNRE   (1 << 6)/* nack irq en */
+#define MALE   (1 << 5)/* arblos irq en */
+#define MSTE   (1 << 4)/* stop irq en */
+#define MDEE   (1 << 3)
+#define MDTE   (1 << 2)
+#define MDRE   (1 << 1)
+#define MATE   (1 << 0)  

Re: [PATCH v2] i2c: add Renesas R-Car I2C driver

2012-09-27 Thread Kuninori Morimoto

Dear Shubhrajyoti

Thank you for your comment.

> Hi A few suggestions,
> 
> On Tue, Aug 28, 2012 at 2:07 PM, Kuninori Morimoto
>  wrote:
> > R-Car I2C is similar with SH7760 I2C.
> > But the SH7760 I2C driver had many workaround operations, since H/W had 
> > bugs.
> > Thus, it was pointless to keep compatible between SH7760 and R-Car I2C 
> > drivers.
> > This patch creates new Renesas R-Car I2C driver.
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> > v1 -> v2
> >
> >  - removed #if 0 function
> >  - add explanation on rcar_i2c_bus_barrier()
> >  - removed IGNORE_NAK support
> >  - rename rcar_i2c_soft_reset() -> rcar_i2c_init()
> >  - removed devm_kfree/devm_iounmap
> >  - __raw_writel/readl => writel/readl
> >  - removed un-needed return from rcar_i2c_bus_phase()
> >  - tidyup calculation method on rcar_i2c_clock_calculate()
> >  - tidyup English type
> >  - tidyup comment to "i2c device disabled"
> >
> >  drivers/i2c/busses/Kconfig|   10 +
> >  drivers/i2c/busses/Makefile   |1 +
> >  drivers/i2c/busses/i2c-rcar.c |  715 
> > +
> >  include/linux/i2c/i2c-rcar.h  |   10 +
> >  4 files changed, 736 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/i2c/busses/i2c-rcar.c
> >  create mode 100644 include/linux/i2c/i2c-rcar.h
> >
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index b4aaa1b..51baa08 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -709,6 +709,16 @@ config I2C_XLR
> >   This driver can also be built as a module.  If so, the module
> >   will be called i2c-xlr.
> >
> > +config I2C_RCAR
> > +   tristate "Renesas R-Car I2C Controller"
> > +   depends on ARCH_SHMOBILE && I2C
> > +   help
> > + If you say yes to this option, support will be included for the
> > + R-Car I2C controller.
> > +
> > + This driver can also be built as a module.  If so, the module
> > + will be called i2c-rcar.
> > +
> >  comment "External I2C/SMBus adapter drivers"
> >
> >  config I2C_DIOLAN_U2C
> > diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> > index ce3c2be..e98ff51 100644
> > --- a/drivers/i2c/busses/Makefile
> > +++ b/drivers/i2c/busses/Makefile
> > @@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE)   += i2c-versatile.o
> >  obj-$(CONFIG_I2C_OCTEON)   += i2c-octeon.o
> >  obj-$(CONFIG_I2C_XILINX)   += i2c-xiic.o
> >  obj-$(CONFIG_I2C_XLR)  += i2c-xlr.o
> > +obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
> >
> >  # External I2C/SMBus adapter drivers
> >  obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > new file mode 100644
> > index 000..bd8fcf1
> > --- /dev/null
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -0,0 +1,715 @@
> > +/*
> > + *  drivers/i2c/busses/i2c-rcar.c
> > + *
> > + * Copyright (C) 2012 Renesas Solutions Corp.
> > + * Kuninori Morimoto 
> > + *
> > + * This file is based on the drivers/i2c/busses/i2c-sh7760.c
> > + * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
> > + *
> > + * This file used out-of-tree driver i2c-rcar.c
> > + * Copyright (C) 2011-2012 Renesas Electronics Corporation
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
> > USA
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* register offsets */

Re: [PATCH v2] i2c: add Renesas R-Car I2C driver

2012-09-27 Thread Kuninori Morimoto

Please teach me current status of this patch ?

> R-Car I2C is similar with SH7760 I2C.
> But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
> Thus, it was pointless to keep compatible between SH7760 and R-Car I2C 
> drivers.
> This patch creates new Renesas R-Car I2C driver.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
> v1 -> v2
> 
>  - removed #if 0 function
>  - add explanation on rcar_i2c_bus_barrier()
>  - removed IGNORE_NAK support
>  - rename rcar_i2c_soft_reset() -> rcar_i2c_init()
>  - removed devm_kfree/devm_iounmap
>  - __raw_writel/readl => writel/readl
>  - removed un-needed return from rcar_i2c_bus_phase()
>  - tidyup calculation method on rcar_i2c_clock_calculate()
>  - tidyup English type
>  - tidyup comment to "i2c device disabled"
> 
>  drivers/i2c/busses/Kconfig|   10 +
>  drivers/i2c/busses/Makefile   |1 +
>  drivers/i2c/busses/i2c-rcar.c |  715 
> +
>  include/linux/i2c/i2c-rcar.h  |   10 +
>  4 files changed, 736 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/busses/i2c-rcar.c
>  create mode 100644 include/linux/i2c/i2c-rcar.h
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index b4aaa1b..51baa08 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -709,6 +709,16 @@ config I2C_XLR
> This driver can also be built as a module.  If so, the module
> will be called i2c-xlr.
>  
> +config I2C_RCAR
> + tristate "Renesas R-Car I2C Controller"
> + depends on ARCH_SHMOBILE && I2C
> + help
> +   If you say yes to this option, support will be included for the
> +   R-Car I2C controller.
> +
> +   This driver can also be built as a module.  If so, the module
> +   will be called i2c-rcar.
> +
>  comment "External I2C/SMBus adapter drivers"
>  
>  config I2C_DIOLAN_U2C
> diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> index ce3c2be..e98ff51 100644
> --- a/drivers/i2c/busses/Makefile
> +++ b/drivers/i2c/busses/Makefile
> @@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
>  obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
>  obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
>  obj-$(CONFIG_I2C_XLR)+= i2c-xlr.o
> +obj-$(CONFIG_I2C_RCAR)   += i2c-rcar.o
>  
>  # External I2C/SMBus adapter drivers
>  obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> new file mode 100644
> index 000..bd8fcf1
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -0,0 +1,715 @@
> +/*
> + *  drivers/i2c/busses/i2c-rcar.c
> + *
> + * Copyright (C) 2012 Renesas Solutions Corp.
> + * Kuninori Morimoto 
> + *
> + * This file is based on the drivers/i2c/busses/i2c-sh7760.c
> + * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
> + *
> + * This file used out-of-tree driver i2c-rcar.c
> + * Copyright (C) 2011-2012 Renesas Electronics Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* register offsets */
> +#define ICSCR0x00/* slave ctrl */
> +#define ICMCR0x04/* master ctrl */
> +#define ICSSR0x08/* slave status */
> +#define ICMSR0x0C/* master status */
> +#define ICSIER   0x10/* slave irq enable */
> +#define ICMIER   0x14/* master irq enable */
> +#define ICCCR0x18/* clock dividers */
> +#define ICSAR0x1C/* slave address */
> +#define ICMAR0x20/* master address */
> +#define ICRXTX   0x24/* data port */
> +
> +/* ICMCR */
> +#define MDBS (1 << 7)/* non-fifo mode switch */
> +#define FSCL (1

[PATCH v2] i2c: add Renesas R-Car I2C driver

2012-08-28 Thread Kuninori Morimoto
R-Car I2C is similar with SH7760 I2C.
But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
Thus, it was pointless to keep compatible between SH7760 and R-Car I2C drivers.
This patch creates new Renesas R-Car I2C driver.

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2

 - removed #if 0 function
 - add explanation on rcar_i2c_bus_barrier()
 - removed IGNORE_NAK support
 - rename rcar_i2c_soft_reset() -> rcar_i2c_init()
 - removed devm_kfree/devm_iounmap
 - __raw_writel/readl => writel/readl
 - removed un-needed return from rcar_i2c_bus_phase()
 - tidyup calculation method on rcar_i2c_clock_calculate()
 - tidyup English type
 - tidyup comment to "i2c device disabled"

 drivers/i2c/busses/Kconfig|   10 +
 drivers/i2c/busses/Makefile   |1 +
 drivers/i2c/busses/i2c-rcar.c |  715 +
 include/linux/i2c/i2c-rcar.h  |   10 +
 4 files changed, 736 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-rcar.c
 create mode 100644 include/linux/i2c/i2c-rcar.h

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index b4aaa1b..51baa08 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -709,6 +709,16 @@ config I2C_XLR
  This driver can also be built as a module.  If so, the module
  will be called i2c-xlr.
 
+config I2C_RCAR
+   tristate "Renesas R-Car I2C Controller"
+   depends on ARCH_SHMOBILE && I2C
+   help
+ If you say yes to this option, support will be included for the
+ R-Car I2C controller.
+
+ This driver can also be built as a module.  If so, the module
+ will be called i2c-rcar.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index ce3c2be..e98ff51 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE)   += i2c-versatile.o
 obj-$(CONFIG_I2C_OCTEON)   += i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)   += i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)  += i2c-xlr.o
+obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
new file mode 100644
index 000..bd8fcf1
--- /dev/null
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -0,0 +1,715 @@
+/*
+ *  drivers/i2c/busses/i2c-rcar.c
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * This file is based on the drivers/i2c/busses/i2c-sh7760.c
+ * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
+ *
+ * This file used out-of-tree driver i2c-rcar.c
+ * Copyright (C) 2011-2012 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* register offsets */
+#define ICSCR  0x00/* slave ctrl */
+#define ICMCR  0x04/* master ctrl */
+#define ICSSR  0x08/* slave status */
+#define ICMSR  0x0C/* master status */
+#define ICSIER 0x10/* slave irq enable */
+#define ICMIER 0x14/* master irq enable */
+#define ICCCR  0x18/* clock dividers */
+#define ICSAR  0x1C/* slave address */
+#define ICMAR  0x20/* master address */
+#define ICRXTX 0x24/* data port */
+
+/* ICMCR */
+#define MDBS   (1 << 7)/* non-fifo mode switch */
+#define FSCL   (1 << 6)/* override SCL pin */
+#define FSDA   (1 << 5)/* override SDA pin */
+#define OBPC   (1 << 4)/* override pins */
+#define MIE(1 << 3)/* master if enable */
+#define TSBE   (1 << 2)
+#define FSB(1 << 1)/* force stop bit */
+#define ESG(1 << 0)/* en startbit gen */
+
+/* ICMSR */
+#define MNR(1 << 6)/* nack received */
+#define MAL(1 << 5)/* arbitration lost */
+#define MST(1 << 4)/* sent a stop */
+#define MDE(1 << 3)
+#define MDT(1 << 2)
+#define MDR(1 << 1)
+#define MAT(1 << 0)/* slave addr xfer done */
+
+

Re: [PATCH] i2c: add Renesas R-Car I2C driver

2012-08-28 Thread Kuninori Morimoto

Hi Shubhrajyoti

> > Thank you for checking patch.
> > I create v2 patch and post it soon.
> > There is not big reason, but I would like to keep adap->retries for now.
> >
> Or maybe just wait for Jean's advice on the same.

I see.
After Jean's advice, I will send v2 patch.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: add Renesas R-Car I2C driver

2012-08-28 Thread Kuninori Morimoto

Hi Phil

Thank you for your comments

> > +static void rcar_i2c_write(struct rcar_i2c_priv *priv, int reg, u32 
> val)
> > +{
> > +   __raw_writel(val, priv->io + reg);
> > +}
> > +
> > +static u32 rcar_i2c_read(struct rcar_i2c_priv *priv, int reg)
> > +{
> > +   return __raw_readl(priv->io + reg);
> > +}
> I think we should use writel/readl here. We have a number of devices where 
> the virtual address map conflicts with register addresses for other 
> peripherals.

OK. I will fix it.


> > +static void rcar_i2c_bus_phase(struct rcar_i2c_priv *priv, int phase)
> > +{
> > +   switch (phase) {
> > +   case RCAR_BUS_PHASE_ADDR:
> > +  rcar_i2c_write(priv, ICMCR, MDBS | MIE | ESG);
> > +  break;
> > +   case RCAR_BUS_PHASE_DATA:
> > +  rcar_i2c_write(priv, ICMCR, MDBS | MIE);
> > +  break;
> > +   case RCAR_BUS_PHASE_STOP:
> > +  rcar_i2c_write(priv, ICMCR, MDBS | MIE | FSB);
> > +  break;
> > +   }
> > +
> > +   return;
> > +}
> Don't need the return.

indeed. thanks

> > +   /*
> > +* use 95% bus speed for safety.
> > +*/
> > +   bus_speed = bus_speed * 95 / 100;
> Why do you use 95% of the bus speed? Surely, either the hardware supports 
> a specific speed or it doesn't.
(snip)
> > +   /*
> > +* it is impossible to calculate large scale
> > +* number on u32
> > +*
> > +* F[(ticf + tr + intd) * ick]
> > +*  = F[(35 + 200 + 50)ns * ick]
> > +*  = F[285 * ick / 10]
> > +*  = F[(ick / 100) * 285 / 1000]
> > +*/
> > +   round = (ick + 50) / 100 * 285;
> > +   round = (round + 500) / 1000;
> Now that I see this, I guess that you used 95% bus clock due to rounding 
> errors here. If so, maybe it would be better to try to improve this 
> calculation.

Indeed, thanks.

> typo: happend => happened 
> typo: finised => finished
> typo: happend => happened 

Haha :)
Sorry for my English.

> > +static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
> > +struct i2c_msg *msgs,
> > +int num)
> > +{
> > +   struct rcar_i2c_priv *priv = i2c_get_adapdata(adap);
> > +   struct device *dev = rcar_i2c_priv_to_dev(priv);
> > +   unsigned long flags;
> > +   int i, ret, timeout;
> > +
> > +   /*== enable i2c device ===*/
> > +   pm_runtime_get_sync(dev);
(snip)
> > +   pm_runtime_put_sync(dev);
> > +   /*== disable i2c device ===*/
> This comment should be above the previous line, unless you the comment is 
> meant to say "i2c device disabled"

I see.


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: add Renesas R-Car I2C driver

2012-08-27 Thread Kuninori Morimoto

Hi Shubhrajyoti

Thank you for checking patch.
I create v2 patch and post it soon.
There is not big reason, but I would like to keep adap->retries for now.

> On Wed, Jul 25, 2012 at 12:06 PM, Kuninori Morimoto
>  wrote:
> > R-Car I2C is similar with SH7760 I2C.
> > But the SH7760 I2C driver had many workaround operations, since H/W had 
> > bugs.
> > Thus, it was pointless to keep compatible between SH7760 and R-Car I2C 
> > drivers.
> > This patch creates new Renesas R-Car I2C driver.
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >  drivers/i2c/busses/Kconfig|   10 +
> >  drivers/i2c/busses/Makefile   |1 +
> >  drivers/i2c/busses/i2c-rcar.c |  741 
> > +
> >  include/linux/i2c/i2c-rcar.h  |   10 +
> >  4 files changed, 762 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/i2c/busses/i2c-rcar.c
> >  create mode 100644 include/linux/i2c/i2c-rcar.h
> >
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index 7244c8b..3175c81 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -704,6 +704,16 @@ config I2C_XLR
> >   This driver can also be built as a module.  If so, the module
> >   will be called i2c-xlr.
> >
> > +config I2C_RCAR
> > +   tristate "Renesas R-Car I2C Controller"
> > +   depends on ARCH_SHMOBILE && I2C
> > +   help
> > + If you say yes to this option, support will be included for the
> > + R-Car I2C controller.
> > +
> > + This driver can also be built as a module.  If so, the module
> > + will be called i2c-rcar.
> > +
> >  comment "External I2C/SMBus adapter drivers"
> >
> >  config I2C_DIOLAN_U2C
> > diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> > index ce3c2be..e98ff51 100644
> > --- a/drivers/i2c/busses/Makefile
> > +++ b/drivers/i2c/busses/Makefile
> > @@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE)   += i2c-versatile.o
> >  obj-$(CONFIG_I2C_OCTEON)   += i2c-octeon.o
> >  obj-$(CONFIG_I2C_XILINX)   += i2c-xiic.o
> >  obj-$(CONFIG_I2C_XLR)  += i2c-xlr.o
> > +obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
> >
> >  # External I2C/SMBus adapter drivers
> >  obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > new file mode 100644
> > index 000..2993cab
> > --- /dev/null
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -0,0 +1,741 @@
> > +/*
> > + *  drivers/i2c/busses/i2c-rcar.c
> > + *
> > + * Copyright (C) 2012 Renesas Solutions Corp.
> > + * Kuninori Morimoto 
> > + *
> > + * This file is based on the drivers/i2c/busses/i2c-sh7760.c
> > + * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
> > + *
> > + * This file used out-of-tree driver i2c-rcar.c
> > + * Copyright (C) 2011-2012 Renesas Electronics Corporation
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
> > USA
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* register offsets */
> > +#define ICSCR  0x00/* slave ctrl */
> > +#define ICMCR  0x04/* master ctrl */
> > +#define ICSSR  0x08/* slave status */
> > +#define ICMSR  0x0C/* master status */
> > +#define ICSIER 0x10/* slave irq enable */
> > +#define ICMIER 0x14/* master irq enable */
> > +#define ICCCR  0x18/* clock dividers */
> > +#define ICSAR  0x1C/* slave address */
> > +#define ICMAR  0x20/* maste

Re: [PATCH] i2c: add Renesas R-Car I2C driver

2012-08-27 Thread Kuninori Morimoto

Hi

Does this patch go to next linux kernel (v3.7) ?
Or was rejected ?

At Tue, 24 Jul 2012 23:36:41 -0700 (PDT),
【RSO】森本 wrote:
> 
> R-Car I2C is similar with SH7760 I2C.
> But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
> Thus, it was pointless to keep compatible between SH7760 and R-Car I2C 
> drivers.
> This patch creates new Renesas R-Car I2C driver.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/i2c/busses/Kconfig|   10 +
>  drivers/i2c/busses/Makefile   |1 +
>  drivers/i2c/busses/i2c-rcar.c |  741 
> +
>  include/linux/i2c/i2c-rcar.h  |   10 +
>  4 files changed, 762 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/busses/i2c-rcar.c
>  create mode 100644 include/linux/i2c/i2c-rcar.h
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 7244c8b..3175c81 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -704,6 +704,16 @@ config I2C_XLR
> This driver can also be built as a module.  If so, the module
> will be called i2c-xlr.
>  
> +config I2C_RCAR
> + tristate "Renesas R-Car I2C Controller"
> + depends on ARCH_SHMOBILE && I2C
> + help
> +   If you say yes to this option, support will be included for the
> +   R-Car I2C controller.
> +
> +   This driver can also be built as a module.  If so, the module
> +   will be called i2c-rcar.
> +
>  comment "External I2C/SMBus adapter drivers"
>  
>  config I2C_DIOLAN_U2C
> diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> index ce3c2be..e98ff51 100644
> --- a/drivers/i2c/busses/Makefile
> +++ b/drivers/i2c/busses/Makefile
> @@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
>  obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
>  obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
>  obj-$(CONFIG_I2C_XLR)+= i2c-xlr.o
> +obj-$(CONFIG_I2C_RCAR)   += i2c-rcar.o
>  
>  # External I2C/SMBus adapter drivers
>  obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> new file mode 100644
> index 000..2993cab
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -0,0 +1,741 @@
> +/*
> + *  drivers/i2c/busses/i2c-rcar.c
> + *
> + * Copyright (C) 2012 Renesas Solutions Corp.
> + * Kuninori Morimoto 
> + *
> + * This file is based on the drivers/i2c/busses/i2c-sh7760.c
> + * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
> + *
> + * This file used out-of-tree driver i2c-rcar.c
> + * Copyright (C) 2011-2012 Renesas Electronics Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* register offsets */
> +#define ICSCR0x00/* slave ctrl */
> +#define ICMCR0x04/* master ctrl */
> +#define ICSSR0x08/* slave status */
> +#define ICMSR0x0C/* master status */
> +#define ICSIER   0x10/* slave irq enable */
> +#define ICMIER   0x14/* master irq enable */
> +#define ICCCR0x18/* clock dividers */
> +#define ICSAR0x1C/* slave address */
> +#define ICMAR0x20/* master address */
> +#define ICRXTX   0x24/* data port */
> +
> +/* ICMCR */
> +#define MDBS (1 << 7)/* non-fifo mode switch */
> +#define FSCL (1 << 6)/* override SCL pin */
> +#define FSDA (1 << 5)/* override SDA pin */
> +#define OBPC (1 << 4)/* override pins */
> +#define MIE  (1 << 3)/* master if enable */
> +#define TSBE (1 << 2)
> +#define FSB  (1 << 1)/* force stop bit */
> +#define ESG  (1 << 0)/* en startbit gen */
> +
> +/* ICMSR */

[PATCH] i2c: add Renesas R-Car I2C driver

2012-07-24 Thread Kuninori Morimoto
R-Car I2C is similar with SH7760 I2C.
But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
Thus, it was pointless to keep compatible between SH7760 and R-Car I2C drivers.
This patch creates new Renesas R-Car I2C driver.

Signed-off-by: Kuninori Morimoto 
---
 drivers/i2c/busses/Kconfig|   10 +
 drivers/i2c/busses/Makefile   |1 +
 drivers/i2c/busses/i2c-rcar.c |  741 +
 include/linux/i2c/i2c-rcar.h  |   10 +
 4 files changed, 762 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-rcar.c
 create mode 100644 include/linux/i2c/i2c-rcar.h

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 7244c8b..3175c81 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -704,6 +704,16 @@ config I2C_XLR
  This driver can also be built as a module.  If so, the module
  will be called i2c-xlr.
 
+config I2C_RCAR
+   tristate "Renesas R-Car I2C Controller"
+   depends on ARCH_SHMOBILE && I2C
+   help
+ If you say yes to this option, support will be included for the
+ R-Car I2C controller.
+
+ This driver can also be built as a module.  If so, the module
+ will be called i2c-rcar.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index ce3c2be..e98ff51 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_VERSATILE)   += i2c-versatile.o
 obj-$(CONFIG_I2C_OCTEON)   += i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)   += i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)  += i2c-xlr.o
+obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
new file mode 100644
index 000..2993cab
--- /dev/null
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -0,0 +1,741 @@
+/*
+ *  drivers/i2c/busses/i2c-rcar.c
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * This file is based on the drivers/i2c/busses/i2c-sh7760.c
+ * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss 
+ *
+ * This file used out-of-tree driver i2c-rcar.c
+ * Copyright (C) 2011-2012 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* register offsets */
+#define ICSCR  0x00/* slave ctrl */
+#define ICMCR  0x04/* master ctrl */
+#define ICSSR  0x08/* slave status */
+#define ICMSR  0x0C/* master status */
+#define ICSIER 0x10/* slave irq enable */
+#define ICMIER 0x14/* master irq enable */
+#define ICCCR  0x18/* clock dividers */
+#define ICSAR  0x1C/* slave address */
+#define ICMAR  0x20/* master address */
+#define ICRXTX 0x24/* data port */
+
+/* ICMCR */
+#define MDBS   (1 << 7)/* non-fifo mode switch */
+#define FSCL   (1 << 6)/* override SCL pin */
+#define FSDA   (1 << 5)/* override SDA pin */
+#define OBPC   (1 << 4)/* override pins */
+#define MIE(1 << 3)/* master if enable */
+#define TSBE   (1 << 2)
+#define FSB(1 << 1)/* force stop bit */
+#define ESG(1 << 0)/* en startbit gen */
+
+/* ICMSR */
+#define MNR(1 << 6)/* nack received */
+#define MAL(1 << 5)/* arbitration lost */
+#define MST(1 << 4)/* sent a stop */
+#define MDE(1 << 3)
+#define MDT(1 << 2)
+#define MDR(1 << 1)
+#define MAT(1 << 0)/* slave addr xfer done */
+
+/* ICMIE */
+#define MNRE   (1 << 6)/* nack irq en */
+#define MALE   (1 << 5)/* arblos irq en */
+#define MSTE   (1 << 4)/* stop irq en */
+#define MDEE   (1 << 3)
+#define MDTE   (1 << 2)
+#define MDRE   (1 << 1)
+#define MATE   (1 << 0)/* address sent irq en */
+
+
+enum {
+   RCAR_BUS_PHASE_ADDR,
+   RCAR_BUS_PHASE_DATA,
+   RCAR_BUS_PHASE

Re: [PATCH] i2c: Add support SuperH SH7734 I2C bus controller

2012-04-15 Thread Kuninori Morimoto

Hi Iwamatsu-san

> > I guess R-Car is not same as this I2C.
> > And sorry, SH7734 seems not same as SH-NAVI.
> > Now I'm checking the series.
> > Please wait.
> >
> 
> I already checked SH7775 and SH7776. These are SH-NAVI series.
> But these CPU's are constitution unlike I2C of SH7734.

I got the information about it this morning.
SH7734 I2C came from SH7266, and it came from SH-NaviJ3.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: Add support SuperH SH7734 I2C bus controller

2012-04-13 Thread Kuninori Morimoto

Hi Iwamatsu-san

> Well, the SH-NAVI series hss I2C.
> However, I assume it support only for SH7734 because bus width and
> register constitution are different.
> If you point it out about R-Car, I will examine R-Car. (R-Car is not SH-NAVI).

I guess R-Car is not same as this I2C.
And sorry, SH7734 seems not same as SH-NAVI.
Now I'm checking the series.
Please wait.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: Add support SuperH SH7734 I2C bus controller

2012-04-11 Thread Kuninori Morimoto

Hi Iwamatsu-san

> This is the SuperH SH7734 I2C Controller Driver.
> A simple Master only support driver for the I2C included in processors SH7734 
> only.
> 
> Signed-off-by: Nobuhiro Iwamatsu 
> ---

I guess we can use this I2C driver in other SuperH Navi series.
(not only SH7734 CPU)

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about i2c_xxx function on CONFIG_I2C

2011-06-27 Thread kuninori . morimoto . gx

Dear Jean

Thank you for your advice

> I don't think this is a good idea in general. If the kernel lacks I2C
> support, and your code uses it, then this is dead code, and you're much
> better excluding that code completely from your build. Most likely
> you'll be able to drop whole functions. I wouldn't count on the
> compiler to optimize it all properly, and you said you want a very
> small kernel.
> 
> Of course we could make better comments if we could see your actual
> code. Maybe some ifdef magic in i2c.h would make sense for a few items,
> as we already do for i2c_register_board_info for example.

I understand, thank you.
I use #ifdef for it.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Question about i2c_xxx function on CONFIG_I2C

2011-06-27 Thread kuninori . morimoto . gx

Dear all

I'm using i2c_xxx function on some board.
And sometimes I need very small kernel which doesn't need CONFIG_I2C.

But then (.config doesn't have CONFIG_I2C), the compile will fail.
like this

error: implicit declaration of function 'i2c_get_adapter'
error: implicit declaration of function 'i2c_transfer'

In this case, should I use #ifdef CONFIG_I2C in my code to solve this compile 
issue ?
Or is below #else in i2c.h good idea ?

--- i2c.h -
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
...
extern struct i2c_adapter *i2c_get_adapter(int nr);
...
#else
...
#define i2c_get_adapter(nr) NULL
...
#endif


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question] RTC probe isn't called

2009-08-31 Thread Kuninori Morimoto

Dear all

> Now I'm creating SuperH board code.
> and I2C-RTC driver probe function isn't called in boot.

Thank you
Now I could solve this problem.
The criminal was "device_initcall".
how stupid am I ...

Best regards
--
Kuninori Morimoto
 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Question] RTC probe isn't called

2009-08-27 Thread Kuninori Morimoto

Dear all

Now I'm creating SuperH board code.
and I2C-RTC driver probe function isn't called in boot.

other I2C devices (I2C-camera) works well for me.
my I2C busses is i2c-sh_mobile.c
I would like to use r2025sd RTC which is attached
to I2C1 on my board.

What should I do ?
where should I check ?
Now I'm doing...

***
* on platform code
***

/* I2C device */
static struct i2c_board_info i2c1_devices[] = {
{
I2C_BOARD_INFO("r2025sd", 0x32),
},
};
...

static int __init devices_setup(void)
{
...
/* enable I2C1 device */
i2c_register_board_info(1, i2c1_devices,
ARRAY_SIZE(i2c1_devices));
...
}
device_initcall(devices_setup);


*  my .config

CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_HELPER_AUTO=y

...
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
...

CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
...

CONFIG_RTC_DRV_RS5C372=y
...

*
I tried add debug printk
*
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -721,6 +721,7 @@ static struct i2c_driver rs5c372_driver = {

 static __init int rs5c372_init(void)
 {
+   printk("* rs5c372_init\n");
return i2c_add_driver(&rs5c372_driver);
 }

**
 the log is
**

hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
* rs5c372_init
i2c /dev entries driver
Linux video capture interface: v2.00
camera 0-0: SuperH Mobile CEU driver attached to camera 0
...
-
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html