Repository navigation
nvmem: raspberrypi: Add nvmem driver for reading customer OTP - #6014
Conversation
| status = "okay"; | ||
| }; | ||
|
|
||
| nvmem_mac: nvmem_mac { |
There was a problem hiding this comment.
Is it possible for a user to make the MAC addresses visible but read-only via device-tree or module parameters?
91830df to
58468a1
Compare
|
@timg236 updated with: Allow write access to customer otp through nvmem driver |
|
|
||
| config NVMEM_RASPBERRYPI_OTP | ||
| tristate "Raspberry Pi OTP support" | ||
| depends on ARCH_BCM || COMPILE_TEST |
There was a problem hiding this comment.
I think this should depend on or select RASPBERRYPI_FIRMWARE.
53418d4 to
41d3301
Compare
pelwell
left a comment
There was a problem hiding this comment.
Apart from the inline comments, this needs to be split into two commits.
|
|
||
| nvme Alias for "pciex1" (2712 only) | ||
|
|
||
| nvmem_customer_writeable Allow write access to customer otp through nvmem driver |
There was a problem hiding this comment.
The parameter decription must start on column 33, and lines must not exceed 80 characters.
There was a problem hiding this comment.
The parameter name is too long for that. Any preference for a change?
nvmem_customer_w or customer_writeable?
| return -EINVAL; | ||
|
|
||
| memcpy(data + 3, val, bytes); | ||
| err = rpi_firmware_property(priv->fw, RPI_FIRMWARE_SET_USER_OTP, |
There was a problem hiding this comment.
Is there any reason not to drop err and just "return rpi_firmware_property(..."?
| default ARCH_BCM && RASPBERRYPI_FIRMWARE | ||
| help | ||
| Say y here to enable support for reading OTP on Raspberry Pi boards. | ||
| such as the M1. These are e.g. used to store non-volatile board |
There was a problem hiding this comment.
"such as the M1." is unwanted text copied from the entry above.
|
I think you can cover all downstream dtbs by putting the changes in |
This supports reading and writing OTP using the firmware mailbox interface. It needs supporting firmware to run. Signed-off-by: Dom Cobley <popcornmix@gmail.com>
|
I also notice that the 2712 nvmem entries are in |
|
See https://github.com/pelwell/linux/tree/nvmem - the output is identical. Also consider moving the 2712 nvmem nodes to / |
|
Updated. |
pelwell
left a comment
There was a problem hiding this comment.
Also consider moving the 2712 nvmem nodes to /
Actually, moving the non-2712 nvmems to /soc removes a dtc warning about reg property length.
|
|
||
| nvme Alias for "pciex1" (2712 only) | ||
|
|
||
| nvmem_cust_rw Allow read/write access to cust otp through nvmem driver |
There was a problem hiding this comment.
These are over 80 characters long
diff --git a/arch/arm/boot/dts/broadcom/bcm2708-rpi.dtsi b/arch/arm/boot/dts/broadcom/bcm2708-rpi.dtsi
index 4302f55f57b4d..f4949a07272b6 100644
--- a/arch/arm/boot/dts/broadcom/bcm2708-rpi.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm2708-rpi.dtsi
@@ -15,6 +15,17 @@ aliases {
i2c2 = &i2c2;
};
+ __overrides__ {
+ hdmi = <&hdmi>,"status";
+ i2c2_iknowwhatimdoing = <&i2c2>,"status";
+ i2c2_baudrate = <&i2c2>,"clock-frequency:0";
+ nvmem_cust_rw = <&nvmem_cust>,"rw?";
+ sd = <&sdhost>,"status";
+ sd_poll_once = <&sdhost>,"non-removable?";
+ };
+};
+
+&soc {
nvmem_otp: nvmem_otp {
compatible = "raspberrypi,rpi-otp";
firmware = <&firmware>;
@@ -28,15 +39,6 @@ nvmem_cust: nvmem_cust {
reg = <1 8>;
status = "okay";
};
-
- __overrides__ {
- hdmi = <&hdmi>,"status";
- i2c2_iknowwhatimdoing = <&i2c2>,"status";
- i2c2_baudrate = <&i2c2>,"clock-frequency:0";
- nvmem_cust_rw = <&nvmem_cust>,"rw?";
- sd = <&sdhost>,"status";
- sd_poll_once = <&sdhost>,"non-removable?";
- };
};
&sdhost {
diff --git a/arch/arm/boot/dts/broadcom/bcm2711-rpi-ds.dtsi b/arch/arm/boot/dts/broadcom/bcm2711-rpi-ds.dtsi
index daa3b5dfa0bf3..b298cd8bb71ce 100644
--- a/arch/arm/boot/dts/broadcom/bcm2711-rpi-ds.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm2711-rpi-ds.dtsi
@@ -75,6 +75,21 @@ zone_dma {
#size-cells = <1>;
dma-ranges = <0x0 0x0 0x0 0x40000000>;
};
+};
+
+&vc4 {
+ raspberrypi,firmware = <&firmware>;
+};
+
+&cma {
+ /* Limit cma to the lower 768MB to allow room for HIGHMEM on 32-bit */
+ alloc-ranges = <0x0 0x00000000 0x30000000>;
+};
+
+&soc {
+ /* Add the physical <-> DMA mapping for the I/O space */
+ dma-ranges = <0xc0000000 0x0 0x00000000 0x40000000>,
+ <0x7c000000 0x0 0xfc000000 0x03800000>;
nvmem_otp: nvmem_otp {
compatible = "raspberrypi,rpi-otp";
@@ -98,21 +113,6 @@ nvmem_priv: nvmem_priv {
};
};
-&vc4 {
- raspberrypi,firmware = <&firmware>;
-};
-
-&cma {
- /* Limit cma to the lower 768MB to allow room for HIGHMEM on 32-bit */
- alloc-ranges = <0x0 0x00000000 0x30000000>;
-};
-
-&soc {
- /* Add the physical <-> DMA mapping for the I/O space */
- dma-ranges = <0xc0000000 0x0 0x00000000 0x40000000>,
- <0x7c000000 0x0 0xfc000000 0x03800000>;
-};
-
&scb {
#size-cells = <2>;
|
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
|
Updated |
See: raspberrypi/linux#6089 kernel: rp1: Support interrupt CPU affinity See: raspberrypi/linux#6090 kernel: i2c: designware: Make the SDA hold time half LCNT See: raspberrypi/linux#6091 kernel: Add support for Chipcap 2 sensor See: raspberrypi/linux#6083 kernel: nvmem: raspberrypi: Add nvmem driver for reading customer OTP See: raspberrypi/linux#6014 kernel: Add overlays and configs for several i2c sensors See: raspberrypi/linux#6093
See: raspberrypi/linux#6089 kernel: rp1: Support interrupt CPU affinity See: raspberrypi/linux#6090 kernel: i2c: designware: Make the SDA hold time half LCNT See: raspberrypi/linux#6091 kernel: Add support for Chipcap 2 sensor See: raspberrypi/linux#6083 kernel: nvmem: raspberrypi: Add nvmem driver for reading customer OTP See: raspberrypi/linux#6014 kernel: Add overlays and configs for several i2c sensors See: raspberrypi/linux#6093
See: raspberrypi/linux#6062 firmware: arm_dt: Improve power HAT+ support firmware: arm_loader: Add user otp read and write functions See: raspberrypi/linux#6014 firmware: dtoverlay: Use %u when converting u32s to strings See: raspberrypi/linux#6039 firmware: video_decode: CONFIGCHANGED not wanted with lack of aspect ratio in new frame See: https://forum.libreelec.tv/thread/28391-cvideoplayeraudio-process-stream-stalled/?postID=190597#post190597
See: raspberrypi/linux#6062 firmware: arm_dt: Improve power HAT+ support firmware: arm_loader: Add user otp read and write functions See: raspberrypi/linux#6014 firmware: dtoverlay: Use %u when converting u32s to strings See: raspberrypi/linux#6039 firmware: video_decode: CONFIGCHANGED not wanted with lack of aspect ratio in new frame See: https://forum.libreelec.tv/thread/28391-cvideoplayeraudio-process-stream-stalled/?postID=190597#post190597
This supports reading and writing OTP using the firmware mailbox interface.
It needs supporting firmware to run.