Skip to content

Commit

Permalink
Merge tag 'xceiv-for-v3.9' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/balbi/usb into usb-next

Felipe writes:
	usb: xceiv: patches for v3.9 merge window

	Two new PHY drivers coming here: one for Samsung,
	one for OMAP. Both architectures are adding USB3
	support to mainline kernel.

	The PHY layer now allows us to have mulitple PHYs
	of the same type, which is necessary for platforms
	which provide more than one USB peripheral port.

	There's also a few cleanups here: removal of __dev*
	annotations, conversion of a cast to to_delayed_work(),
	and mxs-phy learns about ->set_suspend.
  • Loading branch information
gregkh committed Jan 25, 2013
2 parents cba6c85 + 5088b6f commit 4811f53
Show file tree
Hide file tree
Showing 26 changed files with 2,449 additions and 158 deletions.
22 changes: 22 additions & 0 deletions Documentation/devicetree/bindings/usb/dwc3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
synopsys DWC3 CORE

DWC3- USB3 CONTROLLER

Required properties:
- compatible: must be "synopsys,dwc3"
- reg : Address and length of the register set for the device
- interrupts: Interrupts used by the dwc3 controller.
- usb-phy : array of phandle for the PHY device

Optional properties:
- tx-fifo-resize: determines if the FIFO *has* to be reallocated.

This is usually a subnode to DWC3 glue to which it is connected.

dwc3@4a030000 {
compatible = "synopsys,dwc3";
reg = <0x4a030000 0xcfff>;
interrupts = <0 92 4>
usb-phy = <&usb2_phy>, <&usb3,phy>;
tx-fifo-resize;
};
34 changes: 33 additions & 1 deletion Documentation/devicetree/bindings/usb/omap-usb.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
OMAP GLUE
OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS

OMAP MUSB GLUE
- compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
- ti,hwmods : must be "usb_otg_hs"
- ti,has-mailbox : to specify that omap uses an external mailbox
(in control module) to communicate with the musb core during device connect
and disconnect.
- multipoint : Should be "1" indicating the musb controller supports
multipoint. This is a MUSB configuration-specific setting.
- num_eps : Specifies the number of endpoints. This is also a
Expand All @@ -16,13 +19,19 @@ OMAP MUSB GLUE
- power : Should be "50". This signifies the controller can supply upto
100mA when operating in host mode.

Optional properties:
- ctrl-module : phandle of the control module this glue uses to write to
mailbox

SOC specific device node entry
usb_otg_hs: usb_otg_hs@4a0ab000 {
compatible = "ti,omap4-musb";
ti,hwmods = "usb_otg_hs";
ti,has-mailbox;
multipoint = <1>;
num_eps = <16>;
ram_bits = <12>;
ctrl-module = <&omap_control_usb>;
};

Board specific device node entry
Expand All @@ -31,3 +40,26 @@ Board specific device node entry
mode = <3>;
power = <50>;
};

OMAP CONTROL USB

Required properties:
- compatible: Should be "ti,omap-control-usb"
- reg : Address and length of the register set for the device. It contains
the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"
depending upon omap4 or omap5.
- reg-names: The names of the register addresses corresponding to the registers
filled in "reg".
- ti,type: This is used to differentiate whether the control module has
usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
notify events to the musb core and omap5 has usb3 phy power register to
power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
phy power.

omap_control_usb: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
reg = <0x4a002300 0x4>,
<0x4a00233c 0x4>;
reg-names = "control_dev_conf", "otghs_control";
ti,type = <1>;
};
55 changes: 55 additions & 0 deletions Documentation/devicetree/bindings/usb/samsung-usbphy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
* Samsung's usb phy transceiver

The Samsung's phy transceiver is used for controlling usb phy for
s3c-hsotg as well as ehci-s5p and ohci-exynos usb controllers
across Samsung SOCs.
TODO: Adding the PHY binding with controller(s) according to the under
developement generic PHY driver.

Required properties:

Exynos4210:
- compatible : should be "samsung,exynos4210-usbphy"
- reg : base physical address of the phy registers and length of memory mapped
region.

Exynos5250:
- compatible : should be "samsung,exynos5250-usbphy"
- reg : base physical address of the phy registers and length of memory mapped
region.

Optional properties:
- #address-cells: should be '1' when usbphy node has a child node with 'reg'
property.
- #size-cells: should be '1' when usbphy node has a child node with 'reg'
property.
- ranges: allows valid translation between child's address space and parent's
address space.

- The child node 'usbphy-sys' to the node 'usbphy' is for the system controller
interface for usb-phy. It should provide the following information required by
usb-phy controller to control phy.
- reg : base physical address of PHY_CONTROL registers.
The size of this register is the total sum of size of all PHY_CONTROL
registers that the SoC has. For example, the size will be
'0x4' in case we have only one PHY_CONTROL register (e.g.
OTHERS register in S3C64XX or USB_PHY_CONTROL register in S5PV210)
and, '0x8' in case we have two PHY_CONTROL registers (e.g.
USBDEVICE_PHY_CONTROL and USBHOST_PHY_CONTROL registers in exynos4x).
and so on.

Example:
- Exynos4210

usbphy@125B0000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "samsung,exynos4210-usbphy";
reg = <0x125B0000 0x100>;
ranges;

usbphy-sys {
/* USB device and host PHY_CONTROL registers */
reg = <0x10020704 0x8>;
};
};
35 changes: 30 additions & 5 deletions Documentation/devicetree/bindings/usb/usb-phy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,39 @@ OMAP USB2 PHY

