#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9
-# Wed Dec 8 09:41:39 2010
+# Thu Dec 9 14:06:05 2010
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
# CONFIG_ARCH_BCMRING is not set
# CONFIG_ARCH_RK2818 is not set
CONFIG_ARCH_RK29=y
+CONFIG_WIFI_CONTROL_FUNC=y
CONFIG_MACH_RK29SDK=y
#
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+CONFIG_CFG80211_DEFAULT_PS_VALUE=0
+# CONFIG_WIRELESS_OLD_REGULATORY is not set
+CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
# CONFIG_WIMAX is not set
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set
# CONFIG_NET_ETHERNET is not set
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
-# CONFIG_WLAN is not set
+CONFIG_WLAN=y
+# CONFIG_WLAN_PRE80211 is not set
+CONFIG_WLAN_80211=y
+# CONFIG_LIBERTAS is not set
+# CONFIG_HOSTAP is not set
+CONFIG_BCM4329=m
+CONFIG_BCM4329_FW_PATH="/etc/firmware/fw_bcm4329.bin"
+CONFIG_BCM4329_NVRAM_PATH="/etc/firmware/nvram_bcm4329_B23.txt"
#
# Enable WiMAX (Networking options) to see the WiMAX drivers
help
Support for the ROCKCHIP Board For Rk29 Sdk.
+config WIFI_CONTROL_FUNC
+ bool "Enable WiFi control function abstraction"
+ help
+ Enables Power/Reset/Carddetect function abstraction
+
menu "RK29 VPU (Video Processing Unit) support"
config RK29_VPU
rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);\r
rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);\r
rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);\r
- rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);\r
+ //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);\r
return 0;\r
}\r
-\r
+
+static int rk29sdk_wifi_status(struct device *dev);
+static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);\r
+
+#define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
+
struct rk29_sdmmc_platform_data default_sdmmc1_data = {\r
.host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|\r
MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|\r
#else\r
.use_dma = 0,\r
#endif\r
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+ .status = rk29sdk_wifi_status,
+ .register_status_notify = rk29sdk_wifi_status_register,
+#endif
+ .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
};\r
#endif\r
-\r
+
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+#define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
+#define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
+#define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC4
+
+static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
+static void (*wifi_status_cb)(int card_present, void *dev_id);
+static void *wifi_status_cb_devid;
+int rk29sdk_wifi_power_state = 0;
+int rk29sdk_bt_power_state = 0;
+
+static int rk29sdk_wifi_status(struct device *dev)
+{
+ return rk29sdk_wifi_cd;
+}
+
+static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
+{
+ if(wifi_status_cb)
+ return -EAGAIN;
+ wifi_status_cb = callback;
+ wifi_status_cb_devid = dev_id;
+ return 0;
+}
+
+static int rk29sdk_wifi_bt_gpio_control_init(void)
+{
+ if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
+ pr_info("%s: request wifi_bt power gpio failed\n", __func__);
+ return -1;
+ }
+
+ if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
+ pr_info("%s: request wifi reset gpio failed\n", __func__);
+ gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
+ return -1;
+ }
+
+ if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
+ pr_info("%s: request bt reset gpio failed\n", __func__);
+ gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
+ return -1;
+ }
+
+ gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
+ gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
+ gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
+
+ pr_info("%s: init finished\n",__func__);
+
+ return 0;
+}
+
+static int rk29sdk_wifi_power(int on)
+{
+ pr_info("%s: %d\n", __func__, on);
+ if (on){
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ mdelay(100);
+ pr_info("wifi turn on power\n");
+ }else{
+ if (!rk29sdk_bt_power_state){
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ mdelay(100);
+ pr_info("wifi shut off power\n");
+ }else
+ {
+ pr_info("wifi shouldn't shut off power, bt is using it!\n");
+ }
+
+ }
+
+ rk29sdk_wifi_power_state = on;
+ return 0;
+}
+
+static int rk29sdk_wifi_reset_state;
+static int rk29sdk_wifi_reset(int on)
+{
+ pr_info("%s: %d\n", __func__, on);
+ gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
+ mdelay(100);
+ rk29sdk_wifi_reset_state = on;
+ return 0;
+}
+
+static int rk29sdk_wifi_set_carddetect(int val)
+{
+ pr_info("%s:%d\n", __func__, val);
+ rk29sdk_wifi_cd = val;
+ if (wifi_status_cb){
+ wifi_status_cb(val, wifi_status_cb_devid);
+ }else {
+ pr_warning("%s, nobody to notify\n", __func__);
+ }
+ return 0;
+}
+
+static struct wifi_platform_data rk29sdk_wifi_control = {
+ .set_power = rk29sdk_wifi_power,
+ .set_reset = rk29sdk_wifi_reset,
+ .set_carddetect = rk29sdk_wifi_set_carddetect,
+};
+static struct platform_device rk29sdk_wifi_device = {
+ .name = "bcm4329_wlan",
+ .id = 1,
+ .dev = {
+ .platform_data = &rk29sdk_wifi_control,
+ },
+};
+#endif
+
#ifdef CONFIG_VIVANTE\r
static struct resource resources_gpu[] = {\r
[0] = {\r
&rk29xx_device_nand,\r
#endif\r
\r
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+ &rk29sdk_wifi_device,
+#endif
#ifdef CONFIG_MTD_NAND_RK29\r
&rk29_device_nand,\r
#endif\r
\r
gpio_set_value(POWER_ON_PIN, 1);\r
gpio_direction_output(POWER_ON_PIN, 1);\r
+
+ rk29sdk_wifi_bt_gpio_control_init();
\r
platform_add_devices(devices, ARRAY_SIZE(devices));\r
#ifdef CONFIG_I2C0_RK29\r
struct notifier_block freq_transition;
};
+struct wifi_platform_data {
+ int (*set_power)(int val);
+ int (*set_reset)(int val);
+ int (*set_carddetect)(int val);
+ void *(*mem_prealloc)(int section, unsigned long size);
+};
+
struct rk29_sdmmc_platform_data {
unsigned int host_caps;
unsigned int host_ocr_avail;
int (*io_deinit)(void);
int (*status)(struct device *);
int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
+ int detect_irq;
};
struct rk29_i2c_platform_data {
int bus_num;
tasklet_schedule(&host->tasklet);
}
+static int rk29_sdmmc1_card_get_cd(struct mmc_host *mmc)
+{
+ struct rk29_sdmmc *host = mmc_priv(mmc);
+ struct rk29_sdmmc_platform_data *pdata = host->pdev->dev.platform_data;
+ return gpio_get_value(pdata->detect_irq);
+}
+
+static int rk29_sdmmc1_card_change_cd_trigger_type(struct mmc_host *mmc, unsigned int type)
+{
+ struct rk29_sdmmc *host = mmc_priv(mmc);
+ struct rk29_sdmmc_platform_data *pdata = host->pdev->dev.platform_data;
+ return set_irq_type(gpio_to_irq(pdata->detect_irq), type);
+}
+
+
+static irqreturn_t rk29_sdmmc1_card_detect_interrupt(int irq, void *dev_id)
+{
+ struct rk29_sdmmc *host = dev_id;
+ bool present, present_old;
+
+ present = rk29_sdmmc1_card_get_cd(host->mmc);
+ present_old = test_bit(RK29_SDMMC_CARD_PRESENT, &host->flags);
+ if (present != present_old) {
+ if (present != 0) {
+ set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags);
+ } else {
+ clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags);
+ }
+ mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(200));
+ }
+ rk29_sdmmc1_card_change_cd_trigger_type(host->mmc, (present ? IRQF_TRIGGER_FALLING: IRQF_TRIGGER_RISING));
+
+ return IRQ_HANDLED;
+
+}
+
static irqreturn_t rk29_sdmmc_interrupt(int irq, void *dev_id)
{
struct rk29_sdmmc *host = dev_id;
rk29_sdmmc_write(host->regs, SDMMC_RINTSTS,SDMMC_INT_CMD_DONE); // clear interrupt
rk29_sdmmc_cmd_interrupt(host, status);
}
+ if(pending & SDMMC_INT_SDIO) {
+ rk29_sdmmc_write(host->regs, SDMMC_RINTSTS,SDMMC_INT_SDIO);
+ mmc_signal_sdio_irq(host->mmc);
+ }
} while (pass_count++ < 5);
spin_unlock(&host->lock);
{
struct mmc_request *mrq;
struct rk29_sdmmc *host = (struct rk29_sdmmc *)data;;
-
+
smp_rmb();
if (test_bit(RK29_SDMMC_SHUTDOWN, &host->flags))
return;
clk_enable(host->clk);
clk_enable(clk_get(&pdev->dev, "sdmmc_ahb"));
host->bus_hz = clk_get_rate(host->clk); ///40000000; ////cgu_get_clk_freq(CGU_SB_SD_MMC_CCLK_IN_ID);
- printk("Enter:%s %d host->bus_hz =%d\n",__FUNCTION__,__LINE__,host->bus_hz);
/* reset all blocks */
rk29_sdmmc_write(host->regs, SDMMC_CTRL,(SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET));
ret = request_irq(irq, rk29_sdmmc_interrupt, 0, dev_name(&pdev->dev), host);
if (ret)
goto err_dmaunmap;
+
+ /* register sdmmc1 card detect interrupt route */
+ if ((pdev->id == 1) && (pdata->detect_irq != 0)) {
+ irq = gpio_to_irq(pdata->detect_irq);
+ if (irq < 0) {
+ printk("%s: request gpio irq failed\n", __FUNCTION__);
+ goto err_dmaunmap;
+ }
+
+ ret = request_irq(irq, rk29_sdmmc1_card_detect_interrupt, IRQF_TRIGGER_RISING, dev_name(&pdev->dev), host);
+ if (ret) {
+ printk("%s: sdmmc1 request detect interrupt failed\n", __FUNCTION__);
+ goto err_dmaunmap;
+ }
+
+ }
platform_set_drvdata(pdev, host);
mmc->ops = &rk29_sdmmc_ops[pdev->id];
mmc->f_min = host->bus_hz/510;
set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags);
else
clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags);
+
mmc_add_host(mmc);
#if defined (CONFIG_DEBUG_FS)
obj-$(CONFIG_IWM) += iwmc3200wifi/
obj-$(CONFIG_BCM4329) += bcm4329/
-obj-m += wlan/
+#obj-m += wlan/
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
#endif
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
int wifi_set_power(int on, unsigned long msec);
int wifi_set_reset(int on, unsigned long msec);
+#endif
#if defined(OOB_INTR_ONLY)
#ifdef CUSTOMER_HW2
wifi_set_power(0, 0);
#endif
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
wifi_set_power(0, 0);
wifi_set_reset(0, 0);
+#endif
WL_ERROR(("=========== WLAN placed in RESET ========\n"));
break;
#ifdef CUSTOMER_HW2
wifi_set_power(1, 0);
#endif
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
wifi_set_power(1, 0);
wifi_set_reset(1, 0);
+#endif
WL_ERROR(("=========== WLAN going back to live ========\n"));
break;
}
}
}
-static void
+static void __exit
dhd_module_cleanup(void)
{
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
}
-static int
+static int __init
dhd_module_init(void)
{
int error;
return -EINVAL;
}
-//module_init(dhd_module_init);
-//module_exit(dhd_module_cleanup);
-
-int if_sdio_init_module2(void)
-{
- return dhd_module_init();
-}
-
-void if_sdio_exit_module(void)
-{
- dhd_module_cleanup();
-}
-
-EXPORT_SYMBOL(if_sdio_init_module2);
-EXPORT_SYMBOL(if_sdio_exit_module);
+module_init(dhd_module_init);
+module_exit(dhd_module_cleanup);
/*
* OS specific functions required to implement DHD driver in OS independent way