Re: [PATCH] usb: phy: samsung: Introducing usb phy driver for hsotg

2012-10-21 Thread Domenico Andreoli
On Wed, Oct 17, 2012 at 08:13:01PM +0100, Russell King - ARM Linux wrote:
 On Wed, Oct 17, 2012 at 08:00:00PM +0900, Kukjin Kim wrote:
   +static int samsung_usbphy_get_refclk_freq(struct samsung_usbphy *sphy)
   +{
   + struct clk *ref_clk;
   + int refclk_freq = 0;
   +
   + ref_clk = clk_get(sphy-dev, xusbxti);
   + if (IS_ERR(ref_clk)) {
  
  IS_ERR_OR_NULL(ref_clk)?
 
 For the N'th time, NO.  IS_ERR is correct here.
 
   + dev_err(sphy-dev, Failed to get reference clock\n);
   + return PTR_ERR(ref_clk);
 
 Look, it's the ABI.  Not only that but it's also TOTALLY AND UTTERLY WRONG
 to use IS_ERR_OR_NULL(foo) and then follow it with return PTR_ERR(foo).
 You end up returning ZERO.
 
 Stop telling people to use IS_ERR_OR_NULL without properly thinking about
 it first.  Virtually every single one of these done this way is a BUG.
 
 Are we clear on this?

Wouldn't be much easier to define PTR_ERR() to return -Esomething when
its argument is NULL?

This would end the whole issue of should I use IS_ERR*/PTR_ERR or look into
the pointer myself? story.  One could simply always use IS_ERR*/PTR_ERR
and have the right thing done in whatever case.

Regards,
Domenico
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: EXYNOS: exynos4-dt: Set .smp field of machine descriptor

2012-10-21 Thread Tomasz Figa
On Friday 12 of October 2012 11:49:38 Tomasz Figa wrote:
 This patch adds missing initializer of .smp field of machine descriptor
 of Exynos 4 DT machine.
 
 Signed-off-by: Tomasz Figa t.f...@samsung.com
 ---
  arch/arm/mach-exynos/mach-exynos4-dt.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c
 b/arch/arm/mach-exynos/mach-exynos4-dt.c index 7222e3c..d6bdcfb 100644
 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
 @@ -119,6 +119,7 @@ static char const *exynos4_dt_compat[] __initdata =
 {
 
  DT_MACHINE_START(EXYNOS4210_DT, Samsung Exynos4 (Flattened Device
 Tree)) /* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
 + .smp= smp_ops(exynos_smp_ops),
   .init_irq   = exynos4_init_irq,
   .map_io = exynos4_dt_map_io,
   .handle_irq = gic_handle_irq,

Ping. I think this should be considered a fix.

Best regards,
Tomasz Figa

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: exynos4: Enable serial controllers on Origen and SMDKV310

2012-10-21 Thread Tomasz Figa
Hi Kgene,

On Monday 15 of October 2012 23:23:22 Kukjin Kim wrote:
 Tomasz Figa wrote:
  Hi Kgene,
  
  On Monday 08 of October 2012 15:12:48 Tomasz Figa wrote:
   This patch adds status override of serial nodes to enable used
   serial
   ports on Origen and SMDKV310 board.
   
   Signed-off-by: Tomasz Figa t.f...@samsung.com
   ---
   
arch/arm/boot/dts/exynos4210-origen.dts   | 16 
arch/arm/boot/dts/exynos4210-smdkv310.dts | 16 
2 files changed, 32 insertions(+)
  
  I think you missed this patch when applying Exynos dts reorganization
  patches. It is needed to enable serial ports on Origen and SMDKV310
 
 boards.
 
  Could you apply it as well?
 
 Oops, yeah. I will apply.

I saw that you applied this patch to your next/dt-samsung branch, thanks.

However I think this should be considered a fix, because without it serial 
console on Origen and SMDKV310 will be broken.

Best regards,
Tomasz Figa

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: EXYNOS: exynos4-dt: Set .smp field of machine descriptor

2012-10-21 Thread Kyungmin Park
+ Arnd, Olof,

Tomasz,
I think it's better to add arm-soc maintainers at CC when send the patches.
Samsung patches doesn't handled or merged with proper time.

Thank you,
Kyungmin Park

On 10/22/12, Tomasz Figa tomasz.f...@gmail.com wrote:
 On Friday 12 of October 2012 11:49:38 Tomasz Figa wrote:
 This patch adds missing initializer of .smp field of machine descriptor
 of Exynos 4 DT machine.

 Signed-off-by: Tomasz Figa t.f...@samsung.com
 ---
  arch/arm/mach-exynos/mach-exynos4-dt.c | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c
 b/arch/arm/mach-exynos/mach-exynos4-dt.c index 7222e3c..d6bdcfb 100644
 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
 @@ -119,6 +119,7 @@ static char const *exynos4_dt_compat[] __initdata =
 {

  DT_MACHINE_START(EXYNOS4210_DT, Samsung Exynos4 (Flattened Device
 Tree)) /* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
 +.smp= smp_ops(exynos_smp_ops),
  .init_irq   = exynos4_init_irq,
  .map_io = exynos4_dt_map_io,
  .handle_irq = gic_handle_irq,

 Ping. I think this should be considered a fix.

 Best regards,
 Tomasz Figa

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ARM: EXYNOS: exynos4-dt: Set .smp field of machine descriptor

2012-10-21 Thread Kukjin Kim
Tomasz Figa wrote:
 
 This patch adds missing initializer of .smp field of machine descriptor
 of Exynos 4 DT machine.
 
 Signed-off-by: Tomasz Figa t.f...@samsung.com
 ---
  arch/arm/mach-exynos/mach-exynos4-dt.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-
 exynos/mach-exynos4-dt.c
 index 7222e3c..d6bdcfb 100644
 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
 @@ -119,6 +119,7 @@ static char const *exynos4_dt_compat[] __initdata = {
 
  DT_MACHINE_START(EXYNOS4210_DT, Samsung Exynos4 (Flattened Device
Tree))
   /* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
 + .smp= smp_ops(exynos_smp_ops),
   .init_irq   = exynos4_init_irq,
   .map_io = exynos4_dt_map_io,
   .handle_irq = gic_handle_irq,
 --
 1.7.12

Yes, right. Applied.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim kgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] ARM: EXYNOS: exynos4-dt: Set .smp field of machine descriptor

2012-10-21 Thread Kukjin Kim
Kyungmin Park wrote:
 
 + Arnd, Olof,
 
 Tomasz,
 I think it's better to add arm-soc maintainers at CC when send the
patches.
 Samsung patches doesn't handled or merged with proper time.
 

I did just now. Sorry for late.

[...]

  Ping. I think this should be considered a fix.
 
Tomasz, yes I applied this in my -fix. Note this will be sent to upstream
with other Samsung fixes during 3.7-rc, probably in a couple of days.

Thanks for your reminder.

Best regards,
Kgene.
--
Kukjin Kim kgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3] gpio: samsung: use pr_* instead of printk

2012-10-21 Thread Jingoo Han
On Friday, October 19, 2012 7:09 PM Linus Walleij wrote
 
 On Wed, Oct 17, 2012 at 3:52 AM, Jingoo Han jg1@samsung.com wrote:
 
  This patch uses pr_* instead of printk. Also, gpio_dbg
  is replaced with pr_debug.
 
  Signed-off-by: Jingoo Han jg1@samsung.com
  Reviewed-by: Linus Walleij linus.wall...@linaro.org - NAK
 
 Please consult Documentation/SubmittingPatches as to the conditions that
 apply when you add Reviewed-by tags.

Um, you already gave the Reviewed-by to the same patch, a month ago.
Anyway, I will remove Reviewed-by and send v4 patch, soon.

 
 Hint: it doesn't mean I know Linus looked at this patch.
 
 Yours,
 Linus Walleij

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V4] gpio: samsung: use pr_* instead of printk

2012-10-21 Thread Jingoo Han
This patch uses pr_* instead of printk. Also, gpio_dbg
is replaced with pr_debug.

Signed-off-by: Jingoo Han jg1@samsung.com
---
Change since v3:
- remove Linus Walleij's Reviewed-by
Change since v2:
- remove Ryan Mallon's Signed-off-by

 drivers/gpio/gpio-samsung.c |   18 ++
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index a006f0d..5c5ccdf 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -42,12 +42,6 @@
 #include plat/gpio-fns.h
 #include plat/pm.h
 
-#ifndef DEBUG_GPIO
-#define gpio_dbg(x...) do { } while (0)
-#else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
-#endif
-
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
unsigned int off, samsung_gpio_pull_t pull)
 {
@@ -599,7 +593,7 @@ static int samsung_gpiolib_4bit_input(struct gpio_chip 
*chip,
con = ~(0xf  con_4bit_shift(offset));
__raw_writel(con, base + GPIOCON_OFF);
 
-   gpio_dbg(%s: %p: CON now %08lx\n, __func__, base, con);
+   pr_debug(%s: %p: CON now %08lx\n, __func__, base, con);
 
return 0;
 }
@@ -627,7 +621,7 @@ static int samsung_gpiolib_4bit_output(struct gpio_chip 
*chip,
__raw_writel(con, base + GPIOCON_OFF);
__raw_writel(dat, base + GPIODAT_OFF);
 
-   gpio_dbg(%s: %p: CON %08lx, DAT %08lx\n, __func__, base, con, dat);
+   pr_debug(%s: %p: CON %08lx, DAT %08lx\n, __func__, base, con, dat);
 
return 0;
 }
@@ -671,7 +665,7 @@ static int samsung_gpiolib_4bit2_input(struct gpio_chip 
*chip,
con = ~(0xf  con_4bit_shift(offset));
__raw_writel(con, regcon);
 
-   gpio_dbg(%s: %p: CON %08lx\n, __func__, base, con);
+   pr_debug(%s: %p: CON %08lx\n, __func__, base, con);
 
return 0;
 }
@@ -706,7 +700,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip 
*chip,
__raw_writel(con, regcon);
__raw_writel(dat, base + GPIODAT_OFF);
 
-   gpio_dbg(%s: %p: CON %08lx, DAT %08lx\n, __func__, base, con, dat);
+   pr_debug(%s: %p: CON %08lx, DAT %08lx\n, __func__, base, con, dat);
 
return 0;
 }
@@ -926,10 +920,10 @@ static void __init samsung_gpiolib_add(struct 
samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
if (chip-pm != NULL) {
if (!chip-pm-save || !chip-pm-resume)
-   printk(KERN_ERR gpio: %s has missing PM functions\n,
+   pr_err(gpio: %s has missing PM functions\n,
   gc-label);
} else
-   printk(KERN_ERR gpio: %s has no PM function\n, gc-label);
+   pr_err(gpio: %s has no PM function\n, gc-label);
 #endif
 
/* gpiochip_add() prints own failure message on error. */
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 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 v2] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-21 Thread Jingoo Han
On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote
 
 This patch adds host phy support to samsung-usbphy.c and
 further adds support for samsung's exynos5250 usb-phy.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/mach-exynos/setup-usb-phy.c |2 +-
  arch/arm/mach-s3c64xx/setup-usb-phy.c|2 +-
  arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
  drivers/usb/phy/Kconfig  |1 -
  drivers/usb/phy/samsung-usbphy.c |  368 
 --
  include/linux/platform_data/samsung-usbphy.h |8 +-
  6 files changed, 352 insertions(+), 31 deletions(-)
 
 diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
 b/arch/arm/mach-exynos/setup-usb-phy.c
 index 1c62d20..be6cd4f 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -222,7 +222,7 @@ int s5p_usb_phy_exit(struct platform_device *pdev, int 
 type)
   return -EINVAL;
  }
 
 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)
  {
   if (on) {
   writel(readl(S5P_USBDEVICE_PHY_CONTROL)
 diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
 b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 index 3aee778..b7d1d95 100644
 --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
 +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 @@ -13,7 +13,7 @@
  #include mach/map.h
  #include mach/regs-sys.h
 
 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)
  {
   if (on) {
   writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
 diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
 b/arch/arm/plat-samsung/include/plat/usb-phy.h
 index 165ffe7..7a4a959 100644
 --- a/arch/arm/plat-samsung/include/plat/usb-phy.h
 +++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
 @@ -18,6 +18,6 @@ enum s5p_usb_phy_type {
 
  extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
  extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
 -extern void s5p_usb_phy_pmu_isolation(int on);
 +extern void s5p_usb_phy_pmu_isolation(int on, int type);
 
  #endif /* __PLAT_SAMSUNG_USB_PHY_H */
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 313685f..1ce5b32 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -35,7 +35,6 @@ config MV_U3D_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
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index ee2dee0..bd6a5e8 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -61,9 +61,120 @@
  #define MHZ (1000*1000)
  #endif


How about using exact name for the definition, as possible?
PHY SFRs are defined in Exynos5250 and Exynos5410:
HOSTPHYCTRL0 0x
HOSTPHYTUNE0 0x0004
HSICPHYCTRL1 0x0010
HSICPHYTUNE1 0x0014
HSICPHYCTRL2 0x0020
HSICPHYTUNE2 0x0024
HOSTEHCICTRL 0x0030
HOSTOHCICTRL 0x0034
USBOTG_SYS 0x0038
USBOTG_TUNE 0x0040

It would be better to use 'EXYNOS5_PHY_' as the common prefix.

 
 +/* EXYNOS5 */
 +#define EXYNOS5_PHYHOST  (0x00)

EXYNOS5_PHY_HOST_CTRL0???


 +
 +#define EXYNOS5_PHYHOST_PHYSWRSTALL  (0x1  31)
 +
 +#define EXYNOS5_PHYHOST_REFCLKSEL_MASK   (0x3)
 +#define EXYNOS5_PHYHOST_REFCLKSEL(_x)((_x)  19)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_XTAL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x0)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_EXTL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x1)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_CLKCORE\
 + EXYNOS5_PHYHOST_REFCLKSEL(0x2)
 +
 +#define EXYNOS5_PHYHOST_FSEL_MASK(0x7  16)
 +#define EXYNOS5_PHYHOST_FSEL(_x) ((_x)  16)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_50M  (0x7)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_24M  (0x5)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_20M  (0x4)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_19200K   (0x3)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_12M  (0x2)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_10M  (0x1)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_9600K(0x0)
 +
 +#define EXYNOS5_PHYHOST_TESTBURNIN   (0x1  11)
 +#define EXYNOS5_PHYHOST_RETENABLE(0x1  10)
 +#define EXYNOS5_PHYHOST_COMMONON_N   (0x1  9)
 +#define EXYNOS5_PHYHOST_SIDDQ(0x1  6)
 +#define EXYNOS5_PHYHOST_FORCESLEEP   (0x1  5)
 +#define EXYNOS5_PHYHOST_FORCESUSPEND (0x1  4)
 +#define EXYNOS5_PHYHOST_WORDINTERFACE(0x1  3)
 +#define EXYNOS5_PHYHOST_UTMISWRST(0x1  2)
 +#define EXYNOS5_PHYHOST_LINKSWRST(0x1  1)
 +#define EXYNOS5_PHYHOST_PHYSWRST (0x1  0)
 +
 +#define 

Re: [PATCH 2/4 v2] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-10-21 Thread Jingoo Han
On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote
 
 Adding usbphy node for Exynos5250 along with the platform data.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../devicetree/bindings/usb/samsung-usbphy.txt |   12 +-
  arch/arm/boot/dts/exynos5250.dtsi  |5 ++
  arch/arm/mach-exynos/Kconfig   |1 +
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |   10 +
  arch/arm/mach-exynos/setup-usb-phy.c   |   43 ---
  arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
  include/linux/platform_data/samsung-usbphy.h   |1 +
  8 files changed, 65 insertions(+), 9 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 index 7d54d59..c644d01 100644
 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -1,11 +1,19 @@
  * Samsung's usb phy transceiver
 
 -The Samsung's phy transceiver is used for controlling usb otg phy for
 -s3c-hsotg usb device controller.
 +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.
 
 +Exynos4210:
  Required properties:
  - compatible : should be samsung,exynos4210-usbphy
  - reg : base physical address of the phy registers and length of memory 
 mapped
   region.
 +
 +Exynos5250:
 +Required properties:
 +- compatible : should be samsung,exynos5250-usbphy
 +- reg : base physical address of the phy registers and length of memory 
 mapped
 + region.
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index dddfd6e..82bf042 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -218,6 +218,11 @@
   #size-cells = 0;
   };
 
 + usbphy {
 + compatible = samsung,exynos5250-usbphy;
 + reg = 0x1213 0x100;
 + };
 +
   amba {
   #address-cells = 1;
   #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
 index 4372075..e8e3d7b 100644
 --- a/arch/arm/mach-exynos/Kconfig
 +++ b/arch/arm/mach-exynos/Kconfig
 @@ -422,6 +422,7 @@ config MACH_EXYNOS5_DT
   select SOC_EXYNOS5250
   select USE_OF
   select ARM_AMBA
 + select EXYNOS4_SETUP_USB_PHY
   help
 Machine support for Samsung EXYNOS5 machine with device tree enabled.
 Select this if a fdt blob is available for the EXYNOS5 SoC based 
 board.
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 9694424..7f5eb03 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -195,6 +195,7 @@
  #define EXYNOS4_PA_EHCI  0x1258
  #define EXYNOS4_PA_OHCI  0x1259
  #define EXYNOS4_PA_HSPHY 0x125B
 +#define EXYNOS5_PA_HSPHY 0x1213
  #define EXYNOS4_PA_MFC   0x1340
 
  #define EXYNOS4_PA_UART  0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index db1cd8e..bc041be 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -11,6 +11,7 @@
 
  #include linux/of_platform.h
  #include linux/serial_core.h
 +#include linux/platform_data/samsung-usbphy.h
 
  #include asm/mach/arch.h
  #include asm/hardware/gic.h
 @@ -18,9 +19,16 @@
 
  #include plat/cpu.h
  #include plat/regs-serial.h
 +#include plat/usb-phy.h
 
  #include common.h
 
 +static struct samsung_usbphy_data exynos5_usbphy_pdata = {
 + .pmu_isolation = s5p_usb_phy_pmu_isolation,
 + .phy_cfg_sel = s5p_usb_phy_cfg_sel,
 + .type = TYPE_HOST,
 +};
 +
  /*
   * The following lookup table is used to override device names when devices
   * are registered from device tree. This is temporarily added to enable
 @@ -72,6 +80,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
   exynos-gsc.2, NULL),
   OF_DEV_AUXDATA(samsung,exynos5-gsc, EXYNOS5_PA_GSC3,
   exynos-gsc.3, NULL),
 + OF_DEV_AUXDATA(samsung,exynos5250-usbphy, EXYNOS5_PA_HSPHY,
 + s3c-usbphy, exynos5_usbphy_pdata),
   {},
  };
 
 diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
 b/arch/arm/mach-exynos/setup-usb-phy.c
 index be6cd4f..bebc99b 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -14,11 +14,15 @@
  #include linux/err.h
  #include linux/io.h
  #include 

Re: [PATCH 2/4 v2] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-10-21 Thread Vivek Gautam
Hi,

On Mon, Oct 22, 2012 at 10:33 AM, Jingoo Han jg1@samsung.com wrote:
 On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote

 Adding usbphy node for Exynos5250 along with the platform data.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../devicetree/bindings/usb/samsung-usbphy.txt |   12 +-
  arch/arm/boot/dts/exynos5250.dtsi  |5 ++
  arch/arm/mach-exynos/Kconfig   |1 +
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |   10 +
  arch/arm/mach-exynos/setup-usb-phy.c   |   43 
 ---
  arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
  include/linux/platform_data/samsung-usbphy.h   |1 +
  8 files changed, 65 insertions(+), 9 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 index 7d54d59..c644d01 100644
 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -1,11 +1,19 @@
  * Samsung's usb phy transceiver

 -The Samsung's phy transceiver is used for controlling usb otg phy for
 -s3c-hsotg usb device controller.
 +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.

 +Exynos4210:
  Required properties:
  - compatible : should be samsung,exynos4210-usbphy
  - reg : base physical address of the phy registers and length of memory 
 mapped
   region.
 +
 +Exynos5250:
 +Required properties:
 +- compatible : should be samsung,exynos5250-usbphy
 +- reg : base physical address of the phy registers and length of memory 
 mapped
 + region.
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index dddfd6e..82bf042 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -218,6 +218,11 @@
   #size-cells = 0;
   };

 + usbphy {
 + compatible = samsung,exynos5250-usbphy;
 + reg = 0x1213 0x100;
 + };
 +
   amba {
   #address-cells = 1;
   #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
 index 4372075..e8e3d7b 100644
 --- a/arch/arm/mach-exynos/Kconfig
 +++ b/arch/arm/mach-exynos/Kconfig
 @@ -422,6 +422,7 @@ config MACH_EXYNOS5_DT
   select SOC_EXYNOS5250
   select USE_OF
   select ARM_AMBA
 + select EXYNOS4_SETUP_USB_PHY
   help
 Machine support for Samsung EXYNOS5 machine with device tree enabled.
 Select this if a fdt blob is available for the EXYNOS5 SoC based 
 board.
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 9694424..7f5eb03 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -195,6 +195,7 @@
  #define EXYNOS4_PA_EHCI  0x1258
  #define EXYNOS4_PA_OHCI  0x1259
  #define EXYNOS4_PA_HSPHY 0x125B
 +#define EXYNOS5_PA_HSPHY 0x1213
  #define EXYNOS4_PA_MFC   0x1340

  #define EXYNOS4_PA_UART  0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index db1cd8e..bc041be 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -11,6 +11,7 @@

  #include linux/of_platform.h
  #include linux/serial_core.h
 +#include linux/platform_data/samsung-usbphy.h

  #include asm/mach/arch.h
  #include asm/hardware/gic.h
 @@ -18,9 +19,16 @@

  #include plat/cpu.h
  #include plat/regs-serial.h
 +#include plat/usb-phy.h

  #include common.h

 +static struct samsung_usbphy_data exynos5_usbphy_pdata = {
 + .pmu_isolation = s5p_usb_phy_pmu_isolation,
 + .phy_cfg_sel = s5p_usb_phy_cfg_sel,
 + .type = TYPE_HOST,
 +};
 +
  /*
   * The following lookup table is used to override device names when devices
   * are registered from device tree. This is temporarily added to enable
 @@ -72,6 +80,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
   exynos-gsc.2, NULL),
   OF_DEV_AUXDATA(samsung,exynos5-gsc, EXYNOS5_PA_GSC3,
   exynos-gsc.3, NULL),
 + OF_DEV_AUXDATA(samsung,exynos5250-usbphy, EXYNOS5_PA_HSPHY,
 + s3c-usbphy, exynos5_usbphy_pdata),
   {},
  };

 diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
 b/arch/arm/mach-exynos/setup-usb-phy.c
 index be6cd4f..bebc99b 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -14,11 

Re: [PATCH 1/4 v2] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-21 Thread Vivek Gautam
HI,

On Mon, Oct 22, 2012 at 10:27 AM, Jingoo Han jg1@samsung.com wrote:
 On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote

 This patch adds host phy support to samsung-usbphy.c and
 further adds support for samsung's exynos5250 usb-phy.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/mach-exynos/setup-usb-phy.c |2 +-
  arch/arm/mach-s3c64xx/setup-usb-phy.c|2 +-
  arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
  drivers/usb/phy/Kconfig  |1 -
  drivers/usb/phy/samsung-usbphy.c |  368 
 --
  include/linux/platform_data/samsung-usbphy.h |8 +-
  6 files changed, 352 insertions(+), 31 deletions(-)

 diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
 b/arch/arm/mach-exynos/setup-usb-phy.c
 index 1c62d20..be6cd4f 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -222,7 +222,7 @@ int s5p_usb_phy_exit(struct platform_device *pdev, int 
 type)
   return -EINVAL;
  }

 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)
  {
   if (on) {
   writel(readl(S5P_USBDEVICE_PHY_CONTROL)
 diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
 b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 index 3aee778..b7d1d95 100644
 --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
 +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 @@ -13,7 +13,7 @@
  #include mach/map.h
  #include mach/regs-sys.h

 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)
  {
   if (on) {
   writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
 diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
 b/arch/arm/plat-samsung/include/plat/usb-phy.h
 index 165ffe7..7a4a959 100644
 --- a/arch/arm/plat-samsung/include/plat/usb-phy.h
 +++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
 @@ -18,6 +18,6 @@ enum s5p_usb_phy_type {

  extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
  extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
 -extern void s5p_usb_phy_pmu_isolation(int on);
 +extern void s5p_usb_phy_pmu_isolation(int on, int type);

  #endif /* __PLAT_SAMSUNG_USB_PHY_H */
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 313685f..1ce5b32 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -35,7 +35,6 @@ config MV_U3D_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
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index ee2dee0..bd6a5e8 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -61,9 +61,120 @@
  #define MHZ (1000*1000)
  #endif


 How about using exact name for the definition, as possible?
 PHY SFRs are defined in Exynos5250 and Exynos5410:
 HOSTPHYCTRL0 0x
 HOSTPHYTUNE0 0x0004
 HSICPHYCTRL1 0x0010
 HSICPHYTUNE1 0x0014
 HSICPHYCTRL2 0x0020
 HSICPHYTUNE2 0x0024
 HOSTEHCICTRL 0x0030
 HOSTOHCICTRL 0x0034
 USBOTG_SYS 0x0038
 USBOTG_TUNE 0x0040

Yes, using above suggested names will be good.

 It would be better to use 'EXYNOS5_PHY_' as the common prefix.

shall modify these SFRs' names accordingly and resubmit. Thanks for
pointing out.


 +/* EXYNOS5 */
 +#define EXYNOS5_PHYHOST  (0x00)

 EXYNOS5_PHY_HOST_CTRL0???

shall change this as suggested.

 +
 +#define EXYNOS5_PHYHOST_PHYSWRSTALL  (0x1  31)
 +
 +#define EXYNOS5_PHYHOST_REFCLKSEL_MASK   (0x3)
 +#define EXYNOS5_PHYHOST_REFCLKSEL(_x)((_x)  19)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_XTAL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x0)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_EXTL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x1)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_CLKCORE\
 + EXYNOS5_PHYHOST_REFCLKSEL(0x2)
 +
 +#define EXYNOS5_PHYHOST_FSEL_MASK(0x7  16)
 +#define EXYNOS5_PHYHOST_FSEL(_x) ((_x)  16)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_50M  (0x7)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_24M  (0x5)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_20M  (0x4)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_19200K   (0x3)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_12M  (0x2)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_10M  (0x1)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_9600K(0x0)
 +
 +#define EXYNOS5_PHYHOST_TESTBURNIN   (0x1  11)
 +#define EXYNOS5_PHYHOST_RETENABLE(0x1  10)
 +#define EXYNOS5_PHYHOST_COMMONON_N   (0x1  9)
 +#define EXYNOS5_PHYHOST_SIDDQ(0x1  6)
 +#define EXYNOS5_PHYHOST_FORCESLEEP   (0x1  5)
 +#define EXYNOS5_PHYHOST_FORCESUSPEND (0x1  4)