usb: phy: samsung: Introducing usb phy driver for samsung SoCs
Subsystems (3)
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
Removed IS_ENABLED(CONFIG_OF) as pdev->dev.of_node is enough to check for dt support. Using of_match_ptr to add of_match_table to platform_driver structure. Removed unnecessary variables.
Changes from v7:
Rebased to the latest usb-next branch. Separating arch patches from these driver patches.
Changes from v6:
Modified register definitions according to the existing ones. Changed default PHY clk selection for SoCs. Improved binding text and rebased to the latest usb-next.
Changes from v5:
Moved clk_get() to driver's probe function. Now reference clock frequency selection value is stored in samsung_usbphy structure for later use. Used IS_ENABLED() instead of #ifdef in samsung_usbphy_get_driver_data().
Changes from v4:
Moved header file contents to driver's source file Removed unnecessary print message from driver's probe function Dropped the Free Software Foundation address from the header
Changes from v3:
Replaced susbsys_initcall()/module_exit() by module_platform_driver(). Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver is registered
Removed unnecessary devm_usb_put_phy() call from the hsotg driver remove.
Changes from v2:
Changed the driver filenames to samsung-usbphy
Rectified coding style related errors
Changes from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'
This patch set introduces a phy driver for samsung SoCs. It uses the existing transceiver infrastructure to provide phy control functions. Use of this driver can be extended for usb host phy as well. Over the period of time all the phy related code for most of the samsung SoCs can be integrated here. Removing the existing phy code from mach-s3c64xx. Same can be done for other SoCs when they start supporting this phy driver.
This driver is tested with smdk6410 and Exynos4210(with DT).
Praveen Paneri (2):
usb: phy: samsung: Introducing usb phy driver for hsotg
usb: s3c-hsotg: Adding phy driver support
.../devicetree/bindings/usb/samsung-usbphy.txt | 11 + drivers/usb/gadget/s3c-hsotg.c | 37 ++- drivers/usb/phy/Kconfig | 8 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/samsung-usbphy.c | 354 ++++++++++++++++++++ include/linux/platform_data/samsung-usbphy.h | 27 ++ 6 files changed, 428 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt create mode 100644 drivers/usb/phy/samsung-usbphy.c create mode 100644 include/linux/platform_data/samsung-usbphy.h
PATCH RESEND v9 1/2 usb: phy: samsung: Introducing usb phy driver for hsotg
This driver uses usb_phy interface to interact with s3c-hsotg. Supports phy_init and phy_shutdown functions to enable/disable usb phy. Support will be extended to host controllers and more Samsung SoCs.
--- .../devicetree/bindings/usb/samsung-usbphy.txt | 11 + drivers/usb/phy/Kconfig | 8 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/samsung-usbphy.c | 354 ++++++++++++++++++++ include/linux/platform_data/samsung-usbphy.h | 27 ++ 5 files changed, 401 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt create mode 100644 drivers/usb/phy/samsung-usbphy.c create mode 100644 include/linux/platform_data/samsung-usbphy.h
Documentation/devicetree/bindings/usb/samsung-usbphy.txt new file +11 -0
@@ -0,0 +1,11 @@ +* Samsung's usb phy transceiver + +The Samsung's phy transceiver is used for controlling usb otg phy for +s3c-hsotg usb device controller. +TODO: Adding the PHY binding with controller(s) according to the under +developement generic PHY driver. + +Required properties: +- compatible : should be "samsung,exynos4210-usbphy" +- reg : base physical address of the phy registers and length of memory mapped + region.
drivers/usb/phy/Kconfig +8 -0
@@ -45,3 +45,11 @@ config USB_RCAR_PHY To compile this driver as a module, choose M here: the module will be called rcar-phy. + +config SAMSUNG_USBPHY + bool "Samsung USB PHY controller Driver" + depends on USB_S3C_HSOTG + select USB_OTG_UTILS + help + Enable this to support Samsung USB phy controller for samsung + SoCs.
drivers/usb/phy/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o +obj-$(CONFIG_SAMSUNG_USBPHY) += samsung-usbphy.o
drivers/usb/phy/samsung-usbphy.c new file +354 -0
354 lines not on this page · raw message
include/linux/platform_data/samsung-usbphy.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2012 Samsung Electronics Co.Ltd +* http://www.samsung.com/ +* Author: Praveen Paneri <[email protected]> +* +* Defines platform data for samsung usb phy driver. +* +* 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. +*/ + +#ifndef __SAMSUNG_USBPHY_PLATFORM_H +#define __SAMSUNG_USBPHY_PLATFORM_H + +/** +* samsung_usbphy_data - Platform data for USB PHY driver. +* @pmu_isolation: Function to control usb phy isolation in PMU. +*/ +struct samsung_usbphy_data { +void (*pmu_isolation)(int on); +}; + +extern void samsung_usbphy_set_pdata (struct samsung_usbphy_data *pd); + +#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
Signature · 1 line
1.7.1
PATCH RESEND v9 2/2 usb: s3c-hsotg: Adding phy driver support
In reply to Praveen PaneriAdding the transceiver to hsotg driver. Keeping the platform data for continuing the smooth operation for boards which still uses it
--- drivers/usb/gadget/s3c-hsotg.c | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-)
drivers/usb/gadget/s3c-hsotg.c +27 -10
@@ -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>
@@ -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
@@ -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;
@@ -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); }
@@ -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); }
@@ -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;
@@ -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)) {
Signature · 1 line
1.7.1
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
In reply to Praveen PaneriHi,
Quoted 48 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.Changes from v7:
Rebased to the latest usb-next branch. Separating arch patches from these driver patches.Changes from v6:
Modified register definitions according to the existing ones. Changed default PHY clk selection for SoCs. Improved binding text and rebased to the latest usb-next.Changes from v5:
Movedclk_get()to driver's probe function. Now reference clock frequency selection value is stored insamsung_usbphystructure for later use. UsedIS_ENABLED()instead of #ifdef insamsung_usbphy_get_driver_data().Changes from v4:
Moved header file contents to driver's source file Removed unnecessary print message from driver's probe function Dropped the Free Software Foundation address from the headerChanges from v3:
Replaced susbsys_initcall()/module_exit() bymodule_platform_driver(). Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver is registered
Removed unnecessarydevm_usb_put_phy()call from the hsotg driver remove.Changes from v2:
Changed the driver filenames to samsung-usbphy
Rectified coding style related errorsChanges from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'This patch set introduces a phy driver for samsung SoCs. It uses the existing transceiver infrastructure to provide phy control functions. Use of this driver can be extended for usb host phy as well. Over the period of time all the phy related code for most of the samsung SoCs can be integrated here. Removing the existing phy code from mach-s3c64xx. Same can be done for other SoCs when they start supporting this phy driver.
This driver is tested with smdk6410 and Exynos4210(with DT).
Quoted 3 lines
Praveen Paneri (2):
usb: phy: samsung: Introducing usb phy driver for hsotg
usb: s3c-hsotg: Adding phy driver support
Can you check on my xceiv branch if this is applied correctly ?
thanks
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130118/2bfd8ea3/attachment.sig>
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
Hi Felipe,
Quoted 51 lines · Felipe Balbi
Hi,
Quoted 48 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.Changes from v7:
Rebased to the latest usb-next branch. Separating arch patches from these driver patches.Changes from v6:
Modified register definitions according to the existing ones. Changed default PHY clk selection for SoCs. Improved binding text and rebased to the latest usb-next.Changes from v5:
Movedclk_get()to driver's probe function. Now reference clock frequency selection value is stored insamsung_usbphystructure for later use. UsedIS_ENABLED()instead of #ifdef insamsung_usbphy_get_driver_data().Changes from v4:
Moved header file contents to driver's source file Removed unnecessary print message from driver's probe function Dropped the Free Software Foundation address from the headerChanges from v3:
Replaced susbsys_initcall()/module_exit() bymodule_platform_driver(). Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver is registered
Removed unnecessarydevm_usb_put_phy()call from the hsotg driver remove.Changes from v2:
Changed the driver filenames to samsung-usbphy
Rectified coding style related errorsChanges from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'This patch set introduces a phy driver for samsung SoCs. It uses the existing transceiver infrastructure to provide phy control functions. Use of this driver can be extended for usb host phy as well. Over the period of time all the phy related code for most of the samsung SoCs can be integrated here. Removing the existing phy code from mach-s3c64xx. Same can be done for other SoCs when they start supporting this phy driver.
This driver is tested with smdk6410 and Exynos4210(with DT).
Quoted 5 lines
Quoted 3 lines
Praveen Paneri (2):
usb: phy: samsung: Introducing usb phy driver for hsotg
usb: s3c-hsotg: Adding phy driver supportCan you check on my xceiv branch if this is applied correctly ?
Yes! It is applied fine.
Thanks :)
Praveen
Quoted 5 lines
thanks
--
balbi
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
In reply to Praveen PaneriQuoted 68 lines · On Friday 18 of January 2013 14:30:21 Praveen Paneri wrote:
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability. RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.Changes from v7:
Rebased to the latest usb-next branch. Separating arch patches from these driver patches.Changes from v6:
Modified register definitions according to the existing ones. Changed default PHY clk selection for SoCs. Improved binding text and rebased to the latest usb-next.Changes from v5:
Movedclk_get()to driver's probe function. Now reference clock frequency selection value is stored insamsung_usbphystructure for later use. UsedIS_ENABLED()instead of #ifdef insamsung_usbphy_get_driver_data().Changes from v4:
Moved header file contents to driver's source file Removed unnecessary print message from driver's probe function Dropped the Free Software Foundation address from the headerChanges from v3:
Replaced susbsys_initcall()/module_exit() bymodule_platform_driver(). Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver is registered
Removed unnecessarydevm_usb_put_phy()call from the hsotg driver remove.Changes from v2:
Changed the driver filenames to samsung-usbphy
Rectified coding style related errorsChanges from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'This patch set introduces a phy driver for samsung SoCs. It uses the existing transceiver infrastructure to provide phy control functions. Use of this driver can be extended for usb host phy as well. Over the period of time all the phy related code for most of the samsung SoCs can be integrated here. Removing the existing phy code from mach-s3c64xx. Same can be done for other SoCs when they start supporting this phy driver.
This driver is tested with smdk6410 and Exynos4210(with DT).Praveen Paneri (2):
usb: phy: samsung: Introducing usb phy driver for hsotg
usb: s3c-hsotg: Adding phy driver support.../devicetree/bindings/usb/samsung-usbphy.txt | 11 + drivers/usb/gadget/s3c-hsotg.c | 37 ++- drivers/usb/phy/Kconfig | 8 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/samsung-usbphy.c | 354 ++++++++++++++++++++ include/linux/platform_data/samsung-usbphy.h | 27 ++ 6 files changed, 428 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt create mode 100644 drivers/usb/phy/samsung-usbphy.c create mode 100644 include/linux/platform_data/samsung-usbphy.h
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tested on Exynos4210-Trats.
I also have patches for Exynos 4x12, which I will send once this series and generic PMU isolation setting patches get merged.
Best regards,
Signature · 3 lines
Tomasz Figa Samsung Poland R&D Center SW Solution Development, Linux Platform
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
In reply to Praveen PaneriHi,
Quoted 6 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.
trying applying these but it doesn't apply unfortunately.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130227/497c9e86/attachment.sig>
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
Hi Balbi,
Quoted 12 lines · Felipe Balbi
Hi,
Quoted 6 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.trying applying these but it doesn't apply unfortunately.
Already present in 3.8.0 ? ;-)
Signature · 2 lines
Thanks & Regards Vivek
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
Quoted 14 lines · Vivek Gautam
Hi Balbi,
Quoted 10 lines · Felipe Balbi
Hi,
Quoted 6 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability.
RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.
Quoted 4 lines
Quoted 2 lines
trying applying these but it doesn't apply unfortunately.
Already present in 3.8.0 ? ;-)
heh, my bad. For whatever reason it was still marked as unread.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130227/5af5b783/attachment.sig>
v9 cover usb: phy: samsung: Introducing usb phy driver for samsung SoCs
In reply to Vivek GautamQuoted 13 lines · On Wednesday 27 of February 2013 14:00:25 Vivek Gautam wrote:
Hi Balbi,
Quoted 10 lines · Felipe Balbi
Hi,
Quoted 6 lines · Praveen Paneri
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch. Rewording inline comments for better readability. RemovedIS_ENABLED(CONFIG_OF)aspdev->dev.of_nodeis enough to check for dt support. Usingof_match_ptrto addof_match_tabletoplatform_driverstructure. Removed unnecessary variables.
Quoted 3 lines
Quoted 1 line
trying applying these but it doesn't apply unfortunately.
Already present in 3.8.0 ? ;-)
That's great. I will send my patch adding Exynos 4x12 support in next days.
Best regards,
Tomasz