Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 47484master
parent
b2dab45aa7
commit
f8692a4b88
@ -0,0 +1,114 @@ |
||||
From 590605c6bc31d5cbfcb3844ef98eb10ff7ce24c3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||
Date: Sun, 21 Jun 2015 15:25:49 +0200
|
||||
Subject: [PATCH] MIPS: BCM47xx: Simplify handling SPROM revisions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
After the big SPROM cleanup moving code to the bcm47xx_sprom_fill_auto
|
||||
we ended up with few tiny functions, two of them being identical. Let's
|
||||
get rid of these [12]-liners.
|
||||
This also stops extracting higher SPROM revisions as revision 1. Now we
|
||||
have that function nicely handling revisions we don't need it.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Cc: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/10569/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
---
|
||||
arch/mips/bcm47xx/sprom.c | 53 ++++++++---------------------------------------
|
||||
1 file changed, 9 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
|
||||
index b0d62e7..2d5c7a7 100644
|
||||
--- a/arch/mips/bcm47xx/sprom.c
|
||||
+++ b/arch/mips/bcm47xx/sprom.c
|
||||
@@ -200,6 +200,9 @@ static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom,
|
||||
const char *pre = prefix;
|
||||
bool fb = fallback;
|
||||
|
||||
+ /* Broadcom extracts it for rev 8+ but it was found on 2 and 4 too */
|
||||
+ ENTRY(0xfffffffe, u16, pre, "devid", dev_id, 0, fallback);
|
||||
+
|
||||
ENTRY(0xfffffffe, u16, pre, "boardrev", board_rev, 0, true);
|
||||
ENTRY(0xfffffffe, u32, pre, "boardflags", boardflags, 0, fb);
|
||||
ENTRY(0xfffffff0, u32, pre, "boardflags2", boardflags2, 0, fb);
|
||||
@@ -412,27 +415,6 @@ static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom,
|
||||
}
|
||||
#undef ENTRY /* It's specififc, uses local variable, don't use it (again). */
|
||||
|
||||
-static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
|
||||
- const char *prefix, bool fallback)
|
||||
-{
|
||||
- nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback);
|
||||
- nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback);
|
||||
-}
|
||||
-
|
||||
-static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix,
|
||||
- bool fallback)
|
||||
-{
|
||||
- nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
|
||||
- &sprom->leddc_off_time, fallback);
|
||||
-}
|
||||
-
|
||||
-static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom,
|
||||
- const char *prefix, bool fallback)
|
||||
-{
|
||||
- nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
|
||||
- &sprom->leddc_off_time, fallback);
|
||||
-}
|
||||
-
|
||||
static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom,
|
||||
const char *prefix, bool fallback)
|
||||
{
|
||||
@@ -589,39 +571,22 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
|
||||
|
||||
nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0, fallback);
|
||||
|
||||
+ /* Entries requiring custom functions */
|
||||
+ nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback);
|
||||
+ if (sprom->revision >= 3)
|
||||
+ nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
|
||||
+ &sprom->leddc_off_time, fallback);
|
||||
+
|
||||
switch (sprom->revision) {
|
||||
- case 1:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- break;
|
||||
- case 2:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- break;
|
||||
- case 3:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- bcm47xx_fill_sprom_r3(sprom, prefix, fallback);
|
||||
- break;
|
||||
case 4:
|
||||
case 5:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
|
||||
bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
|
||||
bcm47xx_fill_sprom_path_r45(sprom, prefix, fallback);
|
||||
break;
|
||||
case 8:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
|
||||
- bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
|
||||
- break;
|
||||
case 9:
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
- bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
|
||||
bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
|
||||
break;
|
||||
- default:
|
||||
- pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
|
||||
- sprom->revision);
|
||||
- sprom->revision = 1;
|
||||
- bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
|
||||
}
|
||||
|
||||
bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -0,0 +1,48 @@ |
||||
From e5dd8f2cf65cb228fad881ecd35093d8409d17c6 Mon Sep 17 00:00:00 2001
|
||||
From: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Date: Fri, 7 Aug 2015 09:59:10 +0200
|
||||
Subject: [PATCH] MIPS: BCM47xx: Use kmemdup rather than duplicating its
|
||||
implementation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The patch was generated using fixed coccinelle semantic patch
|
||||
scripts/coccinelle/api/memdup.cocci [1].
|
||||
|
||||
[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
|
||||
|
||||
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: Rafał Miłecki <zajec5@gmail.com>
|
||||
Cc: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
|
||||
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
Cc: linux-kernel@vger.kernel.org
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/10898/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
---
|
||||
arch/mips/bcm47xx/buttons.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
|
||||
index 08a4abf..52caa75 100644
|
||||
--- a/arch/mips/bcm47xx/buttons.c
|
||||
+++ b/arch/mips/bcm47xx/buttons.c
|
||||
@@ -396,10 +396,9 @@ static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
|
||||
{
|
||||
size_t size = nbuttons * sizeof(*buttons);
|
||||
|
||||
- bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL);
|
||||
+ bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
|
||||
if (!bcm47xx_button_pdata.buttons)
|
||||
return -ENOMEM;
|
||||
- memcpy(bcm47xx_button_pdata.buttons, buttons, size);
|
||||
bcm47xx_button_pdata.nbuttons = nbuttons;
|
||||
|
||||
return 0;
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -0,0 +1,51 @@ |
||||
From daa7ce02513d2188fe6f5ff47ce5ef83eb7de739 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||
Date: Sun, 25 Oct 2015 22:16:47 +0100
|
||||
Subject: [PATCH 1/3] MIPS: BCM47xx: Support on-SoC bus in SPROM reading
|
||||
function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
To support (extract) SPROM on Broadcom ARM devices we should separate
|
||||
SPROM code and make it a separated module. We won't want to export
|
||||
bcm47xx_fill_sprom symbol so we should support SoC SPROM in the standard
|
||||
fallback function and then modify ssb to use it.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/11355/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
---
|
||||
arch/mips/bcm47xx/sprom.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
|
||||
index 2d5c7a7..e19c1b9 100644
|
||||
--- a/arch/mips/bcm47xx/sprom.c
|
||||
+++ b/arch/mips/bcm47xx/sprom.c
|
||||
@@ -610,14 +610,18 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
|
||||
{
|
||||
char prefix[10];
|
||||
|
||||
- if (bus->bustype == SSB_BUSTYPE_PCI) {
|
||||
+ switch (bus->bustype) {
|
||||
+ case SSB_BUSTYPE_SSB:
|
||||
+ bcm47xx_fill_sprom(out, NULL, false);
|
||||
+ return 0;
|
||||
+ case SSB_BUSTYPE_PCI:
|
||||
memset(out, 0, sizeof(struct ssb_sprom));
|
||||
snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
|
||||
bus->host_pci->bus->number + 1,
|
||||
PCI_SLOT(bus->host_pci->devfn));
|
||||
bcm47xx_fill_sprom(out, prefix, false);
|
||||
return 0;
|
||||
- } else {
|
||||
+ default:
|
||||
pr_warn("Unable to fill SPROM for given bustype.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -0,0 +1,82 @@ |
||||
From 2f94acde42b70c81129b398c44aa09411974a16d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||
Date: Sun, 25 Oct 2015 22:16:48 +0100
|
||||
Subject: [PATCH 2/3] MIPS: BCM47xx: Fix some WARNINGs pointed in sprom.c by
|
||||
checkpatch.pl
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There are still few left:
|
||||
1) Most of them about lines over 80 chars (increased readability exception)
|
||||
2) Wrong parsing of preprocessor macros
|
||||
|
||||
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Cc: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/11356/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
---
|
||||
arch/mips/bcm47xx/sprom.c | 25 ++++++++++++++++---------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
|
||||
index e19c1b9..43353db 100644
|
||||
--- a/arch/mips/bcm47xx/sprom.c
|
||||
+++ b/arch/mips/bcm47xx/sprom.c
|
||||
@@ -60,9 +60,9 @@ static int get_nvram_var(const char *prefix, const char *postfix,
|
||||
}
|
||||
|
||||
#define NVRAM_READ_VAL(type) \
|
||||
-static void nvram_read_ ## type (const char *prefix, \
|
||||
- const char *postfix, const char *name, \
|
||||
- type *val, type allset, bool fallback) \
|
||||
+static void nvram_read_ ## type(const char *prefix, \
|
||||
+ const char *postfix, const char *name, \
|
||||
+ type *val, type allset, bool fallback) \
|
||||
{ \
|
||||
char buf[100]; \
|
||||
int err; \
|
||||
@@ -422,7 +422,10 @@ static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) {
|
||||
- struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i];
|
||||
+ struct ssb_sprom_core_pwr_info *pwr_info;
|
||||
+
|
||||
+ pwr_info = &sprom->core_pwr_info[i];
|
||||
+
|
||||
snprintf(postfix, sizeof(postfix), "%i", i);
|
||||
nvram_read_u8(prefix, postfix, "maxp2ga",
|
||||
&pwr_info->maxpwr_2g, 0, fallback);
|
||||
@@ -470,7 +473,10 @@ static void bcm47xx_fill_sprom_path_r45(struct ssb_sprom *sprom,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) {
|
||||
- struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i];
|
||||
+ struct ssb_sprom_core_pwr_info *pwr_info;
|
||||
+
|
||||
+ pwr_info = &sprom->core_pwr_info[i];
|
||||
+
|
||||
snprintf(postfix, sizeof(postfix), "%i", i);
|
||||
nvram_read_u16(prefix, postfix, "pa2gw3a",
|
||||
&pwr_info->pa_2g[3], 0, fallback);
|
||||
@@ -535,10 +541,11 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
|
||||
nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
|
||||
|
||||
/* The address prefix 00:90:4C is used by Broadcom in their initial
|
||||
- configuration. When a mac address with the prefix 00:90:4C is used
|
||||
- all devices from the same series are sharing the same mac address.
|
||||
- To prevent mac address collisions we replace them with a mac address
|
||||
- based on the base address. */
|
||||
+ * configuration. When a mac address with the prefix 00:90:4C is used
|
||||
+ * all devices from the same series are sharing the same mac address.
|
||||
+ * To prevent mac address collisions we replace them with a mac address
|
||||
+ * based on the base address.
|
||||
+ */
|
||||
if (!bcm47xx_is_valid_mac(sprom->il0mac)) {
|
||||
u8 mac[6];
|
||||
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -0,0 +1,102 @@ |
||||
From d8cfb5037bfc875e6dc8e09e4caceb443c04ff6a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||
Date: Mon, 26 Oct 2015 11:13:16 +0100
|
||||
Subject: [PATCH 3/3] MIPS: BCM47xx: Fetch board info directly in callback
|
||||
function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This drops another symbol dependency between setup.c and sprom.c which
|
||||
will allow us to make SPROM code a separated module (and share it with
|
||||
ARM).
|
||||
Patch tested on Linksys WRT300N V1.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||
Cc: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/11360/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
---
|
||||
arch/mips/bcm47xx/setup.c | 19 ++++++++++++++++++-
|
||||
arch/mips/bcm47xx/sprom.c | 13 -------------
|
||||
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 -----
|
||||
3 files changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
|
||||
index 17503a0..6d38948 100644
|
||||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -105,11 +105,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
|
||||
struct ssb_init_invariants *iv)
|
||||
{
|
||||
char buf[20];
|
||||
+ int len, err;
|
||||
|
||||
/* Fill boardinfo structure */
|
||||
memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
|
||||
|
||||
- bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
|
||||
+ len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
|
||||
+ if (len > 0) {
|
||||
+ err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
|
||||
+ if (err)
|
||||
+ pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
|
||||
+ buf);
|
||||
+ }
|
||||
+ if (!iv->boardinfo.vendor)
|
||||
+ iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
|
||||
+
|
||||
+ len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
|
||||
+ if (len > 0) {
|
||||
+ err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
|
||||
+ if (err)
|
||||
+ pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
|
||||
+ buf);
|
||||
+ }
|
||||
|
||||
memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
|
||||
bcm47xx_fill_sprom(&iv->sprom, NULL, false);
|
||||
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
|
||||
index 43353db..a7e569c 100644
|
||||
--- a/arch/mips/bcm47xx/sprom.c
|
||||
+++ b/arch/mips/bcm47xx/sprom.c
|
||||
@@ -599,19 +599,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
|
||||
bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_BCM47XX_SSB
|
||||
-void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
|
||||
- const char *prefix)
|
||||
-{
|
||||
- nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
|
||||
- true);
|
||||
- if (!boardinfo->vendor)
|
||||
- boardinfo->vendor = SSB_BOARDVENDOR_BCM;
|
||||
-
|
||||
- nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
#if defined(CONFIG_BCM47XX_SSB)
|
||||
static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
|
||||
{
|
||||
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
|
||||
index 1461c10..71e4096 100644
|
||||
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
|
||||
@@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
|
||||
void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
|
||||
bool fallback);
|
||||
|
||||
-#ifdef CONFIG_BCM47XX_SSB
|
||||
-void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
|
||||
- const char *prefix);
|
||||
-#endif
|
||||
-
|
||||
void bcm47xx_set_system_type(u16 chip_id);
|
||||
|
||||
#endif /* __ASM_BCM47XX_H */
|
||||
--
|
||||
1.8.4.5
|
||||
|
Loading…
Reference in new issue