From: Kevin Cernekee <cernekee@gmail.com>
To: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org,
arnd@arndb.de, linux@prisktech.co.nz, stern@rowland.harvard.edu,
gregkh@linuxfoundation.org, f.fainelli@gmail.com
Cc: grant.likely@linaro.org, robh+dt@kernel.org,
computersforpeace@gmail.com, marc.ceeeee@gmail.com,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
linux-mips@linux-mips.org
Subject: [PATCH 7/9] bus: brcmstb_gisb: Add register offset tables for older chips
Date: Tue, 25 Nov 2014 16:49:52 -0800 [thread overview]
Message-ID: <1416962994-27095-8-git-send-email-cernekee@gmail.com> (raw)
In-Reply-To: <1416962994-27095-1-git-send-email-cernekee@gmail.com>
This will select the appropriate register layout based on the DT
"compatible" string.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
.../devicetree/bindings/bus/brcm,gisb-arb.txt | 6 ++-
drivers/bus/brcmstb_gisb.c | 52 +++++++++++++++++++---
2 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt b/Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
index e2d501d..1eceefb 100644
--- a/Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
+++ b/Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
@@ -2,7 +2,11 @@ Broadcom GISB bus Arbiter controller
Required properties:
-- compatible: should be "brcm,gisb-arb"
+- compatible:
+ "brcm,gisb-arb" or "brcm,bcm7445-gisb-arb" for 28nm chips
+ "brcm,bcm7435-gisb-arb" for newer 40nm chips
+ "brcm,bcm7400-gisb-arb" for older 40nm chips and all 65nm chips
+ "brcm,bcm7038-gisb-arb" for 130nm chips
- reg: specifies the base physical address and size of the registers
- interrupt-parent: specifies the phandle to the parent interrupt controller
this arbiter gets interrupt line from
diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
index ef1e423..172908d 100644
--- a/drivers/bus/brcmstb_gisb.c
+++ b/drivers/bus/brcmstb_gisb.c
@@ -47,6 +47,36 @@ enum {
ARB_ERR_CAP_MASTER,
};
+static const int gisb_offsets_bcm7038[] = {
+ [ARB_TIMER] = 0x00c,
+ [ARB_ERR_CAP_CLR] = 0x0c4,
+ [ARB_ERR_CAP_HI_ADDR] = -1,
+ [ARB_ERR_CAP_ADDR] = 0x0c8,
+ [ARB_ERR_CAP_DATA] = 0x0cc,
+ [ARB_ERR_CAP_STATUS] = 0x0d0,
+ [ARB_ERR_CAP_MASTER] = -1,
+};
+
+static const int gisb_offsets_bcm7400[] = {
+ [ARB_TIMER] = 0x00c,
+ [ARB_ERR_CAP_CLR] = 0x0c8,
+ [ARB_ERR_CAP_HI_ADDR] = -1,
+ [ARB_ERR_CAP_ADDR] = 0x0cc,
+ [ARB_ERR_CAP_DATA] = 0x0d0,
+ [ARB_ERR_CAP_STATUS] = 0x0d4,
+ [ARB_ERR_CAP_MASTER] = 0x0d8,
+};
+
+static const int gisb_offsets_bcm7435[] = {
+ [ARB_TIMER] = 0x00c,
+ [ARB_ERR_CAP_CLR] = 0x168,
+ [ARB_ERR_CAP_HI_ADDR] = -1,
+ [ARB_ERR_CAP_ADDR] = 0x16c,
+ [ARB_ERR_CAP_DATA] = 0x170,
+ [ARB_ERR_CAP_STATUS] = 0x174,
+ [ARB_ERR_CAP_MASTER] = 0x178,
+};
+
static const int gisb_offsets_bcm7445[] = {
[ARB_TIMER] = 0x008,
[ARB_ERR_CAP_CLR] = 0x7e4,
@@ -230,10 +260,20 @@ static struct attribute_group gisb_arb_sysfs_attr_group = {
.attrs = gisb_arb_sysfs_attrs,
};
+static const struct of_device_id brcmstb_gisb_arb_of_match[] = {
+ { .compatible = "brcm,gisb-arb", .data = gisb_offsets_bcm7445 },
+ { .compatible = "brcm,bcm7445-gisb-arb", .data = gisb_offsets_bcm7445 },
+ { .compatible = "brcm,bcm7435-gisb-arb", .data = gisb_offsets_bcm7435 },
+ { .compatible = "brcm,bcm7400-gisb-arb", .data = gisb_offsets_bcm7400 },
+ { .compatible = "brcm,bcm7038-gisb-arb", .data = gisb_offsets_bcm7038 },
+ { },
+};
+
static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
{
struct device_node *dn = pdev->dev.of_node;
struct brcmstb_gisb_arb_device *gdev;
+ const struct of_device_id *of_id;
struct resource *r;
int err, timeout_irq, tea_irq;
unsigned int num_masters, j = 0;
@@ -254,7 +294,12 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
if (IS_ERR(gdev->base))
return PTR_ERR(gdev->base);
- gdev->gisb_offsets = gisb_offsets_bcm7445;
+ of_id = of_match_node(brcmstb_gisb_arb_of_match, dn);
+ if (!of_id) {
+ pr_err("failed to look up compatible string\n");
+ return -EINVAL;
+ }
+ gdev->gisb_offsets = of_id->data;
err = devm_request_irq(&pdev->dev, timeout_irq,
brcmstb_gisb_timeout_handler, 0, pdev->name,
@@ -307,11 +352,6 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id brcmstb_gisb_arb_of_match[] = {
- { .compatible = "brcm,gisb-arb" },
- { },
-};
-
static struct platform_driver brcmstb_gisb_arb_driver = {
.probe = brcmstb_gisb_arb_probe,
.driver = {
--
2.1.0
next prev parent reply other threads:[~2014-11-26 0:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 0:49 [PATCH 0/9] Extend various drivers to run on bi-endian BMIPS hosts Kevin Cernekee
2014-11-26 0:49 ` [PATCH 1/9] power/reset: brcmstb: Make the driver buildable on MIPS Kevin Cernekee
[not found] ` <1416962994-27095-2-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-22 1:46 ` Sebastian Reichel
2014-11-26 0:49 ` [PATCH 2/9] power/reset: brcmstb: Use the DT "compatible" string to indicate bit positions Kevin Cernekee
2015-01-22 1:46 ` Sebastian Reichel
2014-11-26 0:49 ` Kevin Cernekee [this message]
[not found] ` <1416962994-27095-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-26 0:49 ` [PATCH 3/9] power/reset: brcmstb: Add support for old 65nm chips Kevin Cernekee
[not found] ` <1416962994-27095-4-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-22 1:47 ` Sebastian Reichel
2014-11-26 0:49 ` [PATCH 4/9] bus: brcmstb_gisb: Make the driver buildable on MIPS Kevin Cernekee
2014-11-26 0:49 ` [PATCH 5/9] bus: brcmstb_gisb: Introduce wrapper functions for MMIO accesses Kevin Cernekee
2014-11-26 0:49 ` [PATCH 6/9] bus: brcmstb_gisb: Look up register offsets in a table Kevin Cernekee
2014-11-26 0:49 ` [PATCH 8/9] bus: brcmstb_gisb: Honor the "big-endian" and "native-endian" DT properties Kevin Cernekee
2015-02-09 21:59 ` Florian Fainelli
[not found] ` <1416962994-27095-9-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-29 4:01 ` Florian Fainelli
2014-11-26 0:49 ` [PATCH 9/9] usb: {ohci,ehci}-platform: Use new OF big-endian helper function Kevin Cernekee
2014-11-26 4:15 ` Tony Prisk
2014-11-26 15:14 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1411261013340.1322-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-11-26 16:07 ` Kevin Cernekee
[not found] ` <CAJiQ=7CuLA2vDpnkDysBU100R0uuUidB_ua3sZdV74vNPjV76w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-26 16:24 ` Alan Stern
2014-11-26 5:33 ` [PATCH 0/9] Extend various drivers to run on bi-endian BMIPS hosts Florian Fainelli
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=1416962994-27095-8-git-send-email-cernekee@gmail.com \
--to=cernekee@gmail.com \
--cc=arnd@arndb.de \
--cc=computersforpeace@gmail.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=f.fainelli@gmail.com \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@prisktech.co.nz \
--cc=marc.ceeeee@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=stern@rowland.harvard.edu \
/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).