예제 #1
0
static void ath9k_deinit_softc(struct ath_softc *sc)
{
	int i = 0;

	if (sc->sbands[IEEE80211_BAND_2GHZ].channels)
		kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels);

	if (sc->sbands[IEEE80211_BAND_5GHZ].channels)
		kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels);

        if ((sc->btcoex.no_stomp_timer) &&
	    sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
		ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer);

	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
		if (ATH_TXQ_SETUP(sc, i))
			ath_tx_cleanupq(sc, &sc->tx.txq[i]);

	ath9k_exit_debug(sc->sc_ah);
	ath9k_hw_deinit(sc->sc_ah);

	tasklet_kill(&sc->intr_tq);
	tasklet_kill(&sc->bcon_tasklet);

	kfree(sc->sc_ah);
	sc->sc_ah = NULL;
}
예제 #2
0
int ath9k_init_debug(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	struct ath_softc *sc = (struct ath_softc *) common->priv;

	if (!ath9k_debugfs_root)
		return -ENOENT;

	sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
						      ath9k_debugfs_root);
	if (!sc->debug.debugfs_phy)
		goto err;

#ifdef CONFIG_ATH_DEBUG
	sc->debug.debugfs_debug = debugfs_create_file("debug",
		S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug);
	if (!sc->debug.debugfs_debug)
		goto err;
#endif

	sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
				       sc->debug.debugfs_phy, sc, &fops_dma);
	if (!sc->debug.debugfs_dma)
		goto err;

	sc->debug.debugfs_interrupt = debugfs_create_file("interrupt",
						     S_IRUSR,
						     sc->debug.debugfs_phy,
						     sc, &fops_interrupt);
	if (!sc->debug.debugfs_interrupt)
		goto err;

	sc->debug.debugfs_rcstat = debugfs_create_file("rcstat",
						  S_IRUSR,
						  sc->debug.debugfs_phy,
						  sc, &fops_rcstat);
	if (!sc->debug.debugfs_rcstat)
		goto err;

	sc->debug.debugfs_wiphy = debugfs_create_file(
		"wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc,
		&fops_wiphy);
	if (!sc->debug.debugfs_wiphy)
		goto err;

	sc->debug.debugfs_xmit = debugfs_create_file("xmit",
						     S_IRUSR,
						     sc->debug.debugfs_phy,
						     sc, &fops_xmit);
	if (!sc->debug.debugfs_xmit)
		goto err;

	return 0;
err:
	ath9k_exit_debug(ah);
	return -ENOMEM;
}
예제 #3
0
int ath9k_init_debug(struct ath_softc *sc)
{
    sc->debug.debug_mask = ath9k_debug;

    if (!ath9k_debugfs_root)
        return -ENOENT;

    sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
                            ath9k_debugfs_root);
    if (!sc->debug.debugfs_phy)
        goto err;

    sc->debug.debugfs_debug = debugfs_create_file("debug",
                              S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug);
    if (!sc->debug.debugfs_debug)
        goto err;

    sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
                            sc->debug.debugfs_phy, sc, &fops_dma);
    if (!sc->debug.debugfs_dma)
        goto err;

    sc->debug.debugfs_interrupt = debugfs_create_file("interrupt",
                                  S_IRUSR,
                                  sc->debug.debugfs_phy,
                                  sc, &fops_interrupt);
    if (!sc->debug.debugfs_interrupt)
        goto err;

    sc->debug.debugfs_rcstat = debugfs_create_file("rcstat",
                               S_IRUSR,
                               sc->debug.debugfs_phy,
                               sc, &fops_rcstat);
    if (!sc->debug.debugfs_rcstat)
        goto err;

    sc->debug.debugfs_wiphy = debugfs_create_file(
                                  "wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc,
                                  &fops_wiphy);
    if (!sc->debug.debugfs_wiphy)
        goto err;

    sc->debug.debugfs_xmit = debugfs_create_file("xmit",
                             S_IRUSR,
                             sc->debug.debugfs_phy,
                             sc, &fops_xmit);
    if (!sc->debug.debugfs_xmit)
        goto err;

    return 0;
