Changeset 3693

Show
Ignore:
Timestamp:
02/07/08 22:56:12 (4 years ago)
Author:
sumsum
Message:

Clean up all the breaking stuff i tried to introduce.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/package/base-files/files/etc/hotplug.d/usb/01-mount

    r3686 r3693  
    1313                                        path=/mnt/${dev}_${part##*part} 
    1414                                        mkdir -p ${path} 
    15                                         [ -x /usr/sbin/fsck ] && /usr/sbin/fsck -a -V /dev/discs/${dev}/${part} >> /var/log/fsck.log 2>&1 
    1615                                        mount ${part} ${path} 
    1716                                done 
  • trunk/freewrt/package/e2fsprogs/Makefile

    r3686 r3693  
    99PKG_NAME:=              e2fsprogs 
    1010PKG_VERSION:=           1.39 
    11 PKG_RELEASE:=           3 
     11PKG_RELEASE:=           2 
    1212PKG_MD5SUM:=            06f7806782e357797fad1d34b7ced0c6 
    1313MASTER_SITES:=          ${MASTER_SITE_SOURCEFORGE:=e2fsprogs/} 
     
    3434        ${INSTALL_DIR} ${IDIR_E2FSPROGS}/usr/lib 
    3535        ${INSTALL_DIR} ${IDIR_E2FSPROGS}/usr/sbin 
    36         ${INSTALL_BIN} ${WRKINST}/usr/sbin/fsck ${IDIR_E2FSPROGS}/usr/sbin/ 
    37         ${INSTALL_BIN} ${WRKINST}/usr/sbin/fsck.ext2 ${IDIR_E2FSPROGS}/usr/sbin/ 
    38         ln -s fsck.ext2 ${IDIR_E2FSPROGS}/usr/sbin/fsck.ext3 
    39         ln -s fsck.ext2 ${IDIR_E2FSPROGS}/usr/sbin/e2fsck 
     36        ${INSTALL_BIN} ${WRKINST}/usr/sbin/e2fsck ${IDIR_E2FSPROGS}/usr/sbin/ 
     37        ${INSTALL_BIN} ${WRKINST}/usr/sbin/mke2fs ${IDIR_E2FSPROGS}/usr/sbin/ 
    4038        ${INSTALL_BIN} ${WRKINST}/usr/sbin/tune2fs ${IDIR_E2FSPROGS}/usr/sbin/ 
    4139        ${CP} ${WRKINST}/usr/lib/lib{blkid,com_err,e2p,ext2fs,uuid}.so.* \ 
  • trunk/freewrt/rules.mk

    r3686 r3693  
    8686UNAME_R:=               2.6.21.1 
    8787else ifeq ($(strip ${FWRT_LINUX_2_6_BRCM_ASUS_WL500G_PREMIUM}),y) 
    88 UNAME_R:=               2.6.24 
     88UNAME_R:=               2.6.22.1 
    8989else ifeq ($(strip ${FWRT_LINUX_2_4}),y) 
    9090UNAME_R:=               2.4.34 
  • trunk/freewrt/target/linux/brcm-2.6/Makefile

    r3686 r3693  
    1 include ${TOPDIR}/target/linux/generic-2.6.24/Makefile 
     1include ${TOPDIR}/target/linux/generic-2.6.22.1/Makefile 
  • trunk/freewrt/target/linux/brcm-2.6/extra/arch/mips/bcm947xx/prom.c

    r3691 r3693  
    4242        unsigned long mem; 
    4343 
    44 //        mips_machgroup = MACH_GROUP_BRCM; 
     44        mips_machgroup = MACH_GROUP_BRCM; 
    4545        mips_machtype = MACH_BCM47XX; 
    4646 
  • trunk/freewrt/target/linux/brcm-2.6/extra/arch/mips/bcm947xx/setup.c

    r3691 r3693  
    3232#include <linux/serial_core.h> 
    3333#include <linux/serial_reg.h> 
    34 #include <linux/serial_8250.h> 
    3534#include <asm/bootinfo.h> 
    3635#include <asm/time.h> 
     
    5655 
    5756        /* Set the watchdog timer to reset immediately */ 
    58         ssb_chipco_watchdog_timer_set(&ssb.chipco, 1); 
     57        ssb_chipco_watchdog(&ssb.chipco, 1); 
    5958        while (1) 
    6059                cpu_relax(); 
     
    6564        /* Disable interrupts and watchdog and spin forever */ 
    6665        local_irq_disable(); 
    67         ssb_chipco_watchdog_timer_set(&ssb.chipco, 0); 
     66        ssb_chipco_watchdog(&ssb.chipco, 0); 
    6867        while (1) 
    6968                cpu_relax(); 
     
    109108} 
    110109 
    111 static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv) 
    112 { 
    113         char *s; 
    114          
    115         // TODO 
    116         //iv->boardinfo.vendor =  
    117         if ((s = nvram_get("boardtype"))) 
    118                 iv->boardinfo.type = (u16)simple_strtoul(s, NULL, 0); 
    119         if ((s = nvram_get("boardrev"))) 
    120                 iv->boardinfo.rev = (u16)simple_strtoul(s, NULL, 0); 
    121         bcm47xx_fill_sprom(&iv->sprom); 
    122         return 0; 
    123 } 
    124  
    125110void __init plat_mem_setup(void) 
    126111{ 
     
    129114        struct ssb_mipscore *mcore; 
    130115 
    131         err = ssb_bus_ssbbus_register(&ssb, SSB_ENUM_BASE, bcm47xx_get_invariants); 
     116        err = ssb_bus_ssbbus_register(&ssb, SSB_ENUM_BASE, bcm47xx_fill_sprom); 
    132117        if (err) { 
    133118                const char *msg = "Failed to initialize SSB bus (err %d)\n"; 
     
    173158        pm_power_off = bcm47xx_machine_halt; 
    174159 
     160        board_time_init = bcm47xx_time_init;//FIXME move into ssb 
    175161} 
    176162 
  • trunk/freewrt/target/linux/brcm-2.6/extra/arch/mips/bcm947xx/time.c

    r3692 r3693  
    3636 
    3737void __init 
    38 plat_time_init(void) 
     38bcm47xx_time_init(void) 
    3939{ 
    4040        unsigned long hz; 
     
    5555} 
    5656 
    57 //void __init 
    58 //plat_timer_setup(struct irqaction *irq) 
    59 //{ 
    60 //      /* Enable the timer interrupt */ 
    61 //      setup_irq(7, irq); 
    62 // } 
    63  
    64 //TODO: remove this function 
     57void __init 
     58plat_timer_setup(struct irqaction *irq) 
     59
     60        /* Enable the timer interrupt */ 
     61        setup_irq(7, irq); 
     62
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/Kconfig

    r3691 r3693  
    11menu "Sonics Silicon Backplane" 
    2  
    3 config SSB_POSSIBLE 
    4         bool 
    5         depends on HAS_IOMEM 
    6         default y 
    72 
    83config SSB 
    94        tristate "Sonics Silicon Backplane support" 
    10         depends on SSB_POSSIBLE 
     5        depends on EXPERIMENTAL 
    116        help 
    12           Support for the Sonics Silicon Backplane bus. 
    13           You only need to enable this option, if you are 
    14           configuring a kernel for an embedded system with 
    15           this bus. 
    16           It will be auto-selected if needed in other 
    17           environments. 
     7          Support for the Sonics Silicon Backplane bus 
    188 
    19           The module will be called ssb. 
     9          The module will be called ssb 
    2010 
    21           If unsure, say N. 
    22  
    23 config SSB_PCIHOST_POSSIBLE 
    24         bool 
    25         depends on SSB && PCI 
    26         default y 
     11          If unsure, say M 
    2712 
    2813config SSB_PCIHOST 
    2914        bool "Support for SSB on PCI-bus host" 
    30         depends on SSB_PCIHOST_POSSIBLE 
     15        depends on SSB && PCI 
    3116        default y 
    3217        help 
     
    3621          If unsure, say Y 
    3722 
    38 config SSB_PCMCIAHOST_POSSIBLE 
    39         bool 
    40         depends on SSB && PCMCIA && EXPERIMENTAL 
    41         default y 
    42  
    4323config SSB_PCMCIAHOST 
    44         bool "Support for SSB on PCMCIA-bus host (EXPERIMENTAL)
    45         depends on SSB_PCMCIAHOST_POSSIBLE 
     24        bool "Support for SSB on PCMCIA-bus host
     25        depends on SSB && PCMCIA 
    4626        help 
    4727          Support for a Sonics Silicon Backplane on top 
     
    5232config SSB_SILENT 
    5333        bool "No SSB kernel messages" 
    54         depends on SSB && EMBEDDED 
     34        depends on SSB 
    5535        help 
    5636          This option turns off all Sonics Silicon Backplane printks. 
     
    7656        # ChipCommon and ExtIf serial support routines. 
    7757 
    78 config SSB_DRIVER_PCICORE_POSSIBLE 
    79         bool 
    80         depends on SSB_PCIHOST 
    81         default y 
    82  
    8358config SSB_DRIVER_PCICORE 
    8459        bool "SSB PCI core driver" 
    85         depends on SSB_DRIVER_PCICORE_POSSIBLE 
     60        depends on SSB && SSB_PCIHOST 
     61        default y 
    8662        help 
    8763          Driver for the Sonics Silicon Backplane attached 
     
    9167 
    9268config SSB_PCICORE_HOSTMODE 
    93         bool "Hostmode support for SSB PCI core (EXPERIMENTAL)
    94         depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS && EXPERIMENTAL 
     69        bool "Hostmode support for SSB PCI core
     70        depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS 
    9571        help 
    9672          PCIcore hostmode operation (external PCI bus). 
    9773 
    9874config SSB_DRIVER_MIPS 
    99         bool "SSB Broadcom MIPS core driver (EXPERIMENTAL)
    100         depends on SSB && MIPS && EXPERIMENTAL 
     75        bool "SSB Broadcom MIPS core driver
     76        depends on SSB && MIPS 
    10177        select SSB_SERIAL 
    10278        help 
     
    10783 
    10884config SSB_DRIVER_EXTIF 
    109         bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)
    110         depends on SSB_DRIVER_MIPS && EXPERIMENTAL 
     85        bool "SSB Broadcom EXTIF core driver
     86        depends on SSB_DRIVER_MIPS 
    11187        help 
    11288          Driver for the Sonics Silicon Backplane attached 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/Makefile

    r3691 r3693  
    1 # core 
    2 ssb-y                                   += main.o scan.o 
     1ssb-builtin-drivers-y                                   += driver_chipcommon.o 
     2ssb-builtin-drivers-$(CONFIG_SSB_DRIVER_MIPS)           += driver_mipscore.o 
     3ssb-builtin-drivers-$(CONFIG_SSB_DRIVER_PCICORE)        += driver_pcicore.o 
    34 
    4 # host support 
    5 ssb-$(CONFIG_SSB_PCIHOST)               += pci.o pcihost_wrapper.o 
    6 ssb-$(CONFIG_SSB_PCMCIAHOST)            += pcmcia.o 
     5ssb-hostsupport-$(CONFIG_SSB_PCIHOST)                   += pci.o pcihost_wrapper.o 
     6ssb-hostsupport-$(CONFIG_SSB_PCMCIAHOST)                += pcmcia.o 
    77 
    8 # built-in drivers 
    9 ssb-y                                   += driver_chipcommon.o 
    10 ssb-$(CONFIG_SSB_DRIVER_MIPS)           += driver_mipscore.o 
    11 ssb-$(CONFIG_SSB_DRIVER_EXTIF)          += driver_extif.o 
    12 ssb-$(CONFIG_SSB_DRIVER_PCICORE)        += driver_pcicore.o 
     8obj-$(CONFIG_SSB) += ssb.o 
    139 
    14 # b43 pci-ssb-bridge driver 
    15 # Not strictly a part of SSB, but kept here for convenience 
    16 ssb-$(CONFIG_SSB_PCIHOST)               += b43_pci_bridge.o 
    17  
    18 obj-$(CONFIG_SSB)                       += ssb.o 
     10ssb-objs        := main.o scan.o \ 
     11                   $(ssb-hostsupport-y) $(ssb-builtin-drivers-y) 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/driver_chipcommon.c

    r3691 r3693  
    1717 
    1818/* Clock sources */ 
    19 enum ssb_clksrc
     19enum
    2020        /* PCI clock */ 
    2121        SSB_CHIPCO_CLKSRC_PCI, 
     
    3838{ 
    3939        ssb_write32(cc->dev, offset, value); 
    40 } 
    41  
    42 static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset, 
    43                                          u32 mask, u32 value) 
    44 { 
    45         value &= mask; 
    46         value |= chipco_read32(cc, offset) & ~mask; 
    47         chipco_write32(cc, offset, value); 
    4840} 
    4941 
     
    9486                break; 
    9587        default: 
    96                 SSB_WARN_ON(1); 
     88                assert(0); 
    9789        } 
    9890} 
    9991 
    10092/* Get the Slow Clock Source */ 
    101 static enum ssb_clksrc chipco_pctl_get_slowclksrc(struct ssb_chipcommon *cc) 
     93static int chipco_pctl_get_slowclksrc(struct ssb_chipcommon *cc) 
    10294{ 
    10395        struct ssb_bus *bus = cc->dev->bus; 
    104         u32 uninitialized_var(tmp)
     96        u32 tmp = 0
    10597 
    10698        if (cc->dev->id.revision < 6) { 
     
    132124static int chipco_pctl_clockfreqlimit(struct ssb_chipcommon *cc, int get_max) 
    133125{ 
    134         int uninitialized_var(limit)
    135         enum ssb_clksrc clocksrc; 
    136         int divisor = 1
     126        int limit
     127        int clocksrc; 
     128        int divisor
    137129        u32 tmp; 
    138130 
     
    147139                        break; 
    148140                default: 
    149                         SSB_WARN_ON(1); 
     141                        assert(0); 
     142                        divisor = 1; 
    150143                } 
    151144        } else if (cc->dev->id.revision < 10) { 
    152145                switch (clocksrc) { 
    153146                case SSB_CHIPCO_CLKSRC_LOPWROS: 
     147                        divisor = 1; 
    154148                        break; 
    155149                case SSB_CHIPCO_CLKSRC_XTALOS: 
     
    159153                        divisor *= 4; 
    160154                        break; 
     155                default: 
     156                        assert(0); 
     157                        divisor = 1; 
    161158                } 
    162159        } else { 
     
    185182                        limit = 25000000; 
    186183                break; 
     184        default: 
     185                assert(0); 
     186                limit = 0; 
    187187        } 
    188188        limit /= divisor; 
     
    236236        pll_on_delay = chipco_read32(cc, SSB_CHIPCO_PLLONDELAY); 
    237237        tmp = (((pll_on_delay + 2) * 1000000) + (minfreq - 1)) / minfreq; 
    238         SSB_WARN_ON(tmp & ~0xFFFF); 
     238        assert((tmp & ~0xFFFF) == 0); 
    239239 
    240240        cc->fast_pwrup_delay = tmp; 
     
    265265} 
    266266 
    267 /* Get the processor clock */ 
    268 void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, 
    269                              u32 *plltype, u32 *n, u32 *m) 
    270 { 
    271         *n = chipco_read32(cc, SSB_CHIPCO_CLOCK_N); 
    272         *plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT); 
    273         switch (*plltype) { 
    274         case SSB_PLLTYPE_2: 
    275         case SSB_PLLTYPE_4: 
    276         case SSB_PLLTYPE_6: 
    277         case SSB_PLLTYPE_7: 
    278                 *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_MIPS); 
    279                 break; 
    280         case SSB_PLLTYPE_3: 
    281                 /* 5350 uses m2 to control mips */ 
    282                 *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_M2); 
    283                 break; 
    284         default: 
    285                 *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_SB); 
    286                 break; 
    287         } 
    288 } 
    289  
    290 /* Get the bus clock */ 
    291267void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc, 
    292268                                 u32 *plltype, u32 *n, u32 *m) 
     
    343319                chipco_write32(cc, SSB_CHIPCO_PROG_WAITCNT, tmp); /* 0x01020a0c for a 100Mhz clock */ 
    344320        } 
    345 } 
    346  
    347 /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ 
    348 void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks) 
    349 { 
    350         /* instant NMI */ 
    351         chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks); 
    352321} 
    353322 
     
    384353                        /* Internal backplane clock */ 
    385354                        baud_base = ssb_clockspeed(bus); 
    386                         div = chipco_read32(cc, SSB_CHIPCO_CLKDIV) 
    387                               & SSB_CHIPCO_CLKDIV_UART; 
     355                        div = 2; /* Minimum divisor */ 
     356                        chipco_write32(cc, SSB_CHIPCO_CLKDIV, 
     357                                       (chipco_read32(cc, SSB_CHIPCO_CLKDIV) 
     358                                        & ~SSB_CHIPCO_CLKDIV_UART) | div); 
    388359                } else { 
    389360                        /* Fixed internal backplane clock */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/driver_mipscore.c

    r3691 r3693  
    1414#include <linux/serial_core.h> 
    1515#include <linux/serial_reg.h> 
    16 #include <linux/time.h> 
     16#include <asm/time.h> 
    1717 
    1818#include "ssb_private.h" 
     
    118118} 
    119119 
     120/* XXX: leave here or move into separate extif driver? */ 
     121static int ssb_extif_serial_init(struct ssb_device *dev, struct ssb_serial_ports *ports) 
     122{ 
     123 
     124} 
     125 
     126 
    120127static void ssb_mips_serial_init(struct ssb_mipscore *mcore) 
    121128{ 
    122129        struct ssb_bus *bus = mcore->dev->bus; 
    123130 
     131        //TODO if (EXTIF available 
     132#if 0 
     133                extifregs_t *eir = (extifregs_t *) regs; 
     134                sbconfig_t *sb; 
     135 
     136                /* Determine external UART register base */ 
     137                sb = (sbconfig_t *)((ulong) eir + SBCONFIGOFF); 
     138                base = EXTIF_CFGIF_BASE(sb_base(R_REG(&sb->sbadmatch1))); 
     139 
     140                /* Determine IRQ */ 
     141                irq = sb_irq(sbh); 
     142 
     143                /* Disable GPIO interrupt initially */ 
     144                W_REG(&eir->gpiointpolarity, 0); 
     145                W_REG(&eir->gpiointmask, 0); 
     146 
     147                /* Search for external UARTs */ 
     148                n = 2; 
     149                for (i = 0; i < 2; i++) { 
     150                        regs = (void *) REG_MAP(base + (i * 8), 8); 
     151                        if (BCMINIT(serial_exists)(regs)) { 
     152                                /* Set GPIO 1 to be the external UART IRQ */ 
     153                                W_REG(&eir->gpiointmask, 2); 
     154                                if (add) 
     155                                        add(regs, irq, 13500000, 0); 
     156                        } 
     157                } 
     158 
     159                /* Add internal UART if enabled */ 
     160                if (R_REG(&eir->corecontrol) & CC_UE) 
     161                        if (add) 
     162                                add((void *) &eir->uartdata, irq, sb_clock(sbh), 2); 
     163 
     164#endif 
    124165        if (bus->extif.dev) 
    125166                mcore->nr_serial_ports = ssb_extif_serial_init(&bus->extif, mcore->serial_ports); 
     
    134175        struct ssb_bus *bus = mcore->dev->bus; 
    135176 
    136         mcore->flash_buswidth = 2; 
    137177        if (bus->chipco.dev) { 
    138178                mcore->flash_window = 0x1c000000; 
    139                 mcore->flash_window_size = 0x02000000; 
    140                 if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG) 
    141                                & SSB_CHIPCO_CFG_DS16) == 0) 
    142                         mcore->flash_buswidth = 1; 
     179                mcore->flash_window_size = 0x800000; 
    143180        } else { 
    144181                mcore->flash_window = 0x1fc00000; 
    145                 mcore->flash_window_size = 0x00400000; 
    146         } 
    147 
    148  
    149 u32 ssb_cpu_clock(struct ssb_mipscore *mcore) 
     182                mcore->flash_window_size = 0x400000; 
     183        } 
     184
     185 
     186 
     187static void ssb_cpu_clock(struct ssb_mipscore *mcore) 
     188
     189
     190 
     191void ssb_mipscore_init(struct ssb_mipscore *mcore) 
    150192{ 
    151193        struct ssb_bus *bus = mcore->dev->bus; 
    152         u32 pll_type, n, m, rate = 0; 
    153  
    154         if (bus->extif.dev) { 
    155                 ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m); 
    156         } else if (bus->chipco.dev) { 
    157                 ssb_chipco_get_clockcpu(&bus->chipco, &pll_type, &n, &m); 
    158         } else 
    159                 return 0; 
    160  
    161         if ((pll_type == SSB_PLLTYPE_5) || (bus->chip_id == 0x5365)) { 
    162                 rate = 200000000; 
    163         } else { 
    164                 rate = ssb_calc_clock_rate(pll_type, n, m); 
    165         } 
    166  
    167         if (pll_type == SSB_PLLTYPE_6) { 
    168                 rate *= 2; 
    169         } 
    170  
    171         return rate; 
    172 } 
    173  
    174 void ssb_mipscore_init(struct ssb_mipscore *mcore) 
    175 { 
    176         struct ssb_bus *bus; 
    177194        struct ssb_device *dev; 
    178195        unsigned long hz, ns; 
     
    184201        ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n"); 
    185202 
    186         bus = mcore->dev->bus; 
    187203        hz = ssb_clockspeed(bus); 
    188204        if (!hz) 
     
    190206        ns = 1000000000 / hz; 
    191207 
    192         if (bus->extif.dev) 
    193                 ssb_extif_timing_init(&bus->extif, ns); 
    194         else if (bus->chipco.dev) 
     208//TODO 
     209#if 0 
     210        if (have EXTIF) { 
     211                /* Initialize extif so we can get to the LEDs and external UART */ 
     212                W_REG(&eir->prog_config, CF_EN); 
     213 
     214                /* Set timing for the flash */ 
     215                tmp = CEIL(10, ns) << FW_W3_SHIFT;      /* W3 = 10nS */ 
     216                tmp = tmp | (CEIL(40, ns) << FW_W1_SHIFT); /* W1 = 40nS */ 
     217                tmp = tmp | CEIL(120, ns);              /* W0 = 120nS */ 
     218                W_REG(&eir->prog_waitcount, tmp);       /* 0x01020a0c for a 100Mhz clock */ 
     219 
     220                /* Set programmable interface timing for external uart */ 
     221                tmp = CEIL(10, ns) << FW_W3_SHIFT;      /* W3 = 10nS */ 
     222                tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */ 
     223                tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */ 
     224                tmp = tmp | CEIL(120, ns);              /* W0 = 120nS */ 
     225                W_REG(&eir->prog_waitcount, tmp); 
     226        } 
     227        else... chipcommon 
     228#endif 
     229        if (bus->chipco.dev) 
    195230                ssb_chipco_timing_init(&bus->chipco, ns); 
    196231 
     
    199234                dev = &(bus->devices[i]); 
    200235                dev->irq = ssb_mips_irq(dev) + 2; 
    201                 switch (dev->id.coreid) { 
    202                 case SSB_DEV_USB11_HOST: 
    203                         /* shouldn't need a separate irq line for non-4710, most of them have a proper 
    204                          * external usb controller on the pci */ 
    205                         if ((bus->chip_id == 0x4710) && (irq <= 4)) { 
    206                                 set_irq(dev, irq++); 
    207                                 break; 
    208                         } 
    209                         /* fallthrough */ 
    210                 case SSB_DEV_PCI: 
    211                 case SSB_DEV_ETHERNET: 
    212                 case SSB_DEV_80211: 
    213                 case SSB_DEV_USB20_HOST: 
    214                         /* These devices get their own IRQ line if available, the rest goes on IRQ0 */ 
    215                         if (irq <= 4) { 
    216                                 set_irq(dev, irq++); 
    217                                 break; 
    218                         } 
     236                switch(dev->id.coreid) { 
     237                        case SSB_DEV_USB11_HOST: 
     238                                /* shouldn't need a separate irq line for non-4710, most of them have a proper 
     239                                 * external usb controller on the pci */ 
     240                                if ((bus->chip_id == 0x4710) && (irq <= 4)) { 
     241                                        set_irq(dev, irq++); 
     242                                        break; 
     243                                } 
     244                        case SSB_DEV_PCI: 
     245                        case SSB_DEV_ETHERNET: 
     246                        case SSB_DEV_80211: 
     247                        case SSB_DEV_USB20_HOST: 
     248                                /* These devices get their own IRQ line if available, the rest goes on IRQ0 */ 
     249                                if (irq <= 4) { 
     250                                        set_irq(dev, irq++); 
     251                                        break; 
     252                                } 
    219253                } 
    220254        } 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/driver_pcicore.c

    r3691 r3693  
    3535 
    3636#include <asm/paccess.h> 
    37 /* Probe a 32bit value on the bus and catch bus exceptions. 
    38  * Returns nonzero on a bus exception. 
    39  * This is MIPS specific */ 
    40 #define mips_busprobe32(val, addr)      get_dbe((val), ((u32 *)(addr))) 
     37/* Read the bus and catch bus exceptions. This is MIPS specific. */ 
     38#define mips_busprobe(val, addr)        get_dbe((val), (addr)) 
    4139 
    4240/* Assume one-hot slot wiring */ 
     
    4846static struct ssb_pcicore *extpci_core; 
    4947 
    50 static u32 ssb_pcicore_pcibus_iobase = 0x100; 
    51 static u32 ssb_pcicore_pcibus_membase = SSB_PCI_DMA; 
     48u32 pci_iobase = 0x100; 
     49u32 pci_membase = SSB_PCI_DMA; 
    5250 
    5351int pcibios_plat_dev_init(struct pci_dev *d) 
     
    5755        u32 *base; 
    5856 
    59         ssb_printk(KERN_INFO "PCI: Fixing up device %s\n", 
    60                    pci_name(d)); 
     57        printk("PCI: Fixing up device %s\n", pci_name(d)); 
    6158 
    6259        /* Fix up resource bases */ 
    6360        for (pos = 0; pos < 6; pos++) { 
    6461                res = &d->resource[pos]; 
    65                 if (res->flags & IORESOURCE_IO) 
    66                         base = &ssb_pcicore_pcibus_iobase; 
    67                 else 
    68                         base = &ssb_pcicore_pcibus_membase; 
     62                base = ((res->flags & IORESOURCE_IO) ? &pci_iobase : &pci_membase); 
    6963                if (res->end) { 
    7064                        size = res->end - res->start + 1; 
     
    9286                return; 
    9387 
    94         ssb_printk(KERN_INFO "PCI: fixing up bridge\n"); 
     88        printk("PCI: fixing up bridge\n"); 
    9589 
    9690        /* Enable PCI bridge bus mastering and memory space */ 
     
    10094        /* Enable PCI bridge BAR1 prefetch and burst */ 
    10195        pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3); 
    102  
    103         /* Make sure our latency is high enough to handle the devices behind us */ 
    104         pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8); 
    10596} 
    10697DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge); 
    10798 
    108 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 
     99int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 
    109100{ 
    110101        return ssb_mips_irq(extpci_core->dev) + 2; 
     
    157148        void __iomem *mmio; 
    158149 
    159         SSB_WARN_ON(!pc->hostmode); 
     150        assert(pc->hostmode); 
    160151        if (unlikely(len != 1 && len != 2 && len != 4)) 
    161152                goto out; 
     
    168159                goto out; 
    169160 
    170         if (mips_busprobe32(val, mmio)) { 
     161        if (mips_busprobe(val, (u32 *) mmio)) { 
    171162                val = 0xffffffff; 
    172163                goto unmap; 
     
    203194        void __iomem *mmio; 
    204195 
    205         SSB_WARN_ON(!pc->hostmode); 
     196        assert(pc->hostmode); 
    206197        if (unlikely(len != 1 && len != 2 && len != 4)) 
    207198                goto out; 
     
    214205                goto out; 
    215206 
    216         if (mips_busprobe32(val, mmio)) { 
     207        if (mips_busprobe(val, (u32 *) mmio)) { 
    217208                val = 0xffffffff; 
    218209                goto unmap; 
     
    234225                break; 
    235226        } 
    236         writel(val, mmio); 
     227        writel(*((const u32 *)buf), mmio); 
    237228 
    238229        err = 0; 
     
    279270        .name   = "SSB PCIcore external memory", 
    280271        .start  = SSB_PCI_DMA, 
    281         .end    = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1, 
     272        .end    = (u32)SSB_PCI_DMA + (u32)SSB_PCI_DMA_SZ - 1, 
    282273        .flags  = IORESOURCE_MEM, 
    283274}; 
     
    301292        u32 val; 
    302293 
    303         if (WARN_ON(extpci_core)) 
     294        if (extpci_core) { 
     295                WARN_ON(1); 
    304296                return; 
     297        } 
    305298        extpci_core = pc; 
    306299 
     
    312305        val |= SSB_PCICORE_CTL_CLK; /* Clock on */ 
    313306        pcicore_write32(pc, SSB_PCICORE_CTL, val); 
    314         udelay(150); /* Assertion time demanded by the PCI standard */ 
     307        udelay(150); 
    315308        val |= SSB_PCICORE_CTL_RST; /* Deassert RST# */ 
    316309        pcicore_write32(pc, SSB_PCICORE_CTL, val); 
    317         val = SSB_PCICORE_ARBCTL_INTERN; 
    318         pcicore_write32(pc, SSB_PCICORE_ARBCTL, val); 
    319         udelay(1); /* Assertion time demanded by the PCI standard */ 
    320  
    321         /*TODO cardbus mode */ 
     310        udelay(1); 
     311 
     312        //TODO cardbus mode 
    322313 
    323314        /* 64MB I/O window */ 
     
    346337         * to non-MIPS platform. */ 
    347338        set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000)); 
    348         /* Give some time to the PCI controller to configure itself with the new 
    349          * values. Not waiting at this point causes crashes of the machine. */ 
    350         mdelay(10); 
    351339        register_pci_controller(&ssb_pcicore_controller); 
    352340} 
     
    377365                return 0; 
    378366 
    379         return !mips_busprobe32(tmp, (bus->mmio + (pc->dev->core_index * SSB_CORE_SIZE))); 
     367        return !mips_busprobe(tmp, (u32 *) (bus->mmio + (pc->dev->core_index * SSB_CORE_SIZE))); 
    380368} 
    381369#endif /* CONFIG_SSB_PCICORE_HOSTMODE */ 
     
    443431        v |= data; 
    444432        pcicore_write32(pc, mdio_data, v); 
    445         /* Wait for the device to complete the transaction */ 
    446433        udelay(10); 
    447434        for (i = 0; i < 10; i++) { 
     
    472459 
    473460        dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev; 
    474         if (WARN_ON(!dev)) 
    475                 return; 
     461        assert(dev); 
    476462        /* This forces an update of the cached registers. */ 
    477463        ssb_broadcast_value(dev, 0xFD8, 0); 
     
    511497 
    512498                intvec = ssb_read32(pdev, SSB_INTVEC); 
    513                 if ((bus->chip_id & 0xFF00) == 0x4400) { 
    514                         /* Workaround: On the BCM44XX the BPFLAG routing 
    515                          * bit is wrong. Use a hardcoded constant. */ 
    516                         intvec |= 0x00000002; 
    517                 } else { 
    518                         tmp = ssb_read32(dev, SSB_TPSFLAG); 
    519                         tmp &= SSB_TPSFLAG_BPFLAG; 
    520                         intvec |= tmp; 
    521                 } 
     499                tmp = ssb_read32(dev, SSB_TPSFLAG); 
     500                tmp &= SSB_TPSFLAG_BPFLAG; 
     501                intvec |= tmp; 
    522502                ssb_write32(pdev, SSB_INTVEC, intvec); 
    523503        } 
     
    546526                } 
    547527        } else { 
    548                 WARN_ON(pdev->id.coreid != SSB_DEV_PCIE); 
     528                assert(pdev->id.coreid == SSB_DEV_PCIE); 
    549529                //TODO: Better make defines for all these magic PCIE values. 
    550530                if ((pdev->id.revision == 0) || (pdev->id.revision == 1)) { 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/main.c

    r3691 r3693  
    1414#include <linux/ssb/ssb.h> 
    1515#include <linux/ssb/ssb_regs.h> 
    16 #include <linux/dma-mapping.h> 
    17 #include <linux/pci.h> 
    18  
    19 #include <pcmcia/cs_types.h> 
    20 #include <pcmcia/cs.h> 
    21 #include <pcmcia/cistpl.h> 
    22 #include <pcmcia/ds.h> 
     16 
     17#ifdef CONFIG_SSB_PCIHOST 
     18# include <linux/pci.h> 
     19#endif 
     20 
     21#ifdef CONFIG_SSB_PCMCIAHOST 
     22# include <pcmcia/cs_types.h> 
     23# include <pcmcia/cs.h> 
     24# include <pcmcia/cistpl.h> 
     25# include <pcmcia/ds.h> 
     26#endif 
    2327 
    2428 
     
    2731 
    2832 
    29 /* Temporary list of yet-to-be-attached buses */ 
    3033static LIST_HEAD(attach_queue); 
    31 /* List if running buses */ 
    3234static LIST_HEAD(buses); 
    33 /* Software ID counter */ 
    3435static unsigned int next_busnumber; 
    35 /* buses_mutes locks the two buslists and the next_busnumber. 
    36  * Don't lock this directly, but use ssb_buses_[un]lock() below. */ 
    3736static DEFINE_MUTEX(buses_mutex); 
    38  
    39 /* There are differences in the codeflow, if the bus is 
    40  * initialized from early boot, as various needed services 
    41  * are not available early. This is a mechanism to delay 
    42  * these initializations to after early boot has finished. 
    43  * It's also used to avoid mutex locking, as that's not 
    44  * available and needed early. */ 
    45 static bool ssb_is_early_boot = 1; 
    4637 
    4738static void ssb_buses_lock(void); 
     
    5041 
    5142#ifdef CONFIG_SSB_PCIHOST 
    52 struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev) 
     43struct ssb_bus * ssb_pci_dev_to_bus(struct pci_dev *pdev) 
    5344{ 
    5445        struct ssb_bus *bus; 
     
    6859#endif /* CONFIG_SSB_PCIHOST */ 
    6960 
    70 static struct ssb_device *ssb_device_get(struct ssb_device *dev) 
     61static struct ssb_device * ssb_device_get(struct ssb_device *dev) 
    7162{ 
    7263        if (dev) 
     
    132123        bus->pcicore.setup_done = 0; 
    133124#endif 
    134 #ifdef CONFIG_SSB_DEBUG 
    135         bus->powered_up = 0; 
    136 #endif 
    137125} 
    138126 
     
    172160        pm_message_t state = PMSG_FREEZE; 
    173161 
    174         /* First check that we are capable to freeze all devices. */ 
    175162        for (i = 0; i < bus->nr_devices; i++) { 
    176163                dev = &(bus->devices[i]); 
    177                 if (!dev->dev || 
    178                     !dev->dev->driver || 
    179                     !device_is_registered(dev->dev)) 
     164                if (!dev->dev->driver) 
     165                       continue; 
     166                if (!device_is_registered(dev->dev)) 
    180167                        continue; 
    181168                drv = drv_to_ssb_drv(dev->dev->driver); 
    182                 if (!drv) 
    183                         continue; 
    184                 if (!drv->suspend) { 
    185                         /* Nope, can't suspend this one. */ 
    186                         return -EOPNOTSUPP; 
     169                if (drv && drv->suspend) { 
     170                        err = drv->suspend(dev, state); 
     171                        if (err) 
     172                                goto out; 
    187173                } 
    188174        } 
    189         /* Now suspend all devices */ 
     175out: 
     176        return err; 
     177
     178 
     179int ssb_devices_thaw(struct ssb_bus *bus) 
     180
     181        struct ssb_device *dev; 
     182        struct ssb_driver *drv; 
     183        int err = 0; 
     184        int i; 
     185 
    190186        for (i = 0; i < bus->nr_devices; i++) { 
    191187                dev = &(bus->devices[i]); 
    192                 if (!dev->dev || 
    193                     !dev->dev->driver || 
    194                     !device_is_registered(dev->dev)) 
     188                if (!dev->dev->driver) 
     189                       continue; 
     190                if (!device_is_registered(dev->dev)) 
    195191                        continue; 
    196192                drv = drv_to_ssb_drv(dev->dev->driver); 
    197                 if (!drv) 
    198                         continue; 
    199                 err = drv->suspend(dev, state); 
    200                 if (err) { 
    201                         ssb_printk(KERN_ERR PFX "Failed to freeze device %s\n", 
    202                                    dev->dev->bus_id); 
    203                         goto err_unwind; 
     193                if (drv && drv->resume) { 
     194                        err = drv->resume(dev); 
     195                        if (err) 
     196                                goto out; 
    204197                } 
    205198        } 
    206  
    207         return 0; 
    208 err_unwind: 
    209         for (i--; i >= 0; i--) { 
    210                 dev = &(bus->devices[i]); 
    211                 if (!dev->dev || 
    212                     !dev->dev->driver || 
    213                     !device_is_registered(dev->dev)) 
    214                         continue; 
    215                 drv = drv_to_ssb_drv(dev->dev->driver); 
    216                 if (!drv) 
    217                         continue; 
    218                 if (drv->resume) 
    219                         drv->resume(dev); 
    220         } 
    221         return err; 
    222 
    223  
    224 int ssb_devices_thaw(struct ssb_bus *bus) 
    225 
    226         struct ssb_device *dev; 
    227         struct ssb_driver *drv; 
    228         int err; 
    229         int i; 
    230  
    231         for (i = 0; i < bus->nr_devices; i++) { 
    232                 dev = &(bus->devices[i]); 
    233                 if (!dev->dev || 
    234                     !dev->dev->driver || 
    235                     !device_is_registered(dev->dev)) 
    236                         continue; 
    237                 drv = drv_to_ssb_drv(dev->dev->driver); 
    238                 if (!drv) 
    239                         continue; 
    240                 if (SSB_WARN_ON(!drv->resume)) 
    241                         continue; 
    242                 err = drv->resume(dev); 
    243                 if (err) { 
    244                         ssb_printk(KERN_ERR PFX "Failed to thaw device %s\n", 
    245                                    dev->dev->bus_id); 
    246                 } 
    247         } 
    248  
    249         return 0; 
     199out: 
     200        return err; 
    250201} 
    251202#endif /* CONFIG_SSB_PCIHOST */ 
     
    321272} 
    322273 
    323 static int ssb_device_uevent(struct device *dev, char **envp, int num_envp, 
    324                              char *buffer, int buffer_size) 
    325 { 
    326         struct ssb_device *ssb_dev = dev_to_ssb_dev(dev); 
    327         int ret, i = 0, length = 0; 
    328  
    329         if (!dev) 
    330                 return -ENODEV; 
    331  
    332         ret = add_uevent_var(envp, num_envp, &i, 
    333                              buffer, buffer_size, &length, 
    334                              "MODALIAS=ssb:v%04Xid%04Xrev%02X", 
    335                              ssb_dev->id.vendor, ssb_dev->id.coreid, 
    336                              ssb_dev->id.revision); 
    337         envp[i] = NULL; 
    338  
    339         return ret; 
    340 } 
    341  
    342274static struct bus_type ssb_bustype = { 
    343         .name           = "ssb", 
     275        .name           = NULL, /* Intentionally NULL to indicate early boot */ 
    344276        .match          = ssb_bus_match, 
    345277        .probe          = ssb_device_probe, 
     
    348280        .suspend        = ssb_device_suspend, 
    349281        .resume         = ssb_device_resume, 
    350         .uevent         = ssb_device_uevent, 
    351282}; 
    352283 
     284#define is_early_boot()         (ssb_bustype.name == NULL) 
     285 
    353286static void ssb_buses_lock(void) 
    354287{ 
    355         /* See the comment at the ssb_is_early_boot definition */ 
    356         if (!ssb_is_early_boot) 
     288        if (!is_early_boot()) 
    357289                mutex_lock(&buses_mutex); 
    358290} 
     
    360292static void ssb_buses_unlock(void) 
    361293{ 
    362         /* See the comment at the ssb_is_early_boot definition */ 
    363         if (!ssb_is_early_boot) 
     294        if (!is_early_boot()) 
    364295                mutex_unlock(&buses_mutex); 
    365296} 
     
    491422                 * (no udelay() available). So do it here in attach stage. 
    492423                 */ 
    493                 err = ssb_bus_powerup(bus, 0); 
    494                 if (err) 
    495                         goto error; 
    496424                ssb_pcicore_init(&bus->pcicore); 
    497                 ssb_bus_may_powerdown(bus); 
    498425 
    499426                err = ssb_devices_register(bus); 
    500 error: 
    501427                if (err) { 
    502428                        drop_them_all = 1; 
     
    542468} 
    543469 
    544 /* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */ 
    545470static const struct ssb_bus_ops ssb_ssb_ops = { 
    546471        .read16         = ssb_ssb_read16, 
     
    551476 
    552477static int ssb_fetch_invariants(struct ssb_bus *bus, 
    553                                 ssb_invariants_func_t get_invariants) 
     478                                int (*get_invariants)(struct ssb_bus *bus, 
     479                                                      struct ssb_init_invariants *iv)) 
    554480{ 
    555481        struct ssb_init_invariants iv; 
     
    567493 
    568494static int ssb_bus_register(struct ssb_bus *bus, 
    569                             ssb_invariants_func_t get_invariants, 
     495                            int (*get_invariants)(struct ssb_bus *bus, 
     496                                                  struct ssb_init_invariants *iv), 
    570497                            unsigned long baseaddr) 
    571498{ 
     
    596523 
    597524        /* Initialize basic system devices (if available) */ 
    598         err = ssb_bus_powerup(bus, 0); 
    599         if (err) 
    600                 goto err_pcmcia_exit; 
    601525        ssb_chipcommon_init(&bus->chipco); 
    602526        ssb_mipscore_init(&bus->mipscore); 
    603527        err = ssb_fetch_invariants(bus, get_invariants); 
    604         if (err) { 
    605                 ssb_bus_may_powerdown(bus); 
     528        if (err) 
    606529                goto err_pcmcia_exit; 
    607         } 
    608         ssb_bus_may_powerdown(bus); 
    609  
    610         /* Queue it for attach. 
    611          * See the comment at the ssb_is_early_boot definition. */ 
     530 
     531        /* Queue it for attach */ 
    612532        list_add_tail(&bus->list, &attach_queue); 
    613         if (!ssb_is_early_boot) { 
     533        if (!is_early_boot()) { 
    614534                /* This is not early boot, so we must attach the bus now */ 
    615535                err = ssb_attach_queued_buses(); 
     
    682602int ssb_bus_ssbbus_register(struct ssb_bus *bus, 
    683603                            unsigned long baseaddr, 
    684                             ssb_invariants_func_t get_invariants) 
     604                            int (*get_invariants)(struct ssb_bus *bus, 
     605                                                  struct ssb_init_invariants *iv)) 
    685606{ 
    686607        int err; 
     
    775696                n1 += SSB_CHIPCO_CLK_T2_BIAS; 
    776697                n2 += SSB_CHIPCO_CLK_T2_BIAS; 
    777                 SSB_WARN_ON(!((n1 >= 2) && (n1 <= 7))); 
    778                 SSB_WARN_ON(!((n2 >= 5) && (n2 <= 23))); 
     698                assert((n1 >= 2) && (n1 <= 7)); 
     699                assert((n2 >= 5) && (n2 <= 23)); 
    779700                break; 
    780701        case SSB_PLLTYPE_5: /* 25Mhz, 4 dividers */ 
    781702                return 100000000; 
    782703        default: 
    783                 SSB_WARN_ON(1); 
     704                assert(0); 
    784705        } 
    785706 
     
    830751                m2 += SSB_CHIPCO_CLK_T2M2_BIAS; 
    831752                m3 += SSB_CHIPCO_CLK_T2_BIAS; 
    832                 SSB_WARN_ON(!((m1 >= 2) && (m1 <= 7))); 
    833                 SSB_WARN_ON(!((m2 >= 3) && (m2 <= 10))); 
    834                 SSB_WARN_ON(!((m3 >= 2) && (m3 <= 7))); 
     753                assert((m1 >= 2) && (m1 <= 7)); 
     754                assert((m2 >= 3) && (m2 <= 10)); 
     755                assert((m3 >= 2) && (m3 <= 7)); 
    835756 
    836757                if (!(mc & SSB_CHIPCO_CLK_T2MC_M1BYP)) 
     
    842763                return clock; 
    843764        default: 
    844                 SSB_WARN_ON(1); 
     765                assert(0); 
    845766        } 
    846767        return 0; 
     
    854775        u32 clkctl_n, clkctl_m; 
    855776 
    856         if (ssb_extif_available(&bus->extif)) 
    857                 ssb_extif_get_clockcontrol(&bus->extif, &plltype, 
    858                                            &clkctl_n, &clkctl_m); 
    859         else if (bus->chipco.dev) 
     777        //TODO if EXTIF: PLLTYPE == 1, read n from clockcontrol_n, m from clockcontrol_sb 
     778 
     779        if (bus->chipco.dev) { 
    860780                ssb_chipco_get_clockcontrol(&bus->chipco, &plltype, 
    861781                                            &clkctl_n, &clkctl_m); 
    862         else 
     782        } else 
    863783                return 0; 
    864784 
     
    885805                return SSB_TMSLOW_REJECT_23; 
    886806        default: 
    887                 WARN_ON(1); 
     807                assert(0); 
    888808        } 
    889809        return (SSB_TMSLOW_REJECT_22 | SSB_TMSLOW_REJECT_23); 
     
    902822} 
    903823EXPORT_SYMBOL(ssb_device_is_enabled); 
    904  
    905 static void ssb_flush_tmslow(struct ssb_device *dev) 
    906 { 
    907         /* Make _really_ sure the device has finished the TMSLOW 
    908          * register write transaction, as we risk running into 
    909          * a machine check exception otherwise. 
    910          * Do this by reading the register back to commit the 
    911          * PCI write and delay an additional usec for the device 
    912          * to react to the change. */ 
    913         ssb_read32(dev, SSB_TMSLOW); 
    914         udelay(1); 
    915 } 
    916824 
    917825void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags) 
     
    923831                    SSB_TMSLOW_RESET | SSB_TMSLOW_CLOCK | 
    924832                    SSB_TMSLOW_FGC | core_specific_flags); 
    925         ssb_flush_tmslow(dev); 
     833        /* flush */ 
     834        ssb_read32(dev, SSB_TMSLOW); 
     835        udelay(1); 
    926836 
    927837        /* Clear SERR if set. This is a hw bug workaround. */ 
     
    938848                    SSB_TMSLOW_CLOCK | SSB_TMSLOW_FGC | 
    939849                    core_specific_flags); 
    940         ssb_flush_tmslow(dev); 
     850        /* flush */ 
     851        ssb_read32(dev, SSB_TMSLOW); 
     852        udelay(1); 
    941853 
    942854        ssb_write32(dev, SSB_TMSLOW, SSB_TMSLOW_CLOCK | 
    943855                    core_specific_flags); 
    944         ssb_flush_tmslow(dev); 
     856        /* flush */ 
     857        ssb_read32(dev, SSB_TMSLOW); 
     858        udelay(1); 
    945859} 
    946860EXPORT_SYMBOL(ssb_device_enable); 
    947861 
    948 /* Wait for a bit in a register to get set or unset. 
    949  * timeout is in units of ten-microseconds */ 
    950862static int ssb_wait_bit(struct ssb_device *dev, u16 reg, u32 bitmask, 
    951863                        int timeout, int set) 
     
    987899                    reject | SSB_TMSLOW_RESET | 
    988900                    core_specific_flags); 
    989         ssb_flush_tmslow(dev); 
     901        /* flush */ 
     902        ssb_read32(dev, SSB_TMSLOW); 
     903        udelay(1); 
    990904 
    991905        ssb_write32(dev, SSB_TMSLOW, 
    992906                    reject | SSB_TMSLOW_RESET | 
    993907                    core_specific_flags); 
    994         ssb_flush_tmslow(dev); 
     908        /* flush */ 
     909        ssb_read32(dev, SSB_TMSLOW); 
     910        udelay(1); 
    995911} 
    996912EXPORT_SYMBOL(ssb_device_disable); 
     
    998914u32 ssb_dma_translation(struct ssb_device *dev) 
    999915{ 
    1000         switch (dev->bus->bustype) { 
     916        switch(dev->bus->bustype) { 
    1001917        case SSB_BUSTYPE_SSB: 
    1002918                return 0; 
     
    1028944{ 
    1029945        struct ssb_chipcommon *cc; 
    1030         int err = 0
     946        int err
    1031947 
    1032948        /* On buses where more than one core may be working 
     
    1034950         * still cores that may want to run. */ 
    1035951        if (bus->bustype == SSB_BUSTYPE_SSB) 
    1036                 goto out
     952                return 0
    1037953 
    1038954        cc = &bus->chipco; 
     
    1041957        if (err) 
    1042958                goto error; 
    1043 out: 
    1044 #ifdef CONFIG_SSB_DEBUG 
    1045         bus->powered_up = 0; 
    1046 #endif 
    1047         return err; 
     959 
     960        return 0; 
    1048961error: 
    1049962        ssb_printk(KERN_ERR PFX "Bus powerdown failed\n"); 
    1050         goto out
     963        return err
    1051964} 
    1052965EXPORT_SYMBOL(ssb_bus_may_powerdown); 
    1053966 
    1054 int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl) 
     967int ssb_bus_powerup(struct ssb_bus *bus, int dynamic_pctl) 
    1055968{ 
    1056969        struct ssb_chipcommon *cc; 
     
    1065978        ssb_chipco_set_clockmode(cc, mode); 
    1066979 
    1067 #ifdef CONFIG_SSB_DEBUG 
    1068         bus->powered_up = 1; 
    1069 #endif 
    1070980        return 0; 
    1071981error: 
     
    1084994                break; 
    1085995        case SSB_ADM_TYPE1: 
    1086                 SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ 
     996                assert(!(adm & SSB_ADM_NEG)); /* unsupported */ 
    1087997                base = (adm & SSB_ADM_BASE1); 
    1088998                break; 
    1089999        case SSB_ADM_TYPE2: 
    1090                 SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ 
     1000                assert(!(adm & SSB_ADM_NEG)); /* unsupported */ 
    10911001                base = (adm & SSB_ADM_BASE2); 
    10921002                break; 
    10931003        default: 
    1094                 SSB_WARN_ON(1); 
     1004                assert(0); 
    10951005        } 
    10961006 
     
    11081018                break; 
    11091019        case SSB_ADM_TYPE1: 
    1110                 SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ 
     1020                assert(!(adm & SSB_ADM_NEG)); /* unsupported */ 
    11111021                size = ((adm & SSB_ADM_SZ1) >> SSB_ADM_SZ1_SHIFT); 
    11121022                break; 
    11131023        case SSB_ADM_TYPE2: 
    1114                 SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ 
     1024                assert(!(adm & SSB_ADM_NEG)); /* unsupported */ 
    11151025                size = ((adm & SSB_ADM_SZ2) >> SSB_ADM_SZ2_SHIFT); 
    11161026                break; 
    11171027        default: 
    1118                 SSB_WARN_ON(1); 
     1028                assert(0); 
    11191029        } 
    11201030        size = (1 << (size + 1)); 
     
    11281038        int err; 
    11291039 
    1130         /* See the comment at the ssb_is_early_boot definition */ 
    1131         ssb_is_early_boot = 0; 
     1040        ssb_bustype.name = "ssb"; 
    11321041        err = bus_register(&ssb_bustype); 
    11331042        if (err) 
     
    11431052                bus_unregister(&ssb_bustype); 
    11441053 
    1145         err = b43_pci_ssb_bridge_init(); 
    1146         if (err) { 
    1147                 ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge " 
    1148                            "initialization failed"); 
    1149                 /* don't fail SSB init because of this */ 
    1150                 err = 0; 
    1151         } 
    1152  
    11531054        return err; 
    11541055} 
     
    11571058static void __exit ssb_modexit(void) 
    11581059{ 
    1159         b43_pci_ssb_bridge_exit(); 
    11601060        bus_unregister(&ssb_bustype); 
    11611061} 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/pci.c

    r3691 r3693  
    2424 
    2525 
    26 /* Define the following to 1 to enable a printk on each coreswitch. */ 
    27 #define SSB_VERBOSE_PCICORESWITCH_DEBUG         0 
    28  
    29  
    30 /* Lowlevel coreswitching */ 
    3126int ssb_pci_switch_coreidx(struct ssb_bus *bus, u8 coreidx) 
    3227{ 
     
    6661        unsigned long flags; 
    6762 
    68 #if SSB_VERBOSE_PCICORESWITCH_DEBUG 
    69         ssb_printk(KERN_INFO PFX 
    70                    "Switching to %s core, index %d\n", 
    71                    ssb_core_name(dev->id.coreid), 
    72                    dev->core_index); 
    73 #endif 
     63        ssb_dprintk(KERN_INFO PFX 
     64                    "Switching to %s core, index %d\n", 
     65                    ssb_core_name(dev->id.coreid), 
     66                    dev->core_index); 
    7467 
    7568        spin_lock_irqsave(&bus->bar_lock, flags); 
     
    8275} 
    8376 
    84 /* Enable/disable the on board crystal oscillator and/or PLL. */ 
    8577int ssb_pci_xtal(struct ssb_bus *bus, u32 what, int turn_on) 
    8678{ 
     
    167159} 
    168160 
    169 /* Get the word-offset for a SSB_SPROM_XXX define. */ 
    170161#define SPOFF(offset)   (((offset) - SSB_SPROM_BASE) / sizeof(u16)) 
    171 /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ 
    172162#define SPEX(_outvar, _offset, _mask, _shift)   \ 
    173163        out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) 
     
    307297        for (i = 0; i < 3; i++) { 
    308298                v = in[SPOFF(SSB_SPROM1_IL0MAC) + i]; 
    309                 *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); 
     299                *(((u16 *)out->il0mac) + i) = cpu_to_be16(v); 
    310300        } 
    311301        for (i = 0; i < 3; i++) { 
    312302                v = in[SPOFF(SSB_SPROM1_ET0MAC) + i]; 
    313                 *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v); 
     303                *(((u16 *)out->et0mac) + i) = cpu_to_be16(v); 
    314304        } 
    315305        for (i = 0; i < 3; i++) { 
    316306                v = in[SPOFF(SSB_SPROM1_ET1MAC) + i]; 
    317                 *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v); 
     307                *(((u16 *)out->et1mac) + i) = cpu_to_be16(v); 
    318308        } 
    319309        SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); 
     
    353343        for (i = 0; i < 4; i++) { 
    354344                v = in[SPOFF(SSB_SPROM1_OEM) + i]; 
    355                 *(((__le16 *)out->oem) + i) = cpu_to_le16(v); 
     345                *(((u16 *)out->oem) + i) = cpu_to_le16(v); 
    356346        } 
    357347} 
     
    375365        for (i = 0; i < 4; i++) { 
    376366                v = in[SPOFF(SSB_SPROM2_CCODE) + i]; 
    377                 *(((__le16 *)out->country_str) + i) = cpu_to_le16(v); 
     367                *(((u16 *)out->country_str) + i) = cpu_to_le16(v); 
    378368        } 
    379369} 
     
    500490} 
    501491 
    502 #ifdef CONFIG_SSB_DEBUG 
    503 static int ssb_pci_assert_buspower(struct ssb_bus *bus) 
    504 { 
    505         if (likely(bus->powered_up)) 
    506                 return 0; 
    507  
    508         printk(KERN_ERR PFX "FATAL ERROR: Bus powered down " 
    509                "while accessing PCI MMIO space\n"); 
    510         if (bus->power_warn_count <= 10) { 
    511                 bus->power_warn_count++; 
    512                 dump_stack(); 
    513         } 
    514  
    515         return -ENODEV; 
    516 } 
    517 #else /* DEBUG */ 
    518 static inline int ssb_pci_assert_buspower(struct ssb_bus *bus) 
    519 { 
    520         return 0; 
    521 } 
    522 #endif /* DEBUG */ 
    523  
    524492static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset) 
    525493{ 
    526494        struct ssb_bus *bus = dev->bus; 
    527495 
    528         if (unlikely(ssb_pci_assert_buspower(bus))) 
    529                 return 0xFFFF; 
    530496        if (unlikely(bus->mapped_device != dev)) { 
    531497                if (unlikely(ssb_pci_switch_core(bus, dev))) 
    532498                        return 0xFFFF; 
    533499        } 
    534         return ioread16(bus->mmio + offset); 
     500        return readw(bus->mmio + offset); 
    535501} 
    536502 
     
    539505        struct ssb_bus *bus = dev->bus; 
    540506 
    541         if (unlikely(ssb_pci_assert_buspower(bus))) 
    542                 return 0xFFFFFFFF; 
    543507        if (unlikely(bus->mapped_device != dev)) { 
    544508                if (unlikely(ssb_pci_switch_core(bus, dev))) 
    545509                        return 0xFFFFFFFF; 
    546510        } 
    547         return ioread32(bus->mmio + offset); 
     511        return readl(bus->mmio + offset); 
    548512} 
    549513 
     
    552516        struct ssb_bus *bus = dev->bus; 
    553517 
    554         if (unlikely(ssb_pci_assert_buspower(bus))) 
    555                 return; 
    556518        if (unlikely(bus->mapped_device != dev)) { 
    557519                if (unlikely(ssb_pci_switch_core(bus, dev))) 
    558520                        return; 
    559521        } 
    560         iowrite16(value, bus->mmio + offset); 
     522        writew(value, bus->mmio + offset); 
    561523} 
    562524 
     
    565527        struct ssb_bus *bus = dev->bus; 
    566528 
    567         if (unlikely(ssb_pci_assert_buspower(bus))) 
    568                 return; 
    569529        if (unlikely(bus->mapped_device != dev)) { 
    570530                if (unlikely(ssb_pci_switch_core(bus, dev))) 
    571531                        return; 
    572532        } 
    573         iowrite32(value, bus->mmio + offset); 
    574 
    575  
    576 /* Not "static", as it's used in main.c */ 
     533        writel(value, bus->mmio + offset); 
     534
     535 
    577536const struct ssb_bus_ops ssb_pci_ops = { 
    578537        .read16         = ssb_pci_read16, 
     
    632591                goto out; 
    633592 
    634         /* Use interruptible locking, as the SPROM write might 
    635          * be holding the lock for several seconds. So allow userspace 
    636          * to cancel operation. */ 
    637593        err = -ERESTARTSYS; 
    638594        if (mutex_lock_interruptible(&bus->pci_sprom_mutex)) 
     
    677633        } 
    678634 
    679         /* Use interruptible locking, as the SPROM write might 
    680          * be holding the lock for several seconds. So allow userspace 
    681          * to cancel operation. */ 
    682635        err = -ERESTARTSYS; 
    683636        if (mutex_lock_interruptible(&bus->pci_sprom_mutex)) 
    684637                goto out_kfree; 
    685638        err = ssb_devices_freeze(bus); 
    686         if (err == -EOPNOTSUPP) { 
    687                 ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze devices. " 
    688                            "No suspend support. Is CONFIG_PM enabled?\n"); 
    689                 goto out_unlock; 
    690         } 
    691639        if (err) { 
    692640                ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze all devices\n"); 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/pcmcia.c

    r3691 r3693  
    2222 
    2323 
    24 /* Define the following to 1 to enable a printk on each coreswitch. */ 
    25 #define SSB_VERBOSE_PCMCIACORESWITCH_DEBUG              0 
    26  
    27  
    2824int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, 
    2925                              u8 coreidx) 
     
    9692        unsigned long flags; 
    9793 
    98 #if SSB_VERBOSE_PCMCIACORESWITCH_DEBUG 
    99         ssb_printk(KERN_INFO PFX 
    100                    "Switching to %s core, index %d\n", 
    101                    ssb_core_name(dev->id.coreid), 
    102                    dev->core_index); 
    103 #endif 
     94        ssb_dprintk(KERN_INFO PFX 
     95                    "Switching to %s core, index %d\n", 
     96                    ssb_core_name(dev->id.coreid), 
     97                    dev->core_index); 
    10498 
    10599        spin_lock_irqsave(&bus->bar_lock, flags); 
     
    119113        int res, err = 0; 
    120114 
    121         SSB_WARN_ON((seg != 0) && (seg != 1)); 
     115        assert(seg == 0 || seg == 1); 
    122116        reg.Offset = 0x34; 
    123117        reg.Function = 0; 
     
    152146} 
    153147 
    154 /* These are the main device register access functions. 
    155  * do_select_core is inline to have the likely hotpath inline. 
    156  * All unlikely codepaths are out-of-line. */ 
    157148static inline int do_select_core(struct ssb_bus *bus, 
    158149                                 struct ssb_device *dev, 
     
    186177                return 0xFFFF; 
    187178        x = readw(bus->mmio + offset); 
    188  
     179//printk("R16 0x%04X, 0x%04X\n", offset, x); 
    189180        return x; 
    190181} 
     
    198189                return 0xFFFFFFFF; 
    199190        x = readl(bus->mmio + offset); 
    200  
     191//printk("R32 0x%04X, 0x%08X\n", offset, x); 
    201192        return x; 
    202193} 
     
    208199        if (unlikely(do_select_core(bus, dev, &offset))) 
    209200                return; 
     201//printk("W16 0x%04X, 0x%04X\n", offset, value); 
    210202        writew(value, bus->mmio + offset); 
    211203} 
     
    217209        if (unlikely(do_select_core(bus, dev, &offset))) 
    218210                return; 
     211//printk("W32 0x%04X, 0x%08X\n", offset, value); 
    219212        readw(bus->mmio + offset); 
    220213        writew(value >> 16, bus->mmio + offset + 2); 
     
    223216} 
    224217 
    225 /* Not "static", as it's used in main.c */ 
    226218const struct ssb_bus_ops ssb_pcmcia_ops = { 
    227219        .read16         = ssb_pcmcia_read16, 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/scan.c

    r3691 r3693  
    1616#include <linux/ssb/ssb_regs.h> 
    1717#include <linux/pci.h> 
    18 #include <linux/io.h> 
    19  
    20 #include <pcmcia/cs_types.h> 
    21 #include <pcmcia/cs.h> 
    22 #include <pcmcia/cistpl.h> 
    23 #include <pcmcia/ds.h> 
     18#include <asm/io.h> 
     19 
     20#ifdef CONFIG_SSB_PCMCIAHOST 
     21# include <pcmcia/cs_types.h> 
     22# include <pcmcia/cs.h> 
     23# include <pcmcia/cistpl.h> 
     24# include <pcmcia/ds.h> 
     25#endif 
    2426 
    2527#include "ssb_private.h" 
    2628 
    2729 
    28 const char *ssb_core_name(u16 coreid) 
     30const char * ssb_core_name(u16 coreid) 
    2931{ 
    3032        switch (coreid) { 
     
    204206                pci_iounmap(bus->host_pci, bus->mmio); 
    205207#else 
    206                 SSB_BUG_ON(1); /* Can't reach this code. */ 
     208                assert(0); /* Can't reach this code. */ 
    207209#endif 
    208210                break; 
     
    212214} 
    213215 
    214 static void __iomem *ssb_ioremap(struct ssb_bus *bus, 
    215                                  unsigned long baseaddr) 
     216static void __iomem * ssb_ioremap(struct ssb_bus *bus, 
     217                                  unsigned long baseaddr) 
    216218{ 
    217219        void __iomem *mmio = NULL; 
     
    228230                mmio = pci_iomap(bus->host_pci, 0, ~0UL); 
    229231#else 
    230                 SSB_BUG_ON(1); /* Can't reach this code. */ 
     232                assert(0); /* Can't reach this code. */ 
    231233#endif 
    232234                break; 
  • trunk/freewrt/target/linux/brcm-2.6/extra/drivers/ssb/ssb_private.h

    r3691 r3693  
    44#include <linux/ssb/ssb.h> 
    55#include <linux/types.h> 
     6#include <asm/io.h> 
    67 
    78 
     
    1617/* dprintk: Debugging printk; vanishes for non-debug compilation */ 
    1718#ifdef CONFIG_SSB_DEBUG 
    18 # define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x) 
     19# define ssb_dprintk(fmt, x...) ssb_printk(fmt ,##x) 
    1920#else 
    2021# define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0) 
    2122#endif 
    2223 
     24/* printkl: Rate limited printk */ 
     25#define ssb_printkl(fmt, x...)  do {            \ 
     26        if (printk_ratelimit())                 \ 
     27                ssb_printk(fmt ,##x);           \ 
     28                                } while (0) 
     29 
     30/* dprintkl: Rate limited debugging printk */ 
    2331#ifdef CONFIG_SSB_DEBUG 
    24 # define SSB_WARN_ON(x)         WARN_ON(x) 
    25 # define SSB_BUG_ON(x)          BUG_ON(x) 
     32# define ssb_dprintkl                   ssb_printkl 
    2633#else 
    27 static inline int __ssb_do_nothing(int x) { return x; } 
    28 # define SSB_WARN_ON(x)         __ssb_do_nothing(unlikely(!!(x))) 
    29 # define SSB_BUG_ON(x)          __ssb_do_nothing(unlikely(!!(x))) 
     34# define ssb_dprintkl(fmt, x...)        do { /* nothing */ } while (0) 
    3035#endif 
     36 
     37#define assert(cond)    do {                                            \ 
     38        if (unlikely(!(cond))) {                                        \ 
     39                ssb_dprintk(KERN_ERR PFX "BUG: Assertion failed (%s) "  \ 
     40                            "at: %s:%d:%s()\n",                         \ 
     41                            #cond, __FILE__, __LINE__, __func__);       \ 
     42        }                                                               \ 
     43                       } while (0) 
    3144 
    3245 
     
    108121 
    109122/* scan.c */ 
    110 extern const char *ssb_core_name(u16 coreid); 
     123extern const char * ssb_core_name(u16 coreid); 
    111124extern int ssb_bus_scan(struct ssb_bus *bus, 
    112125                        unsigned long baseaddr); 
     
    116129/* core.c */ 
    117130extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m); 
     131#ifdef CONFIG_SSB_PCIHOST 
    118132extern int ssb_devices_freeze(struct ssb_bus *bus); 
    119133extern int ssb_devices_thaw(struct ssb_bus *bus); 
    120 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev); 
    121  
    122 /* b43_pci_bridge.c */ 
    123 #ifdef CONFIG_SSB_PCIHOST 
    124 extern int __init b43_pci_ssb_bridge_init(void); 
    125 extern void __exit b43_pci_ssb_bridge_exit(void); 
    126 #else /* CONFIG_SSB_PCIHOST */ 
    127 static inline int b43_pci_ssb_bridge_init(void) 
    128 
    129         return 0; 
    130 
    131 static inline void b43_pci_ssb_bridge_exit(void) 
    132 
    133 
     134extern struct ssb_bus * ssb_pci_dev_to_bus(struct pci_dev *pdev); 
    134135#endif /* CONFIG_SSB_PCIHOST */ 
    135136 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/asm-mips/mach-bcm947xx/gpio.h

    r3691 r3693  
    2828} 
    2929 
    30 static inline int gpio_direction_output(unsigned gpio, int value
     30static inline int gpio_direction_output(unsigned gpio
    3131{ 
    3232        if (ssb.chipco.dev) 
    33                 ssb_chipco_gpio_outen(&ssb.chipco, 1 << gpio, value << gpio); 
     33                ssb_chipco_gpio_outen(&ssb.chipco, 1 << gpio, 1 << gpio); 
    3434        else if (ssb.extif.dev) 
    35                 ssb_extif_gpio_outen(&ssb.extif, 1 << gpio, value << gpio); 
     35                ssb_extif_gpio_outen(&ssb.extif, 1 << gpio, 1 << gpio); 
    3636        else 
    3737                return -EINVAL; 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb.h

    r3691 r3693  
    11#ifndef LINUX_SSB_H_ 
    22#define LINUX_SSB_H_ 
     3#ifdef __KERNEL__ 
    34 
    45#include <linux/device.h> 
     
    67#include <linux/types.h> 
    78#include <linux/spinlock.h> 
    8 #include <linux/pci.h> 
    9 #include <linux/mod_devicetable.h> 
     9#ifdef CONFIG_SSB_PCIHOST 
     10# include <linux/pci.h> 
     11#endif 
    1012 
    1113#include <linux/ssb/ssb_regs.h> 
     
    155157#define SSB_VENDOR_BROADCOM     0x4243 
    156158 
     159struct ssb_device_id { 
     160        u16 vendor; 
     161        u16 coreid; 
     162        u8 revision; 
     163}; 
     164#define SSB_DEVICE(_vendor, _coreid, _revision)  \ 
     165        { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } 
     166#define SSB_DEVTABLE_END  \ 
     167        { 0, }, 
     168 
     169#define SSB_ANY_VENDOR          0xFFFF 
     170#define SSB_ANY_ID              0xFFFF 
     171#define SSB_ANY_REV             0xFF 
     172 
    157173/* Some kernel subsystems poke with dev->drvdata, so we must use the 
    158174 * following ugly workaround to get from struct device to struct ssb_device */ 
     
    183199struct ssb_device * dev_to_ssb_dev(struct device *dev) 
    184200{ 
    185         struct __ssb_dev_wrapper *wrap; 
    186         wrap = container_of(dev, struct __ssb_dev_wrapper, dev); 
     201        struct __ssb_dev_wrapper *wrap = container_of(dev, struct __ssb_dev_wrapper, dev); 
    187202        return wrap->sdev; 
    188203} 
     
    282297 
    283298#ifdef CONFIG_SSB_PCIHOST 
    284         /* Mutex to protect the SPROM writing. */ 
    285299        struct mutex pci_sprom_mutex; 
    286300#endif 
     
    320334        struct ssb_sprom sprom; 
    321335 
    322         /* Internal-only stuff follows. Do not touch. */ 
     336        /* Internal. */ 
    323337        struct list_head list; 
    324 #ifdef CONFIG_SSB_DEBUG 
    325         /* Is the bus already powered up? */ 
    326         bool powered_up; 
    327         int power_warn_count; 
    328 #endif /* DEBUG */ 
    329338}; 
    330339 
     
    334343        struct ssb_sprom sprom; 
    335344}; 
    336 /* Type of function to fetch the invariants. */ 
    337 typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, 
    338                                      struct ssb_init_invariants *iv); 
    339345 
    340346/* Register a SSB system bus. get_invariants() is called after the 
     
    344350extern int ssb_bus_ssbbus_register(struct ssb_bus *bus, 
    345351                                   unsigned long baseaddr, 
    346                                    ssb_invariants_func_t get_invariants); 
     352                                   int (*get_invariants)(struct ssb_bus *bus, 
     353                                                         struct ssb_init_invariants *iv)); 
    347354#ifdef CONFIG_SSB_PCIHOST 
    348355extern int ssb_bus_pcibus_register(struct ssb_bus *bus, 
     
    359366extern u32 ssb_clockspeed(struct ssb_bus *bus); 
    360367 
    361 /* Is the device enabled in hardware? */ 
    362368int ssb_device_is_enabled(struct ssb_device *dev); 
    363 /* Enable a device and pass device-specific SSB_TMSLOW flags. 
    364  * If no device-specific flags are available, use 0. */ 
    365369void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags); 
    366 /* Disable a device in hardware and pass SSB_TMSLOW flags (if any). */ 
    367370void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags); 
    368371 
     
    406409 
    407410 
    408 /* If a driver is shutdown or suspended, call this to signal 
    409  * that the bus may be completely powered down. SSB will decide, 
    410  * if it's really time to power down the bus, based on if there 
    411  * are other devices that want to run. */ 
     411/* Bus-Power handling functions. */ 
    412412extern int ssb_bus_may_powerdown(struct ssb_bus *bus); 
    413 /* Before initializing and enabling a device, call this to power-up the bus. 
    414  * If you want to allow use of dynamic-power-control, pass the flag. 
    415  * Otherwise static always-on powercontrol will be used. */ 
    416 extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); 
     413extern int ssb_bus_powerup(struct ssb_bus *bus, int dynamic_pctl); 
    417414 
    418415 
     
    422419 
    423420 
     421#endif /* __KERNEL__ */ 
    424422#endif /* LINUX_SSB_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb_driver_chipcommon.h

    r3691 r3693  
    1313 * Licensed under the GPL version 2. See COPYING for details. 
    1414 */ 
     15#ifdef __KERNEL__ 
    1516 
    1617/** ChipCommon core registers. **/ 
     
    364365extern void ssb_chipco_resume(struct ssb_chipcommon *cc); 
    365366 
    366 extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, 
    367                                     u32 *plltype, u32 *n, u32 *m); 
    368367extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc, 
    369368                                        u32 *plltype, u32 *n, u32 *m); 
     
    380379                                     enum ssb_clkmode mode); 
    381380 
    382 extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 
    383                                           u32 ticks); 
    384  
    385 u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); 
    386  
    387 void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); 
    388  
    389 void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value); 
    390  
    391381#ifdef CONFIG_SSB_SERIAL 
    392382extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc, 
     
    394384#endif /* CONFIG_SSB_SERIAL */ 
    395385 
     386#endif /* __KERNEL__ */ 
    396387#endif /* LINUX_SSB_CHIPCO_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb_driver_extif.h

    r3691 r3693  
    2020#ifndef LINUX_SSB_EXTIFCORE_H_ 
    2121#define LINUX_SSB_EXTIFCORE_H_ 
     22 
     23#ifdef __KERNEL__ 
     24 
     25struct ssb_extif { 
     26        struct ssb_device *dev; 
     27}; 
    2228 
    2329/* external interface address space */ 
     
    154160 
    155161 
    156  
    157 #ifdef CONFIG_SSB_DRIVER_EXTIF 
    158  
    159 struct ssb_extif { 
    160         struct ssb_device *dev; 
    161 }; 
    162  
    163 static inline bool ssb_extif_available(struct ssb_extif *extif) 
    164 
    165         return (extif->dev != NULL); 
    166 
    167  
    168 extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif, 
    169                                        u32 *plltype, u32 *n, u32 *m); 
    170  
    171 extern void ssb_extif_timing_init(struct ssb_extif *extif, 
    172                                   unsigned long ns); 
    173  
    174 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); 
    175  
    176 void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value); 
    177  
    178 void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value); 
    179  
    180 #ifdef CONFIG_SSB_SERIAL 
    181 extern int ssb_extif_serial_init(struct ssb_extif *extif, 
    182                                  struct ssb_serial_port *ports); 
    183 #endif /* CONFIG_SSB_SERIAL */ 
    184  
    185  
    186 #else /* CONFIG_SSB_DRIVER_EXTIF */ 
    187 /* extif disabled */ 
    188  
    189 struct ssb_extif { 
    190 }; 
    191  
    192 static inline bool ssb_extif_available(struct ssb_extif *extif) 
    193 
    194         return 0; 
    195 
    196  
    197 static inline 
    198 void ssb_extif_get_clockcontrol(struct ssb_extif *extif, 
    199                                 u32 *plltype, u32 *n, u32 *m) 
    200 
    201 
    202  
    203 #endif /* CONFIG_SSB_DRIVER_EXTIF */ 
     162#endif /* __KERNEL__ */ 
    204163#endif /* LINUX_SSB_EXTIFCORE_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb_driver_mips.h

    r3691 r3693  
    11#ifndef LINUX_SSB_MIPSCORE_H_ 
    22#define LINUX_SSB_MIPSCORE_H_ 
     3 
     4#ifdef __KERNEL__ 
    35 
    46#ifdef CONFIG_SSB_DRIVER_MIPS 
     
    2123        struct ssb_serial_port serial_ports[4]; 
    2224 
    23         u8 flash_buswidth; 
    2425        u32 flash_window; 
    2526        u32 flash_window_size; 
     
    2728 
    2829extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 
    29 extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore); 
    3030 
    3131extern unsigned int ssb_mips_irq(struct ssb_device *dev); 
     
    4444#endif /* CONFIG_SSB_DRIVER_MIPS */ 
    4545 
     46#endif /* __KERNEL__ */ 
    4647#endif /* LINUX_SSB_MIPSCORE_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb_driver_pci.h

    r3691 r3693  
    11#ifndef LINUX_SSB_PCICORE_H_ 
    22#define LINUX_SSB_PCICORE_H_ 
     3#ifdef __KERNEL__ 
    34 
    45#ifdef CONFIG_SSB_DRIVER_PCICORE 
     
    104105 
    105106#endif /* CONFIG_SSB_DRIVER_PCICORE */ 
     107#endif /* __KERNEL__ */ 
    106108#endif /* LINUX_SSB_PCICORE_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/extra/include/linux/ssb/ssb_regs.h

    r3691 r3693  
    11#ifndef LINUX_SSB_REGS_H_ 
    22#define LINUX_SSB_REGS_H_ 
     3#ifdef __KERNEL__ 
    34 
    45 
     
    67 * All regions may not exist on all chips. 
    78 */ 
    8 #define SSB_SDRAM_BASE          0x00000000U   /* Physical SDRAM */ 
    9 #define SSB_PCI_MEM             0x08000000U   /* Host Mode sb2pcitranslation0 (64 MB) */ 
    10 #define SSB_PCI_CFG             0x0c000000U   /* Host Mode sb2pcitranslation1 (64 MB) */ 
    11 #define SSB_SDRAM_SWAPPED       0x10000000U   /* Byteswapped Physical SDRAM */ 
    12 #define SSB_ENUM_BASE           0x18000000U   /* Enumeration space base */ 
    13 #define SSB_ENUM_LIMIT          0x18010000U   /* Enumeration space limit */ 
    14  
    15 #define SSB_FLASH2              0x1c000000U   /* Flash Region 2 (region 1 shadowed here) */ 
    16 #define SSB_FLASH2_SZ           0x02000000U   /* Size of Flash Region 2 */ 
    17  
    18 #define SSB_EXTIF_BASE          0x1f000000U   /* External Interface region base address */ 
    19 #define SSB_FLASH1              0x1fc00000U   /* Flash Region 1 */ 
    20 #define SSB_FLASH1_SZ           0x00400000U   /* Size of Flash Region 1 */ 
    21  
    22 #define SSB_PCI_DMA             0x40000000U   /* Client Mode sb2pcitranslation2 (1 GB) */ 
    23 #define SSB_PCI_DMA_SZ          0x40000000U   /* Client Mode sb2pcitranslation2 size in bytes */ 
    24 #define SSB_PCIE_DMA_L32        0x00000000U   /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */ 
    25 #define SSB_PCIE_DMA_H32        0x80000000U   /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ 
    26 #define SSB_EUART               (SSB_EXTIF_BASE + 0x00800000) 
    27 #define SSB_LED                 (SSB_EXTIF_BASE + 0x00900000) 
     9#define SSB_SDRAM_BASE          0x00000000    /* Physical SDRAM */ 
     10#define SSB_PCI_MEM             0x08000000    /* Host Mode sb2pcitranslation0 (64 MB) */ 
     11#define SSB_PCI_CFG             0x0c000000    /* Host Mode sb2pcitranslation1 (64 MB) */ 
     12#define SSB_SDRAM_SWAPPED       0x10000000    /* Byteswapped Physical SDRAM */ 
     13#define SSB_ENUM_BASE           0x18000000    /* Enumeration space base */ 
     14#define SSB_ENUM_LIMIT          0x18010000    /* Enumeration space limit */ 
     15 
     16#define SSB_FLASH2              0x1c000000    /* Flash Region 2 (region 1 shadowed here) */ 
     17#define SSB_FLASH2_SZ           0x02000000    /* Size of Flash Region 2 */ 
     18 
     19#define SSB_EXTIF_BASE          0x1f000000    /* External Interface region base address */ 
     20#define SSB_FLASH1              0x1fc00000    /* Flash Region 1 */ 
     21#define SSB_FLASH1_SZ           0x00400000    /* Size of Flash Region 1 */ 
     22 
     23#define SSB_PCI_DMA             0x40000000    /* Client Mode sb2pcitranslation2 (1 GB) */ 
     24#define SSB_PCI_DMA_SZ          0x40000000    /* Client Mode sb2pcitranslation2 size in bytes */ 
     25#define SSB_PCIE_DMA_L32               0x00000000     /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */ 
     26#define SSB_PCIE_DMA_H32               0x80000000     /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ 
     27#define SSB_EUART               (SB_EXTIF_BASE + 0x00800000) 
     28#define SSB_LED                 (SB_EXTIF_BASE + 0x00900000) 
    2829 
    2930 
     
    268269}; 
    269270 
    270 /* Address-Match values and masks (SSB_ADMATCHxxx) */ 
     271/* Address-Match values and masks (SSB_ADMATCH?) */ 
    271272#define SSB_ADM_TYPE                    0x00000003      /* Address type */ 
    272273#define  SSB_ADM_TYPE0                  0 
     
    290291 
    291292 
     293#endif /* __KERNEL__ */ 
    292294#endif /* LINUX_SSB_REGS_H_ */ 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2100-board_support.patch

    r3686 r3693  
    1 Index: linux-2.6.23/arch/mips/Kconfig 
    2 =================================================================== 
    3 --- linux-2.6.23.orig/arch/mips/Kconfig        2007-10-13 02:23:06.662507926 +0200 
    4 +++ linux-2.6.23/arch/mips/Kconfig     2007-10-13 02:23:41.484492317 +0200 
     1Index: linux-2.6.22-rc4/arch/mips/Kconfig 
     2=================================================================== 
     3--- linux-2.6.22-rc4.orig/arch/mips/Kconfig    2007-06-10 21:32:36.000000000 +0100 
     4+++ linux-2.6.22-rc4/arch/mips/Kconfig 2007-06-10 21:33:12.000000000 +0100 
    55@@ -4,6 +4,10 @@ 
    66        # Horrible source of confusion.  Die, die, die ... 
     
    1414  
    1515 menu "Machine selection" 
    16 @@ -44,6 +48,23 @@ 
    17           note that a kernel built with this option selected will not be 
    18           able to run on normal units. 
     16@@ -126,6 +130,23 @@ 
     17         Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and 
     18         Olivetti M700-10 workstations. 
    1919  
    2020+config BCM947XX 
     
    3535+        Support for BCM947xx based boards 
    3636+ 
    37  config MIPS_COBAL
    38         bool "Cobalt Server
     37 config LASA
     38        bool "LASAT Networks platforms
    3939        select DMA_NONCOHERENT 
    40 Index: linux-2.6.23/arch/mips/Makefile 
    41 =================================================================== 
    42 --- linux-2.6.23.orig/arch/mips/Makefile        2007-10-13 02:23:06.682509066 +0200 
    43 +++ linux-2.6.23/arch/mips/Makefile     2007-10-13 02:23:11.210767122 +0200 
    44 @@ -533,6 +533,18 @@ 
     40Index: linux-2.6.22-rc4/arch/mips/kernel/cpu-probe.c 
     41=================================================================== 
     42--- linux-2.6.22-rc4.orig/arch/mips/kernel/cpu-probe.c  2007-06-10 21:32:13.000000000 +0100 
     43+++ linux-2.6.22-rc4/arch/mips/kernel/cpu-probe.c       2007-06-10 21:33:12.000000000 +0100 
     44@@ -711,6 +711,28 @@ 
     45 } 
     46  
     47  
     48+static inline void cpu_probe_broadcom(struct cpuinfo_mips *c) 
     49+{ 
     50+       decode_config1(c); 
     51+       switch (c->processor_id & 0xff00) { 
     52+               case PRID_IMP_BCM3302: 
     53+                       c->cputype = CPU_BCM3302; 
     54+                       c->isa_level = MIPS_CPU_ISA_M32R1; 
     55+                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 
     56+                                       MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER; 
     57+               break; 
     58+               case PRID_IMP_BCM4710: 
     59+                       c->cputype = CPU_BCM4710; 
     60+                       c->isa_level = MIPS_CPU_ISA_M32R1; 
     61+                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 
     62+                                       MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER; 
     63+               break; 
     64+       default: 
     65+               c->cputype = CPU_UNKNOWN; 
     66+               break; 
     67+       } 
     68+} 
     69
     70 __init void cpu_probe(void) 
     71 { 
     72        struct cpuinfo_mips *c = &current_cpu_data; 
     73@@ -733,6 +755,9 @@ 
     74        case PRID_COMP_SIBYTE: 
     75                cpu_probe_sibyte(c); 
     76                break; 
     77+       case PRID_COMP_BROADCOM: 
     78+               cpu_probe_broadcom(c); 
     79+               break; 
     80        case PRID_COMP_SANDCRAFT: 
     81                cpu_probe_sandcraft(c); 
     82                break; 
     83Index: linux-2.6.22-rc4/arch/mips/kernel/proc.c 
     84=================================================================== 
     85--- linux-2.6.22-rc4.orig/arch/mips/kernel/proc.c       2007-06-10 21:32:13.000000000 +0100 
     86+++ linux-2.6.22-rc4/arch/mips/kernel/proc.c    2007-06-10 21:33:12.000000000 +0100 
     87@@ -83,6 +83,8 @@ 
     88        [CPU_VR4181]    = "NEC VR4181", 
     89        [CPU_VR4181A]   = "NEC VR4181A", 
     90        [CPU_SR71000]   = "Sandcraft SR71000", 
     91+       [CPU_BCM3302]   = "Broadcom BCM3302", 
     92+       [CPU_BCM4710]   = "Broadcom BCM4710", 
     93        [CPU_PR4450]    = "Philips PR4450", 
     94 }; 
     95  
     96Index: linux-2.6.22-rc4/arch/mips/Makefile 
     97=================================================================== 
     98--- linux-2.6.22-rc4.orig/arch/mips/Makefile    2007-06-10 21:32:56.000000000 +0100 
     99+++ linux-2.6.22-rc4/arch/mips/Makefile 2007-06-10 21:33:12.000000000 +0100 
     100@@ -560,6 +560,18 @@ 
    45101 load-$(CONFIG_SIBYTE_BIGSUR)   := 0xffffffff80100000 
    46102  
     
    61117 # 
    62118 core-$(CONFIG_SNI_RM)          += arch/mips/sni/ 
    63 Index: linux-2.6.23.1/drivers/Makefile 
    64 =================================================================== 
    65 --- linux-2.6.23.1.orig/drivers/Makefile        2008-01-27 04:34:31.000000000 +0100 
    66 +++ linux-2.6.23.1/drivers/Makefile             2008-01-27 04:39:57.000000000 +0100 
    67 @@ -89,3 +89,4 @@ 
     119Index: linux-2.6.22-rc4/arch/mips/mm/tlbex.c 
     120=================================================================== 
     121--- linux-2.6.22-rc4.orig/arch/mips/mm/tlbex.c  2007-06-10 21:32:35.000000000 +0100 
     122+++ linux-2.6.22-rc4/arch/mips/mm/tlbex.c       2007-06-10 21:33:12.000000000 +0100 
     123@@ -892,6 +892,8 @@ 
     124        case CPU_4KSC: 
     125        case CPU_20KC: 
     126        case CPU_25KF: 
     127+       case CPU_BCM3302: 
     128+       case CPU_BCM4710: 
     129                tlbw(p); 
     130                break; 
     131  
     132Index: linux-2.6.22-rc4/drivers/Kconfig 
     133=================================================================== 
     134--- linux-2.6.22-rc4.orig/drivers/Kconfig       2007-06-10 21:32:13.000000000 +0100 
     135+++ linux-2.6.22-rc4/drivers/Kconfig    2007-06-10 21:33:12.000000000 +0100 
     136@@ -56,6 +56,8 @@ 
     137  
     138 source "drivers/hwmon/Kconfig" 
     139  
     140+source "drivers/ssb/Kconfig" 
     141
     142 source "drivers/mfd/Kconfig" 
     143  
     144 source "drivers/media/Kconfig" 
     145Index: linux-2.6.22-rc4/drivers/Makefile 
     146=================================================================== 
     147--- linux-2.6.22-rc4.orig/drivers/Makefile      2007-06-10 21:32:14.000000000 +0100 
     148+++ linux-2.6.22-rc4/drivers/Makefile   2007-06-10 21:33:12.000000000 +0100 
     149@@ -81,3 +81,4 @@ 
     150 obj-$(CONFIG_DMA_ENGINE)       += dma/ 
     151 obj-$(CONFIG_HID)              += hid/ 
    68152 obj-$(CONFIG_PPC_PS3)          += ps3/ 
    69  obj-$(CONFIG_OF)               += of/ 
    70  obj-$(CONFIG_GPIO_DEVICE)      += gpio/ 
    71153+obj-$(CONFIG_SSB)              += ssb/ 
    72 Index: linux-2.6.23.1/include/linux/pci_ids.h 
    73 =================================================================== 
    74 --- linux-2.6.23.1.orig/include/linux/pci_ids.h 2008-01-27 04:55:18.000000000 +0100 
    75 +++ linux-2.6.23.1/include/linux/pci_ids.h      2008-01-27 04:55:22.000000000 +0100 
    76 @@ -1972,6 +1972,7 @@ 
     154Index: linux-2.6.22-rc4/include/asm-mips/bootinfo.h 
     155=================================================================== 
     156--- linux-2.6.22-rc4.orig/include/asm-mips/bootinfo.h   2007-06-10 21:32:14.000000000 +0100 
     157+++ linux-2.6.22-rc4/include/asm-mips/bootinfo.h        2007-06-10 21:33:12.000000000 +0100 
     158@@ -213,6 +213,12 @@ 
     159 #define MACH_GROUP_NEC_EMMA2RH 25      /* NEC EMMA2RH (was 23)         */ 
     160 #define  MACH_NEC_MARKEINS     0       /* NEC EMMA2RH Mark-eins        */ 
     161  
     162+/* 
     163+ * Valid machtype for group Broadcom 
     164+ */ 
     165+#define MACH_GROUP_BRCM                23      /* Broadcom                     */ 
     166+#define MACH_BCM47XX           1       /* Broadcom BCM47xx             */ 
     167
     168 #define CL_SIZE                        COMMAND_LINE_SIZE 
     169  
     170 const char *get_system_type(void); 
     171Index: linux-2.6.22-rc4/include/asm-mips/cpu.h 
     172=================================================================== 
     173--- linux-2.6.22-rc4.orig/include/asm-mips/cpu.h        2007-06-10 21:32:14.000000000 +0100 
     174+++ linux-2.6.22-rc4/include/asm-mips/cpu.h     2007-06-10 21:33:12.000000000 +0100 
     175@@ -104,6 +104,13 @@ 
     176 #define PRID_IMP_SR71000        0x0400 
     177  
     178 /* 
     179+ * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM 
     180+ */ 
     181
     182+#define PRID_IMP_BCM4710       0x4000 
     183+#define PRID_IMP_BCM3302       0x9000 
     184
     185+/* 
     186  * Definitions for 7:0 on legacy processors 
     187  */ 
     188  
     189@@ -200,7 +207,9 @@ 
     190 #define CPU_SB1A               62 
     191 #define CPU_74K                        63 
     192 #define CPU_R14000             64 
     193-#define CPU_LAST               64 
     194+#define CPU_BCM3302            65 
     195+#define CPU_BCM4710            66 
     196+#define CPU_LAST               66 
     197  
     198 /* 
     199  * ISA Level encodings 
     200Index: linux-2.6.22-rc4/include/linux/pci_ids.h 
     201=================================================================== 
     202--- linux-2.6.22-rc4.orig/include/linux/pci_ids.h       2007-06-10 21:32:14.000000000 +0100 
     203+++ linux-2.6.22-rc4/include/linux/pci_ids.h    2007-06-10 21:33:12.000000000 +0100 
     204@@ -1991,6 +1991,7 @@ 
    77205 #define PCI_DEVICE_ID_TIGON3_5906M     0x1713 
    78206 #define PCI_DEVICE_ID_BCM4401          0x4401 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2110-flash_map.patch

    r3686 r3693  
    1 Index: linux-2.6.23/drivers/mtd/maps/Kconfig 
     1Index: linux-2.6.22-rc4/drivers/mtd/maps/Kconfig 
    22=================================================================== 
    3 --- linux-2.6.23.orig/drivers/mtd/maps/Kconfig 2007-10-09 22:31:38.000000000 +0200 
    4 +++ linux-2.6.23/drivers/mtd/maps/Kconfig      2007-10-13 02:28:13.644001805 +0200 
    5 @@ -352,6 +352,12 @@ 
     3--- linux-2.6.22-rc4.orig/drivers/mtd/maps/Kconfig     2007-06-10 21:32:13.000000000 +0100 
     4+++ linux-2.6.22-rc4/drivers/mtd/maps/Kconfig  2007-06-10 21:33:14.000000000 +0100 
     5@@ -358,6 +358,12 @@ 
    66          Mapping for the Flaga digital module. If you don't have one, ignore 
    77          this setting. 
     
    1212+       help 
    1313+         Support for the flash chips on the BCM947xx board. 
    14 + 
     14+         
    1515 config MTD_WALNUT 
    1616        tristate "Flash device mapped on IBM 405GP Walnut" 
    1717        depends on MTD_JEDECPROBE && WALNUT 
    18 Index: linux-2.6.23/drivers/mtd/maps/Makefile 
     18Index: linux-2.6.22-rc4/drivers/mtd/maps/Makefile 
    1919=================================================================== 
    20 --- linux-2.6.23.orig/drivers/mtd/maps/Makefile        2007-10-09 22:31:38.000000000 +0200 
    21 +++ linux-2.6.23/drivers/mtd/maps/Makefile     2007-10-13 02:27:56.727037761 +0200 
     20--- linux-2.6.22-rc4.orig/drivers/mtd/maps/Makefile    2007-06-10 21:32:13.000000000 +0100 
     21+++ linux-2.6.22-rc4/drivers/mtd/maps/Makefile 2007-06-10 21:33:14.000000000 +0100 
    2222@@ -33,6 +33,7 @@ 
    2323 obj-$(CONFIG_MTD_PCMCIA)       += pcmciamtd.o 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2120-b44_ssb_support.patch

    r3686 r3693  
    1 Index: linux-2.6.23/drivers/net/b44.c 
     1Index: linux-2.6.22-rc4/drivers/net/b44.c 
    22=================================================================== 
    3 --- linux-2.6.23.orig/drivers/net/b44.c        2007-10-13 10:58:27.872607266 +0200 
    4 +++ linux-2.6.23/drivers/net/b44.c     2007-10-13 11:00:46.916530927 +0200 
     3--- linux-2.6.22-rc4.orig/drivers/net/b44.c    2007-06-10 21:32:13.000000000 +0100 
     4+++ linux-2.6.22-rc4/drivers/net/b44.c 2007-06-10 21:33:15.000000000 +0100 
    55@@ -1,7 +1,9 @@ 
    66-/* b44.c: Broadcom 4400 device driver. 
     
    1515  * 
    1616  * Distribute under GPL. 
    17 @@ -21,11 +23,13 @@ 
     17@@ -20,11 +22,13 @@ 
    1818 #include <linux/delay.h> 
    1919 #include <linux/init.h> 
     
    2929  
    3030 #define DRV_MODULE_NAME                "b44" 
    31 @@ -87,8 +91,8 @@ 
     31@@ -86,8 +90,8 @@ 
    3232 static char version[] __devinitdata = 
    3333        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 
     
    4040 MODULE_VERSION(DRV_MODULE_VERSION); 
    4141  
    42 @@ -96,18 +100,11 @@ 
     42@@ -95,18 +99,11 @@ 
    4343 module_param(b44_debug, int, 0); 
    4444 MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value"); 
     
    6262 static void b44_init_rings(struct b44 *); 
    6363  
    64 @@ -119,6 +116,7 @@ 
     64@@ -118,6 +115,7 @@ 
    6565  
    6666 static int dma_desc_align_mask; 
     
    7070 static const char b44_gstrings[][ETH_GSTRING_LEN] = { 
    7171 #define _B44(x...)     # x, 
    72 @@ -126,35 +124,24 @@ 
     72@@ -125,35 +123,24 @@ 
    7373 #undef _B44 
    7474 }; 
     
    108108+                                              enum dma_data_direction dir) 
    109109+{ 
    110 +       dma_sync_single_range_for_device(sdev->dev, dma_base, 
     110+       dma_sync_single_range_for_device(&sdev->dev, dma_base, 
    111111+                                       offset & dma_desc_align_mask, 
    112112+                                       dma_desc_sync_size, dir); 
     
    118118+                                           enum dma_data_direction dir) 
    119119+{ 
    120 +       dma_sync_single_range_for_cpu(sdev->dev, dma_base, 
     120+       dma_sync_single_range_for_cpu(&sdev->dev, dma_base, 
    121121+                                    offset & dma_desc_align_mask, 
    122122+                                    dma_desc_sync_size, dir); 
     
    124124  
    125125 static int b44_wait_bit(struct b44 *bp, unsigned long reg, 
    126 @@ -182,117 +169,29 @@ 
     126@@ -181,117 +168,29 @@ 
    127127        return 0; 
    128128 } 
     
    240240-#endif 
    241241-       return 0; 
    242 +       data[0] = (val >> 8) & 0xFF; 
    243 +       data[1] = (val >> 0) & 0xFF; 
    244  } 
    245   
     242-} 
     243
    246244-static int ssb_is_core_up(struct b44 *bp) 
    247245-{ 
    248246-       return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK)) 
    249247-               == SBTMSLOW_CLOCK); 
    250 -} 
    251 
     248+       data[0] = (val >> 8) & 0xFF; 
     249+       data[1] = (val >> 0) & 0xFF; 
     250 } 
     251  
    252252-static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index) 
    253253+static inline void __b44_cam_write(struct b44 *bp, unsigned char *data, int index) 
     
    255255        u32 val; 
    256256  
    257 @@ -328,14 +227,14 @@ 
     257@@ -327,14 +226,14 @@ 
    258258        bw32(bp, B44_IMASK, bp->imask); 
    259259 } 
     
    272272                             (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT))); 
    273273        err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0); 
    274 @@ -344,18 +243,34 @@ 
     274@@ -343,18 +242,34 @@ 
    275275        return err; 
    276276 } 
     
    302302+       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) 
    303303+               return 0; 
    304 + 
     304+               
    305305+       return __b44_writephy(bp, bp->phy_addr, reg, val); 
    306306+} 
     
    309309 /* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional 
    310310  * due to code existing before miilib use was added to this driver. 
    311 @@ -384,6 +299,8 @@ 
     311@@ -383,6 +298,8 @@ 
    312312        u32 val; 
    313313        int err; 
     
    318318        if (err) 
    319319                return err; 
    320 @@ -442,11 +359,27 @@ 
     320@@ -441,11 +358,27 @@ 
    321321        __b44_set_flow_ctrl(bp, pause_enab); 
    322322 } 
     
    335335+        */ 
    336336+       if ((atoi(nvram_get("boardnum")) == 2) && 
    337 +                       (__b44_readphy(bp, 0, MII_BMCR, &val) == 0) && 
     337+                       (__b44_readphy(bp, 0, MII_BMCR, &val) == 0) &&  
    338338+                       (val & BMCR_ISOLATE) && 
    339339+                       (__b44_writephy(bp, 0, MII_BMCR, val & ~BMCR_ISOLATE) != 0)) { 
     
    346346                goto out; 
    347347        if ((err = b44_writephy(bp, B44_MII_ALEDCTRL, 
    348 @@ -542,6 +475,19 @@ 
     348@@ -541,6 +474,19 @@ 
    349349 { 
    350350        u32 bmsr, aux; 
     
    371371  
    372372-               pci_unmap_single(bp->pdev, 
    373 +               dma_unmap_single(bp->sdev->dev, 
     373+               dma_unmap_single(&bp->sdev->dev, 
    374374                                 pci_unmap_addr(rp, mapping), 
    375375                                 skb->len, 
     
    379379                dev_kfree_skb_irq(skb); 
    380380        } 
    381 @@ -657,9 +603,9 @@ 
     381@@ -656,10 +602,10 @@ 
     382        skb = dev_alloc_skb(RX_PKT_BUF_SZ); 
    382383        if (skb == NULL) 
    383384                return -ENOMEM; 
    384   
     385
    385386-       mapping = pci_map_single(bp->pdev, skb->data, 
    386 +       mapping = dma_map_single(bp->sdev->dev, skb->data, 
     387+        
     388+       mapping = dma_map_single(&bp->sdev->dev, skb->data, 
    387389                                 RX_PKT_BUF_SZ, 
    388390-                                PCI_DMA_FROMDEVICE); 
     
    396398                if (!dma_mapping_error(mapping)) 
    397399-                       pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); 
    398 +                       dma_unmap_single(bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); 
     400+                       dma_unmap_single(&bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); 
    399401                dev_kfree_skb_any(skb); 
    400                 skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); 
     402                skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA); 
    401403                if (skb == NULL) 
    402404                        return -ENOMEM; 
    403405-               mapping = pci_map_single(bp->pdev, skb->data, 
    404 +               mapping = dma_map_single(bp->sdev->dev, skb->data, 
     406+               mapping = dma_map_single(&bp->sdev->dev, skb->data, 
    405407                                         RX_PKT_BUF_SZ, 
    406408-                                        PCI_DMA_FROMDEVICE); 
     
    410412                        if (!dma_mapping_error(mapping)) 
    411413-                               pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); 
    412 +                               dma_unmap_single(bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); 
     414+                               dma_unmap_single(&bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); 
    413415                        dev_kfree_skb_any(skb); 
    414416                        return -ENOMEM; 
    415417                } 
    416 @@ -705,9 +651,9 @@ 
    417         dp->addr = cpu_to_le32((u32) mapping + RX_PKT_OFFSET + bp->dma_offset); 
     418@@ -707,9 +653,9 @@ 
     419        dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset); 
    418420  
    419421        if (bp->flags & B44_FLAG_RX_RING_HACK) 
     
    427429        return RX_PKT_BUF_SZ; 
    428430 } 
    429 @@ -734,9 +680,9 @@ 
     431@@ -736,9 +682,9 @@ 
    430432                           pci_unmap_addr(src_map, mapping)); 
    431433  
     
    440442        ctrl = src_desc->ctrl; 
    441443        if (dest_idx == (B44_RX_RING_SIZE - 1)) 
    442 @@ -750,13 +696,13 @@ 
     444@@ -752,13 +698,13 @@ 
    443445        src_map->skb = NULL; 
    444446  
     
    452454  
    453455-       pci_dma_sync_single_for_device(bp->pdev, le32_to_cpu(src_desc->addr), 
    454 +       dma_sync_single_for_device(bp->sdev->dev, le32_to_cpu(src_desc->addr), 
     456+       dma_sync_single_for_device(&bp->sdev->dev, le32_to_cpu(src_desc->addr), 
    455457                                       RX_PKT_BUF_SZ, 
    456458-                                      PCI_DMA_FROMDEVICE); 
     
    459461  
    460462 static int b44_rx(struct b44 *bp, int budget) 
    461 @@ -776,9 +722,9 @@ 
     463@@ -778,9 +724,9 @@ 
    462464                struct rx_header *rh; 
    463465                u16 len; 
    464466  
    465467-               pci_dma_sync_single_for_cpu(bp->pdev, map, 
    466 +               dma_sync_single_for_cpu(bp->sdev->dev, map, 
     468+               dma_sync_single_for_cpu(&bp->sdev->dev, map, 
    467469                                            RX_PKT_BUF_SZ, 
    468470-                                           PCI_DMA_FROMDEVICE); 
     
    470472                rh = (struct rx_header *) skb->data; 
    471473                len = le16_to_cpu(rh->len); 
    472                 if ((len > (RX_PKT_BUF_SZ - RX_PKT_OFFSET)) || 
    473 @@ -810,8 +756,8 @@ 
     474                if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) || 
     475@@ -812,11 +758,11 @@ 
    474476                        skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); 
    475477                        if (skb_size < 0) 
     
    477479-                       pci_unmap_single(bp->pdev, map, 
    478480-                                        skb_size, PCI_DMA_FROMDEVICE); 
    479 +                       dma_unmap_single(bp->sdev->dev, map, 
     481+                       dma_unmap_single(&bp->sdev->dev, map, 
    480482+                                        skb_size, DMA_FROM_DEVICE); 
    481483                        /* Leave out rx_header */ 
    482                         skb_put(skb, len + RX_PKT_OFFSET); 
    483                         skb_pull(skb, RX_PKT_OFFSET); 
    484 @@ -982,24 +928,24 @@ 
     484-                       skb_put(skb, len+bp->rx_offset); 
     485-                       skb_pull(skb,bp->rx_offset); 
     486+               skb_put(skb, len+bp->rx_offset); 
     487+                       skb_pull(skb,bp->rx_offset); 
     488                } else { 
     489                        struct sk_buff *copy_skb; 
     490  
     491@@ -985,23 +931,23 @@ 
    485492                goto err_out; 
    486493        } 
    487494  
    488495-       mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); 
    489 +       mapping = dma_map_single(bp->sdev->dev, skb->data, len, DMA_TO_DEVICE); 
     496+       mapping = dma_map_single(&bp->sdev->dev, skb->data, len, DMA_TO_DEVICE); 
    490497        if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { 
    491                 struct sk_buff *bounce_skb; 
    492   
    493498                /* Chip can't handle DMA to/from >1GB, use bounce buffer */ 
    494499                if (!dma_mapping_error(mapping)) 
    495500-                       pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); 
    496 +                       dma_unmap_single(bp->sdev->dev, mapping, len, DMA_TO_DEVICE); 
    497   
    498                 bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA); 
     501+                       dma_unmap_single(&bp->sdev->dev, mapping, len, DMA_TO_DEVICE); 
     502  
     503                bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, 
     504                                             GFP_ATOMIC|GFP_DMA); 
    499505                if (!bounce_skb) 
    500506                        goto err_out; 
     
    502508-               mapping = pci_map_single(bp->pdev, bounce_skb->data, 
    503509-                                        len, PCI_DMA_TODEVICE); 
    504 +               mapping = dma_map_single(bp->sdev->dev, bounce_skb->data, 
     510+               mapping = dma_map_single(&bp->sdev->dev, bounce_skb->data, 
    505511+                                        len, DMA_TO_DEVICE); 
    506512                if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { 
    507513                        if (!dma_mapping_error(mapping)) 
    508514-                               pci_unmap_single(bp->pdev, mapping, 
    509 -                                               len, PCI_DMA_TODEVICE); 
    510 +                               dma_unmap_single(bp->sdev->dev, mapping, 
    511 +                                               len, DMA_TO_DEVICE); 
     515-                                        len, PCI_DMA_TODEVICE); 
     516+                               dma_unmap_single(&bp->sdev->dev, mapping, 
     517+                                        len, DMA_TO_DEVICE); 
    512518                        dev_kfree_skb_any(bounce_skb); 
    513519                        goto err_out; 
    514520                } 
    515 @@ -1022,9 +968,9 @@ 
     521@@ -1025,9 +971,9 @@ 
    516522        bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset); 
    517523  
     
    526532        entry = NEXT_TX(entry); 
    527533  
    528 @@ -1097,10 +1043,10 @@ 
     534@@ -1100,10 +1046,10 @@ 
    529535  
    530536                if (rp->skb == NULL) 
    531537                        continue; 
    532538-               pci_unmap_single(bp->pdev, 
    533 +               dma_unmap_single(bp->sdev->dev, 
     539+               dma_unmap_single(&bp->sdev->dev, 
    534540                                 pci_unmap_addr(rp, mapping), 
    535541                                 RX_PKT_BUF_SZ, 
     
    539545                rp->skb = NULL; 
    540546        } 
    541 @@ -1111,10 +1057,10 @@ 
     547@@ -1114,10 +1060,10 @@ 
    542548  
    543549                if (rp->skb == NULL) 
    544550                        continue; 
    545551-               pci_unmap_single(bp->pdev, 
    546 +               dma_unmap_single(bp->sdev->dev, 
     552+               dma_unmap_single(&bp->sdev->dev, 
    547553                                 pci_unmap_addr(rp, mapping), 
    548554                                 rp->skb->len, 
     
    552558                rp->skb = NULL; 
    553559        } 
    554 @@ -1136,14 +1082,14 @@ 
     560@@ -1139,14 +1085,14 @@ 
    555561        memset(bp->tx_ring, 0, B44_TX_RING_BYTES); 
    556562  
     
    559565-                                          DMA_TABLE_BYTES, 
    560566-                                          PCI_DMA_BIDIRECTIONAL); 
    561 +               dma_sync_single_for_device(bp->sdev->dev, bp->rx_ring_dma, 
     567+               dma_sync_single_for_device(&bp->sdev->dev, bp->rx_ring_dma, 
    562568+                                         DMA_TABLE_BYTES, 
    563569+                                         DMA_BIDIRECTIONAL); 
     
    567573-                                          DMA_TABLE_BYTES, 
    568574-                                          PCI_DMA_TODEVICE); 
    569 +               dma_sync_single_for_device(bp->sdev->dev, bp->tx_ring_dma, 
     575+               dma_sync_single_for_device(&bp->sdev->dev, bp->tx_ring_dma, 
    570576+                                         DMA_TABLE_BYTES, 
    571577+                                         DMA_TO_DEVICE); 
     
    573579        for (i = 0; i < bp->rx_pending; i++) { 
    574580                if (b44_alloc_rx_skb(bp, -1, i) < 0) 
    575 @@ -1163,24 +1109,24 @@ 
     581@@ -1166,24 +1112,24 @@ 
    576582        bp->tx_buffers = NULL; 
    577583        if (bp->rx_ring) { 
     
    580586-                                        DMA_TABLE_BYTES, 
    581587-                                        DMA_BIDIRECTIONAL); 
    582 +                       dma_unmap_single(bp->sdev->dev, bp->rx_ring_dma, 
     588+                       dma_unmap_single(&bp->sdev->dev, bp->rx_ring_dma, 
    583589+                                       DMA_TABLE_BYTES, 
    584590+                                       DMA_BIDIRECTIONAL); 
     
    586592                } else 
    587593-                       pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, 
    588 +                       dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, 
     594+                       dma_free_coherent(&bp->sdev->dev, DMA_TABLE_BYTES, 
    589595                                            bp->rx_ring, bp->rx_ring_dma); 
    590596                bp->rx_ring = NULL; 
     
    596602-                                        DMA_TABLE_BYTES, 
    597603-                                        DMA_TO_DEVICE); 
    598 +                       dma_unmap_single(bp->sdev->dev, bp->tx_ring_dma, 
     604+                       dma_unmap_single(&bp->sdev->dev, bp->tx_ring_dma, 
    599605+                                       DMA_TABLE_BYTES, 
    600606+                                       DMA_TO_DEVICE); 
     
    602608                } else 
    603609-                       pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, 
    604 +                       dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, 
     610+                       dma_free_coherent(&bp->sdev->dev, DMA_TABLE_BYTES, 
    605611                                            bp->tx_ring, bp->tx_ring_dma); 
    606612                bp->tx_ring = NULL; 
    607613                bp->flags &= ~B44_FLAG_TX_RING_HACK; 
    608 @@ -1206,7 +1152,7 @@ 
     614@@ -1209,7 +1155,7 @@ 
    609615                goto out_err; 
    610616  
    611617        size = DMA_TABLE_BYTES; 
    612618-       bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); 
    613 +       bp->rx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->rx_ring_dma, GFP_ATOMIC); 
     619+       bp->rx_ring = dma_alloc_coherent(&bp->sdev->dev, size, &bp->rx_ring_dma, GFP_ATOMIC); 
    614620        if (!bp->rx_ring) { 
    615621                /* Allocation may have failed due to pci_alloc_consistent 
    616622                   insisting on use of GFP_DMA, which is more restrictive 
    617 @@ -1218,9 +1164,9 @@ 
     623@@ -1221,9 +1167,9 @@ 
    618624                if (!rx_ring) 
    619625                        goto out_err; 
     
    622628-                                            DMA_TABLE_BYTES, 
    623629-                                            DMA_BIDIRECTIONAL); 
    624 +               rx_ring_dma = dma_map_single(bp->sdev->dev, rx_ring, 
     630+               rx_ring_dma = dma_map_single(&bp->sdev->dev, rx_ring, 
    625631+                                           DMA_TABLE_BYTES, 
    626632+                                           DMA_BIDIRECTIONAL); 
     
    628634                if (dma_mapping_error(rx_ring_dma) || 
    629635                        rx_ring_dma + size > DMA_30BIT_MASK) { 
    630 @@ -1233,9 +1179,9 @@ 
     636@@ -1236,9 +1182,9 @@ 
    631637                bp->flags |= B44_FLAG_RX_RING_HACK; 
    632638        } 
    633639  
    634640-       bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma); 
    635 +       bp->tx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->tx_ring_dma, GFP_ATOMIC); 
     641+       bp->tx_ring = dma_alloc_coherent(&bp->sdev->dev, size, &bp->tx_ring_dma, GFP_ATOMIC); 
    636642        if (!bp->tx_ring) { 
    637643-               /* Allocation may have failed due to pci_alloc_consistent 
     
    640646                   than necessary...  */ 
    641647                struct dma_desc *tx_ring; 
    642 @@ -1245,9 +1191,9 @@ 
     648@@ -1248,9 +1194,9 @@ 
    643649                if (!tx_ring) 
    644650                        goto out_err; 
     
    647653-                                            DMA_TABLE_BYTES, 
    648654-                                            DMA_TO_DEVICE); 
    649 +               tx_ring_dma = dma_map_single(bp->sdev->dev, tx_ring, 
     655+               tx_ring_dma = dma_map_single(&bp->sdev->dev, tx_ring, 
    650656+                                           DMA_TABLE_BYTES, 
    651657+                                           DMA_TO_DEVICE); 
     
    653659                if (dma_mapping_error(tx_ring_dma) || 
    654660                        tx_ring_dma + size > DMA_30BIT_MASK) { 
    655 @@ -1282,7 +1228,9 @@ 
     661@@ -1285,7 +1231,9 @@ 
    656662 /* bp->lock is held. */ 
    657663 static void b44_chip_reset(struct b44 *bp) 
     
    664670                bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); 
    665671                b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1); 
    666 @@ -1294,19 +1242,23 @@ 
     672@@ -1297,19 +1245,23 @@ 
    667673                } 
    668674                bw32(bp, B44_DMARX_CTRL, 0); 
     
    682688-       bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | 
    683689+       switch (sdev->bus->bustype) { 
    684 +       case SSB_BUSTYPE_SSB: 
     690+       case SSB_BUSTYPE_SSB:  
    685691+                       bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | 
    686692+                            (((ssb_clockspeed(sdev->bus) + (B44_MDC_RATIO / 2)) / B44_MDC_RATIO) 
     
    696702  
    697703        if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) { 
    698 @@ -1349,6 +1301,7 @@ 
     704@@ -1352,6 +1304,7 @@ 
    699705 { 
    700706        struct b44 *bp = netdev_priv(dev); 
     
    704710        if (netif_running(dev)) 
    705711                return -EBUSY; 
    706 @@ -1359,7 +1312,11 @@ 
     712@@ -1362,7 +1315,11 @@ 
    707713        memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 
    708714  
    709715        spin_lock_irq(&bp->lock); 
    710716-       __b44_set_mac_addr(bp); 
    711 + 
     717+    
    712718+       val = br32(bp, B44_RXCONFIG); 
    713719+       if (!(val & RXCONFIG_CAM_ABSENT)) 
    714720+               __b44_set_mac_addr(bp); 
    715 + 
     721+    
    716722        spin_unlock_irq(&bp->lock); 
    717723  
    718724        return 0; 
    719 @@ -1445,18 +1402,6 @@ 
     725@@ -1448,18 +1405,6 @@ 
    720726        return err; 
    721727 } 
     
    736742 /* 
    737743  * Polling receive - used by netconsole and other diagnostic tools 
    738 @@ -1570,7 +1515,6 @@ 
     744@@ -1574,7 +1519,6 @@ 
    739745 static void b44_setup_wol(struct b44 *bp) 
    740746 { 
     
    744750        bw32(bp, B44_RXCONFIG, RXCONFIG_ALLMULTI); 
    745751  
    746 @@ -1594,13 +1538,6 @@ 
     752@@ -1598,13 +1542,6 @@ 
    747753        } else { 
    748754                b44_setup_pseudo_magicp(bp); 
     
    758764  
    759765 static int b44_close(struct net_device *dev) 
    760 @@ -1700,7 +1637,7 @@ 
     766@@ -1704,7 +1641,7 @@ 
    761767  
    762768        val = br32(bp, B44_RXCONFIG); 
     
    767773                bw32(bp, B44_RXCONFIG, val); 
    768774        } else { 
    769 @@ -1747,12 +1684,8 @@ 
     775@@ -1751,12 +1688,8 @@ 
    770776  
    771777 static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) 
     
    780786  
    781787 static int b44_nway_reset(struct net_device *dev) 
    782 @@ -2035,6 +1968,245 @@ 
    783         .get_ethtool_stats     = b44_get_ethtool_stats
     788@@ -2040,6 +1973,245 @@ 
     789        .get_perm_addr         = ethtool_op_get_perm_addr
    784790 }; 
    785791  
     
    970976+ 
    971977+               b44_enable_ints(bp); 
    972 + 
     978+               
    973979+               return 0; 
    974980+       } 
     
    10151021+ 
    10161022+               b44_enable_ints(bp); 
    1017 + 
     1023+               
    10181024+               return 0; 
    10191025+       } 
     
    10261032 { 
    10271033        struct mii_ioctl_data *data = if_mii(ifr); 
    1028 @@ -2044,40 +2216,64 @@ 
     1034@@ -2049,40 +2221,64 @@ 
    10291035        if (!netif_running(dev)) 
    10301036                goto out; 
     
    10941100-               goto out; 
    10951101+       bp->dma_offset = ssb_dma_translation(sdev); 
    1096   
    1097 -       bp->dev->dev_addr[0] = eeprom[79]; 
    1098 -       bp->dev->dev_addr[1] = eeprom[78]; 
    1099 -       bp->dev->dev_addr[2] = eeprom[81]; 
    1100 -       bp->dev->dev_addr[3] = eeprom[80]; 
    1101 -       bp->dev->dev_addr[4] = eeprom[83]; 
    1102 -       bp->dev->dev_addr[5] = eeprom[82]; 
     1102
    11031103+       switch (instance) { 
    11041104+       case 1: 
     
    11111111+              break; 
    11121112+       } 
    1113 
     1113  
     1114-       bp->dev->dev_addr[0] = eeprom[79]; 
     1115-       bp->dev->dev_addr[1] = eeprom[78]; 
     1116-       bp->dev->dev_addr[2] = eeprom[81]; 
     1117-       bp->dev->dev_addr[3] = eeprom[80]; 
     1118-       bp->dev->dev_addr[4] = eeprom[83]; 
     1119-       bp->dev->dev_addr[5] = eeprom[82]; 
    11141120+       memcpy(bp->dev->dev_addr, addr, 6); 
    11151121  
    11161122        if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ 
    11171123                printk(KERN_ERR PFX "Invalid MAC address found in EEPROM\n"); 
    1118 @@ -2086,103 +2282,52 @@ 
     1124@@ -2091,108 +2287,52 @@ 
    11191125  
    11201126        memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len); 
     
    11221128-       bp->phy_addr = eeprom[90] & 0x1f; 
    11231129- 
     1130        /* With this, plus the rx_header prepended to the data by the 
     1131         * hardware, we'll land the ethernet header on a 2-byte boundary. 
     1132         */ 
     1133        bp->rx_offset = 30; 
     1134- 
    11241135        bp->imask = IMASK_DEF; 
    1125   
     1136
    11261137-       bp->core_unit = ssb_core_unit(bp); 
    11271138-       bp->dma_offset = SB_PCI_DMA; 
     
    11291140        /* XXX - really required? 
    11301141           bp->flags |= B44_FLAG_BUGGY_TXPTR; 
    1131           */ 
    1132   
     1142-         */ 
     1143
    11331144-       if (ssb_get_core_rev(bp) >= 7) 
    1134 +       if (bp->sdev->id.revision >= 7) 
    1135                 bp->flags |= B44_FLAG_B0_ANDLATER; 
     1145-               bp->flags |= B44_FLAG_B0_ANDLATER; 
     1146+       */ 
    11361147  
    11371148-out: 
     
    11971208        if (!dev) { 
    11981209-               dev_err(&pdev->dev, "Etherdev alloc failed, aborting.\n"); 
    1199 +               dev_err(sdev->dev, "Etherdev alloc failed, aborting.\n"); 
     1210+               dev_err(&sdev->dev, "Etherdev alloc failed, aborting.\n"); 
    12001211                err = -ENOMEM; 
    12011212-               goto err_out_free_res; 
     
    12051216        SET_MODULE_OWNER(dev); 
    12061217-       SET_NETDEV_DEV(dev,&pdev->dev); 
    1207 +       SET_NETDEV_DEV(dev,sdev->dev); 
     1218+       SET_NETDEV_DEV(dev,&sdev->dev); 
    12081219  
    12091220        /* No interesting netdevice features in this card... */ 
     
    12291240        bp->tx_pending = B44_DEF_TX_RING_PENDING; 
    12301241  
    1231 @@ -2201,16 +2346,16 @@ 
     1242@@ -2211,16 +2351,16 @@ 
    12321243        dev->poll_controller = b44_poll_controller; 
    12331244 #endif 
     
    12421253        if (err) { 
    12431254-               dev_err(&pdev->dev, 
    1244 +               dev_err(sdev->dev, 
     1255+               dev_err(&sdev->dev, 
    12451256                        "Problem fetching invariants of chip, aborting.\n"); 
    12461257-               goto err_out_iounmap; 
     
    12491260  
    12501261        bp->mii_if.dev = dev; 
    1251 @@ -2229,61 +2374,52 @@ 
     1262@@ -2239,61 +2379,52 @@ 
    12521263  
    12531264        err = register_netdev(dev); 
     
    12551266-               dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 
    12561267-               goto err_out_iounmap; 
    1257 +               dev_err(sdev->dev, "Cannot register net device, aborting.\n"); 
     1268+               dev_err(&sdev->dev, "Cannot register net device, aborting.\n"); 
    12581269+               goto out; 
    12591270        } 
     
    13271338        del_timer_sync(&bp->timer); 
    13281339  
    1329 @@ -2301,33 +2437,22 @@ 
     1340@@ -2311,26 +2442,16 @@ 
    13301341                b44_init_hw(bp, B44_PARTIAL_RESET); 
    13311342                b44_setup_wol(bp); 
     
    13571368                return 0; 
    13581369  
    1359         rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev); 
    1360         if (rc) { 
    1361                 printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name); 
    1362 -               pci_disable_device(pdev); 
    1363                 return rc; 
    1364         } 
    1365   
    1366 @@ -2346,29 +2471,31 @@ 
     1370@@ -2356,29 +2477,31 @@ 
    13671371        return 0; 
    13681372 } 
     
    14021406  
    14031407 module_init(b44_init); 
    1404 Index: linux-2.6.23/drivers/net/b44.h 
     1408Index: linux-2.6.22-rc4/drivers/net/b44.h 
    14051409=================================================================== 
    1406 --- linux-2.6.23.orig/drivers/net/b44.h 2007-10-13 10:58:27.880607722 +0200 
    1407 +++ linux-2.6.23/drivers/net/b44.h      2007-10-13 11:00:46.904530245 +0200 
     1410--- linux-2.6.22-rc4.orig/drivers/net/b44.h     2007-06-10 21:32:13.000000000 +0100 
     1411+++ linux-2.6.22-rc4/drivers/net/b44.h  2007-06-10 21:33:15.000000000 +0100 
     1412@@ -129,6 +129,7 @@ 
     1413 #define  RXCONFIG_FLOW         0x00000020 /* Flow Control Enable */ 
     1414 #define  RXCONFIG_FLOW_ACCEPT  0x00000040 /* Accept Unicast Flow Control Frame */ 
     1415 #define  RXCONFIG_RFILT                0x00000080 /* Reject Filter */ 
     1416+#define  RXCONFIG_CAM_ABSENT   0x00000100 /* CAM Absent */ 
     1417 #define B44_RXMAXLEN   0x0404UL /* EMAC RX Max Packet Length */ 
     1418 #define B44_TXMAXLEN   0x0408UL /* EMAC TX Max Packet Length */ 
     1419 #define B44_MDIO_CTRL  0x0410UL /* EMAC MDIO Control */ 
    14081420@@ -227,75 +228,9 @@ 
    14091421 #define B44_RX_PAUSE   0x05D4UL /* MIB RX Pause Packets */ 
     
    15111523 #define B44_FLAG_FULL_DUPLEX   0x00010000 
    15121524 #define B44_FLAG_100_BASE_T    0x00020000 
    1513 @@ -450,8 +388,7 @@ 
     1525@@ -452,8 +390,7 @@ 
    15141526        struct net_device_stats stats; 
    15151527        struct b44_hw_stats     hw_stats; 
     
    15211533  
    15221534        dma_addr_t              rx_ring_dma, tx_ring_dma; 
    1523 Index: linux-2.6.23/drivers/net/Kconfig 
     1535Index: linux-2.6.22-rc4/drivers/net/Kconfig 
    15241536=================================================================== 
    1525 --- linux-2.6.23.orig/drivers/net/Kconfig      2007-10-13 10:58:27.888608180 +0200 
    1526 +++ linux-2.6.23/drivers/net/Kconfig   2007-10-13 11:00:46.912530699 +0200 
    1527 @@ -1577,7 +1577,7 @@ 
     1537--- linux-2.6.22-rc4.orig/drivers/net/Kconfig  2007-06-10 21:32:48.000000000 +0100 
     1538+++ linux-2.6.22-rc4/drivers/net/Kconfig       2007-06-10 21:33:15.000000000 +0100 
     1539@@ -1511,7 +1511,7 @@ 
    15281540  
    15291541 config B44 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2130-remove_scache.patch

    r3686 r3693  
    1 Index: linux-2.6.23/arch/mips/Kconfig 
     1Index: linux-2.6.22-rc4/arch/mips/Kconfig 
    22=================================================================== 
    3 --- linux-2.6.23.orig/arch/mips/Kconfig        2007-10-13 02:23:41.484492317 +0200 
    4 +++ linux-2.6.23/arch/mips/Kconfig     2007-10-13 02:47:02.784347843 +0200 
    5 @@ -192,7 +192,6 @@ 
     3--- linux-2.6.22-rc4.orig/arch/mips/Kconfig    2007-06-10 21:33:12.000000000 +0100 
     4+++ linux-2.6.22-rc4/arch/mips/Kconfig 2007-06-10 21:33:17.000000000 +0100 
     5@@ -202,7 +202,6 @@ 
    66        select I8259 
    77        select MIPS_BOARDS_GEN 
     
    1111        select MIPS_MSC 
    1212        select SWAP_IO_SPACE 
    13 @@ -1281,13 +1280,6 @@ 
     13@@ -1345,13 +1344,6 @@ 
    1414        bool 
    1515        select BOARD_SCACHE 
     
    2525        bool 
    2626        select BOARD_SCACHE 
    27 Index: linux-2.6.23/arch/mips/kernel/cpu-probe.c 
     27Index: linux-2.6.22-rc4/arch/mips/kernel/cpu-probe.c 
    2828=================================================================== 
    29 --- linux-2.6.23.orig/arch/mips/kernel/cpu-probe.c     2007-10-13 02:23:11.210767122 +0200 
    30 +++ linux-2.6.23/arch/mips/kernel/cpu-probe.c  2007-10-13 02:47:02.788348072 +0200 
    31 @@ -701,6 +701,8 @@ 
     29--- linux-2.6.22-rc4.orig/arch/mips/kernel/cpu-probe.c 2007-06-10 21:33:12.000000000 +0100 
     30+++ linux-2.6.22-rc4/arch/mips/kernel/cpu-probe.c      2007-06-10 21:33:17.000000000 +0100 
     31@@ -619,6 +619,8 @@ 
    3232                break; 
    3333        case PRID_IMP_25KF: 
     
    3838        case PRID_IMP_34K: 
    3939                c->cputype = CPU_34K; 
    40 Index: linux-2.6.23/arch/mips/mm/c-r4k.c 
     40Index: linux-2.6.22-rc4/arch/mips/mm/c-r4k.c 
    4141=================================================================== 
    42 --- linux-2.6.23.orig/arch/mips/mm/c-r4k.c     2007-10-09 22:31:38.000000000 +0200 
    43 +++ linux-2.6.23/arch/mips/mm/c-r4k.c  2007-10-13 02:47:02.792348301 +0200 
    44 @@ -1086,7 +1086,6 @@ 
     42--- linux-2.6.22-rc4.orig/arch/mips/mm/c-r4k.c 2007-06-10 21:32:13.000000000 +0100 
     43+++ linux-2.6.22-rc4/arch/mips/mm/c-r4k.c      2007-06-10 21:33:17.000000000 +0100 
     44@@ -1038,7 +1038,6 @@ 
    4545  
    4646 extern int r5k_sc_init(void); 
     
    5050 static void __init setup_scache(void) 
    5151 { 
    52 @@ -1140,29 +1139,17 @@ 
    53  #endif 
     52@@ -1086,29 +1085,17 @@ 
     53               return; 
    5454  
    5555        default: 
     
    8585        c->scache.waysize = scache_size / c->scache.ways; 
    8686  
    87 Index: linux-2.6.23/arch/mips/mm/Makefile 
     87Index: linux-2.6.22-rc4/arch/mips/mm/Makefile 
    8888=================================================================== 
    89 --- linux-2.6.23.orig/arch/mips/mm/Makefile    2007-10-09 22:31:38.000000000 +0200 
    90 +++ linux-2.6.23/arch/mips/mm/Makefile 2007-10-13 02:47:23.393522295 +0200 
    91 @@ -31,6 +31,5 @@ 
     89--- linux-2.6.22-rc4.orig/arch/mips/mm/Makefile        2007-06-10 21:32:13.000000000 +0100 
     90+++ linux-2.6.22-rc4/arch/mips/mm/Makefile     2007-06-10 21:33:17.000000000 +0100 
     91@@ -30,4 +30,3 @@ 
    9292 obj-$(CONFIG_IP22_CPU_SCACHE)  += sc-ip22.o 
    9393 obj-$(CONFIG_R5000_CPU_SCACHE)  += sc-r5k.o 
    9494 obj-$(CONFIG_RM7000_CPU_SCACHE)        += sc-rm7k.o 
    9595-obj-$(CONFIG_MIPS_CPU_SCACHE)  += sc-mips.o 
    96   
    97  EXTRA_CFLAGS += -Werror 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2150-cpu_fixes.patch

    r3686 r3693  
    1 Index: linux-2.6.23/arch/mips/kernel/genex.S 
     1Index: linux-2.6.22/arch/mips/kernel/genex.S 
    22=================================================================== 
    3 --- linux-2.6.23.orig/arch/mips/kernel/genex.S 2007-10-13 11:29:46.219648163 +0200 
    4 +++ linux-2.6.23/arch/mips/kernel/genex.S      2007-10-13 11:29:49.619841933 +0200 
     3--- linux-2.6.22.orig/arch/mips/kernel/genex.S 2007-07-26 06:29:25.057170943 +0200 
     4+++ linux-2.6.22/arch/mips/kernel/genex.S      2007-07-26 06:29:40.890073208 +0200 
    55@@ -51,6 +51,10 @@ 
    66 NESTED(except_vec3_generic, 0, sp) 
     
    1414        mfc0    k0, CP0_INDEX 
    1515 #endif 
    16 Index: linux-2.6.23/arch/mips/mm/c-r4k.c 
     16Index: linux-2.6.22/arch/mips/mm/c-r4k.c 
    1717=================================================================== 
    18 --- linux-2.6.23.orig/arch/mips/mm/c-r4k.c     2007-10-13 11:29:46.227648623 +0200 
    19 +++ linux-2.6.23/arch/mips/mm/c-r4k.c  2007-10-13 11:29:49.619841933 +0200 
    20 @@ -30,6 +30,9 @@ 
     18--- linux-2.6.22.orig/arch/mips/mm/c-r4k.c     2007-07-26 06:29:40.826069560 +0200 
     19+++ linux-2.6.22/arch/mips/mm/c-r4k.c  2007-07-26 06:32:45.956619550 +0200 
     20@@ -29,6 +29,9 @@ 
    2121 #include <asm/cacheflush.h> /* for run_uncached() */ 
    2222  
     
    2828  * Special Variant of smp_call_function for use by cache functions: 
    2929  * 
    30 @@ -94,6 +97,9 @@ 
     30@@ -85,14 +88,21 @@ 
     31  
     32 static inline void r4k_blast_dcache_page_dc32(unsigned long addr) 
     33 { 
     34+       unsigned long flags; 
     35
     36+       local_irq_save(flags); 
     37        R4600_HIT_CACHEOP_WAR_IMPL; 
     38        blast_dcache32_page(addr); 
     39+       local_irq_restore(flags); 
     40 } 
     41  
     42 static void __init r4k_blast_dcache_page_setup(void) 
    3143 { 
    3244        unsigned long  dc_lsize = cpu_dcache_line_size(); 
     
    3850                r4k_blast_dcache_page = (void *)cache_noop; 
    3951        else if (dc_lsize == 16) 
    40 @@ -108,6 +114,9 @@ 
     52@@ -107,6 +117,9 @@ 
    4153 { 
    4254        unsigned long dc_lsize = cpu_dcache_line_size(); 
     
    4860                r4k_blast_dcache_page_indexed = (void *)cache_noop; 
    4961        else if (dc_lsize == 16) 
    50 @@ -122,6 +131,9 @@ 
     62@@ -121,6 +134,9 @@ 
    5163 { 
    5264        unsigned long dc_lsize = cpu_dcache_line_size(); 
     
    5870                r4k_blast_dcache = (void *)cache_noop; 
    5971        else if (dc_lsize == 16) 
    60 @@ -623,6 +635,8 @@ 
     72@@ -202,8 +218,12 @@ 
     73  
     74 static void (* r4k_blast_icache_page)(unsigned long addr); 
     75  
     76+static void r4k_flush_cache_all(void); 
     77 static void __init r4k_blast_icache_page_setup(void) 
     78 { 
     79+#ifdef CONFIG_BCM947XX 
     80+       r4k_blast_icache_page = (void *)r4k_flush_cache_all; 
     81+#else 
     82        unsigned long ic_lsize = cpu_icache_line_size(); 
     83  
     84        if (ic_lsize == 0) 
     85@@ -214,6 +234,7 @@ 
     86                r4k_blast_icache_page = blast_icache32_page; 
     87        else if (ic_lsize == 64) 
     88                r4k_blast_icache_page = blast_icache64_page; 
     89+#endif 
     90 } 
     91  
     92  
     93@@ -221,6 +242,9 @@ 
     94  
     95 static void __init r4k_blast_icache_page_indexed_setup(void) 
     96 { 
     97+#ifdef CONFIG_BCM947XX 
     98+       r4k_blast_icache_page_indexed = (void *)r4k_flush_cache_all; 
     99+#else 
     100        unsigned long ic_lsize = cpu_icache_line_size(); 
     101  
     102        if (ic_lsize == 0) 
     103@@ -239,6 +263,7 @@ 
     104                                blast_icache32_page_indexed; 
     105        } else if (ic_lsize == 64) 
     106                r4k_blast_icache_page_indexed = blast_icache64_page_indexed; 
     107+#endif 
     108 } 
     109  
     110 static void (* r4k_blast_icache)(void); 
     111@@ -322,12 +347,17 @@ 
     112  */ 
     113 static inline void local_r4k_flush_cache_all(void * args) 
     114 { 
     115+       unsigned long flags; 
     116
     117+       local_irq_save(flags); 
     118        r4k_blast_dcache(); 
     119+       r4k_blast_icache(); 
     120+       local_irq_restore(flags); 
     121 } 
     122  
     123 static void r4k_flush_cache_all(void) 
     124 { 
     125-       if (!cpu_has_dc_aliases) 
     126+       if (!cpu_has_dc_aliases && cpu_use_kmap_coherent) 
     127                return; 
     128  
     129        r4k_on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1); 
     130@@ -335,6 +365,9 @@ 
     131  
     132 static inline void local_r4k___flush_cache_all(void * args) 
     133 { 
     134+       unsigned long flags; 
     135
     136+       local_irq_save(flags); 
     137        r4k_blast_dcache(); 
     138        r4k_blast_icache(); 
     139  
     140@@ -348,6 +381,7 @@ 
     141        case CPU_R14000: 
     142                r4k_blast_scache(); 
     143        } 
     144+       local_irq_restore(flags); 
     145 } 
     146  
     147 static void r4k___flush_cache_all(void) 
     148@@ -358,17 +392,21 @@ 
     149 static inline void local_r4k_flush_cache_range(void * args) 
     150 { 
     151        struct vm_area_struct *vma = args; 
     152+       unsigned long flags; 
     153  
     154        if (!(cpu_context(smp_processor_id(), vma->vm_mm))) 
     155                return; 
     156  
     157+       local_irq_save(flags); 
     158        r4k_blast_dcache(); 
     159+       r4k_blast_icache(); 
     160+       local_irq_restore(flags); 
     161 } 
     162  
     163 static void r4k_flush_cache_range(struct vm_area_struct *vma, 
     164        unsigned long start, unsigned long end) 
     165 { 
     166-       if (!cpu_has_dc_aliases) 
     167+       if (!cpu_has_dc_aliases && cpu_use_kmap_coherent) 
     168                return; 
     169  
     170        r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1); 
     171@@ -377,6 +415,7 @@ 
     172 static inline void local_r4k_flush_cache_mm(void * args) 
     173 { 
     174        struct mm_struct *mm = args; 
     175+       unsigned long flags; 
     176  
     177        if (!cpu_context(smp_processor_id(), mm)) 
     178                return; 
     179@@ -395,12 +434,15 @@ 
     180                return; 
     181        } 
     182  
     183+       local_irq_save(flags); 
     184        r4k_blast_dcache(); 
     185+       r4k_blast_icache(); 
     186+       local_irq_restore(flags); 
     187 } 
     188  
     189 static void r4k_flush_cache_mm(struct mm_struct *mm) 
     190 { 
     191-       if (!cpu_has_dc_aliases) 
     192+       if (!cpu_has_dc_aliases && cpu_use_kmap_coherent) 
     193                return; 
     194  
     195        r4k_on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1); 
     196@@ -420,6 +462,7 @@ 
     197        unsigned long paddr = fcp_args->pfn << PAGE_SHIFT; 
     198        int exec = vma->vm_flags & VM_EXEC; 
     199        struct mm_struct *mm = vma->vm_mm; 
     200+       unsigned long flags; 
     201        pgd_t *pgdp; 
     202        pud_t *pudp; 
     203        pmd_t *pmdp; 
     204@@ -451,8 +494,9 @@ 
     205         * for every cache flush operation.  So we do indexed flushes 
     206         * in that case, which doesn't overly flush the cache too much. 
     207         */ 
     208+       local_irq_save(flags); 
     209        if ((mm == current->active_mm) && (pte_val(*ptep) & _PAGE_VALID)) { 
     210-               if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) { 
     211+               if (!cpu_use_kmap_coherent || cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) { 
     212                        r4k_blast_dcache_page(addr); 
     213                        if (exec && !cpu_icache_snoops_remote_store) 
     214                                r4k_blast_scache_page(addr); 
     215@@ -460,14 +504,14 @@ 
     216                if (exec) 
     217                        r4k_blast_icache_page(addr); 
     218  
     219-               return; 
     220+               goto done; 
     221        } 
     222  
     223        /* 
     224         * Do indexed flush, too much work to get the (possible) TLB refills 
     225         * to work correctly. 
     226         */ 
     227-       if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) { 
     228+       if (!cpu_use_kmap_coherent || cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) { 
     229                r4k_blast_dcache_page_indexed(cpu_has_pindexed_dcache ? 
     230                                              paddr : addr); 
     231                if (exec && !cpu_icache_snoops_remote_store) { 
     232@@ -483,6 +527,8 @@ 
     233                } else 
     234                        r4k_blast_icache_page_indexed(addr); 
     235        } 
     236+done: 
     237+       local_irq_restore(flags); 
     238 } 
     239  
     240 static void r4k_flush_cache_page(struct vm_area_struct *vma, 
     241@@ -499,7 +545,11 @@ 
     242  
     243 static inline void local_r4k_flush_data_cache_page(void * addr) 
     244 { 
     245+       unsigned long flags; 
     246
     247+       local_irq_save(flags); 
     248        r4k_blast_dcache_page((unsigned long) addr); 
     249+       local_irq_restore(flags); 
     250 } 
     251  
     252 static void r4k_flush_data_cache_page(unsigned long addr) 
     253@@ -542,6 +592,9 @@ 
     254  
     255 static void r4k_flush_icache_range(unsigned long start, unsigned long end) 
     256 { 
     257+#ifdef CONFIG_BCM947XX 
     258+       r4k_flush_cache_all(); 
     259+#else 
     260        struct flush_icache_range_args args; 
     261  
     262        args.start = start; 
     263@@ -549,12 +602,15 @@ 
     264  
     265        r4k_on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1); 
     266        instruction_hazard(); 
     267+#endif 
     268 } 
     269  
     270 #ifdef CONFIG_DMA_NONCOHERENT 
     271  
     272 static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 
     273 { 
     274+       unsigned long flags; 
     275
     276        /* Catch bad driver code */ 
     277        BUG_ON(size == 0); 
     278  
     279@@ -571,18 +627,21 @@ 
     280         * subset property so we have to flush the primary caches 
     281         * explicitly 
     282         */ 
     283+       local_irq_save(flags); 
     284        if (size >= dcache_size) { 
     285                r4k_blast_dcache(); 
     286        } else { 
     287                R4600_HIT_CACHEOP_WAR_IMPL; 
     288                blast_dcache_range(addr, addr + size); 
     289        } 
     290
     291        bc_wback_inv(addr, size); 
     292+       local_irq_restore(flags); 
     293 } 
     294  
     295 static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) 
     296 { 
     297+       unsigned long flags; 
     298
     299        /* Catch bad driver code */ 
     300        BUG_ON(size == 0); 
     301  
     302@@ -594,6 +653,7 @@ 
     303                return; 
     304        } 
     305  
     306+       local_irq_save(flags); 
     307        if (size >= dcache_size) { 
     308                r4k_blast_dcache(); 
     309        } else { 
     310@@ -602,6 +662,7 @@ 
     311        } 
     312  
     313        bc_inv(addr, size); 
     314+       local_irq_restore(flags); 
     315 } 
     316 #endif /* CONFIG_DMA_NONCOHERENT */ 
     317  
     318@@ -616,8 +677,12 @@ 
     319        unsigned long dc_lsize = cpu_dcache_line_size(); 
     320        unsigned long sc_lsize = cpu_scache_line_size(); 
    61321        unsigned long addr = (unsigned long) arg; 
    62   
     322+       unsigned long flags; 
     323  
     324+       local_irq_save(flags); 
    63325        R4600_HIT_CACHEOP_WAR_IMPL; 
    64326+       BCM4710_PROTECTED_FILL_TLB(addr); 
     
    67329                protected_writeback_dcache_line(addr & ~(dc_lsize - 1)); 
    68330        if (!cpu_icache_snoops_remote_store && scache_size) 
    69 @@ -1198,6 +1212,17 @@ 
     331@@ -644,6 +709,7 @@ 
     332        } 
     333        if (MIPS_CACHE_SYNC_WAR) 
     334                __asm__ __volatile__ ("sync"); 
     335+       local_irq_restore(flags); 
     336 } 
     337  
     338 static void r4k_flush_cache_sigtramp(unsigned long addr) 
     339@@ -1144,6 +1210,17 @@ 
    70340         * silly idea of putting something else there ... 
    71341         */ 
     
    85355        case CPU_R4000SC: 
    86356        case CPU_R4000MC: 
    87 @@ -1228,6 +1253,15 @@ 
     357@@ -1174,6 +1251,15 @@ 
    88358        /* Default cache error handler for R4000 and R5000 family */ 
    89359        set_uncached_handler (0x100, &except_vec2_generic, 0x80); 
     
    101371        setup_scache(); 
    102372  
    103 @@ -1273,5 +1307,13 @@ 
     373@@ -1219,5 +1305,13 @@ 
    104374        build_clear_page(); 
    105375        build_copy_page(); 
     
    115385+#endif 
    116386 } 
    117 Index: linux-2.6.23/arch/mips/mm/tlbex.c 
     387Index: linux-2.6.22/arch/mips/mm/tlbex.c 
    118388=================================================================== 
    119 --- linux-2.6.23.orig/arch/mips/mm/tlbex.c      2007-10-13 11:29:46.235649074 +0200 
    120 +++ linux-2.6.23/arch/mips/mm/tlbex.c   2007-10-13 11:35:46.076155216 +0200 
    121 @@ -1273,6 +1273,9 @@ 
    122                 /* No need for i_nop */ 
    123         } 
     389--- linux-2.6.22.orig/arch/mips/mm/tlbex.c      2007-07-26 06:29:40.582055658 +0200 
     390+++ linux-2.6.22/arch/mips/mm/tlbex.c   2007-07-26 06:32:45.964620005 +0200 
     391@@ -1229,6 +1229,10 @@ 
     392 #endif 
     393 } 
     394  
     395+#ifdef CONFIG_BCM947XX 
     396+extern int bcm4710; 
     397+#endif 
     398
     399 static void __init build_r4000_tlb_refill_handler(void) 
     400 { 
     401        u32 *p = tlb_handler; 
     402@@ -1243,6 +1247,10 @@ 
     403        memset(relocs, 0, sizeof(relocs)); 
     404        memset(final_handler, 0, sizeof(final_handler)); 
    124405  
    125406+#ifdef CONFIG_BCM947XX 
    126407+       i_nop(&p); 
    127408+#endif 
    128  #ifdef CONFIG_64BIT 
    129         build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */ 
    130  #else 
    131 @@ -1708,6 +1711,9 @@ 
    132                                    struct reloc **r, unsigned int pte, 
    133                                    unsigned int ptr) 
    134  { 
    135 +#ifdef CONFIG_BCM947XX 
    136 +       i_nop(p); 
    137 +#endif 
    138  #ifdef CONFIG_64BIT 
    139         build_get_pmde64(p, l, r, pte, ptr); /* get pmd in ptr */ 
    140  #else 
    141 Index: linux-2.6.23/include/asm-mips/r4kcache.h 
     409
     410        /* 
     411         * create the plain linear handler 
     412         */ 
     413@@ -1736,6 +1744,9 @@ 
     414        memset(labels, 0, sizeof(labels)); 
     415        memset(relocs, 0, sizeof(relocs)); 
     416  
     417+#ifdef CONFIG_BCM947XX 
     418+       i_nop(&p); 
     419+#endif 
     420        if (bcm1250_m3_war()) { 
     421                i_MFC0(&p, K0, C0_BADVADDR); 
     422                i_MFC0(&p, K1, C0_ENTRYHI); 
     423Index: linux-2.6.22/include/asm-mips/r4kcache.h 
    142424=================================================================== 
    143 --- linux-2.6.23.orig/include/asm-mips/r4kcache.h      2007-10-13 11:29:46.255650214 +0200 
    144 +++ linux-2.6.23/include/asm-mips/r4kcache.h   2007-10-13 11:29:49.631842613 +0200 
     425--- linux-2.6.22.orig/include/asm-mips/r4kcache.h      2007-07-26 06:29:25.085172538 +0200 
     426+++ linux-2.6.22/include/asm-mips/r4kcache.h   2007-07-26 06:29:40.938075943 +0200 
    145427@@ -17,6 +17,20 @@ 
    146428 #include <asm/cpu-features.h> 
     
    345627  
    346628 #endif /* _ASM_R4KCACHE_H */ 
    347 Index: linux-2.6.23/include/asm-mips/stackframe.h 
     629Index: linux-2.6.22/include/asm-mips/stackframe.h 
    348630=================================================================== 
    349 --- linux-2.6.23.orig/include/asm-mips/stackframe.h    2007-10-13 11:29:46.263650671 +0200 
    350 +++ linux-2.6.23/include/asm-mips/stackframe.h 2007-10-13 11:33:38.504885346 +0200 
     631--- linux-2.6.22.orig/include/asm-mips/stackframe.h    2007-07-26 06:29:25.093172994 +0200 
     632+++ linux-2.6.22/include/asm-mips/stackframe.h 2007-07-26 06:29:40.962077312 +0200 
    351633@@ -350,6 +350,10 @@ 
    352634                .macro  RESTORE_SP_AND_RET 
  • trunk/freewrt/target/linux/brcm-2.6/patches/2160-kmap_coherent.patch

    r3686 r3693  
    1 Index: linux-2.6.23/arch/mips/mm/init.c 
     1Index: linux-2.6.22-rc6/arch/mips/mm/init.c 
    22=================================================================== 
    3 --- linux-2.6.23.orig/arch/mips/mm/init.c      2007-10-09 22:31:38.000000000 +0200 
    4 +++ linux-2.6.23/arch/mips/mm/init.c   2007-10-13 02:57:18.483434538 +0200 
    5 @@ -211,7 +211,7 @@ 
     3--- linux-2.6.22-rc6.orig/arch/mips/mm/init.c  2007-07-04 02:17:11.423962000 +0200 
     4+++ linux-2.6.22-rc6/arch/mips/mm/init.c       2007-07-04 02:17:31.269202250 +0200 
     5@@ -207,7 +207,7 @@ 
    66        void *vfrom, *vto; 
    77  
    88        vto = kmap_atomic(to, KM_USER1); 
    9 -       if (cpu_has_dc_aliases && !Page_dcache_dirty(from)) { 
    10 +       if (cpu_has_dc_aliases && cpu_use_kmap_coherent && !Page_dcache_dirty(from)) { 
     9-       if (cpu_has_dc_aliases) { 
     10+       if (cpu_has_dc_aliases && cpu_use_kmap_coherent) { 
    1111                vfrom = kmap_coherent(from, vaddr); 
    1212                copy_page(vto, vfrom); 
    1313                kunmap_coherent(); 
    14 @@ -234,7 +234,7 @@ 
     14@@ -230,7 +230,7 @@ 
    1515        struct page *page, unsigned long vaddr, void *dst, const void *src, 
    1616        unsigned long len) 
     
    2121                memcpy(vto, src, len); 
    2222                kunmap_coherent(); 
    23 @@ -250,7 +250,7 @@ 
     23@@ -246,7 +246,7 @@ 
    2424        struct page *page, unsigned long vaddr, void *dst, const void *src, 
    2525        unsigned long len) 
     
    3030                        kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 
    3131                memcpy(dst, vfrom, len); 
    32 Index: linux-2.6.23/include/asm-mips/mach-bcm947xx/cpu-feature-overrides.h 
     32Index: linux-2.6.22-rc6/include/asm-mips/mach-bcm947xx/cpu-feature-overrides.h 
    3333=================================================================== 
    3434--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    35 +++ linux-2.6.23/include/asm-mips/mach-bcm947xx/cpu-feature-overrides.h        2007-10-13 02:56:22.020216880 +0200 
     35+++ linux-2.6.22-rc6/include/asm-mips/mach-bcm947xx/cpu-feature-overrides.h    2007-07-04 02:17:31.273202500 +0200 
    3636@@ -0,0 +1,13 @@ 
    3737+/* 
     
    4848+ 
    4949+#endif /* __ASM_MACH_BCM947XX_CPU_FEATURE_OVERRIDES_H */ 
    50 Index: linux-2.6.23/include/asm-mips/cpu-features.h 
     50Index: linux-2.6.22-rc6/include/asm-mips/cpu-features.h 
    5151=================================================================== 
    52 --- linux-2.6.23.orig/include/asm-mips/cpu-features.h  2007-10-09 22:31:38.000000000 +0200 
    53 +++ linux-2.6.23/include/asm-mips/cpu-features.h       2007-10-13 02:56:22.028217337 +0200 
     52--- linux-2.6.22-rc6.orig/include/asm-mips/cpu-features.h      2007-07-04 02:17:11.455964000 +0200 
     53+++ linux-2.6.22-rc6/include/asm-mips/cpu-features.h   2007-07-04 02:17:31.305204500 +0200 
    5454@@ -101,6 +101,9 @@ 
    5555 #ifndef cpu_has_pindexed_dcache&nbs