1 The fref and the tcxo clocks settings are optional in some platforms.
2 WiLink8 doesn't need either, so we don't check the values. WiLink 6
3 only needs the fref clock, so we check that it is valid or return with
4 an error. WiLink7 needs both clocks, if either is not available we
7 Signed-off-by: Luciano Coelho <coelho@ti.com>
8 Reviewed-by: Felipe Balbi <balbi@ti.com>
11 drivers/net/wireless/ti/wl12xx/main.c | 20 +++++++++++++++++---
12 drivers/net/wireless/ti/wlcore/sdio.c | 4 ----
13 2 files changed, 17 insertions(+), 7 deletions(-)
15 --- a/drivers/net/wireless/ti/wl12xx/main.c
16 +++ b/drivers/net/wireless/ti/wl12xx/main.c
17 @@ -930,6 +930,11 @@ static int wl128x_boot_clk(struct wl1271
21 + if ((priv->ref_clock < 0) || (priv->tcxo_clock < 0)) {
22 + wl1271_error("Missing fref and/or tcxo clock settings\n");
26 /* For XTAL-only modes, FREF will be used after switching from TCXO */
27 if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL ||
28 priv->ref_clock == WL12XX_REFCLOCK_38_XTAL) {
29 @@ -979,6 +984,11 @@ static int wl127x_boot_clk(struct wl1271
33 + if (priv->ref_clock < 0) {
34 + wl1271_error("Missing fref clock settings\n");
38 if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3)
39 wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION;
41 @@ -1768,7 +1778,7 @@ static int wl12xx_setup(struct wl1271 *w
42 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, &wl12xx_ht_cap);
46 + if (!fref_param && (pdata->ref_clock_freq > 0)) {
47 priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table,
48 pdata->ref_clock_freq,
49 pdata->ref_clock_xtal);
50 @@ -1779,6 +1789,8 @@ static int wl12xx_setup(struct wl1271 *w
52 return priv->ref_clock;
54 + } else if (!fref_param) {
55 + priv->ref_clock = -EINVAL;
57 if (!strcmp(fref_param, "19.2"))
58 priv->ref_clock = WL12XX_REFCLOCK_19;
59 @@ -1796,7 +1808,7 @@ static int wl12xx_setup(struct wl1271 *w
60 wl1271_error("Invalid fref parameter %s", fref_param);
64 + if (!fref_param && (pdata->tcxo_clock_freq > 0)) {
65 priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
66 pdata->tcxo_clock_freq,
68 @@ -1806,7 +1818,9 @@ static int wl12xx_setup(struct wl1271 *w
70 return priv->tcxo_clock;
73 + } else if (!fref_param) {
74 + priv->tcxo_clock = -EINVAL;
76 if (!strcmp(tcxo_param, "19.2"))
77 priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2;
78 else if (!strcmp(tcxo_param, "26"))
79 --- a/drivers/net/wireless/ti/wlcore/sdio.c
80 +++ b/drivers/net/wireless/ti/wlcore/sdio.c
81 @@ -252,20 +252,16 @@ static struct wl12xx_platform_data *wlco
82 for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
83 of_fixed_clk_setup(clock_node);
85 - /* TODO: make sure we have this when needed (ie. for WL6 and WL7) */
86 glue->refclock = of_clk_get_by_name(np, "refclock");
87 if (IS_ERR(glue->refclock)) {
88 - dev_err(dev, "couldn't find refclock on the device tree\n");
89 glue->refclock = NULL;
91 clk_prepare_enable(glue->refclock);
92 pdata->ref_clock_freq = clk_get_rate(glue->refclock);
95 - /* TODO: make sure we have this when needed (ie. for WL7) */
96 glue->tcxoclock = of_clk_get_by_name(np, "tcxoclock");
97 if (IS_ERR(glue->tcxoclock)) {
98 - dev_err(dev, "couldn't find tcxoclock on the device tree\n");
99 glue->tcxoclock = NULL;
101 clk_prepare_enable(glue->tcxoclock);