All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Vivek Gautam <gautam.vivek@samsung.com>,
	linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org
Cc: gregkh@linuxfoundation.org, balbi@ti.com, kgene.kim@samsung.com,
	t.figa@samsung.com, k.debski@samsung.com, jg1.han@samsung.com,
	sylvester.nawrocki@gmail.com
Subject: Re: [PATCH V4 1/5] phy: Add new Exynos5 USB 3.0 PHY driver
Date: Mon, 14 Apr 2014 17:57:51 +0530	[thread overview]
Message-ID: <534BD447.1080909@ti.com> (raw)
In-Reply-To: <1396967803-28868-2-git-send-email-gautam.vivek@samsung.com>

Hi,

On Tuesday 08 April 2014 08:06 PM, Vivek Gautam wrote:
> Add a new driver for the USB 3.0 PHY on Exynos5 series of SoCs.
> The new driver uses the generic PHY framework and will interact
> with DWC3 controller present on Exynos5 series of SoCs.
> Thereby, removing old phy-samsung-usb3 driver and related code
> used untill now which was based on usb/phy framework.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  .../devicetree/bindings/phy/samsung-phy.txt        |   42 ++
>  drivers/phy/Kconfig                                |   11 +
>  drivers/phy/Makefile                               |    1 +
>  drivers/phy/phy-exynos5-usbdrd.c                   |  668 ++++++++++++++++++++
>  4 files changed, 722 insertions(+)
>  create mode 100644 drivers/phy/phy-exynos5-usbdrd.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 28f9edb..6d99ba9 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -74,3 +74,45 @@ phy-consumer@12340000 {
>  
>  Refer to DT bindings documentation of particular PHY consumer devices for more
>  information about required PHYs and the way of specification.
> +
> +Samsung Exynos5 SoC series USB DRD PHY controller
> +--------------------------------------------------
> +
> +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.
> +- reg : Register offset and length of USB DRD PHY register set;
> +- clocks: Clock IDs array as required by the controller
> +- clock-names: names of clocks correseponding to IDs in the clock property;
> +	       Required clocks:
> +	- phy: main PHY clock (same as USB DRD controller i.e. DWC3 IP clock),
> +	       used for register access.
> +	- ref: PHY's reference clock (usually crystal clock), associated by
> +	       phy name, used to determine bit values for clock settings
> +	       register.
> +	Additional clock required for Exynos5420:
> +	- usb30_sclk_100m: Additional special clock used for PHY operation
> +			   depicted as 'sclk_usbphy30' in CMU of Exynos5420.
> +- samsung,syscon-phandle: phandle for syscon interface, which is used to
> +			  control pmu registers for power isolation.
> +- samsung,pmu-offset: phy power control register offset to pmu-system-controller
> +		      base.
> +- #phy-cells : from the generic PHY bindings, must be 1;
> +
> +For "samsung,exynos5250-usbdrd-phy" and "samsung,exynos5420-usbdrd-phy"
> +compatible PHYs, the second cell in the PHY specifier identifies the
> +PHY id, which is interpreted as follows:
> +  0 - UTMI+ type phy,
> +  1 - PIPE3 type phy,
> +
> +Example:
> +	usb3_phy: usbphy@12100000 {
> +		compatible = "samsung,exynos5250-usbdrd-phy";
> +		reg = <0x12100000 0x100>;
> +		clocks = <&clock 286>, <&clock 1>;
> +		clock-names = "phy", "usb3phy_refclk";
> +		samsung,syscon-phandle = <&pmu_syscon>;
> +		samsung,pmu-offset = <0x704>;
> +		#phy-cells = <1>;
> +	};
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 8d3c49c..d955a05 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -166,4 +166,15 @@ config PHY_XGENE
>  	help
>  	  This option enables support for APM X-Gene SoC multi-purpose PHY.
>  
> +config PHY_EXYNOS5_USBDRD
> +	tristate "Exynos5 SoC series USB DRD PHY driver"
> +	depends on ARCH_EXYNOS5 && OF
> +	depends on HAS_IOMEM
> +	select GENERIC_PHY
> +	select MFD_SYSCON

Lets try to avoid select in Kconfig. We've got enough problems with that.
> +	help
> +	  Enable USB DRD PHY support for Exynos 5 SoC series.
> +	  This driver provides PHY interface for USB 3.0 DRD controller
> +	  present on Exynos5 SoC series.
> +
>  endmenu
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 2faf78e..31baa0c 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -18,3 +18,4 @@ obj-$(CONFIG_PHY_EXYNOS4210_USB2)	+= phy-exynos4210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
>  obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
> +obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
> new file mode 100644
> index 0000000..ff54a7c
> --- /dev/null
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -0,0 +1,668 @@
> +/*
> + * Samsung EXYNOS5 SoC series USB DRD PHY driver
> + *
> + * Phy provider for USB 3.0 DRD controller on Exynos5 SoC series
> + *
> + * Copyright (C) 2013 Samsung Electronics Co., Ltd.

2014 already ;-)
> + * Author: Vivek Gautam <gautam.vivek@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
.
.
<sniip>
.
.

> +
> +/*
> + * Sets the pipe3 phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets multiplier values and spread spectrum
> + * clock settings for SuperSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	/* restore any previous reference clock settings */
> +	reg = phy_drd->refclk_reg;

Why don't we just read back from the register instead?
> +
> +	/* Use EXTREFCLK as ref clock */
> +	reg &= ~PHYCLKRST_REFCLKSEL_MASK;
> +	reg |=	PHYCLKRST_REFCLKSEL_EXT_REFCLK;
> +
> +	/* FSEL settings corresponding to reference clock */
> +	reg &= ~PHYCLKRST_FSEL_PIPE_MASK |
> +		PHYCLKRST_MPLL_MULTIPLIER_MASK |
> +		PHYCLKRST_SSC_REFCLKSEL_MASK;
> +	switch (phy_drd->extrefclk) {
> +	case EXYNOS5_FSEL_50MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_24MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	case EXYNOS5_FSEL_20MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_19MHZ2:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	default:
> +		dev_dbg(phy_drd->dev, "unsupported ref clk\n");
> +		break;
> +	}
> +
> +	/* save refclk settings for multiple phy inits */
> +	phy_drd->refclk_reg = reg;
> +
> +	return reg;
> +}
> +
> +/*
> + * Sets the utmi phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets the FSEL values for HighSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_utmi_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	reg = phy_drd->refclk_reg;

same here..

Thanks
Kishon

WARNING: multiple messages have this Message-ID (diff)
From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 1/5] phy: Add new Exynos5 USB 3.0 PHY driver
Date: Mon, 14 Apr 2014 17:57:51 +0530	[thread overview]
Message-ID: <534BD447.1080909@ti.com> (raw)
In-Reply-To: <1396967803-28868-2-git-send-email-gautam.vivek@samsung.com>

Hi,

On Tuesday 08 April 2014 08:06 PM, Vivek Gautam wrote:
> Add a new driver for the USB 3.0 PHY on Exynos5 series of SoCs.
> The new driver uses the generic PHY framework and will interact
> with DWC3 controller present on Exynos5 series of SoCs.
> Thereby, removing old phy-samsung-usb3 driver and related code
> used untill now which was based on usb/phy framework.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  .../devicetree/bindings/phy/samsung-phy.txt        |   42 ++
>  drivers/phy/Kconfig                                |   11 +
>  drivers/phy/Makefile                               |    1 +
>  drivers/phy/phy-exynos5-usbdrd.c                   |  668 ++++++++++++++++++++
>  4 files changed, 722 insertions(+)
>  create mode 100644 drivers/phy/phy-exynos5-usbdrd.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 28f9edb..6d99ba9 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -74,3 +74,45 @@ phy-consumer at 12340000 {
>  
>  Refer to DT bindings documentation of particular PHY consumer devices for more
>  information about required PHYs and the way of specification.
> +
> +Samsung Exynos5 SoC series USB DRD PHY controller
> +--------------------------------------------------
> +
> +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.
> +- reg : Register offset and length of USB DRD PHY register set;
> +- clocks: Clock IDs array as required by the controller
> +- clock-names: names of clocks correseponding to IDs in the clock property;
> +	       Required clocks:
> +	- phy: main PHY clock (same as USB DRD controller i.e. DWC3 IP clock),
> +	       used for register access.
> +	- ref: PHY's reference clock (usually crystal clock), associated by
> +	       phy name, used to determine bit values for clock settings
> +	       register.
> +	Additional clock required for Exynos5420:
> +	- usb30_sclk_100m: Additional special clock used for PHY operation
> +			   depicted as 'sclk_usbphy30' in CMU of Exynos5420.
> +- samsung,syscon-phandle: phandle for syscon interface, which is used to
> +			  control pmu registers for power isolation.
> +- samsung,pmu-offset: phy power control register offset to pmu-system-controller
> +		      base.
> +- #phy-cells : from the generic PHY bindings, must be 1;
> +
> +For "samsung,exynos5250-usbdrd-phy" and "samsung,exynos5420-usbdrd-phy"
> +compatible PHYs, the second cell in the PHY specifier identifies the
> +PHY id, which is interpreted as follows:
> +  0 - UTMI+ type phy,
> +  1 - PIPE3 type phy,
> +
> +Example:
> +	usb3_phy: usbphy at 12100000 {
> +		compatible = "samsung,exynos5250-usbdrd-phy";
> +		reg = <0x12100000 0x100>;
> +		clocks = <&clock 286>, <&clock 1>;
> +		clock-names = "phy", "usb3phy_refclk";
> +		samsung,syscon-phandle = <&pmu_syscon>;
> +		samsung,pmu-offset = <0x704>;
> +		#phy-cells = <1>;
> +	};
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 8d3c49c..d955a05 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -166,4 +166,15 @@ config PHY_XGENE
>  	help
>  	  This option enables support for APM X-Gene SoC multi-purpose PHY.
>  
> +config PHY_EXYNOS5_USBDRD
> +	tristate "Exynos5 SoC series USB DRD PHY driver"
> +	depends on ARCH_EXYNOS5 && OF
> +	depends on HAS_IOMEM
> +	select GENERIC_PHY
> +	select MFD_SYSCON

Lets try to avoid select in Kconfig. We've got enough problems with that.
> +	help
> +	  Enable USB DRD PHY support for Exynos 5 SoC series.
> +	  This driver provides PHY interface for USB 3.0 DRD controller
> +	  present on Exynos5 SoC series.
> +
>  endmenu
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 2faf78e..31baa0c 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -18,3 +18,4 @@ obj-$(CONFIG_PHY_EXYNOS4210_USB2)	+= phy-exynos4210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
>  obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
> +obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
> new file mode 100644
> index 0000000..ff54a7c
> --- /dev/null
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -0,0 +1,668 @@
> +/*
> + * Samsung EXYNOS5 SoC series USB DRD PHY driver
> + *
> + * Phy provider for USB 3.0 DRD controller on Exynos5 SoC series
> + *
> + * Copyright (C) 2013 Samsung Electronics Co., Ltd.

2014 already ;-)
> + * Author: Vivek Gautam <gautam.vivek@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
.
.
<sniip>
.
.

> +
> +/*
> + * Sets the pipe3 phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets multiplier values and spread spectrum
> + * clock settings for SuperSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	/* restore any previous reference clock settings */
> +	reg = phy_drd->refclk_reg;

