Path: blob/master/ALFA-W1F1/RTL8814AU/platform/platform_ARM_SUN50IW1P1_sdio.c
1307 views
/******************************************************************************1*2* Copyright(c) 2013 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13*****************************************************************************/14/*15* Description:16* This file can be applied to following platforms:17* CONFIG_PLATFORM_ARM_SUN50IW1P118*/19#include <drv_types.h>20#ifdef CONFIG_GPIO_WAKEUP21#include <linux/gpio.h>22#endif2324#ifdef CONFIG_MMC25#if defined(CONFIG_PLATFORM_ARM_SUN50IW1P1)26extern void sunxi_mmc_rescan_card(unsigned ids);27extern void sunxi_wlan_set_power(int on);28extern int sunxi_wlan_get_bus_index(void);29extern int sunxi_wlan_get_oob_irq(void);30extern int sunxi_wlan_get_oob_irq_flags(void);31#endif32#ifdef CONFIG_GPIO_WAKEUP33extern unsigned int oob_irq;34#endif35#endif /* CONFIG_MMC */3637/*38* Return:39* 0: power on successfully40* others: power on failed41*/42int platform_wifi_power_on(void)43{44int ret = 0;4546#ifdef CONFIG_MMC47{4849#if defined(CONFIG_PLATFORM_ARM_SUN50IW1P1)50int wlan_bus_index = sunxi_wlan_get_bus_index();51if (wlan_bus_index < 0)52return wlan_bus_index;5354sunxi_wlan_set_power(1);55mdelay(100);56sunxi_mmc_rescan_card(wlan_bus_index);57#endif58RTW_INFO("%s: power up, rescan card.\n", __FUNCTION__);5960#ifdef CONFIG_GPIO_WAKEUP61#if defined(CONFIG_PLATFORM_ARM_SUN50IW1P1)62oob_irq = sunxi_wlan_get_oob_irq();63#endif64#endif /* CONFIG_GPIO_WAKEUP */65}66#endif /* CONFIG_MMC */6768return ret;69}7071void platform_wifi_power_off(void)72{73#ifdef CONFIG_MMC74#if defined(CONFIG_PLATFORM_ARM_SUN50IW1P1)75int wlan_bus_index = sunxi_wlan_get_bus_index();76if (wlan_bus_index < 0)77return;7879sunxi_mmc_rescan_card(wlan_bus_index);80mdelay(100);81sunxi_wlan_set_power(0);82#endif83RTW_INFO("%s: remove card, power off.\n", __FUNCTION__);84#endif /* CONFIG_MMC */85}868788