linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rtx: x1205: Add DT bindings
@ 2019-01-31 15:06 Linus Walleij
  2019-01-31 15:06 ` [PATCH 2/2] rtc: x1205: Add DT probing support Linus Walleij
  2019-02-07 20:42 ` [PATCH 1/2] rtx: x1205: Add DT bindings Alexandre Belloni
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Walleij @ 2019-01-31 15:06 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: linux-rtc, Linus Walleij, devicetree

This adds device tree bindings for the Xircom X1205 RTC found
in the Linksys NSLU2.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../devicetree/bindings/rtc/xircom,x1205.txt         | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/xircom,x1205.txt

diff --git a/Documentation/devicetree/bindings/rtc/xircom,x1205.txt b/Documentation/devicetree/bindings/rtc/xircom,x1205.txt
new file mode 100644
index 000000000000..3e3102a32728
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/xircom,x1205.txt
@@ -0,0 +1,12 @@
+* Xircom X1205 I2C RTC
+
+Required properties:
+- compatible: Should be "xircom,x1205"
+- reg: I2C address
+
+Example:
+
+rtc@6f {
+	compatible = "xicor,x1205";
+	reg = <0x6f>;
+};
-- 
2.20.1


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

* [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-01-31 15:06 [PATCH 1/2] rtx: x1205: Add DT bindings Linus Walleij
@ 2019-01-31 15:06 ` Linus Walleij
  2019-01-31 15:30   ` Alexandre Belloni
  2019-02-07 20:42   ` Alexandre Belloni
  2019-02-07 20:42 ` [PATCH 1/2] rtx: x1205: Add DT bindings Alexandre Belloni
  1 sibling, 2 replies; 8+ messages in thread
From: Linus Walleij @ 2019-01-31 15:06 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: linux-rtc, Linus Walleij

This makes it possible to probe the X1205 RTC from the
device tree. This is needed when adding device tree boot
support for the IXP4xx-based NSLU2 which has this RTC.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/rtc/rtc-x1205.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index f08f18e4fcdf..c2b64c9363da 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -673,9 +673,15 @@ static const struct i2c_device_id x1205_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, x1205_id);
 
