misc: set modem interface through uuid
BH Hsieh [Thu, 2 Jul 2015 03:15:32 +0000 (11:15 +0800)]
1. Removed property /modem/nvidia,phy-type
2. Created 3 child nodes for 3 modem interfaces
3. Enable corresponding child node by uuid

Bug 200076665

Change-Id: I6284ba52bd29ff93f01e0d3016b7c9fe39d3bd6f
Signed-off-by: BH Hsieh <bhsieh@nvidia.com>
Reviewed-on: http://git-master/r/747615
(cherry picked from commit a8ca6de12339b55a5b85b327968eab08a9c4a0b3)
Reviewed-on: http://git-master/r/775485
Reviewed-by: Steve Lin <stlin@nvidia.com>
Tested-by: Steve Lin <stlin@nvidia.com>

Documentation/devicetree/bindings/misc/tegra_usb_modem_power.txt
arch/arm64/boot/dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
arch/arm64/boot/dts/tegra210-jetson-cv-p2597-2180-a00.dts
arch/arm64/boot/dts/tegra210-jetson-e-p2595-0000-a00-00.dts
arch/arm64/boot/dts/tegra210-loki-e-p2530-0031-e00-00.dts
arch/arm64/boot/dts/tegra210-platforms/tegra210-modem-common.dtsi
drivers/misc/tegra-baseband/tegra_usb_modem_power.c

index 28f2f32..7d3f86e 100644 (file)
@@ -13,6 +13,12 @@ Required properties:
 - nvidia,boot-gpio: input GPIO for modem COLDBOOT signal.
 - nvidia,mdm-en-gpio: output GPIO for enabling modem.
 - nvidia,reset-gpio: output GPIO for hard resetting modem.
+- nvidia,phy-ehci-hsic:
+- nvidia,phy-xhci-hsic:
+- nvidia,phy-xhci-utmi:
+                       modem interface child nodes, these child nodes are
+                       default disabled, shim will enable corresponding node
+                       based on the uuid passed when flashing.
 
 Optional properties:
 -------------------
@@ -26,7 +32,11 @@ Optional properties:
 - nvidia,num-temp-sensors: integer which specifies temperature sensor count for
                     modem thermal reporting.
 - nvidia,phy-type: integer 0, 1, or 2, which stand for EHCI HSIC, XHCI HSIC,
-                    or XHCI UTMI.
+                    or XHCI UTMI. This property is replaced by modem interface
+                    child nodes nvidia,phy-*hci-* mentioned above since T210.
+                    The reason this property still being kept here is for
+                    T124 & T132 backward compatible. Therefore, this property
+                    has higher priority than nvidia,phy-*hci-* child nodes.
 
 Example:
 
@@ -49,12 +59,22 @@ With all properties defined:
         /* temp sensors count */
         nvidia,num-temp-sensors = <3>;
 
-        /* USB PHY interfaces */
-        nvidia,phy-type = <1>;
-
         /* should be disabled by default. Bootloader will determine if this
            node will be enabled according to TNSPEC. */
         status = "disabled";
+
+        /* modem interface child nodes */
+        nvidia,phy-ehci-hsic {
+            status = "disabled";
+        };
+
+        nvidia,phy-xhci-hsic {
+            status = "disabled";
+        };
+
+        nvidia,phy-xhci-utmi {
+            status = "disabled";
+        };
     };
 
 
index 70b27b5..5e068f7 100644 (file)
                nvidia,edp_limit = <25000>;
        };
 
-       modem {
-               /* using XHCI UTMI */
-               nvidia,phy-type = <2>;
-       };
-
        soctherm@0x700E2000 {
                throttle@oc1 {
                        device_type = "throttlectl";
index 0b95815..8ca07a4 100644 (file)
@@ -37,9 +37,4 @@
                        hardware = "jetson_cv";
                };
        };
-
-       modem {
-               /* using XHCI UTMI */
-               nvidia,phy-type = <2>;
-       };
 };
