Skip to contentSkip to conversation

dt/bindings: Add binding for the Raspberry Pi firmware driver

PATCH Superseded Eric Anholt 3 participants 8 messages Jun 4, 2015 – Jun 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v7 1/3 dt/bindings: Add binding for the Raspberry Pi firmware driver

This driver will provide support for calls into the firmware that will be used by other drivers like cpufreq and vc4.

---

v2: Improve commit message, point to mailbox.txt for how mboxes work.
v3: Use Lee's suggestion for mailbox phandle docs, fix spelling of
"raspberry".
v4: Change the compatible string to "raspberrypi,bcm2835-firmware"
(requested by Lee, agreed by Stephen)
v5: Add missing s-o-b, fix spelling.

 .../bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt new file +14 -0
new file mode 100644
index 0000000..6824b31
@@ -0,0 +1,14 @@
+Raspberry Pi VideoCore firmware driver
+
+Required properties:
+
+- compatible:		Should be "raspberrypi,bcm2835-firmware"
+- mboxes:		Phandle to the firmware device's Mailbox.
+			  (See: ../mailbox/mailbox.txt for more information)
+
+Example:
+
+firmware {
+	compatible = "raspberrypi,bcm2835-firmware";
+	mboxes = <&mailbox>;
+};
Signature · 1 line
2.1.4
#1 lore raw

PATCH v7 2/3 ARM: bcm2835: Add the Raspberry Pi firmware driver

This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and set clock rates.

---

v2: Drop power-domains stuff for now since we don't have the driver
core support to make it useful. Move to drivers/firmware/. Capitalize the enums. De-global the firmware variable. Use the firmware device to allocate our DMA buffer, so that the dma-ranges DT property gets respected. Simplify the property tag transaction interface even more, leaving a multi-tag interface still available. For conciseness, rename "raspberrypi" to "rpi" on all functions/enums/structs, and the "firmware" variable to "fw". Print when the driver is probed successfully, since debugging -EPROBE_DEFER handling is such a big part of bcm2835 development. Drop -EBUSY mailbox handling since the mailbox core has been fixed to return -EPROBE_DEFER in -next.

v3: Use kernel-doc style for big comments (from Noralf), drop stale
comment, use "dev" when freeing DMA as well.

v4: Move description comment into copyright comment, drop a dead
initialization of "ret", and print the firmware revision at probe time.

v5: Rename the compatible to "raspberrypi,bcm2835-firmware", move
include to not say "property", add functions to get struct rpi_firmware from the device_node and put when done, make property functions take the rpi_firmware instead and never return -EPROBE_DEFER, put the driver under its own RASPBERRYPI_FIRMWARE Kconfig.

v6: Drop the try_module_get/module_put stuff, since all clients will
be referencing our symbols in order to call those functions, anyway. Fix the kerneldoc comments for the changes in v5.

 drivers/firmware/Kconfig                   |   7 +
 drivers/firmware/Makefile                  |   1 +
 drivers/firmware/raspberrypi.c             | 260 +++++++++++++++++++++++++++++
 include/soc/bcm2835/raspberrypi-firmware.h | 115 +++++++++++++
 4 files changed, 383 insertions(+)
 create mode 100644 drivers/firmware/raspberrypi.c
 create mode 100644 include/soc/bcm2835/raspberrypi-firmware.h
drivers/firmware/Kconfig +7 -0
index 6517132..564aa5b 100644
@@ -136,6 +136,13 @@ config QCOM_SCM
 	bool
 	depends on ARM || ARM64
 
+config RASPBERRYPI_FIRMWARE
+	tristate "Raspberry Pi Firmware Driver"
+	depends on BCM2835_MBOX
+	help
+	  This option enables support for communicating with the firmware on the
+	  Raspberry Pi.
+
 source "drivers/firmware/google/Kconfig"
 source "drivers/firmware/efi/Kconfig"
 
drivers/firmware/Makefile +1 -0
index 3fdd391..ee101a2 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_ISCSI_IBFT)	+= iscsi_ibft.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)	+= memmap.o
 obj-$(CONFIG_QCOM_SCM)		+= qcom_scm.o
 CFLAGS_qcom_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
+obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
 
 obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
 obj-$(CONFIG_EFI)		+= efi/
drivers/firmware/raspberrypi.c new file +260 -0

260 lines not on this page · raw message

include/soc/bcm2835/raspberrypi-firmware.h new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.1.4
Acked-by on v7 2/3
#2 lore raw

Re: [PATCH v7 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver

Quoted 3 lines · Eric Anholt

This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and set clock rates.

#3 lore raw

Re: [PATCH v7 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver

Quoted 6 lines · Stephen Warren
Quoted 3 lines · Eric Anholt

This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and set clock rates.

Does anyone know how drivers/firmware/ is managed? I don't seem to be able to find a maintainer/supporter listed in MAINTAINERS.

#4 lore raw

Re: [PATCH v7 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver

Quoted 11 lines · Lee Jones
Quoted 6 lines · Stephen Warren
Quoted 3 lines · Eric Anholt

This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and set clock rates.

Does anyone know how drivers/firmware/ is managed? I don't seem to be able to find a maintainer/supporter listed in MAINTAINERS.

git log implies lots of different committers. I'd suggest send it through arm-soc with the rest of the series.

#5 lore raw

PATCH v7 3/3 ARM: bcm2835: Add the firmware driver information to the RPi DT

In reply to Eric Anholt

---

v2: Drop pm-domains stuff since I've dropped it from the firmware
driver for now, until we get drivers/base fixed.

v3: Rename the compatible to "raspberrypi,bcm2835-firmware"

 arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +7 -0
index 46780bb..ab5474e 100644
@@ -14,6 +14,13 @@
 			linux,default-trigger = "heartbeat";
 		};
 	};
+
+	soc {
+		firmware: firmware {
+			compatible = "raspberrypi,bcm2835-firmware";
+			mboxes = <&mailbox>;
+		};
+	};
 };
 
 &gpio {
Signature · 1 line
2.1.4
#6 lore raw

Re: [PATCH v7 3/3] ARM: bcm2835: Add the firmware driver information to the RPi DT

Quoted 5 lines · Eric Anholt

---

Quoted 7 lines

v2: Drop pm-domains stuff since I've dropped it from the firmware
driver for now, until we get drivers/base fixed.

v3: Rename the compatible to "raspberrypi,bcm2835-firmware"

 arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

Applied for v4.2, thanks.

Quoted 18 lines
arch/arm/boot/dts/bcm2835-rpi.dtsi +7 -0
index 46780bb..ab5474e 100644
@@ -14,6 +14,13 @@
 			linux,default-trigger = "heartbeat";
 		};
 	};
+
+	soc {
+		firmware: firmware {
+			compatible = "raspberrypi,bcm2835-firmware";
+			mboxes = <&mailbox>;
+		};
+	};
 };
 
 &gpio {
#7 lore raw
In reply to Eric Anholt
Quoted 14 lines · Eric Anholt

This driver will provide support for calls into the firmware that will be used by other drivers like cpufreq and vc4.

---

v2: Improve commit message, point to mailbox.txt for how mboxes work.
v3: Use Lee's suggestion for mailbox phandle docs, fix spelling of
"raspberry".
v4: Change the compatible string to "raspberrypi,bcm2835-firmware"
(requested by Lee, agreed by Stephen)
v5: Add missing s-o-b, fix spelling.

Quoted 3 lines
 .../bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt

Applied for v4.2, thanks.

Quoted 20 lines
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt new file +14 -0
new file mode 100644
index 0000000..6824b31
@@ -0,0 +1,14 @@
+Raspberry Pi VideoCore firmware driver
+
+Required properties:
+
+- compatible:		Should be "raspberrypi,bcm2835-firmware"
+- mboxes:		Phandle to the firmware device's Mailbox.
+			  (See: ../mailbox/mailbox.txt for more information)
+
+Example:
+
+firmware {
+	compatible = "raspberrypi,bcm2835-firmware";
+	mboxes = <&mailbox>;
+};