Skip to contentSkip to conversation

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

PATCH Superseded Eric Anholt 3 participants 7 messages May 29, 2015 – Jun 3, 2015

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 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)

---
 .../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..5fb1868
@@ -0,0 +1,14 @@
+Raspberry Pi VideoCore firmware driver
+
+Required properties:
+
+- compatible:		Should be "rasbperrypi,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 v6 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
#2 lore raw

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

Quoted 31 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.

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.

Quoted 3 lines

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.

(This style of commit explanation is getting quite common. I must say I rather dislike it. I think people should just update the entire commit explanation when needed, and not simply paste any changes at the end of it, thereby forcing the the reader to determine which older parts are actually overruled by newer parts. Besides, many, or maybe even most, of the changes are really not interesting enough to keep in the commit explanation.)

drivers/firmware/raspberrypi.c line 164

Quoted 6 lines
drivers/firmware/raspberrypi.c new file +2 -0
 
+EXPORT_SYMBOL_GPL(rpi_firmware_property_list);
 
+EXPORT_SYMBOL_GPL(rpi_firmware_property);

A patch that uses these exports hit lkml recently:
https://lkml.org/lkml/2015/5/28/596 .

Quoted 1 line

+EXPORT_SYMBOL_GPL(rpi_firmware_get);

But I didn't spot a (recent) patch that uses this export. Is it queued somewhere?

Thanks,

Paul Bolle

#3 lore raw

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

Quoted 9 lines · Paul Bolle
Quoted 7 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.

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.

Quoted 7 lines

(This style of commit explanation is getting quite common. I must say I rather dislike it. I think people should just update the entire commit explanation when needed, and not simply paste any changes at the end of it, thereby forcing the the reader to determine which older parts are actually overruled by newer parts. Besides, many, or maybe even most, of the changes are really not interesting enough to keep in the commit explanation.)

It was a slip-up that I didn't move it below the '---'this time (I changed my workflow a bit, and missed the step). I was assuming that Lee would just trim them on pulling in the changes.

Quoted 7 lines

drivers/firmware/raspberrypi.c line 164

Quoted 6 lines
drivers/firmware/raspberrypi.c new file +2 -0
 
+EXPORT_SYMBOL_GPL(rpi_firmware_property_list);
 
+EXPORT_SYMBOL_GPL(rpi_firmware_property);
Quoted 7 lines

A patch that uses these exports hit lkml recently:
https://lkml.org/lkml/2015/5/28/596 .

Quoted 1 line

+EXPORT_SYMBOL_GPL(rpi_firmware_get);

But I didn't spot a (recent) patch that uses this export. Is it queued somewhere?

This is from the v5 changes due to review feedback, and the clients need
to be changed to use it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150601/419ffcda/attachment.sig>

#4 lore raw

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

Quoted 19 lines · Eric Anholt
Quoted 9 lines · Paul Bolle
Quoted 7 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.

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.

Quoted 7 lines

(This style of commit explanation is getting quite common. I must say I rather dislike it. I think people should just update the entire commit explanation when needed, and not simply paste any changes at the end of it, thereby forcing the the reader to determine which older parts are actually overruled by newer parts. Besides, many, or maybe even most, of the changes are really not interesting enough to keep in the commit explanation.)

Quoted 3 lines

It was a slip-up that I didn't move it below the '---'this time (I changed my workflow a bit, and missed the step). I was assuming that Lee would just trim them on pulling in the changes.

I'm not the Firmware Maintainer, but I'm sure whoever is will be happy to remove the changelog. But Paul is correct, the commit should be updated.

#5 lore raw

PATCH v6 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
In reply to Eric Anholt

What's going on here? This is unlike you.

Quoted 8 lines

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)

Perhaps this should have culminated in a Suggested-by.

The change-log should be below the "---".

Quoted 1 line

Where's your SoB?

Quoted 11 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
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt new file +0 -0
new file mode 100644
index 0000000..5fb1868

Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt line 5

Quoted 5 lines
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt new file +5 -0
@@ -0,0 +1,14 @@
+Raspberry Pi VideoCore firmware driver
+
+Required properties:
+
+- compatible:		Should be "rasbperrypi,bcm2835-firmware"

Spelling.

Quoted 9 lines
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.txt new file +9 -0
+- mboxes:		Phandle to the firmware device's Mailbox.
+			  (See: ../mailbox/mailbox.txt for more information)
+
+Example:
+
+firmware {
+	compatible = "raspberrypi,bcm2835-firmware";
+	mboxes = <&mailbox>;
+};