Adding functionalities to Mailbox RPi

Pavel Pisa pisa at cmp.felk.cvut.cz
Mon Jun 20 15:29:48 UTC 2016


Hello Mudit,

On Monday 20 of June 2016 15:59:16 Mudit Jain wrote:
> Hi,
>
> I have added functionality to retrieve the firmware version, board model
> number and board revision to the mail box code. This was one of the
> deliverables of my project.
>
> Github Link :
> https://github.com/spark1729/rtems/commit/796231efc7b0f6dd1adce67f21615689a
>1b0224b
>
> This is in accordance with -
> https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
>
> Pavel, if you could review the code it would be great.
>
> The mailbox code in RTEMS mainline is minimal. I will be working on
> expanding the same.

code looks correct to me. Only one nitpick there is missing space
in next typedef

> +typedef struct
> +{
> +  uint32_t fw_rev;
> +}bcm2835_mailbox_get_fw_rev_entries;

+} bcm2835_mailbox_get_fw_rev_entries;

And it seems that it is missing in already present retries as well.
They has been probably overlooked by me during code integration.
Spaces should be adjusted for these in future.

But I suggest to add space in newly added entries to minimize
size of future formating patch.

Are values for board model and revision returned by there calls
corresponding to expected ones?
I try to test the code on my RPi when I have time or test
something else.

As for the power state, there are some ideas to test.
You can try to put code before MMU is enabled.
You can try to change code to use newer firmware
domain command instead

--- a/c/src/lib/libbsp/arm/raspberrypi/misc/vc.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/misc/vc.c
@@ -224,7 +224,7 @@ 
bcm2835_mailbox_set_power_state(bcm2835_set_power_state_entries *_entries)
   }buffer BCM2835_MBOX_BUF_ALIGN_ATTRIBUTE;
   BCM2835_MBOX_INIT_BUF(&buffer);
   BCM2835_MBOX_INIT_TAG(&buffer.set_power_state,
-    BCM2835_MAILBOX_TAG_SET_POWER_STATE);
+    BCM2835_MAILBOX_TAG_SET_DOMAIN_STATE);
   buffer.set_power_state.body.req.dev_id = _entries->dev_id;
   buffer.set_power_state.body.req.state = _entries->state;
   bcm2835_mailbox_buffer_flush_and_invalidate(&buffer, sizeof(&buffer));

But according to the next Linux kernel developres thread it
seems that SDCARD domain is always on and firmware does not
care about this domain (ignores it or may be reports unsupported
operation on newer firmware ????).

  http://thread.gmane.org/gmane.linux.ports.arm.kernel/451646

So may it be, power control can/should be ignored for SDcard
interface if you check that power is present on the card and
can focus to other task in SDcard support implementation.

I have pushed patch with mbox cache synchronization into RTEMS
mainline. If you update patch and integrate possible remarks
from others then I can push your change to the mainline
as well.

Best wishes,

              Pavel


More information about the devel mailing list