All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] rt2x00: RT5350 support
@ 2017-01-20 13:28 Stanislaw Gruszka
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-20 13:28 UTC (permalink / raw)
  To: linux-wireless
  Cc: Helmut Schaa, Daniel Golle, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

Repost patches from Daniel with updated clock handling and
correct author of RT5350 patch.

Note I did not test patches on SOC devices, but getting
clock frequency is simple and should be trouble-free.

Daniel Golle (1):
  rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal

Serge Vasilugin (1):
  rt2x00: add support for RT5350 WiSoC

Stanislaw Gruszka (1):
  rt2x00: add copy of clk for soc devices

 drivers/net/wireless/ralink/rt2x00/rt2800.h    |   1 +
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 156 +++++++++++++++++++++++--
 drivers/net/wireless/ralink/rt2x00/rt2x00.h    |   5 +
 drivers/net/wireless/ralink/rt2x00/rt2x00soc.c |   1 +
 4 files changed, 155 insertions(+), 8 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/3] rt2x00: add copy of clk for soc devices
  2017-01-20 13:28 [PATCH v4 0/3] rt2x00: RT5350 support Stanislaw Gruszka
@ 2017-01-20 13:28 ` Stanislaw Gruszka
  2017-01-20 14:13   ` Daniel Golle
                     ` (2 more replies)
  2017-01-20 13:28 ` [PATCH v4 2/3] rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal Stanislaw Gruszka
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-20 13:28 UTC (permalink / raw)
  To: linux-wireless
  Cc: Helmut Schaa, Daniel Golle, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

Since clk_get() is not trivial add copy of clk pointer to rt2x00dev
for System On Chip devices and initialize it on probe routine.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00.h    | 4 ++++
 drivers/net/wireless/ralink/rt2x00/rt2x00soc.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
index bea7ac3..b59e721 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
@@ -39,6 +39,7 @@
 #include <linux/hrtimer.h>
 #include <linux/average.h>
 #include <linux/usb.h>
+#include <linux/clk.h>
 
 #include <net/mac80211.h>
 
