Changeset 42272


Ignore:
Timestamp:
2014-08-24T17:57:49+02:00 (3 years ago)
Author:
hauke
Message:

bcm53xx: update bcma device tree intergeneration and fix nvram parsing

This fixes lots of sparse and checkpatch errors and extends the
documentation.

This also fixes a problem in the nvram parser, it now detects the
correct nvram on my Netgear R6250.

Signed-off-by: Hauke Mehrtens <hauke@…>

Location:
trunk/target/linux/bcm53xx
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/bcm53xx/config-3.14

    r42260 r42272  
    4343CONFIG_B53_SRAB_DRIVER=y 
    4444CONFIG_BCM47XX_NVRAM=y 
    45 CONFIG_BCM53XX_SPROM=y 
     45CONFIG_BCM47XX_SPROM=y 
    4646CONFIG_BCMA=y 
    4747CONFIG_BCMA_BLOCKIO=y 
  • trunk/target/linux/bcm53xx/patches-3.14/110-bcm47xx-move-the-nvram-header-file-into-common-space.patch

    r40880 r42272  
    1 From bd489dfe8c0d7495645cbc8b8c283217ba816fab Mon Sep 17 00:00:00 2001 
     1From 7063a1583166abe1a9cefed38c2f53a0e14a0005 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Sun, 4 May 2014 16:35:42 +0200 
    4 Subject: [PATCH 02/15] bcm47xx: move the nvram header file into common space 
    5  
    6 Moving mach-bcm47xx/bcm47xx_nvram.h makes it possible to reuse this 
    7 header on the arm bcm47xx (BCM5301X) devices. This way a driver gets 
    8 the correct functions to access the nvram depending on the SoC it boots 
    9 for. 
     4Subject: [PATCH 01/17] MIPS: BCM47XX: move the nvram header file into common 
     5 space 
     6 
     7Moving mach-bcm47xx/bcm47xx_nvram.h to include/linux/bcm47xx_nvram.h 
     8makes it possible to reuse this header on the ARM based bcm47xx/bcm53xx 
     9SoCs (e.g. BCM5301X devices). Broadcom uses ARM CPUs in their new SoC 
     10form the bcm47xx and bcm53xx line, but many other things like nvram 
     11stayed the same. 
     12 
     13This is a preparation for adding a new nvram driver, which can be used 
     14by the ARM SoC and the MIPS SoC code. The device drivers accessing 
     15nvram do not have to care about ARM or MIPS SoC version. 
     16 
     17Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1018--- 
    1119 arch/mips/bcm47xx/board.c                          |  2 +- 
     
    1422 arch/mips/bcm47xx/sprom.c                          |  2 +- 
    1523 arch/mips/bcm47xx/time.c                           |  2 +- 
    16  arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 53 ------------------ 
     24 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 53 ----------------- 
    1725 drivers/net/ethernet/broadcom/b44.c                |  8 +-- 
    1826 drivers/net/ethernet/broadcom/bgmac.c              |  2 +- 
    1927 drivers/ssb/driver_chipcommon_pmu.c                |  6 +- 
    20  include/linux/bcm47xx_nvram.h                      | 65 ++++++++++++++++++++++ 
    21  10 files changed, 73 insertions(+), 71 deletions(-) 
     28 include/linux/bcm47xx_nvram.h                      | 66 ++++++++++++++++++++++ 
     29 10 files changed, 74 insertions(+), 71 deletions(-) 
    2230 delete mode 100644 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h 
    2331 create mode 100644 include/linux/bcm47xx_nvram.h 
     
    203211--- /dev/null 
    204212+++ b/include/linux/bcm47xx_nvram.h 
    205 @@ -0,0 +1,65 @@ 
     213@@ -0,0 +1,66 @@ 
    206214+/* 
    207215+ *  Copyright (C) 2005, Broadcom Corporation 
     
    244252+int bcm47xx_nvram_gpio_pin(const char *name); 
    245253+#else 
    246 +static inline int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 
     254+static inline int bcm47xx_nvram_getenv(const char *name, char *val, 
     255+                                      size_t val_len) 
    247256+{ 
    248257+       return -ENXIO; 
  • trunk/target/linux/bcm53xx/patches-3.14/111-bcm47xx-nvram-add-new-nvram-driver-with-dt-support.patch

    r40880 r42272  
    1 From 60a413ed5bc7917f1612df441240f458163b10c1 Mon Sep 17 00:00:00 2001 
     1From 71a6bff8656a1713615ffdd9139a83d65ba46c6d Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Sat, 3 May 2014 22:54:59 +0200 
    4 Subject: [PATCH 03/15] bcm47xx-nvram: add new nvram driver with dt support 
     4Subject: [PATCH 02/17] bcm47xx-nvram: add new broadcom nvram driver with dt 
     5 support 
    56 
    6 This adds a new nvrm driver which uses device tree to provide nvram 
    7 access to other drivers. You have to specify the memory ranges where 
    8 the flash chip is mapped and this driver will search there for some 
    9 nvram and parse it. Other drivers can use this driver to access the 
     7This adds a new driver which searches at a given memory range for a 
     8nvram like it is used on the bcm47xx and bcm53xx SoCs with ARM and MIPS 
     9CPUs. This driver provides acces to this nvram to other device in the 
     10device tree. You have to specify the memory ranges where the content of 
     11the flash chip is memory mapped and this driver will search there for 
     12some nvram and parse it. Other drivers can use this driver to access the 
    1013device nvram. The nvram is used to store board configurations like the 
    11 mac address and also for configuration values in the vendor firmware. 
     14mac addresses, the switch configuration and the calibration data for 
     15the wifi devices. 
     16 
     17This was copied from arch/mips/bcm47xx/nvram.c and modified to interact 
     18with device tree. My plan is to make the MIPS bcm47xx also use this new 
     19driver some time later. 
     20 
     21Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1222--- 
    13  arch/mips/bcm47xx/board.c             |  36 +++--- 
    14  arch/mips/bcm47xx/nvram.c             |   7 +- 
    15  arch/mips/bcm47xx/setup.c             |   4 +- 
    16  arch/mips/bcm47xx/sprom.c             |   4 +- 
    17  arch/mips/bcm47xx/time.c              |   2 +- 
    18  drivers/misc/Kconfig                  |   5 + 
    19  drivers/misc/Makefile                 |   1 + 
    20  drivers/misc/bcm47xx-nvram.c          | 211 ++++++++++++++++++++++++++++++++++ 
    21  drivers/net/ethernet/broadcom/b44.c   |   2 +- 
    22  drivers/net/ethernet/broadcom/bgmac.c |   4 +- 
    23  drivers/ssb/driver_chipcommon_pmu.c   |   2 +- 
    24  include/linux/bcm47xx_nvram.h         |  16 ++- 
    25  12 files changed, 259 insertions(+), 35 deletions(-) 
     23 .../devicetree/bindings/misc/bcm47xx-nvram.txt     |  19 ++ 
     24 arch/mips/bcm47xx/board.c                          |  40 ++-- 
     25 arch/mips/bcm47xx/nvram.c                          |   7 +- 
     26 arch/mips/bcm47xx/setup.c                          |   4 +- 
     27 arch/mips/bcm47xx/sprom.c                          |   4 +- 
     28 arch/mips/bcm47xx/time.c                           |   2 +- 
     29 drivers/misc/Kconfig                               |   5 + 
     30 drivers/misc/Makefile                              |   1 + 
     31 drivers/misc/bcm47xx-nvram.c                       | 215 +++++++++++++++++++++ 
     32 drivers/net/ethernet/broadcom/b44.c                |   2 +- 
     33 drivers/net/ethernet/broadcom/bgmac.c              |   5 +- 
     34 drivers/ssb/driver_chipcommon_pmu.c                |   3 +- 
     35 include/linux/bcm47xx_nvram.h                      |  17 +- 
     36 13 files changed, 286 insertions(+), 38 deletions(-) 
     37 create mode 100644 Documentation/devicetree/bindings/misc/bcm47xx-nvram.txt 
    2638 create mode 100644 drivers/misc/bcm47xx-nvram.c 
    2739 
     40--- /dev/null 
     41+++ b/Documentation/devicetree/bindings/misc/bcm47xx-nvram.txt 
     42@@ -0,0 +1,19 @@ 
     43+Broadcom bcm47xx/bcm53xx nvram access driver 
     44+ 
     45+This driver provides access to the nvram for other drivers. 
     46+ 
     47+Required properties: 
     48+ 
     49+- compatible : brcm,bcm47xx-nvram 
     50+ 
     51+- reg : iomem address range 
     52+ 
     53+On NorthStar ARM SoCs the NAND flash is available at 0x1c000000 and the 
     54+NOR flash is at 0x1e000000 
     55+ 
     56+Example: 
     57+ 
     58+nvram0: nvram@0 { 
     59+       compatible = "brcm,bcm47xx-nvram"; 
     60+       reg = <0x1c000000 0x01000000>; 
     61+}; 
    2862--- a/arch/mips/bcm47xx/board.c 
    2963+++ b/arch/mips/bcm47xx/board.c 
     
    227261--- /dev/null 
    228262+++ b/drivers/misc/bcm47xx-nvram.c 
    229 @@ -0,0 +1,211 @@ 
     263@@ -0,0 +1,215 @@ 
    230264+/* 
    231265+ * BCM947xx nvram variable access 
     
    260294+static u32 find_nvram_size(void __iomem *end) 
    261295+{ 
    262 +       struct nvram_header *header; 
     296+       struct nvram_header __iomem *header; 
    263297+       int i; 
    264298+ 
    265299+       for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { 
    266 +               header = (struct nvram_header *)(end - nvram_sizes[i]); 
    267 +               if (header->magic == NVRAM_HEADER) 
     300+               header = (struct nvram_header __iomem *)(end - nvram_sizes[i]); 
     301+               if (__raw_readl(&header->magic) == NVRAM_HEADER) 
    268302+                       return nvram_sizes[i]; 
    269303+       } 
     
    277311+                              size_t *nvram_len) 
    278312+{ 
    279 +       struct nvram_header *header; 
     313+       struct nvram_header __iomem *header; 
    280314+       int i; 
    281315+       u32 off; 
    282 +       u32 *src, *dst; 
     316+       u32 *dst; 
     317+       __le32 __iomem *src; 
    283318+       u32 size; 
    284319+ 
     
    289324+               size = find_nvram_size(base + off); 
    290325+               if (size) { 
    291 +                       header = (struct nvram_header *)(base + off - size); 
     326+                       header = (struct nvram_header __iomem *) 
     327+                                       (base + off - size); 
    292328+                       goto found; 
    293329+               } 
    294 +               off <<= 1; 
     330+               off += 0x10000; 
    295331+       } 
    296332+ 
    297333+       /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ 
    298 +       header = (struct nvram_header *)(base + 4096); 
    299 +       if (header->magic == NVRAM_HEADER) { 
     334+       header = (struct nvram_header __iomem *)(base + 4096); 
     335+       if (__raw_readl(&header->magic) == NVRAM_HEADER) { 
    300336+               size = NVRAM_SPACE; 
    301337+               goto found; 
    302338+       } 
    303339+ 
    304 +       header = (struct nvram_header *)(base + 1024); 
    305 +       if (header->magic == NVRAM_HEADER) { 
     340+       header = (struct nvram_header __iomem *)(base + 1024); 
     341+       if (__raw_readl(&header->magic) == NVRAM_HEADER) { 
    306342+               size = NVRAM_SPACE; 
    307343+               goto found; 
     
    314350+ 
    315351+found: 
    316 +       if (header->len > size) 
     352+       if (readl(&header->len) > size) 
    317353+               pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n"); 
    318 +       *nvram_len = min_t(u32, header->len, size); 
     354+       *nvram_len = min_t(u32, readl(&header->len), size); 
    319355+ 
    320356+       *nvram_buf = devm_kzalloc(dev, *nvram_len, GFP_KERNEL); 
     
    322358+               return -ENOMEM; 
    323359+ 
    324 +       src = (u32 *) header; 
     360+       src = (__le32 __iomem *) header; 
    325361+       dst = (u32 *) *nvram_buf; 
    326362+       for (i = 0; i < sizeof(struct nvram_header); i += 4) 
    327 +               *dst++ = *src++; 
     363+               *dst++ = __raw_readl(src++); 
    328364+       for (; i < *nvram_len; i += 4) 
    329 +               *dst++ = le32_to_cpu(*src++); 
     365+               *dst++ = readl(src++); 
    330366+ 
    331367+       return 0; 
    332368+} 
    333369+ 
    334 +int bcm47xx_nvram_getenv(const struct device *dev, const char *name, char *val, size_t val_len) 
     370+int bcm47xx_nvram_getenv(const struct device *dev, const char *name, char *val, 
     371+                        size_t val_len) 
    335372+{ 
    336373+       char *var, *value, *end, *eq; 
     
    408445+               return -ENOMEM; 
    409446+ 
    410 +       err = nvram_find_and_copy(dev, mmio, resource_size(&flash_mem), &nvram->nvram_buf, &nvram->nvram_len); 
     447+       err = nvram_find_and_copy(dev, mmio, resource_size(&flash_mem), 
     448+                                 &nvram->nvram_buf, &nvram->nvram_len); 
    411449+       if (err) 
    412450+               goto err_unmap_mmio; 
     
    452490--- a/drivers/net/ethernet/broadcom/bgmac.c 
    453491+++ b/drivers/net/ethernet/broadcom/bgmac.c 
    454 @@ -974,7 +974,7 @@ static void bgmac_chip_reset(struct bgma 
     492@@ -974,7 +974,8 @@ static void bgmac_chip_reset(struct bgma 
    455493                             BGMAC_CHIPCTL_1_IF_TYPE_MII; 
    456494                char buf[4]; 
    457495  
    458496-               if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) { 
    459 +               if (bcm47xx_nvram_getenv(NULL, "et_swtype", buf, sizeof(buf)) > 0) { 
     497+               if (bcm47xx_nvram_getenv(NULL, "et_swtype", buf, 
     498+                                        sizeof(buf)) > 0) { 
    460499                        if (kstrtou8(buf, 0, &et_swtype)) 
    461500                                bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n", 
    462501                                          buf); 
    463 @@ -1534,7 +1534,7 @@ static int bgmac_probe(struct bcma_devic 
     502@@ -1534,7 +1535,7 @@ static int bgmac_probe(struct bcma_devic 
    464503        } 
    465504  
     
    472511--- a/drivers/ssb/driver_chipcommon_pmu.c 
    473512+++ b/drivers/ssb/driver_chipcommon_pmu.c 
    474 @@ -319,7 +319,7 @@ static void ssb_pmu_pll_init(struct ssb_ 
     513@@ -319,7 +319,8 @@ static void ssb_pmu_pll_init(struct ssb_ 
    475514  
    476515        if (bus->bustype == SSB_BUSTYPE_SSB) { 
    477516                char buf[20]; 
    478517-               if (bcm47xx_nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0) 
    479 +               if (bcm47xx_nvram_getenv(NULL, "xtalfreq", buf, sizeof(buf)) >= 0) 
     518+               if (bcm47xx_nvram_getenv(NULL, "xtalfreq", buf, 
     519+                                        sizeof(buf)) >= 0) 
    480520                        crystalfreq = simple_strtoul(buf, NULL, 0); 
    481521        } 
     
    483523--- a/include/linux/bcm47xx_nvram.h 
    484524+++ b/include/linux/bcm47xx_nvram.h 
    485 @@ -15,6 +15,8 @@ 
     525@@ -15,9 +15,11 @@ 
    486526 #include <linux/types.h> 
    487527 #include <linux/kernel.h> 
     
    491531 struct nvram_header { 
    492532        u32 magic; 
    493         u32 len; 
    494 @@ -33,17 +35,21 @@ struct nvram_header { 
     533-       u32 len; 
     534+       __le32 len; 
     535        u32 crc_ver_init;       /* 0:7 crc, 8:15 ver, 16:31 sdram_init */ 
     536        u32 config_refresh;     /* 0:15 sdram_config, 16:31 sdram_refresh */ 
     537        u32 config_ncdl;        /* ncdl values for memc */ 
     538@@ -33,18 +35,21 @@ struct nvram_header { 
    495539 #define NVRAM_MAX_VALUE_LEN 255 
    496540 #define NVRAM_MAX_PARAM_LEN 64 
     
    505549+int bcm47xx_nvram_gpio_pin(const struct device *dev, const char *name); 
    506550 #else 
    507 -static inline int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 
     551-static inline int bcm47xx_nvram_getenv(const char *name, char *val, 
    508552+static inline int bcm47xx_nvram_getenv(const struct device *dev, 
    509553+                                      const char *name, char *val, 
    510 +                                      size_t val_len) 
     554                                       size_t val_len) 
    511555 { 
    512556        return -ENXIO; 
  • trunk/target/linux/bcm53xx/patches-3.14/112-bcm53xx-sprom-add-sprom-driver.patch

    r40880 r42272  
    1 From b113f9d3e140f18e63cbf3408b3dcde372242dc8 Mon Sep 17 00:00:00 2001 
     1From 4e0ab3269a6d260a41a3673157753147f5f71341 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Sun, 4 May 2014 13:19:20 +0200 
    4 Subject: [PATCH 04/15] bcm53xx-sprom: add sprom driver 
     4Subject: [PATCH 03/17] bcm47xx-sprom: add Broadcom sprom parser driver 
    55 
    66This driver needs an nvram driver and fetches the sprom values from the 
    7 sprom and provides it to any other driver. The calibration data for the 
     7nvram and provides it to any other driver. The calibration data for the 
    88wifi chip the mac address and some more board description data is 
    99stores in the sprom. 
    1010 
     11This is based on a copy of arch/mips/bcm47xx/sprom.c and my plan is to 
     12make the bcm47xx MIPS SoCs also use this driver some time later. 
     13 
    1114Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1215--- 
    13  drivers/misc/Kconfig         |   5 + 
    14  drivers/misc/Makefile        |   1 + 
    15  drivers/misc/bcm53xx-sprom.c | 625 +++++++++++++++++++++++++++++++++++++++++++ 
    16  3 files changed, 631 insertions(+) 
    17  create mode 100644 drivers/misc/bcm53xx-sprom.c 
     16 .../devicetree/bindings/misc/bcm47xx-sprom.txt     |  16 + 
     17 drivers/misc/Kconfig                               |  11 + 
     18 drivers/misc/Makefile                              |   1 + 
     19 drivers/misc/bcm47xx-sprom.c                       | 690 +++++++++++++++++++++ 
     20 4 files changed, 718 insertions(+) 
     21 create mode 100644 Documentation/devicetree/bindings/misc/bcm47xx-sprom.txt 
     22 create mode 100644 drivers/misc/bcm47xx-sprom.c 
    1823 
     24--- /dev/null 
     25+++ b/Documentation/devicetree/bindings/misc/bcm47xx-sprom.txt 
     26@@ -0,0 +1,16 @@ 
     27+Broadcom bcm47xx/bcm53xx sprom converter 
     28+ 
     29+This driver provbides an sprom based on a given nvram. 
     30+ 
     31+Required properties: 
     32+ 
     33+- compatible : brcm,bcm47xx-sprom 
     34+ 
     35+- nvram : reference to a nvram driver, e.g. bcm47xx-nvram 
     36+ 
     37+Example: 
     38+ 
     39+sprom0: sprom@0 { 
     40+       compatible = "brcm,bcm47xx-sprom"; 
     41+       nvram = <&nvram0>; 
     42+}; 
    1943--- a/drivers/misc/Kconfig 
    2044+++ b/drivers/misc/Kconfig 
    21 @@ -520,6 +520,11 @@ config BCM47XX_NVRAM 
     45@@ -520,6 +520,17 @@ config BCM47XX_NVRAM 
    2246        help 
    2347                This adds support for the brcm47xx nvram driver. 
    2448  
    25 +config BCM53XX_SPROM 
    26 +       tristate "BCM53XX sprom driver" 
     49+config BCM47XX_SPROM 
     50+       tristate "BCM47XX sprom driver" 
    2751+       help 
    28 +               This adds support for the brcm53xx sprom driver. 
     52+         This driver parses the sprom from a given nvram which is found on 
     53+         Broadcom bcm47xx and bcm53xx SoCs. 
     54+ 
     55+         The sprom contains board configuration data like the 
     56+         calibration data fro the wifi chips, the mac addresses used 
     57+         by the board and many other board configuration data. This 
     58+         driver will provide the sprom to bcma. 
    2959+ 
    3060 source "drivers/misc/c2port/Kconfig" 
     
    3767 obj-$(CONFIG_GENWQE)           += genwqe/ 
    3868 obj-$(CONFIG_BCM47XX_NVRAM)    += bcm47xx-nvram.o 
    39 +obj-$(CONFIG_BCM53XX_SPROM)    += bcm53xx-sprom.o 
     69+obj-$(CONFIG_BCM47XX_SPROM)    += bcm47xx-sprom.o 
    4070--- /dev/null 
    41 +++ b/drivers/misc/bcm53xx-sprom.c 
    42 @@ -0,0 +1,625 @@ 
     71+++ b/drivers/misc/bcm47xx-sprom.c 
     72@@ -0,0 +1,690 @@ 
    4373+/* 
    44 + * BCM947xx nvram variable access 
     74+ * BCM47xx/BCM53xx nvram variable access 
    4575+ * 
    4676+ * Copyright (C) 2005 Broadcom Corporation 
     
    6898+#include <linux/ssb/ssb.h> 
    6999+#include <linux/bcm47xx_nvram.h> 
    70 + 
    71 +struct bcm53xx_sprom_fill { 
     100+#include <linux/if_ether.h> 
     101+#include <linux/etherdevice.h> 
     102+ 
     103+struct bcm47xx_sprom_fill { 
    72104+       const char *prefix; 
    73105+       bool fallback; 
    74 +       int (*getenv)(const struct bcm53xx_sprom_fill *fill, const char *name, char *val, size_t val_len); 
     106+       int (*getenv)(const struct bcm47xx_sprom_fill *fill, const char *name, 
     107+                     char *val, size_t val_len); 
    75108+       const void *priv; 
    76109+}; 
     
    89122+} 
    90123+ 
    91 +static int get_nvram_var(const struct bcm53xx_sprom_fill *fill, const char *postfix, 
    92 +                        const char *name, char *buf, int len) 
     124+static int get_nvram_var(const struct bcm47xx_sprom_fill *fill, 
     125+                        const char *postfix, const char *name, char *buf, 
     126+                        int len) 
    93127+{ 
    94128+       char key[40]; 
     
    106140+ 
    107141+#define NVRAM_READ_VAL(type)                                           \ 
    108 +static void nvram_read_ ## type (const struct bcm53xx_sprom_fill *fill,        \ 
     142+static void nvram_read_ ## type (const struct bcm47xx_sprom_fill *fill,        \ 
    109143+                                const char *postfix, const char *name, \ 
    110144+                                type *val, type allset)                \ 
     
    135169+#undef NVRAM_READ_VAL 
    136170+ 
    137 +static void nvram_read_u32_2(const struct bcm53xx_sprom_fill *fill, const char *name, 
    138 +                            u16 *val_lo, u16 *val_hi) 
     171+static void nvram_read_u32_2(const struct bcm47xx_sprom_fill *fill, 
     172+                            const char *name, u16 *val_lo, u16 *val_hi) 
    139173+{ 
    140174+       char buf[100]; 
     
    155189+} 
    156190+ 
    157 +static void nvram_read_leddc(const struct bcm53xx_sprom_fill *fill, const char *name, 
    158 +                            u8 *leddc_on_time, u8 *leddc_off_time) 
     191+static void nvram_read_leddc(const struct bcm47xx_sprom_fill *fill, 
     192+                            const char *name, u8 *leddc_on_time, 
     193+                            u8 *leddc_off_time) 
    159194+{ 
    160195+       char buf[100]; 
     
    179214+} 
    180215+ 
    181 +static void nvram_read_macaddr(const struct bcm53xx_sprom_fill *fill, const char *name, 
    182 +                              u8 val[6]) 
     216+static void nvram_read_macaddr(const struct bcm47xx_sprom_fill *fill, 
     217+                              const char *name, u8 val[6]) 
    183218+{ 
    184219+       char buf[100]; 
     
    192227+} 
    193228+ 
    194 +static void nvram_read_alpha2(const struct bcm53xx_sprom_fill *fill, const char *name, 
    195 +                            char val[2]) 
     229+static void nvram_read_alpha2(const struct bcm47xx_sprom_fill *fill, 
     230+                             const char *name, char val[2]) 
    196231+{ 
    197232+       char buf[10]; 
     
    210245+} 
    211246+ 
    212 +static void bcm53xx_sprom_fill_r1234589(struct ssb_sprom *sprom, 
    213 +                                       const struct bcm53xx_sprom_fill *fill) 
    214 +{ 
     247+static void bcm47xx_sprom_fill_r1234589(struct ssb_sprom *sprom, 
     248+                                       const struct bcm47xx_sprom_fill *fill) 
     249+{ 
     250+       nvram_read_u16(fill, NULL, "devid", &sprom->dev_id, 0); 
    215251+       nvram_read_u8(fill, NULL, "ledbh0", &sprom->gpio0, 0xff); 
    216252+       nvram_read_u8(fill, NULL, "ledbh1", &sprom->gpio1, 0xff); 
     
    224260+} 
    225261+ 
    226 +static void bcm53xx_sprom_fill_r12389(struct ssb_sprom *sprom, 
    227 +                                     const struct bcm53xx_sprom_fill *fill) 
     262+static void bcm47xx_sprom_fill_r12389(struct ssb_sprom *sprom, 
     263+                                     const struct bcm47xx_sprom_fill *fill) 
    228264+{ 
    229265+       nvram_read_u16(fill, NULL, "pa0b0", &sprom->pa0b0, 0); 
     
    239275+} 
    240276+ 
    241 +static void bcm53xx_sprom_fill_r1(struct ssb_sprom *sprom, 
    242 +                                 const struct bcm53xx_sprom_fill *fill) 
     277+static void bcm47xx_sprom_fill_r1(struct ssb_sprom *sprom, 
     278+                                 const struct bcm47xx_sprom_fill *fill) 
    243279+{ 
    244280+       nvram_read_u16(fill, NULL, "boardflags", &sprom->boardflags_lo, 0); 
     
    246282+} 
    247283+ 
    248 +static void bcm53xx_sprom_fill_r2389(struct ssb_sprom *sprom, 
    249 +                                    const struct bcm53xx_sprom_fill *fill) 
     284+static void bcm47xx_sprom_fill_r2389(struct ssb_sprom *sprom, 
     285+                                    const struct bcm47xx_sprom_fill *fill) 
    250286+{ 
    251287+       nvram_read_u8(fill, NULL, "opo", &sprom->opo, 0); 
     
    260296+} 
    261297+ 
    262 +static void bcm53xx_sprom_fill_r389(struct ssb_sprom *sprom, 
    263 +                                   const struct bcm53xx_sprom_fill *fill) 
     298+static void bcm47xx_sprom_fill_r389(struct ssb_sprom *sprom, 
     299+                                   const struct bcm47xx_sprom_fill *fill) 
    264300+{ 
    265301+       nvram_read_u8(fill, NULL, "bxa2g", &sprom->bxa2g, 0); 
     
    279315+} 
    280316+ 
    281 +static void bcm53xx_sprom_fill_r3(struct ssb_sprom *sprom, 
    282 +                                 const struct bcm53xx_sprom_fill *fill) 
     317+static void bcm47xx_sprom_fill_r3(struct ssb_sprom *sprom, 
     318+                                 const struct bcm47xx_sprom_fill *fill) 
    283319+{ 
    284320+       nvram_read_u8(fill, NULL, "regrev", &sprom->regrev, 0); 
     
    287323+} 
    288324+ 
    289 +static void bcm53xx_sprom_fill_r4589(struct ssb_sprom *sprom, 
    290 +                                    const struct bcm53xx_sprom_fill *fill) 
     325+static void bcm47xx_sprom_fill_r4589(struct ssb_sprom *sprom, 
     326+                                    const struct bcm47xx_sprom_fill *fill) 
    291327+{ 
    292328+       nvram_read_u8(fill, NULL, "regrev", &sprom->regrev, 0); 
     
    300336+} 
    301337+ 
    302 +static void bcm53xx_sprom_fill_r458(struct ssb_sprom *sprom, 
    303 +                                   const struct bcm53xx_sprom_fill *fill) 
     338+static void bcm47xx_sprom_fill_r458(struct ssb_sprom *sprom, 
     339+                                   const struct bcm47xx_sprom_fill *fill) 
    304340+{ 
    305341+       nvram_read_u16(fill, NULL, "cck2gpo", &sprom->cck2gpo, 0); 
     
    346382+} 
    347383+ 
    348 +static void bcm53xx_sprom_fill_r45(struct ssb_sprom *sprom, 
    349 +                                  const struct bcm53xx_sprom_fill *fill) 
     384+static void bcm47xx_sprom_fill_r45(struct ssb_sprom *sprom, 
     385+                                  const struct bcm47xx_sprom_fill *fill) 
    350386+{ 
    351387+       nvram_read_u8(fill, NULL, "txpid2ga0", &sprom->txpid2g[0], 0); 
     
    367403+} 
    368404+ 
    369 +static void bcm53xx_sprom_fill_r89(struct ssb_sprom *sprom, 
    370 +                                  const struct bcm53xx_sprom_fill *fill) 
     405+static void bcm47xx_sprom_fill_r89(struct ssb_sprom *sprom, 
     406+                                  const struct bcm47xx_sprom_fill *fill) 
    371407+{ 
    372408+       nvram_read_u8(fill, NULL, "tssipos2g", &sprom->fem.ghz2.tssipos, 0); 
     
    430466+} 
    431467+ 
    432 +static void bcm53xx_sprom_fill_r9(struct ssb_sprom *sprom, 
    433 +                                 const struct bcm53xx_sprom_fill *fill) 
     468+static void bcm47xx_sprom_fill_r9(struct ssb_sprom *sprom, 
     469+                                 const struct bcm47xx_sprom_fill *fill) 
    434470+{ 
    435471+       nvram_read_u16(fill, NULL, "cckbw202gpo", &sprom->cckbw202gpo, 0); 
     
    461497+} 
    462498+ 
    463 +static void bcm53xx_sprom_fill_path_r4589(struct ssb_sprom *sprom, 
    464 +                                         const struct bcm53xx_sprom_fill *fill) 
     499+static void bcm47xx_sprom_fill_path_r4589(struct ssb_sprom *sprom, 
     500+                                         const struct bcm47xx_sprom_fill *fill) 
    465501+{ 
    466502+       char postfix[2]; 
     
    469505+       for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) { 
    470506+               struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i]; 
     507+ 
    471508+               snprintf(postfix, sizeof(postfix), "%i", i); 
    472509+               nvram_read_u8(fill, postfix, "maxp2ga", &pwr_info->maxpwr_2g, 0); 
     
    491528+} 
    492529+ 
    493 +static void bcm53xx_sprom_fill_path_r45(struct ssb_sprom *sprom, 
    494 +                                       const struct bcm53xx_sprom_fill *fill) 
     530+static void bcm47xx_sprom_fill_path_r45(struct ssb_sprom *sprom, 
     531+                                       const struct bcm47xx_sprom_fill *fill) 
    495532+{ 
    496533+       char postfix[2]; 
     
    499536+       for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) { 
    500537+               struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i]; 
     538+ 
    501539+               snprintf(postfix, sizeof(postfix), "%i", i); 
    502540+               nvram_read_u16(fill, postfix, "pa2gw3a", &pwr_info->pa_2g[3], 0); 
     
    507545+} 
    508546+ 
    509 +static void bcm53xx_sprom_fill_ethernet(struct ssb_sprom *sprom, 
    510 +                                       const struct bcm53xx_sprom_fill *fill) 
     547+static bool bcm47xx_is_valid_mac(u8 *mac) 
     548+{ 
     549+       return mac && !(mac[0] == 0x00 && mac[1] == 0x90 && mac[2] == 0x4c); 
     550+} 
     551+ 
     552+static int bcm47xx_increase_mac_addr(u8 *mac, u8 num) 
     553+{ 
     554+       u8 *oui = mac + ETH_ALEN/2 - 1; 
     555+       u8 *p = mac + ETH_ALEN - 1; 
     556+ 
     557+       do { 
     558+               (*p) += num; 
     559+               if (*p > num) 
     560+                       break; 
     561+               p--; 
     562+               num = 1; 
     563+       } while (p != oui); 
     564+ 
     565+       if (p == oui) { 
     566+               pr_err("unable to fetch mac address\n"); 
     567+               return -ENOENT; 
     568+       } 
     569+       return 0; 
     570+} 
     571+ 
     572+/* 
     573+ * This is a global counter because different instances of sprom will 
     574+ * access the same nvram. 
     575+ */ 
     576+static int mac_addr_used = 2; 
     577+ 
     578+static void bcm47xx_sprom_fill_ethernet(struct ssb_sprom *sprom, 
     579+                                       const struct bcm47xx_sprom_fill *fill) 
    511580+{ 
    512581+       nvram_read_macaddr(fill, "et0macaddr", sprom->et0mac); 
     
    520589+       nvram_read_macaddr(fill, "macaddr", sprom->il0mac); 
    521590+       nvram_read_macaddr(fill, "il0macaddr", sprom->il0mac); 
    522 +} 
    523 + 
    524 +static void bcm53xx_sprom_fill_board_data(struct ssb_sprom *sprom, 
    525 +                                         const struct bcm53xx_sprom_fill *fill) 
     591+ 
     592+       /* 
     593+        * The address prefix 00:90:4C is used by Broadcom in their initial 
     594+        * configuration. When a mac address with the prefix 00:90:4C is used 
     595+        * all devices from the same series are sharing the same mac address. 
     596+        * To prevent mac address collisions we replace them with a mac address 
     597+        * based on the base address. 
     598+        */ 
     599+       if (!bcm47xx_is_valid_mac(sprom->il0mac)) { 
     600+               u8 mac[6]; 
     601+               struct bcm47xx_sprom_fill fill_no_prefix; 
     602+ 
     603+               memcpy(&fill_no_prefix, fill, sizeof(fill_no_prefix)); 
     604+               fill_no_prefix.prefix = NULL; 
     605+ 
     606+               nvram_read_macaddr(&fill_no_prefix, "et0macaddr", mac); 
     607+               if (bcm47xx_is_valid_mac(mac)) { 
     608+                       int err = bcm47xx_increase_mac_addr(mac, mac_addr_used); 
     609+ 
     610+                       if (!err) { 
     611+                               ether_addr_copy(sprom->il0mac, mac); 
     612+                               mac_addr_used++; 
     613+                       } 
     614+               } 
     615+       } 
     616+} 
     617+ 
     618+static void bcm47xx_sprom_fill_board_data(struct ssb_sprom *sprom, 
     619+                                         const struct bcm47xx_sprom_fill *fill) 
    526620+{ 
    527621+       nvram_read_u16(fill, NULL, "boardrev", &sprom->board_rev, 0); 
     
    534628+} 
    535629+ 
    536 +static void bcm53xx_sprom_fill(struct ssb_sprom *sprom, 
    537 +                       const struct bcm53xx_sprom_fill *fill) 
    538 +{ 
    539 +       bcm53xx_sprom_fill_ethernet(sprom, fill); 
    540 +       bcm53xx_sprom_fill_board_data(sprom, fill); 
     630+static void bcm47xx_sprom_fill(struct ssb_sprom *sprom, 
     631+                              const struct bcm47xx_sprom_fill *fill) 
     632+{ 
     633+       bcm47xx_sprom_fill_ethernet(sprom, fill); 
     634+       bcm47xx_sprom_fill_board_data(sprom, fill); 
    541635+ 
    542636+       nvram_read_u8(fill, NULL, "sromrev", &sprom->revision, 0); 
     
    544638+       switch (sprom->revision) { 
    545639+       case 1: 
    546 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    547 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    548 +               bcm53xx_sprom_fill_r1(sprom, fill); 
     640+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     641+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     642+               bcm47xx_sprom_fill_r1(sprom, fill); 
    549643+               break; 
    550644+       case 2: 
    551 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    552 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    553 +               bcm53xx_sprom_fill_r2389(sprom, fill); 
     645+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     646+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     647+               bcm47xx_sprom_fill_r2389(sprom, fill); 
    554648+               break; 
    555649+       case 3: 
    556 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    557 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    558 +               bcm53xx_sprom_fill_r2389(sprom, fill); 
    559 +               bcm53xx_sprom_fill_r389(sprom, fill); 
    560 +               bcm53xx_sprom_fill_r3(sprom, fill); 
     650+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     651+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     652+               bcm47xx_sprom_fill_r2389(sprom, fill); 
     653+               bcm47xx_sprom_fill_r389(sprom, fill); 
     654+               bcm47xx_sprom_fill_r3(sprom, fill); 
    561655+               break; 
    562656+       case 4: 
    563657+       case 5: 
    564 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    565 +               bcm53xx_sprom_fill_r4589(sprom, fill); 
    566 +               bcm53xx_sprom_fill_r458(sprom, fill); 
    567 +               bcm53xx_sprom_fill_r45(sprom, fill); 
    568 +               bcm53xx_sprom_fill_path_r4589(sprom, fill); 
    569 +               bcm53xx_sprom_fill_path_r45(sprom, fill); 
     658+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     659+               bcm47xx_sprom_fill_r4589(sprom, fill); 
     660+               bcm47xx_sprom_fill_r458(sprom, fill); 
     661+               bcm47xx_sprom_fill_r45(sprom, fill); 
     662+               bcm47xx_sprom_fill_path_r4589(sprom, fill); 
     663+               bcm47xx_sprom_fill_path_r45(sprom, fill); 
    570664+               break; 
    571665+       case 8: 
    572 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    573 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    574 +               bcm53xx_sprom_fill_r2389(sprom, fill); 
    575 +               bcm53xx_sprom_fill_r389(sprom, fill); 
    576 +               bcm53xx_sprom_fill_r4589(sprom, fill); 
    577 +               bcm53xx_sprom_fill_r458(sprom, fill); 
    578 +               bcm53xx_sprom_fill_r89(sprom, fill); 
    579 +               bcm53xx_sprom_fill_path_r4589(sprom, fill); 
     666+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     667+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     668+               bcm47xx_sprom_fill_r2389(sprom, fill); 
     669+               bcm47xx_sprom_fill_r389(sprom, fill); 
     670+               bcm47xx_sprom_fill_r4589(sprom, fill); 
     671+               bcm47xx_sprom_fill_r458(sprom, fill); 
     672+               bcm47xx_sprom_fill_r89(sprom, fill); 
     673+               bcm47xx_sprom_fill_path_r4589(sprom, fill); 
    580674+               break; 
    581675+       case 9: 
    582 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    583 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    584 +               bcm53xx_sprom_fill_r2389(sprom, fill); 
    585 +               bcm53xx_sprom_fill_r389(sprom, fill); 
    586 +               bcm53xx_sprom_fill_r4589(sprom, fill); 
    587 +               bcm53xx_sprom_fill_r89(sprom, fill); 
    588 +               bcm53xx_sprom_fill_r9(sprom, fill); 
    589 +               bcm53xx_sprom_fill_path_r4589(sprom, fill); 
     676+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     677+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     678+               bcm47xx_sprom_fill_r2389(sprom, fill); 
     679+               bcm47xx_sprom_fill_r389(sprom, fill); 
     680+               bcm47xx_sprom_fill_r4589(sprom, fill); 
     681+               bcm47xx_sprom_fill_r89(sprom, fill); 
     682+               bcm47xx_sprom_fill_r9(sprom, fill); 
     683+               bcm47xx_sprom_fill_path_r4589(sprom, fill); 
    590684+               break; 
    591685+       default: 
     
    593687+                       sprom->revision); 
    594688+               sprom->revision = 1; 
    595 +               bcm53xx_sprom_fill_r1234589(sprom, fill); 
    596 +               bcm53xx_sprom_fill_r12389(sprom, fill); 
    597 +               bcm53xx_sprom_fill_r1(sprom, fill); 
    598 +       } 
    599 +} 
    600 + 
    601 +static int bcm53xx_sprom_getenv(const struct bcm53xx_sprom_fill *fill, 
     689+               bcm47xx_sprom_fill_r1234589(sprom, fill); 
     690+               bcm47xx_sprom_fill_r12389(sprom, fill); 
     691+               bcm47xx_sprom_fill_r1(sprom, fill); 
     692+       } 
     693+} 
     694+ 
     695+static int bcm47xx_sprom_getenv(const struct bcm47xx_sprom_fill *fill, 
    602696+                               const char *name, char *val, size_t val_len) 
    603697+{ 
     
    607701+}; 
    608702+ 
    609 +static int bcm53xx_sprom_probe(struct platform_device *pdev) 
     703+static int bcm47xx_sprom_probe(struct platform_device *pdev) 
    610704+{ 
    611705+       struct device *dev = &pdev->dev; 
    612706+       struct device_node *np = dev->of_node; 
    613707+       struct ssb_sprom *sprom; 
    614 +       const phandle *handle; 
     708+       const __be32 *handle; 
    615709+       struct device_node *nvram_node; 
    616710+       struct platform_device *nvram_dev; 
    617 +       struct bcm53xx_sprom_fill fill; 
     711+       struct bcm47xx_sprom_fill fill; 
    618712+ 
    619713+       /* Alloc */ 
     
    634728+               return -ENOMEM; 
    635729+ 
    636 +       fill.prefix = NULL; 
     730+       fill.prefix = of_get_property(np, "prefix", NULL); 
     731+ 
    637732+       fill.fallback = false; 
    638 +       fill.getenv = bcm53xx_sprom_getenv; 
     733+       fill.getenv = bcm47xx_sprom_getenv; 
    639734+       fill.priv = nvram_dev; 
    640735+ 
    641 +       bcm53xx_sprom_fill(sprom, &fill); 
     736+       bcm47xx_sprom_fill(sprom, &fill); 
    642737+ 
    643738+       platform_set_drvdata(pdev, sprom); 
     
    646741+} 
    647742+ 
    648 +static const struct of_device_id bcm53xx_sprom_of_match_table[] = { 
    649 +       { .compatible = "brcm,bcm53xx-sprom", }, 
     743+static const struct of_device_id bcm47xx_sprom_of_match_table[] = { 
     744+       { .compatible = "brcm,bcm47xx-sprom", }, 
    650745+       {}, 
    651746+}; 
    652747+MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table); 
    653748+ 
    654 +static struct platform_driver bcm53xx_sprom_driver = { 
     749+static struct platform_driver bcm47xx_sprom_driver = { 
    655750+       .driver = { 
    656751+               .owner = THIS_MODULE, 
    657 +               .name = "bcm53xx-sprom", 
    658 +               .of_match_table = bcm53xx_sprom_of_match_table, 
     752+               .name = "bcm47xx-sprom", 
     753+               .of_match_table = bcm47xx_sprom_of_match_table, 
    659754+               /* driver unloading/unbinding currently not supported */ 
    660755+               .suppress_bind_attrs = true, 
    661756+       }, 
    662 +       .probe = bcm53xx_sprom_probe, 
     757+       .probe = bcm47xx_sprom_probe, 
    663758+}; 
    664 +module_platform_driver(bcm53xx_sprom_driver); 
     759+module_platform_driver(bcm47xx_sprom_driver); 
    665760+ 
    666761+MODULE_AUTHOR("Hauke Mehrtens <hauke@hauke-m.de>"); 
    667 +MODULE_LICENSE("GPLv2"); 
     762+MODULE_LICENSE("GPL v2"); 
  • trunk/target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch

    r41913 r42272  
    1 From bb5d497aeceb8d9f36a1d990538389b54748dfcd Mon Sep 17 00:00:00 2001 
     1From 04b91da96d7c163fd39c0849d2034e2928103f4d Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Mon, 6 Jan 2014 23:29:15 +0100 
    4 Subject: [PATCH 05/15] bcma: register bcma as device tree driver 
     4Subject: [PATCH 04/17] bcma: register bcma as device tree driver 
    55 
    6 This driver is used by the bcm53xx ARM SoC code.Now it is possible to 
    7 give the address of the chipcommon core in device tree. 
     6This driver is used by the bcm53xx ARM SoC code. Now it is possible to 
     7give the address of the chipcommon core in device tree and bcma will 
     8search for all the other cores. 
    89 
    910Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1011--- 
    11  drivers/bcma/host_soc.c   | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 
    12  include/linux/bcma/bcma.h |  2 ++ 
    13  2 files changed, 72 insertions(+) 
     12 Documentation/devicetree/bindings/bus/bcma.txt | 46 +++++++++++++++++ 
     13 drivers/bcma/host_soc.c                        | 70 ++++++++++++++++++++++++++ 
     14 include/linux/bcma/bcma.h                      |  2 + 
     15 3 files changed, 118 insertions(+) 
     16 create mode 100644 Documentation/devicetree/bindings/bus/bcma.txt 
    1417 
     18--- /dev/null 
     19+++ b/Documentation/devicetree/bindings/bus/bcma.txt 
     20@@ -0,0 +1,46 @@ 
     21+Broadcom AIX bcma bus driver 
     22+ 
     23+ 
     24+Required properties: 
     25+ 
     26+- compatible : brcm,bus-aix 
     27+ 
     28+- reg : iomem address range of chipcommon core 
     29+ 
     30+Optional properties: 
     31+ 
     32+- sprom: reference to a sprom driver. This is needed for sprom less devices. 
     33+        Use bcm47xx_sprom for example. 
     34+ 
     35+ 
     36+The cores on the AIX bus are auto detected by bcma. Detection of the 
     37+IRQ number is not supported on BCM47xx/BCM53xx ARM SoCs, so it is 
     38+possible to provide the IRQ number over device tree. The IRQ number and 
     39+the device tree child entry will be added to the core with the matching 
     40+reg address. 
     41+ 
     42+Example: 
     43+ 
     44+       aix@18000000 { 
     45+               compatible = "brcm,bus-aix"; 
     46+               reg = <0x18000000 0x1000>; 
     47+               ranges = <0x00000000 0x18000000 0x00100000>; 
     48+               #address-cells = <1>; 
     49+               #size-cells = <1>; 
     50+               sprom = <&sprom0>; 
     51+ 
     52+               gmac@0 { 
     53+                       reg = <0x18024000 0x1000>; 
     54+                       interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>; 
     55+               }; 
     56+ 
     57+               gmac@1 { 
     58+                       reg = <0x18025000 0x1000>; 
     59+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; 
     60+               }; 
     61+ 
     62+               pcie@0 { 
     63+                       reg = <0x18012000 0x1000>; 
     64+                       interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; 
     65+               }; 
     66+       }; 
    1567--- a/drivers/bcma/host_soc.c 
    1668+++ b/drivers/bcma/host_soc.c 
  • trunk/target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch

    r41804 r42272  
    1 From 3e59da41882a408064cd23f4c9124a7938bdb91f Mon Sep 17 00:00:00 2001 
     1From eaf1943a2c49cbc6eb0ffafa7b6ced45f2d328da Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Thu, 9 Jan 2014 19:40:14 +0100 
    4 Subject: [PATCH 06/15] bcma: get irqs from dt 
     4Subject: [PATCH 05/17] bcma: get IRQ numbers from dt 
    55 
    6 If bcma was registered with device tree it will search for some nodes 
    7 with the irq number and add it to the core configuration. 
     6It is not possible to auto detect the irq numbers used by the cores on 
     7an arm SoC. If bcma was registered with device tree it will search for 
     8some device tree nodes with the irq number and add it to the core 
     9configuration. 
     10 
     11Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    812--- 
    913 drivers/bcma/main.c | 42 +++++++++++++++++++++++++++++++++++++++++- 
     
    3640+ 
    3741+       for_each_child_of_node(parent->dev.of_node, node) { 
    38 +               reg = of_get_address(node, 0, &size, 0); 
     42+               reg = of_get_address(node, 0, &size, NULL); 
    3943+               if (!reg) 
    4044+                       continue; 
  • trunk/target/linux/bcm53xx/patches-3.14/123-bcma-get-sprom-from-devicetree.patch

    r41913 r42272  
    1 From 5d94449a92e4121b408e7cb8931a47984135eeea Mon Sep 17 00:00:00 2001 
     1From bd9106f5907080b467026bdaaea979fac8c7badb Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Sun, 4 May 2014 14:34:31 +0200 
    4 Subject: [PATCH 07/15] bcma: get sprom from devicetree 
     4Subject: [PATCH 06/17] bcma: get sprom from devicetree 
    55 
    66This patch make it possible to device an sprom provider in device tree 
     
    3232+                                  struct ssb_sprom *out) 
    3333+{ 
    34 +       const phandle *handle; 
     34+       const __be32 *handle; 
    3535+       struct device_node *sprom_node; 
    3636+       struct platform_device *sprom_dev; 
  • trunk/target/linux/bcm53xx/patches-3.14/130-ARM-BCM5301X-register-bcma-bus.patch

    r40880 r42272  
    1 From 23bcd5e7cb2aaee48ba8b2351f032a230d948b6f Mon Sep 17 00:00:00 2001 
     1From 414f0ad9b3a8e8ee6eaf09c6d79d5f448ac28630 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Sat, 25 Jan 2014 17:03:07 +0100 
    4 Subject: [PATCH 08/15] ARM: BCM5301X: register bcma bus 
     4Subject: [PATCH 07/17] ARM: BCM5301X: register bcma bus 
    55 
    66--- 
     
    2020+ 
    2121+       sprom0: sprom@0 { 
    22 +               compatible = "brcm,bcm53xx-sprom"; 
     22+               compatible = "brcm,bcm47xx-sprom"; 
    2323+               nvram = <&nvram0>; 
    2424+       }; 
  • trunk/target/linux/bcm53xx/patches-3.14/140-bcma-only-map-wrap-if-it-is-not-null.patch

    r40880 r42272  
    1 From f8ea60bbaf880d8d8d99fde3b5155f472e00141f Mon Sep 17 00:00:00 2001 
     1From c6516d2c672450fb27783866397a487511d90bba Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    3 Date: Mon, 12 May 2014 20:16:39 +0200 
    4 Subject: [PATCH 09/15] bcma: only map wrap if it is not null 
     3Date: Fri, 22 Aug 2014 08:44:52 +0200 
     4Subject: [PATCH 08/17] bcma: only map wrapper if its address is available 
     5MIME-Version: 1.0 
     6Content-Type: text/plain; charset=UTF-8 
     7Content-Transfer-Encoding: 8bit 
    58 
    6 The chipcommon B core does not have a wrap address and it would fail here. 
     9The Chipcommon B core does not have a wrap address and it would fail here. 
    710 
    811Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
     12Signed-off-by: Rafał Miłecki <zajec5@gmail.com> 
    913--- 
    10  drivers/bcma/scan.c | 11 +++++++---- 
    11  1 file changed, 7 insertions(+), 4 deletions(-) 
     14 drivers/bcma/host_soc.c |  4 ++++ 
     15 drivers/bcma/scan.c     | 11 +++++++---- 
     16 2 files changed, 11 insertions(+), 4 deletions(-) 
    1217 
     18--- a/drivers/bcma/host_soc.c 
     19+++ b/drivers/bcma/host_soc.c 
     20@@ -137,12 +137,16 @@ static void bcma_host_soc_block_write(st 
     21  
     22 static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset) 
     23 { 
     24+       if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) 
     25+               return ~0; 
     26        return readl(core->io_wrap + offset); 
     27 } 
     28  
     29 static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset, 
     30                                  u32 value) 
     31 { 
     32+       if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n")) 
     33+               return; 
     34        writel(value, core->io_wrap + offset); 
     35 } 
     36  
    1337--- a/drivers/bcma/scan.c 
    1438+++ b/drivers/bcma/scan.c 
  • trunk/target/linux/bcm53xx/patches-3.14/141-bcma-store-more-alternative-addresses.patch

    r41913 r42272  
    1 From 9317024aa1d8df94d3b021bc23b57f02a435e96c Mon Sep 17 00:00:00 2001 
     1From f8c6045ee00b82c1bb3f8b3446d723c4d50e6b08 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Mon, 12 May 2014 21:57:53 +0200 
    4 Subject: [PATCH 10/15] bcma: store more alternative addresses 
     4Subject: [PATCH 09/17] bcma: store more alternative addresses 
    55 
    66Each core could have more than one alternative address. There are cores 
  • trunk/target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch

    r42221 r42272  
    1 From 6c0df4a483e41ef129caa8948b3bcde7f91de197 Mon Sep 17 00:00:00 2001 
     1From 30e85c691b905f15ef55ab9e1aea98ac35f5e31a Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Mon, 12 May 2014 20:33:15 +0200 
    4 Subject: [PATCH 11/15] bcma: add support for chipcommon B core 
     4Subject: [PATCH 10/17] bcma: add support for chipcommon B core 
    55 
    66This core is used on BCM4708 to configure the PCIe and USB3 PHYs and it 
  • trunk/target/linux/bcm53xx/patches-3.14/150-pci-do-not-probe-too-early.patch

    r40880 r42272  
    1 From ea422113a5d2778347db6136d95f45a50e2f2d29 Mon Sep 17 00:00:00 2001 
     1From cf72936c001056de1cfcb27dd9a232f5484ec59c Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Thu, 29 May 2014 20:54:15 +0200 
    4 Subject: [PATCH 13/15] pci: do not probe too early 
     4Subject: [PATCH 12/17] pci: do not probe too early 
    55 
    66Probing is done before the PCIe bridge is fully activated and the 
  • trunk/target/linux/bcm53xx/patches-3.14/160-bcma-add-PCI-IDs-for-more-devices.patch

    r42142 r42272  
    1 From a0d83e0ad20f6dde0a71ed07da12ca3be8bbdc01 Mon Sep 17 00:00:00 2001 
     1From 5274195ed2aefa21bcc69de7ecbd13a88bd3f357 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    3 Date: Sun, 18 May 2014 17:15:24 +0200 
    4 Subject: [PATCH 12/15] bcma: add PCI IDs for more devices 
     3Date: Sat, 23 Aug 2014 17:58:11 +0200 
     4Subject: [PATCH 11/17] bcma: add PCI ID for spromless BCM43217 
    55 
    6 This adds the PCI IDs for the BCM4360 and BCM43227. 
    7 Both devices were found on a Netgear R6250 with a BCM4708 ARM SoC. 
     6This adds the PCI ID a BCM43217 without a sprom. 
     7This devices was found on a Netgear R6250 attached to a BCM4708 ARM SoC. 
     8 
     9bcma: bus1: Found chip with id 0xA8D1, rev 0x00 and package 0x08 
     10bcma: bus1: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x27, class 0x0) 
     11bcma: bus1: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x1E, class 0x0) 
     12bcma: bus1: Core 2 found: PCIe (manuf 0x4BF, id 0x820, rev 0x14, class 0x0) 
     13 
     14b43-phy0: Broadcom 43217 WLAN found (core revision 30) 
     15b43-phy0: Found PHY: Analog 9, Type 4 (N), Revision 17 
     16b43-phy0: Found Radio: Manuf 0x17F, ID 0x2057, Revision 14, Version 1 
    817 
    918Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1019--- 
    11  drivers/bcma/host_pci.c | 2 ++ 
    12  1 file changed, 2 insertions(+) 
     20 drivers/bcma/host_pci.c | 1 + 
     21 1 file changed, 1 insertion(+) 
    1322 
    1423--- a/drivers/bcma/host_pci.c 
     
    1827        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, 
    1928        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, 
    20 +       { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, 
     29+       { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) },  /* 0xA8DB */ 
    2130        { 0, }, 
    2231 }; 
  • trunk/target/linux/bcm53xx/patches-3.14/170-pcie2-bcma-add-new-PCIe2-driver-for-bcma.patch

    r42221 r42272  
    1 From 7475eee716d11f487076f78f26a6e403c06d0c76 Mon Sep 17 00:00:00 2001 
     1From cc2cda651fcbc498bf513a6b802dca19944bcb37 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    33Date: Mon, 12 May 2014 11:55:20 +0200 
    4 Subject: [PATCH 14/15] pcie2-bcma: add new PCIe2 driver for bcma 
     4Subject: [PATCH 13/17] pcie2-bcma: add new PCIe2 driver for bcma 
    55 
    66This driver supports the PCIe controller found on the BCM4708 and 
     
    99Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1010--- 
    11  arch/arm/mach-bcm/Kconfig     |   1 + 
     11 arch/arm/mach-bcm/Kconfig     |   2 + 
    1212 drivers/pci/host/Kconfig      |   7 + 
    1313 drivers/pci/host/Makefile     |   1 + 
    14  drivers/pci/host/pcie2-bcma.c | 594 ++++++++++++++++++++++++++++++++++++++++++ 
    15  4 files changed, 603 insertions(+) 
     14 drivers/pci/host/pcie2-bcma.c | 591 ++++++++++++++++++++++++++++++++++++++++++ 
     15 4 files changed, 601 insertions(+) 
    1616 create mode 100644 drivers/pci/host/pcie2-bcma.c 
    1717 
     
    4949--- /dev/null 
    5050+++ b/drivers/pci/host/pcie2-bcma.c 
    51 @@ -0,0 +1,594 @@ 
     51@@ -0,0 +1,591 @@ 
    5252+/* 
    5353+ * Northstar PCI-Express driver 
     
    134134+               bcma_write32(bdev, SOC_PCIE_EXT_CFG_ADDR, where & 0xffc); 
    135135+               return SOC_PCIE_EXT_CFG_DATA; 
    136 +       } else { 
    137 +               if (fn > 1) 
    138 +                       return 0; 
    139 +               addr_reg = (busno & 0xff) << 20 | (slot << 15) | (fn << 12) | 
    140 +                          (where & 0xffc) | (1 & 0x3); 
    141 + 
    142 +               bcma_write32(bdev, SOC_PCIE_CFG_ADDR, addr_reg); 
    143 +               return SOC_PCIE_CFG_DATA; 
    144 +       } 
     136+       } 
     137+       if (fn > 1) 
     138+               return 0; 
     139+       addr_reg = (busno & 0xff) << 20 | (slot << 15) | (fn << 12) | 
     140+                  (where & 0xffc) | (1 & 0x3); 
     141+ 
     142+       bcma_write32(bdev, SOC_PCIE_CFG_ADDR, addr_reg); 
     143+       return SOC_PCIE_CFG_DATA; 
    145144+} 
    146145+ 
     
    150149+       u32 base; 
    151150+       u32 data_reg; 
     151+       u32 mask; 
     152+       int shift; 
    152153+ 
    153154+       base = bcma_pcie2_cfg_base(bdev, busno, devfn, where); 
     
    172173+       /* HEADER_TYPE=00 indicates the port in EP mode */ 
    173174+ 
    174 +       if (size == 4) { 
     175+       if (size == 4) 
    175176+               return data_reg; 
    176 +       } else { 
    177 +               u32 mask = (1 << (size * 8)) - 1; 
    178 +               int shift = (where % 4) * 8; 
    179 +               return (data_reg >> shift) & mask; 
    180 +       } 
     177+ 
     178+       mask = (1 << (size * 8)) - 1; 
     179+       shift = (where % 4) * 8; 
     180+       return (data_reg >> shift) & mask; 
    181181+} 
    182182+ 
     
    196196+               u32 mask = (1 << (size * 8)) - 1; 
    197197+               int shift = (where % 4) * 8; 
     198+ 
    198199+               data_reg = bcma_read32(bdev, base); 
    199200+               data_reg &= ~(mask << shift); 
     
    529530+       /* create mem resource */ 
    530531+       res = devm_kzalloc(&bdev->dev, sizeof(*res), GFP_KERNEL); 
    531 +       if (!res) { 
    532 +               dev_info(&bdev->dev, "requesting resource at 0x%x failed\n", 
    533 +                        bdev->addr_s[0]); 
     532+       if (!res) 
    534533+               return -EINVAL; 
    535 +       } 
     534+ 
    536535+       res->start = bdev->addr_s[0]; 
    537536+       res->end = res->start + SZ_128M - 1; 
     
    543542+       /* This PCIe controller does not support IO Mem, so use a dummy one. */ 
    544543+       res = devm_kzalloc(&bdev->dev, sizeof(*res), GFP_KERNEL); 
    545 +       if (!res) { 
    546 +               dev_info(&bdev->dev, "requesting resource at 0x%x failed\n", 
    547 +                        bdev->addr_s[0]); 
     544+       if (!res) 
    548545+               return -EINVAL; 
    549 +       } 
     546+ 
    550547+       res->start = bdev->addr_s[0]; 
    551548+       res->end = res->start + SZ_128M - 1; 
Note: See TracChangeset for help on using the changeset viewer.