All of lore.kernel.org
 help / color / mirror / Atom feed
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver
Date: Tue, 28 Apr 2015 19:58:41 -0600	[thread overview]
Message-ID: <55403AD1.4030103@wwwdotorg.org> (raw)
In-Reply-To: <1430176449-12322-3-git-send-email-eric@anholt.net>

On 04/27/2015 05:14 PM, 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.

> diff --git a/arch/arm/mach-bcm/raspberrypi-firmware.c b/arch/arm/mach-bcm/raspberrypi-firmware.c

> +/*
> + * Submits a set of concatenated tags to the VPU firmware through the
> + * mailbox property interface.
> + *
> + * The buffer header and the ending tag are added by this function and
> + * don't need to be supplied, just the actual tags for your operation.
> + * See struct raspberrypi_firmware_property_tag_header for the per-tag structure.
> + */
> +int raspberrypi_firmware_property(void *data, size_t tag_size)
> +{
> +	size_t size = tag_size + 12;
> +	u32 *buf;
> +	dma_addr_t bus_addr;
> +	int ret = 0;
> +
> +	if (!firmware)
> +		return -EPROBE_DEFER;

I think it'd make more sense if the clients looked up the firmware
driver via phandle at their probe time. This would mean:

* No need for global "firmware", since clients could pass the firmware
driver handle into this function.

* Clients resolve deferred probe at their probe time. That way, they
won't register themselves with subsystems asserting they can provide
services, but find out they can't yet provide the service at that time.

> +static int raspberrypi_firmware_probe(struct platform_device *pdev)

BTW if you wanted, a s/raspberrypi/rpi/ in all symbols and filenames
seems reasonable. I'm not really bothered either way.

> +{

> +	firmware->chan = mbox_request_channel(&firmware->cl, 0);
> +	if (IS_ERR(firmware->chan)) {
> +		ret = PTR_ERR(firmware->chan);
> +		/* An -EBUSY from the core means it couldn't find our
> +		 * channel, because the mailbox driver hadn't
> +		 * registered yet.
> +		 */
> +		if (ret == -EBUSY)
> +			ret = -EPROBE_DEFER;
> +		else
> +			dev_err(dev, "Failed to get mbox channel: %d\n", ret);

I would have hoped that mbox_request_channel() returned -EPROBE_DEFER
itself. It really should...

> +static int raspberrypi_firmware_remove(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +
> +	of_genpd_del_provider(dev->of_node);
> +	mbox_free_channel(firmware->chan);

firmware = NULL; ?

  parent reply	other threads:[~2015-04-29  1:58 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
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 [this message]
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=55403AD1.4030103@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.