@@ -1011,6 +1012,9 @@ struct rt2x00_dev {
 	unsigned int extra_tx_headroom;
 
 	struct usb_anchor *anchor;
+
+	/* Clock for System On Chip devices. */
+	struct clk *clk;
 };
 
 struct rt2x00_bar_list_entry {
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
index 69a0cda..362f9d3 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
@@ -92,6 +92,7 @@ int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
 	rt2x00dev->hw = hw;
 	rt2x00dev->irq = platform_get_irq(pdev, 0);
 	rt2x00dev->name = pdev->dev.driver->name;
+	rt2x00dev->clk = clk_get(&pdev->dev);
 
 	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/3] rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal
  2017-01-20 13:28 [PATCH v4 0/3] rt2x00: RT5350 support Stanislaw Gruszka
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
@ 2017-01-20 13:28 ` Stanislaw Gruszka
  2017-01-20 13:28 ` [PATCH v4 3/3] rt2x00: add support for RT5350 WiSoC Stanislaw Gruszka
  2017-01-20 14:32 ` [PATCH v4 0/3] rt2x00: RT5350 support Daniel Golle
  3 siblings, 0 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-20 13:28 UTC (permalink / raw)
  To: linux-wireless
  Cc: Helmut Schaa, Daniel Golle, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

From: Daniel Golle <daniel@makrotopia.org>

On Rt3352 the driver needs to know the frequency of an external
crystal which can be either 40 MHz (as on all other WiSoCs until now)
or 20 MHz.
Get the clock attached by ramips WiSoC platform code which probes
SYSC_REG_SYSCFG (added by John Crispin in commit 6ac8579b96e3b) and
introduce a new flag clk_is_20mhz in struct hw_mode_spec to make the
driver aware and use either 40 MHz or 20 MHz specific rf_vals on those
WiSoC platforms.
The introduced support for boards with a 20 MHz crystal is also needed
for RT5350.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 31 +++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 8ea844d..5ae2950 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -1935,6 +1935,11 @@ static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev,
 	rt2x00dev->lna_gain = lna_gain;
 }
 
+static inline bool rt2800_clk_is_20mhz(struct rt2x00_dev *rt2x00dev)
+{
+	return clk_get_rate(rt2x00dev->clk) == 20000000;
+}
+
 #define FREQ_OFFSET_BOUND	0x5f
 
 static void rt2800_freq_cal_mode1(struct rt2x00_dev *rt2x00dev)
@@ -7426,6 +7431,27 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	{173, 0x61, 0, 9},
 };
 
+/*
+ * RF value list for rt3xxx with Xtal20MHz
+ * Supports: 2.4 GHz (all) (RF3322)
+ */
+static const struct rf_channel rf_vals_3x_xtal20[] = {
+	{1,    0xE2,	 2,  0x14},
+	{2,    0xE3,	 2,  0x14},
+	{3,    0xE4,	 2,  0x14},
+	{4,    0xE5,	 2,  0x14},
+	{5,    0xE6,	 2,  0x14},
+	{6,    0xE7,	 2,  0x14},
+	{7,    0xE8,	 2,  0x14},
+	{8,    0xE9,	 2,  0x14},
+	{9,    0xEA,	 2,  0x14},
+	{10,   0xEB,	 2,  0x14},
+	{11,   0xEC,	 2,  0x14},
+	{12,   0xED,	 2,  0x14},
+	{13,   0xEE,	 2,  0x14},
+	{14,   0xF0,	 2,  0x18},
+};
+
 static const struct rf_channel rf_vals_5592_xtal20[] = {
 	/* Channel, N, K, mod, R */
 	{1, 482, 4, 10, 3},
@@ -7654,7 +7680,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	case RF5390:
 	case RF5392:
 		spec->num_channels = 14;
-		spec->channels = rf_vals_3x;
+		if (rt2800_clk_is_20mhz(rt2x00dev))
+			spec->channels = rf_vals_3x_xtal20;
+		else
+			spec->channels = rf_vals_3x;
 		break;
 
 	case RF3052:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 3/3] rt2x00: add support for RT5350 WiSoC
  2017-01-20 13:28 [PATCH v4 0/3] rt2x00: RT5350 support Stanislaw Gruszka
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
  2017-01-20 13:28 ` [PATCH v4 2/3] rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal Stanislaw Gruszka
@ 2017-01-20 13:28 ` Stanislaw Gruszka
  2017-01-20 14:32 ` [PATCH v4 0/3] rt2x00: RT5350 support Daniel Golle
  3 siblings, 0 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-20 13:28 UTC (permalink / raw)
  To: linux-wireless
  Cc: Helmut Schaa, Daniel Golle, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

From: Serge Vasilugin <vasilugin@yandex.ru>

Support for the RT5350 WiSoC was added to OpenWrt after having a
lengthy debate about the legality of the original submission, see
https://lists.openwrt.org/pipermail/openwrt-devel/2013-January/018224.html
MTK/Ralink Acked replied and says we can merge this patch under the GPL.
https://dev.openwrt.org/changeset/36177

Signed-off-by: Serge Vasilugin <vasilugin@yandex.ru>
Tested-by: Michel Stempin <michel.stempin@wanadoo.fr>
Acked-by: John Crispin <blogic@openwrt.org>
[daniel@makrotopia.org: added commit message, cleaned up code]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800.h    |   1 +
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 125 +++++++++++++++++++++++--
 drivers/net/wireless/ralink/rt2x00/rt2x00.h    |   1 +
 3 files changed, 120 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800.h b/drivers/net/wireless/ralink/rt2x00/rt2800.h
index 1809690..256496b 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
@@ -72,6 +72,7 @@
 #define RF5592				0x000f
 #define RF3070				0x3070
 #define RF3290				0x3290
