MIPS: lantiq: add support for xrx200 firmware depending on soc type
authorJohn Crispin <blogic@openwrt.org>
Wed, 10 Sep 2014 20:39:19 +0000 (22:39 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2014 06:45:17 +0000 (07:45 +0100)
VR9 needs different firmware files for the various phy/soc revisions. Some
boards are ship with older and newer SoC revisions. To be able to boot a single
image on all versions we need to define both firmware files inside the
devicetree.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/8045/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/lantiq/xway/xrx200_phy_fw.c

index d4d9d31f152e403ae40a8246fbc2ba665a8521ee..7c1e54c6a36c5e4d6e6b3b93118df6207ba10f1d 100644 (file)
@@ -24,7 +24,28 @@ static dma_addr_t xway_gphy_load(struct platform_device *pdev)
        void *fw_addr;
        size_t size;
 
-       if (of_property_read_string(pdev->dev.of_node, "firmware", &fw_name)) {
+       if (of_get_property(pdev->dev.of_node, "firmware1", NULL) ||
+               of_get_property(pdev->dev.of_node, "firmware2", NULL)) {
+               switch (ltq_soc_type()) {
+               case SOC_TYPE_VR9:
+                       if (of_property_read_string(pdev->dev.of_node,
+                                                   "firmware1", &fw_name)) {
+                               dev_err(&pdev->dev,
+                                       "failed to load firmware filename\n");
+                               return 0;
+                       }
+                       break;
+               case SOC_TYPE_VR9_2:
+                       if (of_property_read_string(pdev->dev.of_node,
+                                                   "firmware2", &fw_name)) {
+                               dev_err(&pdev->dev,
+                                       "failed to load firmware filename\n");
+                               return 0;
+                       }
+                       break;
+               }
+       } else if (of_property_read_string(pdev->dev.of_node,
+                                        "firmware", &fw_name)) {
                dev_err(&pdev->dev, "failed to load firmware filename\n");
                return 0;
        }