All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210
@ 2012-02-10 10:35 Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control Lukasz Majewski
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski

Those patches add support for S3C-HSOTG driver for Universal C210 on the
platform part.

Patches done by Joonyoung Shim have been included to this patch series, since
those patches are necessary for further fixes. Unfortunately they haven't been 
included to mainline yet.

Joonyoung Shim (4):
  ARM: S3C64XX: Add usb otg phy control
  ARM: SAMSUNG: Fix memory size for hsotg
  ARM: EXYNOS: Add usb otg phy control for EXYNOS4210
  ARM: EXYNOS: Add hsotg device for NURI board

Lukasz Majewski (2):
  ARM: EXYNOS: select EXYNOS4_SETUP_USB_PHY at Universal_C210
  ARM: EXYNOS: USB OTG support for Universal C210

 arch/arm/mach-exynos/Kconfig                       |    1 +
 arch/arm/mach-exynos/include/mach/map.h            |    2 +
 arch/arm/mach-exynos/include/mach/regs-pmu.h       |    3 +
 arch/arm/mach-exynos/mach-nuri.c                   |    9 ++-
 arch/arm/mach-exynos/mach-universal_c210.c         |    5 +
 arch/arm/mach-exynos/setup-usb-phy.c               |   95 ++++++++++++++-----
 arch/arm/mach-s3c64xx/Kconfig                      |    8 ++
 arch/arm/mach-s3c64xx/Makefile                     |    1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c              |    4 +
 arch/arm/mach-s3c64xx/mach-smartq.c                |    3 +
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |    4 +
 arch/arm/mach-s3c64xx/setup-usb-phy.c              |   90 ++++++++++++++++++
 arch/arm/plat-samsung/devs.c                       |   16 +++-
 .../plat-samsung/include/plat/regs-usb-hsotg-phy.h |    7 +-
 arch/arm/plat-samsung/include/plat/udc-hs.h        |    5 +
 15 files changed, 223 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/mach-s3c64xx/setup-usb-phy.c

---
Dependences:
- (original Joonyoung Shim patches - before rebase):
http://comments.gmane.org/gmane.linux.usb.general/56341

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-02-10 18:26   ` Mark Brown
  2012-02-10 10:35 ` [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg Lukasz Majewski
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

From: Joonyoung Shim <jy0922.shim@samsung.com>

This patch supports to control usb otg phy of S3C64XX. Currently, the
driver for usb otg controls usb otg phy but it can be removed by this
patch.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[Rebased on the newest git/kgene/linux-samsung #for-next]
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 arch/arm/mach-s3c64xx/Kconfig                      |    8 ++
 arch/arm/mach-s3c64xx/Makefile                     |    1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c              |    4 +
 arch/arm/mach-s3c64xx/mach-smartq.c                |    3 +
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |    4 +
 arch/arm/mach-s3c64xx/setup-usb-phy.c              |   90 ++++++++++++++++++++
 arch/arm/plat-samsung/devs.c                       |   14 +++
 .../plat-samsung/include/plat/regs-usb-hsotg-phy.h |    7 +-
 arch/arm/plat-samsung/include/plat/udc-hs.h        |    5 +
 9 files changed, 133 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-s3c64xx/setup-usb-phy.c

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index dc45123..82c0915 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -83,6 +83,11 @@ config S3C64XX_SETUP_SPI
 	help
 	 Common setup code for SPI GPIO configurations
 
+config S3C64XX_SETUP_USB_PHY
+	bool
+	help
+	  Common setup code for USB PHY controller
+
 # S36400 Macchine support
 
 config MACH_SMDK6400
@@ -157,6 +162,7 @@ config MACH_SMDK6410
 	select S3C64XX_SETUP_IDE
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_KEYPAD
+	select S3C64XX_SETUP_USB_PHY
 	help
 	  Machine support for the Samsung SMDK6410
 
@@ -256,6 +262,7 @@ config MACH_SMARTQ
 	select S3C_DEV_USB_HOST
 	select S3C64XX_SETUP_SDHCI
 	select S3C64XX_SETUP_FB_24BPP
+	select S3C64XX_SETUP_USB_PHY
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
@@ -283,6 +290,7 @@ config MACH_WLF_CRAGG_6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_KEYPAD
 	select S3C64XX_SETUP_SPI
+	select S3C64XX_SETUP_USB_PHY
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_KEYPAD
 	select S3C_DEV_USB_HOST
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 610fe28..f9ce1dc 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_S3C64XX_SETUP_IDE)		+= setup-ide.o
 obj-$(CONFIG_S3C64XX_SETUP_KEYPAD)	+= setup-keypad.o
 obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO)	+= setup-sdhci-gpio.o
 obj-$(CONFIG_S3C64XX_SETUP_SPI)		+= setup-spi.o
+obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o
 
 # Machine support
 
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index f93caad..c55a822 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -61,6 +61,7 @@
 #include <plat/sdhci.h>
 #include <plat/gpio-cfg.h>
 #include <plat/s3c64xx-spi.h>
+#include <plat/udc-hs.h>
 
 #include <plat/keypad.h>
 #include <plat/clock.h>
@@ -759,6 +760,8 @@ static const struct gpio_led_platform_data gpio_leds_pdata = {
 	.num_leds = ARRAY_SIZE(gpio_leds),
 };
 
+static struct s3c_hsotg_plat crag6410_hsotg_pdata;
+
 static void __init crag6410_machine_init(void)
 {
 	/* Open drain IRQs need pullups */
@@ -783,6 +786,7 @@ static void __init crag6410_machine_init(void)
 	s3c_i2c0_set_platdata(&i2c0_pdata);
 	s3c_i2c1_set_platdata(&i2c1_pdata);
 	s3c_fb_set_platdata(&crag6410_lcd_pdata);
+	s3c_hsotg_set_platdata(&crag6410_hsotg_pdata);
 
 	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
 	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index ce31db1..ce745e1 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -187,6 +187,8 @@ static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata = {
 	},
 };
 
+static struct s3c_hsotg_plat smartq_hsotg_pdata;
+
 static int __init smartq_lcd_setup_gpio(void)
 {
 	int ret;
@@ -383,6 +385,7 @@ void __init smartq_map_io(void)
 void __init smartq_machine_init(void)
 {
 	s3c_i2c0_set_platdata(NULL);
+	s3c_hsotg_set_platdata(&smartq_hsotg_pdata);
 	s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
 	s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
 	s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index ca6fc20..d55bc96 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -72,6 +72,7 @@
 #include <plat/keypad.h>
 #include <plat/backlight.h>
 #include <plat/regs-fb-v4.h>
+#include <plat/udc-hs.h>
 
 #include "common.h"
 
@@ -631,6 +632,8 @@ static struct platform_pwm_backlight_data smdk6410_bl_data = {
 	.pwm_id = 1,
 };
 
+static struct s3c_hsotg_plat smdk6410_hsotg_pdata;
+
 static void __init smdk6410_map_io(void)
 {
 	u32 tmp;
@@ -659,6 +662,7 @@ static void __init smdk6410_machine_init(void)
 	s3c_i2c0_set_platdata(NULL);
 	s3c_i2c1_set_platdata(NULL);
 	s3c_fb_set_platdata(&smdk6410_lcd_pdata);
+	s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);
 
 	samsung_keypad_set_platdata(&smdk6410_keypad_data);
 
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
new file mode 100644
index 0000000..f6757e0
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.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.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <mach/map.h>
+#include <mach/regs-sys.h>
+#include <plat/cpu.h>
+#include <plat/regs-usb-hsotg-phy.h>
+#include <plat/usb-phy.h>
+
+static int s3c_usb_otgphy_init(struct platform_device *pdev)
+{
+	struct clk *xusbxti;
+	u32 phyclk;
+
+	writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
+
+	/* set clock frequency for PLL */
+	phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
+
+	xusbxti = clk_get(&pdev->dev, "xusbxti");
+	if (xusbxti && !IS_ERR(xusbxti)) {
+		switch (clk_get_rate(xusbxti)) {
+		case 12 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_12M;
+			break;
+		case 24 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_24M;
+			break;
+		default:
+		case 48 * MHZ:
+			/* default reference clock */
+			break;
+		}
+		clk_put(xusbxti);
+	}
+
+	/* TODO: select external clock/oscillator */
+	writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
+
+	/* set to normal OTG PHY */
+	writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
+	mdelay(1);
+
+	/* reset OTG PHY and Link */
+	writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
+			S3C_RSTCON);
+	udelay(20);	/* at-least 10uS */
+	writel(0, S3C_RSTCON);
+
+	return 0;
+}
+
+static int s3c_usb_otgphy_exit(struct platform_device *pdev)
+{
+	writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
+				S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
+
+	writel(readl(S3C64XX_OTHERS) & ~S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
+
+	return 0;
+}
+
+int s5p_usb_phy_init(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s3c_usb_otgphy_init(pdev);
+
+	return -EINVAL;
+}
+
+int s5p_usb_phy_exit(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s3c_usb_otgphy_exit(pdev);
+
+	return -EINVAL;
+}
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 145580a..21168ea 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -57,6 +57,7 @@
 #include <plat/sdhci.h>
 #include <plat/ts.h>
 #include <plat/udc.h>
+#include <plat/udc-hs.h>
 #include <plat/usb-control.h>
 #include <plat/usb-phy.h>
 #include <plat/regs-iic.h>
@@ -1449,6 +1450,19 @@ struct platform_device s3c_device_usb_hsotg = {
 		.coherent_dma_mask	= DMA_BIT_MASK(32),
 	},
 };
+
+void __init s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd)
+{
+	struct s3c_hsotg_plat *npd;
+
+	npd = s3c_set_platdata(pd, sizeof(struct s3c_hsotg_plat),
+			&s3c_device_usb_hsotg);
+
+	if (!npd->phy_init)
+		npd->phy_init = s5p_usb_phy_init;
+	if (!npd->phy_exit)
+		npd->phy_exit = s5p_usb_phy_exit;
+}
 #endif /* CONFIG_S3C_DEV_USB_HSOTG */
 
 /* USB High Spped 2.0 Device (Gadget) */
