Skip to content

Commit 2aebe3f

Browse files
committed
Merge tag 'for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-next
Kishon writes: New Features ============ *) Add driver for USB PHYs on sun9i *) Add driver for USB PHY on dm816x *) Modified exynos5-usbdrd driver to add support for Exynos5433 SoC Fixes ===== *) Fix power_on/power_off failure paths in some drivers *) Make miphy365x use generic PHY type constants *) Fix build errors due to missing export symbols in qcom-ufs driver *) Make all the functions return proper error values Cleanups ======== *) use PTR_ERR_OR_ZERO to simplify code *) use devm_kcalloc instead of devm_kzalloc with multiply *) remove un-necessary ifdef CONFIG_OF
2 parents c8d1bc1 + e95cf39 commit 2aebe3f

26 files changed

+655
-110
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Device tree binding documentation for am816x USB PHY
2+
=========================
3+
4+
Required properties:
5+
- compatible : should be "ti,dm816x-usb-phy"
6+
- reg : offset and length of the PHY register set.
7+
- reg-names : name for the phy registers
8+
- clocks : phandle to the clock
9+
- clock-names : name of the clock
10+
- syscon: phandle for the syscon node to access misc registers
11+
- #phy-cells : from the generic PHY bindings, must be 1
12+
- syscon: phandle for the syscon node to access misc registers
13+
14+
Example:
15+
16+
usb_phy0: usb-phy@20 {
17+
compatible = "ti,dm8168-usb-phy";
18+
reg = <0x20 0x8>;
19+
reg-names = "phy";
20+
clocks = <&main_fapll 6>;
21+
clock-names = "refclk";
22+
#phy-cells = <0>;
23+
syscon = <&scm_conf>;
24+
};

Documentation/devicetree/bindings/phy/phy-miphy365x.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Required nodes : A sub-node is required for each channel the controller
2020
Required properties (port (child) node):
2121
- #phy-cells : Should be 1 (See second example)
2222
Cell after port phandle is device type from:
23-
- MIPHY_TYPE_SATA
24-
- MIPHY_TYPE_PCI
23+
- PHY_TYPE_SATA
24+
- PHY_TYPE_PCI
2525
- reg : Address and length of register sets for each device in
2626
"reg-names"
2727
- reg-names : The names of the register addresses corresponding to the
@@ -68,10 +68,10 @@ property, containing a phandle to the phy port node and a device type.
6868

6969
Example:
7070

71-
#include <dt-bindings/phy/phy-miphy365x.h>
71+
#include <dt-bindings/phy/phy.h>
7272

7373
sata0: sata@fe380000 {
7474
...
75-
phys = <&phy_port0 MIPHY_TYPE_SATA>;
75+
phys = <&phy_port0 PHY_TYPE_SATA>;
7676
...
7777
};

Documentation/devicetree/bindings/phy/samsung-phy.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Required properties:
128128
- compatible : Should be set to one of the following supported values:
129129
- "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC,
130130
- "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC.
131+
- "samsung,exynos5433-usbdrd-phy" - for exynos5433 SoC.
131132
- "samsung,exynos7-usbdrd-phy" - for exynos7 SoC.
132133
- reg : Register offset and length of USB DRD PHY register set;
133134
- clocks: Clock IDs array as required by the controller
@@ -139,7 +140,7 @@ Required properties:
139140
PHY operations, associated by phy name. It is used to
140141
determine bit values for clock settings register.
141142
For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
142-
- optional clocks: Exynos7 SoC has now following additional
143+
- optional clocks: Exynos5433 & Exynos7 SoC has now following additional
143144
gate clocks available:
144145
- phy_pipe: for PIPE3 phy
145146
- phy_utmi: for UTMI+ phy
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Allwinner sun9i USB PHY
2+
-----------------------
3+
4+
Required properties:
5+
- compatible : should be one of
6+
* allwinner,sun9i-a80-usb-phy
7+
- reg : a list of offset + length pairs
8+
- #phy-cells : from the generic phy bindings, must be 0
9+
- phy_type : "hsic" for HSIC usage;
10+
other values or absence of this property indicates normal USB
11+
- clocks : phandle + clock specifier for the phy clocks
12+
- clock-names : depending on the "phy_type" property,
13+
* "phy" for normal USB
14+
* "hsic_480M", "hsic_12M" for HSIC
15+
- resets : a list of phandle + reset specifier pairs
16+
- reset-names : depending on the "phy_type" property,
17+
* "phy" for normal USB
18+
* "hsic" for HSIC
19+
20+
Optional Properties:
21+
- phy-supply : from the generic phy bindings, a phandle to a regulator that
22+
provides power to VBUS.
23+
24+
It is recommended to list all clocks and resets available.
25+
The driver will only use those matching the phy_type.
26+
27+
Example:
28+
usbphy1: phy@00a01800 {
29+
compatible = "allwinner,sun9i-a80-usb-phy";
30+
reg = <0x00a01800 0x4>;
31+
clocks = <&usb_phy_clk 2>, <&usb_phy_clk 10>,
32+
<&usb_phy_clk 3>;
33+
clock-names = "hsic_480M", "hsic_12M", "phy";
34+
resets = <&usb_phy_clk 18>, <&usb_phy_clk 19>;
35+
reset-names = "hsic", "phy";
36+
status = "disabled";
37+
#phy-cells = <0>;
38+
};

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,8 @@ F: drivers/clocksource/arm_global_timer.c
14681468
F: drivers/i2c/busses/i2c-st.c
14691469
F: drivers/media/rc/st_rc.c
14701470
F: drivers/mmc/host/sdhci-st.c
1471+
F: drivers/phy/phy-miphy28lp.c
1472+
F: drivers/phy/phy-miphy365x.c
14711473
F: drivers/phy/phy-stih407-usb.c
14721474
F: drivers/phy/phy-stih41x-usb.c
14731475
F: drivers/pinctrl/pinctrl-st.c

