diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-05 13:12:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-05 13:12:23 -0400 |
commit | 0a1b6f63198f6e51d12c8d8c4ed4e7d759b3b73d (patch) | |
tree | c1abeac7eef4a6c3d25c25fcce3a727285e70e55 | |
parent | ffe5adcb7661d94e952d6b5ed7f493cb4ef0c7bc (diff) | |
parent | 257d5d9a9f19ee6c6801589c74791d5422c374e9 (diff) |
Merge tag 'phy-for-4.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-linus
Kishon writes:
phy: for 4.2-rc6
*) Fix compiler error when sun4i usb phy driver is built as module
*) Fix SATA Lockup issue in dra7 SoC
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-rw-r--r-- | Documentation/devicetree/bindings/phy/ti-phy.txt | 16 | ||||
-rw-r--r-- | arch/arm/boot/dts/dra7.dtsi | 1 | ||||
-rw-r--r-- | drivers/phy/phy-sun4i-usb.c | 1 | ||||
-rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 61 |
4 files changed, 73 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt index 305e3df3d9b1..9cf9446eaf2e 100644 --- a/Documentation/devicetree/bindings/phy/ti-phy.txt +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt | |||
@@ -82,6 +82,9 @@ Optional properties: | |||
82 | - id: If there are multiple instance of the same type, in order to | 82 | - id: If there are multiple instance of the same type, in order to |
83 | differentiate between each instance "id" can be used (e.g., multi-lane PCIe | 83 | differentiate between each instance "id" can be used (e.g., multi-lane PCIe |
84 | PHY). If "id" is not provided, it is set to default value of '1'. | 84 | PHY). If "id" is not provided, it is set to default value of '1'. |
85 | - syscon-pllreset: Handle to system control region that contains the | ||
86 | CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 | ||
87 | register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy. | ||
85 | 88 | ||
86 | This is usually a subnode of ocp2scp to which it is connected. | 89 | This is usually a subnode of ocp2scp to which it is connected. |
87 | 90 | ||
@@ -100,3 +103,16 @@ usb3phy@4a084400 { | |||
100 | "sysclk", | 103 | "sysclk", |
101 | "refclk"; | 104 | "refclk"; |
102 | }; | 105 | }; |
106 | |||
107 | sata_phy: phy@4A096000 { | ||
108 | compatible = "ti,phy-pipe3-sata"; | ||
109 | reg = <0x4A096000 0x80>, /* phy_rx */ | ||
110 | <0x4A096400 0x64>, /* phy_tx */ | ||
111 | <0x4A096800 0x40>; /* pll_ctrl */ | ||
112 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; | ||
113 | ctrl-module = <&omap_control_sata>; | ||
114 | clocks = <&sys_clkin1>, <&sata_ref_clk>; | ||
115 | clock-names = "sysclk", "refclk"; | ||
116 | syscon-pllreset = <&scm_conf 0x3fc>; | ||
117 | #phy-cells = <0>; | ||
118 | }; | ||
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 8f1e25bcecbd..4a0718ccf68e 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -1140,6 +1140,7 @@ | |||
1140 | ctrl-module = <&omap_control_sata>; | 1140 | ctrl-module = <&omap_control_sata>; |
1141 | clocks = <&sys_clkin1>, <&sata_ref_clk>; | 1141 | clocks = <&sys_clkin1>, <&sata_ref_clk>; |
1142 | clock-names = "sysclk", "refclk"; | 1142 | clock-names = "sysclk", "refclk"; |
1143 | syscon-pllreset = <&scm_conf 0x3fc>; | ||
1143 | #phy-cells = <0>; | 1144 | #phy-cells = <0>; |
1144 | }; | 1145 | }; |
1145 | 1146 | ||
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index e17c539e4f6f..2dad7e820ff0 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
@@ -212,6 +212,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled) | |||
212 | 212 | ||
213 | sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2); | 213 | sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2); |
214 | } | 214 | } |
215 | EXPORT_SYMBOL_GPL(sun4i_usb_phy_set_squelch_detect); | ||
215 | 216 | ||
216 | static struct phy_ops sun4i_usb_phy_ops = { | 217 | static struct phy_ops sun4i_usb_phy_ops = { |
217 | .init = sun4i_usb_phy_init, | 218 | .init = sun4i_usb_phy_init, |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 3510b81db3fa..08020dc2c7c8 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/phy/omap_control_phy.h> | 29 | #include <linux/phy/omap_control_phy.h> |
30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
31 | #include <linux/mfd/syscon.h> | ||
32 | #include <linux/regmap.h> | ||
31 | 33 | ||
32 | #define PLL_STATUS 0x00000004 | 34 | #define PLL_STATUS 0x00000004 |
33 | #define PLL_GO 0x00000008 | 35 | #define PLL_GO 0x00000008 |
@@ -52,6 +54,8 @@ | |||
52 | #define PLL_LOCK 0x2 | 54 | #define PLL_LOCK 0x2 |
53 | #define PLL_IDLE 0x1 | 55 | #define PLL_IDLE 0x1 |
54 | 56 | ||
57 | #define SATA_PLL_SOFT_RESET BIT(18) | ||
58 | |||
55 | /* | 59 | /* |
56 | * This is an Empirical value that works, need to confirm the actual | 60 | * This is an Empirical value that works, need to confirm the actual |
57 | * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status | 61 | * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status |
@@ -82,6 +86,9 @@ struct ti_pipe3 { | |||
82 | struct clk *refclk; | 86 | struct clk *refclk; |
83 | struct clk *div_clk; | 87 | struct clk *div_clk; |
84 | struct pipe3_dpll_map *dpll_map; | 88 | struct pipe3_dpll_map *dpll_map; |
89 | struct regmap *dpll_reset_syscon; /* ctrl. reg. acces */ | ||
90 | unsigned int dpll_reset_reg; /* reg. index within syscon */ | ||
91 | bool sata_refclk_enabled; | ||
85 | }; | 92 | }; |
86 | 93 | ||
87 | static struct pipe3_dpll_map dpll_map_usb[] = { | 94 | static struct pipe3_dpll_map dpll_map_usb[] = { |
@@ -249,8 +256,11 @@ static int ti_pipe3_exit(struct phy *x) | |||
249 | u32 val; | 256 | u32 val; |
250 | unsigned long timeout; | 257 | unsigned long timeout; |
251 | 258 | ||
252 | /* SATA DPLL can't be powered down due to Errata i783 */ | 259 | /* If dpll_reset_syscon is not present we wont power down SATA DPLL |
253 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) | 260 | * due to Errata i783 |
261 | */ | ||
262 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") && | ||
263 | !phy->dpll_reset_syscon) | ||
254 | return 0; | 264 | return 0; |
255 | 265 | ||
256 | /* PCIe doesn't have internal DPLL */ | 266 | /* PCIe doesn't have internal DPLL */ |
@@ -276,6 +286,14 @@ static int ti_pipe3_exit(struct phy *x) | |||
276 | } | 286 | } |
277 | } | 287 | } |
278 | 288 | ||
289 | /* i783: SATA needs control bit toggle after PLL unlock */ | ||
290 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) { | ||
291 | regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, | ||
292 | SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET); | ||
293 | regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, | ||
294 | SATA_PLL_SOFT_RESET, 0); | ||
295 | } | ||
296 | |||
279 | ti_pipe3_disable_clocks(phy); | 297 | ti_pipe3_disable_clocks(phy); |
280 | 298 | ||
281 | return 0; | 299 | return 0; |
@@ -350,6 +368,21 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
350 | } | 368 | } |
351 | } else { | 369 | } else { |
352 | phy->wkupclk = ERR_PTR(-ENODEV); | 370 | phy->wkupclk = ERR_PTR(-ENODEV); |
371 | phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node, | ||
372 | "syscon-pllreset"); | ||
373 | if (IS_ERR(phy->dpll_reset_syscon)) { | ||
374 | dev_info(&pdev->dev, | ||
375 | "can't get syscon-pllreset, sata dpll won't idle\n"); | ||
376 | phy->dpll_reset_syscon = NULL; | ||
377 | } else { | ||
378 | if (of_property_read_u32_index(node, | ||
379 | "syscon-pllreset", 1, | ||
380 | &phy->dpll_reset_reg)) { | ||
381 | dev_err(&pdev->dev, | ||
382 | "couldn't get pllreset reg. offset\n"); | ||
383 | return -EINVAL; | ||
384 | } | ||
385 | } | ||
353 | } | 386 | } |
354 | 387 | ||
355 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 388 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
@@ -402,10 +435,16 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
402 | 435 | ||
403 | platform_set_drvdata(pdev, phy); | 436 | platform_set_drvdata(pdev, phy); |
404 | pm_runtime_enable(phy->dev); | 437 | pm_runtime_enable(phy->dev); |
405 | /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */ | 438 | |
406 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) | 439 | /* |
407 | if (!IS_ERR(phy->refclk)) | 440 | * Prevent auto-disable of refclk for SATA PHY due to Errata i783 |
441 | */ | ||
442 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) { | ||
443 | if (!IS_ERR(phy->refclk)) { | ||
408 | clk_prepare_enable(phy->refclk); | 444 | clk_prepare_enable(phy->refclk); |
445 | phy->sata_refclk_enabled = true; | ||
446 | } | ||
447 | } | ||
409 | 448 | ||
410 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); | 449 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); |
411 | if (IS_ERR(generic_phy)) | 450 | if (IS_ERR(generic_phy)) |
@@ -472,8 +511,18 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) | |||
472 | { | 511 | { |
473 | if (!IS_ERR(phy->wkupclk)) | 512 | if (!IS_ERR(phy->wkupclk)) |
474 | clk_disable_unprepare(phy->wkupclk); | 513 | clk_disable_unprepare(phy->wkupclk); |
475 | if (!IS_ERR(phy->refclk)) | 514 | if (!IS_ERR(phy->refclk)) { |
476 | clk_disable_unprepare(phy->refclk); | 515 | clk_disable_unprepare(phy->refclk); |
516 | /* | ||
517 | * SATA refclk needs an additional disable as we left it | ||
518 | * on in probe to avoid Errata i783 | ||
519 | */ | ||
520 | if (phy->sata_refclk_enabled) { | ||
521 | clk_disable_unprepare(phy->refclk); | ||
522 | phy->sata_refclk_enabled = false; | ||
523 | } | ||
524 | } | ||
525 | |||
477 | if (!IS_ERR(phy->div_clk)) | 526 | if (!IS_ERR(phy->div_clk)) |
478 | clk_disable_unprepare(phy->div_clk); | 527 | clk_disable_unprepare(phy->div_clk); |
479 | } | 528 | } |