Re: [PATCH 2/2] rtc: x1205: Add DT probing support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/02/2019 13:22:57+0100, Linus Walleij wrote:
> On Thu, Jan 31, 2019 at 4:30 PM Alexandre Belloni
> <alexandre.belloni@xxxxxxxxxxx> 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@xxxxxxxxxx>
> > > ---
> > >  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



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux