diff options
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-omap-control.c | 52 | ||||
-rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 4 |
2 files changed, 54 insertions, 2 deletions
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c index 311b4f9a5132..9487bf112267 100644 --- a/drivers/phy/phy-omap-control.c +++ b/drivers/phy/phy-omap-control.c | |||
@@ -27,6 +27,41 @@ | |||
27 | #include <linux/phy/omap_control_phy.h> | 27 | #include <linux/phy/omap_control_phy.h> |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * omap_control_pcie_pcs - set the PCS delay count | ||
31 | * @dev: the control module device | ||
32 | * @id: index of the pcie PHY (should be 1 or 2) | ||
33 | * @delay: 8 bit delay value | ||
34 | */ | ||
35 | void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | ||
36 | { | ||
37 | u32 val; | ||
38 | struct omap_control_phy *control_phy; | ||
39 | |||
40 | if (IS_ERR(dev) || !dev) { | ||
41 | pr_err("%s: invalid device\n", __func__); | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | control_phy = dev_get_drvdata(dev); | ||
46 | if (!control_phy) { | ||
47 | dev_err(dev, "%s: invalid control phy device\n", __func__); | ||
48 | return; | ||
49 | } | ||
50 | |||
51 | if (control_phy->type != OMAP_CTRL_TYPE_PCIE) { | ||
52 | dev_err(dev, "%s: unsupported operation\n", __func__); | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | val = readl(control_phy->pcie_pcs); | ||
57 | val &= ~(OMAP_CTRL_PCIE_PCS_MASK << | ||
58 | (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT)); | ||
59 | val |= delay << (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); | ||
60 | writel(val, control_phy->pcie_pcs); | ||
61 | } | ||
62 | EXPORT_SYMBOL_GPL(omap_control_pcie_pcs); | ||
63 | |||
64 | /** | ||
30 | * omap_control_phy_power - power on/off the phy using control module reg | 65 | * omap_control_phy_power - power on/off the phy using control module reg |
31 | * @dev: the control module device | 66 | * @dev: the control module device |
32 | * @on: 0 or 1, based on powering on or off the PHY | 67 | * @on: 0 or 1, based on powering on or off the PHY |
@@ -61,6 +96,7 @@ void omap_control_phy_power(struct device *dev, int on) | |||
61 | val |= OMAP_CTRL_DEV_PHY_PD; | 96 | val |= OMAP_CTRL_DEV_PHY_PD; |
62 | break; | 97 | break; |
63 | 98 | ||
99 | case OMAP_CTRL_TYPE_PCIE: | ||
64 | case OMAP_CTRL_TYPE_PIPE3: | 100 | case OMAP_CTRL_TYPE_PIPE3: |
65 | rate = clk_get_rate(control_phy->sys_clk); | 101 | rate = clk_get_rate(control_phy->sys_clk); |
66 | rate = rate/1000000; | 102 | rate = rate/1000000; |
@@ -211,6 +247,7 @@ EXPORT_SYMBOL_GPL(omap_control_usb_set_mode); | |||
211 | static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS; | 247 | static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS; |
212 | static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2; | 248 | static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2; |
213 | static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3; | 249 | static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3; |
250 | static const enum omap_control_phy_type pcie_data = OMAP_CTRL_TYPE_PCIE; | ||
214 | static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2; | 251 | static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2; |
215 | static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2; | 252 | static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2; |
216 | 253 | ||
@@ -228,6 +265,10 @@ static const struct of_device_id omap_control_phy_id_table[] = { | |||
228 | .data = &pipe3_data, | 265 | .data = &pipe3_data, |
229 | }, | 266 | }, |
230 | { | 267 | { |
268 | .compatible = "ti,control-phy-pcie", | ||
269 | .data = &pcie_data, | ||
270 | }, | ||
271 | { | ||
231 | .compatible = "ti,control-phy-usb2-dra7", | 272 | .compatible = "ti,control-phy-usb2-dra7", |
232 | .data = &dra7usb2_data, | 273 | .data = &dra7usb2_data, |
233 | }, | 274 | }, |
@@ -279,7 +320,8 @@ static int omap_control_phy_probe(struct platform_device *pdev) | |||
279 | } | 320 | } |
280 | } | 321 | } |
281 | 322 | ||
282 | if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) { | 323 | if (control_phy->type == OMAP_CTRL_TYPE_PIPE3 || |
324 | control_phy->type == OMAP_CTRL_TYPE_PCIE) { | ||
283 | control_phy->sys_clk = devm_clk_get(control_phy->dev, | 325 | control_phy->sys_clk = devm_clk_get(control_phy->dev, |
284 | "sys_clkin"); | 326 | "sys_clkin"); |
285 | if (IS_ERR(control_phy->sys_clk)) { | 327 | if (IS_ERR(control_phy->sys_clk)) { |
@@ -288,6 +330,14 @@ static int omap_control_phy_probe(struct platform_device *pdev) | |||
288 | } | 330 | } |
289 | } | 331 | } |
290 | 332 | ||
333 | if (control_phy->type == OMAP_CTRL_TYPE_PCIE) { | ||
334 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
335 | "pcie_pcs"); | ||
336 | control_phy->pcie_pcs = devm_ioremap_resource(&pdev->dev, res); | ||
337 | if (IS_ERR(control_phy->pcie_pcs)) | ||
338 | return PTR_ERR(control_phy->pcie_pcs); | ||
339 | } | ||
340 | |||
291 | dev_set_drvdata(control_phy->dev, control_phy); | 341 | dev_set_drvdata(control_phy->dev, control_phy); |
292 | 342 | ||
293 | return 0; | 343 | return 0; |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 6174f4b1a5de..93bcd67f1b22 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -217,8 +217,10 @@ static int ti_pipe3_init(struct phy *x) | |||
217 | u32 val; | 217 | u32 val; |
218 | int ret = 0; | 218 | int ret = 0; |
219 | 219 | ||
220 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) | 220 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { |
221 | omap_control_pcie_pcs(phy->control_dev, phy->id, 0xF1); | ||
221 | return 0; | 222 | return 0; |
223 | } | ||
222 | 224 | ||
223 | /* Bring it out of IDLE if it is IDLE */ | 225 | /* Bring it out of IDLE if it is IDLE */ |
224 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); | 226 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); |