diff --git a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h b/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
index a111ad8..fcf2796 100644
--- a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
+++ b/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
@@ -25,8 +25,9 @@
 #define S3C_HSOTG_PHYREG(x)	((x) + S3C_VA_USB_HSPHY)
 
 #define S3C_PHYPWR				S3C_HSOTG_PHYREG(0x00)
-#define SRC_PHYPWR_OTG_DISABLE			(1 << 4)
-#define SRC_PHYPWR_ANALOG_POWERDOWN		(1 << 3)
+#define S3C_PHYPWR_NORMAL_MASK			(0x19 << 0)
+#define S3C_PHYPWR_OTG_DISABLE			(1 << 4)
+#define S3C_PHYPWR_ANALOG_POWERDOWN		(1 << 3)
 #define SRC_PHYPWR_FORCE_SUSPEND		(1 << 1)
 
 #define S3C_PHYCLK				S3C_HSOTG_PHYREG(0x04)
@@ -42,7 +43,7 @@
 
 #define S3C_RSTCON				S3C_HSOTG_PHYREG(0x08)
 #define S3C_RSTCON_PHYCLK			(1 << 2)
-#define S3C_RSTCON_HCLK				(1 << 2)
+#define S3C_RSTCON_HCLK				(1 << 1)
 #define S3C_RSTCON_PHY				(1 << 0)
 
 #define S3C_PHYTUNE				S3C_HSOTG_PHYREG(0x20)
diff --git a/arch/arm/plat-samsung/include/plat/udc-hs.h b/arch/arm/plat-samsung/include/plat/udc-hs.h
index a22a4f2..c9e3667 100644
--- a/arch/arm/plat-samsung/include/plat/udc-hs.h
+++ b/arch/arm/plat-samsung/include/plat/udc-hs.h
@@ -26,4 +26,9 @@ enum s3c_hsotg_dmamode {
 struct s3c_hsotg_plat {
 	enum s3c_hsotg_dmamode	dma;
 	unsigned int		is_osc : 1;
+
+	int (*phy_init)(struct platform_device *pdev, int type);
+	int (*phy_exit)(struct platform_device *pdev, int type);
 };
+
+extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-03-01  4:40   ` Kukjin Kim
  2012-02-10 10:35 ` [PATCH 3/6] ARM: EXYNOS: Add usb otg phy control for EXYNOS4210 Lukasz Majewski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

From: Joonyoung Shim <jy0922.shim@samsung.com>

The device link core registers for hsotg is base + 0000h ~ base +
11000h.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[Rebased on the newest git/kgene/linux-samsung #for-next]
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 arch/arm/plat-samsung/devs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 21168ea..7ca0875 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1436,7 +1436,7 @@ void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
 
 #ifdef CONFIG_S3C_DEV_USB_HSOTG
 static struct resource s3c_usb_hsotg_resources[] = {
-	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_16K),
+	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
 	[1] = DEFINE_RES_IRQ(IRQ_OTG),
 };
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/6] ARM: EXYNOS: Add usb otg phy control for EXYNOS4210
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board Lukasz Majewski
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

From: Joonyoung Shim <jy0922.shim@samsung.com>

This patch supports to control usb otg phy of EXYNOS4210.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[Rebased on the newest git/kgene/linux-samsung #for-next]
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 arch/arm/mach-exynos/include/mach/map.h      |    2 +
 arch/arm/mach-exynos/include/mach/regs-pmu.h |    3 +
 arch/arm/mach-exynos/setup-usb-phy.c         |   95 +++++++++++++++++++-------
 3 files changed, 75 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 7df9e74..a81c95b 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -33,6 +33,7 @@
 
 #define EXYNOS4_PA_G2D			0x12800000
 
+#define EXYNOS4_PA_USB_HSOTG		0x12480000
 #define EXYNOS4_PA_I2S0			0x03830000
 #define EXYNOS4_PA_I2S1			0xE3100000
 #define EXYNOS4_PA_I2S2			0xE2A00000
@@ -153,6 +154,7 @@
 #define S3C_PA_IIC6			EXYNOS4_PA_IIC(6)
 #define S3C_PA_IIC7			EXYNOS4_PA_IIC(7)
 #define S3C_PA_RTC			EXYNOS4_PA_RTC
+#define S3C_PA_USB_HSOTG		EXYNOS4_PA_USB_HSOTG
 #define S3C_PA_WDT			EXYNOS4_PA_WATCHDOG
 #define S3C_PA_UART			EXYNOS4_PA_UART
 #define S3C_PA_SPI0			EXYNOS4_PA_SPI0
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 4fff8e9..e181f2a 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -162,6 +162,9 @@
 #define S5P_CHECK_SLEEP				0x00000BAD
 
 /* Only for EXYNOS4210 */
+#define S5P_USBDEVICE_PHY_CONTROL	S5P_PMUREG(0x0704)
+#define S5P_USBDEVICE_PHY_ENABLE	(1 << 0)
+
 #define S5P_USBHOST_PHY_CONTROL		S5P_PMUREG(0x0708)
 #define S5P_USBHOST_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 41743d2..6cf5d6a 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -26,11 +26,72 @@ static int exynos4_usb_host_phy_is_on(void)
 	return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
 }
 
-static int exynos4_usb_phy1_init(struct platform_device *pdev)
+static void exynos4_usb_phy_clkset(struct platform_device *pdev)
 {
-	struct clk *otg_clk;
 	struct clk *xusbxti_clk;
 	u32 phyclk;
+
+	/* set clock frequency for PLL */
+	phyclk = readl(EXYNOS4_PHYCLK) & ~CLKSEL_MASK;
+
+	xusbxti_clk = clk_get(&pdev->dev, "xusbxti");
+	if (xusbxti_clk && !IS_ERR(xusbxti_clk)) {
+		switch (clk_get_rate(xusbxti_clk)) {
+		case 12 * MHZ:
+			phyclk |= CLKSEL_12M;
+			break;
+		case 24 * MHZ:
+			phyclk |= CLKSEL_24M;
+			break;
+		default:
+		case 48 * MHZ:
+			/* default reference clock */
+			break;
+		}
+		clk_put(xusbxti_clk);
+	}
+
+	writel(phyclk, EXYNOS4_PHYCLK);
+}
+
+static int exynos4_usb_phy0_init(struct platform_device *pdev)
+{
+	u32 rstcon;
+
+	writel(readl(S5P_USBDEVICE_PHY_CONTROL) | S5P_USBDEVICE_PHY_ENABLE,
+			S5P_USBDEVICE_PHY_CONTROL);
+
+	exynos4_usb_phy_clkset(pdev);
+
+	/* set to normal PHY0 */
+	writel((readl(EXYNOS4_PHYPWR) & ~PHY0_NORMAL_MASK), EXYNOS4_PHYPWR);
+
+	/* reset PHY0 and Link */
+	rstcon = readl(EXYNOS4_RSTCON) | PHY0_SWRST_MASK;
+	writel(rstcon, EXYNOS4_RSTCON);
+	udelay(10);
+
+	rstcon &= ~PHY0_SWRST_MASK;
+	writel(rstcon, EXYNOS4_RSTCON);
+	udelay(80);
+
+	return 0;
+}
+
+static int exynos4_usb_phy0_exit(struct platform_device *pdev)
+{
+	writel((readl(EXYNOS4_PHYPWR) | PHY0_ANALOG_POWERDOWN |
+				PHY0_OTG_DISABLE), EXYNOS4_PHYPWR);
+
+	writel(readl(S5P_USBDEVICE_PHY_CONTROL) & ~S5P_USBDEVICE_PHY_ENABLE,
+			S5P_USBDEVICE_PHY_CONTROL);
+
+	return 0;
+}
+
+static int exynos4_usb_phy1_init(struct platform_device *pdev)
+{
+	struct clk *otg_clk;
 	u32 rstcon;
 	int err;
 
@@ -54,27 +115,7 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
 	writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
 			S5P_USBHOST_PHY_CONTROL);
 
