public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver
Date: Tue, 28 Apr 2015 09:56:06 +0200	[thread overview]
Message-ID: <3080299.N0ANU8WHs3@wuerfel> (raw)
In-Reply-To: <1430176449-12322-3-git-send-email-eric@anholt.net>

On Monday 27 April 2015 16:14:08 Eric Anholt wrote:
> This gives us a function for making mailbox property channel requests
> of the firmware, and uses it to control the 3 power domains provided
> by the firmware.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  arch/arm/mach-bcm/Kconfig                          |   2 +
>  arch/arm/mach-bcm/Makefile                         |   1 +
>  arch/arm/mach-bcm/raspberrypi-firmware.c           | 285 +++++++++++++++++++++

drivers/firmware maybe?

Is this firmware the same one on the Roku 2? If so, it might need a better name.

> diff --git a/include/soc/bcm2835/raspberrypi-mailbox-property.h b/include/soc/bcm2835/raspberrypi-mailbox-property.h
> new file mode 100644
> index 0000000..787bd75
> --- /dev/null
> +++ b/include/soc/bcm2835/raspberrypi-mailbox-property.h
> @@ -0,0 +1,110 @@
> +/*
> + *  Copyright ? 2015 Broadcom
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/types.h>
> +
> +enum raspberrypi_firmware_property_status {
> +	raspberrypi_firmware_status_request = 0,
> +	raspberrypi_firmware_status_success = 0x80000000,
> +	raspberrypi_firmware_status_error =   0x80000001,
> +};

We tend to use ALL_CAPS for constants, even when they are in an enum.

> +struct raspberrypi_firmware_property_tag_header {
> +	/* One of enum_mbox_property_tag. */
> +	u32 tag;
> +
> +	/* The number of bytes in the value buffer following this
> +	 * struct.
> +	 */
> +	u32 buf_size;
> +
> +	/*
> +	 * On submit, the length of the request (though it doesn't
> +	 * appear to be currently used by the firmware).  On return,
> +	 * the length of the response (always 4 byte aligned), with
> +	 * the low bit set.
> +	 */
> +	u32 req_resp_size;
> +};

If I read your code right, this structure is only used inside of the driver and
not passed in from a device driver, so better move it inside of the firmware
code.

It might be best to do the same with the return codes above as well, and 
convert them into standard Linux calling conventions as well.

> +enum raspberrypi_firmware_property_tag {
> +	raspberrypi_firmware_property_end = 0,
> +	raspberrypi_firmware_get_firmware_revision =                  0x00000001,
> +
> +	raspberrypi_firmware_set_cursor_info =                        0x00008010,
> +	raspberrypi_firmware_set_cursor_state =                       0x00008011,
> +
> +	raspberrypi_firmware_get_board_model =                        0x00010001,
> +	raspberrypi_firmware_get_board_revision =                     0x00010002,
> +	raspberrypi_firmware_get_board_mac_address =                  0x00010003,
> +	raspberrypi_firmware_get_board_serial =                       0x00010004,
> +	raspberrypi_firmware_get_arm_memory =                         0x00010005,
> +	raspberrypi_firmware_get_vc_memory =                          0x00010006,
> +	raspberrypi_firmware_get_clocks =                             0x00010007,

How stable are these interfaces? Does the firmware guarantee to keep the ABI
working, or might we need to version these?

	Arnd

  reply	other threads:[~2015-04-28  7:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 23:14 [PATCH 0/3] Raspberry Pi firmware driver Eric Anholt
2015-04-27 23:14 ` [PATCH 1/3] dt/bindings: Add binding for the " Eric Anholt
2015-04-28  9:34   ` Lee Jones
2015-04-29  1:42   ` Stephen Warren
2015-04-27 23:14 ` [PATCH 2/3] ARM: bcm2835: Add " Eric Anholt
2015-04-28  7:56   ` Arnd Bergmann [this message]
2015-04-28 20:07     ` Eric Anholt
2015-04-28  9:27   ` Lee Jones
2015-04-28  9:28   ` Lee Jones
2015-04-29  1:58   ` Stephen Warren
2015-04-29  2:14     ` Jassi Brar
2015-04-29  2:56       ` Jassi Brar
2015-04-29 17:51     ` Eric Anholt
2015-04-29 23:47       ` Stephen Warren
2015-05-12 17:46         ` Eric Anholt
2015-05-12 22:08           ` Stephen Warren
2015-05-13  0:38             ` Eric Anholt
2015-05-13 18:28               ` Stephen Warren
2015-04-27 23:14 ` [PATCH 3/3] ARM: bcm2835: Add the necessary firmware driver information to the DT Eric Anholt
2015-04-28  9:33   ` Lee Jones
2015-04-29  1:44   ` Stephen Warren
2015-04-29 16:29     ` Eric Anholt
2015-04-29 23:43       ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3080299.N0ANU8WHs3@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox