Date: Tue, 18 Mar 2014 08:26:39 -0600 From: Warner Losh <imp@bsdimp.com> To: Luiz Otavio O Souza <lists.br@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: [RFC] lm75 kernel driver and bsnmp module Message-ID: <4B0E494C-A289-435C-89AA-29DEB1A4EAD9@gmail.com> In-Reply-To: <CAB=2f8wqTqQekBPRGdG%2BBqTn-yt1BX-3DW6K5HBt2jptc4g4-g@mail.gmail.com> References: <CAB=2f8wqTqQekBPRGdG%2BBqTn-yt1BX-3DW6K5HBt2jptc4g4-g@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
On Mar 17, 2014, at 8:11 AM, Luiz Otavio O Souza <lists.br@gmail.com> wrote:
> <lm75.diff>
+#ifdef FDT
+static struct ofw_compat_data compat_data[] = {
+ { "freebsd,lm75", HWTYPE_LM75 },
+ { "freebsd,lm75a", HWTYPE_LM75A },
+ { NULL, HWTYPE_NONE },
+};
+#endif
Is there a FDT standard here? It seems like they would fall under the
“national,lm75” bindings that are defined in the “standard” FDT spec. You
can find it listed in the ‘device-tree/Bindings/i2c/trivial-devices.txt’ file in
Linux, or in a similar location in the device-tree vendor tree in FreeBSD.
It isn’t clear that both devices can’t be handled with the same driver, since
the extra bits are supposed to be clear and so the extra if’s here:
+ if (sc->sc_hwtype == HWTYPE_LM75A) {
+ if (buf & LM75_0125C)
+ t += 125;
+ if (buf & LM75_0250C)
+ t += 250;
+ }
+ if (buf & LM75_0500C)
+ t += 500;
which just leaves device type reporting. The only reason I mention is is that
Linux doesn’t seem to differentiate the two at the FDT level.
+ sc->sc_hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
I don’t think that the NULL binding is guaranteed to work that way, so
I’d suggest dropping the NULL line above and testing explicitly for NULL
here instead.
Finally, is pausing for hz on read/write errors the right thing to do? Seems like a very
long time...
Warner
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B0E494C-A289-435C-89AA-29DEB1A4EAD9>