+#define RF5350				0x5350
 #define RF5360				0x5360
 #define RF5362				0x5362
 #define RF5370				0x5370
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 5ae2950..755c093 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -2763,6 +2763,13 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
 
 				rt2800_rfcsr_write(rt2x00dev, 59,
 						   r59_non_bt[idx]);
+			} else if (rt2x00_rt(rt2x00dev, RT5350)) {
+				static const char r59_non_bt[] = {0x0b, 0x0b,
+					0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
+					0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
+
+				rt2800_rfcsr_write(rt2x00dev, 59,
+						   r59_non_bt[idx]);
 			}
 		}
 	}
@@ -3200,6 +3207,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 		rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
 		break;
 	case RF3070:
+	case RF5350:
 	case RF5360:
 	case RF5362:
 	case RF5370:
@@ -3218,6 +3226,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	if (rt2x00_rf(rt2x00dev, RF3070) ||
 	    rt2x00_rf(rt2x00dev, RF3290) ||
 	    rt2x00_rf(rt2x00dev, RF3322) ||
+	    rt2x00_rf(rt2x00dev, RF5350) ||
 	    rt2x00_rf(rt2x00dev, RF5360) ||
 	    rt2x00_rf(rt2x00dev, RF5362) ||
 	    rt2x00_rf(rt2x00dev, RF5370) ||
@@ -3475,7 +3484,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	/*
 	 * Clear update flag
 	 */
-	if (rt2x00_rt(rt2x00dev, RT3352)) {
+	if (rt2x00_rt(rt2x00dev, RT3352) ||
+	    rt2x00_rt(rt2x00dev, RT5350)) {
 		rt2800_bbp_read(rt2x00dev, 49, &bbp);
 		rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
 		rt2800_bbp_write(rt2x00dev, 49, bbp);
@@ -4356,6 +4366,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev)
 	case RF3053:
 	case RF3070:
 	case RF3290:
+	case RF5350:
 	case RF5360:
 	case RF5362:
 	case RF5370:
@@ -4738,6 +4749,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
+	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
+		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
 	} else {
 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
@@ -5383,9 +5396,13 @@ static void rt2800_init_bbp_3352(struct rt2x00_dev *rt2x00dev)
 
 	rt2800_bbp_write(rt2x00dev, 82, 0x62);
 
-	rt2800_bbp_write(rt2x00dev, 83, 0x6a);
-
-	rt2800_bbp_write(rt2x00dev, 84, 0x99);
+	if (rt2x00_rt(rt2x00dev, RT5350)) {
+		rt2800_bbp_write(rt2x00dev, 83, 0x7a);
+		rt2800_bbp_write(rt2x00dev, 84, 0x9a);
+	} else {
+		rt2800_bbp_write(rt2x00dev, 83, 0x6a);
+		rt2800_bbp_write(rt2x00dev, 84, 0x99);
+	}
 
 	rt2800_bbp_write(rt2x00dev, 86, 0x38);
 
@@ -5399,9 +5416,13 @@ static void rt2800_init_bbp_3352(struct rt2x00_dev *rt2x00dev)
 
 	rt2800_bbp_write(rt2x00dev, 104, 0x92);
 
-	rt2800_bbp_write(rt2x00dev, 105, 0x34);
-
-	rt2800_bbp_write(rt2x00dev, 106, 0x05);
+	if (rt2x00_rt(rt2x00dev, RT5350)) {
+		rt2800_bbp_write(rt2x00dev, 105, 0x3c);
+		rt2800_bbp_write(rt2x00dev, 106, 0x03);
+	} else {
+		rt2800_bbp_write(rt2x00dev, 105, 0x34);
+		rt2800_bbp_write(rt2x00dev, 106, 0x05);
+	}
 
 	rt2800_bbp_write(rt2x00dev, 120, 0x50);
 
@@ -5426,6 +5447,16 @@ static void rt2800_init_bbp_3352(struct rt2x00_dev *rt2x00dev)
 	rt2800_bbp_write(rt2x00dev, 143, 0xa2);
 
 	rt2800_bbp_write(rt2x00dev, 148, 0xc8);
+
+	if (rt2x00_rt(rt2x00dev, RT5350)) {
+		/* Antenna Software OFDM */
+		rt2800_bbp_write(rt2x00dev, 150, 0x40);
+		/* Antenna Software CCK */
+		rt2800_bbp_write(rt2x00dev, 151, 0x30);
+		rt2800_bbp_write(rt2x00dev, 152, 0xa3);
+		/* Clear previously selected antenna */
+		rt2800_bbp_write(rt2x00dev, 154, 0);
+	}
 }
 
 static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
@@ -5726,6 +5757,7 @@ static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
 		rt2800_init_bbp_3290(rt2x00dev);
 		break;
 	case RT3352:
+	case RT5350:
 		rt2800_init_bbp_3352(rt2x00dev);
 		break;
 	case RT3390:
@@ -6536,6 +6568,76 @@ static void rt2800_init_rfcsr_3593(struct rt2x00_dev *rt2x00dev)
 	/* TODO: enable stream mode support */
 }
 
