mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2025-11-14 22:18:20 +03:00
Uploading the v5.3.4 version
This commit is contained in:
54
platform/platform_aml_s905_sdio.c
Normal file
54
platform/platform_aml_s905_sdio.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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/printk.h> /* pr_info(() */
|
||||
#include <linux/delay.h> /* msleep() */
|
||||
#include "platform_aml_s905_sdio.h" /* sdio_reinit() and etc */
|
||||
|
||||
|
||||
/*
|
||||
* Return:
|
||||
* 0: power on successfully
|
||||
* others: power on failed
|
||||
*/
|
||||
int platform_wifi_power_on(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
ret = wifi_setup_dt();
|
||||
if (ret) {
|
||||
pr_err("%s: setup dt failed!!(%d)\n", __func__, ret);
|
||||
return -1;
|
||||
}
|
||||
#endif /* kernel < 3.14.0 */
|
||||
|
||||
#if 0 /* Seems redundancy? Already done before insert driver */
|
||||
pr_info("######%s:\n", __func__);
|
||||
extern_wifi_set_enable(0);
|
||||
msleep(500);
|
||||
extern_wifi_set_enable(1);
|
||||
msleep(500);
|
||||
sdio_reinit();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void platform_wifi_power_off(void)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
wifi_teardown_dt();
|
||||
#endif /* kernel < 3.14.0 */
|
||||
}
|
||||
28
platform/platform_aml_s905_sdio.h
Normal file
28
platform/platform_aml_s905_sdio.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __PLATFORM_AML_S905_SDIO_H__
|
||||
#define __PLATFORM_AML_S905_SDIO_H__
|
||||
|
||||
#include <linux/version.h> /* Linux vresion */
|
||||
|
||||
extern void sdio_reinit(void);
|
||||
extern void extern_wifi_set_enable(int is_on);
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
extern void wifi_teardown_dt(void);
|
||||
extern int wifi_setup_dt(void);
|
||||
#endif /* kernel < 3.14.0 */
|
||||
|
||||
#endif /* __PLATFORM_AML_S905_SDIO_H__ */
|
||||
110
platform/platform_hisilicon_hi3798_sdio.c
Normal file
110
platform/platform_hisilicon_hi3798_sdio.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2017 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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/delay.h> /* mdelay() */
|
||||
#include <mach/hardware.h> /* __io_address(), readl(), writel() */
|
||||
#include "platform_hisilicon_hi3798_sdio.h" /* HI_S32() and etc. */
|
||||
|
||||
typedef enum hi_GPIO_DIR_E {
|
||||
HI_DIR_OUT = 0,
|
||||
HI_DIR_IN = 1,
|
||||
} HI_GPIO_DIR_E;
|
||||
|
||||
#define RTL_REG_ON_GPIO (4*8 + 3)
|
||||
|
||||
#define REG_BASE_CTRL __io_address(0xf8a20008)
|
||||
|
||||
int gpio_wlan_reg_on = RTL_REG_ON_GPIO;
|
||||
#if 0
|
||||
module_param(gpio_wlan_reg_on, uint, 0644);
|
||||
MODULE_PARM_DESC(gpio_wlan_reg_on, "wlan reg_on gpio num (default:gpio4_3)");
|
||||
#endif
|
||||
|
||||
static int hi_gpio_set_value(u32 gpio, u32 value)
|
||||
{
|
||||
HI_S32 s32Status;
|
||||
|
||||
s32Status = HI_DRV_GPIO_SetDirBit(gpio, HI_DIR_OUT);
|
||||
if (s32Status != HI_SUCCESS) {
|
||||
pr_err("gpio(%d) HI_DRV_GPIO_SetDirBit HI_DIR_OUT failed\n",
|
||||
gpio);
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32Status = HI_DRV_GPIO_WriteBit(gpio, value);
|
||||
if (s32Status != HI_SUCCESS) {
|
||||
pr_err("gpio(%d) HI_DRV_GPIO_WriteBit value(%d) failed\n",
|
||||
gpio, value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hisi_wlan_set_carddetect(bool present)
|
||||
{
|
||||
u32 regval;
|
||||
u32 mask;
|
||||
|
||||
|
||||
#ifndef CONFIG_HISI_SDIO_ID
|
||||
return;
|
||||
#endif
|
||||
pr_info("SDIO ID=%d\n", CONFIG_HISI_SDIO_ID);
|
||||
#if (CONFIG_HISI_SDIO_ID == 1)
|
||||
mask = 1;
|
||||
#elif (CONFIG_HISI_SDIO_ID == 0)
|
||||
mask = 2;
|
||||
#endif
|
||||
|
||||
regval = readl(REG_BASE_CTRL);
|
||||
if (present) {
|
||||
pr_info("====== Card detection to detect SDIO card! ======\n");
|
||||
/* set card_detect low to detect card */
|
||||
regval |= mask;
|
||||
} else {
|
||||
pr_info("====== Card detection to remove SDIO card! ======\n");
|
||||
/* set card_detect high to remove card */
|
||||
regval &= ~(mask);
|
||||
}
|
||||
writel(regval, REG_BASE_CTRL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return:
|
||||
* 0: power on successfully
|
||||
* others: power on failed
|
||||
*/
|
||||
int platform_wifi_power_on(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
||||
hi_gpio_set_value(gpio_wlan_reg_on, 1);
|
||||
mdelay(100);
|
||||
hisi_wlan_set_carddetect(1);
|
||||
mdelay(2000);
|
||||
pr_info("======== set_carddetect delay 2s! ========\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void platform_wifi_power_off(void)
|
||||
{
|
||||
hisi_wlan_set_carddetect(0);
|
||||
mdelay(100);
|
||||
hi_gpio_set_value(gpio_wlan_reg_on, 0);
|
||||
}
|
||||
28
platform/platform_hisilicon_hi3798_sdio.h
Normal file
28
platform/platform_hisilicon_hi3798_sdio.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2017 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __PLATFORM_HISILICON_HI3798_SDIO_H__
|
||||
#define __PLATFORM_HISILICON_HI3798_SDIO_H__
|
||||
|
||||
typedef unsigned int HI_U32;
|
||||
|
||||
typedef int HI_S32;
|
||||
|
||||
#define HI_SUCCESS 0
|
||||
#define HI_FAILURE (-1)
|
||||
|
||||
extern HI_S32 HI_DRV_GPIO_SetDirBit(HI_U32 u32GpioNo, HI_U32 u32DirBit);
|
||||
extern HI_S32 HI_DRV_GPIO_WriteBit(HI_U32 u32GpioNo, HI_U32 u32BitValue);
|
||||
|
||||
#endif /* __PLATFORM_HISILICON_HI3798_SDIO_H__ */
|
||||
53
platform/platform_zte_zx296716_sdio.c
Normal file
53
platform/platform_zte_zx296716_sdio.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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/printk.h> /* pr_info(() */
|
||||
#include <linux/delay.h> /* msleep() */
|
||||
#include "platform_zte_zx296716_sdio.h" /* sdio_reinit() and etc */
|
||||
|
||||
|
||||
/*
|
||||
* Return:
|
||||
* 0: power on successfully
|
||||
* others: power on failed
|
||||
*/
|
||||
int platform_wifi_power_on(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
pr_info("######%s: disable--1--\n", __func__);
|
||||
extern_wifi_set_enable(0);
|
||||
/*msleep(500);*/ /* add in function:extern_wifi_set_enable */
|
||||
pr_info("######%s: enable--2---\n", __func__);
|
||||
extern_wifi_set_enable(1);
|
||||
/*msleep(500);*/
|
||||
sdio_reinit();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void platform_wifi_power_off(void)
|
||||
{
|
||||
int card_val;
|
||||
|
||||
pr_info("######%s:\n", __func__);
|
||||
#ifdef CONFIG_A16T03_BOARD
|
||||
card_val = sdio_host_is_null();
|
||||
if (card_val)
|
||||
remove_card();
|
||||
#endif /* CONFIG_A16T03_BOARD */
|
||||
extern_wifi_set_enable(0);
|
||||
|
||||
/*msleep(500);*/
|
||||
}
|
||||
25
platform/platform_zte_zx296716_sdio.h
Normal file
25
platform/platform_zte_zx296716_sdio.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __PLATFORM_ZTE_ZX296716_SDIO_H__
|
||||
#define __PLATFORM_ZTE_ZX296716_SDIO_H__
|
||||
|
||||
extern void sdio_reinit(void);
|
||||
extern void extern_wifi_set_enable(int val);
|
||||
#ifdef CONFIG_A16T03_BOARD
|
||||
extern int sdio_host_is_null(void);
|
||||
extern void remove_card(void);
|
||||
#endif /* CONFIG_A16T03_BOARD */
|
||||
|
||||
#endif /* __PLATFORM_ZTE_ZX296716_SDIO_H__ */
|
||||
Reference in New Issue
Block a user