aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-11-25 19:49:52 -0500
committerFlorian Fainelli <f.fainelli@gmail.com>2014-11-28 18:44:44 -0500
commitd1d6786846e1c40f780edb83569597a8a7769e95 (patch)
treed49b7b12ec58f2422d2b968ecede7ccf2de38dec
parentf80835875d3d1a4764711a90f6cc2669f037f527 (diff)
bus: brcmstb_gisb: Add register offset tables for older chips
This will select the appropriate register layout based on the DT "compatible" string. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-rw-r--r--Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt6
-rw-r--r--drivers/bus/brcmstb_gisb.c52
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 e2d501d20c9a..1eceefb20f01 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
2 2
3Required properties: 3Required properties:
4 4
5- compatible: should be "brcm,gisb-arb" 5- compatible:
6 "brcm,gisb-arb" or "brcm,bcm7445-gisb-arb" for 28nm chips
7 "brcm,bcm7435-gisb-arb" for newer 40nm chips
8 "brcm,bcm7400-gisb-arb" for older 40nm chips and all 65nm chips
9 "brcm,bcm7038-gisb-arb" for 130nm chips
6- reg: specifies the base physical address and size of the registers 10- reg: specifies the base physical address and size of the registers
7- interrupt-parent: specifies the phandle to the parent interrupt controller 11- interrupt-parent: specifies the phandle to the parent interrupt controller
8 this arbiter gets interrupt line from 12 this arbiter gets interrupt line from
diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
index ef1e4238ef5f..172908da5957 100644
--- a/drivers/bus/brcmstb_gisb.c
+++ b/drivers/bus/brcmstb_gisb.c
@@ -47,6 +47,36 @@ enum {
47 ARB_ERR_CAP_MASTER, 47 ARB_ERR_CAP_MASTER,
48}; 48};
49 49
50static const int gisb_offsets_bcm7038[] = {
51 [ARB_TIMER] = 0x00c,
52 [ARB_ERR_CAP_CLR] = 0x0c4,
53 [ARB_ERR_CAP_HI_ADDR] = -1,
54 [ARB_ERR_CAP_ADDR] = 0x0c8,
55 [ARB_ERR_CAP_DATA] = 0x0cc,
56 [ARB_ERR_CAP_STATUS] = 0x0d0,
57 [ARB_ERR_CAP_MASTER] = -1,
58};
59
60static const int gisb_offsets_bcm7400[] = {
61 [ARB_TIMER] = 0x00c,
62 [ARB_ERR_CAP_CLR] = 0x0c8,
63 [ARB_ERR_CAP_HI_ADDR] = -1,
64 [ARB_ERR_CAP_ADDR] = 0x0cc,
65 [ARB_ERR_CAP_DATA] = 0x0d0,
66 [ARB_ERR_CAP_STATUS] = 0x0d4,
67 [ARB_ERR_CAP_MASTER] = 0x0d8,
68};
69
70static const int gisb_offsets_bcm7435[] = {
71 [ARB_TIMER] = 0x00c,
72 [ARB_ERR_CAP_CLR] = 0x168,
73 [ARB_ERR_CAP_HI_ADDR] = -1,
74 [ARB_ERR_CAP_ADDR] = 0x16c,
75 [ARB_ERR_CAP_DATA] = 0x170,
76 [ARB_ERR_CAP_STATUS] = 0x174,
77 [ARB_ERR_CAP_MASTER] = 0x178,
78};
79
50static const int gisb_offsets_bcm7445[] = { 80static const int gisb_offsets_bcm7445[] = {
51 [ARB_TIMER] = 0x008, 81 [ARB_TIMER] = 0x008,
52 [ARB_ERR_CAP_CLR] = 0x7e4, 82 [ARB_ERR_CAP_CLR] = 0x7e4,
@@ -230,10 +260,20 @@ static struct attribute_group gisb_arb_sysfs_attr_group = {
230 .attrs = gisb_arb_sysfs_attrs, 260 .attrs = gisb_arb_sysfs_attrs,
231}; 261};
232 262
263static const struct of_device_id brcmstb_gisb_arb_of_match[] = {
264 { .compatible = "brcm,gisb-arb", .data = gisb_offsets_bcm7445 },
265 { .compatible = "brcm,bcm7445-gisb-arb", .data = gisb_offsets_bcm7445 },
266 { .compatible = "brcm,bcm7435-gisb-arb", .data = gisb_offsets_bcm7435 },
267 { .compatible = "brcm,bcm7400-gisb-arb", .data = gisb_offsets_bcm7400 },
268 { .compatible = "brcm,bcm7038-gisb-arb", .data = gisb_offsets_bcm7038 },
269 { },
270};
271
233static int brcmstb_gisb_arb_probe(struct platform_device *pdev) 272static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
234{ 273{
235 struct device_node *dn = pdev->dev.of_node; 274 struct device_node *dn = pdev->dev.of_node;
236 struct brcmstb_gisb_arb_device *gdev; 275 struct brcmstb_gisb_arb_device *gdev;
276 const struct of_device_id *of_id;
237 struct resource *r; 277 struct resource *r;
238 int err, timeout_irq, tea_irq; 278 int err, timeout_irq, tea_irq;
239 unsigned int num_masters, j = 0; 279 unsigned int num_masters, j = 0;
@@ -254,7 +294,12 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
254 if (IS_ERR(gdev->base)) 294 if (IS_ERR(gdev->base))
255 return PTR_ERR(gdev->base); 295 return PTR_ERR(gdev->base);
256 296
257 gdev->gisb_offsets = gisb_offsets_bcm7445; 297 of_id = of_match_node(brcmstb_gisb_arb_of_match, dn);
298 if (!of_id) {
299 pr_err("failed to look up compatible string\n");
300 return -EINVAL;
301 }
302 gdev->gisb_offsets = of_id->data;
258 303
259 err = devm_request_irq(&pdev->dev, timeout_irq, 304 err = devm_request_irq(&pdev->dev, timeout_irq,
260 brcmstb_gisb_timeout_handler, 0, pdev->name, 305 brcmstb_gisb_timeout_handler, 0, pdev->name,
@@ -307,11 +352,6 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
307 return 0; 352 return 0;
308} 353}
309 354
310static const struct of_device_id brcmstb_gisb_arb_of_match[] = {
311 { .compatible = "brcm,gisb-arb" },
312 { },
313};
314
315static struct platform_driver brcmstb_gisb_arb_driver = { 355static struct platform_driver brcmstb_gisb_arb_driver = {
316 .probe = brcmstb_gisb_arb_probe, 356 .probe = brcmstb_gisb_arb_probe,
317 .driver = { 357 .driver = {