Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy
Hi Tony, On Thursday 11 October 2012 06:29 AM, Tony Lindgren wrote: Hi, * Kishon Vijay Abraham I kis...@ti.com [120919 04:32]: Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. You may be able to set up the control module register with one of the following Linux standard frameworks: 1. Fixed regulator defined in mach-omap2/control.c Is it control.c? In this case the PHY driver can pick up the regulator by name. Do you mean we have to define something like fixed_voltage_config defined in board-4430sdp.c? From whatever I could make out from regulator/fixed.c, enabling/disabling of regulator is done using only gpio. I'm not sure how we can use that to write to control module register. 2. A mux mapped with pinctrl framework using pinctrl-single,bits binding And in this case the PHY driver can request the named pinctrl states like enabled and disabled. --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -15,3 +15,21 @@ usb2phy@4a0ad080 { reg = 0x4a0ad080 0x58, 0x4a002300 0x4; }; The comments also apply to the omap_usb2.c driver for 0x4a002300 above. + +OMAP USB3 PHY + +Required properties: + - compatible: Should be ti,omap-usb3 + - reg : Address and length of the register set for the device. Also +add the address of control module phy power register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; And register 0x4a002370 here. Care to post some info what the 0x4a002370 register bits do? Is that same as CONTROL_DEV_CONF on omap4, or does it have other bits there too? It's CONTROL_PHY_POWER_USB register and it's structure looks like this. 31:22 USB_PWRCTL_CLK_FREQ 21:14 USB_PWRCTL_CLK_CMD 13:0 RESERVED CLK_CMD takes values to power up/down the TX and RX in various combinations. And CLK_FREQ takes values for clock configuration. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy
* kishon kis...@ti.com [121012 02:10]: Hi Tony, On Thursday 11 October 2012 06:29 AM, Tony Lindgren wrote: Hi, * Kishon Vijay Abraham I kis...@ti.com [120919 04:32]: Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. You may be able to set up the control module register with one of the following Linux standard frameworks: 1. Fixed regulator defined in mach-omap2/control.c Is it control.c? Hmm after looking into it more we're missing one piece of the puzzle to handle SCM regulators, which is omap-scm-regulator.c :) I'll do a minimal DT only version of that. In this case the PHY driver can pick up the regulator by name. Do you mean we have to define something like fixed_voltage_config defined in board-4430sdp.c? From whatever I could make out from regulator/fixed.c, enabling/disabling of regulator is done using only gpio. I'm not sure how we can use that to write to control module register. Yes you're right, we're missing omap-scm-regulator.c, then it will be trivial to select the regulator from DT like we have for the twl-regulator.c. +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; And register 0x4a002370 here. Care to post some info what the 0x4a002370 register bits do? Is that same as CONTROL_DEV_CONF on omap4, or does it have other bits there too? It's CONTROL_PHY_POWER_USB register and it's structure looks like this. 31:22 USB_PWRCTL_CLK_FREQ 21:14 USB_PWRCTL_CLK_CMD 13:0 RESERVED CLK_CMD takes values to power up/down the TX and RX in various combinations. And CLK_FREQ takes values for clock configuration. Oh, it's a clock. Then it would be best to set it up using the common clock framework and have the clock registered by the SCM core driver when those are available. Maybe please just add a comment for that for later on? Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy
Hi, * Kishon Vijay Abraham I kis...@ti.com [120919 04:32]: Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. You may be able to set up the control module register with one of the following Linux standard frameworks: 1. Fixed regulator defined in mach-omap2/control.c In this case the PHY driver can pick up the regulator by name. 2. A mux mapped with pinctrl framework using pinctrl-single,bits binding And in this case the PHY driver can request the named pinctrl states like enabled and disabled. --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -15,3 +15,21 @@ usb2phy@4a0ad080 { reg = 0x4a0ad080 0x58, 0x4a002300 0x4; }; The comments also apply to the omap_usb2.c driver for 0x4a002300 above. + +OMAP USB3 PHY + +Required properties: + - compatible: Should be ti,omap-usb3 + - reg : Address and length of the register set for the device. Also +add the address of control module phy power register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; And register 0x4a002370 here. Care to post some info what the 0x4a002370 register bits do? Is that same as CONTROL_DEV_CONF on omap4, or does it have other bits there too? The advantage for using regulator fwk and pinctrl fwk is that the regulator and mux can be children of the SCM core driver when we have it. And no direct register tinkering or omap specific custom exported functions are needed ;) Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy
Hi, On Wed, Sep 19, 2012 at 8:11 PM, Marc Kleine-Budde m...@pengutronix.de wrote: On 09/19/2012 01:30 PM, Kishon Vijay Abraham I wrote: Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Moiz Sonasath m-sonas...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 18 + drivers/usb/phy/Kconfig |9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb3.c | 369 + include/linux/usb/omap_usb.h | 72 5 files changed, 469 insertions(+) create mode 100644 drivers/usb/phy/omap-usb3.c diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 80d4148..7c5fd89 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -15,3 +15,21 @@ usb2phy@4a0ad080 { reg = 0x4a0ad080 0x58, 0x4a002300 0x4; }; + +OMAP USB3 PHY + +Required properties: + - compatible: Should be ti,omap-usb3 + - reg : Address and length of the register set for the device. Also +add the address of control module phy power register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 63c339b..353dc0c 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -13,6 +13,15 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config OMAP_USB3 + tristate OMAP USB3 PHY Driver + select USB_OTG_UTILS + help + Enable this to support the USB3 PHY that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + config USB_ISP1301 tristate NXP ISP1301 USB transceiver support depends on USB || USB_GADGET diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index b069f29..973b1e6 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -5,6 +5,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG obj-$(CONFIG_OMAP_USB2) += omap-usb2.o +obj-$(CONFIG_OMAP_USB3) += omap-usb3.o obj-$(CONFIG_USB_ISP1301)+= isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c new file mode 100644 index 000..4dc84ca --- /dev/null +++ b/drivers/usb/phy/omap-usb3.c @@ -0,0 +1,369 @@ +/* + * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP. + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; 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/slab.h +#include linux/usb/omap_usb.h +#include linux/of.h +#include linux/clk.h +#include linux/err.h +#include linux/pm_runtime.h +#include linux/delay.h + +static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = { + {1250, 5, 4, 20, 0},/* 12 MHz */ + {3125, 20, 4, 20, 0}, /* 16.8 MHz */ + {1172, 8, 4, 20, 65537},/* 19.2 MHz */ + {1250, 12, 4, 20, 0}, /* 26 MHz */ + {3125, 47, 4, 20, 92843}, /* 38.4 MHz */ +}; + +/** + * omap5_usb_phy_power - power on/off the serializer using control module + * @phy: struct omap_usb * + * @on: 0 to off and 1 to on based on powering on or off the PHY + * + * omap_usb3 can call this API to power on or off the PHY. + */ +static int omap5_usb_phy_power(struct
[PATCH 1/4] usb: phy: add a new driver for usb3 phy
Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Moiz Sonasath m-sonas...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 18 + drivers/usb/phy/Kconfig |9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb3.c | 369 + include/linux/usb/omap_usb.h | 72 5 files changed, 469 insertions(+) create mode 100644 drivers/usb/phy/omap-usb3.c diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 80d4148..7c5fd89 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -15,3 +15,21 @@ usb2phy@4a0ad080 { reg = 0x4a0ad080 0x58, 0x4a002300 0x4; }; + +OMAP USB3 PHY + +Required properties: + - compatible: Should be ti,omap-usb3 + - reg : Address and length of the register set for the device. Also +add the address of control module phy power register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 63c339b..353dc0c 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -13,6 +13,15 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config OMAP_USB3 + tristate OMAP USB3 PHY Driver + select USB_OTG_UTILS + help + Enable this to support the USB3 PHY that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + config USB_ISP1301 tristate NXP ISP1301 USB transceiver support depends on USB || USB_GADGET diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index b069f29..973b1e6 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -5,6 +5,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG obj-$(CONFIG_OMAP_USB2)+= omap-usb2.o +obj-$(CONFIG_OMAP_USB3)+= omap-usb3.o obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c new file mode 100644 index 000..4dc84ca --- /dev/null +++ b/drivers/usb/phy/omap-usb3.c @@ -0,0 +1,369 @@ +/* + * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP. + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; 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/slab.h +#include linux/usb/omap_usb.h +#include linux/of.h +#include linux/clk.h +#include linux/err.h +#include linux/pm_runtime.h +#include linux/delay.h + +static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = { + {1250, 5, 4, 20, 0},/* 12 MHz */ + {3125, 20, 4, 20, 0}, /* 16.8 MHz */ + {1172, 8, 4, 20, 65537},/* 19.2 MHz */ + {1250, 12, 4, 20, 0}, /* 26 MHz */ + {3125, 47, 4, 20, 92843}, /* 38.4 MHz */ +}; + +/** + * omap5_usb_phy_power - power on/off the serializer using control module + * @phy: struct omap_usb * + * @on: 0 to off and 1 to on based on powering on or off the PHY + * + * omap_usb3 can call this API to power on or off the PHY. + */ +static int omap5_usb_phy_power(struct omap_usb *phy, bool on) +{ + u32 val; + unsigned long rate; + struct clk *sys_clk; + + sys_clk = clk_get(NULL, sys_clkin); + if (IS_ERR(sys_clk)) { + pr_err(%s:
Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy
On 09/19/2012 01:30 PM, Kishon Vijay Abraham I wrote: Added a driver for usb3 phy that handles the interaction between usb phy device and dwc3 controller. This also includes device tree support for usb3 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Moiz Sonasath m-sonas...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 18 + drivers/usb/phy/Kconfig |9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb3.c | 369 + include/linux/usb/omap_usb.h | 72 5 files changed, 469 insertions(+) create mode 100644 drivers/usb/phy/omap-usb3.c diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 80d4148..7c5fd89 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -15,3 +15,21 @@ usb2phy@4a0ad080 { reg = 0x4a0ad080 0x58, 0x4a002300 0x4; }; + +OMAP USB3 PHY + +Required properties: + - compatible: Should be ti,omap-usb3 + - reg : Address and length of the register set for the device. Also +add the address of control module phy power register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb3phy@4a084400 { + compatible = ti,omap-usb3; + reg = 0x0x4a084400 0x80, + 0x4a084800 0x64, + 0x4a084c00 0x40, + 0x4a002370 0x4; +}; diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 63c339b..353dc0c 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -13,6 +13,15 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config OMAP_USB3 + tristate OMAP USB3 PHY Driver + select USB_OTG_UTILS + help + Enable this to support the USB3 PHY that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + config USB_ISP1301 tristate NXP ISP1301 USB transceiver support depends on USB || USB_GADGET diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index b069f29..973b1e6 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -5,6 +5,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG obj-$(CONFIG_OMAP_USB2) += omap-usb2.o +obj-$(CONFIG_OMAP_USB3) += omap-usb3.o obj-$(CONFIG_USB_ISP1301)+= isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c new file mode 100644 index 000..4dc84ca --- /dev/null +++ b/drivers/usb/phy/omap-usb3.c @@ -0,0 +1,369 @@ +/* + * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP. + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; 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/slab.h +#include linux/usb/omap_usb.h +#include linux/of.h +#include linux/clk.h +#include linux/err.h +#include linux/pm_runtime.h +#include linux/delay.h + +static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = { + {1250, 5, 4, 20, 0},/* 12 MHz */ + {3125, 20, 4, 20, 0}, /* 16.8 MHz */ + {1172, 8, 4, 20, 65537},/* 19.2 MHz */ + {1250, 12, 4, 20, 0}, /* 26 MHz */ + {3125, 47, 4, 20, 92843}, /* 38.4 MHz */ +}; + +/** + * omap5_usb_phy_power - power on/off the serializer using control module + * @phy: struct omap_usb * + * @on: 0 to off and 1 to on based on powering on or off the PHY + * + * omap_usb3 can call this API to power on or off the PHY. + */ +static int omap5_usb_phy_power(struct omap_usb *phy, bool on) +{ + u32 val; + unsigned long rate; +