[PATCH 0/2] ARM: Expose Raspberry Pi revision code in /proc/cpuinfo

Jonathan Neuschäfer posted 2 patches 1 year, 5 months ago
Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml | 12 ++++++++++++
arch/arm/mach-bcm/board_bcm2835.c                      | 11 +++++++++++
2 files changed, 23 insertions(+)
[PATCH 0/2] ARM: Expose Raspberry Pi revision code in /proc/cpuinfo
Posted by Jonathan Neuschäfer 1 year, 5 months ago
Raspberry Pi boards have a "revision code", documented here:

  https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes

This patch copies what the downstream kernel does and reads it from the
devicetree property /system/linux,revision. This enables some software
to work as intended on mainline kernels:

  https://github.com/hzeller/rpi-rgb-led-matrix/blob/a3eea997a9254b83ab2de97ae80d83588f696387/lib/gpio.cc#L247

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Jonathan Neuschäfer (2):
      dt-bindings: arm: bcm2835: Specify /system/linux,revision property
      ARM: bcm2835: Detect system revision

 Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml | 12 ++++++++++++
 arch/arm/mach-bcm/board_bcm2835.c                      | 11 +++++++++++
 2 files changed, 23 insertions(+)
---
base-commit: 22a40d14b572deb80c0648557f4bd502d7e83826
change-id: 20240707-raspi-revision-84dffdfaebce

Best regards,
--
Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Re: [PATCH 0/2] ARM: Expose Raspberry Pi revision code in /proc/cpuinfo
Posted by Stefan Wahren 1 year, 5 months ago
Hi Jonathan,

Am 08.07.24 um 01:08 schrieb Jonathan Neuschäfer:
> Raspberry Pi boards have a "revision code", documented here:
>
>    https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes
AFAIK these revision codes mostly refer to the board and not to the CPU.
The abuse of /proc/cpuinfo has been rejected in the past and from my
understanding this applies also in this case.
> This patch copies what the downstream kernel does and reads it from the
> devicetree property /system/linux,revision. This enables some software
> to work as intended on mainline kernels:
>
>    https://github.com/hzeller/rpi-rgb-led-matrix/blob/a3eea997a9254b83ab2de97ae80d83588f696387/lib/gpio.cc#L247
This is a bad example because the application doesn't really care about
the kernel and directly access the hardware registers via /dev/mem. A
proper application would use the dedicated userspace API (GPIO Character
Device or PWM). I would bet that the application does not work with the
Raspberry Pi 5.

Regards
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> ---
> Jonathan Neuschäfer (2):
>        dt-bindings: arm: bcm2835: Specify /system/linux,revision property
>        ARM: bcm2835: Detect system revision
>
>   Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml | 12 ++++++++++++
>   arch/arm/mach-bcm/board_bcm2835.c                      | 11 +++++++++++
>   2 files changed, 23 insertions(+)
> ---
> base-commit: 22a40d14b572deb80c0648557f4bd502d7e83826
> change-id: 20240707-raspi-revision-84dffdfaebce
>
> Best regards,
> --
> Jonathan Neuschäfer <j.neuschaefer@gmx.net>
>
Re: [PATCH 0/2] ARM: Expose Raspberry Pi revision code in /proc/cpuinfo
Posted by J. Neuschäfer 1 year, 5 months ago
On Mon, Jul 08, 2024 at 06:14:01PM +0200, Stefan Wahren wrote:
> Hi Jonathan,
>
> Am 08.07.24 um 01:08 schrieb Jonathan Neuschäfer:
> > Raspberry Pi boards have a "revision code", documented here:
> >
> >    https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes
> AFAIK these revision codes mostly refer to the board and not to the CPU.

True.

> The abuse of /proc/cpuinfo has been rejected in the past and from my
> understanding this applies also in this case.

Alright

> > This patch copies what the downstream kernel does and reads it from the
> > devicetree property /system/linux,revision. This enables some software
> > to work as intended on mainline kernels:
> >
> >    https://github.com/hzeller/rpi-rgb-led-matrix/blob/a3eea997a9254b83ab2de97ae80d83588f696387/lib/gpio.cc#L247
> This is a bad example because the application doesn't really care about
> the kernel and directly access the hardware registers via /dev/mem. A
> proper application would use the dedicated userspace API (GPIO Character
> Device or PWM).

Right

> I would bet that the application does not work with the Raspberry Pi 5.

Probably, yeah.


Jonathan