Why don't we just read back from the register instead?
> +
> +	/* Use EXTREFCLK as ref clock */
> +	reg &= ~PHYCLKRST_REFCLKSEL_MASK;
> +	reg |=	PHYCLKRST_REFCLKSEL_EXT_REFCLK;
> +
> +	/* FSEL settings corresponding to reference clock */
> +	reg &= ~PHYCLKRST_FSEL_PIPE_MASK |
> +		PHYCLKRST_MPLL_MULTIPLIER_MASK |
> +		PHYCLKRST_SSC_REFCLKSEL_MASK;
> +	switch (phy_drd->extrefclk) {
> +	case EXYNOS5_FSEL_50MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_24MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	case EXYNOS5_FSEL_20MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_19MHZ2:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	default:
> +		dev_dbg(phy_drd->dev, "unsupported ref clk\n");
> +		break;
> +	}
> +
> +	/* save refclk settings for multiple phy inits */
> +	phy_drd->refclk_reg = reg;
> +
> +	return reg;
> +}
> +
> +/*
> + * Sets the utmi phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets the FSEL values for HighSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_utmi_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	reg = phy_drd->refclk_reg;

same here..

Thanks
Kishon

WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Vivek Gautam <gautam.vivek@samsung.com>,
	<linux-usb@vger.kernel.org>, <linux-samsung-soc@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-doc@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <balbi@ti.com>,
	<kgene.kim@samsung.com>, <t.figa@samsung.com>,
	<k.debski@samsung.com>, <jg1.han@samsung.com>,
	<sylvester.nawrocki@gmail.com>
Subject: Re: [PATCH V4 1/5] phy: Add new Exynos5 USB 3.0 PHY driver
Date: Mon, 14 Apr 2014 17:57:51 +0530	[thread overview]
Message-ID: <534BD447.1080909@ti.com> (raw)
In-Reply-To: <1396967803-28868-2-git-send-email-gautam.vivek@samsung.com>

Hi,

On Tuesday 08 April 2014 08:06 PM, Vivek Gautam wrote:
> Add a new driver for the USB 3.0 PHY on Exynos5 series of SoCs.
> The new driver uses the generic PHY framework and will interact
> with DWC3 controller present on Exynos5 series of SoCs.
> Thereby, removing old phy-samsung-usb3 driver and related code
> used untill now which was based on usb/phy framework.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  .../devicetree/bindings/phy/samsung-phy.txt        |   42 ++
>  drivers/phy/Kconfig                                |   11 +
>  drivers/phy/Makefile                               |    1 +
>  drivers/phy/phy-exynos5-usbdrd.c                   |  668 ++++++++++++++++++++
>  4 files changed, 722 insertions(+)
>  create mode 100644 drivers/phy/phy-exynos5-usbdrd.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 28f9edb..6d99ba9 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -74,3 +74,45 @@ phy-consumer@12340000 {
>  
>  Refer to DT bindings documentation of particular PHY consumer devices for more
>  information about required PHYs and the way of specification.
> +
> +Samsung Exynos5 SoC series USB DRD PHY controller
> +--------------------------------------------------
> +
> +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.
> +- reg : Register offset and length of USB DRD PHY register set;
> +- clocks: Clock IDs array as required by the controller
> +- clock-names: names of clocks correseponding to IDs in the clock property;
> +	       Required clocks:
> +	- phy: main PHY clock (same as USB DRD controller i.e. DWC3 IP clock),
> +	       used for register access.
> +	- ref: PHY's reference clock (usually crystal clock), associated by
> +	       phy name, used to determine bit values for clock settings
> +	       register.
> +	Additional clock required for Exynos5420:
> +	- usb30_sclk_100m: Additional special clock used for PHY operation
> +			   depicted as 'sclk_usbphy30' in CMU of Exynos5420.
> +- samsung,syscon-phandle: phandle for syscon interface, which is used to
> +			  control pmu registers for power isolation.
> +- samsung,pmu-offset: phy power control register offset to pmu-system-controller
> +		      base.
> +- #phy-cells : from the generic PHY bindings, must be 1;
> +
> +For "samsung,exynos5250-usbdrd-phy" and "samsung,exynos5420-usbdrd-phy"
> +compatible PHYs, the second cell in the PHY specifier identifies the
> +PHY id, which is interpreted as follows:
> +  0 - UTMI+ type phy,
> +  1 - PIPE3 type phy,
> +
> +Example:
> +	usb3_phy: usbphy@12100000 {
> +		compatible = "samsung,exynos5250-usbdrd-phy";
> +		reg = <0x12100000 0x100>;
> +		clocks = <&clock 286>, <&clock 1>;
> +		clock-names = "phy", "usb3phy_refclk";
> +		samsung,syscon-phandle = <&pmu_syscon>;
> +		samsung,pmu-offset = <0x704>;
> +		#phy-cells = <1>;
> +	};
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 8d3c49c..d955a05 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -166,4 +166,15 @@ config PHY_XGENE
>  	help
>  	  This option enables support for APM X-Gene SoC multi-purpose PHY.
>  
> +config PHY_EXYNOS5_USBDRD
> +	tristate "Exynos5 SoC series USB DRD PHY driver"
> +	depends on ARCH_EXYNOS5 && OF
> +	depends on HAS_IOMEM
> +	select GENERIC_PHY
> +	select MFD_SYSCON

Lets try to avoid select in Kconfig. We've got enough problems with that.
> +	help
> +	  Enable USB DRD PHY support for Exynos 5 SoC series.
> +	  This driver provides PHY interface for USB 3.0 DRD controller
> +	  present on Exynos5 SoC series.
> +
>  endmenu
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 2faf78e..31baa0c 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -18,3 +18,4 @@ obj-$(CONFIG_PHY_EXYNOS4210_USB2)	+= phy-exynos4210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
>  obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
> +obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
> new file mode 100644
> index 0000000..ff54a7c
> --- /dev/null
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -0,0 +1,668 @@
> +/*
> + * Samsung EXYNOS5 SoC series USB DRD PHY driver
> + *
> + * Phy provider for USB 3.0 DRD controller on Exynos5 SoC series
> + *
> + * Copyright (C) 2013 Samsung Electronics Co., Ltd.

2014 already ;-)
> + * Author: Vivek Gautam <gautam.vivek@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
.
.
<sniip>
.
.

> +
> +/*
> + * Sets the pipe3 phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets multiplier values and spread spectrum
> + * clock settings for SuperSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	/* restore any previous reference clock settings */
> +	reg = phy_drd->refclk_reg;

