You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'usb-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB driver updates from Greg KH: "Here's the big USB (and PHY) driver patchset for 4.1-rc1. Everything here has been in linux-next, and the full details are below in the shortlog. Nothing major, just the normal round of new drivers,api updates, and other changes, mostly in the USB gadget area, as usual" * tag 'usb-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (252 commits) drivers/usb/core: devio.c: Removed an uneeded space before tab usb: dwc2: host: sleep USB_RESUME_TIMEOUT during resume usb: chipidea: debug: add low power mode check before print registers usb: chipidea: udc: bypass pullup DP when gadget connect in OTG fsm mode usb: core: hub: use new USB_RESUME_TIMEOUT usb: isp1760: hcd: use new USB_RESUME_TIMEOUT usb: dwc2: hcd: use new USB_RESUME_TIMEOUT usb: host: sl811: use new USB_RESUME_TIMEOUT usb: host: r8a66597: use new USB_RESUME_TIMEOUT usb: host: oxu210hp: use new USB_RESUME_TIMEOUT usb: host: fusbh200: use new USB_RESUME_TIMEOUT usb: host: fotg210: use new USB_RESUME_TIMEOUT usb: host: isp116x: use new USB_RESUME_TIMEOUT usb: musb: use new USB_RESUME_TIMEOUT usb: host: uhci: use new USB_RESUME_TIMEOUT usb: host: ehci: use new USB_RESUME_TIMEOUT usb: host: xhci: use new USB_RESUME_TIMEOUT usb: define a generic USB_RESUME_TIMEOUT macro usb: musb: dsps: fix build on i386 when COMPILE_TEST is set ehci-hub: use USB_DT_HUB ...
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
What: /config/usb-gadget/gadget/functions/printer.name
|
||||
Date: Apr 2015
|
||||
KernelVersion: 4.1
|
||||
Description:
|
||||
The attributes:
|
||||
|
||||
pnp_string - Data to be passed to the host in pnp string
|
||||
q_len - Number of requests per endpoint
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Device tree binding documentation for am816x USB PHY
|
||||
=========================
|
||||
|
||||
Required properties:
|
||||
- compatible : should be "ti,dm816x-usb-phy"
|
||||
- reg : offset and length of the PHY register set.
|
||||
- reg-names : name for the phy registers
|
||||
- clocks : phandle to the clock
|
||||
- clock-names : name of the clock
|
||||
- syscon: phandle for the syscon node to access misc registers
|
||||
- #phy-cells : from the generic PHY bindings, must be 1
|
||||
- syscon: phandle for the syscon node to access misc registers
|
||||
|
||||
Example:
|
||||
|
||||
usb_phy0: usb-phy@20 {
|
||||
compatible = "ti,dm8168-usb-phy";
|
||||
reg = <0x20 0x8>;
|
||||
reg-names = "phy";
|
||||
clocks = <&main_fapll 6>;
|
||||
clock-names = "refclk";
|
||||
#phy-cells = <0>;
|
||||
syscon = <&scm_conf>;
|
||||
};
|
||||
@@ -20,8 +20,8 @@ Required nodes : A sub-node is required for each channel the controller
|
||||
Required properties (port (child) node):
|
||||
- #phy-cells : Should be 1 (See second example)
|
||||
Cell after port phandle is device type from:
|
||||
- MIPHY_TYPE_SATA
|
||||
- MIPHY_TYPE_PCI
|
||||
- PHY_TYPE_SATA
|
||||
- PHY_TYPE_PCI
|
||||
- reg : Address and length of register sets for each device in
|
||||
"reg-names"
|
||||
- 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.
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/phy/phy-miphy365x.h>
|
||||
#include <dt-bindings/phy/phy.h>
|
||||
|
||||
sata0: sata@fe380000 {
|
||||
...
|
||||
phys = <&phy_port0 MIPHY_TYPE_SATA>;
|
||||
phys = <&phy_port0 PHY_TYPE_SATA>;
|
||||
...
|
||||
};
|
||||
|
||||
@@ -128,6 +128,7 @@ Required properties:
|
||||
- compatible : Should be set to one of the following supported values:
|
||||
- "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC,
|
||||
- "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC.
|
||||
- "samsung,exynos5433-usbdrd-phy" - for exynos5433 SoC.
|
||||
- "samsung,exynos7-usbdrd-phy" - for exynos7 SoC.
|
||||
- reg : Register offset and length of USB DRD PHY register set;
|
||||
- clocks: Clock IDs array as required by the controller
|
||||
@@ -139,7 +140,7 @@ Required properties:
|
||||
PHY operations, associated by phy name. It is used to
|
||||
determine bit values for clock settings register.
|
||||
For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
|
||||
- optional clocks: Exynos7 SoC has now following additional
|
||||
- optional clocks: Exynos5433 & Exynos7 SoC has now following additional
|
||||
gate clocks available:
|
||||
- phy_pipe: for PIPE3 phy
|
||||
- phy_utmi: for UTMI+ phy
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
Allwinner sun9i USB PHY
|
||||
-----------------------
|
||||
|
||||
Required properties:
|
||||
- compatible : should be one of
|
||||
* allwinner,sun9i-a80-usb-phy
|
||||
- reg : a list of offset + length pairs
|
||||
- #phy-cells : from the generic phy bindings, must be 0
|
||||
- phy_type : "hsic" for HSIC usage;
|
||||
other values or absence of this property indicates normal USB
|
||||
- clocks : phandle + clock specifier for the phy clocks
|
||||
- clock-names : depending on the "phy_type" property,
|
||||
* "phy" for normal USB
|
||||
* "hsic_480M", "hsic_12M" for HSIC
|
||||
- resets : a list of phandle + reset specifier pairs
|
||||
- reset-names : depending on the "phy_type" property,
|
||||
* "phy" for normal USB
|
||||
* "hsic" for HSIC
|
||||
|
||||
Optional Properties:
|
||||
- phy-supply : from the generic phy bindings, a phandle to a regulator that
|
||||
provides power to VBUS.
|
||||
|
||||
It is recommended to list all clocks and resets available.
|
||||
The driver will only use those matching the phy_type.
|
||||
|
||||
Example:
|
||||
usbphy1: phy@00a01800 {
|
||||
compatible = "allwinner,sun9i-a80-usb-phy";
|
||||
reg = <0x00a01800 0x4>;
|
||||
clocks = <&usb_phy_clk 2>, <&usb_phy_clk 10>,
|
||||
<&usb_phy_clk 3>;
|
||||
clock-names = "hsic_480M", "hsic_12M", "phy";
|
||||
resets = <&usb_phy_clk 18>, <&usb_phy_clk 19>;
|
||||
reset-names = "hsic", "phy";
|
||||
status = "disabled";
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
@@ -14,6 +14,7 @@ Optional properties:
|
||||
- phys: from the *Generic PHY* bindings
|
||||
- phy-names: from the *Generic PHY* bindings
|
||||
- tx-fifo-resize: determines if the FIFO *has* to be reallocated.
|
||||
- snps,usb3_lpm_capable: determines if platform is USB3 LPM capable
|
||||
- snps,disable_scramble_quirk: true when SW should disable data scrambling.
|
||||
Only really useful for FPGA builds.
|
||||
- snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled
|
||||
|
||||
@@ -15,7 +15,10 @@ Optional properties:
|
||||
- phys: phandle + phy specifier pair
|
||||
- phy-names: must be "usb"
|
||||
- dmas: Must contain a list of references to DMA specifiers.
|
||||
- dma-names : Must contain a list of DMA names, "tx" or "rx".
|
||||
- dma-names : Must contain a list of DMA names:
|
||||
- tx0 ... tx<n>
|
||||
- rx0 ... rx<n>
|
||||
- This <n> means DnFIFO in USBHS module.
|
||||
|
||||
Example:
|
||||
usbhs: usb@e6590000 {
|
||||
|
||||
@@ -5,6 +5,7 @@ Required properties:
|
||||
- compatible: Should be one of below:
|
||||
"fsl,imx6q-usbmisc" for imx6q
|
||||
"fsl,vf610-usbmisc" for Vybrid vf610
|
||||
"fsl,imx6sx-usbmisc" for imx6sx
|
||||
- reg: Should contain registers location and length
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -69,3 +69,24 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
|
||||
----------------------
|
||||
"On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
|
||||
July 27, 2012 Revision 2.0 version 1.1a"
|
||||
|
||||
2. How to enable USB as system wakeup source
|
||||
-----------------------------------
|
||||
Below is the example for how to enable USB as system wakeup source
|
||||
at imx6 platform.
|
||||
|
||||
2.1 Enable core's wakeup
|
||||
echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup
|
||||
2.2 Enable glue layer's wakeup
|
||||
echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup
|
||||
2.3 Enable PHY's wakeup (optional)
|
||||
echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup
|
||||
2.4 Enable roothub's wakeup
|
||||
echo enabled > /sys/bus/usb/devices/usb1/power/wakeup
|
||||
2.5 Enable related device's wakeup
|
||||
echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
|
||||
|
||||
If the system has only one usb port, and you want usb wakeup at this port, you
|
||||
can use below script to enable usb wakeup.
|
||||
for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ provided by gadgets.
|
||||
16. UAC1 function
|
||||
17. UAC2 function
|
||||
18. UVC function
|
||||
19. PRINTER function
|
||||
|
||||
|
||||
1. ACM function
|
||||
@@ -726,3 +727,49 @@ with these patches:
|
||||
http://www.spinics.net/lists/linux-usb/msg99220.html
|
||||
|
||||
host: luvcview -f yuv
|
||||
|
||||
19. PRINTER function
|
||||
====================
|
||||
|
||||
The function is provided by usb_f_printer.ko module.
|
||||
|
||||
Function-specific configfs interface
|
||||
------------------------------------
|
||||
|
||||
The function name to use when creating the function directory is "printer".
|
||||
The printer function provides these attributes in its function directory:
|
||||
|
||||
pnp_string - Data to be passed to the host in pnp string
|
||||
q_len - Number of requests per endpoint
|
||||
|
||||
Testing the PRINTER function
|
||||
----------------------------
|
||||
|
||||
The most basic testing:
|
||||
|
||||
device: run the gadget
|
||||
# ls -l /devices/virtual/usb_printer_gadget/
|
||||
|
||||
should show g_printer<number>.
|
||||
|
||||
If udev is active, then /dev/g_printer<number> should appear automatically.
|
||||
|
||||
host:
|
||||
|
||||
If udev is active, then e.g. /dev/usb/lp0 should appear.
|
||||
|
||||
host->device transmission:
|
||||
|
||||
device:
|
||||
# cat /dev/g_printer<number>
|
||||
host:
|
||||
# cat > /dev/usb/lp0
|
||||
|
||||
device->host transmission:
|
||||
|
||||
# cat > /dev/g_printer<number>
|
||||
host:
|
||||
# cat /dev/usb/lp0
|
||||
|
||||
More advanced testing can be done with the prn_example
|
||||
described in Documentation/usb/gadget-printer.txt.
|
||||
|
||||
+10
-2
@@ -1468,6 +1468,8 @@ F: drivers/clocksource/arm_global_timer.c
|
||||
F: drivers/i2c/busses/i2c-st.c
|
||||
F: drivers/media/rc/st_rc.c
|
||||
F: drivers/mmc/host/sdhci-st.c
|
||||
F: drivers/phy/phy-miphy28lp.c
|
||||
F: drivers/phy/phy-miphy365x.c
|
||||
F: drivers/phy/phy-stih407-usb.c
|
||||
F: drivers/phy/phy-stih41x-usb.c
|
||||
F: drivers/pinctrl/pinctrl-st.c
|
||||
@@ -2518,7 +2520,7 @@ F: Documentation/zh_CN/
|
||||
|
||||
CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER
|
||||
M: Peter Chen <Peter.Chen@freescale.com>
|
||||
T: git git://github.com/hzpeterchen/linux-usb.git
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
|
||||
L: linux-usb@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/usb/chipidea/
|
||||
@@ -10132,6 +10134,12 @@ S: Maintained
|
||||
F: drivers/net/usb/cdc_*.c
|
||||
F: include/uapi/linux/usb/cdc.h
|
||||
|
||||
USB CHAOSKEY DRIVER
|
||||
M: Keith Packard <keithp@keithp.com>
|
||||
L: linux-usb@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/usb/misc/chaoskey.c
|
||||
|
||||
USB CYPRESS C67X00 DRIVER
|
||||
M: Peter Korsgaard <jacmet@sunsite.dk>
|
||||
L: linux-usb@vger.kernel.org
|
||||
@@ -10212,7 +10220,7 @@ F: drivers/usb/host/ohci*
|
||||
|
||||
USB OTG FSM (Finite State Machine)
|
||||
M: Peter Chen <Peter.Chen@freescale.com>
|
||||
T: git git://github.com/hzpeterchen/linux-usb.git
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
|
||||
L: linux-usb@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/usb/common/usb-otg-fsm.c
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "stih416-clock.dtsi"
|
||||
#include "stih416-pinctrl.dtsi"
|
||||
|
||||
#include <dt-bindings/phy/phy-miphy365x.h>
|
||||
#include <dt-bindings/phy/phy.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/reset-controller/stih416-resets.h>
|
||||
/ {
|
||||
@@ -306,7 +306,7 @@
|
||||
reg = <0xfe380000 0x1000>;
|
||||
interrupts = <GIC_SPI 157 IRQ_TYPE_NONE>;
|
||||
interrupt-names = "hostc";
|
||||
phys = <&phy_port0 MIPHY_TYPE_SATA>;
|
||||
phys = <&phy_port0 PHY_TYPE_SATA>;
|
||||
phy-names = "sata-phy";
|
||||
resets = <&powerdown STIH416_SATA0_POWERDOWN>,
|
||||
<&softreset STIH416_SATA0_SOFTRESET>;
|
||||
|
||||
@@ -35,6 +35,13 @@ config ARMADA375_USBCLUSTER_PHY
|
||||
depends on OF
|
||||
select GENERIC_PHY
|
||||
|
||||
config PHY_DM816X_USB
|
||||
tristate "TI dm816x USB PHY driver"
|
||||
depends on ARCH_OMAP2PLUS
|
||||
select GENERIC_PHY
|
||||
help
|
||||
Enable this for dm816x USB to work.
|
||||
|
||||
config PHY_EXYNOS_MIPI_VIDEO
|
||||
tristate "S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver"
|
||||
depends on HAS_IOMEM
|
||||
@@ -174,6 +181,17 @@ config PHY_SUN4I_USB
|
||||
This driver controls the entire USB PHY block, both the USB OTG
|
||||
parts, as well as the 2 regular USB 2 host PHYs.
|
||||
|
||||
config PHY_SUN9I_USB
|
||||
tristate "Allwinner sun9i SoC USB PHY driver"
|
||||
depends on ARCH_SUNXI && HAS_IOMEM && OF
|
||||
depends on RESET_CONTROLLER
|
||||
select GENERIC_PHY
|
||||
help
|
||||
Enable this to support the transceiver that is part of Allwinner
|
||||
sun9i SoCs.
|
||||
|
||||
This driver controls each individual USB 2 host PHY.
|
||||
|
||||
config PHY_SAMSUNG_USB2
|
||||
tristate "Samsung USB 2.0 PHY driver"
|
||||
depends on HAS_IOMEM
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
obj-$(CONFIG_GENERIC_PHY) += phy-core.o
|
||||
obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o
|
||||
obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o
|
||||
obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o
|
||||
obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o
|
||||
obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
|
||||
obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o
|
||||
@@ -20,6 +21,7 @@ obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o
|
||||
obj-$(CONFIG_PHY_EXYNOS5250_SATA) += phy-exynos5250-sata.o
|
||||
obj-$(CONFIG_PHY_HIX5HD2_SATA) += phy-hix5hd2-sata.o
|
||||
obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o
|
||||
obj-$(CONFIG_PHY_SUN9I_USB) += phy-sun9i-usb.o
|
||||
obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-exynos-usb2.o
|
||||
phy-exynos-usb2-y += phy-samsung-usb2.o
|
||||
phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o
|
||||
|
||||
@@ -218,7 +218,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev)
|
||||
if (priv->nphys == 0)
|
||||
return -ENODEV;
|
||||
|
||||
priv->phys = devm_kzalloc(dev, priv->nphys * sizeof(*priv->phys),
|
||||
priv->phys = devm_kcalloc(dev, priv->nphys, sizeof(*priv->phys),
|
||||
GFP_KERNEL);
|
||||
if (!priv->phys)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -103,9 +103,6 @@
|
||||
#define MODE_TEST_EN BIT(11)
|
||||
#define ANA_TEST_DC_CTRL(x) ((x) << 12)
|
||||
|
||||
#define to_phy_berlin_usb_priv(p) \
|
||||
container_of((p), struct phy_berlin_usb_priv, phy)
|
||||
|
||||
static const u32 phy_berlin_pll_dividers[] = {
|
||||
/* Berlin 2 */
|
||||
CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
|
||||
@@ -115,14 +112,13 @@ static const u32 phy_berlin_pll_dividers[] = {
|
||||
|
||||
struct phy_berlin_usb_priv {
|
||||
void __iomem *base;
|
||||
struct phy *phy;
|
||||
struct reset_control *rst_ctrl;
|
||||
u32 pll_divider;
|
||||
};
|
||||
|
||||
static int phy_berlin_usb_power_on(struct phy *phy)
|
||||
{
|
||||
struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent);
|
||||
struct phy_berlin_usb_priv *priv = phy_get_drvdata(phy);
|
||||
|
||||
reset_control_reset(priv->rst_ctrl);
|
||||
|
||||
@@ -175,6 +171,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
|
||||
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
|
||||
struct phy_berlin_usb_priv *priv;
|
||||
struct resource *res;
|
||||
struct phy *phy;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -192,20 +189,18 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
|
||||
|
||||
priv->pll_divider = *((u32 *)match->data);
|
||||
|
||||
priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
|
||||
if (IS_ERR(priv->phy)) {
|
||||
phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
|
||||
if (IS_ERR(phy)) {
|
||||
dev_err(&pdev->dev, "failed to create PHY\n");
|
||||
return PTR_ERR(priv->phy);
|
||||
return PTR_ERR(phy);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
phy_set_drvdata(phy, priv);
|
||||
|
||||
phy_provider =
|
||||
devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
|
||||
if (IS_ERR(phy_provider))
|
||||
return PTR_ERR(phy_provider);
|
||||
|
||||
return 0;
|
||||
return PTR_ERR_OR_ZERO(phy_provider);
|
||||
}
|
||||
|
||||
static struct platform_driver phy_berlin_usb_driver = {
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/usb/phy_companion.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
#include <linux/mfd/syscon.h>
|
||||
|
||||
/*
|
||||
* TRM has two sets of USB_CTRL registers.. The correct register bits
|
||||
* are in TRM section 24.9.8.2 USB_CTRL Register. The TRM documents the
|
||||
* phy as being SR70LX Synopsys USB 2.0 OTG nanoPHY. It also seems at
|
||||
* least dm816x rev c ignores writes to USB_CTRL register, but the TI
|
||||
* kernel is writing to those so it's possible that later revisions
|
||||
* have worknig USB_CTRL register.
|
||||
*
|
||||
* Also note that At least USB_CTRL register seems to be dm816x specific
|
||||
* according to the TRM. It's possible that USBPHY_CTRL is more generic,
|
||||
* but that would have to be checked against the SR70LX documentation
|
||||
* which does not seem to be publicly available.
|
||||
*
|
||||
* Finally, the phy on dm814x and am335x is different from dm816x.
|
||||
*/
|
||||
#define DM816X_USB_CTRL_PHYCLKSRC BIT(8) /* 1 = PLL ref clock */
|
||||
#define DM816X_USB_CTRL_PHYSLEEP1 BIT(1) /* Enable the first phy */
|
||||
#define DM816X_USB_CTRL_PHYSLEEP0 BIT(0) /* Enable the second phy */
|
||||
|
||||
#define DM816X_USBPHY_CTRL_TXRISETUNE 1
|
||||
#define DM816X_USBPHY_CTRL_TXVREFTUNE 0xc
|
||||
#define DM816X_USBPHY_CTRL_TXPREEMTUNE 0x2
|
||||
|
||||
struct dm816x_usb_phy {
|
||||
struct regmap *syscon;
|
||||
struct device *dev;
|
||||
unsigned int instance;
|
||||
struct clk *refclk;
|
||||
struct usb_phy phy;
|
||||
unsigned int usb_ctrl; /* Shared between phy0 and phy1 */
|
||||
unsigned int usbphy_ctrl;
|
||||
};
|
||||
|
||||
static int dm816x_usb_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
|
||||
{
|
||||
otg->host = host;
|
||||
if (!host)
|
||||
otg->state = OTG_STATE_UNDEFINED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dm816x_usb_phy_set_peripheral(struct usb_otg *otg,
|
||||
struct usb_gadget *gadget)
|
||||
{
|
||||
otg->gadget = gadget;
|
||||
if (!gadget)
|
||||
otg->state = OTG_STATE_UNDEFINED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dm816x_usb_phy_init(struct phy *x)
|
||||
{
|
||||
struct dm816x_usb_phy *phy = phy_get_drvdata(x);
|
||||
unsigned int val;
|
||||
int error;
|
||||
|
||||
if (clk_get_rate(phy->refclk) != 24000000)
|
||||
dev_warn(phy->dev, "nonstandard phy refclk\n");
|
||||
|
||||
/* Set PLL ref clock and put phys to sleep */
|
||||
error = regmap_update_bits(phy->syscon, phy->usb_ctrl,
|
||||
DM816X_USB_CTRL_PHYCLKSRC |
|
||||
DM816X_USB_CTRL_PHYSLEEP1 |
|
||||
DM816X_USB_CTRL_PHYSLEEP0,
|
||||
0);
|
||||
regmap_read(phy->syscon, phy->usb_ctrl, &val);
|
||||
if ((val & 3) != 0)
|
||||
dev_info(phy->dev,
|
||||
"Working dm816x USB_CTRL! (0x%08x)\n",
|
||||
val);
|
||||
|
||||
/*
|
||||
* TI kernel sets these values for "symmetrical eye diagram and
|
||||
* better signal quality" so let's assume somebody checked the
|
||||
* values with a scope and set them here too.
|
||||
*/
|
||||
regmap_read(phy->syscon, phy->usbphy_ctrl, &val);
|
||||
val |= DM816X_USBPHY_CTRL_TXRISETUNE |
|
||||
DM816X_USBPHY_CTRL_TXVREFTUNE |
|
||||
DM816X_USBPHY_CTRL_TXPREEMTUNE;
|
||||
regmap_write(phy->syscon, phy->usbphy_ctrl, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct phy_ops ops = {
|
||||
.init = dm816x_usb_phy_init,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int dm816x_usb_phy_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct dm816x_usb_phy *phy = dev_get_drvdata(dev);
|
||||
unsigned int mask, val;
|
||||
int error = 0;
|
||||
|
||||
mask = BIT(phy->instance);
|
||||
val = ~BIT(phy->instance);
|
||||
error = regmap_update_bits(phy->syscon, phy->usb_ctrl,
|
||||
mask, val);
|
||||
if (error)
|
||||
dev_err(phy->dev, "phy%i failed to power off\n",
|
||||
phy->instance);
|
||||
clk_disable(phy->refclk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dm816x_usb_phy_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct dm816x_usb_phy *phy = dev_get_drvdata(dev);
|
||||
unsigned int mask, val;
|
||||
int error;
|
||||
|
||||
error = clk_enable(phy->refclk);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Note that at least dm816x rev c does not seem to do
|
||||
* anything with the USB_CTRL register. But let's follow
|
||||
* what the TI tree is doing in case later revisions use
|
||||
* USB_CTRL.
|
||||
*/
|
||||
mask = BIT(phy->instance);
|
||||
val = BIT(phy->instance);
|
||||
error = regmap_update_bits(phy->syscon, phy->usb_ctrl,
|
||||
mask, val);
|
||||
if (error) {
|
||||
dev_err(phy->dev, "phy%i failed to power on\n",
|
||||
phy->instance);
|
||||
clk_disable(phy->refclk);
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UNIVERSAL_DEV_PM_OPS(dm816x_usb_phy_pm_ops,
|
||||
dm816x_usb_phy_runtime_suspend,
|
||||
dm816x_usb_phy_runtime_resume,
|
||||
NULL);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id dm816x_usb_phy_id_table[] = {
|
||||
{
|
||||
.compatible = "ti,dm8168-usb-phy",
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, dm816x_usb_phy_id_table);
|
||||
#endif
|
||||
|
||||
static int dm816x_usb_phy_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct dm816x_usb_phy *phy;
|
||||
struct resource *res;
|
||||
struct phy *generic_phy;
|
||||
struct phy_provider *phy_provider;
|
||||
struct usb_otg *otg;
|
||||
const struct of_device_id *of_id;
|
||||
const struct usb_phy_data *phy_data;
|
||||
int error;
|
||||
|
||||
of_id = of_match_device(of_match_ptr(dm816x_usb_phy_id_table),
|
||||
&pdev->dev);
|
||||
if (!of_id)
|
||||
return -EINVAL;
|
||||
|
||||
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
|
||||
if (!phy)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENOENT;
|
||||
|
||||
phy->syscon = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
|
||||
"syscon");
|
||||
if (IS_ERR(phy->syscon))
|
||||
return PTR_ERR(phy->syscon);
|
||||
|
||||
/*
|
||||
* According to sprs614e.pdf, the first usb_ctrl is shared and
|
||||
* the second instance for usb_ctrl is reserved.. Also the
|
||||
* register bits are different from earlier TRMs.
|
||||
*/
|
||||
phy->usb_ctrl = 0x20;
|
||||
phy->usbphy_ctrl = (res->start & 0xff) + 4;
|
||||
if (phy->usbphy_ctrl == 0x2c)
|
||||
phy->instance = 1;
|
||||
|
||||
phy_data = of_id->data;
|
||||
|
||||
otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
|
||||
if (!otg)
|
||||
return -ENOMEM;
|
||||
|
||||
phy->dev = &pdev->dev;
|
||||
phy->phy.dev = phy->dev;
|
||||
phy->phy.label = "dm8168_usb_phy";
|
||||
phy->phy.otg = otg;
|
||||
phy->phy.type = USB_PHY_TYPE_USB2;
|
||||
otg->set_host = dm816x_usb_phy_set_host;
|
||||
otg->set_peripheral = dm816x_usb_phy_set_peripheral;
|
||||
otg->usb_phy = &phy->phy;
|
||||
|
||||
platform_set_drvdata(pdev, phy);
|
||||
|
||||
phy->refclk = devm_clk_get(phy->dev, "refclk");
|
||||
if (IS_ERR(phy->refclk))
|
||||
return PTR_ERR(phy->refclk);
|
||||
error = clk_prepare(phy->refclk);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
pm_runtime_enable(phy->dev);
|
||||
generic_phy = devm_phy_create(phy->dev, NULL, &ops);
|
||||
if (IS_ERR(generic_phy))
|
||||
return PTR_ERR(generic_phy);
|
||||
|
||||
phy_set_drvdata(generic_phy, phy);
|
||||
|
||||
phy_provider = devm_of_phy_provider_register(phy->dev,
|
||||
of_phy_simple_xlate);
|
||||
if (IS_ERR(phy_provider))
|
||||
return PTR_ERR(phy_provider);
|
||||
|
||||
usb_add_phy_dev(&phy->phy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dm816x_usb_phy_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct dm816x_usb_phy *phy = platform_get_drvdata(pdev);
|
||||
|
||||
usb_remove_phy(&phy->phy);
|
||||
pm_runtime_disable(phy->dev);
|
||||
clk_unprepare(phy->refclk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver dm816x_usb_phy_driver = {
|
||||
.probe = dm816x_usb_phy_probe,
|
||||
.remove = dm816x_usb_phy_remove,
|
||||
.driver = {
|
||||
.name = "dm816x-usb-phy",
|
||||
.pm = &dm816x_usb_phy_pm_ops,
|
||||
.of_match_table = of_match_ptr(dm816x_usb_phy_id_table),
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(dm816x_usb_phy_driver);
|
||||
|
||||
MODULE_ALIAS("platform:dm816x_usb");
|
||||
MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
|
||||
MODULE_DESCRIPTION("dm816x usb phy driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -624,6 +624,13 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
|
||||
.has_common_clk_gate = true,
|
||||
};
|
||||
|
||||
static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
|
||||
.phy_cfg = phy_cfg_exynos5,
|
||||
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
|
||||
.pmu_offset_usbdrd1_phy = EXYNOS5433_USBHOST30_PHY_CONTROL,
|
||||
.has_common_clk_gate = false,
|
||||
};
|
||||
|
||||
static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
|
||||
.phy_cfg = phy_cfg_exynos5,
|
||||
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL,
|
||||
@@ -637,6 +644,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = {
|
||||
}, {
|
||||
.compatible = "samsung,exynos5420-usbdrd-phy",
|
||||
.data = &exynos5420_usbdrd_phy
|
||||
}, {
|
||||
.compatible = "samsung,exynos5433-usbdrd-phy",
|
||||
.data = &exynos5433_usbdrd_phy
|
||||
}, {
|
||||
.compatible = "samsung,exynos7-usbdrd-phy",
|
||||
.data = &exynos7_usbdrd_phy
|
||||
|
||||
@@ -1259,10 +1259,7 @@ static int miphy28lp_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate);
|
||||
if (IS_ERR(provider))
|
||||
return PTR_ERR(provider);
|
||||
|
||||
return 0;
|
||||
return PTR_ERR_OR_ZERO(provider);
|
||||
}
|
||||
|
||||
static const struct of_device_id miphy28lp_of_match[] = {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <dt-bindings/phy/phy-miphy365x.h>
|
||||
#include <dt-bindings/phy/phy.h>
|
||||
|
||||
#define HFC_TIMEOUT 100
|
||||
|
||||
@@ -177,7 +177,7 @@ static u8 rx_tx_spd[] = {
|
||||
static int miphy365x_set_path(struct miphy365x_phy *miphy_phy,
|
||||
struct miphy365x_dev *miphy_dev)
|
||||
{
|
||||
bool sata = (miphy_phy->type == MIPHY_TYPE_SATA);
|
||||
bool sata = (miphy_phy->type == PHY_TYPE_SATA);
|
||||
|
||||
return regmap_update_bits(miphy_dev->regmap,
|
||||
miphy_phy->ctrlreg,
|
||||
@@ -431,7 +431,7 @@ static int miphy365x_init(struct phy *phy)
|
||||
}
|
||||
|
||||
/* Initialise Miphy for PCIe or SATA */
|
||||
if (miphy_phy->type == MIPHY_TYPE_PCIE)
|
||||
if (miphy_phy->type == PHY_TYPE_PCIE)
|
||||
ret = miphy365x_init_pcie_port(miphy_phy, miphy_dev);
|
||||
else
|
||||
ret = miphy365x_init_sata_port(miphy_phy, miphy_dev);
|
||||
@@ -455,8 +455,8 @@ int miphy365x_get_addr(struct device *dev, struct miphy365x_phy *miphy_phy,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!((!strncmp(name, "sata", 4) && type == MIPHY_TYPE_SATA) ||
|
||||
(!strncmp(name, "pcie", 4) && type == MIPHY_TYPE_PCIE)))
|
||||
if (!((!strncmp(name, "sata", 4) && type == PHY_TYPE_SATA) ||
|
||||
(!strncmp(name, "pcie", 4) && type == PHY_TYPE_PCIE)))
|
||||
return 0;
|
||||
|
||||
miphy_phy->base = of_iomap(phynode, index);
|
||||
@@ -499,8 +499,8 @@ static struct phy *miphy365x_xlate(struct device *dev,
|
||||
|
||||
miphy_phy->type = args->args[0];
|
||||
|
||||
if (!(miphy_phy->type == MIPHY_TYPE_SATA ||
|
||||
miphy_phy->type == MIPHY_TYPE_PCIE)) {
|
||||
if (!(miphy_phy->type == PHY_TYPE_SATA ||
|
||||
miphy_phy->type == PHY_TYPE_PCIE)) {
|
||||
dev_err(dev, "Unsupported device type: %d\n", miphy_phy->type);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user