usb: check SoC rev [1/2]
authorhe.he <he.he@amlogic.com>
Fri, 25 Jan 2019 07:44:08 +0000 (15:44 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 31 Jan 2019 08:35:33 +0000 (00:35 -0800)
PD#SWPL-4582

Problem:
Need to check Soc rev to distinguish G12B revB.

Solution:
Check Soc rev set version and phy-interface for g12b revB.

Test: make w400 bootimage

Verify:
pass on W400

Change-Id: I338d7f0eed7bb61660625343404f756f0edf0d54
Signed-off-by: he.he <he.he@amlogic.com>
drivers/amlogic/usb/dwc_otg/310/dwc_otg_driver.c
drivers/amlogic/usb/phy/phy-aml-new-usb2-v2.c

index d4ea816..3ce109b 100644 (file)
@@ -71,6 +71,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/workqueue.h>
+#include <linux/amlogic/cpu_version.h>
 #ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
 #include <linux/amlogic/pm.h>
 #endif
@@ -1058,6 +1059,11 @@ static int dwc_otg_driver_probe(struct platform_device *pdev)
                        if (prop)
                                phy_interface = of_read_ulong(prop, 1);
 
+                       if (is_meson_g12b_cpu()) {
+                               if (!is_meson_rev_a())
+                                       phy_interface = 2;
+                       }
+
                        dwc_otg_module_params.host_rx_fifo_size = dwc_otg_module_params.data_fifo_size / 2;
                        DWC_PRINTF("dwc_otg: %s: type: %d speed: %d, ",
                                s_clock_name, port_type, port_speed);
index 82fc567..787da97 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/usb/phy.h>
 #include <linux/amlogic/usb-v2.h>
+#include <linux/amlogic/cpu_version.h>
 #include "phy-aml-new-usb-v2.h"
 
 struct amlogic_usb_v2  *g_phy2_v2;
@@ -243,6 +244,11 @@ static int amlogic_new_usb2_probe(struct platform_device *pdev)
        else
                phy_version = 0;
 
+       if (is_meson_g12b_cpu()) {
+               if (!is_meson_rev_a())
+                       phy_version = 1;
+       }
+
        phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        phy_base = devm_ioremap_resource(dev, phy_mem);
        if (IS_ERR(phy_base))