Revert "phy: merge and backport phy core from linux kernel 4.1"
[firefly-linux-kernel-4.4.55.git] / drivers / phy / phy-omap-control.c
index a7653d930e6bf492aae1d80c7978f69c0c038f4d..c96e8183a8ffe061e017976daa40632ac5a22c56 100644 (file)
 /**
  * omap_control_pcie_pcs - set the PCS delay count
  * @dev: the control module device
+ * @id: index of the pcie PHY (should be 1 or 2)
  * @delay: 8 bit delay value
  */
-void omap_control_pcie_pcs(struct device *dev, u8 delay)
+void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay)
 {
        u32 val;
        struct omap_control_phy *control_phy;
@@ -54,8 +55,8 @@ void omap_control_pcie_pcs(struct device *dev, u8 delay)
 
        val = readl(control_phy->pcie_pcs);
        val &= ~(OMAP_CTRL_PCIE_PCS_MASK <<
-               OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT);
-       val |= (delay << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT);
+               (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT));
+       val |= delay << (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT);
        writel(val, control_phy->pcie_pcs);
 }
 EXPORT_SYMBOL_GPL(omap_control_pcie_pcs);
@@ -216,6 +217,7 @@ void omap_control_usb_set_mode(struct device *dev,
                return;
 
        ctrl_phy = dev_get_drvdata(dev);
+
        if (!ctrl_phy) {
                dev_err(dev, "Invalid control phy device\n");
                return;
@@ -240,6 +242,8 @@ void omap_control_usb_set_mode(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
 
+#ifdef CONFIG_OF
+
 static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
 static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
 static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
@@ -275,6 +279,8 @@ static const struct of_device_id omap_control_phy_id_table[] = {
        {},
 };
 MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
+#endif
+
 
 static int omap_control_phy_probe(struct platform_device *pdev)
 {
@@ -282,7 +288,8 @@ static int omap_control_phy_probe(struct platform_device *pdev)
        const struct of_device_id *of_id;
        struct omap_control_phy *control_phy;
 
-       of_id = of_match_device(omap_control_phy_id_table, &pdev->dev);
+       of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
+                               &pdev->dev);
        if (!of_id)
                return -EINVAL;
 
@@ -338,7 +345,7 @@ static struct platform_driver omap_control_phy_driver = {
        .probe          = omap_control_phy_probe,
        .driver         = {
                .name   = "omap-control-phy",
-               .of_match_table = omap_control_phy_id_table,
+               .of_match_table = of_match_ptr(omap_control_phy_id_table),
        },
 };