tristate "Broadcom IEEE802.11n WLAN drivers"
        depends on WLAN
 
-choice
-       prompt "Broadcom IEEE802.11n driver style"
-       depends on BRCM80211
-       help
-       Select the appropriate driver style from the list below.
-
 config BRCMSMAC
        bool "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver"
        depends on PCI
          Broadcom IEEE802.11n FullMAC chipsets.  This driver uses the kernel's
          wireless extensions subsystem.  If you choose to build a module,
          it'll be called brcmfmac.ko.
-endchoice
+
+config BRCMDBG
+       bool "Broadcom driver debug functions"
+       default n
+       depends on BRCM80211
+       ---help---
+         Selecting this enables additional code for debug purposes.
 
 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-# one and only common flag
-subdir-ccflags-y := -DBCMDBG
+# common flags
+subdir-ccflags-y                       := -DBCMDMA32
+subdir-ccflags-$(CONFIG_BRCMDBG)       += -DBCMDBG -DBCMDBG_ASSERT
 
 obj-$(CONFIG_BRCMFMAC) += brcmfmac/
 obj-$(CONFIG_BRCMSMAC) += brcmsmac/
 
        -DBCMSDIO               \
        -DBDC                   \
        -DBRCM_FULLMAC          \
-       -DDHD_DEBUG             \
        -DDHD_FIRSTREAD=64      \
        -DDHD_SCHED             \
        -DDHD_SDALIGN=64        \
        -DMMC_SDIO_ABORT        \
        -DPKT_FILTER_SUPPORT    \
        -DSHOW_EVENTS           \
-       -DTOE                   \
-       -Idrivers/staging/brcm80211/brcmfmac            \
+       -DTOE
+
+ccflags-$(CONFIG_BRCMDBG)      += -DDHD_DEBUG
+
+ccflags-y += \
+       -Idrivers/staging/brcm80211/brcmfmac    \
        -Idrivers/staging/brcm80211/include             \
        -Idrivers/staging/brcm80211/util
 
 
 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-ccflags-y :=                                   \
+ccflags-y :=                           \
        -DWLC_HIGH                              \
        -DWLC_LOW                               \
        -DSTA                                   \
        -DWME                                   \
        -DWL11N                                 \
        -DDBAND                                 \
-       -DBCMDMA32                              \
        -DBCMNVRAMR                             \
        -Idrivers/staging/brcm80211/brcmsmac \
        -Idrivers/staging/brcm80211/brcmsmac/phy \
 
                eromptr = regs;
                break;
 
-#ifdef BCMSDIO
        case SPI_BUS:
        case SDIO_BUS:
-#endif                         /* BCMSDIO */
                eromptr = (u32 *)(unsigned long)erombase;
                break;
 
                pci_write_config_dword(sii->osh->pdev, PCI_BAR0_WIN2, wrap);
                break;
 
-#ifdef BCMSDIO
        case SPI_BUS:
        case SDIO_BUS:
-#endif                         /* BCMSDIO */
                sii->curmap = regs = (void *)(unsigned long)addr;
                sii->curwrap = (void *)(unsigned long)wrap;
                break;
 
        ASSERT(pq->len == 0);
 }
 #else /* !BRCM_FULLMAC */
+/* TODO: can we remove callback for softmac? */
 void
 pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
            ifpkt_cb_t fn, int arg)
 
                data = p->data;
                len = p->len;
 #ifdef BCM_DMAPAD
+               /* TODO: when is this used? */
                len += PKTDMAPAD(di->osh, p);
 #endif                         /* BCM_DMAPAD */
                next = p->next;
 
 
 #ifdef BCMDBG
 #define        PMU_MSG(args)   printf args
+
+/* debug-only definitions */
+/* #define BCMDBG_FORCEHT */
+/* #define CHIPC_UART_ALWAYS_ON */
 #else
 #define        PMU_MSG(args)
 #endif                         /* BCMDBG */
        m1div = (tmp & PMU1_PLL0_PC1_M1DIV_MASK) >> PMU1_PLL0_PC1_M1DIV_SHIFT;
 
 #ifdef BCMDBG
+       /* TODO: seems more like a workaround */
        /* Read p2div/p1div from pllcontrol[0] */
        W_REG(osh, &cc->pllcontrol_addr, PMU1_PLL0_PLLCTL0);
        tmp = R_REG(osh, &cc->pllcontrol_data);
        }
 
 #ifdef BCMDBG_FORCEHT
+       /* TODO: when is this flag used? what does it do? */
        OR_REG(osh, &cc->clk_ctl_st, CCS_FORCEHT);
 #endif
 
        return st;
 }
 
-void
-#if defined(BCMDBG)
-si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable)
-#else
-si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable)
-#endif
+void si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable)
 {
        chipcregs_t *cc;
        uint origidx;
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
 #ifdef CHIPC_UART_ALWAYS_ON
+       /* TODO: are these special for debugging purposes? */
        si_corereg(sih, SI_CC_IDX, offsetof(chipcregs_t, clk_ctl_st),
                   CCS_FORCEALP, CCS_FORCEALP);
 #endif                         /* CHIPC_UART_ALWAYS_ON */