index 2850606..a74709f 100644 (file)
@@ -32,9 +32,4 @@
                        hardware = "jetson_e";
                };
        };
-
-       modem {
-               /* using XHCI UTMI */
-               nvidia,phy-type = <2>;
-       };
 };
index 875bdc4..d2f21b0 100644 (file)
@@ -35,8 +35,6 @@
        modem {
                /* pre boost regulator gpio */
                nvidia,pre-boost-gpio = <&gpio TEGRA_GPIO(E, 5) GPIO_ACTIVE_HIGH>;
-               /* using XHCI UTMI */
-               nvidia,phy-type = <2>;
        };
 
        xusb@70090000 {
index 64db847..163708b 100644 (file)
                compatible = "nvidia,icera-i500";
                status = "disabled";
 
-               /* use EHCI HSIC */
-               nvidia,phy-type = <0>;
-
                nvidia,boot-gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_LOW>;
                nvidia,mdm-power-report-gpio = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_LOW>;
                nvidia,reset-gpio = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_LOW>;
                nvidia,mdm-en-gpio = <&gpio TEGRA_GPIO(K, 7) GPIO_ACTIVE_HIGH>;
                nvidia,num-temp-sensors = <3>;
+
+               /* modem interface child nodes */
+               nvidia,phy-ehci-hsic {
+                       status = "disabled";
+               };
+
+               nvidia,phy-xhci-hsic {
+                       status = "disabled";
+               };
+
+               nvidia,phy-xhci-utmi {
+                       status = "disabled";
+               };
        };
 };
index 47c3d92..f516975 100644 (file)
@@ -880,9 +880,11 @@ static int tegra_usb_modem_parse_dt(struct tegra_usb_modem *modem,
 {
        struct tegra_usb_modem_power_platform_data pdata;
        struct device_node *node = pdev->dev.of_node;
+       struct device_node *phy_node;
        const unsigned int *prop;
        int gpio;
        int ret;
+       const char *node_status;
 
        if (!node) {
                dev_err(&pdev->dev, "Missing device tree node\n");
@@ -932,9 +934,47 @@ static int tegra_usb_modem_parse_dt(struct tegra_usb_modem *modem,
        }
 
        /* determine phy type */
+       modem->phy_type = -1;
        ret = of_property_read_u32(node, "nvidia,phy-type", &modem->phy_type);
-       if (ret != 0) {
-               dev_err(&pdev->dev, "DT property 'nvidia,phy-type' read fail!\n");
+       if (0 == ret) {
+               dev_info(&pdev->dev,
+                       "set phy type with property 'nvidia,phy-type'\n");
+       } else {
+               dev_info(&pdev->dev,
+                       "set phy type with child node 'nvidia,phy-*hci-*'\n");
+               for_each_child_of_node(node, phy_node) {
+                       ret = of_property_read_string(phy_node,
+                                                       "status", &node_status);
+                       if (ret != 0) {
+                               dev_err(&pdev->dev,
+                                       "DT property '%s/status' read fail!\n",
+                                       phy_node->full_name);
+                               goto error;
+                       }
+
+                       if (strcmp(node_status, "okay") == 0) {
+                               if (strcmp(phy_node->name,
+                                               "nvidia,phy-ehci-hsic") == 0)
+                                       modem->phy_type = EHCI_HSIC;
+                               else if (strcmp(phy_node->name,
+                                               "nvidia,phy-xhci-hsic") == 0)
+                                       modem->phy_type = XHCI_HSIC;
+                               else if (strcmp(phy_node->name,
+                                               "nvidia,phy-xhci-utmi") == 0)
+                                       modem->phy_type = XHCI_UTMI;
+                               else {
+                                       dev_err(&pdev->dev,
+                                               "Unrecognized phy type node!!\n");
+                                       ret = -EINVAL;
+                                       goto error;
+                               }
+                       }
+               }
+       }
+       if (-1 == modem->phy_type) {
+               dev_err(&pdev->dev,
+                       "Unable to set phy type!!\n");
+               ret = -EINVAL;
                goto error;
        }