-	/* set clock frequency for PLL */
-	phyclk = readl(EXYNOS4_PHYCLK) & ~CLKSEL_MASK;
-
-	xusbxti_clk = clk_get(&pdev->dev, "xusbxti");
-	if (xusbxti_clk && !IS_ERR(xusbxti_clk)) {
-		switch (clk_get_rate(xusbxti_clk)) {
-		case 12 * MHZ:
-			phyclk |= CLKSEL_12M;
-			break;
-		case 24 * MHZ:
-			phyclk |= CLKSEL_24M;
-			break;
-		default:
-		case 48 * MHZ:
-			/* default reference clock */
-			break;
-		}
-		clk_put(xusbxti_clk);
-	}
-
-	writel(phyclk, EXYNOS4_PHYCLK);
+	exynos4_usb_phy_clkset(pdev);
 
 	/* floating prevention logic: disable */
 	writel((readl(EXYNOS4_PHY1CON) | FPENABLEN), EXYNOS4_PHY1CON);
@@ -136,7 +177,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_HOST)
+	if (type == S5P_USB_PHY_DEVICE)
+		return exynos4_usb_phy0_init(pdev);
+	else if (type == S5P_USB_PHY_HOST)
 		return exynos4_usb_phy1_init(pdev);
 
 	return -EINVAL;
@@ -144,7 +187,9 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_HOST)
+	if (type == S5P_USB_PHY_DEVICE)
+		return exynos4_usb_phy0_exit(pdev);
+	else if (type == S5P_USB_PHY_HOST)
 		return exynos4_usb_phy1_exit(pdev);
 
 	return -EINVAL;
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
                   ` (2 preceding siblings ...)
  2012-02-10 10:35 ` [PATCH 3/6] ARM: EXYNOS: Add usb otg phy control for EXYNOS4210 Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-02-13  9:29   ` Tushar Behera
  2012-02-10 10:35 ` [PATCH 5/6] ARM: EXYNOS: select EXYNOS4_SETUP_USB_PHY at Universal_C210 Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
  5 siblings, 1 reply; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

From: Joonyoung Shim <jy0922.shim@samsung.com>

This patch adds hsotg device to the NURI board.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[Rebased on the newest git/kgene/linux-samsung #for-next]
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 arch/arm/mach-exynos/mach-nuri.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 165c876..cd90ef2 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -43,6 +43,7 @@
 #include <plat/fb.h>
 #include <plat/sdhci.h>
 #include <plat/ehci.h>
+#include <plat/udc-hs.h>
 #include <plat/clock.h>
 #include <plat/gpio-cfg.h>
 #include <plat/iic.h>
@@ -391,6 +392,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
 	REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
+	REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
 	REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
@@ -403,7 +405,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
 	REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
-	REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
+	REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
 	REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
 };
 static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
@@ -1115,6 +1117,9 @@ static void __init nuri_ehci_init(void)
 	s5p_ehci_set_platdata(pdata);
 }
 
+/* USB OTG */
+static struct s3c_hsotg_plat nuri_hsotg_pdata;
+
 /* CAMERA */
 static struct regulator_consumer_supply cam_vdda_supply[] = {
 	REGULATOR_SUPPLY("a_sensor", "0-001f"),
@@ -1268,6 +1273,7 @@ static struct platform_device *nuri_devices[] __initdata = {
 	&exynos4_device_pd[PD_LCD0],
 	&exynos4_device_pd[PD_CAM],
 	&s5p_device_fimc_md,
+	&s3c_device_usb_hsotg,
 
 	/* NURI Devices */
 	&nuri_gpio_keys,
@@ -1312,6 +1318,7 @@ static void __init nuri_machine_init(void)
 	nuri_camera_init();
 
 	nuri_ehci_init();
+	s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
 	clk_xusbxti.rate = 24000000;
 
 	/* Last */
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/6] ARM: EXYNOS: select EXYNOS4_SETUP_USB_PHY at Universal_C210
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
                   ` (3 preceding siblings ...)
  2012-02-10 10:35 ` [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-02-10 10:35 ` [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
  5 siblings, 0 replies; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

This patch adds EXYNOS4_SETUP_USB_PHY to Kconfig for C210
Universal.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index bd4600e..47de403 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -252,6 +252,7 @@ config MACH_UNIVERSAL_C210
 	select EXYNOS4_SETUP_SDHCI
 	select EXYNOS4_SETUP_FIMC
 	select S5P_SETUP_MIPIPHY
+	select EXYNOS4_SETUP_USB_PHY
 	help
 	  Machine support for Samsung Mobile Universal S5PC210 Reference
 	  Board.
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210
  2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
                   ` (4 preceding siblings ...)
  2012-02-10 10:35 ` [PATCH 5/6] ARM: EXYNOS: select EXYNOS4_SETUP_USB_PHY at Universal_C210 Lukasz Majewski
@ 2012-02-10 10:35 ` Lukasz Majewski
  2012-02-13  6:57   ` Tushar Behera
  2012-02-13 11:38   ` [RESEND PATCH " Lukasz Majewski
  5 siblings, 2 replies; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-10 10:35 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Kyungmin Park

This patch adds platform data for using S3C-HSOTG driver at
Universal_C210 target.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index dd75101..3aaac61 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -40,6 +40,7 @@
 #include <plat/fimc-core.h>
 #include <plat/camport.h>
 #include <plat/mipi_csis.h>
+#include <plat/udc-hs.h>
 
 #include <mach/map.h>
 
@@ -927,6 +928,9 @@ static struct gpio universal_camera_gpios[] = {
 	{ GPIO_CAM_MEGA_nRST,	GPIOF_OUT_INIT_LOW,  "CAM_8M_NRST" },
 };
 
+/* USB OTG */
+static struct s3c_hsotg_plat universal_hsotg_pdata;
+
 static void universal_camera_init(void)
 {
 	s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
@@ -1037,6 +1041,7 @@ static void __init universal_machine_init(void)
 	i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
 			ARRAY_SIZE(i2c_gpio12_devs));
 
+	s3c_hsotg_set_platdata(&universal_hsotg_pdata);
 	universal_camera_init();
 
 	/* Last */
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-02-10 10:35 ` [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control Lukasz Majewski
@ 2012-02-10 18:26   ` Mark Brown
  2012-03-07 12:28     ` Kukjin Kim
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Brown @ 2012-02-10 18:26 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: linux-samsung-soc, Marek Szyprowski, Kukjin Kim, Joonyoung Shim,
	Kyungmin Park

On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
> From: Joonyoung Shim <jy0922.shim@samsung.com>
> 
> This patch supports to control usb otg phy of S3C64XX. Currently, the
> driver for usb otg controls usb otg phy but it can be removed by this
> patch.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210
  2012-02-10 10:35 ` [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
@ 2012-02-13  6:57   ` Tushar Behera
  2012-02-13  9:53     ` Lukasz Majewski
  2012-02-13 11:38   ` [RESEND PATCH " Lukasz Majewski
  1 sibling, 1 reply; 20+ messages in thread
From: Tushar Behera @ 2012-02-13  6:57 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: linux-samsung-soc, Marek Szyprowski, Kukjin Kim, Joonyoung Shim,
	Kyungmin Park

On 02/10/2012 04:05 PM, Lukasz Majewski wrote:
> This patch adds platform data for using S3C-HSOTG driver at
> Universal_C210 target.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/mach-universal_c210.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
> index dd75101..3aaac61 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -40,6 +40,7 @@
>  #include <plat/fimc-core.h>
>  #include <plat/camport.h>
>  #include <plat/mipi_csis.h>
> +#include <plat/udc-hs.h>
>  
>  #include <mach/map.h>
>  
> @@ -927,6 +928,9 @@ static struct gpio universal_camera_gpios[] = {
>  	{ GPIO_CAM_MEGA_nRST,	GPIOF_OUT_INIT_LOW,  "CAM_8M_NRST" },
>  };
>  
> +/* USB OTG */
> +static struct s3c_hsotg_plat universal_hsotg_pdata;
> +
>  static void universal_camera_init(void)
>  {
>  	s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
> @@ -1037,6 +1041,7 @@ static void __init universal_machine_init(void)
>  	i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
>  			ARRAY_SIZE(i2c_gpio12_devs));
>  
> +	s3c_hsotg_set_platdata(&universal_hsotg_pdata);
>  	universal_camera_init();
>  
>  	/* Last */

Are you not missing the device entry for &s3c_device_usb_hsotg?


-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board
  2012-02-10 10:35 ` [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board Lukasz Majewski
@ 2012-02-13  9:29   ` Tushar Behera
  0 siblings, 0 replies; 20+ messages in thread
From: Tushar Behera @ 2012-02-13  9:29 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: linux-samsung-soc, Marek Szyprowski, Kukjin Kim, Joonyoung Shim,
	Kyungmin Park

On 02/10/2012 04:05 PM, Lukasz Majewski wrote:
> From: Joonyoung Shim <jy0922.shim@samsung.com>
> 
> This patch adds hsotg device to the NURI board.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> [Rebased on the newest git/kgene/linux-samsung #for-next]
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  arch/arm/mach-exynos/mach-nuri.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
> index 165c876..cd90ef2 100644
> --- a/arch/arm/mach-exynos/mach-nuri.c
> +++ b/arch/arm/mach-exynos/mach-nuri.c
> @@ -43,6 +43,7 @@
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
>  #include <plat/ehci.h>
> +#include <plat/udc-hs.h>
>  #include <plat/clock.h>
>  #include <plat/gpio-cfg.h>
>  #include <plat/iic.h>
> @@ -391,6 +392,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
>  	REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
>  };
>  static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
> +	REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
>  	REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
>  };
>  static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
> @@ -403,7 +405,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
>  	REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
>  };
>  static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
> -	REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
> +	REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
>  	REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
>  };
>  static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
> @@ -1115,6 +1117,9 @@ static void __init nuri_ehci_init(void)
>  	s5p_ehci_set_platdata(pdata);
>  }
>  
> +/* USB OTG */
> +static struct s3c_hsotg_plat nuri_hsotg_pdata;
> +
>  /* CAMERA */
>  static struct regulator_consumer_supply cam_vdda_supply[] = {
>  	REGULATOR_SUPPLY("a_sensor", "0-001f"),
> @@ -1268,6 +1273,7 @@ static struct platform_device *nuri_devices[] __initdata = {
>  	&exynos4_device_pd[PD_LCD0],
>  	&exynos4_device_pd[PD_CAM],
>  	&s5p_device_fimc_md,
> +	&s3c_device_usb_hsotg,
>  
>  	/* NURI Devices */
>  	&nuri_gpio_keys,
> @@ -1312,6 +1318,7 @@ static void __init nuri_machine_init(void)
>  	nuri_camera_init();
>  
>  	nuri_ehci_init();
> +	s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
>  	clk_xusbxti.rate = 24000000;
>  
>  	/* Last */
It is missing S3C_DEV_USB_HSOTG entry in Kconfig file for individual boards.

Additionally, after adding the same, the build fails with following
error message.

arch/arm/plat-samsung/devs.c:1442:8: error: ‘IRQ_OTG’ undeclared here
(not in a function)
drivers/usb/gadget/s3c-hsotg.c:38:27: fatal error: mach/regs-sys.h: No
such file or directory
compilation terminated.

I had applied the patches at kgene's for-next branch while doing this
build-test.


-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210
  2012-02-13  6:57   ` Tushar Behera
@ 2012-02-13  9:53     ` Lukasz Majewski
  0 siblings, 0 replies; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-13  9:53 UTC (permalink / raw)
  To: Tushar Behera
  Cc: linux-samsung-soc, Marek Szyprowski, Kukjin Kim, Joonyoung Shim,
	Kyungmin Park

On Mon, 13 Feb 2012 12:27:01 +0530
Tushar Behera <tushar.behera@linaro.org> wrote:

> On 02/10/2012 04:05 PM, Lukasz Majewski wrote:
> > This patch adds platform data for using S3C-HSOTG driver at
> > Universal_C210 target.
> > 
> > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  arch/arm/mach-exynos/mach-universal_c210.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
> > b/arch/arm/mach-exynos/mach-universal_c210.c index dd75101..3aaac61
> > 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c
> > +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> > @@ -40,6 +40,7 @@
> >  #include <plat/fimc-core.h>
> >  #include <plat/camport.h>
> >  #include <plat/mipi_csis.h>
> > +#include <plat/udc-hs.h>
> >  
> >  #include <mach/map.h>
> >  
> > @@ -927,6 +928,9 @@ static struct gpio universal_camera_gpios[] = {
> >  	{ GPIO_CAM_MEGA_nRST,	GPIOF_OUT_INIT_LOW,
> > "CAM_8M_NRST" }, };
> >  
> > +/* USB OTG */
> > +static struct s3c_hsotg_plat universal_hsotg_pdata;
> > +
> >  static void universal_camera_init(void)
> >  {
> >  	s3c_set_platdata(&mipi_csis_platdata,
> > sizeof(mipi_csis_platdata), @@ -1037,6 +1041,7 @@ static void
> > __init universal_machine_init(void)
> > i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
> > ARRAY_SIZE(i2c_gpio12_devs)); 
> > +	s3c_hsotg_set_platdata(&universal_hsotg_pdata);
> >  	universal_camera_init();
> >  
> >  	/* Last */
> 
> Are you not missing the device entry for &s3c_device_usb_hsotg?
> 
> 

Hi,

Yes, rebase error.
Thank you for spotting.

Correct patch under development.

-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [RESEND PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210
  2012-02-10 10:35 ` [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
  2012-02-13  6:57   ` Tushar Behera
@ 2012-02-13 11:38   ` Lukasz Majewski
  2012-02-14  6:01     ` Tushar Behera
  1 sibling, 1 reply; 20+ messages in thread
From: Lukasz Majewski @ 2012-02-13 11:38 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kukjin Kim, Joonyoung Shim, Lukasz Majewski,
	Tushar Behera, Kyungmin Park

This patch adds platform data for using S3C-HSOTG driver at
Universal_C210 target.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/Kconfig                 |    1 +
 arch/arm/mach-exynos/include/mach/map.h      |    2 ++
 arch/arm/mach-exynos/include/mach/regs-sys.h |   20 ++++++++++++++++++++
 arch/arm/mach-exynos/mach-universal_c210.c   |   14 ++++++++++++++
 arch/arm/plat-samsung/devs.c                 |    2 +-
 5 files changed, 38 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-exynos/include/mach/regs-sys.h

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 440d095..42bb710 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -246,6 +246,7 @@ config MACH_UNIVERSAL_C210
 	select S5P_DEV_MFC
 	select S5P_DEV_ONENAND
 	select S5P_DEV_TV
+	select S3C_DEV_USB_HSOTG
 	select EXYNOS4_DEV_DMA
 	select EXYNOS4_DEV_PD
 	select EXYNOS4_SETUP_FIMD0
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index a81c95b..be09588 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -34,6 +34,8 @@
 #define EXYNOS4_PA_G2D			0x12800000
 
 #define EXYNOS4_PA_USB_HSOTG		0x12480000
+#define EXYNOS4_PA_USB_HSPHY		0x125B0000
+
 #define EXYNOS4_PA_I2S0			0x03830000
 #define EXYNOS4_PA_I2S1			0xE3100000
 #define EXYNOS4_PA_I2S2			0xE2A00000
diff --git a/arch/arm/mach-exynos/include/mach/regs-sys.h b/arch/arm/mach-exynos/include/mach/regs-sys.h
new file mode 100644
index 0000000..5682227
--- /dev/null
+++ b/arch/arm/mach-exynos/include/mach/regs-sys.h
@@ -0,0 +1,20 @@
+/* arch/arm/mach-s5pv210/include/mach/regs-sys.h
+ *
+ * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
+ *
+ * S5PV210 - System registers definitions
+ *
+ * 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.
+*/
+
+/* Registers related to power management */
+#define S5P_PMREGx(x)			(S5P_VA_PMU + (x))
+
+#define S5P_USBOTG_PHY_CONTROL		S5P_PMREGx(0x0704)
+#define S5P_USBOTG_PHY_EN		(1 << 0)
+
+/* compatibility for hsotg driver */
+#define S3C64XX_OTHERS		S5P_USBOTG_PHY_CONTROL
+#define S3C64XX_OTHERS_USBMASK	S5P_USBOTG_PHY_EN
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 220de1c..2e43e98 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -28,6 +28,7 @@
 #include <asm/mach-types.h>
 
 #include <plat/regs-serial.h>
+#include <plat/clock.h>
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/iic.h>
@@ -41,6 +42,7 @@
 #include <plat/s5p-time.h>
 #include <plat/camport.h>
 #include <plat/mipi_csis.h>
+#include <plat/udc-hs.h>
 
 #include <mach/map.h>
 
@@ -200,6 +202,7 @@ static struct regulator_init_data lp3974_ldo2_data = {
 };
 
 static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
+	REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
 	REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
 	REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
 	REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
@@ -285,6 +288,7 @@ static struct regulator_init_data lp3974_ldo7_data = {
 };
 
 static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
+	REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
 	REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
 };
 
@@ -475,7 +479,10 @@ static struct regulator_init_data lp3974_vichg_data = {
 static struct regulator_init_data lp3974_esafeout1_data = {
 	.constraints	= {
 		.name		= "SAFEOUT1",
+		.min_uV		= 4800000,
+		.max_uV		= 4800000,
 		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+		.always_on	= 1,
 		.state_mem	= {
 			.enabled	= 1,
 		},
@@ -928,6 +935,9 @@ static struct gpio universal_camera_gpios[] = {
 	{ GPIO_CAM_MEGA_nRST,	GPIOF_OUT_INIT_LOW,  "CAM_8M_NRST" },
 };
 
+/* USB OTG */
+static struct s3c_hsotg_plat universal_hsotg_pdata;
+
 static void universal_camera_init(void)
 {
 	s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
@@ -981,6 +991,7 @@ static struct platform_device *universal_devices[] __initdata = {
 	&universal_gpio_keys,
 	&s5p_device_onenand,
 	&s5p_device_fimd0,
+	&s3c_device_usb_hsotg,
 	&s5p_device_mfc,
 	&s5p_device_mfc_l,
 	&s5p_device_mfc_r,
@@ -1039,6 +1050,7 @@ static void __init universal_machine_init(void)
 	i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
 			ARRAY_SIZE(i2c_gpio12_devs));
 
+	s3c_hsotg_set_platdata(&universal_hsotg_pdata);
 	universal_camera_init();
 
 	/* Last */
@@ -1052,6 +1064,8 @@ static void __init universal_machine_init(void)
 	s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
 	s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
 	s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
+
+	clk_xusbxti.rate = 24000000;
 }
 
 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 2d4d500..2e6558e 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1439,7 +1439,7 @@ void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
 #ifdef CONFIG_S3C_DEV_USB_HSOTG
 static struct resource s3c_usb_hsotg_resources[] = {
 	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
-	[1] = DEFINE_RES_IRQ(IRQ_OTG),
+	[1] = DEFINE_RES_IRQ(IRQ_USB_HSOTG),
 };
 
 struct platform_device s3c_device_usb_hsotg = {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [RESEND PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210
  2012-02-13 11:38   ` [RESEND PATCH " Lukasz Majewski
@ 2012-02-14  6:01     ` Tushar Behera
  0 siblings, 0 replies; 20+ messages in thread
From: Tushar Behera @ 2012-02-14  6:01 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: linux-samsung-soc, Marek Szyprowski, Kukjin Kim, Joonyoung Shim,
	Kyungmin Park

On 02/13/2012 05:08 PM, Lukasz Majewski wrote:
> This patch adds platform data for using S3C-HSOTG driver at
> Universal_C210 target.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/Kconfig                 |    1 +
>  arch/arm/mach-exynos/include/mach/map.h      |    2 ++
>  arch/arm/mach-exynos/include/mach/regs-sys.h |   20 ++++++++++++++++++++
>  arch/arm/mach-exynos/mach-universal_c210.c   |   14 ++++++++++++++
>  arch/arm/plat-samsung/devs.c                 |    2 +-

You must split these changes to platform-code and board-specific code
... and the changes to fix build-error w.r.t. S3C_DEV_USB_HSOTG should
come before OTG support is added to any of the EXYNOS based boards.

>  5 files changed, 38 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/mach-exynos/include/mach/regs-sys.h
> 
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index 440d095..42bb710 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -246,6 +246,7 @@ config MACH_UNIVERSAL_C210
>  	select S5P_DEV_MFC
>  	select S5P_DEV_ONENAND
>  	select S5P_DEV_TV
> +	select S3C_DEV_USB_HSOTG

The same needs to be updated for nuri-board also ...

>  	select EXYNOS4_DEV_DMA
>  	select EXYNOS4_DEV_PD
>  	select EXYNOS4_SETUP_FIMD0
> diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
> index a81c95b..be09588 100644
> --- a/arch/arm/mach-exynos/include/mach/map.h
> +++ b/arch/arm/mach-exynos/include/mach/map.h
> @@ -34,6 +34,8 @@
>  #define EXYNOS4_PA_G2D			0x12800000
>  
>  #define EXYNOS4_PA_USB_HSOTG		0x12480000
> +#define EXYNOS4_PA_USB_HSPHY		0x125B0000

This macro is not used anywhere in the patch. I suppose it is not
required.

> +
>  #define EXYNOS4_PA_I2S0			0x03830000
>  #define EXYNOS4_PA_I2S1			0xE3100000
>  #define EXYNOS4_PA_I2S2			0xE2A00000
> diff --git a/arch/arm/mach-exynos/include/mach/regs-sys.h b/arch/arm/mach-exynos/include/mach/regs-sys.h
> new file mode 100644
> index 0000000..5682227
> --- /dev/null
> +++ b/arch/arm/mach-exynos/include/mach/regs-sys.h
> @@ -0,0 +1,20 @@
> +/* arch/arm/mach-s5pv210/include/mach/regs-sys.h
Change the file name, or still better, don't use the filename at all.

> + *
> + * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
> + *
> + * S5PV210 - System registers definitions
EXYNOS?

> + *
> + * 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.
> +*/
> +
> +/* Registers related to power management */
> +#define S5P_PMREGx(x)			(S5P_VA_PMU + (x))
> +
> +#define S5P_USBOTG_PHY_CONTROL		S5P_PMREGx(0x0704)
> +#define S5P_USBOTG_PHY_EN		(1 << 0)
> +
> +/* compatibility for hsotg driver */
> +#define S3C64XX_OTHERS		S5P_USBOTG_PHY_CONTROL
> +#define S3C64XX_OTHERS_USBMASK	S5P_USBOTG_PHY_EN

I don't think we need these definitions.

> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
> index 220de1c..2e43e98 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -28,6 +28,7 @@
>  #include <asm/mach-types.h>
>  
>  #include <plat/regs-serial.h>
> +#include <plat/clock.h>
>  #include <plat/cpu.h>
>  #include <plat/devs.h>
>  #include <plat/iic.h>
> @@ -41,6 +42,7 @@
>  #include <plat/s5p-time.h>
>  #include <plat/camport.h>
>  #include <plat/mipi_csis.h>
> +#include <plat/udc-hs.h>
>  
>  #include <mach/map.h>
>  
> @@ -200,6 +202,7 @@ static struct regulator_init_data lp3974_ldo2_data = {
>  };
>  
>  static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
> +	REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
>  	REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
>  	REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
>  	REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
> @@ -285,6 +288,7 @@ static struct regulator_init_data lp3974_ldo7_data = {
>  };
>  
>  static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
> +	REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
>  	REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
>  };
>  
> @@ -475,7 +479,10 @@ static struct regulator_init_data lp3974_vichg_data = {
>  static struct regulator_init_data lp3974_esafeout1_data = {
>  	.constraints	= {
>  		.name		= "SAFEOUT1",
> +		.min_uV		= 4800000,
> +		.max_uV		= 4800000,
>  		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +		.always_on	= 1,
>  		.state_mem	= {
>  			.enabled	= 1,
>  		},
> @@ -928,6 +935,9 @@ static struct gpio universal_camera_gpios[] = {
>  	{ GPIO_CAM_MEGA_nRST,	GPIOF_OUT_INIT_LOW,  "CAM_8M_NRST" },
>  };
>  
> +/* USB OTG */
> +static struct s3c_hsotg_plat universal_hsotg_pdata;
> +
>  static void universal_camera_init(void)
>  {
>  	s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
> @@ -981,6 +991,7 @@ static struct platform_device *universal_devices[] __initdata = {
>  	&universal_gpio_keys,
>  	&s5p_device_onenand,
>  	&s5p_device_fimd0,
> +	&s3c_device_usb_hsotg,
>  	&s5p_device_mfc,
>  	&s5p_device_mfc_l,
>  	&s5p_device_mfc_r,
> @@ -1039,6 +1050,7 @@ static void __init universal_machine_init(void)
>  	i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
>  			ARRAY_SIZE(i2c_gpio12_devs));
>  
> +	s3c_hsotg_set_platdata(&universal_hsotg_pdata);
>  	universal_camera_init();
>  
>  	/* Last */
> @@ -1052,6 +1064,8 @@ static void __init universal_machine_init(void)
>  	s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
>  	s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
>  	s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
> +
> +	clk_xusbxti.rate = 24000000;
>  }
>  
>  MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
> index 2d4d500..2e6558e 100644
> --- a/arch/arm/plat-samsung/devs.c
> +++ b/arch/arm/plat-samsung/devs.c
> @@ -1439,7 +1439,7 @@ void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
>  #ifdef CONFIG_S3C_DEV_USB_HSOTG
>  static struct resource s3c_usb_hsotg_resources[] = {
>  	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
> -	[1] = DEFINE_RES_IRQ(IRQ_OTG),
> +	[1] = DEFINE_RES_IRQ(IRQ_USB_HSOTG),
>  };
>  
>  struct platform_device s3c_device_usb_hsotg = {


-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg
  2012-02-10 10:35 ` [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg Lukasz Majewski
@ 2012-03-01  4:40   ` Kukjin Kim
  2012-03-08  2:50     ` Tushar Behera
  0 siblings, 1 reply; 20+ messages in thread
From: Kukjin Kim @ 2012-03-01  4:40 UTC (permalink / raw)
  To: 'Lukasz Majewski', linux-samsung-soc
  Cc: 'Marek Szyprowski', 'Joonyoung Shim',
	'Kyungmin Park'

Lukasz Majewski wrote:
> 
> From: Joonyoung Shim <jy0922.shim@samsung.com>
> 
> The device link core registers for hsotg is base + 0000h ~ base +
> 11000h.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> [Rebased on the newest git/kgene/linux-samsung #for-next]
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  arch/arm/plat-samsung/devs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
> index 21168ea..7ca0875 100644
> --- a/arch/arm/plat-samsung/devs.c
> +++ b/arch/arm/plat-samsung/devs.c
> @@ -1436,7 +1436,7 @@ void __init s5p_ehci_set_platdata(struct
> s5p_ehci_platdata *pd)
> 
>  #ifdef CONFIG_S3C_DEV_USB_HSOTG
>  static struct resource s3c_usb_hsotg_resources[] = {
> -	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_16K),
> +	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
>  	[1] = DEFINE_RES_IRQ(IRQ_OTG),
>  };
> 
> --
> 1.7.2.3

OK, will apply.
Thanks.

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-02-10 18:26   ` Mark Brown
@ 2012-03-07 12:28     ` Kukjin Kim
  2012-03-08  9:52       ` Kukjin Kim
  0 siblings, 1 reply; 20+ messages in thread
From: Kukjin Kim @ 2012-03-07 12:28 UTC (permalink / raw)
  To: Mark Brown
  Cc: Lukasz Majewski, linux-samsung-soc, Marek Szyprowski, Kukjin Kim,
	Joonyoung Shim, Kyungmin Park

On 02/10/12 10:26, Mark Brown wrote:
> On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
>> From: Joonyoung Shim<jy0922.shim@samsung.com>
>>
>> This patch supports to control usb otg phy of S3C64XX. Currently, the
>> driver for usb otg controls usb otg phy but it can be removed by this
>> patch.
>
> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>

Applied, thanks.

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg
  2012-03-01  4:40   ` Kukjin Kim
@ 2012-03-08  2:50     ` Tushar Behera
  0 siblings, 0 replies; 20+ messages in thread
From: Tushar Behera @ 2012-03-08  2:50 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Lukasz Majewski', linux-samsung-soc,
	'Marek Szyprowski', 'Joonyoung Shim',
	'Kyungmin Park'

On 03/01/2012 10:10 AM, Kukjin Kim wrote:
> Lukasz Majewski wrote:
>>
>> From: Joonyoung Shim <jy0922.shim@samsung.com>
>>
>> The device link core registers for hsotg is base + 0000h ~ base +
>> 11000h.
>>
>> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> [Rebased on the newest git/kgene/linux-samsung #for-next]
>> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
>> ---
>>  arch/arm/plat-samsung/devs.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
>> index 21168ea..7ca0875 100644
>> --- a/arch/arm/plat-samsung/devs.c
>> +++ b/arch/arm/plat-samsung/devs.c
>> @@ -1436,7 +1436,7 @@ void __init s5p_ehci_set_platdata(struct
>> s5p_ehci_platdata *pd)
>>
>>  #ifdef CONFIG_S3C_DEV_USB_HSOTG
>>  static struct resource s3c_usb_hsotg_resources[] = {
>> -	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_16K),
>> +	[0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
>>  	[1] = DEFINE_RES_IRQ(IRQ_OTG),

As defined in arch/arm/mach-exynos/include/mach/irqs.h, should the IRQ
resource be DEFINE_RES_IRQ(IRQ_USB_HSOTG)?

>>  };
>>
>> --
>> 1.7.2.3
> 
> OK, will apply.
> Thanks.
> 
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-03-07 12:28     ` Kukjin Kim
@ 2012-03-08  9:52       ` Kukjin Kim
  2012-03-08 11:27         ` Joonyoung Shim
  0 siblings, 1 reply; 20+ messages in thread
From: Kukjin Kim @ 2012-03-08  9:52 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Mark Brown, Lukasz Majewski, linux-samsung-soc, Marek Szyprowski,
	Joonyoung Shim, Kyungmin Park

On 03/07/12 04:28, Kukjin Kim wrote:
> On 02/10/12 10:26, Mark Brown wrote:
>> On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
>>> From: Joonyoung Shim<jy0922.shim@samsung.com>
>>>
>>> This patch supports to control usb otg phy of S3C64XX. Currently, the
>>> driver for usb otg controls usb otg phy but it can be removed by this
>>> patch.
>>
>> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
>
> Applied, thanks.
>

Oops, following error happened with s5pv210_defconfig after applying this.

arch/arm/plat-samsung/built-in.o: In function `s3c_hsotg_set_platdata':
arch/arm/plat-samsung/devs.c:1449: undefined reference to `s5p_usb_phy_init'
arch/arm/plat-samsung/devs.c:1449: undefined reference to `s5p_usb_phy_init'
arch/arm/plat-samsung/devs.c:1451: undefined reference to `s5p_usb_phy_exit'
arch/arm/plat-samsung/devs.c:1451: undefined reference to `s5p_usb_phy_exit'
make: *** [.tmp_vmlinux1] Error 1

Thanks.

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-03-08  9:52       ` Kukjin Kim
@ 2012-03-08 11:27         ` Joonyoung Shim
  2012-03-08 13:20           ` Lukasz Majewski
  0 siblings, 1 reply; 20+ messages in thread
From: Joonyoung Shim @ 2012-03-08 11:27 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Mark Brown, Lukasz Majewski, linux-samsung-soc, Marek Szyprowski,
	Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

On 03/08/2012 06:52 PM, Kukjin Kim wrote:
> On 03/07/12 04:28, Kukjin Kim wrote:
>> On 02/10/12 10:26, Mark Brown wrote:
>>> On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
>>>> From: Joonyoung Shim<jy0922.shim@samsung.com>
>>>>
>>>> This patch supports to control usb otg phy of S3C64XX. Currently, the
>>>> driver for usb otg controls usb otg phy but it can be removed by this
>>>> patch.
>>>
>>> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
>>
>> Applied, thanks.
>>
>
> Oops, following error happened with s5pv210_defconfig after applying 
> this.
>
> arch/arm/plat-samsung/built-in.o: In function `s3c_hsotg_set_platdata':
> arch/arm/plat-samsung/devs.c:1449: undefined reference to 
> `s5p_usb_phy_init'
> arch/arm/plat-samsung/devs.c:1449: undefined reference to 
> `s5p_usb_phy_init'
> arch/arm/plat-samsung/devs.c:1451: undefined reference to 
> `s5p_usb_phy_exit'
> arch/arm/plat-samsung/devs.c:1451: undefined reference to 
> `s5p_usb_phy_exit'
> make: *** [.tmp_vmlinux1] Error 1
>

Also the s5pv210 needs setup-usb-phy.c file. I think the attached patch
will solve this errors. This patch was tested only compile.

Thanks.

[-- Attachment #2: 0001-ARM-S5PV210-Add-usb-otg-phy-control.patch --]
[-- Type: text/x-patch, Size: 4923 bytes --]

>From 9ae6ac166743391a6037d7e7a4d178f68a96f047 Mon Sep 17 00:00:00 2001
From: Joonyoung Shim <jy0922.shim@samsung.com>
Date: Thu, 8 Mar 2012 19:52:25 +0900
Subject: [PATCH] ARM: S5PV210: Add usb otg phy control

This patch supports to control usb otg phy of S5PV210. Based on
setup-usb-phy.c of S3C64XX.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-s5pv210/Kconfig                 |    6 ++
 arch/arm/mach-s5pv210/Makefile                |    1 +
 arch/arm/mach-s5pv210/include/mach/regs-sys.h |    4 -
 arch/arm/mach-s5pv210/setup-usb-phy.c         |   90 +++++++++++++++++++++++++
 4 files changed, 97 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/setup-usb-phy.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 2cdc42e..82525e3 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -65,6 +65,11 @@ config S5PV210_SETUP_SPI
 	help
 	  Common setup code for SPI GPIO configurations.
 
+config S5PV210_SETUP_USB_PHY
+	bool
+	help
+	  Common setup code for USB PHY controller
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
@@ -107,6 +112,7 @@ config MACH_GONI
 	select S5PV210_SETUP_KEYPAD
 	select S5PV210_SETUP_SDHCI
 	select S5PV210_SETUP_FIMC
+	select S5PV210_SETUP_USB_PHY
 	help
 	  Machine support for Samsung GONI board
 	  S5PC110(MCP) is one of package option of S5PV210
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 76a121d..1c4e419 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
 obj-$(CONFIG_S5PV210_SETUP_KEYPAD)	+= setup-keypad.o
 obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO)	+= setup-sdhci-gpio.o
 obj-$(CONFIG_S5PV210_SETUP_SPI)		+= setup-spi.o
+obj-$(CONFIG_S5PV210_SETUP_USB_PHY) += setup-usb-phy.o
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-sys.h b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
index 26691d3..cccb1ed 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-sys.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
@@ -13,7 +13,3 @@
 #define S5PV210_USB_PHY_CON	(S3C_VA_SYS + 0xE80C)
 #define S5PV210_USB_PHY0_EN	(1 << 0)
 #define S5PV210_USB_PHY1_EN	(1 << 1)
-
-/* compatibility defines for s3c-hsotg driver */
-#define S3C64XX_OTHERS		S5PV210_USB_PHY_CON
-#define S3C64XX_OTHERS_USBMASK	S5PV210_USB_PHY0_EN
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
new file mode 100644
index 0000000..be39cf4
--- /dev/null
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@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 Foundationr
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <mach/map.h>
+#include <mach/regs-sys.h>
+#include <plat/cpu.h>
+#include <plat/regs-usb-hsotg-phy.h>
+#include <plat/usb-phy.h>
+
+static int s5pv210_usb_otgphy_init(struct platform_device *pdev)
+{
+	struct clk *xusbxti;
+	u32 phyclk;
+
+	writel(readl(S5PV210_USB_PHY_CON) | S5PV210_USB_PHY0_EN,
+			S5PV210_USB_PHY_CON);
+
+	/* set clock frequency for PLL */
+	phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
+
+	xusbxti = clk_get(&pdev->dev, "xusbxti");
+	if (xusbxti && !IS_ERR(xusbxti)) {
+		switch (clk_get_rate(xusbxti)) {
+		case 12 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_12M;
+			break;
+		case 24 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_24M;
+			break;
+		default:
+		case 48 * MHZ:
+			/* default reference clock */
+			break;
+		}
+		clk_put(xusbxti);
+	}
+
+	/* TODO: select external clock/oscillator */
+	writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
+
+	/* set to normal OTG PHY */
+	writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
+	mdelay(1);
+
+	/* reset OTG PHY and Link */
+	writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
+			S3C_RSTCON);
+	udelay(20);	/* at-least 10uS */
+	writel(0, S3C_RSTCON);
+
+	return 0;
+}
+
+static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
+{
+	writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
+				S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
+
+	writel(readl(S5PV210_USB_PHY_CON) & ~S5PV210_USB_PHY0_EN,
+			S5PV210_USB_PHY_CON);
+
+	return 0;
+}
+
+int s5p_usb_phy_init(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5pv210_usb_otgphy_init(pdev);
+
+	return -EINVAL;
+}
+
+int s5p_usb_phy_exit(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5pv210_usb_otgphy_exit(pdev);
+
+	return -EINVAL;
+}
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-03-08 11:27         ` Joonyoung Shim
@ 2012-03-08 13:20           ` Lukasz Majewski
  2012-03-09 15:35             ` Kukjin Kim
  0 siblings, 1 reply; 20+ messages in thread
From: Lukasz Majewski @ 2012-03-08 13:20 UTC (permalink / raw)
  To: Joonyoung Shim
  Cc: Kukjin Kim, Mark Brown, linux-samsung-soc@vger.kernel.org,
	Marek Szyprowski, Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

Hi Joonyoung,

On Thu, 8 Mar 2012 12:27:30 +0100
Joonyoung Shim <jy0922.shim@samsung.com> wrote:

> On 03/08/2012 06:52 PM, Kukjin Kim wrote:
> > On 03/07/12 04:28, Kukjin Kim wrote:
> >> On 02/10/12 10:26, Mark Brown wrote:
> >>> On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
> >>>> From: Joonyoung Shim<jy0922.shim@samsung.com>
> >>>>
> >>>> This patch supports to control usb otg phy of S3C64XX.
> >>>> Currently, the driver for usb otg controls usb otg phy but it
> >>>> can be removed by this patch.
> >>>
> >>> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
> >>
> >> Applied, thanks.
> >>
> >
> > Oops, following error happened with s5pv210_defconfig after
> > applying this.
> >
> > arch/arm/plat-samsung/built-in.o: In function
> > `s3c_hsotg_set_platdata': arch/arm/plat-samsung/devs.c:1449:
> > undefined reference to `s5p_usb_phy_init'
> > arch/arm/plat-samsung/devs.c:1449: undefined reference to 
> > `s5p_usb_phy_init'
> > arch/arm/plat-samsung/devs.c:1451: undefined reference to 
> > `s5p_usb_phy_exit'
> > arch/arm/plat-samsung/devs.c:1451: undefined reference to 
> > `s5p_usb_phy_exit'
> > make: *** [.tmp_vmlinux1] Error 1
> >
> 
> Also the s5pv210 needs setup-usb-phy.c file. I think the attached
> patch will solve this errors. This patch was tested only compile.
> 
> Thanks.

Thank you for the patch.

I've extended your's patch by adding GONI dependent platform code.

It has been tested and works with s3c-hsotg driver.

Test HW:
GONI S5PC110 

Tested-by: Lukasz Majewski <l.majewski@samsung.com>


-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group

[-- Attachment #2: 0001-ARM-S5PV210-Add-usb-otg-phy-control.patch --]
[-- Type: text/x-patch, Size: 6098 bytes --]

>From a18166a6e87df8ade29f1d4e37b96f932d2a8909 Mon Sep 17 00:00:00 2001
From: Joonyoung Shim <jy0922.shim@samsung.com>
Date: Thu, 8 Mar 2012 19:52:25 +0900
Subject: [PATCH] ARM: S5PV210: Add usb otg phy control

This patch supports to control usb otg phy of S5PV210. Based on
setup-usb-phy.c of S3C64XX.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-s5pv210/Kconfig                 |    7 ++
 arch/arm/mach-s5pv210/Makefile                |    1 +
 arch/arm/mach-s5pv210/include/mach/regs-sys.h |    4 -
 arch/arm/mach-s5pv210/mach-goni.c             |    6 ++
 arch/arm/mach-s5pv210/setup-usb-phy.c         |   90 +++++++++++++++++++++++++
 5 files changed, 104 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/setup-usb-phy.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 2ae6a5f..b51210c 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -65,6 +65,11 @@ config S5PV210_SETUP_SPI
 	help
 	  Common setup code for SPI GPIO configurations.
 
+config S5PV210_SETUP_USB_PHY
+	bool
+	help
+	  Common setup code for USB PHY controller
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
@@ -81,6 +86,7 @@ config MACH_AQUILA
 	select S3C_DEV_USB_HSOTG
 	select S5PV210_SETUP_FB_24BPP
 	select S5PV210_SETUP_SDHCI
+	select S5PV210_SETUP_USB_PHY
 	help
 	  Machine support for the Samsung Aquila target based on S5PC110 SoC
 
@@ -108,6 +114,7 @@ config MACH_GONI
 	select S5PV210_SETUP_KEYPAD
 	select S5PV210_SETUP_SDHCI
 	select S5PV210_SETUP_FIMC
+	select S5PV210_SETUP_USB_PHY
 	help
 	  Machine support for Samsung GONI board
 	  S5PC110(MCP) is one of package option of S5PV210
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 76a121d..1c4e419 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
 obj-$(CONFIG_S5PV210_SETUP_KEYPAD)	+= setup-keypad.o
 obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO)	+= setup-sdhci-gpio.o
 obj-$(CONFIG_S5PV210_SETUP_SPI)		+= setup-spi.o
+obj-$(CONFIG_S5PV210_SETUP_USB_PHY) += setup-usb-phy.o
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-sys.h b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
index 26691d3..cccb1ed 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-sys.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
@@ -13,7 +13,3 @@
 #define S5PV210_USB_PHY_CON	(S3C_VA_SYS + 0xE80C)
 #define S5PV210_USB_PHY0_EN	(1 << 0)
 #define S5PV210_USB_PHY1_EN	(1 << 1)
-
-/* compatibility defines for s3c-hsotg driver */
-#define S3C64XX_OTHERS		S5PV210_USB_PHY_CON
-#define S3C64XX_OTHERS_USBMASK	S5PV210_USB_PHY0_EN
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 2cf5ed7..f5f4926 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -49,6 +49,7 @@
 #include <plat/mfc.h>
 #include <plat/regs-fb-v4.h>
 #include <plat/camport.h>
+#include <plat/udc-hs.h>
 
 #include <media/v4l2-mediabus.h>
 #include <media/s5p_fimc.h>
@@ -277,6 +278,9 @@ static void __init goni_tsp_init(void)
 	i2c2_devs[0].irq = gpio_to_irq(gpio);
 }
 
+/* USB OTG */
+static struct s3c_hsotg_plat goni_hsotg_pdata;
+
 static void goni_camera_init(void)
 {
 	s5pv210_fimc_setup_gpio(S5P_CAMPORT_A);
@@ -939,6 +943,8 @@ static void __init goni_machine_init(void)
 	s3c_set_platdata(&goni_fimc_md_platdata, sizeof(goni_fimc_md_platdata),
 			 &s5p_device_fimc_md);
 
+	s3c_hsotg_set_platdata(&goni_hsotg_pdata);
+
 	goni_camera_init();
 
 	/* SPI */
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
new file mode 100644
index 0000000..be39cf4
--- /dev/null
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@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 Foundationr
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <mach/map.h>
+#include <mach/regs-sys.h>
+#include <plat/cpu.h>
+#include <plat/regs-usb-hsotg-phy.h>
+#include <plat/usb-phy.h>
+
+static int s5pv210_usb_otgphy_init(struct platform_device *pdev)
+{
+	struct clk *xusbxti;
+	u32 phyclk;
+
+	writel(readl(S5PV210_USB_PHY_CON) | S5PV210_USB_PHY0_EN,
+			S5PV210_USB_PHY_CON);
+
+	/* set clock frequency for PLL */
+	phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
+
+	xusbxti = clk_get(&pdev->dev, "xusbxti");
+	if (xusbxti && !IS_ERR(xusbxti)) {
+		switch (clk_get_rate(xusbxti)) {
+		case 12 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_12M;
+			break;
+		case 24 * MHZ:
+			phyclk |= S3C_PHYCLK_CLKSEL_24M;
+			break;
+		default:
+		case 48 * MHZ:
+			/* default reference clock */
+			break;
+		}
+		clk_put(xusbxti);
+	}
+
+	/* TODO: select external clock/oscillator */
+	writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
+
+	/* set to normal OTG PHY */
+	writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
+	mdelay(1);
+
+	/* reset OTG PHY and Link */
+	writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
+			S3C_RSTCON);
+	udelay(20);	/* at-least 10uS */
+	writel(0, S3C_RSTCON);
+
+	return 0;
+}
+
+static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
+{
+	writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
+				S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
+
+	writel(readl(S5PV210_USB_PHY_CON) & ~S5PV210_USB_PHY0_EN,
+			S5PV210_USB_PHY_CON);
+
+	return 0;
+}
+
+int s5p_usb_phy_init(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5pv210_usb_otgphy_init(pdev);
+
+	return -EINVAL;
+}
+
+int s5p_usb_phy_exit(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5pv210_usb_otgphy_exit(pdev);
+
+	return -EINVAL;
+}
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control
  2012-03-08 13:20           ` Lukasz Majewski
@ 2012-03-09 15:35             ` Kukjin Kim
  0 siblings, 0 replies; 20+ messages in thread
From: Kukjin Kim @ 2012-03-09 15:35 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joonyoung Shim, Kukjin Kim, Mark Brown,
	linux-samsung-soc@vger.kernel.org, Marek Szyprowski,
	Kyungmin Park

On 03/08/12 05:20, Lukasz Majewski wrote:
> Hi Joonyoung,
>
> On Thu, 8 Mar 2012 12:27:30 +0100
> Joonyoung Shim<jy0922.shim@samsung.com>  wrote:
>
>> On 03/08/2012 06:52 PM, Kukjin Kim wrote:
>>> On 03/07/12 04:28, Kukjin Kim wrote:
>>>> On 02/10/12 10:26, Mark Brown wrote:
>>>>> On Fri, Feb 10, 2012 at 11:35:41AM +0100, Lukasz Majewski wrote:
>>>>>> From: Joonyoung Shim<jy0922.shim@samsung.com>
>>>>>>
>>>>>> This patch supports to control usb otg phy of S3C64XX.
>>>>>> Currently, the driver for usb otg controls usb otg phy but it
>>>>>> can be removed by this patch.
>>>>>
>>>>> Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com>
>>>>
>>>> Applied, thanks.
>>>>
>>>
>>> Oops, following error happened with s5pv210_defconfig after
>>> applying this.
>>>
>>> arch/arm/plat-samsung/built-in.o: In function
>>> `s3c_hsotg_set_platdata': arch/arm/plat-samsung/devs.c:1449:
>>> undefined reference to `s5p_usb_phy_init'
>>> arch/arm/plat-samsung/devs.c:1449: undefined reference to
>>> `s5p_usb_phy_init'
>>> arch/arm/plat-samsung/devs.c:1451: undefined reference to
>>> `s5p_usb_phy_exit'
>>> arch/arm/plat-samsung/devs.c:1451: undefined reference to
>>> `s5p_usb_phy_exit'
>>> make: *** [.tmp_vmlinux1] Error 1
>>>
>>
>> Also the s5pv210 needs setup-usb-phy.c file. I think the attached
>> patch will solve this errors. This patch was tested only compile.
>>
>> Thanks.
>
> Thank you for the patch.
>
> I've extended your's patch by adding GONI dependent platform code.
>
> It has been tested and works with s3c-hsotg driver.
>
> Test HW:
> GONI S5PC110
>
> Tested-by: Lukasz Majewski<l.majewski@samsung.com>
>
Looks good to me.
Applied, Thanks.

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2012-03-09 15:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-10 10:35 [PATCH 0/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
2012-02-10 10:35 ` [PATCH 1/6] ARM: S3C64XX: Add usb otg phy control Lukasz Majewski
2012-02-10 18:26   ` Mark Brown
2012-03-07 12:28     ` Kukjin Kim
2012-03-08  9:52       ` Kukjin Kim
2012-03-08 11:27         ` Joonyoung Shim
2012-03-08 13:20           ` Lukasz Majewski
2012-03-09 15:35             ` Kukjin Kim
2012-02-10 10:35 ` [PATCH 2/6] ARM: SAMSUNG: Fix memory size for hsotg Lukasz Majewski
2012-03-01  4:40   ` Kukjin Kim
2012-03-08  2:50     ` Tushar Behera
2012-02-10 10:35 ` [PATCH 3/6] ARM: EXYNOS: Add usb otg phy control for EXYNOS4210 Lukasz Majewski
2012-02-10 10:35 ` [PATCH 4/6] ARM: EXYNOS: Add hsotg device for NURI board Lukasz Majewski
2012-02-13  9:29   ` Tushar Behera
2012-02-10 10:35 ` [PATCH 5/6] ARM: EXYNOS: select EXYNOS4_SETUP_USB_PHY at Universal_C210 Lukasz Majewski
2012-02-10 10:35 ` [PATCH 6/6] ARM: EXYNOS: USB OTG support for Universal C210 Lukasz Majewski
2012-02-13  6:57   ` Tushar Behera
2012-02-13  9:53     ` Lukasz Majewski
2012-02-13 11:38   ` [RESEND PATCH " Lukasz Majewski
2012-02-14  6:01     ` Tushar Behera

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.