err:
    ath9k_exit_debug(sc);
    return -ENOMEM;
}
예제 #4
0
static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
			    const struct ath_bus_ops *bus_ops)
{
	struct ath_hw *ah = NULL;
	struct ath_common *common;
	int ret = 0, i;
	int csz = 0;

	ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
	if (!ah)
		return -ENOMEM;

	ah->hw_version.devid = devid;
	ah->hw_version.subsysid = subsysid;
	sc->sc_ah = ah;

	common = ath9k_hw_common(ah);
	common->ops = &ath9k_common_ops;
	common->bus_ops = bus_ops;
	common->ah = ah;
	common->hw = sc->hw;
	common->priv = sc;
	common->debug_mask = ath9k_debug;

	spin_lock_init(&sc->wiphy_lock);
	spin_lock_init(&sc->sc_resetlock);
	spin_lock_init(&sc->sc_serial_rw);
	spin_lock_init(&sc->sc_pm_lock);
	mutex_init(&sc->mutex);
	tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
	tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
		     (unsigned long)sc);

	/*
	 * Cache line size is used to size and align various
	 * structures used to communicate with the hardware.
	 */
	ath_read_cachesize(common, &csz);
	common->cachelsz = csz << 2; /* convert to bytes */

	ret = ath9k_hw_init(ah);
	if (ret) {
		ath_print(common, ATH_DBG_FATAL,
			  "Unable to initialize hardware; "
			  "initialization status: %d\n", ret);
		goto err_hw;
	}

	ret = ath9k_init_debug(ah);
	if (ret) {
		ath_print(common, ATH_DBG_FATAL,
			  "Unable to create debugfs files\n");
		goto err_debug;
	}

	ret = ath9k_init_queues(sc);
	if (ret)
		goto err_queues;

	ret =  ath9k_init_btcoex(sc);
	if (ret)
		goto err_btcoex;

	ath9k_init_crypto(sc);
	ath9k_init_channels_rates(sc);
	ath9k_init_misc(sc);

	return 0;

err_btcoex:
	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
		if (ATH_TXQ_SETUP(sc, i))
			ath_tx_cleanupq(sc, &sc->tx.txq[i]);
err_queues:
	ath9k_exit_debug(ah);
err_debug:
	ath9k_hw_deinit(ah);
err_hw:
	tasklet_kill(&sc->intr_tq);
	tasklet_kill(&sc->bcon_tasklet);

	kfree(ah);
	sc->sc_ah = NULL;

	return ret;
}
예제 #5
0
int ath9k_init_debug(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	struct ath_softc *sc = (struct ath_softc *) common->priv;

	if (!ath9k_debugfs_root)
		return -ENOENT;

	sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
						      ath9k_debugfs_root);
	if (!sc->debug.debugfs_phy)
		return -ENOMEM;

#ifdef CONFIG_ATH_DEBUG
	if (!debugfs_create_file("debug", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_debug))
		goto err;
#endif

	if (!debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy,
			sc, &fops_dma))
		goto err;

	if (!debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy,
			sc, &fops_interrupt))
		goto err;

	if (!debugfs_create_file("rcstat", S_IRUSR, sc->debug.debugfs_phy,
			sc, &fops_rcstat))
		goto err;

	if (!debugfs_create_file("wiphy", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_wiphy))
		goto err;

	if (!debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy,
			sc, &fops_xmit))
		goto err;

	if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy,
			sc, &fops_recv))
		goto err;

	if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_rx_chainmask))
		goto err;

	if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_tx_chainmask))
		goto err;

	if (!debugfs_create_file("regidx", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_regidx))
		goto err;

	if (!debugfs_create_file("regval", S_IRUSR | S_IWUSR,
			sc->debug.debugfs_phy, sc, &fops_regval))
		goto err;

	sc->debug.regidx = 0;
	return 0;
err:
	ath9k_exit_debug(ah);
	return -ENOMEM;
}