Exemplo n.º 1
0
static int
ath_ahb_probe(device_t dev)
{
	int vendor_id, device_id;
	const char* devname;

	/*
	 * Check if a device/vendor ID is provided in hints.
	 */
	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
	    "vendor_id", &vendor_id) != 0) {
		vendor_id = VENDOR_ATHEROS;
	}

	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
	    "device_id", &device_id) != 0) {
		device_id = AR9130_DEVID;
	}

	device_printf(dev, "Vendor=0x%04x, Device=0x%04x\n",
	    vendor_id & 0xffff,
	    device_id & 0xffff);

	/* Attempt to probe */
	devname = ath_hal_probe(vendor_id, device_id);

	if (devname != NULL) {
		device_set_desc(dev, devname);
		return BUS_PROBE_DEFAULT;
	}
	return ENXIO;
}
Exemplo n.º 2
0
static int
ath_pci_probe(device_t dev)
{
	const char* devname;

	devname = ath_hal_probe(pci_get_vendor(dev), pci_get_device(dev));
	if (devname != NULL) {
		device_set_desc(dev, devname);
		return BUS_PROBE_DEFAULT;
	}
	return ENXIO;
}
Exemplo n.º 3
0
int
ath_cardbus_match(device_t parent, struct cfdata *match, void *aux)
{
	struct cardbus_attach_args *ca = aux;
	const char *devname;

	devname = ath_hal_probe(PCI_VENDOR(ca->ca_id), PCI_PRODUCT(ca->ca_id));

	if (devname)
		return 1;

	return 0;
}
Exemplo n.º 4
0
static int
ath_ahb_probe(device_t dev)
{
	const char* devname;

	/* Atheros / ar9130 */
	devname = ath_hal_probe(VENDOR_ATHEROS, AR9130_DEVID);

	if (devname != NULL) {
		device_set_desc(dev, devname);
		return BUS_PROBE_DEFAULT;
	}
	return ENXIO;
}
Exemplo n.º 5
0
int
ath_pci_match(struct device *parent, void *match, void *aux)
{
	const char* devname;
	struct pci_attach_args *pa = aux;
	pci_vendor_id_t vendor;

	vendor = PCI_VENDOR(pa->pa_id);
	if (vendor == 0x128c)
		vendor = PCI_VENDOR_ATHEROS;
	devname = ath_hal_probe(vendor, PCI_PRODUCT(pa->pa_id));
	if (devname)
		return 1;

	return 0;
}
Exemplo n.º 6
0
static int
init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
{
	const char *athname;
	struct net_device *dev;
	struct ath_ahb_softc *sc;
	u16 *radio_data;

	if (((wlanNum != 0) && (wlanNum != 1)) ||
		(sclist[wlanNum] != NULL))
		goto bad;

	ahb_enable_wmac(devid, wlanNum);

	dev = alloc_netdev(sizeof(struct ath_ahb_softc), "wifi%d", ether_setup);
	if (dev == NULL) {
		printk(KERN_ERR "%s: no memory for device state\n", dev_info);
		goto bad2;
	}
	sc = netdev_priv(dev);
	sc->aps_sc.sc_dev = dev;

	/*
	 * Mark the device as detached to avoid processing
	 * interrupts until setup is complete.
	 */
	sc->aps_sc.sc_invalid = 1;
	SET_MODULE_OWNER(dev);
	sclist[wlanNum] = sc;

	if (dev_alloc_name(dev, dev->name) < 0) {
		printk(KERN_ERR "%s: cannot allocate name\n", dev_info);
		goto bad3;
	}

	switch (wlanNum) {
	case AR531X_WLAN0_NUM:
		if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
			((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
			dev->irq = AR5315_IRQ_WLAN0_INTRS;
			dev->mem_start = AR5315_WLAN0;
		} else {
			dev->irq = AR531X_IRQ_WLAN0_INTRS;
			dev->mem_start = AR531X_WLAN0;
		}
		break;
	case AR531X_WLAN1_NUM:
		dev->irq = AR531X_IRQ_WLAN1_INTRS;
		dev->mem_start = KSEG1ADDR(AR531X_WLAN1);
		break;
	default:
		goto bad3;
	}
	dev->mem_end = dev->mem_start + AR531X_WLANX_LEN;
	sc->aps_sc.sc_iobase = (void __iomem *)dev->mem_start;
	sc->aps_sc.sc_bdev = NULL;

	if (request_irq(dev->irq, ath_intr, IRQF_SHARED, dev->name, dev)) {
		printk(KERN_WARNING "%s: %s: request_irq failed\n", dev_info, dev->name);
		goto bad3;
	}

	if (ath_attach(devid, dev, config) != 0)
		goto bad4;
	athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
	printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",
		dev_info, dev->name, athname ? athname : "Atheros ???", dev->mem_start, dev->irq);
	num_activesc++;
	/* Ready to process interrupts */

	sc->aps_sc.sc_softled = 1; /* SoftLED over GPIO */
	sc->aps_sc.sc_ledpin = config->board->sysLedGpio;
	sc->aps_sc.sc_invalid = 0;
	ahb_hw_detect(sc, config->radio);

	return 0;

 bad4:
	free_irq(dev->irq, dev);
 bad3:
	free_netdev(dev);
	sclist[wlanNum] = NULL;
 bad2:
	ahb_disable_wmac(devid, wlanNum);
 bad:
	return -ENODEV;
}