From: Arnd Bergmann <arnd@arndb.de>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
zajec5@gmail.com, arend@broadcom.com,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
varkabhadram@gmail.com
Subject: Re: [PATCH v6] bcma: register bcma as device tree driver
Date: Tue, 30 Sep 2014 15:40:10 +0200 [thread overview]
Message-ID: <7004113.vCTZUyLSaf@wuerfel> (raw)
In-Reply-To: <1411682959-21557-1-git-send-email-hauke@hauke-m.de>
On Friday 26 September 2014 00:09:19 Hauke Mehrtens wrote:
> This driver is used by the bcm53xx ARM SoC code. Now it is possible to
> give the address of the chipcommon core in device tree and bcma will
> search for all the other cores.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
I'm basically happy with this patch, so
Acked-by: Arnd Bergmann <arnd@arndb.de>
A few details that I think are worth improving:
> diff --git a/Documentation/devicetree/bindings/bus/bcma.txt b/Documentation/devicetree/bindings/bus/bcma.txt
> new file mode 100644
> index 0000000..e9070c1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/bus/bcma.txt
> @@ -0,0 +1,20 @@
> +Driver for ARM AXI Bus with Broadcom Plugins (bcma)
> +
> +Required properties:
> +
> +- compatible : brcm,bus-axi
> +
> +- reg : iomem address range of chipcommon core
> +
> +The cores on the AXI bus are automatically detected by bcma with the
> +memory ranges they are using and they get registered afterwards.
> +
> +Example:
> +
> + axi@18000000 {
> + compatible = "brcm,bus-axi";
> + reg = <0x18000000 0x1000>;
> + ranges = <0x00000000 0x18000000 0x00100000>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
I think it would be good to document how you can specify child nodes
here, and give one node as the example.
> +
> +#ifdef CONFIG_OF
> +static int bcma_host_soc_probe(struct platform_device *pdev)
> +{
We generally try to avoid #ifdef in device drivers, I think it would
be trivial to avoid this one by moving the contents into a new file.
> + struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> + struct bcma_bus *bus;
> + int err;
> +
> + /* Alloc */
> + bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
> + if (!bus)
> + return -ENOMEM;
> +
> + /* Map MMIO */
> + bus->mmio = of_iomap(np, 0);
> + if (!bus->mmio)
> + return -ENOMEM;
this could use devm_ioremap_resource() to avoid the iounmap
in the failu
> +#ifdef CONFIG_OF
> +static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
> + struct bcma_device *core)
> +{
> + struct device_node *node;
> + u64 size;
> + const __be32 *reg;
> +
> + if (!parent || !parent->dev.of_node)
> + return NULL;
> +
> + for_each_child_of_node(parent->dev.of_node, node) {
> + reg = of_get_address(node, 0, &size, NULL);
> + if (!reg)
> + continue;
> + if (of_translate_address(node, reg) == core->addr)
> + return node;
> + }
> + return NULL;
> +}
I think this will compile into nothing if CONFIG_OF is disabled, so no
need for the #ifdef.
> +
> +static void bcma_of_fill_device(struct platform_device *parent,
> + struct bcma_device *core)
> +{
> + struct device_node *node;
> +
> + node = bcma_of_find_child_device(parent, core);
> + if (node)
> + core->dev.of_node = node;
> +}
and consequently, this function can be moved into the caller.
Arnd
prev parent reply other threads:[~2014-09-30 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-25 22:09 [PATCH v6] bcma: register bcma as device tree driver Hauke Mehrtens
2014-09-30 13:40 ` Arnd Bergmann [this message]
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=7004113.vCTZUyLSaf@wuerfel \
--to=arnd@arndb.de \
--cc=arend@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=hauke@hauke-m.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=varkabhadram@gmail.com \
--cc=zajec5@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).