Changeset 24266


Ignore:
Timestamp:
2010-12-05T20:19:50+01:00 (6 years ago)
Author:
hauke
Message:

brcm47xx: backport patch from kernel 2.6.37

Backport patches from r24162

brcm47xx: reorder patches like they were commitet upstream

Location:
trunk/target/linux/brcm47xx/patches-2.6.36
Files:
5 added
1 deleted
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/brcm47xx/patches-2.6.36/011-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch

    r24265 r24266  
    1 From e5c5828063a55a752e2392d820383dd7a5da3737 Mon Sep 17 00:00:00 2001 
     1From 4f95d9875b74bbf804a3a83f2c3c5e2068c3f857 Mon Sep 17 00:00:00 2001 
    22From: Hauke Mehrtens <hauke@hauke-m.de> 
    3 Date: Sun, 18 Jul 2010 13:34:32 +0200 
     3Date: Sat, 27 Nov 2010 00:44:58 +0100 
    44Subject: [PATCH 2/6] MIPS: BCM47xx: Fill values for b43 into ssb sprom 
    55 
    6 Most of the values are stored in the nvram and not in the CFE. At first 
    7 the nvram should be read and if there is no value it should look into 
    8 the CFE. Now more values are read out because the b43 and b43legacy 
    9 drivers needs them. 
     6Fill the sprom with all available values from the nvram. Most of these 
     7new values are needed for the b43 or b43legacy driver. 
    108 
    119Some parts of this patch have been in OpenWRT for a long time and were 
     
    1412Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
    1513--- 
    16  arch/mips/bcm47xx/setup.c |  131 +++++++++++++++++++++++++++++++++----------- 
    17  1 files changed, 98 insertions(+), 33 deletions(-) 
     14 arch/mips/bcm47xx/setup.c |  114 ++++++++++++++++++++++++++++++++++++--------- 
     15 1 files changed, 92 insertions(+), 22 deletions(-) 
    1816 
    1917--- a/arch/mips/bcm47xx/setup.c 
    2018+++ b/arch/mips/bcm47xx/setup.c 
    21 @@ -74,6 +74,95 @@ static void str2eaddr(char *str, char *d 
     19@@ -73,42 +73,112 @@ static void str2eaddr(char *str, char *d 
    2220        } 
    2321 } 
    2422  
    2523+#define READ_FROM_NVRAM(_outvar, name, buf) \ 
    26 +       if (nvram_getenv(name, buf, sizeof(buf)) >= 0 || \ 
    27 +           cfe_getenv(name, buf, sizeof(buf)) >= 0) \ 
     24+       if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\ 
    2825+               sprom->_outvar = simple_strtoul(buf, NULL, 0); 
    2926+ 
     
    3734+       sprom->revision = 1; /* Fallback: Old hardware does not define this. */ 
    3835+       READ_FROM_NVRAM(revision, "sromrev", buf); 
    39 +       if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0 || 
    40 +           cfe_getenv("il0macaddr", buf, sizeof(buf)) >= 0) 
     36+       if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0) 
    4137+               str2eaddr(buf, sprom->il0mac); 
    42 +       if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0 || 
    43 +           cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 
     38+       if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 
    4439+               str2eaddr(buf, sprom->et0mac); 
    45 +       if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0 || 
    46 +           cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 
     40+       if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 
    4741+               str2eaddr(buf, sprom->et1mac); 
    4842+       READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf); 
     
    9690+       READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf); 
    9791+ 
    98 +       if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0 || 
    99 +           cfe_getenv("boardflags", buf, sizeof(buf)) >= 0) 
     92+       if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) { 
    10093+               boardflags = simple_strtoul(buf, NULL, 0); 
    101 +       if (boardflags) { 
    102 +               sprom->boardflags_lo = (boardflags & 0x0000FFFFU); 
    103 +               sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16; 
     94+               if (boardflags) { 
     95+                       sprom->boardflags_lo = (boardflags & 0x0000FFFFU); 
     96+                       sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16; 
     97+               } 
    10498+       } 
    105 +       if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0 || 
    106 +           cfe_getenv("boardflags2", buf, sizeof(buf)) >= 0) 
     99+       if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) { 
    107100+               boardflags = simple_strtoul(buf, NULL, 0); 
    108 +       if (boardflags) { 
    109 +               sprom->boardflags2_lo = (boardflags & 0x0000FFFFU); 
    110 +               sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16; 
     101+               if (boardflags) { 
     102+                       sprom->boardflags2_lo = (boardflags & 0x0000FFFFU); 
     103+                       sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16; 
     104+               } 
    111105+       } 
    112106+} 
     
    115109                                   struct ssb_init_invariants *iv) 
    116110 { 
    117 @@ -82,43 +171,19 @@ static int bcm47xx_get_invariants(struct 
     111-       char buf[100]; 
     112+       char buf[20]; 
     113  
    118114        /* Fill boardinfo structure */ 
    119115        memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); 
    120116  
    121 -       if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 || 
    122 -           nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) 
    123 +       iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; 
    124 +       if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0 || 
    125 +           cfe_getenv("boardtype", buf, sizeof(buf)) >= 0) 
     117        if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) 
     118-               iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); 
     119+               iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0); 
     120+       else 
     121+               iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; 
     122        if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) 
    126123                iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); 
    127 -       if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 || 
    128 -           nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) 
    129 -               iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); 
    130 -       if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 || 
    131 -           nvram_getenv("boardrev", buf, sizeof(buf)) >= 0) 
    132 +       if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0 || 
    133 +           cfe_getenv("boardrev", buf, sizeof(buf)) >= 0) 
     124        if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0) 
    134125                iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); 
    135126  
     
    138129-       iv->sprom.revision = 3; 
    139130- 
    140 -       if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 || 
    141 -           nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 
     131-       if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 
    142132-               str2eaddr(buf, iv->sprom.et0mac); 
    143133- 
    144 -       if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 || 
    145 -           nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 
     134-       if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 
    146135-               str2eaddr(buf, iv->sprom.et1mac); 
    147136- 
    148 -       if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 || 
    149 -           nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) 
     137-       if (nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) 
    150138-               iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0); 
    151139- 
    152 -       if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 || 
    153 -           nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) 
     140-       if (nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) 
    154141-               iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0); 
    155142- 
    156 -       if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 || 
    157 -           nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0) 
     143-       if (nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0) 
    158144-               iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10); 
    159 - 
    160 -       if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 || 
    161 -           nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0) 
     145+       bcm47xx_fill_sprom(&iv->sprom); 
     146  
     147-       if (nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0) 
    162148-               iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10); 
    163 +       bcm47xx_fill_sprom(&iv->sprom); 
    164 + 
    165 +       if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0 || 
    166 +           cfe_getenv("cardbus", buf, sizeof(buf)) >= 0) 
     149+       if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) 
    167150+               iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10); 
    168151  
  • trunk/target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch

    r22424 r24266  
    2525 #include <asm/reboot.h> 
    2626 #include <asm/time.h> 
    27 @@ -190,12 +192,47 @@ static int bcm47xx_get_invariants(struct 
     27@@ -168,7 +170,7 @@ static int bcm47xx_get_invariants(struct 
    2828  
    2929 void __init plat_mem_setup(void) 
     
    3131-       int err; 
    3232+       int i, err; 
    33 +       char buf[100]; 
    34 +       struct ssb_mipscore *mcore; 
     33        char buf[100]; 
     34        struct ssb_mipscore *mcore; 
    3535  
    36         err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, 
    37                                       bcm47xx_get_invariants); 
    38         if (err) 
    39                 panic("Failed to initialize SSB bus (err %d)\n", err); 
    40 +       mcore = &ssb_bcm47xx.mipscore; 
    41 + 
    42 +       if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0 || 
    43 +           cfe_getenv("kernel_args", buf, sizeof(buf)) >= 0) { 
    44 +               if (strstr(buf, "console=ttyS1")) { 
    45 +                       struct ssb_serial_port port; 
    46 + 
    47 +                       printk(KERN_DEBUG "Swapping serial ports!\n"); 
    48 +                       /* swap serial ports */ 
    49 +                       memcpy(&port, &mcore->serial_ports[0], sizeof(port)); 
    50 +                       memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], 
    51 +                              sizeof(port)); 
    52 +                       memcpy(&mcore->serial_ports[1], &port, sizeof(port)); 
    53 +               } 
    54 +       } 
    55 + 
     36@@ -191,6 +193,24 @@ void __init plat_mem_setup(void) 
     37                } 
     38        } 
     39  
    5640+       for (i = 0; i < mcore->nr_serial_ports; i++) { 
    5741+               struct ssb_serial_port *port = &(mcore->serial_ports[i]); 
     
    7155+       } 
    7256+       printk(KERN_DEBUG "Serial init done.\n"); 
    73   
     57+ 
    7458        _machine_restart = bcm47xx_machine_restart; 
    7559        _machine_halt = bcm47xx_machine_halt; 
     60        pm_power_off = bcm47xx_machine_halt; 
  • trunk/target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch

    r23278 r24266  
    11--- a/drivers/net/b44.c 
    22+++ b/drivers/net/b44.c 
    3 @@ -381,11 +381,12 @@ static void b44_set_flow_ctrl(struct b44 
    4         __b44_set_flow_ctrl(bp, pause_enab); 
    5  } 
    6   
    7 -#ifdef SSB_DRIVER_MIPS 
    8 -extern char *nvram_get(char *name); 
    9 +#ifdef CONFIG_BCM47XX 
    10 + 
    11 +#include <asm/mach-bcm47xx/nvram.h> 
    12  static void b44_wap54g10_workaround(struct b44 *bp) 
    13  { 
    14 -       const char *str; 
    15 +       char buf[20]; 
    16         u32 val; 
    17         int err; 
    18   
    19 @@ -394,10 +395,9 @@ static void b44_wap54g10_workaround(stru 
    20          * see https://dev.openwrt.org/ticket/146 
    21          * check and reset bit "isolate" 
    22          */ 
    23 -       str = nvram_get("boardnum"); 
    24 -       if (!str) 
    25 +       if (nvram_getenv("boardnum", buf, sizeof(buf)) > 0) 
    26                 return; 
    27 -       if (simple_strtoul(str, NULL, 0) == 2) { 
    28 +       if (simple_strtoul(buf, NULL, 0) == 2) { 
    29                 err = __b44_readphy(bp, 0, MII_BMCR, &val); 
    30                 if (err) 
    31                         goto error; 
    32 @@ -412,10 +412,43 @@ static void b44_wap54g10_workaround(stru 
     3@@ -411,10 +411,41 @@ static void b44_wap54g10_workaround(stru 
    334 error: 
    345        pr_warning("PHY: cannot reset MII transceiver isolate bit\n"); 
     
    6132+       return; 
    6233+} 
    63 + 
    6434 #else 
    65 + 
    6635 static inline void b44_wap54g10_workaround(struct b44 *bp) 
    6736 { 
     
    7443  
    7544 static int b44_setup_phy(struct b44 *bp) 
    76 @@ -424,6 +457,7 @@ static int b44_setup_phy(struct b44 *bp) 
     45@@ -423,6 +454,7 @@ static int b44_setup_phy(struct b44 *bp) 
    7746        int err; 
    7847  
     
    8251        if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) 
    8352                return 0; 
    84 @@ -2089,6 +2123,8 @@ static int __devinit b44_get_invariants( 
     53@@ -2088,6 +2120,8 @@ static int __devinit b44_get_invariants( 
    8554         * valid PHY address. */ 
    8655        bp->phy_addr &= 0x1F; 
  • trunk/target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch

    r23911 r24266  
    3434--- a/arch/mips/bcm47xx/setup.c 
    3535+++ b/arch/mips/bcm47xx/setup.c 
    36 @@ -238,3 +238,20 @@ void __init plat_mem_setup(void) 
     36@@ -215,3 +215,20 @@ void __init plat_mem_setup(void) 
    3737        _machine_halt = bcm47xx_machine_halt; 
    3838        pm_power_off = bcm47xx_machine_halt; 
  • trunk/target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch

    r23278 r24266  
     1From 3cfa0a9d4b4cc30ec735c5c9535ff493bae24d08 Mon Sep 17 00:00:00 2001 
     2From: Hauke Mehrtens <hauke@hauke-m.de> 
     3Date: Sat, 27 Nov 2010 18:14:23 +0100 
     4Subject: [PATCH] ssb: Add sysfs attributes to ssb devices 
     5 
     6Make it possible to read out the attributes, till now only show on 
     7dmesg, through sysfs. 
     8 
     9This patch was some time in OpenWrt. 
     10 
     11Signed-off-by: Bernhard Loos <bernhardloos@googlemail.com> 
     12Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> 
     13--- 
     14 drivers/ssb/main.c |   30 ++++++++++++++++++++++++++++++ 
     15 1 files changed, 30 insertions(+), 0 deletions(-) 
     16 
    117--- a/drivers/ssb/main.c 
    218+++ b/drivers/ssb/main.c 
    3 @@ -384,6 +384,34 @@ static int ssb_device_uevent(struct devi 
     19@@ -384,6 +384,35 @@ static int ssb_device_uevent(struct devi 
    420                             ssb_dev->id.revision); 
    521 } 
    622  
    7 +#define ssb_config_attr(attrib, field, format_string)                                  \ 
    8 +static ssize_t                                                                                                 \ 
     23+#define ssb_config_attr(attrib, field, format_string) \ 
     24+static ssize_t \ 
    925+attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \ 
    10 +{                                                                                                                              \ 
    11 +       return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field);         \ 
     26+{ \ 
     27+       return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \ 
    1228+} 
    1329+ 
     
    2036+name_show(struct device *dev, struct device_attribute *attr, char *buf) 
    2137+{ 
    22 +       return sprintf(buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid)); 
     38+       return sprintf(buf, "%s\n", 
     39+                      ssb_core_name(dev_to_ssb_dev(dev)->id.coreid)); 
    2340+} 
    2441+ 
     
    3653        .name           = "ssb", 
    3754        .match          = ssb_bus_match, 
    38 @@ -393,6 +421,7 @@ static struct bus_type ssb_bustype = { 
     55@@ -393,6 +422,7 @@ static struct bus_type ssb_bustype = { 
    3956        .suspend        = ssb_device_suspend, 
    4057        .resume         = ssb_device_resume, 
Note: See TracChangeset for help on using the changeset viewer.