Port-arm archive

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

Re: DS1307 on NetBSD 9 RPI2 and RPI3



Jason Thorpe <thorpej%me.com@localhost> writes:

>> On Apr 23, 2020, at 12:55 PM, Brad Spencer <brad%anduin.eldar.org@localhost> wrote:
>> 
>> Well, it would have been a hold over from the previous way this all
>> worked, so:
>> 
>> dsrtc* at iic2 addr 0x68 flags 1307
>
> It's failing because the parent doesn't match your config file.  This is all much easier with the device tree way... kernel config file can say:
>
> dsrtc* at iic? addr ?
>
> Address comes from the DT, and so does the device type (via the "compatible" string).
>
> -- thorpej

Yes, that ended up being the final piece.  I should have been able to
figure this out on my own, but I really could not find a great deal of
examples that had all of the pieces together.

So... what I ended up with was a overlay that looks like this:

/dts-v1/;

/ {
        compatible = "brcm,bcm2836";

        fragment@0 {
                target-path = "/soc/i2c@7e205000";

                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@1 {
                target-path = "/soc/i2c@7e805000";

                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@2 {
                target-path = "/soc/i2c@7e804000";

                __overlay__ {
                        status = "okay";
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;
                        clock-frequency = <0x61a80>;

                        dsrtc@68 {
                                compatible = "dallas,ds1307";
                                reg = <0x68>;
                        };
                };
        };
};

That was for a RPI2, for the RPI3, I did the proper thing and used
brcm,bcm2837 .. these strings seem to be mostly located in
src/sys/external/gpl2/dts/dist/arch/arm ..  you compile this with
something like "dtc -I dts -O dtb -o ds3231_rpi3.dtbo ds3231_rpi3.dts"
and place the dtbo file in /boot/overlays.  For the RPI the config.txt
file will need a line with something like "dtoverlay=ds3231_rpi3.dtbo"

For the DS RTC chips you will then need a kernel that has the driver in
it.  It is enough, it appears to have a config file with:

dsrtc* at iic? addr ?

I assume that if one loaded a kernel module that was device tree aware
and there was an overlay defined in the proper way, that the driver
would get used.




Thanks everyone for the help,

-- 
Brad Spencer - brad%anduin.eldar.org@localhost - KC8VKS - http://anduin.eldar.org


Home | Main Index | Thread Index | Old Index