aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2011-05-10 17:31:32 -0400
committerRalf Baechle <ralf@linux-mips.org>2011-05-19 04:55:47 -0400
commitfe6f3642ac70d21004ddbe7242bd4548c35f1c10 (patch)
treecc1196f4aafc864effef6050af28b36eb4d413ba /arch
parenta7c62f8564357532872e106f0fa383728cf886cc (diff)
MIPS: BCM47xx: Register SSB fallback sprom callback
We are generating the prefix based on the PCI bus address the device is on. This is done like Broadcom does it in their code expect that the the bus number is increased by one. In the SB bus implementation used by Broadcom the SB bus emulates a PCI bus so the kernel sees one PCI bus more then in our implementation. We do not handle prefixes like sb/1/ yet as they are only used on the new bus which is not implemented yet. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2364/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/bcm47xx/nvram.c3
-rw-r--r--arch/mips/bcm47xx/setup.c22
2 files changed, 24 insertions, 1 deletions
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index e5b6615731e5..54db815bc86c 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2005 Broadcom Corporation 4 * Copyright (C) 2005 Broadcom Corporation
5 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 5 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
6 * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -23,7 +24,7 @@
23static char nvram_buf[NVRAM_SPACE]; 24static char nvram_buf[NVRAM_SPACE];
24 25
25/* Probe for NVRAM header */ 26/* Probe for NVRAM header */
26static void __init early_nvram_init(void) 27static void early_nvram_init(void)
27{ 28{
28 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 29 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
29 struct nvram_header *header; 30 struct nvram_header *header;
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index bbfcf9bd38db..258ffcf92754 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -3,6 +3,7 @@
3 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 3 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de> 4 * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
5 * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> 5 * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
6 * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -154,6 +155,22 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
154 } 155 }
155} 156}
156 157
158int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
159{
160 char prefix[10];
161
162 if (bus->bustype == SSB_BUSTYPE_PCI) {
163 snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
164 bus->host_pci->bus->number + 1,
165 PCI_SLOT(bus->host_pci->devfn));
166 bcm47xx_fill_sprom(out, prefix);
167 return 0;
168 } else {
169 printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n");
170 return -EINVAL;
171 }
172}
173
157static int bcm47xx_get_invariants(struct ssb_bus *bus, 174static int bcm47xx_get_invariants(struct ssb_bus *bus,
158 struct ssb_init_invariants *iv) 175 struct ssb_init_invariants *iv)
159{ 176{
@@ -185,6 +202,11 @@ void __init plat_mem_setup(void)
185 char buf[100]; 202 char buf[100];
186 struct ssb_mipscore *mcore; 203 struct ssb_mipscore *mcore;
187 204
205 err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom);
206 if (err)
207 printk(KERN_WARNING "bcm47xx: someone else already registered"
208 " a ssb SPROM callback handler (err %d)\n", err);
209
188 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, 210 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
189 bcm47xx_get_invariants); 211 bcm47xx_get_invariants);
190 if (err) 212 if (err)