diff options
author | Luciano Coelho <luca@coelho.fi> | 2015-03-18 12:38:26 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2015-03-24 12:47:57 -0400 |
commit | 44486b48b066330e0ed0a66478cc49f5975ec6c1 (patch) | |
tree | 9961c30c1a665a3dbba3e738072b8077c284f141 /drivers/net/wireless | |
parent | 6f921fab5844941f7605b7f1a265f5fc7fe969a7 (diff) |
wl12xx: use frequency instead of enumerations for pdata clocks
Instead of defining an enumeration with the FW specific values for the
different clock rates, use the actual frequency instead. Also add a
boolean to specify whether the clock is XTAL or not.
Change all board files to reflect this.
Signed-off-by: Luciano Coelho <luca@coelho.fi>
[Eliad - small fixes, update board file changes]
Signed-off-by: Eliad Peller <eliad@wizery.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 |
2 files changed, 84 insertions, 4 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 144d1f8ba473..b3f751f1e08f 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -1770,6 +1770,40 @@ wl12xx_iface_combinations[] = { | |||
1770 | }, | 1770 | }, |
1771 | }; | 1771 | }; |
1772 | 1772 | ||
1773 | static const struct wl12xx_clock wl12xx_refclock_table[] = { | ||
1774 | { 19200000, false, WL12XX_REFCLOCK_19 }, | ||
1775 | { 26000000, false, WL12XX_REFCLOCK_26 }, | ||
1776 | { 26000000, true, WL12XX_REFCLOCK_26_XTAL }, | ||
1777 | { 38400000, false, WL12XX_REFCLOCK_38 }, | ||
1778 | { 38400000, true, WL12XX_REFCLOCK_38_XTAL }, | ||
1779 | { 52000000, false, WL12XX_REFCLOCK_52 }, | ||
1780 | { 0, false, 0 } | ||
1781 | }; | ||
1782 | |||
1783 | static const struct wl12xx_clock wl12xx_tcxoclock_table[] = { | ||
1784 | { 16368000, true, WL12XX_TCXOCLOCK_16_368 }, | ||
1785 | { 16800000, true, WL12XX_TCXOCLOCK_16_8 }, | ||
1786 | { 19200000, true, WL12XX_TCXOCLOCK_19_2 }, | ||
1787 | { 26000000, true, WL12XX_TCXOCLOCK_26 }, | ||
1788 | { 32736000, true, WL12XX_TCXOCLOCK_32_736 }, | ||
1789 | { 33600000, true, WL12XX_TCXOCLOCK_33_6 }, | ||
1790 | { 38400000, true, WL12XX_TCXOCLOCK_38_4 }, | ||
1791 | { 52000000, true, WL12XX_TCXOCLOCK_52 }, | ||
1792 | { 0, false, 0 } | ||
1793 | }; | ||
1794 | |||
1795 | static int wl12xx_get_clock_idx(const struct wl12xx_clock *table, | ||
1796 | u32 freq, bool xtal) | ||
1797 | { | ||
1798 | int i; | ||
1799 | |||
1800 | for (i = 0; table[i].freq != 0; i++) | ||
1801 | if ((table[i].freq == freq) && (table[i].xtal == xtal)) | ||
1802 | return table[i].hw_idx; | ||
1803 | |||
1804 | return -EINVAL; | ||
1805 | } | ||
1806 | |||
1773 | static int wl12xx_setup(struct wl1271 *wl) | 1807 | static int wl12xx_setup(struct wl1271 *wl) |
1774 | { | 1808 | { |
1775 | struct wl12xx_priv *priv = wl->priv; | 1809 | struct wl12xx_priv *priv = wl->priv; |
@@ -1799,7 +1833,17 @@ static int wl12xx_setup(struct wl1271 *wl) | |||
1799 | wl12xx_conf_init(wl); | 1833 | wl12xx_conf_init(wl); |
1800 | 1834 | ||
1801 | if (!fref_param) { | 1835 | if (!fref_param) { |
1802 | priv->ref_clock = pdata->board_ref_clock; | 1836 | priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table, |
1837 | pdata->ref_clock_freq, | ||
1838 | pdata->ref_clock_xtal); | ||
1839 | if (priv->ref_clock < 0) { | ||
1840 | wl1271_error("Invalid ref_clock frequency (%d Hz, %s)", | ||
1841 | pdata->ref_clock_freq, | ||
1842 | pdata->ref_clock_xtal ? | ||
1843 | "XTAL" : "not XTAL"); | ||
1844 | |||
1845 | return priv->ref_clock; | ||
1846 | } | ||
1803 | } else { | 1847 | } else { |
1804 | if (!strcmp(fref_param, "19.2")) | 1848 | if (!strcmp(fref_param, "19.2")) |
1805 | priv->ref_clock = WL12XX_REFCLOCK_19; | 1849 | priv->ref_clock = WL12XX_REFCLOCK_19; |
@@ -1817,9 +1861,17 @@ static int wl12xx_setup(struct wl1271 *wl) | |||
1817 | wl1271_error("Invalid fref parameter %s", fref_param); | 1861 | wl1271_error("Invalid fref parameter %s", fref_param); |
1818 | } | 1862 | } |
1819 | 1863 | ||
1820 | if (!tcxo_param) { | 1864 | if (!tcxo_param && pdata->tcxo_clock_freq) { |
1821 | priv->tcxo_clock = pdata->board_tcxo_clock; | 1865 | priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table, |
1822 | } else { | 1866 | pdata->tcxo_clock_freq, |
1867 | true); | ||
1868 | if (priv->tcxo_clock < 0) { | ||
1869 | wl1271_error("Invalid tcxo_clock frequency (%d Hz)", | ||
1870 | pdata->tcxo_clock_freq); | ||
1871 | |||
1872 | return priv->tcxo_clock; | ||
1873 | } | ||
1874 | } else if (tcxo_param) { | ||
1823 | if (!strcmp(tcxo_param, "19.2")) | 1875 | if (!strcmp(tcxo_param, "19.2")) |
1824 | priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; | 1876 | priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; |
1825 | else if (!strcmp(tcxo_param, "26")) | 1877 | else if (!strcmp(tcxo_param, "26")) |
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index 75c92658bfea..5952e99ace1b 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
@@ -82,6 +82,34 @@ struct wl12xx_priv { | |||
82 | struct wl127x_rx_mem_pool_addr *rx_mem_addr; | 82 | struct wl127x_rx_mem_pool_addr *rx_mem_addr; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* Reference clock values */ | ||
86 | enum { | ||
87 | WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */ | ||
88 | WL12XX_REFCLOCK_26 = 1, /* 26 MHz */ | ||
89 | WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */ | ||
90 | WL12XX_REFCLOCK_52 = 3, /* 52 MHz */ | ||
91 | WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */ | ||
92 | WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */ | ||
93 | }; | ||
94 | |||
95 | /* TCXO clock values */ | ||
96 | enum { | ||
97 | WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */ | ||
98 | WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */ | ||
99 | WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */ | ||
100 | WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */ | ||
101 | WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */ | ||
102 | WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */ | ||
103 | WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */ | ||
104 | WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ | ||
105 | }; | ||
106 | |||
107 | struct wl12xx_clock { | ||
108 | u32 freq; | ||
109 | bool xtal; | ||
110 | u8 hw_idx; | ||
111 | }; | ||
112 | |||
85 | struct wl12xx_fw_packet_counters { | 113 | struct wl12xx_fw_packet_counters { |
86 | /* Cumulative counter of released packets per AC */ | 114 | /* Cumulative counter of released packets per AC */ |
87 | u8 tx_released_pkts[NUM_TX_QUEUES]; | 115 | u8 tx_released_pkts[NUM_TX_QUEUES]; |