Required properties:
- compatible: Should be "ti,omap-usb2"
- reg : Address and length of the register set for the device. Also
add the address of control module dev conf register until a driver for
control module is added
- reg : Address and length of the register set for the device.

Optional properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
the PHY.

This is usually a subnode of ocp2scp to which it is connected.

usb2phy@4a0ad080 {
compatible = "ti,omap-usb2";
reg = <0x4a0ad080 0x58>,
<0x4a002300 0x4>;
reg = <0x4a0ad080 0x58>;
ctrl-module = <&omap_control_usb>;
};

OMAP USB3 PHY

Required properties:
- compatible: Should be "ti,omap-usb3"
- reg : Address and length of the register set for the device.
- reg-names: The names of the register addresses corresponding to the registers
filled in "reg".

Optional properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
the PHY.

This is usually a subnode of ocp2scp to which it is connected.

usb3phy@4a084400 {
compatible = "ti,omap-usb3";
reg = <0x4a084400 0x80>,
<0x4a084800 0x64>,
<0x4a084c00 0x40>;
reg-names = "phy_rx", "phy_tx", "pll_ctrl";
ctrl-module = <&omap_control_usb>;
};
24 changes: 20 additions & 4 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,19 @@ static int dwc3_probe(struct platform_device *pdev)
return -ENOMEM;
}

dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (node) {
dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
} else {
dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
}

if (IS_ERR_OR_NULL(dwc->usb2_phy)) {
dev_err(dev, "no usb2 phy configured\n");
return -EPROBE_DEFER;
}

dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
if (IS_ERR_OR_NULL(dwc->usb3_phy)) {
dev_err(dev, "no usb3 phy configured\n");
return -EPROBE_DEFER;
Expand All @@ -453,8 +459,7 @@ static int dwc3_probe(struct platform_device *pdev)
else
dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;

if (of_get_property(node, "tx-fifo-resize", NULL))
dwc->needs_fifo_resize = true;
dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");

pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
Expand Down Expand Up @@ -583,11 +588,22 @@ static int dwc3_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_OF
static const struct of_device_id of_dwc3_match[] = {
{
.compatible = "synopsys,dwc3"
},
{ },
};
MODULE_DEVICE_TABLE(of, of_dwc3_match);
#endif

static struct platform_driver dwc3_driver = {
.probe = dwc3_probe,
.remove = dwc3_remove,
.driver = {
.name = "dwc3",
.of_match_table = of_match_ptr(of_dwc3_match),
},
};

Expand Down
37 changes: 27 additions & 10 deletions drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/phy.h>
#include <linux/platform_data/s3c-hsotg.h>

#include <mach/map.h>
Expand Down Expand Up @@ -133,7 +134,9 @@ struct s3c_hsotg_ep {
* struct s3c_hsotg - driver state.
* @dev: The parent device supplied to the probe function
* @driver: USB gadget driver
* @plat: The platform specific configuration data.
* @phy: The otg phy transceiver structure for phy control.
* @plat: The platform specific configuration data. This can be removed once
* all SoCs support usb transceiver.
* @regs: The memory area mapped for accessing registers.
* @irq: The IRQ number we are using
* @supplies: Definition of USB power supplies
Expand All @@ -153,6 +156,7 @@ struct s3c_hsotg_ep {
struct s3c_hsotg {
struct device *dev;
struct usb_gadget_driver *driver;
struct usb_phy *phy;
struct s3c_hsotg_plat *plat;

spinlock_t lock;
Expand Down Expand Up @@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
struct platform_device *pdev = to_platform_device(hsotg->dev);

dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
if (hsotg->plat->phy_init)

if (hsotg->phy)
usb_phy_init(hsotg->phy);
else if (hsotg->plat->phy_init)
hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
}

Expand All @@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
{
struct platform_device *pdev = to_platform_device(hsotg->dev);

if (hsotg->plat->phy_exit)
if (hsotg->phy)
usb_phy_shutdown(hsotg->phy);
else if (hsotg->plat->phy_exit)
hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
}

Expand Down Expand Up @@ -3492,6 +3501,7 @@ static void s3c_hsotg_release(struct device *dev)
static int s3c_hsotg_probe(struct platform_device *pdev)
{
struct s3c_hsotg_plat *plat = pdev->dev.platform_data;
struct usb_phy *phy;
struct device *dev = &pdev->dev;
struct s3c_hsotg_ep *eps;
struct s3c_hsotg *hsotg;
Expand All @@ -3500,20 +3510,27 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
int ret;
int i;

plat = pdev->dev.platform_data;
if (!plat) {
dev_err(&pdev->dev, "no platform data defined\n");
return -EINVAL;
}

hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
if (!hsotg) {
dev_err(dev, "cannot get memory\n");
return -ENOMEM;
}

phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(phy)) {
/* Fallback for pdata */
plat = pdev->dev.platform_data;
if (!plat) {
dev_err(&pdev->dev, "no platform data or transceiver defined\n");
return -EPROBE_DEFER;
} else {
hsotg->plat = plat;
}
} else {
hsotg->phy = phy;
}

hsotg->dev = dev;
hsotg->plat = plat;

hsotg->clk = devm_clk_get(&pdev->dev, "otg");
if (IS_ERR(hsotg->clk)) {
Expand Down
Loading

0 comments on commit 4811f53

Please sign in to comment.