aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaeyoung Kim <ktyrun@insignal.co.kr>2013-01-17 18:37:06 +0900
committerTaeyoung Kim <ktyrun@insignal.co.kr>2013-01-17 18:47:12 +0900
commitc5c47b0019cbd6191e2f89d61d9a15a5426620be (patch)
tree58e8748b290e179b3697acffab06ef348a355a63
parent6ba2242fce50e6ba968dd40b9fd537468667c7bb (diff)
Wifi: Add support A51H wifi.arndale-jb_mr1-es2arndale-jb_mr1-20130119
Signed-off-by: Taeyoung Kim <ktyrun@insignal.co.kr>
-rw-r--r--arch/arm/configs/arndale_android_defconfig7
-rw-r--r--arch/arm/mach-exynos/Makefile1
-rw-r--r--arch/arm/mach-exynos/board-arndale-wifi.c180
-rw-r--r--arch/arm/mach-exynos/board-smdk5250.h1
-rw-r--r--arch/arm/mach-exynos/mach-arndale.c1
-rw-r--r--drivers/net/wireless/ath/ath6kl/Makefile1
-rw-r--r--drivers/net/wireless/ath/ath6kl/platform_data.c31
-rw-r--r--drivers/net/wireless/ath/ath6kl/sdio.c12
-rw-r--r--include/linux/ath6kl.h30
9 files changed, 263 insertions, 1 deletions
diff --git a/arch/arm/configs/arndale_android_defconfig b/arch/arm/configs/arndale_android_defconfig
index 04bd868bac3..ba26c49faaf 100644
--- a/arch/arm/configs/arndale_android_defconfig
+++ b/arch/arm/configs/arndale_android_defconfig
@@ -168,6 +168,9 @@ CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
CONFIG_NET_ACT_GACT=y
CONFIG_NET_ACT_MIRRED=y
+CONFIG_CFG80211=y
+CONFIG_NL80211_TESTMODE=y
+CONFIG_WIRELESS_EXT_SYSFS=y
CONFIG_SYNC=y
CONFIG_SW_SYNC=y
CONFIG_BLK_DEV_LOOP=y
@@ -191,6 +194,9 @@ CONFIG_PPP_MPPE=y
CONFIG_PPPOLAC=y
CONFIG_PPPOPNS=y
CONFIG_USB_USBNET=y
+CONFIG_ATH_COMMON=y
+CONFIG_ATH6KL=y
+CONFIG_ATH6KL_SDIO=m
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_KEYRESET=y
CONFIG_KEYBOARD_GPIO=y
@@ -344,7 +350,6 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_SUSPEND=y
CONFIG_USB_MON=y
CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_EXYNOS=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_S5P=y
CONFIG_USB_OHCI_HCD=y
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 07a78fac20d..d7017e87c60 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -101,6 +101,7 @@ obj-$(CONFIG_MACH_ARNDALE) += board-arndale-display.o
obj-$(CONFIG_MACH_ARNDALE) += board-arndale-media.o
obj-$(CONFIG_MACH_ARNDALE) += board-arndale-tvout.o
obj-$(CONFIG_MACH_ARNDALE) += board-arndale-camera.o
+obj-$(CONFIG_MACH_ARNDALE) += board-arndale-wifi.o
# device support
diff --git a/arch/arm/mach-exynos/board-arndale-wifi.c b/arch/arm/mach-exynos/board-arndale-wifi.c
new file mode 100644
index 00000000000..6191186a88c
--- /dev/null
+++ b/arch/arm/mach-exynos/board-arndale-wifi.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <asm/mach-types.h>
+#include <asm/gpio.h>
+#include <asm/io.h>
+#include <asm/setup.h>
+#include <linux/if.h>
+#include <linux/skbuff.h>
+#include <linux/wlan_plat.h>
+#include <linux/mmc/host.h>
+#include <plat/gpio-cfg.h>
+#include <plat/devs.h>
+#include <mach/dwmci.h>
+#include <mach/map.h>
+
+#include <linux/random.h>
+#include <linux/jiffies.h>
+
+
+
+#include "board-smdk5250.h"
+
+#ifdef CONFIG_ATH6KL
+#include <linux/ath6kl.h>
+#define ARNDALE_WLAN_WOW EXYNOS5_GPX1(0)
+#define ARNDALE_WLAN_RESET EXYNOS5_GPX3(0)
+
+static void (*wifi_status_cb)(struct platform_device *, int state);
+
+static int arndale_wifi_ext_cd_init(void (*notify_func)
+ (struct platform_device *, int state))
+{
+ /* Assign sdhci_s3c_notify_change to wifi_status_cb */
+ if (!notify_func)
+ return -EAGAIN;
+ else
+ wifi_status_cb = notify_func;
+
+ return 0;
+}
+
+static int arndale_wifi_ext_cd_cleanup(void (*notify_func)
+ (struct platform_device *, int))
+{
+ wifi_status_cb = NULL;
+ return 0;
+}
+
+
+static void arndale_wifi_set_power(int val)
+{
+ int err;
+
+ err = gpio_request_one(ARNDALE_WLAN_RESET, GPIOF_OUT_INIT_LOW, "GPX3_0");
+
+ if (err) {
+ pr_warning("ARNDALE: Not obtain WIFI gpios\n");
+ return;
+ }
+
+ if (val) {
+ s3c_gpio_cfgpin(ARNDALE_WLAN_RESET, S3C_GPIO_OUTPUT);
+ s3c_gpio_setpull(ARNDALE_WLAN_RESET,
+ S3C_GPIO_PULL_NONE);
+ /* VDD33,I/O Supply must be done */
+ gpio_set_value(ARNDALE_WLAN_WOW, 0);
+ gpio_set_value(ARNDALE_WLAN_RESET, 0);
+ udelay(300); /*Tb */
+ printk("ARNDALE: ARNDALE_WLAN_RESET on setting!!!!\n");
+ gpio_direction_output(ARNDALE_WLAN_RESET, 1);
+ gpio_free(ARNDALE_WLAN_RESET);
+ } else {
+ printk("ARNDALE: ARNDALE_WLAN_RESET off setting!!!!\n");
+ gpio_direction_output(ARNDALE_WLAN_RESET, 0);
+ gpio_free(ARNDALE_WLAN_RESET);
+ }
+
+ mdelay(100);
+
+ return;
+}
+
+static int arndale_wifi_set_detect(int val)
+{
+ if (val) {
+ arndale_wifi_set_power(val);
+ wifi_status_cb(&exynos5_device_dwmci1, val);
+ } else {
+ arndale_wifi_set_power(val);
+ wifi_status_cb(&exynos5_device_dwmci1, val);
+ }
+
+ return 0;
+}
+
+struct ath6kl_platform_data arndale_wifi_data __initdata = {
+ .setup_power = arndale_wifi_set_detect,
+};
+#endif
+
+static void exynos5_setup_wlan_cfg_gpio(int width)
+{
+ unsigned int gpio;
+
+ /* Set all the necessary GPC2[0:1] pins to special-function 2 */
+ for (gpio = EXYNOS5_GPC2(0); gpio < EXYNOS5_GPC2(2); gpio++) {
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
+ }
+
+ for (gpio = EXYNOS5_GPC2(3); gpio <= EXYNOS5_GPC2(6); gpio++) {
+ /* Data pin GPC2[3:6] to special-function 2 */
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
+ }
+
+ gpio = EXYNOS5_GPC2(2);
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
+}
+
+
+static struct dw_mci_board exynos_wlan_pdata __initdata = {
+ .num_slots = 1,
+ .cd_type = DW_MCI_CD_EXTERNAL,
+ .quirks = DW_MCI_QUIRK_HIGHSPEED,
+ .bus_hz = 200 * 1000 * 1000,
+ .caps = MMC_CAP_CMD23,
+ .fifo_depth = 0x80,
+ .detect_delay_ms = 200,
+ .hclk_name = "dwmci",
+ .cclk_name = "sclk_dwmci",
+ .cfg_gpio = exynos5_setup_wlan_cfg_gpio,
+#ifdef CONFIG_ATH6KL
+ .ext_cd_init = arndale_wifi_ext_cd_init,
+ .ext_cd_cleanup = arndale_wifi_ext_cd_cleanup,
+#endif
+ .sdr_timing = 0x03020001,
+ .ddr_timing = 0x03030002,
+ .clk_drv = 4,
+};
+
+static struct platform_device *arndale_wifi_devs[] __initdata = {
+ &exynos5_device_dwmci1,
+};
+
+void __init exynos5_arndale_wifi_init(void)
+{
+#ifdef CONFIG_ATH6KL
+ ath6kl_set_platform_data(&arndale_wifi_data);
+#endif
+ exynos_dwmci_set_platdata(&exynos_wlan_pdata, 1);
+ dev_set_name(&exynos5_device_dwmci1.dev, "exynos4-sdhci.1");
+ clk_add_alias("dwmci", "dw_mmc.1", "hsmmc", &exynos5_device_dwmci1.dev);
+ clk_add_alias("sclk_dwmci", "dw_mmc.1", "sclk_mmc",
+ &exynos5_device_dwmci1.dev);
+ platform_add_devices(arndale_wifi_devs, ARRAY_SIZE(arndale_wifi_devs));
+
+}
+
diff --git a/arch/arm/mach-exynos/board-smdk5250.h b/arch/arm/mach-exynos/board-smdk5250.h
index 977e57ada2f..198e485373f 100644
--- a/arch/arm/mach-exynos/board-smdk5250.h
+++ b/arch/arm/mach-exynos/board-smdk5250.h
@@ -49,5 +49,6 @@ void exynos5_smdk5250_display_init(void);
void exynos5_smdk5250_media_init(void);
void exynos5_smdk5250_tvout_init(void);
void exynos5_smdk5250_camera_init(void);
+void exynos5_arndale_wifi_init(void);
#endif
diff --git a/arch/arm/mach-exynos/mach-arndale.c b/arch/arm/mach-exynos/mach-arndale.c
index c3c3273764a..f23ef7fb7a6 100644
--- a/arch/arm/mach-exynos/mach-arndale.c
+++ b/arch/arm/mach-exynos/mach-arndale.c
@@ -489,6 +489,7 @@ static void __init smdk5250_machine_init(void)
exynos5_smdk5250_camera_init();
exynos5_smdk5250_sysfs_soc_init();
+ exynos5_arndale_wifi_init();
}
MACHINE_START(ARNDALE, "ARNDALE")
diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile
index 85746c3eb02..5ce83c0fbea 100644
--- a/drivers/net/wireless/ath/ath6kl/Makefile
+++ b/drivers/net/wireless/ath/ath6kl/Makefile
@@ -33,6 +33,7 @@ ath6kl_core-y += main.o
ath6kl_core-y += txrx.o
ath6kl_core-y += wmi.o
ath6kl_core-y += core.o
+ath6kl_core-y += platform_data.o
ath6kl_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
obj-$(CONFIG_ATH6KL_SDIO) += ath6kl_sdio.o
diff --git a/drivers/net/wireless/ath/ath6kl/platform_data.c b/drivers/net/wireless/ath/ath6kl/platform_data.c
new file mode 100644
index 00000000000..d43c5fc0cf1
--- /dev/null
+++ b/drivers/net/wireless/ath/ath6kl/platform_data.c
@@ -0,0 +1,31 @@
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/ath6kl.h>
+
+static const struct ath6kl_platform_data *platform_data;
+
+int __init ath6kl_set_platform_data(const struct ath6kl_platform_data *data)
+{
+
+ printk("ath6kl_set_platform_data ~~~~~~~~~~~~~~~~\n");
+
+ if (platform_data)
+ return -EBUSY;
+ if (!data)
+ return -EINVAL;
+
+ platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+ if (!platform_data)
+ return -ENOMEM;
+ return 0;
+}
+
+const struct ath6kl_platform_data *ath6kl_get_platform_data(void)
+{
+ printk("ath6kl_get_platform_data ~~~~~~~~~~~~~~~~\n");
+
+ if (!platform_data)
+ return ERR_PTR(-ENODEV);
+ return platform_data;
+}
+EXPORT_SYMBOL(ath6kl_get_platform_data);
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 53528648b42..8346362c018 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -23,12 +23,14 @@
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sd.h>
+#include <linux/ath6kl.h>
#include "hif.h"
#include "hif-ops.h"
#include "target.h"
#include "debug.h"
#include "cfg80211.h"
+
struct ath6kl_sdio {
struct sdio_func *func;
@@ -1421,7 +1423,11 @@ static struct sdio_driver ath6kl_sdio_driver = {
static int __init ath6kl_sdio_init(void)
{
int ret;
+ const struct ath6kl_platform_data *wlan_data;
+ wlan_data = ath6kl_get_platform_data();
+ if (!IS_ERR(wlan_data))
+ wlan_data->setup_power(1);
ret = sdio_register_driver(&ath6kl_sdio_driver);
if (ret)
ath6kl_err("sdio driver registration failed: %d\n", ret);
@@ -1431,7 +1437,13 @@ static int __init ath6kl_sdio_init(void)
static void __exit ath6kl_sdio_exit(void)
{
+ const struct ath6kl_platform_data *wlan_data;
+
sdio_unregister_driver(&ath6kl_sdio_driver);
+
+ wlan_data = ath6kl_get_platform_data();
+ if (!IS_ERR(wlan_data))
+ wlan_data->setup_power(0);
}
module_init(ath6kl_sdio_init);
diff --git a/include/linux/ath6kl.h b/include/linux/ath6kl.h
new file mode 100644
index 00000000000..acd63b234af
--- /dev/null
+++ b/include/linux/ath6kl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LINUX_ATH6KL_PLATFORM_H
+#define _LINUX_ATH6KL_PLATFORM_H
+
+struct ath6kl_platform_data {
+ int (*setup_power)(bool);
+};
+
+int ath6kl_set_platform_data(const struct ath6kl_platform_data *data);
+
+const struct ath6kl_platform_data *ath6kl_get_platform_data(void);
+
+#endif /* _LINUX_ATH6KL_PLATFORM_H */