summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eagle/sdio_stub.c
blob: 77294c1e5047c6a8f78a22ae50add567e1c1af7b (plain)
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
/*
 * Copyright (c) 2013 Espressif System.
 *
 *  sdio stub code for customer
 */

#include <linux/gpio.h>
#include <mach/wmt_iomux.h>

#define SDIO_ID 2

extern void wmt_detect_sdio2(void);
extern void force_remove_sdio2(void);


void sif_platform_rescan_card(unsigned insert)
{

	printk("%s id %d %u\n", __func__, SDIO_ID, insert);
	if (insert)
	{
		wmt_detect_sdio2();
	}
	else
	{
		force_remove_sdio2();
	}
}

void sif_platform_reset_target(void)
{
	int err;

	err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");
        if(err < 0) {
                printk("reques gpio:%x failed!!! for wifi\n",WMT_PIN_GP62_SUSGPIO1);
        }else{
                printk("request gpio:%d for wifi success!!!\n",WMT_PIN_GP62_SUSGPIO1);
        }

	gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);
	msleep(100);
	gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);
	mdelay(100);
}

void sif_platform_target_poweroff(void)
{
	gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);
	mdelay(100);
	printk("eagle wifi module power off!\n");

	gpio_free(WMT_PIN_GP62_SUSGPIO1);
}

void sif_platform_target_poweron(void)
{
	int err;

	err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");
        if(err < 0) {
                printk("reques gpio:%x failed!!! for wifi\n",WMT_PIN_GP62_SUSGPIO1);
        }else{
                printk("request gpio:%d for wifi success!!!\n",WMT_PIN_GP62_SUSGPIO1);
        }

	gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);
	msleep(200);
	gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);
	mdelay(100);
	printk("eagle wifi module power on!\n");
}

void sif_platform_target_speed(int high_speed)
{
}

void sif_platform_check_r1_ready(struct esp_pub *epub)
{
}

#ifdef ESP_ACK_INTERRUPT
extern void eagle_ack_interrupt(void);
void sif_platform_ack_interrupt(struct esp_pub *epub)
{
        eagle_ack_interrupt();
}
#endif //ESP_ACK_INTERRUPT

module_init(esp_sdio_init);
module_exit(esp_sdio_exit);