forked from Evlers/esp8089_wifi_drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdio_stub.c
93 lines (76 loc) · 1.96 KB
/
sdio_stub.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright (c) 2013 Espressif System.
*
* sdio stub code for RK
*/
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
//#include <mach/iomux.h>
/* reset GPIO parameter defaults to GPIO 0 (ID_SD) on the Raspberry Pi */
static int esp_reset_gpio = 0;
module_param(esp_reset_gpio, int, 0);
MODULE_PARM_DESC(esp_reset_gpio, "ESP8089 CH_PD reset GPIO number");
#define ESP8089_DRV_VERSION "1.9"
extern int rk29sdk_wifi_power(int on);
extern int rk29sdk_wifi_set_carddetect(int val);
int rockchip_wifi_init_module(void)
{
return esp_sdio_init();
}
void rockchip_wifi_exit_module(void)
{
esp_sdio_exit();
}
void sif_platform_rescan_card(unsigned insert)
{
}
void sif_platform_reset_target(void)
{
esp_dbg(ESP_DBG_LOG, "ESP8089 reset via GPIO %d\n", esp_reset_gpio);
gpio_request(esp_reset_gpio,"esp_reset");
gpio_direction_output(esp_reset_gpio,0);
msleep(200);
gpio_direction_input(esp_reset_gpio);
gpio_free(esp_reset_gpio);
}
void sif_platform_target_poweroff(void)
{
/* reset ESP before unload so that the esp can be probed on
* warm reboot */
sif_platform_reset_target();
}
void sif_platform_target_poweron(void)
{
sif_platform_reset_target();
}
void sif_platform_target_speed(int high_speed)
{
}
void sif_platform_check_r1_ready(struct esp_pub *epub)
{
}
#ifdef ESP_ACK_INTERRUPT
extern void sdmmc_ack_interrupt(struct mmc_host *mmc);
void sif_platform_ack_interrupt(struct esp_pub *epub)
{
struct esp_sdio_ctrl *sctrl = NULL;
struct sdio_func *func = NULL;
if (epub == NULL) {
ESSERT(epub != NULL);
return;
}
sctrl = (struct esp_sdio_ctrl *)epub->sif;
func = sctrl->func;
if (func == NULL) {
ESSERT(func != NULL);
return;
}
sdmmc_ack_interrupt(func->card->host);
}
#endif //ESP_ACK_INTERRUPT
EXPORT_SYMBOL(rockchip_wifi_init_module);
EXPORT_SYMBOL(rockchip_wifi_exit_module);
late_initcall(esp_sdio_init);
module_exit(esp_sdio_exit);