Why don't we just read back from the register instead?
> +
> +	/* Use EXTREFCLK as ref clock */
> +	reg &= ~PHYCLKRST_REFCLKSEL_MASK;
> +	reg |=	PHYCLKRST_REFCLKSEL_EXT_REFCLK;
> +
> +	/* FSEL settings corresponding to reference clock */
> +	reg &= ~PHYCLKRST_FSEL_PIPE_MASK |
> +		PHYCLKRST_MPLL_MULTIPLIER_MASK |
> +		PHYCLKRST_SSC_REFCLKSEL_MASK;
> +	switch (phy_drd->extrefclk) {
> +	case EXYNOS5_FSEL_50MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_24MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	case EXYNOS5_FSEL_20MHZ:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x00));
> +		break;
> +	case EXYNOS5_FSEL_19MHZ2:
> +		reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF |
> +			PHYCLKRST_SSC_REFCLKSEL(0x88));
> +		break;
> +	default:
> +		dev_dbg(phy_drd->dev, "unsupported ref clk\n");
> +		break;
> +	}
> +
> +	/* save refclk settings for multiple phy inits */
> +	phy_drd->refclk_reg = reg;
> +
> +	return reg;
> +}
> +
> +/*
> + * Sets the utmi phy's clk as EXTREFCLK (XXTI) which is internal clock
> + * from clock core. Further sets the FSEL values for HighSpeed operations.
> + */
> +static unsigned int
> +exynos5_usbdrd_utmi_set_refclk(struct phy_usb_instance *inst)
> +{
> +	static u32 reg;
> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> +	reg = phy_drd->refclk_reg;

same here..

Thanks
Kishon

  parent reply	other threads:[~2014-04-14 12:28 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 14:36 [PATCH V4 0/5] Add Exynos5 USB 3.0 phy driver based on generic PHY framework Vivek Gautam
2014-04-08 14:36 ` Vivek Gautam
2014-04-08 14:36 ` [PATCH V4 1/5] phy: Add new Exynos5 USB 3.0 PHY driver Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
     [not found]   ` <1396967803-28868-2-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-09 11:06     ` Tomasz Figa
2014-04-09 11:06       ` Tomasz Figa
2014-04-09 11:06       ` Tomasz Figa
2014-04-09 11:49       ` Vivek Gautam
2014-04-09 11:49         ` Vivek Gautam
2014-04-09 13:33         ` Tomasz Figa
2014-04-09 13:33           ` Tomasz Figa
     [not found]           ` <53454C11.7060607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-10 11:39             ` Vivek Gautam
2014-04-10 11:39               ` Vivek Gautam
2014-04-10 11:39               ` Vivek Gautam
2014-04-15  6:09               ` Vivek Gautam
2014-04-15  6:09                 ` Vivek Gautam
2014-04-16 13:44                 ` Tomasz Figa
2014-04-16 13:44                   ` Tomasz Figa
     [not found]                   ` <534E892B.6090409-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-16 14:49                     ` Vivek Gautam
2014-04-16 14:49                       ` Vivek Gautam
2014-04-16 14:49                       ` Vivek Gautam
2014-04-22  2:18                       ` Jingoo Han
2014-04-22  2:18                         ` Jingoo Han
2014-04-22  3:35                         ` Vivek Gautam
2014-04-22  3:35                           ` Vivek Gautam
2014-04-14 11:54       ` Kishon Vijay Abraham I
2014-04-14 11:54         ` Kishon Vijay Abraham I
2014-04-14 11:54         ` Kishon Vijay Abraham I
     [not found]         ` <534BCC91.8090108-l0cyMroinI0@public.gmane.org>
2014-04-14 12:05           ` Vivek Gautam
2014-04-14 12:05             ` Vivek Gautam
2014-04-14 12:05             ` Vivek Gautam
2014-04-14 13:05             ` Kishon Vijay Abraham I
2014-04-14 13:05               ` Kishon Vijay Abraham I
2014-04-14 13:05               ` Kishon Vijay Abraham I
2014-04-14 13:44               ` Tomasz Figa
2014-04-14 13:44                 ` Tomasz Figa
2014-04-14 13:49                 ` Vivek Gautam
2014-04-14 13:49                   ` Vivek Gautam
     [not found]                   ` <CAFp+6iHhUvLhAKGPARS8RUfmO8RGcTrumvYb7QjJXbFD1nUuig-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-14 14:21                     ` Sylwester Nawrocki
2014-04-14 14:21                       ` Sylwester Nawrocki
2014-04-14 14:21                       ` Sylwester Nawrocki
2014-04-15  5:07                       ` Vivek Gautam
2014-04-15  5:07                         ` Vivek Gautam
2014-04-14 12:27   ` Kishon Vijay Abraham I [this message]
2014-04-14 12:27     ` Kishon Vijay Abraham I
2014-04-14 12:27     ` Kishon Vijay Abraham I
     [not found]     ` <534BD447.1080909-l0cyMroinI0@public.gmane.org>
2014-04-14 12:42       ` Vivek Gautam
2014-04-14 12:42         ` Vivek Gautam
2014-04-14 12:42         ` Vivek Gautam
2014-04-14 12:59         ` Kishon Vijay Abraham I
2014-04-14 12:59           ` Kishon Vijay Abraham I
2014-04-14 12:59           ` Kishon Vijay Abraham I
2014-04-14 13:20           ` Vivek Gautam
2014-04-14 13:20             ` Vivek Gautam
2014-04-14 13:26             ` Kishon Vijay Abraham I
2014-04-14 13:26               ` Kishon Vijay Abraham I
2014-04-14 13:26               ` Kishon Vijay Abraham I
2014-04-14 13:40               ` Vivek Gautam
2014-04-14 13:40                 ` Vivek Gautam
2014-04-14 13:46                 ` Vivek Gautam
2014-04-14 13:46                   ` Vivek Gautam
2014-04-14 13:49                 ` Tomasz Figa
2014-04-14 13:49                   ` Tomasz Figa
     [not found]                   ` <534BE77E.5090902-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-15 13:59                     ` Kishon Vijay Abraham I
2014-04-15 13:59                       ` Kishon Vijay Abraham I
2014-04-15 13:59                       ` Kishon Vijay Abraham I
2014-04-14 14:37   ` Sylwester Nawrocki
2014-04-14 14:37     ` Sylwester Nawrocki
2014-04-15  5:09     ` Vivek Gautam
2014-04-15  5:09       ` Vivek Gautam
     [not found]     ` <534BF28E.7040906-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-25  7:57       ` Tushar Behera
2014-04-25  7:57         ` Tushar Behera
2014-04-25  7:57         ` Tushar Behera
2014-04-25  8:08         ` Vivek Gautam
2014-04-25  8:08           ` Vivek Gautam
     [not found] ` <1396967803-28868-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-08 14:36   ` [PATCH v4 2/5] dt: exynos5420: Enable support for USB 3.0 PHY controller Vivek Gautam
2014-04-08 14:36     ` Vivek Gautam
2014-04-08 14:36     ` Vivek Gautam
     [not found]     ` <1396967803-28868-3-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-09 11:10       ` Tomasz Figa
2014-04-09 11:10         ` Tomasz Figa
2014-04-09 11:10         ` Tomasz Figa
2014-04-08 14:36 ` [PATCH V4 3/5] dt: exynos5420: Enable support for DWC3 controller Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
2014-04-09 11:11   ` Tomasz Figa
2014-04-09 11:11     ` Tomasz Figa
2014-04-08 14:36 ` [PATCH V4 4/5] dt: exynos5250: Enable support for generic USB DRD phy Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
     [not found]   ` <1396967803-28868-5-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-09 11:11     ` Tomasz Figa
2014-04-09 11:11       ` Tomasz Figa
2014-04-09 11:11       ` Tomasz Figa
2014-04-08 14:36 ` [PATCH V4 5/5] usb-phy: samsung-usb3: Remove older phy-samsung-usb3 driver Vivek Gautam
2014-04-08 14:36   ` Vivek Gautam
2014-04-09 11:13   ` Tomasz Figa
2014-04-09 11:13     ` Tomasz Figa
2014-04-09 11:34     ` Vivek Gautam
2014-04-09 11:34       ` Vivek Gautam
2014-04-09 11:34       ` Vivek Gautam
2014-04-16 13:33       ` Richard Genoud
2014-04-16 13:33         ` Richard Genoud
2014-04-16 14:42         ` Vivek Gautam
2014-04-16 14:42           ` Vivek Gautam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534BD447.1080909@ti.com \
    --to=kishon@ti.com \
    --cc=balbi@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gautam.vivek@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jg1.han@samsung.com \
    --cc=k.debski@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sylvester.nawrocki@gmail.com \
    --cc=t.figa@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.