/* This function will return: * 1) return : Host gpio interrupt number per customer platform * 2) irq_flags_ptr : Type of Host interrupt as Level or Edge * * NOTE : * Customer should check his platform definitions * and his Host Interrupt spec * to figure out the proper setting for his platform. * Broadcom provides just reference settings as example. * */ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) { int host_oob_irq = CUSTOM_OOB_GPIO_NUM; #if defined(CUSTOMER_HW2) && !defined(PLATFORM_MPS) host_oob_irq = wifi_get_irq_number(irq_flags_ptr); #elif defined(CUSTOMER_OOB) host_oob_irq = bcm_wlan_get_oob_irq(); #else #if defined(CUSTOM_OOB_GPIO_NUM) if (dhd_oob_gpio_num < 0) { dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM; } #endif /* CUSTOMER_OOB_GPIO_NUM */ if (dhd_oob_gpio_num < 0) { WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n", __FUNCTION__)); return (dhd_oob_gpio_num); } WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", __FUNCTION__, dhd_oob_gpio_num)); #if defined CUSTOMER_HW host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); #elif defined CUSTOMER_HW3 || defined(PLATFORM_MPS) gpio_request(dhd_oob_gpio_num, "oob irq"); host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); gpio_direction_input(dhd_oob_gpio_num); #endif /* CUSTOMER_HW */ #endif return (host_oob_irq); }
static int wifi_ctrlfunc_register_drv(void) { wifi_adapter_info_t *adapter; #ifndef CUSTOMER_HW int err = 0; struct device *dev1, *dev2; dev1 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME, wifi_platdev_match); dev2 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME2, wifi_platdev_match); #endif #if !defined(CONFIG_DTS) && !defined(CUSTOMER_HW) if (!dts_enabled) { if (dev1 == NULL && dev2 == NULL) { DHD_ERROR(("no wifi platform data, skip\n")); return -ENXIO; } } #endif /* !defined(CONFIG_DTS) */ /* multi-chip support not enabled, build one adapter information for * DHD (either SDIO, USB or PCIe) */ adapter = kzalloc(sizeof(wifi_adapter_info_t), GFP_KERNEL); adapter->name = "DHD generic adapter"; adapter->bus_type = -1; adapter->bus_num = -1; adapter->slot_num = -1; adapter->irq_num = -1; is_power_on = FALSE; wifi_plat_dev_probe_ret = 0; dhd_wifi_platdata = kzalloc(sizeof(bcmdhd_wifi_platdata_t), GFP_KERNEL); dhd_wifi_platdata->num_adapters = 1; dhd_wifi_platdata->adapters = adapter; #ifndef CUSTOMER_HW if (dev1) { err = platform_driver_register(&wifi_platform_dev_driver); if (err) { DHD_ERROR(("%s: failed to register wifi ctrl func driver\n", __FUNCTION__)); return err; } } if (dev2) { err = platform_driver_register(&wifi_platform_dev_driver_legacy); if (err) { DHD_ERROR(("%s: failed to register wifi ctrl func legacy driver\n", __FUNCTION__)); return err; } } #endif #if !defined(CONFIG_DTS) if (dts_enabled) { #ifdef CUSTOMER_HW adapter->wifi_plat_data = (void *)&dhd_wlan_control; bcm_wlan_set_plat_data(); #ifdef CUSTOMER_OOB adapter->irq_num = bcm_wlan_get_oob_irq(); adapter->intr_flags = bcm_wlan_get_oob_irq_flags(); #endif #else struct resource *resource; resource = &dhd_wlan_resources; adapter->irq_num = resource->start; adapter->intr_flags = resource->flags & IRQF_TRIGGER_MASK; #endif wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); } #endif /* !defined(CONFIG_DTS) */ #if defined(CONFIG_DTS) && !defined(CUSTOMER_HW) wifi_plat_dev_probe_ret = platform_driver_register(&wifi_platform_dev_driver); #endif /* CONFIG_DTS */ /* return probe function's return value if registeration succeeded */ return wifi_plat_dev_probe_ret; }