[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Wed Apr 25 18:04:46 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/3acbd1e8c8ac
changeset: 473:3acbd1e8c8ac
user: Aleksandr Rybalko <ray at ddteam.net>
date: Wed Apr 25 21:05:25 2012 +0300
description:
Return if_ath_pci.c to HEAD
diffstat:
head/sys/dev/ath/if_ath_pci.c | 141 ------------------------------------------
1 files changed, 0 insertions(+), 141 deletions(-)
diffs (178 lines):
diff -r d64690706fbe -r 3acbd1e8c8ac head/sys/dev/ath/if_ath_pci.c
--- a/head/sys/dev/ath/if_ath_pci.c Wed Apr 25 17:04:46 2012 +0300
+++ b/head/sys/dev/ath/if_ath_pci.c Wed Apr 25 21:05:25 2012 +0300
@@ -57,9 +57,7 @@
#include <net80211/ieee80211_var.h>
#include <dev/ath/if_athvar.h>
-#include <dev/ath/ath_hal/ah_devid.h>
-#include <sys/pciio.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@@ -83,9 +81,6 @@
#define BS_BAR 0x10
#define PCIR_RETRY_TIMEOUT 0x41
#define PCIR_CFG_PMCSR 0x48
-/* number of 16 bit words */
-#define ATH_EEPROM_DATA_SIZE 2048
-#define AR5416_EEPROM_MAGIC 0xa55a
#define DEFAULT_CACHESIZE 32
@@ -129,139 +124,11 @@
pci_write_config(dev, PCIR_RETRY_TIMEOUT, 0, 1);
}
-/*
- * Fix PCI configuration space and preload EEPROM data.
- */
-static int
-ar724x_load_eeprom_data(device_t dev)
-{
- uint32_t bar0, hint, reg, val;
- uint16_t *data = NULL;
- struct resource *memres;
- int rid;
- bus_space_tag_t bst;
- bus_space_handle_t bsh;
- struct pci_devinfo *dinfo;
- struct ath_pci_softc *psc = device_get_softc(dev);
- struct ath_softc *sc = &psc->sc_sc;
-
- if (bootverbose)
- device_printf(dev, "Fetching eeprom address hint\n");
-
- /* Search for a hint of eeprom data offset */
- if (resource_int_value(device_get_name(dev),
- device_get_unit(dev), "eepromdata", &hint) != 0)
- return (ENXIO);
-
- device_printf(dev, "Loading the eeprom fixup data from %#x\n", hint);
- data = (uint16_t *)MIPS_PHYS_TO_KSEG1(hint);
-
- if (*data != AR5416_EEPROM_MAGIC) {
- device_printf(dev, "Invalid calibration data from %#x\n",
- hint);
- return (EIO);
- }
-
- rid = 0x10;
- memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
- if (memres == NULL) {
- device_printf(dev, "cannot map register space\n");
- return (EIO);
- }
-
- bst = rman_get_bustag(memres);
- bsh = rman_get_bushandle(memres);
-
- /* Save bar(0) address - just to flush bar(0) (SoC WAR) ? */
- bar0 = pci_read_config(dev, PCIR_BAR(0), 4);
- /*
- * XXX Access to PCI internal regs
- * AR7240 - 0xffff
- * AR7241, AR7242 - 0x1000ffff
- */
- pci_write_config(dev, PCIR_BAR(0), 0x1000ffff, 4);
-
- val = pci_read_config(dev, PCIR_COMMAND, 4);
- val |= (PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
- pci_write_config(dev, PCIR_COMMAND, val, 4);
-
- if (bootverbose)
- printf("Load PCI config space fix up\n");
- /* set pointer to first reg address */
- data += 3;
- while (*data != 0xffff) {
- reg = *data++;
- val = *data++;
- val |= (*data++) << 16;
-
- /* Write eeprom fixup data to device memory */
- if (bootverbose)
- printf("\t%08x: %08x\n", reg, val);
- bus_space_write_4(bst, bsh, reg, val);
- DELAY(100);
- }
- DELAY(1000);
-
- val = pci_read_config(dev, PCIR_COMMAND, 4);
- val &= ~(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
- pci_write_config(dev, PCIR_COMMAND, val, 4);
-
- /* Write the saved bar(0) address */
- pci_write_config(dev, PCIR_BAR(0), bar0, 4);
-
- DELAY(10000);
-
- bus_release_resource(dev, SYS_RES_MEMORY, rid, memres);
-
- /* Update IDs */
- pci_save_state(dev);
- pci_restore_state(dev);
-
- dinfo = device_get_ivars(dev);
-
- dinfo->conf.pc_subvendor = dinfo->cfg.subvendor;
- dinfo->conf.pc_subdevice = dinfo->cfg.subdevice;
- dinfo->conf.pc_vendor = dinfo->cfg.vendor;
- dinfo->conf.pc_device = dinfo->cfg.device;
-
- dinfo->conf.pc_class = dinfo->cfg.baseclass;
- dinfo->conf.pc_subclass = dinfo->cfg.subclass;
- dinfo->conf.pc_progif = dinfo->cfg.progif;
- dinfo->conf.pc_revid = dinfo->cfg.revid;
-
- sc->sc_eepromdata = malloc(ATH_EEPROM_DATA_SIZE * 2, M_TEMP,
- M_NOWAIT | M_ZERO);
- if (sc->sc_eepromdata == NULL) {
- device_printf(dev,
- "cannot allocate memory for eeprom data\n");
- return (ENOMEM);
- }
-
- /* Copy the EEPROM data out */
- /* Restore pointer */
- data = (uint16_t *)MIPS_PHYS_TO_KSEG1(hint);
- memcpy(sc->sc_eepromdata, data, ATH_EEPROM_DATA_SIZE * 2);
-
- return (0);
-}
-
static int
ath_pci_probe(device_t dev)
{
const char* devname;
- if (pci_get_vendor(dev) != ATHEROS_VENDOR_ID)
- return (ENXIO);
-
- switch (pci_get_device(dev)) {
- case AR9287_DEVID_PCIE_WOEE:
- /* EEPROMless Kiwi */
- device_set_desc(dev, "Atheros 9227/9287");
- return BUS_PROBE_DEFAULT;
- }
-
- /* Now probe normal device */
devname = ath_hal_probe(pci_get_vendor(dev), pci_get_device(dev));
if (devname != NULL) {
device_set_desc(dev, devname);
@@ -284,14 +151,6 @@
sc->sc_dev = dev;
- switch (pci_get_device(dev)) {
- case AR9287_DEVID_PCIE_WOEE:
- /* EEPROMless Kiwi */
- error = ar724x_load_eeprom_data(dev);
- if (error)
- return (error);
- }
-
/*
* Enable bus mastering.
*/
More information about the Zrouter-src-freebsd
mailing list