+static const struct of_device_id x1205_dt_ids[] = {
+	{ .compatible = "xircom,x1205", },
+};
+MODULE_DEVICE_TABLE(of, x1205_dt_ids);
+
 static struct i2c_driver x1205_driver = {
 	.driver		= {
 		.name	= "rtc-x1205",
+		.of_match_table = x1205_dt_ids,
 	},
 	.probe		= x1205_probe,
 	.remove		= x1205_remove,
-- 
2.20.1


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

* Re: [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-01-31 15:06 ` [PATCH 2/2] rtc: x1205: Add DT probing support Linus Walleij
@ 2019-01-31 15:30   ` Alexandre Belloni
  2019-02-01 12:22     ` Linus Walleij
  2019-02-07 20:42   ` Alexandre Belloni
  1 sibling, 1 reply; 8+ messages in thread
From: Alexandre Belloni @ 2019-01-31 15:30 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Alessandro Zummo, linux-rtc

Hi Linus,

On 31/01/2019 16:06:42+0100, Linus Walleij wrote:
> This makes it possible to probe the X1205 RTC from the
> device tree. This is needed when adding device tree boot
> support for the IXP4xx-based NSLU2 which has this RTC.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/rtc/rtc-x1205.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
> index f08f18e4fcdf..c2b64c9363da 100644
> --- a/drivers/rtc/rtc-x1205.c
> +++ b/drivers/rtc/rtc-x1205.c
> @@ -673,9 +673,15 @@ static const struct i2c_device_id x1205_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, x1205_id);
>  
> +static const struct of_device_id x1205_dt_ids[] = {
> +	{ .compatible = "xircom,x1205", },
> +};
> +MODULE_DEVICE_TABLE(of, x1205_dt_ids);
> +

I think this is not necessary and this will probe without the
of_match_table but it doesn't hurt either.

>  static struct i2c_driver x1205_driver = {
>  	.driver		= {
>  		.name	= "rtc-x1205",
> +		.of_match_table = x1205_dt_ids,
>  	},
>  	.probe		= x1205_probe,
>  	.remove		= x1205_remove,
> -- 
> 2.20.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-01-31 15:30   ` Alexandre Belloni
@ 2019-02-01 12:22     ` Linus Walleij
  2019-02-01 14:13       ` Alexandre Belloni
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2019-02-01 12:22 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Lee Jones; +Cc: Alessandro Zummo, linux-rtc

On Thu, Jan 31, 2019 at 4:30 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> On 31/01/2019 16:06:42+0100, Linus Walleij wrote:

> > This makes it possible to probe the X1205 RTC from the
> > device tree. This is needed when adding device tree boot
> > support for the IXP4xx-based NSLU2 which has this RTC.
> >
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> >  drivers/rtc/rtc-x1205.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
> > index f08f18e4fcdf..c2b64c9363da 100644
> > --- a/drivers/rtc/rtc-x1205.c
> > +++ b/drivers/rtc/rtc-x1205.c
> > @@ -673,9 +673,15 @@ static const struct i2c_device_id x1205_id[] = {
> >  };
> >  MODULE_DEVICE_TABLE(i2c, x1205_id);
> >
> > +static const struct of_device_id x1205_dt_ids[] = {
> > +     { .compatible = "xircom,x1205", },
> > +};
> > +MODULE_DEVICE_TABLE(of, x1205_dt_ids);
> > +
>
> I think this is not necessary and this will probe without the
> of_match_table but it doesn't hurt either.

In the earlier implementations of device tree it was done
such that the device node would match the i2c name and
then the device would probe, such that if I in my device
tree name it:

x1205@6f {
    reg = <>;
};

Then the core will see match that node name to the i2c
device name. (I think this goes way back, possibly to the
earliest Open Firmware.)

However the DT maintainers have more and more pushed
for DT nodes to have functional name, so this would then
be named:

rtc@6f {
    reg = <>;
};

And then it stops working.

I think Lee Jones added the compatible probing to a bunch
of I2C devices for this reason.

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-02-01 12:22     ` Linus Walleij
@ 2019-02-01 14:13       ` Alexandre Belloni
  2019-02-01 21:29         ` Linus Walleij
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Belloni @ 2019-02-01 14:13 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Rob Herring, Lee Jones, Alessandro Zummo, linux-rtc

On 01/02/2019 13:22:57+0100, Linus Walleij wrote:
> On Thu, Jan 31, 2019 at 4:30 PM Alexandre Belloni
> <alexandre.belloni@bootlin.com> wrote:
> > On 31/01/2019 16:06:42+0100, Linus Walleij wrote:
> 
> > > This makes it possible to probe the X1205 RTC from the
> > > device tree. This is needed when adding device tree boot
> > > support for the IXP4xx-based NSLU2 which has this RTC.
> > >
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > >  drivers/rtc/rtc-x1205.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
> > > index f08f18e4fcdf..c2b64c9363da 100644
> > > --- a/drivers/rtc/rtc-x1205.c
> > > +++ b/drivers/rtc/rtc-x1205.c
> > > @@ -673,9 +673,15 @@ static const struct i2c_device_id x1205_id[] = {
> > >  };
> > >  MODULE_DEVICE_TABLE(i2c, x1205_id);
> > >
> > > +static const struct of_device_id x1205_dt_ids[] = {
> > > +     { .compatible = "xircom,x1205", },
> > > +};
> > > +MODULE_DEVICE_TABLE(of, x1205_dt_ids);
> > > +
> >
> > I think this is not necessary and this will probe without the
> > of_match_table but it doesn't hurt either.
> 
> In the earlier implementations of device tree it was done
> such that the device node would match the i2c name and
> then the device would probe, such that if I in my device
> tree name it:
> 
> x1205@6f {
>     reg = <>;
> };
> 
> Then the core will see match that node name to the i2c
> device name. (I think this goes way back, possibly to the
> earliest Open Firmware.)
> 
> However the DT maintainers have more and more pushed
> for DT nodes to have functional name, so this would then
> be named:
> 
> rtc@6f {
>     reg = <>;
> };
> 
> And then it stops working.
> 
> I think Lee Jones added the compatible probing to a bunch
> of I2C devices for this reason.
> 

Well, that is not what I was referring to. You could use:

rtc@6f {
     compatible = "xircom,x1205";
     reg = <0x6f>;
};

And this would already probe without having an of_device_id table
because the i2c core is matching the compatibles with the i2c_device_id
table.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-02-01 14:13       ` Alexandre Belloni
@ 2019-02-01 21:29         ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2019-02-01 21:29 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Rob Herring, Lee Jones, Alessandro Zummo, linux-rtc

Hi Alexandre,

On Fri, Feb 1, 2019 at 3:13 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> On 01/02/2019 13:22:57+0100, Linus Walleij wrote:

> > In the earlier implementations of device tree it was done
> > such that the device node would match the i2c name and
> > then the device would probe, such that if I in my device
> > tree name it:
> >
> > x1205@6f {
> >     reg = <>;
> > };
> >
> > Then the core will see match that node name to the i2c
> > device name. (I think this goes way back, possibly to the
> > earliest Open Firmware.)
> >
> > However the DT maintainers have more and more pushed
> > for DT nodes to have functional name, so this would then
> > be named:
> >
> > rtc@6f {
> >     reg = <>;
> > };
> >
> > And then it stops working.
> >
> > I think Lee Jones added the compatible probing to a bunch
> > of I2C devices for this reason.
> >
>
> Well, that is not what I was referring to.

Oh sorry for my ignorance, it's the only mechanism I ever
heard of...

> You could use:
>
> rtc@6f {
>      compatible = "xircom,x1205";
>      reg = <0x6f>;
> };
>
> And this would already probe without having an of_device_id table
> because the i2c core is matching the compatibles with the i2c_device_id
> table.

Oh interesting! There is some code in i2c-core-of.c that strips the "vendor,"
part and matches on the last part of the compatible, but it is named
i2c_of_match_device_sysfs() so one think it only apply to devices
added through sysfs. But indeed seems to be used for everything.

That's a neat trick!

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] rtx: x1205: Add DT bindings
  2019-01-31 15:06 [PATCH 1/2] rtx: x1205: Add DT bindings Linus Walleij
  2019-01-31 15:06 ` [PATCH 2/2] rtc: x1205: Add DT probing support Linus Walleij
@ 2019-02-07 20:42 ` Alexandre Belloni
  1 sibling, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-02-07 20:42 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Alessandro Zummo, linux-rtc, devicetree

Hi,

On 31/01/2019 16:06:41+0100, Linus Walleij wrote:
> This adds device tree bindings for the Xircom X1205 RTC found
> in the Linksys NSLU2.
> 
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  .../devicetree/bindings/rtc/xircom,x1205.txt         | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rtc/xircom,x1205.txt
> 

I chose to not apply that one and instead amend your following patch to
add the compatible with the trivial RTCs in rtc.txt

> diff --git a/Documentation/devicetree/bindings/rtc/xircom,x1205.txt b/Documentation/devicetree/bindings/rtc/xircom,x1205.txt
> new file mode 100644
> index 000000000000..3e3102a32728
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/xircom,x1205.txt
> @@ -0,0 +1,12 @@
> +* Xircom X1205 I2C RTC
> +
> +Required properties:
> +- compatible: Should be "xircom,x1205"
> +- reg: I2C address
> +
> +Example:
> +
> +rtc@6f {
> +	compatible = "xicor,x1205";
> +	reg = <0x6f>;
> +};
> -- 
> 2.20.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 2/2] rtc: x1205: Add DT probing support
  2019-01-31 15:06 ` [PATCH 2/2] rtc: x1205: Add DT probing support Linus Walleij
  2019-01-31 15:30   ` Alexandre Belloni
@ 2019-02-07 20:42   ` Alexandre Belloni
  1 sibling, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-02-07 20:42 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Alessandro Zummo, linux-rtc

On 31/01/2019 16:06:42+0100, Linus Walleij wrote:
> This makes it possible to probe the X1205 RTC from the
> device tree. This is needed when adding device tree boot
> support for the IXP4xx-based NSLU2 which has this RTC.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/rtc/rtc-x1205.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2019-02-07 20:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 15:06 [PATCH 1/2] rtx: x1205: Add DT bindings Linus Walleij
2019-01-31 15:06 ` [PATCH 2/2] rtc: x1205: Add DT probing support Linus Walleij
2019-01-31 15:30   ` Alexandre Belloni
2019-02-01 12:22     ` Linus Walleij
2019-02-01 14:13       ` Alexandre Belloni
2019-02-01 21:29         ` Linus Walleij
2019-02-07 20:42   ` Alexandre Belloni
2019-02-07 20:42 ` [PATCH 1/2] rtx: x1205: Add DT bindings Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).