arch/arm/boot/dts/stih416.dtsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "stih416-clock.dtsi"
1111
#include "stih416-pinctrl.dtsi"
1212

13-
#include <dt-bindings/phy/phy-miphy365x.h>
13+
#include <dt-bindings/phy/phy.h>
1414
#include <dt-bindings/interrupt-controller/arm-gic.h>
1515
#include <dt-bindings/reset-controller/stih416-resets.h>
1616
/ {
@@ -306,7 +306,7 @@
306306
reg = <0xfe380000 0x1000>;
307307
interrupts = <GIC_SPI 157 IRQ_TYPE_NONE>;
308308
interrupt-names = "hostc";
309-
phys = <&phy_port0 MIPHY_TYPE_SATA>;
309+
phys = <&phy_port0 PHY_TYPE_SATA>;
310310
phy-names = "sata-phy";
311311
resets = <&powerdown STIH416_SATA0_POWERDOWN>,
312312
<&softreset STIH416_SATA0_SOFTRESET>;

drivers/phy/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ config ARMADA375_USBCLUSTER_PHY
3535
depends on OF
3636
select GENERIC_PHY
3737

38+
config PHY_DM816X_USB
39+
tristate "TI dm816x USB PHY driver"
40+
depends on ARCH_OMAP2PLUS
41+
select GENERIC_PHY
42+
help
43+
Enable this for dm816x USB to work.
44+
3845
config PHY_EXYNOS_MIPI_VIDEO
3946
tristate "S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver"
4047
depends on HAS_IOMEM
@@ -174,6 +181,17 @@ config PHY_SUN4I_USB
174181
This driver controls the entire USB PHY block, both the USB OTG
175182
parts, as well as the 2 regular USB 2 host PHYs.
176183

184+
config PHY_SUN9I_USB
185+
tristate "Allwinner sun9i SoC USB PHY driver"
186+
depends on ARCH_SUNXI && HAS_IOMEM && OF
187+
depends on RESET_CONTROLLER
188+
select GENERIC_PHY
189+
help
190+
Enable this to support the transceiver that is part of Allwinner
191+
sun9i SoCs.
192+
193+
This driver controls each individual USB 2 host PHY.
194+
177195
config PHY_SAMSUNG_USB2
178196
tristate "Samsung USB 2.0 PHY driver"
179197
depends on HAS_IOMEM

drivers/phy/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
obj-$(CONFIG_GENERIC_PHY) += phy-core.o
66
obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o
77
obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o
8+
obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o
89
obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o
910
obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
1011
obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o
@@ -20,6 +21,7 @@ obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o
2021
obj-$(CONFIG_PHY_EXYNOS5250_SATA) += phy-exynos5250-sata.o
2122
obj-$(CONFIG_PHY_HIX5HD2_SATA) += phy-hix5hd2-sata.o
2223
obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o
24+
obj-$(CONFIG_PHY_SUN9I_USB) += phy-sun9i-usb.o
2325
obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-exynos-usb2.o
2426
phy-exynos-usb2-y += phy-samsung-usb2.o
2527
phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o

drivers/phy/phy-berlin-sata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev)
218218
if (priv->nphys == 0)
219219
return -ENODEV;
220220

221-
priv->phys = devm_kzalloc(dev, priv->nphys * sizeof(*priv->phys),
221+
priv->phys = devm_kcalloc(dev, priv->nphys, sizeof(*priv->phys),
222222
GFP_KERNEL);
223223
if (!priv->phys)
224224
return -ENOMEM;

drivers/phy/phy-berlin-usb.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@
103103
#define MODE_TEST_EN BIT(11)
104104
#define ANA_TEST_DC_CTRL(x) ((x) << 12)
105105

106-
#define to_phy_berlin_usb_priv(p) \
107-
container_of((p), struct phy_berlin_usb_priv, phy)
108-
109106
static const u32 phy_berlin_pll_dividers[] = {
110107
/* Berlin 2 */
111108
CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
@@ -115,14 +112,13 @@ static const u32 phy_berlin_pll_dividers[] = {
115112

116113
struct phy_berlin_usb_priv {
117114
void __iomem *base;
118-
struct phy *phy;
119115
struct reset_control *rst_ctrl;
120116
u32 pll_divider;
121117
};
122118

123119
static int phy_berlin_usb_power_on(struct phy *phy)
124120
{
125-
struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent);
121+
struct phy_berlin_usb_priv *priv = phy_get_drvdata(phy);
126122

127123
reset_control_reset(priv->rst_ctrl);
128124

@@ -175,6 +171,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
175171
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
176172
struct phy_berlin_usb_priv *priv;
177173
struct resource *res;
174+
struct phy *phy;
178175
struct phy_provider *phy_provider;
179176

180177
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -192,20 +189,18 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
192189

193190
priv->pll_divider = *((u32 *)match->data);
194191

195-
priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
196-
if (IS_ERR(priv->phy)) {
192+
phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
193+
if (IS_ERR(phy)) {
197194
dev_err(&pdev->dev, "failed to create PHY\n");
198-
return PTR_ERR(priv->phy);
195+
return PTR_ERR(phy);
199196
}
200197

201198
platform_set_drvdata(pdev, priv);
199+
phy_set_drvdata(phy, priv);
202200

203201
phy_provider =
204202
devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
205-
if (IS_ERR(phy_provider))
206-
return PTR_ERR(phy_provider);
207-
208-
return 0;
203+
return PTR_ERR_OR_ZERO(phy_provider);
209204
}
210205

211206
static struct platform_driver phy_berlin_usb_driver = {

0 commit comments

Comments
 (0)