+static void rt2800_init_rfcsr_5350(struct rt2x00_dev *rt2x00dev)
+{
+	rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
+	rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
+	rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
+	rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
+	rt2800_rfcsr_write(rt2x00dev, 4, 0x49);
+	rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
+	rt2800_rfcsr_write(rt2x00dev, 6, 0xe0);
+	rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 8, 0xf1);
+	rt2800_rfcsr_write(rt2x00dev, 9, 0x02);
+	rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
+	rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
+	rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
+	if (rt2800_clk_is_20mhz(rt2x00dev))
+		rt2800_rfcsr_write(rt2x00dev, 13, 0x1f);
+	else
+		rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
+	rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 16, 0xc0);
+	rt2800_rfcsr_write(rt2x00dev, 18, 0x03);
+	rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 21, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
+	rt2800_rfcsr_write(rt2x00dev, 23, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
+	rt2800_rfcsr_write(rt2x00dev, 26, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
+	rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 29, 0xd0);
+	rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
+	rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
+	rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
+	rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
+	rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
+	rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 37, 0x08);
+	rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
+	rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);
+	rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
+	rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
+	rt2800_rfcsr_write(rt2x00dev, 42, 0xd5);
+	rt2800_rfcsr_write(rt2x00dev, 43, 0x9b);
+	rt2800_rfcsr_write(rt2x00dev, 44, 0x0c);
+	rt2800_rfcsr_write(rt2x00dev, 45, 0xa6);
+	rt2800_rfcsr_write(rt2x00dev, 46, 0x73);
+	rt2800_rfcsr_write(rt2x00dev, 47, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 48, 0x10);
+	rt2800_rfcsr_write(rt2x00dev, 49, 0x80);
+	rt2800_rfcsr_write(rt2x00dev, 50, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 51, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 52, 0x38);
+	rt2800_rfcsr_write(rt2x00dev, 53, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 54, 0x38);
+	rt2800_rfcsr_write(rt2x00dev, 55, 0x43);
+	rt2800_rfcsr_write(rt2x00dev, 56, 0x82);
+	rt2800_rfcsr_write(rt2x00dev, 57, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 58, 0x39);
+	rt2800_rfcsr_write(rt2x00dev, 59, 0x0b);
+	rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
+	rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
+	rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
+	rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
+}
+
 static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
 {
 	rt2800_rf_init_calibration(rt2x00dev, 2);
@@ -6773,6 +6875,9 @@ static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
 	case RT3593:
 		rt2800_init_rfcsr_3593(rt2x00dev);
 		break;
+	case RT5350:
+		rt2800_init_rfcsr_5350(rt2x00dev);
+		break;
 	case RT5390:
 		rt2800_init_rfcsr_5390(rt2x00dev);
 		break;
@@ -7152,6 +7257,8 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
 	else if (rt2x00_rt(rt2x00dev, RT3352))
 		rf = RF3322;
+	else if (rt2x00_rt(rt2x00dev, RT5350))
+		rf = RF5350;
 	else
 		rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
 
@@ -7170,6 +7277,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	case RF3290:
 	case RF3320:
 	case RF3322:
+	case RF5350:
 	case RF5360:
 	case RF5362:
 	case RF5370:
@@ -7673,6 +7781,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	case RF3290:
 	case RF3320:
 	case RF3322:
+	case RF5350:
 	case RF5360:
 	case RF5362:
 	case RF5370:
@@ -7809,6 +7918,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	case RF3053:
 	case RF3070:
 	case RF3290:
+	case RF5350:
 	case RF5360:
 	case RF5362:
 	case RF5370:
@@ -7849,6 +7959,7 @@ static int rt2800_probe_rt(struct rt2x00_dev *rt2x00dev)
 	case RT3390:
 	case RT3572:
 	case RT3593:
+	case RT5350:
 	case RT5390:
 	case RT5392:
 	case RT5592:
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
index b59e721..ea299c4 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
@@ -170,6 +170,7 @@ struct rt2x00_chip {
 #define RT3572		0x3572
 #define RT3593		0x3593
 #define RT3883		0x3883	/* WSOC */
+#define RT5350		0x5350  /* WSOC 2.4GHz */
 #define RT5390		0x5390  /* 2.4GHz */
 #define RT5392		0x5392  /* 2.4GHz */
 #define RT5592		0x5592
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/3] rt2x00: add copy of clk for soc devices
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
@ 2017-01-20 14:13   ` Daniel Golle
  2017-01-28  7:09   ` [v4,1/3] " Kalle Valo
  2017-01-28 19:39   ` [PATCH v4 1/3] " Felix Fietkau
  2 siblings, 0 replies; 10+ messages in thread
From: Daniel Golle @ 2017-01-20 14:13 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Helmut Schaa, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

On Fri, Jan 20, 2017 at 02:28:24PM +0100, Stanislaw Gruszka wrote:
> Since clk_get() is not trivial add copy of clk pointer to rt2x00dev
> for System On Chip devices and initialize it on probe routine.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Daniel Golle <daniel@makrotopia.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/3] rt2x00: RT5350 support
  2017-01-20 13:28 [PATCH v4 0/3] rt2x00: RT5350 support Stanislaw Gruszka
                   ` (2 preceding siblings ...)
  2017-01-20 13:28 ` [PATCH v4 3/3] rt2x00: add support for RT5350 WiSoC Stanislaw Gruszka
@ 2017-01-20 14:32 ` Daniel Golle
  2017-01-20 15:38   ` Stanislaw Gruszka
  3 siblings, 1 reply; 10+ messages in thread
From: Daniel Golle @ 2017-01-20 14:32 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Helmut Schaa, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

Hi Stanislaw,

On Fri, Jan 20, 2017 at 02:28:23PM +0100, Stanislaw Gruszka wrote:
> Repost patches from Daniel with updated clock handling and
> correct author of RT5350 patch.
> 
> Note I did not test patches on SOC devices, but getting
> clock frequency is simple and should be trouble-free.

Thanks a lot for handling this!
And big thanks to everyone involved for reviewing a smelly pile of
patches we had rotting here for half a decade...

Would you like me to re-work and re-submit the remaining patches needed
to support RT3883 and RF3853?

Otherwise, the next thing I'd have in mind would be to add device-tree
bindings to handle in-flash EEPROM loading, see the patches 60[2-9]* in
https://git.lede-project.org/?p=source.git;a=tree;f=package/kernel/mac80211/patches

Imho having only support for MTD partitions and skip support for
requesting firmware files from userspace for now would be the cleanest
way towards proper WiSoC support in vanilla kernels.
Obviously our existing patches need to be reworked and stuff needs to
be added to Documentation/devicetree/bindings.
Support for non-device-tree legacy platforms which need platform_data
and legacy EEPROM loading mechanism can remain a local patch in our
tree until those will no longer be needed.
Does everybody agree with this general direction?

John, Mathias: Are you going to rework and upstream your work to
support loading in-flash EEPROM yourself our would you like me to give
it a shot?


Cheers


Daniel



> 
> Daniel Golle (1):
>   rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal
> 
> Serge Vasilugin (1):
>   rt2x00: add support for RT5350 WiSoC
> 
> Stanislaw Gruszka (1):
>   rt2x00: add copy of clk for soc devices
> 
>  drivers/net/wireless/ralink/rt2x00/rt2800.h    |   1 +
>  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 156 +++++++++++++++++++++++--
>  drivers/net/wireless/ralink/rt2x00/rt2x00.h    |   5 +
>  drivers/net/wireless/ralink/rt2x00/rt2x00soc.c |   1 +
>  4 files changed, 155 insertions(+), 8 deletions(-)
> 
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/3] rt2x00: RT5350 support
  2017-01-20 14:32 ` [PATCH v4 0/3] rt2x00: RT5350 support Daniel Golle
@ 2017-01-20 15:38   ` Stanislaw Gruszka
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-20 15:38 UTC (permalink / raw)
  To: Daniel Golle
  Cc: linux-wireless, Helmut Schaa, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin

Hi

On Fri, Jan 20, 2017 at 03:32:19PM +0100, Daniel Golle wrote:
> On Fri, Jan 20, 2017 at 02:28:23PM +0100, Stanislaw Gruszka wrote:
> > Repost patches from Daniel with updated clock handling and
> > correct author of RT5350 patch.
> > 
> > Note I did not test patches on SOC devices, but getting
> > clock frequency is simple and should be trouble-free.
> 
> Thanks a lot for handling this!
> And big thanks to everyone involved for reviewing a smelly pile of
> patches we had rotting here for half a decade...
> 
> Would you like me to re-work and re-submit the remaining patches needed
> to support RT3883 and RF3853?

Yes, please post them in small sets. 

> Otherwise, the next thing I'd have in mind would be to add device-tree
> bindings to handle in-flash EEPROM loading, see the patches 60[2-9]* in
> https://git.lede-project.org/?p=source.git;a=tree;f=package/kernel/mac80211/patches
> 
> Imho having only support for MTD partitions and skip support for
> requesting firmware files from userspace for now would be the cleanest
> way towards proper WiSoC support in vanilla kernels.
> Obviously our existing patches need to be reworked and stuff needs to
> be added to Documentation/devicetree/bindings.
> Support for non-device-tree legacy platforms which need platform_data
> and legacy EEPROM loading mechanism can remain a local patch in our
> tree until those will no longer be needed.
> Does everybody agree with this general direction?

Sound ok for me.

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [v4,1/3] rt2x00: add copy of clk for soc devices
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
  2017-01-20 14:13   ` Daniel Golle
@ 2017-01-28  7:09   ` Kalle Valo
  2017-01-28 19:39   ` [PATCH v4 1/3] " Felix Fietkau
  2 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2017-01-28  7:09 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Helmut Schaa, Daniel Golle, Gabor Juhos,
	Serge Vasilugin, Mathias Kresin, Michel Stempin, John Crispin

Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> Since clk_get() is not trivial add copy of clk pointer to rt2x00dev
> for System On Chip devices and initialize it on probe routine.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Acked-by: Daniel Golle <daniel@makrotopia.org>

3 patches applied to wireless-drivers-next.git, thanks.

34db70b92fae rt2x00: add copy of clk for soc devices
5c4412e07280 rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal
98e71f44c51d rt2x00: add support for RT5350 WiSoC

-- 
https://patchwork.kernel.org/patch/9528399/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/3] rt2x00: add copy of clk for soc devices
  2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
  2017-01-20 14:13   ` Daniel Golle
  2017-01-28  7:09   ` [v4,1/3] " Kalle Valo
@ 2017-01-28 19:39   ` Felix Fietkau
  2017-01-29 11:16     ` Stanislaw Gruszka
  2 siblings, 1 reply; 10+ messages in thread
From: Felix Fietkau @ 2017-01-28 19:39 UTC (permalink / raw)
  To: Stanislaw Gruszka, linux-wireless
  Cc: Helmut Schaa, Daniel Golle, Gabor Juhos, Serge Vasilugin,
	Mathias Kresin, Michel Stempin, John Crispin

On 2017-01-20 14:28, Stanislaw Gruszka wrote:
> Since clk_get() is not trivial add copy of clk pointer to rt2x00dev
> for System On Chip devices and initialize it on probe routine.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2x00.h    | 4 ++++
>  drivers/net/wireless/ralink/rt2x00/rt2x00soc.c | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> index bea7ac3..b59e721 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> @@ -39,6 +39,7 @@
>  #include <linux/hrtimer.h>
>  #include <linux/average.h>
>  #include <linux/usb.h>
> +#include <linux/clk.h>
>  
>  #include <net/mac80211.h>
>  
> @@ -1011,6 +1012,9 @@ struct rt2x00_dev {
>  	unsigned int extra_tx_headroom;
>  
>  	struct usb_anchor *anchor;
> +
> +	/* Clock for System On Chip devices. */
> +	struct clk *clk;
>  };
>  
>  struct rt2x00_bar_list_entry {
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
> index 69a0cda..362f9d3 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
> @@ -92,6 +92,7 @@ int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
>  	rt2x00dev->hw = hw;
>  	rt2x00dev->irq = platform_get_irq(pdev, 0);
>  	rt2x00dev->name = pdev->dev.driver->name;
> +	rt2x00dev->clk = clk_get(&pdev->dev);
This looks broken, clk_get takes two parameters, not just one.

- Felix

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/3] rt2x00: add copy of clk for soc devices
  2017-01-28 19:39   ` [PATCH v4 1/3] " Felix Fietkau
@ 2017-01-29 11:16     ` Stanislaw Gruszka
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislaw Gruszka @ 2017-01-29 11:16 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: linux-wireless, Helmut Schaa, Daniel Golle, Gabor Juhos,
	Serge Vasilugin, Mathias Kresin, Michel Stempin

On Sat, Jan 28, 2017 at 08:39:15PM +0100, Felix Fietkau wrote:
> >  	rt2x00dev->hw = hw;
> >  	rt2x00dev->irq = platform_get_irq(pdev, 0);
> >  	rt2x00dev->name = pdev->dev.driver->name;
> > +	rt2x00dev->clk = clk_get(&pdev->dev);
> This looks broken, clk_get takes two parameters, not just one.

Err, since patch was already applied in -next, I will post fix
in separate patch.  

Thanks
Stanislaw

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-29 11:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 13:28 [PATCH v4 0/3] rt2x00: RT5350 support Stanislaw Gruszka
2017-01-20 13:28 ` [PATCH v4 1/3] rt2x00: add copy of clk for soc devices Stanislaw Gruszka
2017-01-20 14:13   ` Daniel Golle
2017-01-28  7:09   ` [v4,1/3] " Kalle Valo
2017-01-28 19:39   ` [PATCH v4 1/3] " Felix Fietkau
2017-01-29 11:16     ` Stanislaw Gruszka
2017-01-20 13:28 ` [PATCH v4 2/3] rt2x00: rt2800lib: add support for RT3352 with 20MHz crystal Stanislaw Gruszka
2017-01-20 13:28 ` [PATCH v4 3/3] rt2x00: add support for RT5350 WiSoC Stanislaw Gruszka
2017-01-20 14:32 ` [PATCH v4 0/3] rt2x00: RT5350 support Daniel Golle
2017-01-20 15:38   ` Stanislaw Gruszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.