phy: for 3.20 merge window
Subsystems (5)
Hi Greg,
Please find the PULL REQUEST for 3.20 merge window. It's a rather short pull request which includes a new PHY driver for rockchip and contains few misc fixes.
There is a patch which modifies the dt data for stih416 and I've included it in this pull request after getting ack from STI maintainer (Maxime Coquelin).
Let me know If I have to change something.
Cheers
Kishon
The following changes since commit ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc:
Linux 3.19-rc5 (2015-01-18 18:02:20 +1200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/for-3.20
for you to fetch changes up to bbd3ce86c768928d5db334881e20116c6da4d0c7:
phy: miphy365x: Pass sysconfig register offsets via syscfg dt property. (2015-01-30 18:12:05 +0530)
----------------------------------------------------------------
Adds a new Rockchip PHY driver and contains miscellaneous fixes.
----------------------------------------------------------------
Gabriel FERNANDEZ (1):
phy: miphy28lp: Pass sysconfig register offsets via syscfg dt property.
Peter Griffin (2):
phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property.
phy: miphy365x: Pass sysconfig register offsets via syscfg dt property.
Roger Quadros (2):
phy: ti-pipe3: Disable clocks on system suspend
phy: ti-pipe3: Fix SATA across suspend/resume
Sylwester Nawrocki (1):
phy: exynos-video-mipi: Fix regression by adding support for PMU regmap
Wei Yongjun (1):
phy: fix return value check in armada375_usb_phy_probe()
Yunzhi Li (2):
Documentation: bindings: add dt documentation for Rockchip usb PHY
phy: add a driver for the Rockchip SoC internal USB2.0 PHY
.../devicetree/bindings/phy/phy-miphy28lp.txt | 43 ++---- .../devicetree/bindings/phy/phy-miphy365x.txt | 15 +- .../devicetree/bindings/phy/phy-stih407-usb.txt | 10 +- .../devicetree/bindings/phy/rockchip-usb-phy.txt | 37 +++++ .../devicetree/bindings/phy/samsung-phy.txt | 2 +- arch/arm/boot/dts/stih416.dtsi | 10 +- drivers/phy/Kconfig | 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-armada375-usb2.c | 4 +- drivers/phy/phy-exynos-mipi-video.c | 89 +++++++---- drivers/phy/phy-miphy28lp.c | 61 ++++---- drivers/phy/phy-miphy365x.c | 29 ++-- drivers/phy/phy-rockchip-usb.c | 158 ++++++++++++++++++++ drivers/phy/phy-stih407-usb.c | 25 ++-- drivers/phy/phy-ti-pipe3.c | 143 ++++++++++++++---- include/linux/mfd/syscon/exynos4-pmu.h | 21 +++ 16 files changed, 483 insertions(+), 172 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt create mode 100644 drivers/phy/phy-rockchip-usb.c create mode 100644 include/linux/mfd/syscon/exynos4-pmu.h
Signature · 1 line
1.7.9.5
PATCH 1/9 phy: ti-pipe3: Disable clocks on system suspend
From: Roger Quadros <[email protected]>
On system suspend, the runtime_suspend() driver hook doesn't get called for USB phy and so the clocks are not disabled in the driver. This causes the L3INIT_960M_GFCLK and L3INIT_480M_GFCLK to remain active on the DRA7 platform while in system suspend.
In case of pcie-phy, the runtime_suspend hook gets called after the suspend hook so we introduce a flag phy->enabled to keep track if our clocks are enabled or not to prevent multiple enable/disables.
Add suspend/resume hooks to the driver.
Move enabling/disabling clock code into helper functions.
--- drivers/phy/phy-ti-pipe3.c | 99 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 77 insertions(+), 22 deletions(-)
drivers/phy/phy-ti-pipe3.c +77 -22
@@ -28,6 +28,7 @@#include <linux/delay.h> #include <linux/phy/omap_control_phy.h> #include <linux/of_platform.h> +#include <linux/spinlock.h> #define PLL_STATUS 0x00000004#define PLL_GO 0x00000008
@@ -82,6 +83,8 @@ struct ti_pipe3 {struct clk *refclk;struct clk *div_clk;struct pipe3_dpll_map *dpll_map; +bool enabled; +spinlock_t lock;/* serialize clock enable/disable */ };static struct pipe3_dpll_map dpll_map_usb[] = {
@@ -307,6 +310,7 @@ static int ti_pipe3_probe(struct platform_device *pdev)return -ENOMEM ; phy->dev = &pdev->dev; +spin_lock_init (&phy->lock);if (!of_device_is_compatible (node,"ti,phy-pipe3-pcie" )) { match = of_match_device(of_match_ptr(ti_pipe3_id_table),
@@ -427,24 +431,14 @@ static int ti_pipe3_remove(struct platform_device *pdev)#ifdef CONFIG_PM -static int ti_pipe3_runtime_suspend (struct device *dev) +static int ti_pipe3_enable_clocks (struct ti_pipe3 *phy) { -struct ti_pipe3 *phy =dev_get_drvdata (dev); - -if (!IS_ERR (phy->wkupclk)) -clk_disable_unprepare (phy->wkupclk); -if (!IS_ERR (phy->refclk)) -clk_disable_unprepare (phy->refclk); -if (!IS_ERR (phy->div_clk)) -clk_disable_unprepare (phy->div_clk); - -return 0 ; -} +int ret =0 ; +unsigned long flags; -static int ti_pipe3_runtime_resume (struct device *dev) -{ -u32 ret =0 ; -struct ti_pipe3 *phy =dev_get_drvdata (dev); +spin_lock_irqsave (&phy->lock, flags); +if (phy->enabled) + goto err1;if (!IS_ERR (phy->refclk)) { ret =clk_prepare_enable (phy->refclk);
@@ -469,6 +463,9 @@ static int ti_pipe3_runtime_resume(struct device *dev) goto err3; } } + + phy->enabled = true; +spin_unlock_irqrestore (&phy->lock, flags);return 0 ; err3:
@@ -480,19 +477,77 @@ err2:clk_disable_unprepare (phy->refclk); err1: +spin_unlock_irqrestore (&phy->lock, flags); +return ret; +} + +static void ti_pipe3_disable_clocks (struct ti_pipe3 *phy) +{ +unsigned long flags; + +spin_lock_irqsave (&phy->lock, flags); +if (!phy->enabled) { +spin_unlock_irqrestore (&phy->lock, flags); +return ; + } + +if (!IS_ERR (phy->wkupclk)) +clk_disable_unprepare (phy->wkupclk); +if (!IS_ERR (phy->refclk)) +clk_disable_unprepare (phy->refclk); +if (!IS_ERR (phy->div_clk)) +clk_disable_unprepare (phy->div_clk); + phy->enabled = false; +spin_unlock_irqrestore (&phy->lock, flags); +} + +static int ti_pipe3_runtime_suspend (struct device *dev) +{ +struct ti_pipe3 *phy =dev_get_drvdata (dev); + +ti_pipe3_disable_clocks (phy); +return 0 ; +} + +static int ti_pipe3_runtime_resume (struct device *dev) +{ +struct ti_pipe3 *phy =dev_get_drvdata (dev); +int ret =0 ; + + ret =ti_pipe3_enable_clocks (phy);return ret; } +static int ti_pipe3_suspend (struct device *dev) +{ +struct ti_pipe3 *phy =dev_get_drvdata (dev); + +ti_pipe3_disable_clocks (phy); +return 0 ; +} + +static int ti_pipe3_resume (struct device *dev) +{ +struct ti_pipe3 *phy =dev_get_drvdata (dev); +int ret; + + ret =ti_pipe3_enable_clocks (phy); +if (ret) +return ret; + +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); +return 0 ; +} +#endif +static const struct dev_pm_ops ti_pipe3_pm_ops = { SET_RUNTIME_PM_OPS(ti_pipe3_runtime_suspend, ti_pipe3_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (ti_pipe3_suspend, ti_pipe3_resume) }; -#define DEV_PM_OPS (&ti_pipe3_pm_ops) -#else -#define DEV_PM_OPS NULL -#endif - #ifdef CONFIG_OF static const struct of_device_id ti_pipe3_id_table[] = { {
@@ -520,7 +575,7 @@ static struct platform_driver ti_pipe3_driver = { .remove = ti_pipe3_remove, .driver = { .name = "ti-pipe3", - .pm = DEV_PM_OPS, + .pm = &ti_pipe3_pm_ops, .of_match_table = of_match_ptr(ti_pipe3_id_table), }, };
Signature · 1 line
1.7.9.5
PATCH 2/9 phy: ti-pipe3: Fix SATA across suspend/resume
In reply to Kishon Vijay Abraham IFrom: Roger Quadros <[email protected]>
Failed test case: Boot without SATA drive connected. Suspend/resume the board and then connect SATA drive. It fails to enumerate.
Due to Errata i783 "SATA Lockup After SATA DPLL Unlock/Relock" we can't allow SATA DPLL to be in the unlocked state.
The SATA refclk (sata_ref_clk) is the source of the SATA_DPLL. This clock is being controlled only by the AHCI SATA driver and is shut off during system suspend (if the SATA drive was not already attached) causing the SATA DPLL to be unlocked and so causing errata i783.
To prevent sata_ref_clk from being disabled, we add the control of this clock to the SATA PHY driver and prevent it from being disabled.
This also fixes the issue of SATA not working on OMAP5/DRA7 when AHCI platform driver is built as a module.
NOTE: Device tree changes also required for OMAP5 & DRA7.
--- drivers/phy/phy-ti-pipe3.c | 58 ++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 16 deletions(-)
drivers/phy/phy-ti-pipe3.c +42 -16
@@ -85,6 +85,8 @@ struct ti_pipe3 {struct pipe3_dpll_map *dpll_map;bool enabled;spinlock_t lock;/* serialize clock enable/disable */ +/* the below flag is needed specifically for SATA */ +bool refclk_enabled; };static struct pipe3_dpll_map dpll_map_usb[] = {
@@ -337,21 +339,24 @@ static int ti_pipe3_probe(struct platform_device *pdev) } } + phy->refclk =devm_clk_get (phy->dev,"refclk" ); +if (IS_ERR (phy->refclk)) { +dev_err (&pdev->dev,"unable to get refclk\n" ); +/* older DTBs have missing refclk in SATA PHY +* so don't bail out in case of SATA PHY. +*/ +if (!of_device_is_compatible (node,"ti,phy-pipe3-sata" )) +return PTR_ERR (phy->refclk); + } +if (!of_device_is_compatible (node,"ti,phy-pipe3-sata" )) { phy->wkupclk =devm_clk_get (phy->dev,"wkupclk" );if (IS_ERR (phy->wkupclk)) {dev_err (&pdev->dev,"unable to get wkupclk\n" );return PTR_ERR (phy->wkupclk); } - - phy->refclk =devm_clk_get (phy->dev,"refclk" ); -if (IS_ERR (phy->refclk)) { -dev_err (&pdev->dev,"unable to get refclk\n" ); -return PTR_ERR (phy->refclk); - } }else { phy->wkupclk =ERR_PTR (-ENODEV ); - phy->refclk =ERR_PTR (-ENODEV ); }if (of_device_is_compatible (node,"ti,phy-pipe3-pcie" )) {
@@ -430,6 +435,29 @@ static int ti_pipe3_remove(struct platform_device *pdev) }#ifdef CONFIG_PM +static int ti_pipe3_enable_refclk (struct ti_pipe3 *phy) +{ +if (!IS_ERR (phy->refclk) && !phy->refclk_enabled) { +int ret; + + ret =clk_prepare_enable (phy->refclk); +if (ret) { +dev_err (phy->dev,"Failed to enable refclk %d\n" , ret); +return ret; + } + phy->refclk_enabled = true; + } + +return 0 ; +} + +static void ti_pipe3_disable_refclk (struct ti_pipe3 *phy) +{ +if (!IS_ERR (phy->refclk)) +clk_disable_unprepare (phy->refclk); + + phy->refclk_enabled = false; +}static int ti_pipe3_enable_clocks (struct ti_pipe3 *phy) {
@@ -440,13 +468,9 @@ static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy)if (phy->enabled) goto err1; -if (!IS_ERR (phy->refclk)) { - ret =clk_prepare_enable (phy->refclk); -if (ret) { -dev_err (phy->dev,"Failed to enable refclk %d\n" , ret); - goto err1; - } - } + ret =ti_pipe3_enable_refclk (phy); +if (ret) + goto err1;if (!IS_ERR (phy->wkupclk)) { ret =clk_prepare_enable (phy->wkupclk);
@@ -476,6 +500,7 @@ err2:if (!IS_ERR (phy->refclk))clk_disable_unprepare (phy->refclk); +ti_pipe3_disable_refclk (phy); err1:spin_unlock_irqrestore (&phy->lock, flags);return ret;
@@ -493,8 +518,9 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy)if (!IS_ERR (phy->wkupclk))clk_disable_unprepare (phy->wkupclk); -if (!IS_ERR (phy->refclk)) -clk_disable_unprepare (phy->refclk); +/* Don't disable refclk for SATA PHY due to Errata i783 */ +if (!of_device_is_compatible (phy->dev->of_node,"ti,phy-pipe3-sata" )) +ti_pipe3_disable_refclk (phy);if (!IS_ERR (phy->div_clk))clk_disable_unprepare (phy->div_clk); phy->enabled = false;
Signature · 1 line
1.7.9.5
PATCH 3/9 phy: fix return value check in armada375_usb_phy_probe()
In reply to Kishon Vijay Abraham IFrom: Wei Yongjun <[email protected]>
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().
--- drivers/phy/phy-armada375-usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-armada375-usb2.c +2 -2
@@ -118,8 +118,8 @@ static int armada375_usb_phy_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); usb_cluster_base =devm_ioremap_resource (&pdev->dev, res); -if (!usb_cluster_base) -return -ENOMEM ; +if (IS_ERR (usb_cluster_base)) +return PTR_ERR (usb_cluster_base); phy =devm_phy_create (dev,NULL , &armada375_usb_phy_ops);if (IS_ERR (phy)) {
Signature · 1 line
1.7.9.5
PATCH 4/9 phy: miphy28lp: Pass sysconfig register offsets via syscfg dt property.
In reply to Kishon Vijay Abraham IFrom: Gabriel FERNANDEZ <[email protected]>
Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161,
update the miphy28lp phy driver to access sysconfig register offsets via syscfg dt property.
This is because the reg property should not be mixing address spaces like it does currently for miphy28lp. This change then also aligns us to how other platforms such as keystone and bcm7445 pass there syscon offsets via DT.
I have updated the miphy28lp phy driver same way as Peter's implementation.
--- .../devicetree/bindings/phy/phy-miphy28lp.txt | 43 +++++--------- drivers/phy/phy-miphy28lp.c | 61 ++++++++++---------- 2 files changed, 48 insertions(+), 56 deletions(-)
Documentation/devicetree/bindings/phy/phy-miphy28lp.txt +16 -27
@@ -26,6 +26,7 @@ Required properties (port (child) node): filled in "reg". It can also contain the offset of the system configuration registers used as glue-logic to setup the device for SATA/PCIe or USB3 devices. +- st,syscfg : Offset of the parent configuration register. - resets : phandle to the parent reset controller. - reset-names : Associated name must be "miphy-sw-rst".
@@ -54,18 +55,12 @@ example: phy_port0: port@9b22000 { reg = <0x9b22000 0xff>, <0x9b09000 0xff>, - <0x9b04000 0xff>, - <0x114 0x4>, /* sysctrl MiPHY cntrl */ - <0x818 0x4>, /* sysctrl MiPHY status*/ - <0xe0 0x4>, /* sysctrl PCIe */ - <0xec 0x4>; /* sysctrl SATA */ + <0x9b04000 0xff>; reg-names = "sata-up", "pcie-up", - "pipew", - "miphy-ctrl-glue", - "miphy-status-glue", - "pcie-glue", - "sata-glue"; + "pipew"; + + st,syscfg = <0x114 0x818 0xe0 0xec>; #phy-cells = <1>; st,osc-rdy; reset-names = "miphy-sw-rst";
@@ -75,18 +70,13 @@ example: phy_port1: port@9b2a000 { reg = <0x9b2a000 0xff>, <0x9b19000 0xff>, - <0x9b14000 0xff>, - <0x118 0x4>, - <0x81c 0x4>, - <0xe4 0x4>, - <0xf0 0x4>; + <0x9b14000 0xff>; reg-names = "sata-up", "pcie-up", - "pipew", - "miphy-ctrl-glue", - "miphy-status-glue", - "pcie-glue", - "sata-glue"; + "pipew"; + + st,syscfg = <0x118 0x81c 0xe4 0xf0>; + #phy-cells = <1>; st,osc-force-ext; reset-names = "miphy-sw-rst";
@@ -95,13 +85,12 @@ example: phy_port2: port@8f95000 { reg = <0x8f95000 0xff>, - <0x8f90000 0xff>, - <0x11c 0x4>, - <0x820 0x4>; + <0x8f90000 0xff>; reg-names = "pipew", - "usb3-up", - "miphy-ctrl-glue", - "miphy-status-glue"; + "usb3-up"; + + st,syscfg = <0x11c 0x820>; + #phy-cells = <1>; reset-names = "miphy-sw-rst"; resets = <&softreset STIH407_MIPHY2_SOFTRESET>;
@@ -125,4 +114,4 @@ example: Macro definitions for the supported miphy configuration can be found in: -include/dt-bindings/phy/phy-miphy28lp.h +include/dt-bindings/phy/phy.h
drivers/phy/phy-miphy28lp.c +32 -29
134 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 5/9 phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property.
In reply to Kishon Vijay Abraham IFrom: Peter Griffin <[email protected]>
Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161,
update the phy driver to not use the reg property to access the sysconfig register offsets.
This is because other phy's (miphy28, miphy365) have a combination of memory mapped registers and sysconfig control regs, and we shouldn't be mixing address spaces in the reg property. In addition we would ideally like the sysconfig offsets to be passed via DT in a uniform way.
This new method will also allow us to support devices which have sysconfig registers in different banks more easily and it is also analagous to how keystone and bcm7745 platforms pass there syscon offsets in DT.
This breaks DT compatibility, but this platform is considered WIP, and is only used by a few developers who are upstreaming support for it.
--- .../devicetree/bindings/phy/phy-stih407-usb.txt | 10 ++------ drivers/phy/phy-stih407-usb.c | 25 +++++++++++--------- 2 files changed, 16 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/phy/phy-stih407-usb.txt +2 -8
@@ -5,10 +5,7 @@ host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC fa Required properties: - compatible : should be "st,stih407-usb2-phy" -- reg : contain the offset and length of the system configuration registers - used as glue logic to control & parameter phy -- reg-names : the names of the system configuration registers in "reg", should be "param" and "reg" -- st,syscfg : sysconfig register to manage phy parameter at driver level +- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets - resets : list of phandle and reset specifier pairs. There should be two entries, one for the whole phy and one for the port - reset-names : list of reset signal names. Should be "global" and "port"
@@ -19,11 +16,8 @@ Example: usb2_picophy0: usbpicophy@f8 { compatible = "st,stih407-usb2-phy"; - reg = <0xf8 0x04>, /* syscfg 5062 */ - <0xf4 0x04>; /* syscfg 5061 */ - reg-names = "param", "ctrl"; #phy-cells = <0>; - st,syscfg = <&syscfg_core>; + st,syscfg = <&syscfg_core 0x100 0xf4>; resets = <&softreset STIH407_PICOPHY_SOFTRESET>, <&picophyreset STIH407_PICOPHY0_RESET>; reset-names = "global", "port";
drivers/phy/phy-stih407-usb.c +14 -11
@@ -22,6 +22,9 @@#include <linux/mfd/syscon.h> #include <linux/phy/phy.h> +#define PHYPARAM_REG 1 +#define PHYCTRL_REG 2 +/* Default PHY_SEL and REFCLKSEL configuration */ #define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6#define STIH407_USB_PICOPHY_CTRL_PORT_MASK 0x1f
@@ -93,7 +96,7 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)struct device_node *np = dev->of_node;struct phy_provider *phy_provider;struct phy *phy; -struct resource *res; +int ret; phy_dev =devm_kzalloc (dev,sizeof (*phy_dev),GFP_KERNEL );if (!phy_dev)
@@ -123,19 +126,19 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)return PTR_ERR (phy_dev->regmap); } - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ctrl" ); -if (!res) { -dev_err (dev,"No ctrl reg found\n" ); -return -ENXIO ; + ret =of_property_read_u32_index (np,"st,syscfg" ,PHYPARAM_REG , + &phy_dev->param); +if (ret) { +dev_err (dev,"can't get phyparam offset (%d)\n" , ret); +return ret; } - phy_dev->ctrl = res->start; - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"param" ); -if (!res) { -dev_err (dev,"No param reg found\n" ); -return -ENXIO ; + ret =of_property_read_u32_index (np,"st,syscfg" ,PHYCTRL_REG , + &phy_dev->ctrl); +if (ret) { +dev_err (dev,"can't get phyctrl offset (%d)\n" , ret); +return ret; } - phy_dev->param = res->start; phy =devm_phy_create (dev,NULL , &stih407_usb2_picophy_data);if (IS_ERR (phy)) {
Signature · 1 line
1.7.9.5
PATCH 6/9 Documentation: bindings: add dt documentation for Rockchip usb PHY
In reply to Kishon Vijay Abraham IFrom: Yunzhi Li <[email protected]>
This patch adds a binding that describes the Rockchip usb PHYs found on Rockchip SoCs usb interface.
--- .../devicetree/bindings/phy/rockchip-usb-phy.txt | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt new file +37 -0
@@ -0,0 +1,37 @@ +ROCKCHIP USB2 PHY + +Required properties: + - compatible: rockchip,rk3288-usb-phy + - rockchip,grf : phandle to the syscon managing the "general + register files" + - #address-cells: should be 1 + - #size-cells: should be 0 + +Sub-nodes: +Each PHY should be represented as a sub-node. + +Sub-nodes +required properties: +- #phy-cells: should be 0 +- reg: PHY configure reg address offset in GRF + "0x320" - for PHY attach to OTG controller + "0x334" - for PHY attach to HOST0 controller + "0x348" - for PHY attach to HOST1 controller + +Optional Properties: +- clocks : phandle + clock specifier for the phy clocks +- clock-names: string, clock name, must be "phyclk" + +Example: + +usbphy: phy { + compatible = "rockchip,rk3288-usb-phy"; + rockchip,grf = <&grf>; + #address-cells = <1>; + #size-cells = <0>; + + usbphy0: usb-phy0 { + #phy-cells = <0>; + reg = <0x320>; + }; +};
Signature · 1 line
1.7.9.5
PATCH 7/9 phy: add a driver for the Rockchip SoC internal USB2.0 PHY
In reply to Kishon Vijay Abraham IFrom: Yunzhi Li <[email protected]>
This patch to add a generic PHY driver for ROCKCHIP usb PHYs, currently this driver can support RK3288. The RK3288 SoC have three independent USB PHY IPs which are all configured through a set of registers located in the GRF (general register files) module.
--- drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-usb.c | 158 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 drivers/phy/phy-rockchip-usb.c
drivers/phy/Kconfig +7 -0
@@ -239,6 +239,13 @@ config PHY_QCOM_IPQ806X_SATA depends on OF select GENERIC_PHY +config PHY_ROCKCHIP_USB + tristate "Rockchip USB2 PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip USB 2.0 PHY. + config PHY_ST_SPEAR1310_MIPHY tristate "ST SPEAR1310-MIPHY driver" select GENERIC_PHY
drivers/phy/Makefile +1 -0
@@ -28,6 +28,7 @@ phy-exynos-usb2-$(CONFIG_PHY_EXYNOS5250_USB2) += phy-exynos5250-usb2.o phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2) += phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o +obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
drivers/phy/phy-rockchip-usb.c new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 8/9 phy: exynos-video-mipi: Fix regression by adding support for PMU regmap
In reply to Kishon Vijay Abraham IFrom: Sylwester Nawrocki <[email protected]>
After the Exynos Power Management Unit (PMU) driver was converted to the platform device driver in commit 14fc8b93d47323561edf5d482 ("ARM: EXYNOS: Add platform driver support for Exynos PMU") and then PMU device nodes added to Exynos4 DTs in commit 7b9613aca42a5522d269 ("ARM: dts: add PMU syscon node for exynos4") the mipi video phy driver started failing probing, due to overlapping memory mapped register region resources.
Now all the Exynos peripheral devices which have registers in the PMU region are supposed to use the regmap provided by the syscon driver. So support for regmap is added in this patch, this unfortunately creates yet another indirection into that supposedly trivial driver.
The additional mutex is required because single register is used by PHY pairs (they share bit in a register). An improvement here could be to allow a PHY instance be created with a driver custom mutex, which would then be common for each PHY pair. This would eliminate one of 3 mutexes which need to be taken in the phy_power_on/ phy_power_off code path. However, I tried to keep this bug fix patch possibly simple.
This change is needed to make MIPI DSI displays and MIPI CSI-2 camera sensors working again on Exynos4 boards.
--- .../devicetree/bindings/phy/samsung-phy.txt | 2 +- drivers/phy/phy-exynos-mipi-video.c | 89 +++++++++++++------- include/linux/mfd/syscon/exynos4-pmu.h | 21 +++++ 3 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 include/linux/mfd/syscon/exynos4-pmu.h
Documentation/devicetree/bindings/phy/samsung-phy.txt +1 -1
@@ -3,8 +3,8 @@ Samsung S5P/EXYNOS SoC series MIPI CSIS/DSIM DPHY Required properties: - compatible : should be "samsung,s5pv210-mipi-video-phy"; -- reg : offset and length of the MIPI DPHY register set; - #phy-cells : from the generic phy bindings, must be 1; +- syscon - phandle to the PMU system controller; For "samsung,s5pv210-mipi-video-phy" compatible PHYs the second cell in the PHY specifier identifies the PHY and its meaning is as follows:
drivers/phy/phy-exynos-mipi-video.c +57 -32
140 lines not on this page · raw message
include/linux/mfd/syscon/exynos4-pmu.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2015 Samsung Electronics Co., Ltd. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _LINUX_MFD_SYSCON_PMU_EXYNOS4_H_ +#define _LINUX_MFD_SYSCON_PMU_EXYNOS4_H_ + +/* Exynos4 PMU register definitions */ + +/* MIPI_PHYn_CONTROL register offset: n = 0..1 */ +#define EXYNOS4_MIPI_PHY_CONTROL (n) (0x710 + (n) * 4) +#define EXYNOS4_MIPI_PHY_ENABLE (1 << 0) +#define EXYNOS4_MIPI_PHY_SRESETN (1 << 1) +#define EXYNOS4_MIPI_PHY_MRESETN (1 << 2) +#define EXYNOS4_MIPI_PHY_RESET_MASK (3 << 1) + +#endif /* _LINUX_MFD_SYSCON_PMU_EXYNOS4_H_ */
Signature · 1 line
1.7.9.5
PATCH 9/9 phy: miphy365x: Pass sysconfig register offsets via syscfg dt property.
In reply to Kishon Vijay Abraham IFrom: Peter Griffin <[email protected]>
Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161,
update the miphy365 phy driver to access sysconfig register offsets via syscfg dt property.
This is because the reg property should not be mixing address spaces like it does currently for miphy365. This change then also aligns us to how other platforms such as keystone and bcm7445 pass there syscon offsets via DT.
This patch breaks DT compatibility, but this platform is considered WIP, and is only used by a few developers who are upstreaming support for it. This change has been done as a single atomic commit to ensure it is bisectable.
--- .../devicetree/bindings/phy/phy-miphy365x.txt | 15 +++++----- arch/arm/boot/dts/stih416.dtsi | 10 +++---- drivers/phy/phy-miphy365x.c | 29 +++++++------------- 3 files changed, 23 insertions(+), 31 deletions(-)
Documentation/devicetree/bindings/phy/phy-miphy365x.txt +8 -7
@@ -6,8 +6,10 @@ for SATA and PCIe. Required properties (controller (parent) node): - compatible : Should be "st,miphy365x-phy" -- st,syscfg : Should be a phandle of the system configuration register group - which contain the SATA, PCIe mode setting bits +- st,syscfg : Phandle / integer array property. Phandle of sysconfig group + containing the miphy registers and integer array should contain + an entry for each port sub-node, specifying the control + register offset inside the sysconfig group. Required nodes : A sub-node is required for each channel the controller provides. Address range information including the usual
@@ -26,7 +28,6 @@ Required properties (port (child) node): registers filled in "reg": - sata: For SATA devices - pcie: For PCIe devices - - syscfg: To specify the syscfg based config register Optional properties (port (child) node): - st,sata-gen : Generation of locally attached SATA IP. Expected values
@@ -39,20 +40,20 @@ Example: miphy365x_phy: miphy365x@fe382000 { compatible = "st,miphy365x-phy"; - st,syscfg = <&syscfg_rear>; + st,syscfg = <&syscfg_rear 0x824 0x828>; #address-cells = <1>; #size-cells = <1>; ranges; phy_port0: port@fe382000 { - reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>; - reg-names = "sata", "pcie", "syscfg"; + reg = <0xfe382000 0x100>, <0xfe394000 0x100>; + reg-names = "sata", "pcie"; #phy-cells = <1>; st,sata-gen = <3>; }; phy_port1: port@fe38a000 { - reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>;; + reg = <0xfe38a000 0x100>, <0xfe804000 0x100>;; reg-names = "sata", "pcie", "syscfg"; #phy-cells = <1>; st,pcie-tx-pol-inv;
arch/arm/boot/dts/stih416.dtsi +5 -5
@@ -283,21 +283,21 @@ miphy365x_phy: phy@fe382000 { compatible = "st,miphy365x-phy"; - st,syscfg = <&syscfg_rear>; + st,syscfg = <&syscfg_rear 0x824 0x828>; #address-cells = <1>; #size-cells = <1>; ranges; phy_port0: port@fe382000 { #phy-cells = <1>; - reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>; - reg-names = "sata", "pcie", "syscfg"; + reg = <0xfe382000 0x100>, <0xfe394000 0x100>; + reg-names = "sata", "pcie"; }; phy_port1: port@fe38a000 { #phy-cells = <1>; - reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>; - reg-names = "sata", "pcie", "syscfg"; + reg = <0xfe38a000 0x100>, <0xfe804000 0x100>; + reg-names = "sata", "pcie"; }; };
drivers/phy/phy-miphy365x.c +10 -19
@@ -141,7 +141,7 @@ struct miphy365x_phy {bool pcie_tx_pol_inv;bool sata_tx_pol_inv;u32 sata_gen; -u64 ctrlreg; +u32 ctrlreg;u8 type; };
@@ -179,7 +179,7 @@ static int miphy365x_set_path(struct miphy365x_phy *miphy_phy,bool sata = (miphy_phy->type ==MIPHY_TYPE_SATA );return regmap_update_bits (miphy_dev->regmap, - (unsigned int )miphy_phy->ctrlreg, + miphy_phy->ctrlreg,SYSCFG_SELECT_SATA_MASK , sata <<SYSCFG_SELECT_SATA_POS ); }
@@ -445,7 +445,6 @@ int miphy365x_get_addr(struct device *dev, struct miphy365x_phy *miphy_phy, {struct device_node *phynode = miphy_phy->phy->dev.of_node;const char *name; -const __be32 *taddr;int type = miphy_phy->type;int ret;
@@ -455,22 +454,6 @@ int miphy365x_get_addr(struct device *dev, struct miphy365x_phy *miphy_phy,return ret; } -if (!strncmp (name,"syscfg" ,6 )) { - taddr =of_get_address (phynode, index,NULL ,NULL ); -if (!taddr) { -dev_err (dev,"failed to fetch syscfg address\n" ); -return -EINVAL ; - } - - miphy_phy->ctrlreg =of_translate_address (phynode, taddr); -if (miphy_phy->ctrlreg ==OF_BAD_ADDR ) { -dev_err (dev,"failed to translate syscfg address\n" ); -return -EINVAL ; - } - -return 0 ; - } -if (!((!strncmp (name,"sata" ,4 ) && type ==MIPHY_TYPE_SATA ) || (!strncmp (name,"pcie" ,4 ) && type ==MIPHY_TYPE_PCIE )))return 0 ;
@@ -606,7 +589,15 @@ static int miphy365x_probe(struct platform_device *pdev)return ret;phy_set_drvdata (phy, miphy_dev->phys[port]); + port++; +/* sysconfig offsets are indexed from 1 */ + ret =of_property_read_u32_index (np,"st,syscfg" , port, + &miphy_phy->ctrlreg); +if (ret) { +dev_err (&pdev->dev,"No sysconfig offset found\n" ); +return ret; + } } provider =devm_of_phy_provider_register (&pdev->dev, miphy365x_xlate);
Signature · 1 line
1.7.9.5
Quoted 14 lines · Kishon Vijay Abraham I
Hi Greg,
Please find the PULL REQUEST for 3.20 merge window. It's a rather short pull request which includes a new PHY driver for rockchip and contains few misc fixes.
There is a patch which modifies the dt data for stih416 and I've included it in this pull request after getting ack from STI maintainer (Maxime Coquelin).
Let me know If I have to change something.
Cheers
Kishon
Quoted 7 lines
The following changes since commit
ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc:Linux 3.19-rc5 (2015-01-18 18:02:20 +1200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.gittags/for-3.20
Pulled and pushed out, thanks.
greg k-h