Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Feb 2019 14:07:33 +1100
From:      Peter Jeremy <peter@rulingia.com>
To:        freebsd-arm@freebsd.org
Subject:   Fixing the missing "cpu" devclass on RPi
Message-ID:  <20190224030733.GA11137@server.rulingia.com>

next in thread | raw e-mail | index | archive | help

--ibTvN161/egqYuK8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On the RPi, the "cpu" devclass is created by dev/ofw/ofw_cpu.c and depends
on the presence of a "cpus" block in the FDT.  This exists in the FreeBSD
trees (eg bcm2835-rpi-b-plus.dtb) but not in the Linux FDT populated by the
latest firmware.  This means that (eg) bcm2835_cpufreq never gets probed[1].

Injecting "cpus" via a fdt overlay was suggested but I can't get that to
work.  I have rpi-cpus.dtso as follows:
=3D=3D=3D=3D=3D
/dts-v1/;
/plugin/;

/ {
	compatible =3D "brcm,bcm2835";
};

&{/} {
	cpus {
		cpu@0 {
			compatible =3D "arm,1176jzf-s";
			device_type =3D "cpu";
		};
	};
};
=3D=3D=3D=3D=3D
When I compile it and de-compile it, the result looks sane:
=3D=3D=3D=3D
$ dtc -I dtb -O dts rpi-cpus.dtbo
/dts-v1/;

/  {

        compatible =3D "brcm,bcm2835";
        fragment@0 {

                target-path =3D "/";
                __overlay__ {

                        cpus {

                                cpu@0 {

                                        compatible =3D "arm,1176jzf-s";
                                        device_type =3D "cpu";
                                };
                        };
                };
        };
        __symbols__ {

        };
};
=3D=3D=3D=3D

I've added rpi-cpus.dtbo to fdt_overlays in loader.conf and the boot
messages report that it's being loaded but the "cpus" section is still
missing from hw.fdt

I presume I've got something wrong in my dtso but I'm not sure what -
I haven't found a great deal of documentation on writing overlays and
the above looks correct according to what I've found.

[1] There's a separate bug in bcm2835_cpufreq.c so it'll never attach,
    but that's just a matter of fixing the compatible list.

--=20
Peter Jeremy

--ibTvN161/egqYuK8
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAlxyCnVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF
QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi
CzTZCA//XGWihd3u8p/0txIUzP3c+hS5zpKzJZameYOwv1CJFJ/vcIcHVhoMAXX5
+zbgcg+w9GZUsLUw04LF7dsXkpLwbfBK4uQCQ0o25vBgBRS15aMCE3D3M9yxhCcJ
TvAYzT22biaAqD8Z+YvJg8wxhbG341sWxKaj4hOnXGNGYGzD93pVH7H3JRYUxA37
dBwyeP7K9LDkLxUN+EcYBUAkvMhAQQxntLX0aGuPeuwRbmhqsnVYMjXyyyKZE9JV
Ptv1SbraIyv8lDMRumtOdqzWuo8+JYDMngLKrCQq+cdxY3pC847TuiTeuYAbF4FK
rF7H5OIKfbLd9F8ZhNHmcQ+gCTP2QJBN9Flo07CcVO/iJ2mFUya62UOZbDJ0PBLg
JZ8Uba1WQVf4G/wULvj0jJoqU9KeobOUm673LEwRMOZAnNwj0APmPAahwI45SnUh
ZPK+NHIo6GwV/oIQjz3elGQKrcgmtmuEb5TgtUuaYsJIKvAcMGY1H5rf+RMJTIcH
y7nldYeY3+0rzUveiaUjnewevvBQUa5jZ+TMZ8pGTcakkPeFJcliB7+4g2R1OiNh
fzmy4KrNf50I8302CbjNamYaPf3OupGjNZlNFNx/DX0XB/Bua1Q8/Zdk/kJQP2yT
JYqPYKI5ru+Cv6KL+d4mtepLxQpjFKC/ncf/G2uytqwx1BqJ2/8=
=l2uY
-----END PGP SIGNATURE-----

--ibTvN161/egqYuK8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190224030733.GA11137>