blob: a9c723be1acfca6cd6d6bbfa37f453404aadb83d [file] [log] [blame]
Kalle Valo2f01a1f2009-04-29 23:33:31 +03001/*
2 * This file is part of wl12xx
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
Kalle Valo4c5f7d72010-08-22 22:46:28 +03006 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
Kalle Valo2f01a1f2009-04-29 23:33:31 +03007 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
Ohad Ben-Cohenc1f9a092010-09-16 13:16:02 +020024#ifndef _LINUX_WL12XX_H
25#define _LINUX_WL12XX_H
Kalle Valo2f01a1f2009-04-29 23:33:31 +030026
Luciano Coelho6cc9efe2013-01-25 12:05:34 +020027#include <linux/err.h>
28
Luciano Coelho62c7d082011-03-10 16:42:47 +020029/* Reference clock values */
Gery Kahnc8aea562010-10-05 16:09:05 +020030enum {
Ido Yarivd29633b2011-03-31 10:06:57 +020031 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
32 WL12XX_REFCLOCK_26 = 1, /* 26 MHz */
33 WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */
34 WL12XX_REFCLOCK_52 = 3, /* 52 MHz */
35 WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
36 WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
Gery Kahnc8aea562010-10-05 16:09:05 +020037};
38
Luciano Coelho62c7d082011-03-10 16:42:47 +020039/* TCXO clock values */
40enum {
41 WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */
42 WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */
43 WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */
44 WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */
45 WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */
46 WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */
47 WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49};
50
Luciano Coelho946651c2014-02-15 00:05:52 +010051struct wl1251_platform_data {
Sebastian Reichel1d207cd2014-02-15 00:05:53 +010052 int power_gpio;
Grazvydas Ignotasa02a2952010-04-16 13:22:12 +030053 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
54 int irq;
David-John Willisc95cf3d02009-11-17 18:50:09 +020055 bool use_eeprom;
Luciano Coelho946651c2014-02-15 00:05:52 +010056};
57
58struct wl12xx_platform_data {
59 int irq;
Ohad Ben-Cohen15cea992010-09-16 01:31:51 +020060 int board_ref_clock;
Luciano Coelho62c7d082011-03-10 16:42:47 +020061 int board_tcxo_clock;
Ido Yariv341b7cd2011-03-31 10:07:01 +020062 unsigned long platform_quirks;
Felipe Balbia390e852011-10-06 10:07:44 +030063 bool pwr_in_suspend;
Kalle Valo2f01a1f2009-04-29 23:33:31 +030064};
65
Ido Yariv341b7cd2011-03-31 10:07:01 +020066/* Platform does not support level trigger interrupts */
67#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
68
Luciano Coelho6cc9efe2013-01-25 12:05:34 +020069#ifdef CONFIG_WILINK_PLATFORM_DATA
Ohad Ben-Cohen65836112010-09-28 20:20:28 +020070
Ohad Ben-Cohen61ee7002010-09-16 01:31:12 +020071int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
Ohad Ben-Cohen65836112010-09-28 20:20:28 +020072
Luciano Coelho6cc9efe2013-01-25 12:05:34 +020073struct wl12xx_platform_data *wl12xx_get_platform_data(void);
74
Luciano Coelho946651c2014-02-15 00:05:52 +010075int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76
77struct wl1251_platform_data *wl1251_get_platform_data(void);
78
Ohad Ben-Cohen65836112010-09-28 20:20:28 +020079#else
80
81static inline
82int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
83{
84 return -ENOSYS;
85}
86
Luciano Coelho6cc9efe2013-01-25 12:05:34 +020087static inline
88struct wl12xx_platform_data *wl12xx_get_platform_data(void)
89{
90 return ERR_PTR(-ENODATA);
91}
Ohad Ben-Cohen65836112010-09-28 20:20:28 +020092
Luciano Coelho946651c2014-02-15 00:05:52 +010093static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{
96 return -ENOSYS;
97}
98
99static inline
100struct wl1251_platform_data *wl1251_get_platform_data(void)
101{
102 return ERR_PTR(-ENODATA);
103}
104
Luciano Coelho6cc9efe2013-01-25 12:05:34 +0200105#endif
Ohad Ben-Cohen61ee7002010-09-16 01:31:12 +0200106
Kalle Valo2f01a1f2009-04-29 23:33:31 +0300107#endif