devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Vivek Gautam <gautam.vivek@samsung.com>
Cc: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org, gregkh@linuxfoundation.org,
	balbi@ti.com, rob.herring@calxeda.com, kgene.kim@samsung.com,
	yulgon.kim@samsung.com, av.tikhomirov@samsung.com,
	thomas.abraham@linaro.org, kishon@ti.com, p.paneri@samsung.com
Subject: Re: [PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver
Date: Wed, 07 Nov 2012 19:34:54 +0100	[thread overview]
Message-ID: <509AA9CE.8050808@gmail.com> (raw)
In-Reply-To: <1352216197-11828-3-git-send-email-gautam.vivek@samsung.com>

Hi Vivek,

On 11/06/2012 04:36 PM, Vivek Gautam wrote:
> Adding base address information and required platform data
> support for enabling USB DRD phy on exynos5250 SOC.
>
> Signed-off-by: Vivek Gautam<gautam.vivek@samsung.com>
> ---
>   arch/arm/boot/dts/exynos5250.dtsi            |    3 ++-
>   arch/arm/mach-exynos/include/mach/regs-pmu.h |    4 ++++
>   arch/arm/mach-exynos/setup-usb-phy.c         |    9 +++++++++
>   3 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
> index 82bf042..51693af 100644
> --- a/arch/arm/boot/dts/exynos5250.dtsi
> +++ b/arch/arm/boot/dts/exynos5250.dtsi
> @@ -220,7 +220,8 @@
>
>   	usbphy {
>   		compatible = "samsung,exynos5250-usbphy";
> -		reg =<0x12130000 0x100>;
> +		reg =<0x12130000 0x100>,
> +		<0x12100000 0x100>;
>   	};
>
>   	amba {
> diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
> index d4e392b..67132b4 100644
> --- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
> +++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
> @@ -39,6 +39,10 @@
>   #define S5P_HDMI_PHY_CONTROL			S5P_PMUREG(0x0700)
>   #define S5P_HDMI_PHY_ENABLE			(1<<  0)
>
> +/* only for EXYNOS5250*/
> +#define S5P_USBDRD_PHY_CONTROL			S5P_PMUREG(0x0704)
> +#define S5P_USBDRD_PHY_ENABLE			(1<<  0)

Hmm, couldn't it be added to your usbphy node above and then this register
left for the usb phy driver to do ioremap and control it directly ? Rather
than relying on the platform data callback ? I hoped this static mapping
can be dropped once there is a proper usb phy driver in place. AFAIU
arch/arm/mach-exynos/setup-usb-phy.c is supposed to be a non-dt only thing.

> +
>   #define S5P_DAC_PHY_CONTROL			S5P_PMUREG(0x070C)
>   #define S5P_DAC_PHY_ENABLE			(1<<  0)
>
> diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
> index 6c768e0..5e46fdd 100644
> --- a/arch/arm/mach-exynos/setup-usb-phy.c
> +++ b/arch/arm/mach-exynos/setup-usb-phy.c
> @@ -238,6 +238,15 @@ void s5p_usb_phy_pmu_isolation(int on, int type)
>   			writel(readl(S5P_USBHOST_PHY_CONTROL)
>   				| S5P_USBHOST_PHY_ENABLE,
>   					S5P_USBHOST_PHY_CONTROL);
> +	} else if (type == USB_PHY_TYPE_DRD) {
> +		if (on)
> +			writel(readl(S5P_USBDRD_PHY_CONTROL)
> +				&  ~S5P_USBDRD_PHY_ENABLE,
> +					S5P_USBDRD_PHY_CONTROL);

This is horrible coding style IMHO BTW. Why not just do

		u32 reg = readl(S5P_USBDRD_PHY_CONTROL);
		if (on)
			reg &= ~S5P_USBDRD_PHY_ENABLE;
		else
			reg |= ~S5P_USBDRD_PHY_ENABLE;
		writel(reg, S5P_USBDRD_PHY_CONTROL);

Or to create some read/modify/write helper ? Anyway, I suppose this whole
setup-usb-phy.c file is going to be removed, once exynos is completely dt
only.

> +		else
> +			writel(readl(S5P_USBDRD_PHY_CONTROL)
> +				| S5P_USBDRD_PHY_ENABLE,
> +					S5P_USBDRD_PHY_CONTROL);
>   	} else {
>   		if (on)
>   			writel(readl(S5P_USBDEVICE_PHY_CONTROL)

--

Thanks,
Sylwester

  reply	other threads:[~2012-11-07 18:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 15:36 [PATCH 0/2] Adding USB 3.0 DRD-phy support for exynos5250 Vivek Gautam
2012-11-06 15:36 ` [PATCH 1/2] USB: PHY: Add support for USB 3.0 phy " Vivek Gautam
2012-11-06 23:40   ` Sylwester Nawrocki
2012-11-07 13:35     ` Vivek Gautam
2012-11-07 19:27       ` Sylwester Nawrocki
2012-11-06 15:36 ` [PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver Vivek Gautam
2012-11-07 18:34   ` Sylwester Nawrocki [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-18 15:39 [PATCH 0/2] ARM: Exynos5250: Enabling samsung usb phy Vivek Gautam
2012-12-18 15:39 ` [PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver Vivek Gautam
2012-12-18 23:32   ` Sylwester Nawrocki
2012-12-19  5:49     ` 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=509AA9CE.8050808@gmail.com \
    --to=sylvester.nawrocki@gmail.com \
    --cc=av.tikhomirov@samsung.com \
    --cc=balbi@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=gautam.vivek@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kgene.kim@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.paneri@samsung.com \
    --cc=rob.herring@calxeda.com \
    --cc=thomas.abraham@linaro.org \
    --cc=yulgon.kim@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).