several patches to make OF work on rt2x00
authorJohn Crispin <john@openwrt.org>
Wed, 3 Apr 2013 10:00:29 +0000 (10:00 +0000)
committerJohn Crispin <john@openwrt.org>
Wed, 3 Apr 2013 10:00:29 +0000 (10:00 +0000)
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 36178

package/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch [new file with mode: 0644]
package/mac80211/patches/613-rt2x00-fixup-symbols.patch [new file with mode: 0644]
package/mac80211/patches/614-rt2x00-of_load_eeprom_filename.patch [new file with mode: 0644]
package/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch [new file with mode: 0644]

diff --git a/package/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
new file mode 100644 (file)
index 0000000..00855f6
--- /dev/null
@@ -0,0 +1,39 @@
+From 04dbd87265f6ba4a373b211ba324b437d224fb2d Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Sun, 17 Mar 2013 00:03:31 +0100
+Subject: [PATCH 21/38] rt2x00: make wmac loadable via OF on rt288x/305x SoC
+
+This patch ads the match table to allow loading the wmac support from a
+devicetree.
+
+Signed-off-by: John Crispin <blogic@openwrt.org>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
+index ded73da..e5deb9e 100644
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -1183,11 +1183,18 @@ static int rt2800soc_probe(struct platform_device *pdev)
+       return rt2x00soc_probe(pdev, &rt2800pci_ops);
+ }
++static const struct of_device_id rt2880_wmac_match[] = {
++      { .compatible = "ralink,rt2880-wmac" },
++      {},
++};
++MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
++
+ static struct platform_driver rt2800soc_driver = {
+       .driver         = {
+               .name           = "rt2800_wmac",
+               .owner          = THIS_MODULE,
+               .mod_name       = KBUILD_MODNAME,
++              .of_match_table = rt2880_wmac_match,
+       },
+       .probe          = rt2800soc_probe,
+       .remove         = rt2x00soc_remove,
+-- 
+1.7.10.4
+
diff --git a/package/mac80211/patches/613-rt2x00-fixup-symbols.patch b/package/mac80211/patches/613-rt2x00-fixup-symbols.patch
new file mode 100644 (file)
index 0000000..7a87cb6
--- /dev/null
@@ -0,0 +1,49 @@
+Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800pci.c
+===================================================================
+--- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2800pci.c    2013-03-31 19:25:51.185815171 +0200
++++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800pci.c 2013-03-31 19:27:59.805818237 +0200
+@@ -1179,7 +1179,7 @@
+ #endif /* CONFIG_PCI */
+ MODULE_LICENSE("GPL");
+-#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
++#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
+ static int rt2800soc_probe(struct platform_device *pdev)
+ {
+       return rt2x00soc_probe(pdev, &rt2800pci_ops);
+@@ -1203,7 +1203,7 @@
+       .suspend        = rt2x00soc_suspend,
+       .resume         = rt2x00soc_resume,
+ };
+-#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */
++#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
+ #ifdef CONFIG_PCI
+ static int rt2800pci_probe(struct pci_dev *pci_dev,
+@@ -1226,7 +1226,7 @@
+ {
+       int ret = 0;
+-#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
++#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
+       ret = platform_driver_register(&rt2800soc_driver);
+       if (ret)
+               return ret;
+@@ -1234,7 +1234,7 @@
+ #ifdef CONFIG_PCI
+       ret = pci_register_driver(&rt2800pci_driver);
+       if (ret) {
+-#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
++#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
+               platform_driver_unregister(&rt2800soc_driver);
+ #endif
+               return ret;
+@@ -1249,7 +1249,7 @@
+ #ifdef CONFIG_PCI
+       pci_unregister_driver(&rt2800pci_driver);
+ #endif
+-#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
++#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
+       platform_driver_unregister(&rt2800soc_driver);
+ #endif
+ }
diff --git a/package/mac80211/patches/614-rt2x00-of_load_eeprom_filename.patch b/package/mac80211/patches/614-rt2x00-of_load_eeprom_filename.patch
new file mode 100644 (file)
index 0000000..136bd84
--- /dev/null
@@ -0,0 +1,22 @@
+Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800pci.c
+===================================================================
+--- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2800pci.c    2013-03-31 19:27:59.805818237 +0200
++++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800pci.c 2013-03-31 19:40:07.313835573 +0200
+@@ -322,11 +322,17 @@
+ static char *rt2800pci_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
+ {
+       struct rt2x00_platform_data *pdata;
++      struct device_node *np;
++      char *eep;
+       pdata = rt2x00dev->dev->platform_data;
+       if (pdata)
+               return pdata->eeprom_file_name;
++      np = rt2x00dev->dev->of_node;
++      if (np && !of_property_read_string(np, "ralink,eeprom", &eep))
++              return eep;
++
+       return NULL;
+ }
diff --git a/package/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
new file mode 100644 (file)
index 0000000..281dd2e
--- /dev/null
@@ -0,0 +1,31 @@
+Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800lib.c
+===================================================================
+--- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2800lib.c    2013-04-02 10:56:56.245205151 +0200
++++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800lib.c 2013-04-02 11:24:06.057243987 +0200
+@@ -38,6 +38,7 @@
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
++#include <linux/clk.h>
+ #include "rt2x00.h"
+ #include "rt2800lib.h"
+@@ -5505,13 +5506,14 @@
+ int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
+ {
+-      struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
+       struct hw_mode_spec *spec = &rt2x00dev->spec;
++      struct clk *clk = clk_get(rt2x00dev->dev, NULL);
+-      if (!pdata)
+-              return -EINVAL;
++      if (IS_ERR(clk))
++              return PTR_ERR(clk);
+-      spec->clk_is_20mhz = pdata->clk_is_20mhz;
++      if (clk_get_rate(clk) == 20000000)
++              spec->clk_is_20mhz = 1;
+       return 0;
+ }