[RESEND][PATCH] ARM: EXYNOS: Fixed undefined symbol compilation error.

2011-11-15 Thread Pankaj Dubey
Many drivers will fail to compile if compiled as module due to
undefined symbol exynos4_ioremap.
Fix has been added by exporting the same in cpu.c file.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/cpu.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c
index 8e09f34..027f65471 100644
--- a/arch/arm/mach-exynos/cpu.c
+++ b/arch/arm/mach-exynos/cpu.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
 */
 
+#include 
 #include 
 #include 
 #include 
@@ -164,6 +165,7 @@ void __iomem *exynos4_ioremap(unsigned long phy, size_t 
size, unsigned int type)
 
return __arm_ioremap(phy, size, type);
 }
+EXPORT_SYMBOL(exynos4_ioremap);
 
 static void exynos_idle(void)
 {
-- 
1.7.4.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


[PATCH 0/3] Moving xusbxti clock setting in clock.c file.

2011-12-01 Thread Pankaj Dubey
Since there is code duplication in different mach-board.c file it is better
to set default clock rate of xusbxti clock in plat-s5p/clock.c file.

The patches are based on following commit on Kukjin's for-next branch.

Pankaj (1):
  ARM: S5P: Set default rate of xusbxti clock

Pankaj Dubey (2):
  ARM: EXYNOS: Removed code for setting clock rate of xusbxti
  ARM: S5PV210: Removed code for setting clock rate of xusbxti

 arch/arm/mach-exynos/mach-nuri.c |1 -
 arch/arm/mach-exynos/mach-origen.c   |1 -
 arch/arm/mach-exynos/mach-smdk4x12.c |2 --
 arch/arm/mach-exynos/mach-smdkv310.c |1 -
 arch/arm/mach-s5pv210/mach-goni.c|1 -
 arch/arm/plat-s5p/clock.c|1 +
 6 files changed, 1 insertions(+), 6 deletions(-)

-- 
1.7.4.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


[PATCH 1/3] ARM: S5P: Set default rate of xusbxti clock

2011-12-01 Thread Pankaj Dubey
From: Pankaj 

Initialize xusbxti clock's default value here.
So that code duplication in all other mach-board.c can be avoided.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/plat-s5p/clock.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 5f84a3f..6fb9049 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -38,6 +38,7 @@ struct clk clk_ext_xtal_mux = {
 struct clk clk_xusbxti = {
.name   = "xusbxti",
.id = -1,
+   .rate   = 2400,
 };
 
 struct clk s5p_clk_27m = {
-- 
1.7.4.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


[PATCH 2/3] ARM: EXYNOS: Removed code for setting clock rate of xusbxti

2011-12-01 Thread Pankaj Dubey
Since now xusbxti clock's default rate is set in clock.c file,
there is no need to set it again in the machine file.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/mach-nuri.c |1 -
 arch/arm/mach-exynos/mach-origen.c   |1 -
 arch/arm/mach-exynos/mach-smdk4x12.c |2 --
 arch/arm/mach-exynos/mach-smdkv310.c |1 -
 4 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 236bbe1..d9196b8 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -1314,7 +1314,6 @@ static void __init nuri_machine_init(void)
nuri_camera_init();
 
nuri_ehci_init();
-   clk_xusbxti.rate = 2400;
 
/* Last */
platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
diff --git a/arch/arm/mach-exynos/mach-origen.c 
b/arch/arm/mach-exynos/mach-origen.c
index f56d027..4700456 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -702,7 +702,6 @@ static void __init origen_machine_init(void)
s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
 
origen_ehci_init();
-   clk_xusbxti.rate = 2400;
 
s5p_tv_setup();
s5p_i2c_hdmiphy_set_platdata(NULL);
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c 
b/arch/arm/mach-exynos/mach-smdk4x12.c
index fcf2e0e..35b86ea 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -247,8 +247,6 @@ static struct platform_device *smdk4x12_devices[] 
__initdata = {
 
 static void __init smdk4x12_map_io(void)
 {
-   clk_xusbxti.rate = 2400;
-
s5p_init_io(NULL, 0, S5P_VA_CHIPID);
s3c24xx_init_clocks(clk_xusbxti.rate);
s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c 
b/arch/arm/mach-exynos/mach-smdkv310.c
index cec2afa..c7fb82f 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -363,7 +363,6 @@ static void __init smdkv310_machine_init(void)
s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
 
smdkv310_ehci_init();
-   clk_xusbxti.rate = 2400;
 
platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
-- 
1.7.4.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


[PATCH 3/3] ARM: S5PV210: Removed code for setting clock rate of xusbxti

2011-12-01 Thread Pankaj Dubey
Since now xusbxti clock's default rate is set in clock.c file,
there is no need to set it again in the machine file.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-s5pv210/mach-goni.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 15edcae..02d31f4 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -947,7 +947,6 @@ static void __init goni_machine_init(void)
/* KEYPAD */
samsung_keypad_set_platdata(&keypad_data);
 
-   clk_xusbxti.rate = 2400;
 
platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
 }
-- 
1.7.4.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] clk: samsung: fixed compiler warning [-Wpointer-to-int-cast]

2014-03-16 Thread Pankaj Dubey

On 02/26/2014 11:42 AM, Pankaj Dubey wrote:

When compiled using ARM64 cross compiler, gcc complains as

drivers/clk/samsung/clk.c:293:18:
warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]

Signed-off-by: Pankaj Dubey 
---
  drivers/clk/samsung/clk.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index 91bec3e..59142ba 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -278,7 +278,7 @@ void __init samsung_clk_of_register_fixed_ext(
for_each_matching_node_and_match(np, clk_matches, &match) {
if (of_property_read_u32(np, "clock-frequency", &freq))
continue;
-   fixed_rate_clk[(u32)match->data].fixed_rate = freq;
+   fixed_rate_clk[(unsigned long)match->data].fixed_rate = freq;
}
samsung_clk_register_fixed_rate(fixed_rate_clk, nr_fixed_rate_clk);
  }


Gentle Ping.

--
Best Regards,
Pankaj Dubey

--
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 v2 0/4] Introduce new Kconfig for Samsung common clock

2014-03-19 Thread Pankaj Dubey

On 03/12/2014 01:32 PM, Pankaj Dubey wrote:

Introduce a new Kconfig file for Samsung common clock infrastructure
related config options. As current Samsung common clock gets compiled
based on PLAT_SAMSUNG, but moving ahead with ARM64 we can not have any
more such config options, so this patch introduce new COMMON_CLK_SAMSUNG
invisible option. This option also select COMMON_CLK so ARCH Kconfig just
need to select COMMON_CLK_SAMSUNG in case they want to use Samsung common
clock.

This series is based on Kukjin's for-next branch.

V2:
  1) Adding new Kconfig file for Samsung common clock.
  2) Make COMMON_CLK_SAMSUNG option invisible. (as suggested by Tomasz Figa)
  3) Let COMMON_CLK_SAMSUNG select COMMON_CLK. (as suggested by Tomasz Figa)
  4) Move S3C24XX clock config option in new Kconfig file.

Pankaj Dubey (4):
   clk: samsung: add new Kconfig for Samsung common clock options
   drivers: clk: use CONFIG_COMMON_CLK_SAMSUNG for Samsung clock support
   ARM: select COMMON_CLK_SAMSUNG for ARCH_EXYNOS and ARCH_S3C64XX
   ARM: S3C24XX: remove S3C24XX specific clock Kconfig options

  arch/arm/Kconfig  |4 ++--
  arch/arm/mach-s3c24xx/Kconfig |   14 --
  drivers/clk/Kconfig   |2 ++
  drivers/clk/Makefile  |2 +-
  drivers/clk/samsung/Kconfig   |   11 +++
  5 files changed, 16 insertions(+), 17 deletions(-)
  create mode 100644 drivers/clk/samsung/Kconfig



+CC: Mike and Tomasz Figa

Sorry, during posting second version I forgot to CC Clock maintainer's,
so CC'ing now.

Link for this series: http://lkml.org/lkml/2014/3/12/10

--
Best Regards,
Pankaj Dubey

--
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 v2 2/4] drivers: clk: use CONFIG_COMMON_CLK_SAMSUNG for Samsung clock support

2014-03-19 Thread Pankaj Dubey

On 03/19/2014 09:18 PM, Tomasz Figa wrote:

Hi Pankaj,

On 12.03.2014 05:32, Pankaj Dubey wrote:

This patch includes Samsung clock Kconfig file, and replaces PLAT_SAMSUNG
with COMMON_CLK_SAMSUNG for Samsung common clock support.
Any Samsung SoC want to use Samsung common clock infrastructure can simply
select COMMON_CLK_SAMSUNG.

Signed-off-by: Pankaj Dubey 
---
  drivers/clk/Kconfig  |2 ++
  drivers/clk/Makefile |2 +-
  2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 7641965..f2b6179 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -112,3 +112,5 @@ source "drivers/clk/qcom/Kconfig"
  endmenu

  source "drivers/clk/mvebu/Kconfig"
+
+source "drivers/clk/samsung/Kconfig"
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index a367a98..f1da6ee 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_PLAT_ORION)+= mvebu/
  obj-$(CONFIG_ARCH_MXS)+= mxs/
  obj-$(CONFIG_COMMON_CLK_QCOM)+= qcom/
  obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/
-obj-$(CONFIG_PLAT_SAMSUNG)+= samsung/
+obj-$(CONFIG_COMMON_CLK_SAMSUNG)+= samsung/
  obj-$(CONFIG_ARCH_SHMOBILE_MULTI)+= shmobile/
  obj-$(CONFIG_ARCH_SIRF)+= sirf/
  obj-$(CONFIG_ARCH_SOCFPGA)+= socfpga/



This patch makes samsung/ subdirectory compile depending on 
CONFIG_COMMON_CLK_SAMSUNG, but nothing selects it yet and thus breaking 
bisection.


Best regards,
Tomasz



Thanks for review.
OK, I will take care of this in next revision.

--
Best Regards,
Pankaj Dubey

--
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 v2 1/4] clk: samsung: add new Kconfig for Samsung common clock options

2014-03-19 Thread Pankaj Dubey

On 03/19/2014 09:19 PM, Tomasz Figa wrote:

Hi Pankaj,

On 12.03.2014 05:32, Pankaj Dubey wrote:

This patch adds new Kconfig file for adding new config option
as COMMON_CLK_SAMSUNG for Samsung common clock. This patch also
moves S3C24XX specific clock options here in this file.

Signed-off-by: Pankaj Dubey 
---
  drivers/clk/samsung/Kconfig |   11 +++
  1 file changed, 11 insertions(+)
  create mode 100644 drivers/clk/samsung/Kconfig

diff --git a/drivers/clk/samsung/Kconfig b/drivers/clk/samsung/Kconfig
new file mode 100644
index 000..26eb446
--- /dev/null
+++ b/drivers/clk/samsung/Kconfig
@@ -0,0 +1,11 @@
+config COMMON_CLK_SAMSUNG
+bool
+select COMMON_CLK
+
+config S3C2412_COMMON_CLK
+bool
+select COMMON_CLK_SAMSUNG
+
+config S3C2443_COMMON_CLK
+bool
+select COMMON_CLK_SAMSUNG



This patch adds S3C2412_COMMON_CLK and S3C2443_COMMON_CLK to 
drivers/clk/samsung/Kconfig, but they are still present in 
arch/arm/mach-s3c24xx/Kconfig, so after this patch there are duplicate 
definitions.


Best regards,
Tomasz



OK, In that case I will club change in arm/mach-s3c24xx/Kconfig and 
clk/samsung/Kconfig together

 and resubmit once again.

--
Best Regards,
Pankaj Dubey

--
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 v3 0/4] Introduce new Kconfig for Samsung common clock

2014-03-19 Thread Pankaj Dubey
Introduce a new Kconfig file for Samsung common clock infrastructure
related config options. As current Samsung common clock gets compiled
based on PLAT_SAMSUNG, but moving ahead with ARM64 we can not have any
more such config options, so this patch introduce new COMMON_CLK_SAMSUNG
invisible option. This option also select COMMON_CLK so ARCH Kconfig just
need to select COMMON_CLK_SAMSUNG in case they want to use Samsung common
clock.

This series is based on Kukjin's for-next branch.

V3: 
 1) Re-organized patches for preventing bisect issues.
 2) Rebase on top of latest Kukjin's for-next branch.
 3) Compile tested exynos_defconfig, s3c6400_defconfig and s3c2410_defconfig
after each commit.

V2:
 1) Adding new Kconfig file for Samsung common clock.
 2) Make COMMON_CLK_SAMSUNG option invisible. (as suggested by Tomasz Figa)
 3) Let COMMON_CLK_SAMSUNG select COMMON_CLK. (as suggested by Tomasz Figa)
 4) Move S3C24XX clock config option in new Kconfig file.

Pankaj Dubey (4):
  clk: samsung: add new Kconfig for Samsung common clock option
  ARM: select COMMON_CLK_SAMSUNG for ARCH_EXYNOS and ARCH_S3C64XX
  ARM: S3C24XX: move S3C24XX clock Kconfig options to Samsung clock
Kconfig file
  drivers: clk: use COMMON_CLK_SAMSUNG for Samsung clock support

 arch/arm/Kconfig  |4 ++--
 arch/arm/mach-s3c24xx/Kconfig |   14 --
 drivers/clk/Kconfig   |2 ++
 drivers/clk/Makefile  |2 +-
 drivers/clk/samsung/Kconfig   |   12 
 5 files changed, 17 insertions(+), 17 deletions(-)
 create mode 100644 drivers/clk/samsung/Kconfig

-- 
1.7.10.4

--
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 v3 2/4] ARM: select COMMON_CLK_SAMSUNG for ARCH_EXYNOS and ARCH_S3C64XX

2014-03-19 Thread Pankaj Dubey
This patch selects COMMON_CLK_SAMSUNG for EXYNOS and S3C64XX SoC
and removes COMMON_CLK selection as COMMON_CLK_SAMSUNG selects it's dependency.

CC: Russell King 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/Kconfig |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e254198..0c15aa7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -755,7 +755,7 @@ config ARCH_S3C64XX
select ARM_VIC
select CLKDEV_LOOKUP
select CLKSRC_SAMSUNG_PWM
-   select COMMON_CLK
+   select COMMON_CLK_SAMSUNG
select CPU_V6K
select GENERIC_CLOCKEVENTS
select GPIO_SAMSUNG
@@ -834,7 +834,7 @@ config ARCH_EXYNOS
select ARCH_REQUIRE_GPIOLIB
select ARCH_SPARSEMEM_ENABLE
select ARM_GIC
-   select COMMON_CLK
+   select COMMON_CLK_SAMSUNG
select CPU_V7
select GENERIC_CLOCKEVENTS
select HAVE_S3C2410_I2C if I2C
-- 
1.7.10.4

--
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 v3 3/4] ARM: S3C24XX: move S3C24XX clock Kconfig options to Samsung clock Kconfig file

2014-03-19 Thread Pankaj Dubey
This patch moves S3C24XX specific clock Kconfig options into
"clk/samsung/Kconfig" and also removes COMMON_CLK selection from
"mach-s3c24xx/Kconfig" as S3C24XX_COMMON_CLK is selecting it's dependency.

CC: Ben Dooks 
CC: Kukjin Kim 
CC: Russell King 
CC: Mike Turquette 
CC: Tomasz Figa 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-s3c24xx/Kconfig |   14 --
 drivers/clk/samsung/Kconfig   |9 +
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 80373da..2d1232e 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -39,7 +39,6 @@ config CPU_S3C2410
 
 config CPU_S3C2412
bool "SAMSUNG S3C2412"
-   select COMMON_CLK
select CPU_ARM926T
select CPU_LLSERIAL_S3C2440
select S3C2412_COMMON_CLK
@@ -50,7 +49,6 @@ config CPU_S3C2412
 
 config CPU_S3C2416
bool "SAMSUNG S3C2416/S3C2450"
-   select COMMON_CLK
select CPU_ARM926T
select CPU_LLSERIAL_S3C2440
select S3C2416_PM if PM
@@ -88,7 +86,6 @@ config CPU_S3C244X
 
 config CPU_S3C2443
bool "SAMSUNG S3C2443"
-   select COMMON_CLK
select CPU_ARM920T
select CPU_LLSERIAL_S3C2440
select S3C2443_COMMON_CLK
@@ -364,11 +361,6 @@ config S3C2412_PM_SLEEP
 
 if CPU_S3C2412
 
-config S3C2412_COMMON_CLK
-   bool
-   help
- Build the s3c2412 clock driver based on the common clock framework.
-
 config CPU_S3C2412_ONLY
bool
depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
@@ -651,12 +643,6 @@ endif  # CPU_S3C2442
 
 if CPU_S3C2443 || CPU_S3C2416
 
-config S3C2443_COMMON_CLK
-   bool
-   help
- Temporary symbol to build the clock driver based on the common clock
- framework.
-
 config S3C2443_DMA
bool
help
diff --git a/drivers/clk/samsung/Kconfig b/drivers/clk/samsung/Kconfig
index fc8696b..baf28cb 100644
--- a/drivers/clk/samsung/Kconfig
+++ b/drivers/clk/samsung/Kconfig
@@ -1,3 +1,12 @@
 config COMMON_CLK_SAMSUNG
bool
select COMMON_CLK
+
+config S3C2412_COMMON_CLK
+   bool
+   select COMMON_CLK_SAMSUNG
+
+config S3C2443_COMMON_CLK
+   bool
+   select COMMON_CLK_SAMSUNG
+
-- 
1.7.10.4

--
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 v3 4/4] drivers: clk: use COMMON_CLK_SAMSUNG for Samsung clock support

2014-03-19 Thread Pankaj Dubey
This patch replaces PLAT_SAMSUNG with COMMON_CLK_SAMSUNG for Samsung
common clock support. Any Samsung SoC want to use Samsung common clock
infrastructure can simply select COMMON_CLK_SAMSUNG.

CC: Tomasz Figa 
Signed-off-by: Pankaj Dubey 
---
 drivers/clk/Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index a367a98..f1da6ee 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_PLAT_ORION)  += mvebu/
 obj-$(CONFIG_ARCH_MXS) += mxs/
 obj-$(CONFIG_COMMON_CLK_QCOM)  += qcom/
 obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/
-obj-$(CONFIG_PLAT_SAMSUNG) += samsung/
+obj-$(CONFIG_COMMON_CLK_SAMSUNG)   += samsung/
 obj-$(CONFIG_ARCH_SHMOBILE_MULTI)  += shmobile/
 obj-$(CONFIG_ARCH_SIRF)+= sirf/
 obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/
-- 
1.7.10.4

--
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 v3 1/4] clk: samsung: add new Kconfig for Samsung common clock option

2014-03-19 Thread Pankaj Dubey
This patch adds new Kconfig file for adding new COMMON_CLK_SAMSUNG option.
Samsung platforms can select this for using common clock infrastructure.

CC: Tomasz Figa 
CC: Mike Turquette 
Signed-off-by: Pankaj Dubey 
---
 drivers/clk/Kconfig |2 ++
 drivers/clk/samsung/Kconfig |3 +++
 2 files changed, 5 insertions(+)
 create mode 100644 drivers/clk/samsung/Kconfig

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 7641965..f2b6179 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -112,3 +112,5 @@ source "drivers/clk/qcom/Kconfig"
 endmenu
 
 source "drivers/clk/mvebu/Kconfig"
+
+source "drivers/clk/samsung/Kconfig"
diff --git a/drivers/clk/samsung/Kconfig b/drivers/clk/samsung/Kconfig
new file mode 100644
index 000..fc8696b
--- /dev/null
+++ b/drivers/clk/samsung/Kconfig
@@ -0,0 +1,3 @@
+config COMMON_CLK_SAMSUNG
+   bool
+   select COMMON_CLK
-- 
1.7.10.4

--
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 01/10] ARM: EXYNOS: Cleanup "mach-exynos/common.h" file

2014-04-02 Thread Pankaj Dubey
Remove unused declarations from "mach-exynos/common.h"

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9ef3f83..277a83e 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,9 +15,6 @@
 #include 
 #include 
 
-void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-
-struct map_desc;
 void exynos_init_io(void);
 void exynos_restart(enum reboot_mode mode, const char *cmd);
 void exynos_cpuidle_init(void);
-- 
1.7.10.4

--
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 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-02 Thread Pankaj Dubey
From: Young-Gun Jang 

Add support for mapping Exynos Power Management Unit (PMU) base address
from device tree. Code will use existing samsung pmu binding information.
This patch also adds "get_exynos_pmubase" a helper function to return mapped 
base
address to various other files under "mach-exynos".

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |2 ++
 arch/arm/mach-exynos/exynos.c |   44 +
 2 files changed, 46 insertions(+)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ff28334..9a55cf6 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -61,4 +61,6 @@ struct exynos_pmu_conf {
 
 extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 
+extern void __iomem *get_exynos_pmubase(void);
+
 #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a5e1349..a5127fb 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -35,6 +35,8 @@
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
 
+static void __iomem *exynos_pmu_base __initdata;
+
 static struct map_desc exynos4_iodesc[] __initdata = {
{
.virtual= (unsigned long)S3C_VA_SYS,
@@ -245,6 +247,47 @@ void __init exynos_init_late(void)
exynos_pm_init();
 }
 
+static char const *exynos_dt_pmu_match[] __initconst = {
+   "samsung,exynos4210-pmu",
+   "samsung,exynos4212-pmu",
+   "samsung,exynos4412-pmu",
+   "samsung,exynos5250-pmu",
+   NULL
+};
+
+static int __init exynos_fdt_map_pmu(unsigned long node,
+   const char *uname, int depth, void *data)
+{
+   struct map_desc iodesc;
+   __be32 *reg;
+   unsigned long len;
+
+   if (of_flat_dt_match(node, exynos_dt_pmu_match)) {
+   phys_addr_t phys_addr;
+   reg = of_get_flat_dt_prop(node, "reg", &len);
+   if (reg == NULL || len != (sizeof(unsigned long) * 2))
+   return 0;
+
+   phys_addr = be32_to_cpu(reg[0]);
+   iodesc.pfn = __phys_to_pfn(phys_addr);
+   iodesc.length = be32_to_cpu(reg[1]) - 1;
+   iodesc.virtual = (unsigned long)S5P_VA_PMU;
+   iodesc.type = MT_DEVICE;
+   iotable_init(&iodesc, 1);
+
+   exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1]));
+   if (WARN_ON(!exynos_pmu_base))
+   return -EFAULT;
+   }
+
+   return 0;
+}
+
+inline void __iomem *get_exynos_pmubase()
+{
+   return exynos_pmu_base;
+}
+
 static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
int depth, void *data)
 {
@@ -301,6 +344,7 @@ void __init exynos_init_io(void)
debug_ll_io_init();
 
of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
+   of_scan_flat_dt(exynos_fdt_map_pmu, NULL);
 
/* detect cpu id and rev. */
s5p_init_cpu(S5P_VA_CHIPID);
-- 
1.7.10.4

--
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 0/7] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-04-02 Thread Pankaj Dubey
This patch series, does some minor cleanup and modifies Exynos PMU related
code for mapping Exynos Power Management Unit (PMU) base address from device
tree. Since PMU offsets are used across many files under mach-exynos, it
introduces one helper function to get PMU base address in exynos.c.

This patch series is preparation for moving PMU related code out of machine
folder and converting into a driver.

This patch requires change in Exynos4210, Exynos4212 and Exynos4412 dtsi files,
which I will post shortly as separate patch series.

These patches are created on top of kgene for-next branch.
We have tested these patches for System boot and PMU initialization of
Exynos5250 and Exynos5260 (with some internal patches).
For rest Exynos SoC it has been only compile tested.

Pankaj Dubey (4):
  ARM: EXYNOS: Cleanup  "mach-exynos/common.h" file
  ARM: EXYNOS: Correct file path in comment message
  ARM: EXYNOS: Move "regs-pmu" header inclusion in common.h
  ARM: EXYNOS: Refactored code for PMU register mapping via DT

Young-Gun Jang (3):
  ARM: EXYNOS: Move SYSREG definition into sys-reg specific file
  ARM: EXYNOS: Remove regs-pmu.h file dependency from pm_domain
  ARM: EXYNOS: Add support for mapping PMU base address via DT

 arch/arm/mach-exynos/common.h   |   10 +-
 arch/arm/mach-exynos/cpuidle.c  |   29 +-
 arch/arm/mach-exynos/exynos.c   |   58 +++-
 arch/arm/mach-exynos/hotplug.c  |5 +-
 arch/arm/mach-exynos/include/mach/map.h |3 -
 arch/arm/mach-exynos/platsmp.c  |   15 +-
 arch/arm/mach-exynos/pm.c   |   55 ++--
 arch/arm/mach-exynos/pm_domains.c   |2 +-
 arch/arm/mach-exynos/pmu.c  |   35 +--
 arch/arm/mach-exynos/regs-pmu.h |  510 +++
 arch/arm/mach-exynos/regs-sys.h |   22 ++
 11 files changed, 405 insertions(+), 339 deletions(-)
 create mode 100644 arch/arm/mach-exynos/regs-sys.h

-- 
1.7.10.4

--
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 03/10] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file

2014-04-02 Thread Pankaj Dubey
From: Young-Gun Jang 

While making PMU (Power Mengement Unit) implementation device tree based,
there are few offsets related with SYSREG present in regs-pmu.h, so let's
make a new header file "regs-sys.h" to keep all such SYSREG related
register definition and remove them from "regs-pmu.h"

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c   |1 +
 arch/arm/mach-exynos/pm.c   |1 +
 arch/arm/mach-exynos/regs-pmu.h |3 ---
 arch/arm/mach-exynos/regs-sys.h |   22 ++
 4 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-exynos/regs-sys.h

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b567361..57bd1cd 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -31,6 +31,7 @@
 #include "common.h"
 #include "mfc.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 15af0ce..723c988 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -35,6 +35,7 @@
 
 #include "common.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 /**
  * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4f6a256..4ee706d 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -15,7 +15,6 @@
 #include 
 
 #define S5P_PMUREG(x)  (S5P_VA_PMU + (x))
-#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
 
 #define S5P_CENTRAL_SEQ_CONFIGURATION  S5P_PMUREG(0x0200)
 
@@ -180,8 +179,6 @@
 
 /* For EXYNOS5 */
 
-#define EXYNOS5_SYS_I2C_CFG
S5P_SYSREG(0x0234)
-
 #define EXYNOS5_AUTO_WDTRESET_DISABLE  
S5P_PMUREG(0x0408)
 #define EXYNOS5_MASK_WDTRESET_REQUEST  
S5P_PMUREG(0x040C)
 
diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h
new file mode 100644
index 000..84332b0
--- /dev/null
+++ b/arch/arm/mach-exynos/regs-sys.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * EXYNOS - system register definition
+ *
+ * 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.
+*/
+
+#ifndef __ASM_ARCH_REGS_SYS_H
+#define __ASM_ARCH_REGS_SYS_H __FILE__
+
+#include 
+
+#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
+
+/* For EXYNOS5 */
+#define EXYNOS5_SYS_I2C_CFGS5P_SYSREG(0x0234)
+
+#endif /* __ASM_ARCH_REGS_SYS_H */
-- 
1.7.10.4

--
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 07/10] ARM: EXYNOS: Refactored code for PMU register mapping via DT

2014-04-02 Thread Pankaj Dubey
This patch removes PMU register mapping via iodesc table and updates
users of PMU registers for using "get_exynos_pmubase" helper function to
get PMU base address.

CC: Tomasz Figa 
CC: Kyungmin Park 
CC: Thomas Abraham 
Signed-off-by: Pankaj Dubey 
Signed-off-by: Younggun Jang 
---
 arch/arm/mach-exynos/common.h   |4 +-
 arch/arm/mach-exynos/cpuidle.c  |   28 +-
 arch/arm/mach-exynos/exynos.c   |   12 +-
 arch/arm/mach-exynos/hotplug.c  |4 +-
 arch/arm/mach-exynos/include/mach/map.h |3 -
 arch/arm/mach-exynos/platsmp.c  |   12 +-
 arch/arm/mach-exynos/pm.c   |   53 ++--
 arch/arm/mach-exynos/pmu.c  |   34 ++-
 arch/arm/mach-exynos/regs-pmu.h |  506 +++
 9 files changed, 332 insertions(+), 324 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9a55cf6..645f4f8 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -44,7 +44,7 @@ extern void exynos_cpu_die(unsigned int cpu);
 
 /* PMU(Power Management Unit) support */
 
-#define PMU_TABLE_END  NULL
+#define PMU_TABLE_END  0x
 
 enum sys_powerdown {
SYS_AFTR,
@@ -55,7 +55,7 @@ enum sys_powerdown {
 
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
-   void __iomem *reg;
+   unsigned int offset;
unsigned int val[NUM_SYS_POWERDOWN];
 };
 
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index b9dd8c3..dcf563d 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -31,11 +31,15 @@
 #include "common.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
-   S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
-   (S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
+   get_exynos_pmubase() + S5P_INFORM7 : \
+   (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+   (S5P_VA_SYSRAM + 0x24) : \
+   get_exynos_pmubase() + S5P_INFORM0))
 #define REG_DIRECTGO_FLAG  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
-   S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
-   (S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
+   get_exynos_pmubase() + S5P_INFORM6 : \
+   (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+   (S5P_VA_SYSRAM + 0x20) : \
+   get_exynos_pmubase() + S5P_INFORM1))
 
 #define S5P_CHECK_AFTR 0xFCBA0D10
 
@@ -58,6 +62,8 @@
 #define PWR_CTRL2_CORE2_UP_RATIO   (1 << 4)
 #define PWR_CTRL2_CORE1_UP_RATIO   (1 << 0)
 
+static void __iomem *pmu_base;
+
 static int exynos4_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index);
@@ -85,7 +91,7 @@ static struct cpuidle_driver exynos4_idle_driver = {
 /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
 static void exynos4_set_wakeupmask(void)
 {
-   __raw_writel(0xff3e, S5P_WAKEUP_MASK);
+   __raw_writel(0xff3e, pmu_base + S5P_WAKEUP_MASK);
 }
 
 static unsigned int g_pwr_ctrl, g_diag_reg;
@@ -131,9 +137,9 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device 
*dev,
save_cpu_arch_register();
 
/* Setting Central Sequence Register for power down mode */
-   tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+   tmp = __raw_readl(pmu_base + S5P_CENTRAL_SEQ_CONFIGURATION);
tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
-   __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+   __raw_writel(tmp, pmu_base + S5P_CENTRAL_SEQ_CONFIGURATION);
 
cpu_pm_enter();
cpu_suspend(0, idle_finisher);
@@ -152,14 +158,14 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device 
*dev,
 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
 * in this situation.
 */
-   tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+   tmp = __raw_readl(pmu_base + S5P_CENTRAL_SEQ_CONFIGURATIO);
if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
tmp |= S5P_CENTRAL_LOWPWR_CFG;
-   __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+   __raw_writel(tmp, pmu_base + S5P_CENTRAL_SEQ_CONFIGURATION);
}
 
/* Clear wakeup state register */
-   __raw_writel(0x0, S5P_WAKEUP_STAT);
+   __raw_writel(0x0, pmu_base + S5P_WAKEUP_STAT);
 
return index;
 }
@@ -217,6 +223,8 @@ static int exynos_cpuidle_probe(struct platform_device 
*pdev)
int cpu_id, ret;
struct cpuidle_device *device;
 
+   pmu_base = get_exynos_pmubase();
+
if (soc_is_exynos5250())
exynos5_core_down_clk();
 
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a5127fb..68e7612 100644
--- a/arch

[PATCH 02/10] ARM: EXYNOS: Correct file path in comment message

2014-04-02 Thread Pankaj Dubey
This patch corrects file path mentioned in file comment message.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/platsmp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 03e5e9f..d8d1555 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -1,4 +1,4 @@
-/* linux/arch/arm/mach-exynos4/platsmp.c
+/* linux/arch/arm/mach-exynos/platsmp.c
  *
  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
-- 
1.7.10.4

--
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 04/10] ARM: EXYNOS: Remove regs-pmu.h file dependency from pm_domain

2014-04-02 Thread Pankaj Dubey
From: Young-Gun Jang 

Current "pm_domain.c" file uses "S5P_INT_LOCAL_PWR_EN" definition from
"regs-pmu.h" and hence needs to include this header file. As there is
no other user of "S5P_INT_LOCAL_PWR_EN" definition other than pm_domain,
to remove "regs-pmu.h" header file dependency from "pm_domain.c"  it's
better we define this definition in "pm_domain.c" file itself and thus it
will help in removing header file inclusion from "pm_domain.c".

Signed-off-by: Young-Gun Jang 
---
 arch/arm/mach-exynos/pm_domains.c |2 +-
 arch/arm/mach-exynos/regs-pmu.h   |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c 
b/arch/arm/mach-exynos/pm_domains.c
index fe6570e..f676b0a 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include "regs-pmu.h"
+#define S5P_INT_LOCAL_PWR_EN 0x7
 
 /*
  * Exynos specific wrapper around the generic power domain
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4ee706d..bfebe84 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -116,7 +116,6 @@
 #define S5P_PAD_RET_EBIB_OPTIONS5P_PMUREG(0x31A8)
 
 #define S5P_CORE_LOCAL_PWR_EN  0x3
-#define S5P_INT_LOCAL_PWR_EN   0x7
 
 #define S5P_CHECK_SLEEP0x0BAD
 
-- 
1.7.10.4

--
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 05/10] ARM: EXYNOS: Move "regs-pmu" header inclusion in common.h

2014-04-02 Thread Pankaj Dubey
There are many machine files under "mach-exynos" including "regs-pmu.h"
as well as "common.h", so better we move this header inclusion in common.h.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h  |1 +
 arch/arm/mach-exynos/cpuidle.c |1 -
 arch/arm/mach-exynos/exynos.c  |1 -
 arch/arm/mach-exynos/hotplug.c |1 -
 arch/arm/mach-exynos/platsmp.c |1 -
 arch/arm/mach-exynos/pm.c  |1 -
 arch/arm/mach-exynos/pmu.c |1 -
 7 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 277a83e..ff28334 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include "regs-pmu.h"
 
 void exynos_init_io(void);
 void exynos_restart(enum reboot_mode mode, const char *cmd);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index b530231..b9dd8c3 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -29,7 +29,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 57bd1cd..a5e1349 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -30,7 +30,6 @@
 
 #include "common.h"
 #include "mfc.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead53..33db6ee 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -22,7 +22,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 static inline void cpu_enter_lowpower_a9(void)
 {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index d8d1555..3ebb03f 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -29,7 +29,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 extern void exynos4_secondary_startup(void);
 
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 723c988..875151f 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -34,7 +34,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
 
 /**
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce1..fb44352 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 static const struct exynos_pmu_conf *exynos_pmu_config;
 
-- 
1.7.10.4

--
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 3/3] Documentation: update samsung pmu binding information for Exynos4210/4212/4412

2014-04-02 Thread Pankaj Dubey
This patch updates samsung pmu (power management unit) binding information
for Exynos4210, Exynos4212 and Exynos4412.

CC: Leela Krishna Amudala 
CC: Tomasz Figa 
CC: Guenter Roeck 
CC: Rob Landley 
Signed-off-by: Pankaj Dubey 
---
 Documentation/devicetree/bindings/arm/samsung/pmu.txt |3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
index f1f1552..b562634 100644
--- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
@@ -2,6 +2,9 @@ SAMSUNG Exynos SoC series PMU Registers
 
 Properties:
  - compatible : should contain two values. First value must be one from 
following list:
+  - "samsung,exynos4210-pmu" - for Exynos4210 SoC,
+  - "samsung,exynos4212-pmu" - for Exynos4212 SoC,
+  - "samsung,exynos4412-pmu" - for Exynos4412 SoC,
   - "samsung,exynos5250-pmu" - for Exynos5250 SoC,
   - "samsung,exynos5420-pmu" - for Exynos5420 SoC.
second value must be always "syscon".
-- 
1.7.10.4

--
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 0/3] Add PMU node for Exynos4210, Exynos4412, Exynos4212

2014-04-02 Thread Pankaj Dubey
This patch updates Exynos4210, Exynos4412 and Exynos4212 dtsi files
for adding PMU (Power Management Unit) reg node. Also updated binding
document for the same. 
These patches required for using PMU base address via DT for these SoC.
Patches for using PMU base address via DT are posted here-

http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg27875.html

Pankaj Dubey (3):
  ARM: dts: Add PMU reg node to exynos4210
  ARM: dts: Add PMU reg node to exynos4212 and exynos4412
  Documentation: update samsung pmu binding information for
Exynos4210/4212/4412

 Documentation/devicetree/bindings/arm/samsung/pmu.txt |3 +++
 arch/arm/boot/dts/exynos4210.dtsi |5 +
 arch/arm/boot/dts/exynos4212.dtsi |5 +
 arch/arm/boot/dts/exynos4412.dtsi |5 +
 4 files changed, 18 insertions(+)

-- 
1.7.10.4

--
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 1/3] ARM: dts: Add PMU reg node to exynos4210

2014-04-02 Thread Pankaj Dubey
This patch adds pmu regnode to exynos4210 dtsi to handle
PMU register access via DT.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos4210.dtsi |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index cacf614..0a2c0fe 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -81,6 +81,11 @@
interrupts = <2 2>, <3 2>;
};
 
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4210-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   };
+
pinctrl_0: pinctrl@1140 {
compatible = "samsung,exynos4210-pinctrl";
reg = <0x1140 0x1000>;
-- 
1.7.10.4

--
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 2/3] ARM: dts: Add PMU reg node to exynos4212 and exynos4412

2014-04-02 Thread Pankaj Dubey
This patch adds pmu regnode to exynos4212 and exynos4412 dtsi to
handle PMU register access via DT.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos4212.dtsi |5 +
 arch/arm/boot/dts/exynos4412.dtsi |5 +
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4212.dtsi 
b/arch/arm/boot/dts/exynos4212.dtsi
index 3c00e6e..4661ffa 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -29,4 +29,9 @@
gic: interrupt-controller@1049 {
cpu-offset = <0x8000>;
};
+
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4212-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4412.dtsi 
b/arch/arm/boot/dts/exynos4412.dtsi
index 15d3c0a..6f4cb22 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -29,4 +29,9 @@
gic: interrupt-controller@1049 {
cpu-offset = <0x4000>;
};
+
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4412-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   };
 };
-- 
1.7.10.4

--
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


[RFC PATCH 0/2] Add support for Exynos PMU driver

2014-04-02 Thread Pankaj Dubey
This patch series tries to remove machine specific implementation
of Power Management Unit from "mach-exynos" to driver form.
In case of ARM32 we had machine folder such as "mach-exynos" but
moving forward with ARM64 SoC support we can not have any more such
machine folders, keeping that in mind we have planned to move PMU
implementation out of machine folder and give it driver form.
Since PMU binding already exist as "samsung, exynosxxx-pmu, syscon"
and Syscon driver is located under "drivers/mfd" we are moving 
Exynos PMU driver under "drivers/mfd", but suggestions are welcome.

This patch series is based on kgene for-next and depends on following
patch series
1) ARM: Exynos: PMU cleanup and refactoring for using DT
   http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg27875.html

We have tested this driver for System boot and PMU initialization on Exynos5250
and Exynos5260 (with support of some internal patches).

Pankaj Dubey (1):
  ARM: EXYNOS: remove arch specific PMU implementation

Younggun Jang (1):
  drivers: mfd: Add support of exynos-pmu driver

 arch/arm/mach-exynos/Kconfig|2 +
 arch/arm/mach-exynos/Makefile   |2 -
 arch/arm/mach-exynos/common.h   |   22 +-
 arch/arm/mach-exynos/pmu.c  |  426 -
 arch/arm/mach-exynos/regs-pmu.h |  310 
 drivers/mfd/Kconfig |9 +
 drivers/mfd/Makefile|2 +
 drivers/mfd/exynos-pmu.c|  534 +++
 include/linux/mfd/samsung/exynos-pmu.h  |   31 ++
 include/linux/mfd/samsung/exynos-regs-pmu.h |  308 +++
 10 files changed, 890 insertions(+), 756 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/pmu.c
 delete mode 100644 arch/arm/mach-exynos/regs-pmu.h
 create mode 100644 drivers/mfd/exynos-pmu.c
 create mode 100644 include/linux/mfd/samsung/exynos-pmu.h
 create mode 100644 include/linux/mfd/samsung/exynos-regs-pmu.h

-- 
1.7.10.4

--
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


[RFC PATCH 1/2] drivers: mfd: Add support of exynos-pmu driver

2014-04-02 Thread Pankaj Dubey
From: Younggun Jang 

This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Samuel Ortiz 
CC: Lee Jones 
CC: Sangbeom Kim 
CC: Grant Likely 
CC: Rob Herring 
CC: devicet...@vger.kernel.org
Signed-off-by: Younggun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h   |   22 +-
 arch/arm/mach-exynos/regs-pmu.h |  310 
 drivers/mfd/Kconfig |9 +
 drivers/mfd/Makefile|2 +
 drivers/mfd/exynos-pmu.c|  534 +++
 include/linux/mfd/samsung/exynos-pmu.h  |   31 ++
 include/linux/mfd/samsung/exynos-regs-pmu.h |  308 +++
 7 files changed, 888 insertions(+), 328 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/regs-pmu.h
 create mode 100644 drivers/mfd/exynos-pmu.c
 create mode 100644 include/linux/mfd/samsung/exynos-pmu.h
 create mode 100644 include/linux/mfd/samsung/exynos-regs-pmu.h

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 645f4f8..cbe8159 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,9 +12,12 @@
 #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
 #define __ARCH_ARM_MACH_EXYNOS_COMMON_H
 
+#include 
+
 #include 
 #include 
-#include "regs-pmu.h"
+#include 
+#include 
 
 void exynos_init_io(void);
 void exynos_restart(enum reboot_mode mode, const char *cmd);
@@ -42,24 +45,7 @@ extern struct smp_operations exynos_smp_ops;
 
 extern void exynos_cpu_die(unsigned int cpu);
 
-/* PMU(Power Management Unit) support */
-
-#define PMU_TABLE_END  0x
-
-enum sys_powerdown {
-   SYS_AFTR,
-   SYS_LPA,
-   SYS_SLEEP,
-   NUM_SYS_POWERDOWN,
-};
-
 extern unsigned long l2x0_regs_phys;
-struct exynos_pmu_conf {
-   unsigned int offset;
-   unsigned int val[NUM_SYS_POWERDOWN];
-};
-
-extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 
 extern void __iomem *get_exynos_pmubase(void);
 
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
deleted file mode 100644
index 7f3bf65..000
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * EXYNOS - Power management unit definition
- *
- * 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.
-*/
-
-#ifndef __ASM_ARCH_REGS_PMU_H
-#define __ASM_ARCH_REGS_PMU_H __FILE__
-
-#include 
-
-#define S5P_CENTRAL_SEQ_CONFIGURATION  0x0200
-
-#define S5P_CENTRAL_LOWPWR_CFG (1 << 16)
-
-#define S5P_CENTRAL_SEQ_OPTION 0x0208
-
-#define S5P_USE_STANDBY_WFI0   (1 << 16)
-#define S5P_USE_STANDBY_WFE0   (1 << 24)
-
-#define EXYNOS_SWRESET 0x0400
-#define EXYNOS5440_SWRESET 0x00C4
-
-#define S5P_WAKEUP_STAT0x0600
-#define S5P_EINT_WAKEUP_MASK   0x0604
-#define S5P_WAKEUP_MASK0x0608
-
-#define S5P_INFORM00x0800
-#define S5P_INFORM10x0804
-#define S5P_INFORM50x0814
-#define S5P_INFORM60x0818
-#define S5P_INFORM70x081C
-
-#define S5P_ARM_CORE0_LOWPWR   0x1000
-#define S5P_DIS_IRQ_CORE0  0x1004
-#define S5P_DIS_IRQ_CENTRAL0   0x1008
-#define S5P_ARM_CORE1_LOWPWR   0x1010
-#define S5P_DIS_IRQ_CORE1  0x1014
-#define S5P_DIS_IRQ_CENTRAL1   0x1018
-#define S5P_ARM_COMMON_LOWPWR  0x1080
-#define S5P_L2_0_LOWPWR0x10C0
-#define S5P_L2_1_LOWPWR0x10C4
-#define S5P_CMU_ACLKSTOP_LOWPWR0x1100
-#define S5P_CMU_SCLKSTOP_LOWPWR0x1104
-#define S5P_CMU_RESET_LOWPWR   0x110C
-#define S5P_APLL_SYSCLK_LOWPWR 0x1120
-#define S5P_MPLL_SYSCLK_LOWPWR 0x1124
-#define S5P_VPLL_SYSCLK_LOWPWR 0x1128
-#define S5P_EPLL_SYSCLK_LOWPWR 0x112C
-#define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR   0x1138
-#define S5P_CMU_RESET_GPSALIVE_LOWPWR  0x113C
-#define S5P_CMU_CLKSTOP_CAM_LOWPWR 0x1140
-#define S5P_CMU_CLKSTOP_TV_LOWPWR  0x1144
-#define S5P_CMU_CLKSTOP_

[RFC PATCH 2/2] ARM: EXYNOS: remove arch specific PMU implementation

2014-04-02 Thread Pankaj Dubey
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/Kconfig  |2 +
 arch/arm/mach-exynos/Makefile |2 -
 arch/arm/mach-exynos/pmu.c|  426 -
 3 files changed, 2 insertions(+), 428 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/pmu.c

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fcd78c2..61f0ead 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -26,6 +26,7 @@ config ARCH_EXYNOS4
select PINCTRL
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS4 SoCs based systems
 
@@ -37,6 +38,7 @@ config ARCH_EXYNOS5
select HAVE_SMP
select PINCTRL
select USB_ARCH_HAS_XHCI
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index a656dbe..19fdf17 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -18,8 +18,6 @@ obj-$(CONFIG_PM_SLEEP)+= pm.o sleep.o
 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
 
-obj-$(CONFIG_ARCH_EXYNOS)  += pmu.o
-
 obj-$(CONFIG_SMP)  += platsmp.o headsmp.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
deleted file mode 100644
index 30b20ab..000
--- a/arch/arm/mach-exynos/pmu.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
- * http://www.samsung.com/
- *
- * EXYNOS - CPU PMU(Power Management Unit) support
- *
- * 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.
- */
-
-#include 
-#include 
-#include 
-
-#include 
-
-#include "common.h"
-
-static const struct exynos_pmu_conf *exynos_pmu_config;
-static void __iomem *pmu_base;
-
-static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
-   { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
-   { S5P_DIS_IRQ_CORE0,{ 0x0, 0x0, 0x0 } },
-   { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
-   { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
-   { S5P_DIS_IRQ_CORE1,{ 0x0, 0x0, 0x0 } },
-   { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
-   { S5P_ARM_COMMON_LOWPWR,{ 0x0, 0x0, 0x2 } },
-   { S5P_L2_0_LOWPWR,  { 0x2, 0x2, 0x3 } },
-   { S5P_L2_1_LOWPWR,  { 0x2, 0x2, 0x3 } },
-   { S5P_CMU_ACLKSTOP_LOWPWR,  { 0x1, 0x0, 0x0 } },
-   { S5P_CMU_SCLKSTOP_LOWPWR,  { 0x1, 0x0, 0x0 } },
-   { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_APLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_MPLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_VPLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_EPLL_SYSCLK_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_GPSALIVE_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_CAM_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_TV_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_MFC_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_G3D_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_LCD0_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_LCD1_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_GPS_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_TV_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_LCD0_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_LCD1_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_MAUDIO_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_TOP_BUS_LOWPWR,   { 0x3, 0x0, 0x0 } },
-   { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
-   { S5P_TOP_PWR_LOWPWR,   { 0x3, 0x0, 0x3 } },
-   { S5P_LOGIC_RESET_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_ONENAND_MEM_LOWPWR,   { 0x3, 0x0, 0x0 } },
-   { S5P_MODIMIF_MEM_LOWPWR,   { 0x3

Re: [PATCH 02/10] ARM: EXYNOS: Correct file path in comment message

2014-04-02 Thread Pankaj Dubey

Hi Michal,

On 04/02/2014 09:01 PM, Michal Simek wrote:

On 04/02/2014 09:50 AM, Pankaj Dubey wrote:

This patch corrects file path mentioned in file comment message.

Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/platsmp.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 03e5e9f..d8d1555 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -1,4 +1,4 @@
-/* linux/arch/arm/mach-exynos4/platsmp.c
+/* linux/arch/arm/mach-exynos/platsmp.c
   *
   * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
   *http://www.samsung.com


Shouldn't you just remove it entirely?
I had the same file names in the whole microblaze tree
and some months/years later this was just broken everywhere.
That's why it is just easier to remove it entirely.


Thanks for review and suggestion.
Removing of file name makes more sense to me also.
Will take care of this in some other files also under "mach-exynos"
in next version of patch.



Thanks,
Michal





--
Best Regards,
Pankaj Dubey

--
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 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-05 Thread Pankaj Dubey

On 04/02/2014 08:48 PM, Sylwester Nawrocki wrote:

On 02/04/14 09:50, Pankaj Dubey wrote:

From: Young-Gun Jang 

Add support for mapping Exynos Power Management Unit (PMU) base address
from device tree. Code will use existing samsung pmu binding information.
This patch also adds "get_exynos_pmubase" a helper function to return mapped 
base
address to various other files under "mach-exynos".

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/common.h |2 ++
  arch/arm/mach-exynos/exynos.c |   44 +
  2 files changed, 46 insertions(+)


[...]

  #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a5e1349..a5127fb 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -35,6 +35,8 @@
  #define L2_AUX_VAL 0x7C470001
  #define L2_AUX_MASK 0xC200
  
+static void __iomem *exynos_pmu_base __initdata;

+
  static struct map_desc exynos4_iodesc[] __initdata = {
{
.virtual= (unsigned long)S3C_VA_SYS,
@@ -245,6 +247,47 @@ void __init exynos_init_late(void)
exynos_pm_init();
  }
  
+static char const *exynos_dt_pmu_match[] __initconst = {

+   "samsung,exynos4210-pmu",
+   "samsung,exynos4212-pmu",
+   "samsung,exynos4412-pmu",
+   "samsung,exynos5250-pmu",
+   NULL
+};
+
+static int __init exynos_fdt_map_pmu(unsigned long node,
+   const char *uname, int depth, void *data)
+{
+   struct map_desc iodesc;
+   __be32 *reg;
+   unsigned long len;
+
+   if (of_flat_dt_match(node, exynos_dt_pmu_match)) {
+   phys_addr_t phys_addr;
+   reg = of_get_flat_dt_prop(node, "reg", &len);
+   if (reg == NULL || len != (sizeof(unsigned long) * 2))
+   return 0;
+
+   phys_addr = be32_to_cpu(reg[0]);
+   iodesc.pfn = __phys_to_pfn(phys_addr);
+   iodesc.length = be32_to_cpu(reg[1]) - 1;
+   iodesc.virtual = (unsigned long)S5P_VA_PMU;
+   iodesc.type = MT_DEVICE;
+   iotable_init(&iodesc, 1);

Are you sure...you need this in addition to ioremap() below ?
Can't you just use the Linux syscon API ?
There were some patches posted for syscon to make it available in earlier
system initialization stage: https://lkml.org/lkml/2014/2/19/218

Thanks for review and suggestion.

We need ioremap() in addition to iotable_init to get virtual address,
which will be used by other files also for read/write PMU registers.

Regarding syscon early initialization, since I was not aware of any such
patch earlier I have not used it. But after you suggested I tried it and
modified this implementation to use syscon API and regmap API and it's
working fine.
I will wait for review of other patches in this series and status of above
mentioned syscon API based on that I will update this in next revision.


+   exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1]));
+   if (WARN_ON(!exynos_pmu_base))
+   return -EFAULT;
+   }
+
+   return 0;
+}

--
Thanks,
Sylwester




--
Best Regards,
Pankaj Dubey

--
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 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-05 Thread Pankaj Dubey

On 04/03/2014 06:07 PM, Sylwester Nawrocki wrote:

On 02/04/14 14:15, Michal Simek wrote:

There were some patches posted for syscon to make it available in earlier
system initialization stage: https://lkml.org/lkml/2014/2/19/218

I haven't finished this yet. I have to look at it again.

Thanks for the information, I assume this would be also useful
on the Exynos SoC series, so I'd be happy to see continuation
of those works.


It is useful for Exynos SoC series and I have modified this patch series to use 
early syscon

initialization API and I can see it's working.
I have some observation for early initialization of syscon API which I will
update in corresponding message thread.


--
Thanks,
Sylwester




--
Best Regards,
Pankaj Dubey

--
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 01/10] ARM: EXYNOS: Cleanup "mach-exynos/common.h" file

2014-04-09 Thread Pankaj Dubey

Hi Tomasz,

On 04/09/2014 12:59 AM, Tomasz Figa wrote:

Hi Pankaj,

On 02.04.2014 09:50, Pankaj Dubey wrote:

Remove unused declarations from "mach-exynos/common.h"

Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/common.h |3 ---
  1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9ef3f83..277a83e 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,9 +15,6 @@
  #include 
  #include 

-void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-
-struct map_desc;
  void exynos_init_io(void);
  void exynos_restart(enum reboot_mode mode, const char *cmd);
  void exynos_cpuidle_init(void);



You could also drop a bit more. From the context above I can see that at least 
exynos_restart() and exynos_init_io() are never used outside of files they are 
defined in, so they too could be dropped from this header. Looking at rest of 
the header, there seems to be a lot of similar definitions. If cleaning up the 
header anyway, could you take care of them as well?




Thanks for review.
Sure, I will take care of other functions which are not required in this header
file in next version.


Best regards,
Tomasz




--
Best Regards,
Pankaj Dubey

--
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 05/10] ARM: EXYNOS: Move "regs-pmu" header inclusion in common.h

2014-04-09 Thread Pankaj Dubey

Hi Tomasz,

On 04/09/2014 01:09 AM, Tomasz Figa wrote:

Hi Pankaj,

On 02.04.2014 09:50, Pankaj Dubey wrote:

There are many machine files under "mach-exynos" including "regs-pmu.h"
as well as "common.h", so better we move this header inclusion in common.h.

Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/common.h  |1 +
  arch/arm/mach-exynos/cpuidle.c |1 -
  arch/arm/mach-exynos/exynos.c  |1 -
  arch/arm/mach-exynos/hotplug.c |1 -
  arch/arm/mach-exynos/platsmp.c |1 -
  arch/arm/mach-exynos/pm.c  |1 -
  arch/arm/mach-exynos/pmu.c |1 -
  7 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 277a83e..ff28334 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -14,6 +14,7 @@

  #include 
  #include 
+#include "regs-pmu.h"

  void exynos_init_io(void);
  void exynos_restart(enum reboot_mode mode, const char *cmd);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index b530231..b9dd8c3 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -29,7 +29,6 @@
  #include 

  #include "common.h"
-#include "regs-pmu.h"

  #define REG_DIRECTGO_ADDR(samsung_rev() == EXYNOS4210_REV_1_1 ? \
  S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 57bd1cd..a5e1349 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -30,7 +30,6 @@

  #include "common.h"
  #include "mfc.h"
-#include "regs-pmu.h"
  #include "regs-sys.h"

  #define L2_AUX_VAL 0x7C470001
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead53..33db6ee 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -22,7 +22,6 @@
  #include 

  #include "common.h"
-#include "regs-pmu.h"

  static inline void cpu_enter_lowpower_a9(void)
  {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index d8d1555..3ebb03f 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -29,7 +29,6 @@
  #include 

  #include "common.h"
-#include "regs-pmu.h"

  extern void exynos4_secondary_startup(void);

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 723c988..875151f 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -34,7 +34,6 @@
  #include 

  #include "common.h"
-#include "regs-pmu.h"
  #include "regs-sys.h"

  /**
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce1..fb44352 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,6 @@
  #include 

  #include "common.h"
-#include "regs-pmu.h"

  static const struct exynos_pmu_conf *exynos_pmu_config;




I don't think this is a good idea. It adds hidden indirect dependencies 
between source files and thus reduces maintainability and readability. In 
addition it causes the file to be included even by files that don't need it.



Thanks for review.
I did this change because:
1: Currently only these 6 files (under "arm/mach-exynos/") are including 
"regs-pmu.h"
as well as "common.h" so all these source files requires "regs-pmu.h" can get it 
included via "common.h".
2: Next if we change location/rename "regs-pmu.h", we need to update all these 
source files. On the other hand

if it's present in common.h it can be done at single place in "common.h".
3:  More over just checked that even currently common.h has some hidden includes 
such as ("linux/of.h") which is not

required by all source files (I can see only pm.c needs it).
So let me know if still you think it's not good idea, I will consider to drop 
this patch in next version of patch series.



Best regards,
Tomasz




--
Best Regards,
Pankaj Dubey

--
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 0/4] Introduce new Kconfig for Samsung common clock

2014-04-10 Thread Pankaj Dubey

On 03/20/2014 01:55 PM, Pankaj Dubey wrote:

Introduce a new Kconfig file for Samsung common clock infrastructure
related config options. As current Samsung common clock gets compiled
based on PLAT_SAMSUNG, but moving ahead with ARM64 we can not have any
more such config options, so this patch introduce new COMMON_CLK_SAMSUNG
invisible option. This option also select COMMON_CLK so ARCH Kconfig just
need to select COMMON_CLK_SAMSUNG in case they want to use Samsung common
clock.

This series is based on Kukjin's for-next branch.

V3:
  1) Re-organized patches for preventing bisect issues.
  2) Rebase on top of latest Kukjin's for-next branch.
  3) Compile tested exynos_defconfig, s3c6400_defconfig and s3c2410_defconfig
 after each commit.

V2:
  1) Adding new Kconfig file for Samsung common clock.
  2) Make COMMON_CLK_SAMSUNG option invisible. (as suggested by Tomasz Figa)
  3) Let COMMON_CLK_SAMSUNG select COMMON_CLK. (as suggested by Tomasz Figa)
  4) Move S3C24XX clock config option in new Kconfig file.

Pankaj Dubey (4):
   clk: samsung: add new Kconfig for Samsung common clock option
   ARM: select COMMON_CLK_SAMSUNG for ARCH_EXYNOS and ARCH_S3C64XX
   ARM: S3C24XX: move S3C24XX clock Kconfig options to Samsung clock
 Kconfig file
   drivers: clk: use COMMON_CLK_SAMSUNG for Samsung clock support

  arch/arm/Kconfig  |4 ++--
  arch/arm/mach-s3c24xx/Kconfig |   14 --
  drivers/clk/Kconfig   |2 ++
  drivers/clk/Makefile  |2 +-
  drivers/clk/samsung/Kconfig   |   12 
  5 files changed, 17 insertions(+), 17 deletions(-)
  create mode 100644 drivers/clk/samsung/Kconfig



Gentle Ping.

--
Best Regards,
Pankaj Dubey

--
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: [RFC PATCH 1/2] drivers: mfd: Add support of exynos-pmu driver

2014-04-10 Thread Pankaj Dubey

Hi Bartlomiej,

Thanks for review.

On 04/03/2014 08:56 PM, Bartlomiej Zolnierkiewicz wrote:

Hi,

On Wednesday, April 02, 2014 05:24:44 PM Pankaj Dubey wrote:

From: Younggun Jang 

This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.

PMU support for ARM32 EXYNOS SoCs is heavily SoC dependent and there
is very little code shared between diffirent SoCs.  Unless PMU setup
for Samsung ARM64 SoCs is similar to some existing ARM32 EXYNOS SoCs
it may be better to just add a separate PMU driver for Samsung ARM64
SoCs. IOW it would be best to show that this patch series is really
useful before merging it.


We think it will be useful, but I will consider your point of making driver
which should have common piece of code to address various EXYNOS SoCs.
We are working on it, once it takes some proper shape I will post details here.



When it comes to the current patches it would be better to do changes
converting PMU support to be a platform driver first for the existing
arch/arm/mach-exynos/pmu.c file and then move+rename this file in
the separate patch.  Currently the code changes are done at the same
time as the code movement which makes them difficult to review/verify.


OK, will do as you suggested in next version.


There are also some minor issues with the new code:

[...]


diff --git a/drivers/mfd/exynos-pmu.c b/drivers/mfd/exynos-pmu.c
new file mode 100644
index 000..24abd9b
--- /dev/null
+++ b/drivers/mfd/exynos-pmu.c
@@ -0,0 +1,534 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/

2015?


Will fix this.


[...]


+static int __init exynos4210_pmu_init(void)
+{
+   exynos_pmu_config = exynos4210_pmu_config;
+   pmu_data->pmu_id = PMU_EXYNOS4210;
+   pr_info("EXYNOS4210 PMU Initialize\n");
+
+   return 0;
+}
+
+static int __init exynos4212_pmu_init(void)
+{
+   exynos_pmu_config = exynos4x12_pmu_config;
+   pmu_data->pmu_id = PMU_EXYNOS4212;
+   pr_info("EXYNOS4x12 PMU Initialize\n");
+
+   return 0;
+}
+
+static int __init exynos4412_pmu_init(void)
+{
+   exynos_pmu_config = exynos4x12_pmu_config;
+   pmu_data->pmu_id = PMU_EXYNOS4412;
+   pr_info("EXYNOS4412 PMU Initialize\n");
+
+   return 0;
+}
+
+static int __init exynos5250_pmu_init(void)
+{
+   unsigned int value;
+
+   /*
+* When SYS_WDTRESET is set, watchdog timer reset request
+* is ignored by power management unit.
+*/
+   value = __raw_readl(pmu_data->regs + EXYNOS5_AUTO_WDTRESET_DISABLE);
+   value &= ~EXYNOS5_SYS_WDTRESET;
+   __raw_writel(value, pmu_data->regs + EXYNOS5_AUTO_WDTRESET_DISABLE);
+
+   value = __raw_readl(pmu_data->regs + EXYNOS5_MASK_WDTRESET_REQUEST);
+   value &= ~EXYNOS5_SYS_WDTRESET;
+   __raw_writel(value, pmu_data->regs + EXYNOS5_MASK_WDTRESET_REQUEST);
+
+   exynos_pmu_config = exynos5250_pmu_config;
+   pmu_data->pmu_id = PMU_EXYNOS5250;
+   pr_info("EXYNOS5250 PMU Initialize\n");
+
+   return 0;
+}
+
+/*
+ * PMU platform driver and devicetree bindings.
+ */
+static struct of_device_id exynos_pmu_of_device_ids[] = {
+   {
+   .compatible = "samsung,exynos4210-pmu",
+   .data = (void *)exynos4210_pmu_init
+   },
+   {
+   .compatible = "samsung,exynos4212-pmu",
+   .data = (void *)exynos4212_pmu_init
+   },
+   {
+   .compatible = "samsung,exynos4412-pmu",
+   .data = (void *)exynos4412_pmu_init
+   },
+   {
+   .compatible = "samsung,exynos5250-pmu",
+   .data = (void *)exynos5250_pmu_init
+   },
+   {},
+};
+
+static int exynos_pmu_probe(struct platform_device *pdev)
+{
+   const struct of_device_id *match;
+   exynos_pmu_init_t exynos_pmu_init;
+   struct resource *res;
+
+   pmu_data = devm_kzalloc(&pdev->dev,
+   sizeof(struct exynos_pmu_data), GFP_KERNEL);
+   if (!pmu_data) {
+   dev_err(&pdev->dev, "exynos_pmu driver probe failed\n");
+   return -ENOMEM;
+   }
+
+   pmu_data->dev = &pdev->dev;
+
+   match = of_match_node(exynos_pmu_of_device_ids, pdev->dev.of_node);
+   exynos_pmu_init = match->data;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   pmu_data->regs = devm_ioremap_resource(&pdev->dev, res);

devm_ioremap_resouce() return value should be checked for errors with

if (IS_ERR(pmu_data->regs))
return PTR_ERR(pmu_data->regs);

Will take care.

+
+ 

Re: [PATCH 03/10] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file

2014-04-10 Thread Pankaj Dubey

On 04/02/2014 08:27 PM, Sylwester Nawrocki wrote:

Hi,

On 02/04/14 09:50, Pankaj Dubey wrote:

From: Young-Gun Jang 

While making PMU (Power Mengement Unit) implementation device tree based,
there are few offsets related with SYSREG present in regs-pmu.h, so let's
make a new header file "regs-sys.h" to keep all such SYSREG related
register definition and remove them from "regs-pmu.h"

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/exynos.c   |1 +
  arch/arm/mach-exynos/pm.c   |1 +
  arch/arm/mach-exynos/regs-pmu.h |3 ---
  arch/arm/mach-exynos/regs-sys.h |   22 ++
  4 files changed, 24 insertions(+), 3 deletions(-)
  create mode 100644 arch/arm/mach-exynos/regs-sys.h

[...]

diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h
new file mode 100644
index 000..84332b0
--- /dev/null
+++ b/arch/arm/mach-exynos/regs-sys.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * EXYNOS - system register definition
+ *
+ * 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.
+*/
+
+#ifndef __ASM_ARCH_REGS_SYS_H
+#define __ASM_ARCH_REGS_SYS_H __FILE__
+
+#include 
+
+#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
+
+/* For EXYNOS5 */
+#define EXYNOS5_SYS_I2C_CFGS5P_SYSREG(0x0234)

Can this be defined as a regular register offset in a header file
placed at include/linux/mfd/syscon/ ? I.e. can the mfd syscon driver be
used instead of these hacks ?


No. As currently SysRegs are being accessed via iodesc table and not via DT,
it has dependency on "mach/map.h".
We separated these definitions from "regs-pmu.h" as it does not belong to EXYNOS 
PMU IP.

But this can be done once we make some way of accessing SysReg register sets 
via DT.

--
Best Regards,
Pankaj Dubey

--
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/2] phy: samsung: add simple phys for exynos5250 SoC

2014-04-20 Thread Pankaj Dubey

Hi Rahul,

On 04/20/2014 07:08 PM, Rahul Sharma wrote:

From: Rahul Sharma 

Extend the support for simple phys for exynos5250 SoC
in simple phy driver.

Change-Id: I39e7745e01ae4b1cf5063dce8a29ebdc37180130

Change-Id should be removed. Missing Signed-off-by.

---
  .../devicetree/bindings/phy/samsung-phy.txt|   22 
  drivers/phy/exynos-simple-phy.c|9 
  2 files changed, 31 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index f97c4c3..f469099 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -122,6 +122,7 @@ Required properties:
  - compatible : should be one of the listed compatibles:
- "samsung,exynos4210-simple-phy"
- "samsung,exynos4412-simple-phy"
+   - "samsung,exynos5250-simple-phy"
  - reg : offset and length of the register set;
  - #phy-cells : from the generic phy bindings, must be 1;
  
@@ -138,3 +139,24 @@ the PHY specifier identifies the PHY and its meaning is as follows:

0 - HDMI PHY,
1 - ADC PHY,
  
+For "samsung,exynos5250-simple-phy" compatible PHYs the second cell in

+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - ADC PHY,
+  2 - ADC PHY,
+
+Example:
+Simple PHY provider node:
+
+   simplephys: simple-phys@1004 {
+   compatible = "samsung,exynos5250-simple-phy";
+   reg = <0x1004 0x1>;
+   #phy-cells = <1>;
+   };
+
+Other nodes accessing simple PHYs:
+
+   hdmi {
+   phys = <&simplephys 0>;
+   phy-names = "hdmiphy";
+   };
diff --git a/drivers/phy/exynos-simple-phy.c b/drivers/phy/exynos-simple-phy.c
index 57ad338..187f6b1 100644
--- a/drivers/phy/exynos-simple-phy.c
+++ b/drivers/phy/exynos-simple-phy.c
@@ -64,11 +64,20 @@ static const u32 exynos4412_offsets[] = {
~0, /* end mark */
  };
  
+static const u32 exynos5250_offsets[] = {

+   0x0700, /* HDMI_PHY */
+   0x0718, /* ADC_PHY */
+   0x0724, /* SATA_PHY */
+   ~0, /* end mark */
+};
+
  static const struct of_device_id exynos_phy_of_match[] = {
{ .compatible = "samsung,exynos4210-simple-phy",
  .data = exynos4210_offsets},
{ .compatible = "samsung,exynos4412-simple-phy",
  .data = exynos4412_offsets},
+   { .compatible = "samsung,exynos5250-simple-phy",
+ .data = exynos5250_offsets},
{ },
  };
  MODULE_DEVICE_TABLE(of, exynos_phy_of_match);



--
Best Regards,
Pankaj Dubey

--
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 2/2] phy: samsung: add simple phys for exynos5420 SoC

2014-04-20 Thread Pankaj Dubey

Hi Rahul,

On 04/20/2014 07:08 PM, Rahul Sharma wrote:

From: Rahul Sharma 

Extend the support for simple phys for exynos5420
SoC in simple phy driver.

Change-Id: I0ab7b59b1f013db9e924fc868bd8b1b6ed8acbb3

Change-Id should be removed.

Signed-off-by: Rahul Sharma 
---
  .../devicetree/bindings/phy/samsung-phy.txt|6 ++
  drivers/phy/exynos-simple-phy.c|8 
  2 files changed, 14 insertions(+)
  mode change 100644 => 100755 drivers/phy/exynos-simple-phy.c

File permission should not be changed.


diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index f469099..f0ae619 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -123,6 +123,7 @@ Required properties:
- "samsung,exynos4210-simple-phy"
- "samsung,exynos4412-simple-phy"
- "samsung,exynos5250-simple-phy"
+   - "samsung,exynos5420-simple-phy"
  - reg : offset and length of the register set;
  - #phy-cells : from the generic phy bindings, must be 1;
  
@@ -145,6 +146,11 @@ the PHY specifier identifies the PHY and its meaning is as follows:

1 - ADC PHY,
2 - ADC PHY,
  
+For "samsung,exynos5420-simple-phy" compatible PHYs the second cell in

+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - ADC PHY,
+
  Example:
  Simple PHY provider node:
  
diff --git a/drivers/phy/exynos-simple-phy.c b/drivers/phy/exynos-simple-phy.c

old mode 100644
new mode 100755
index 187f6b1..9681a43
--- a/drivers/phy/exynos-simple-phy.c
+++ b/drivers/phy/exynos-simple-phy.c
@@ -71,6 +71,12 @@ static const u32 exynos5250_offsets[] = {
~0, /* end mark */
  };
  
+static const u32 exynos5420_offsets[] = {

+   0x0700, /* HDMI_PHY */
+   0x0720, /* ADC_PHY */
+   ~0, /* end mark */
+};
+
  static const struct of_device_id exynos_phy_of_match[] = {
{ .compatible = "samsung,exynos4210-simple-phy",
  .data = exynos4210_offsets},
@@ -78,6 +84,8 @@ static const struct of_device_id exynos_phy_of_match[] = {
  .data = exynos4412_offsets},
{ .compatible = "samsung,exynos5250-simple-phy",
  .data = exynos5250_offsets},
+   { .compatible = "samsung,exynos5420-simple-phy",
+ .data = exynos5420_offsets},
    { },
  };
  MODULE_DEVICE_TABLE(of, exynos_phy_of_match);



--
Best Regards,
Pankaj Dubey

--
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 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-23 Thread Pankaj Dubey

Hi Vikas,

On 04/23/2014 10:02 PM, Vikas Sajjan wrote:

Hi,

On Wed, Apr 2, 2014 at 1:20 PM, Pankaj Dubey  wrote:

From: Young-Gun Jang 

Add support for mapping Exynos Power Management Unit (PMU) base address
from device tree. Code will use existing samsung pmu binding information.
This patch also adds "get_exynos_pmubase" a helper function to return mapped 
base
address to various other files under "mach-exynos".

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/common.h |2 ++
  arch/arm/mach-exynos/exynos.c |   44 +
  2 files changed, 46 insertions(+)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ff28334..9a55cf6 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -61,4 +61,6 @@ struct exynos_pmu_conf {

  extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);

+extern void __iomem *get_exynos_pmubase(void);
+
  #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a5e1349..a5127fb 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -35,6 +35,8 @@
  #define L2_AUX_VAL 0x7C470001
  #define L2_AUX_MASK 0xC200

+static void __iomem *exynos_pmu_base __initdata;

Are you sure you want to keep exynos_pmu_base in .init section.
I am seeing a crash in platform_do_lowpower()
I think you should remove __initdata.


Thanks for review and testing.
You are right we do not need __initdata here.
I will take care of this in V2.


+
  static struct map_desc exynos4_iodesc[] __initdata = {
 {
 .virtual= (unsigned long)S3C_VA_SYS,
@@ -245,6 +247,47 @@ void __init exynos_init_late(void)
 exynos_pm_init();
  }

+static char const *exynos_dt_pmu_match[] __initconst = {
+   "samsung,exynos4210-pmu",
+   "samsung,exynos4212-pmu",
+   "samsung,exynos4412-pmu",
+   "samsung,exynos5250-pmu",
+   NULL
+};
+
+static int __init exynos_fdt_map_pmu(unsigned long node,
+   const char *uname, int depth, void *data)
+{
+   struct map_desc iodesc;
+   __be32 *reg;
+   unsigned long len;
+
+   if (of_flat_dt_match(node, exynos_dt_pmu_match)) {
+   phys_addr_t phys_addr;
+   reg = of_get_flat_dt_prop(node, "reg", &len);
+   if (reg == NULL || len != (sizeof(unsigned long) * 2))
+   return 0;
+
+   phys_addr = be32_to_cpu(reg[0]);
+   iodesc.pfn = __phys_to_pfn(phys_addr);
+   iodesc.length = be32_to_cpu(reg[1]) - 1;
+   iodesc.virtual = (unsigned long)S5P_VA_PMU;
+   iodesc.type = MT_DEVICE;
+   iotable_init(&iodesc, 1);
+
+   exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1]));
+   if (WARN_ON(!exynos_pmu_base))
+   return -EFAULT;
+   }
+
+   return 0;
+}
+
+inline void __iomem *get_exynos_pmubase()
+{
+   return exynos_pmu_base;
+}
+
  static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
 int depth, void *data)
  {
@@ -301,6 +344,7 @@ void __init exynos_init_io(void)
 debug_ll_io_init();

 of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
+   of_scan_flat_dt(exynos_fdt_map_pmu, NULL);

 /* detect cpu id and rev. */
 s5p_init_cpu(S5P_VA_CHIPID);
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



--
Best Regards,
Pankaj Dubey

--
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/3] ARM: dts: Add PMU reg node to exynos4210

2014-04-24 Thread Pankaj Dubey

Hi Vikas,

On 04/24/2014 08:59 PM, Vikas Sajjan wrote:

+Tomasz


On Wed, Apr 2, 2014 at 1:32 PM, Pankaj Dubey  wrote:

This patch adds pmu regnode to exynos4210 dtsi to handle
PMU register access via DT.

Signed-off-by: Pankaj Dubey 
---
  arch/arm/boot/dts/exynos4210.dtsi |5 +
  1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index cacf614..0a2c0fe 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -81,6 +81,11 @@
 interrupts = <2 2>, <3 2>;
 };

+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4210-pmu", "syscon";
+   reg = <0x1002 0x5000>;

Can we have 2 strings as "compatible" and these 2 strings are used by
2 different driver?

Because once syscon driver gets probed, exynos-pmu.c [1] driver will
never be probed.

The new PMU driver [1] completely relies on this. With just
exynos_defconfig, you will not notice this issue, since syscon is NOT
enabled by exynos_defconfig. When I enabled "System Controller
Register R/W Based on Regmap" in menuconfig, I could see PMU driver
[1] is NEVER probed.

Let me know, if I am missing something.

  [1] http://www.spinics.net/lists/arm-kernel/msg319750.html


You are correct. We also missed this because "SYSCON" option was
not enabled in exynos_defconfig.
I noticed this during preparation of V2 when I planned to use
"early_syscon_init" [1] as suggested by Sylwester here [2].

In V2 I will take care of this. I hope soon I will be able to post second
version of this series, just waiting for testing and internal code review.

[1] https://lkml.org/lkml/2014/4/8/239
[2] https://lkml.org/lkml/2014/4/2/171




+   };
+
 pinctrl_0: pinctrl@1140 {
 compatible = "samsung,exynos4210-pinctrl";
 reg = <0x1140 0x1000>;
--
1.7.10.4


___
linux-arm-kernel mailing list
linux-arm-ker...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



--
Best Regards,
Pankaj Dubey

--
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 v2 0/5] Add PMU node for Exynos SoCs

2014-04-25 Thread Pankaj Dubey
This patch series adds new property in samsung PMU binding as
"samsung,syscon-phandle" to get PMU regmap handle in PMU driver
implementation and "mach-exynos/exynos.c".
This patch also updates Exynos4210, Exynos4412 and Exynos4212 dtsi files
for adding PMU (Power Management Unit) reg node.
Updated binding document for the same.

These patches are required for converting PMU implementation free from
static mapping of PMU registers as well as it's dependency from machine
header files, thus allowing us to converting it into DT based.

Changes since v1:
 - Added new property "samsung,syscon-phandle" to get access to PMU regmap 
handle.
 - Updated Exynos5250, Exynos5420, Exynos4210/4412/4212 dtsi files.
 - Rebased on Kukjin Kim's for-next branch.

Pankaj Dubey (5):
  ARM: dts: Add syscon handle in pmu node for exynos5250
  ARM: dts: Add PMU node to exynos4210
  ARM: dts: Add PMU node to exynos4212 and exynos4412
  arm: dts: Add syscon handle in pmu node for exynos5420
  Documentation: update samsung pmu binding information

 Documentation/devicetree/bindings/arm/samsung/pmu.txt |7 +++
 arch/arm/boot/dts/exynos4210.dtsi |6 ++
 arch/arm/boot/dts/exynos4212.dtsi |6 ++
 arch/arm/boot/dts/exynos4412.dtsi |6 ++
 arch/arm/boot/dts/exynos5250.dtsi |1 +
 arch/arm/boot/dts/exynos5420.dtsi |1 +
 6 files changed, 27 insertions(+)

-- 
1.7.10.4

--
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 v2 3/5] ARM: dts: Add PMU node to exynos4212 and exynos4412

2014-04-25 Thread Pankaj Dubey
This patch adds pmu regnode to exynos4212 and exynos4412 dtsi to
handle PMU register access via DT.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos4212.dtsi |6 ++
 arch/arm/boot/dts/exynos4412.dtsi |6 ++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4212.dtsi 
b/arch/arm/boot/dts/exynos4212.dtsi
index 3c00e6e..b1d4768 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -29,4 +29,10 @@
gic: interrupt-controller@1049 {
cpu-offset = <0x8000>;
};
+
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4212-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4412.dtsi 
b/arch/arm/boot/dts/exynos4412.dtsi
index 15d3c0a..6152e70 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -29,4 +29,10 @@
gic: interrupt-controller@1049 {
cpu-offset = <0x4000>;
};
+
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4412-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
+   };
 };
-- 
1.7.10.4

--
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 v2 1/5] ARM: dts: Add syscon handle in pmu node for exynos5250

2014-04-25 Thread Pankaj Dubey
Add "samsung,syscon-phandle" property pointing to PMU node
to access PMU register via PMU regmap handle.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos5250.dtsi |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 3742331..52801af 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -173,6 +173,7 @@
pmu_system_controller: system-controller@1004 {
compatible = "samsung,exynos5250-pmu", "syscon";
reg = <0x1004 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
};
 
watchdog@101D {
-- 
1.7.10.4

--
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 v2 5/5] Documentation: update samsung pmu binding information

2014-04-25 Thread Pankaj Dubey
This patch updates samsung pmu (power management unit) binding information.

CC: Leela Krishna Amudala 
CC: Guenter Roeck 
CC: Rob Landley 
Signed-off-by: Pankaj Dubey 
---
 Documentation/devicetree/bindings/arm/samsung/pmu.txt |7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
index f1f1552..ac9b45c 100644
--- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
@@ -2,14 +2,21 @@ SAMSUNG Exynos SoC series PMU Registers
 
 Properties:
  - compatible : should contain two values. First value must be one from 
following list:
+  - "samsung,exynos4210-pmu" - for Exynos4210 SoC,
+  - "samsung,exynos4212-pmu" - for Exynos4212 SoC,
+  - "samsung,exynos4412-pmu" - for Exynos4412 SoC,
   - "samsung,exynos5250-pmu" - for Exynos5250 SoC,
   - "samsung,exynos5420-pmu" - for Exynos5420 SoC.
second value must be always "syscon".
 
  - reg : offset and length of the register set.
 
+ - samsung,syscon-phandle : reference to syscon node. This property points to 
syscon node
+   holding the PMU base address.
+
 Example :
 pmu_system_controller: system-controller@1004 {
compatible = "samsung,exynos5250-pmu", "syscon";
reg = <0x1004 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
 };
-- 
1.7.10.4

--
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 v2 2/5] ARM: dts: Add PMU node to exynos4210

2014-04-25 Thread Pankaj Dubey
This patch adds pmu regnode to exynos4210 dtsi to handle
PMU register access via DT.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos4210.dtsi |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index cacf614..042b6d9 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -81,6 +81,12 @@
interrupts = <2 2>, <3 2>;
};
 
+   pmu_system_controller: system-controller@1002 {
+   compatible = "samsung,exynos4210-pmu", "syscon";
+   reg = <0x1002 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
+   };
+
pinctrl_0: pinctrl@1140 {
compatible = "samsung,exynos4210-pinctrl";
reg = <0x1140 0x1000>;
-- 
1.7.10.4

--
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 v2 4/5] arm: dts: Add syscon handle in pmu node for exynos5420

2014-04-25 Thread Pankaj Dubey
Add "samsung,syscon-phandle" property pointing to PMU node
to access PMU register via PMU regmap handle.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/boot/dts/exynos5420.dtsi |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index c3a9a66..c6e449d 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -673,6 +673,7 @@
pmu_system_controller: system-controller@1004 {
compatible = "samsung,exynos5420-pmu", "syscon";
reg = <0x1004 0x5000>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
};
 
tmu_cpu0: tmu@1006 {
-- 
1.7.10.4

--
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 v2 04/10] ARM: EXYNOS: Remove file path from comment section

2014-04-25 Thread Pankaj Dubey
Many files under "arm/mach-exynos" are having file path in file
comment section which is invalid now.
So for better code maintainability let's remove them.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/headsmp.S |2 --
 arch/arm/mach-exynos/hotplug.c |3 +--
 arch/arm/mach-exynos/include/mach/memory.h |3 +--
 arch/arm/mach-exynos/platsmp.c |3 +--
 4 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S
index cdd9d91..698c57f 100644
--- a/arch/arm/mach-exynos/headsmp.S
+++ b/arch/arm/mach-exynos/headsmp.S
@@ -1,6 +1,4 @@
 /*
- *  linux/arch/arm/mach-exynos4/headsmp.S
- *
  *  Cloned from linux/arch/arm/mach-realview/headsmp.S
  *
  *  Copyright (c) 2003 ARM Limited
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead53..73b0b5c 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -1,5 +1,4 @@
-/* linux arch/arm/mach-exynos4/hotplug.c
- *
+/*
  *  Cloned from linux/arch/arm/mach-realview/hotplug.c
  *
  *  Copyright (C) 2002 ARM Ltd.
diff --git a/arch/arm/mach-exynos/include/mach/memory.h 
b/arch/arm/mach-exynos/include/mach/memory.h
index 2a4cdb7..e19df1f 100644
--- a/arch/arm/mach-exynos/include/mach/memory.h
+++ b/arch/arm/mach-exynos/include/mach/memory.h
@@ -1,5 +1,4 @@
-/* linux/arch/arm/mach-exynos4/include/mach/memory.h
- *
+/*
  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
  *
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 03e5e9f..29c2286 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -1,5 +1,4 @@
-/* linux/arch/arm/mach-exynos4/platsmp.c
- *
+/*
  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
  *
-- 
1.7.10.4

--
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 v2 02/10] ARM: EXYNOS: Cleanup "mach-exynos/common.h" file

2014-04-25 Thread Pankaj Dubey
Remove unused and unwanted declarations from "mach-exynos/common.h"

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9ef3f83..31c5964 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,14 +15,8 @@
 #include 
 #include 
 
-void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-
-struct map_desc;
-void exynos_init_io(void);
-void exynos_restart(enum reboot_mode mode, const char *cmd);
 void exynos_cpuidle_init(void);
 void exynos_cpufreq_init(void);
-void exynos_init_late(void);
 
 void exynos_firmware_init(void);
 
-- 
1.7.10.4

--
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 v2 09/10] ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c

2014-04-25 Thread Pankaj Dubey
As we have removed static mappings from "regs-pmu.h" it does not
need map.h anymore. But "platsmp.c" needed this and till now it
got included indirectly. So lets move header inclusion of
"mach/map.h" from "regs-pmu.h" to "platsmp.c".

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/platsmp.c  |1 +
 arch/arm/mach-exynos/regs-pmu.h |2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 9ce4c9f9..3831e6c 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -26,6 +26,7 @@
 #include 
 
 #include 
+#include 
 
 #include "common.h"
 #include "regs-pmu.h"
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 7f3bf65..bb57b62 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -12,8 +12,6 @@
 #ifndef __ASM_ARCH_REGS_PMU_H
 #define __ASM_ARCH_REGS_PMU_H __FILE__
 
-#include 
-
 #define S5P_CENTRAL_SEQ_CONFIGURATION  0x0200
 
 #define S5P_CENTRAL_LOWPWR_CFG (1 << 16)
-- 
1.7.10.4

--
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 v2 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-25 Thread Pankaj Dubey
From: Young-Gun Jang 

Add support for mapping Samsung Power Management Unit (PMU) base address
from device tree. Code will use existing samsung pmu binding information.
This patch also adds two helper functions as "get_exynos_pmuregmap" and
"get_exynos_pmuaddr".
"get_exynos_pmuregmap" returns a regmap based PMU register handle where as
"get_exynos_pmuaddr" returns ioremap virtual address.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/Kconfig  |2 ++
 arch/arm/mach-exynos/common.h |3 ++
 arch/arm/mach-exynos/exynos.c |   78 +
 3 files changed, 83 insertions(+)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fc8bf18..2f60c90 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -26,6 +26,7 @@ config ARCH_EXYNOS4
select PINCTRL
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
+   select MFD_SYSCON
help
  Samsung EXYNOS4 SoCs based systems
 
@@ -36,6 +37,7 @@ config ARCH_EXYNOS5
select HAVE_ARM_SCU if SMP
select HAVE_SMP
select PINCTRL
+   select MFD_SYSCON
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 31c5964..ecfd0fc 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -57,4 +57,7 @@ struct exynos_pmu_conf {
 
 extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 
+extern struct regmap *get_exynos_pmuregmap(void);
+extern void __iomem *get_exynos_pmuaddr(void);
+
 #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index d6f405f..68f60e1 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,6 +37,9 @@
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
 
+static struct regmap *exynos_pmu_regmap;
+static void __iomem *exynos_pmu_base;
+
 static struct map_desc exynos4_iodesc[] __initdata = {
{
.virtual= (unsigned long)S3C_VA_SYS,
@@ -269,6 +273,46 @@ static int __init exynos_fdt_map_chipid(unsigned long 
node, const char *uname,
return 1;
 }
 
+static const struct of_device_id exynos_dt_pmu_match[] = {
+   { .compatible = "samsung,exynos4210-pmu" },
+   { .compatible = "samsung,exynos4212-pmu" },
+   { .compatible = "samsung,exynos4412-pmu" },
+   { .compatible = "samsung,exynos5250-pmu" },
+   {},
+};
+
+static int __init exynos_fdt_map_pmu(unsigned long node,
+   const char *uname, int depth, void *data)
+{
+   struct map_desc iodesc;
+   __be32 *reg;
+   unsigned long len;
+   phys_addr_t phys_addr;
+   const struct of_device_id *matches = exynos_dt_pmu_match;
+
+   for (; matches->compatible[0]; matches++) {
+   if (!of_flat_dt_is_compatible(node, matches->compatible))
+   continue;
+   reg = of_get_flat_dt_prop(node, "reg", &len);
+   if (reg == NULL || len != (sizeof(unsigned long) * 2))
+   return 0;
+
+   phys_addr = be32_to_cpu(reg[0]);
+   iodesc.pfn = __phys_to_pfn(phys_addr);
+   iodesc.length = be32_to_cpu(reg[1]) - 1;
+   iodesc.virtual = (unsigned long)S5P_VA_PMU;
+   iodesc.type = MT_DEVICE;
+   iotable_init(&iodesc, 1);
+
+   exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1]));
+   if (WARN_ON(!exynos_pmu_base))
+   return -EFAULT;
+   return 1;
+   }
+
+   return 0;
+}
+
 /*
  * exynos_map_io
  *
@@ -302,6 +346,7 @@ static void __init exynos_init_io(void)
debug_ll_io_init();
 
of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
+   of_scan_flat_dt(exynos_fdt_map_pmu, NULL);
 
/* detect cpu id and rev. */
s5p_init_cpu(S5P_VA_CHIPID);
@@ -336,6 +381,38 @@ static int __init exynos4_l2x0_cache_init(void)
 }
 early_initcall(exynos4_l2x0_cache_init);
 
+
+inline struct regmap *get_exynos_pmuregmap()
+{
+   return exynos_pmu_regmap;
+}
+
+inline void __iomem *get_exynos_pmuaddr()
+{
+   return exynos_pmu_base;
+}
+
+
+void __init exynos_map_pmu(void)
+{
+   struct device_node *np = NULL;
+
+   early_syscon_init();
+
+   np = of_find_matching_node(NULL, exynos_dt_pmu_match);
+
+   if (!np) {
+   pr_err("Failed to find PMU node\n");
+   return;
+   } else {
+   exynos_pmu_regmap = syscon_early_regmap_lookup_by_phandle(np,
+   "samsung,syscon-phandle");
+   }
+
+

[PATCH v2 07/10] ARM: EXYNOS: Remove "linux/bug.h" from pmu.c

2014-04-25 Thread Pankaj Dubey
From: Young-Gun Jang 

This patch removes unnecessary header file inclusion from pmu.c.

Signed-off-by: Young-Gun Jang 
---
 arch/arm/mach-exynos/pmu.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce1..4c3453a 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -11,7 +11,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
-- 
1.7.10.4

--
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 v2 08/10] ARM: EXYNOS: Refactored code for using PMU address via DT

2014-04-25 Thread Pankaj Dubey
Under "arm/mach-exynos" many files are using PMU register offsets.
Since we have added support for accessing PMU base address via DT,
now we can remove PMU mapping from exynosX_iodesc.
Let's convert all these access using either of "get_exynos_pmuaddr"
or "get_exynos_regmap".
This will help us in removing static mapping of PMU base address
as well as help in reducing dependency over machine header files.
Thus helping for migration of PMU implementation from machine to driver
folder which can be reused for ARM64 bsed SoC.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h   |4 +-
 arch/arm/mach-exynos/cpuidle.c  |   37 ++-
 arch/arm/mach-exynos/exynos.c   |   19 +-
 arch/arm/mach-exynos/hotplug.c  |4 +-
 arch/arm/mach-exynos/include/mach/map.h |3 -
 arch/arm/mach-exynos/platsmp.c  |   13 +-
 arch/arm/mach-exynos/pm.c   |   60 ++--
 arch/arm/mach-exynos/pmu.c  |   40 +--
 arch/arm/mach-exynos/regs-pmu.h |  506 +++
 9 files changed, 348 insertions(+), 338 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ecfd0fc..ad5128e 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -40,7 +40,7 @@ extern void exynos_cpu_die(unsigned int cpu);
 
 /* PMU(Power Management Unit) support */
 
-#define PMU_TABLE_END  NULL
+#define PMU_TABLE_END  0x
 
 enum sys_powerdown {
SYS_AFTR,
@@ -51,7 +51,7 @@ enum sys_powerdown {
 
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
-   void __iomem *reg;
+   unsigned int offset;
unsigned int val[NUM_SYS_POWERDOWN];
 };
 
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index c57cae0..5dcdd46 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -34,10 +35,10 @@
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
-   (S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
+   0x24 : S5P_INFORM0))
 #define REG_DIRECTGO_FLAG  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
-   (S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
+   0x20 : S5P_INFORM1))
 
 #define S5P_CHECK_AFTR 0xFCBA0D10
 
@@ -60,6 +61,8 @@
 #define PWR_CTRL2_CORE2_UP_RATIO   (1 << 4)
 #define PWR_CTRL2_CORE1_UP_RATIO   (1 << 0)
 
+static struct regmap *pmu_regmap;
+
 static int exynos4_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index);
@@ -87,7 +90,7 @@ static struct cpuidle_driver exynos4_idle_driver = {
 /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
 static void exynos4_set_wakeupmask(void)
 {
-   __raw_writel(0xff3e, S5P_WAKEUP_MASK);
+   regmap_write(pmu_regmap, S5P_WAKEUP_MASK, 0xff3e);
 }
 
 static unsigned int g_pwr_ctrl, g_diag_reg;
@@ -120,22 +123,28 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device 
*dev,
struct cpuidle_driver *drv,
int index)
 {
-   unsigned long tmp;
+   unsigned int tmp;
 
exynos4_set_wakeupmask();
 
/* Set value of power down register for aftr mode */
exynos_sys_powerdown_conf(SYS_AFTR);
-
-   __raw_writel(virt_to_phys(exynos_cpu_resume), REG_DIRECTGO_ADDR);
-   __raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
-
+   
+   if (samsung_rev() == EXYNOS4210_REV_1_0) {
+   __raw_writel(virt_to_phys(exynos_cpu_resume),
+   S5P_VA_SYSRAM + REG_DIRECTGO_ADDR);
+   __raw_writel(S5P_CHECK_AFTR, S5P_VA_SYSRAM + REG_DIRECTGO_FLAG);
+   } else {
+   regmap_write(pmu_regmap, REG_DIRECTGO_ADDR,
+   virt_to_phys(exynos_cpu_resume));
+   regmap_write(pmu_regmap, REG_DIRECTGO_FLAG, S5P_CHECK_AFTR);
+   }
save_cpu_arch_register();
 
/* Setting Central Sequence Register for power down mode */
-   tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+   regmap_read(pmu_regmap, S5P_CENTRAL_SEQ_CONFIGURATION, &tmp);
tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
-   __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+   regmap_write(pmu_regmap, S5P_CENTRAL_SEQ_CONFIGURATION, tmp);
 
cpu_pm_enter();
cpu_suspend(0, idle_finisher);
@@ -154,14 +163,14 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device 
*dev,
 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
 * in this situation.
 */

[PATCH v2 05/10] ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain

2014-04-25 Thread Pankaj Dubey
From: Young-Gun Jang 

Current "pm_domain.c" file uses "S5P_INT_LOCAL_PWR_EN" definition from
"regs-pmu.h" and hence needs to include this header file. As there is
no other user of "S5P_INT_LOCAL_PWR_EN" definition other than pm_domain,
to remove "regs-pmu.h" header file dependency from "pm_domain.c"  it's
better we define this definition in "pm_domain.c" file itself and thus it
will help in removing header file inclusion from "pm_domain.c".

Signed-off-by: Young-Gun Jang 
---
 arch/arm/mach-exynos/pm_domains.c |2 +-
 arch/arm/mach-exynos/regs-pmu.h   |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c 
b/arch/arm/mach-exynos/pm_domains.c
index fe6570e..f676b0a 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include "regs-pmu.h"
+#define S5P_INT_LOCAL_PWR_EN 0x7
 
 /*
  * Exynos specific wrapper around the generic power domain
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4ee706d..bfebe84 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -116,7 +116,6 @@
 #define S5P_PAD_RET_EBIB_OPTIONS5P_PMUREG(0x31A8)
 
 #define S5P_CORE_LOCAL_PWR_EN  0x3
-#define S5P_INT_LOCAL_PWR_EN   0x7
 
 #define S5P_CHECK_SLEEP0x0BAD
 
-- 
1.7.10.4

--
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 v2 03/10] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file.

2014-04-25 Thread Pankaj Dubey
From: Young-Gun Jang 

While making PMU implementation to be device tree based, there are
few register offsets related with SYSREG present in regs-pmu.h, so
let's make a new header file "regs-sys.h" to keep all such SYSREG
related register offsets and remove them from "regs-pmu.h"

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c   |1 +
 arch/arm/mach-exynos/pm.c   |1 +
 arch/arm/mach-exynos/regs-pmu.h |3 ---
 arch/arm/mach-exynos/regs-sys.h |   22 ++
 4 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-exynos/regs-sys.h

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 2388ee4..d6f405f 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -31,6 +31,7 @@
 #include "common.h"
 #include "mfc.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 15af0ce..723c988 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -35,6 +35,7 @@
 
 #include "common.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 /**
  * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4f6a256..4ee706d 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -15,7 +15,6 @@
 #include 
 
 #define S5P_PMUREG(x)  (S5P_VA_PMU + (x))
-#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
 
 #define S5P_CENTRAL_SEQ_CONFIGURATION  S5P_PMUREG(0x0200)
 
@@ -180,8 +179,6 @@
 
 /* For EXYNOS5 */
 
-#define EXYNOS5_SYS_I2C_CFG
S5P_SYSREG(0x0234)
-
 #define EXYNOS5_AUTO_WDTRESET_DISABLE  
S5P_PMUREG(0x0408)
 #define EXYNOS5_MASK_WDTRESET_REQUEST  
S5P_PMUREG(0x040C)
 
diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h
new file mode 100644
index 000..84332b0
--- /dev/null
+++ b/arch/arm/mach-exynos/regs-sys.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * EXYNOS - system register definition
+ *
+ * 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.
+*/
+
+#ifndef __ASM_ARCH_REGS_SYS_H
+#define __ASM_ARCH_REGS_SYS_H __FILE__
+
+#include 
+
+#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
+
+/* For EXYNOS5 */
+#define EXYNOS5_SYS_I2C_CFGS5P_SYSREG(0x0234)
+
+#endif /* __ASM_ARCH_REGS_SYS_H */
-- 
1.7.10.4

--
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 v2 10/10] ARM: EXYNOS: Add device tree based initialization support for PMU.

2014-04-25 Thread Pankaj Dubey
This patch adds device tree based initialization for PMU and modifies
PMU initialization implementation in following way:

1: Let's initialize PMU based on device tree compatibility string.
2: Obtain PMU regmap handle using "syscon_early_regmap_lookup_by_phandle"
so that we can reduce dependency over machine header files.
3: Separate each SoC's PMU initialization function and bind this initialization
function with PMU compatibility string.
4 : It also removes uses of soc_is_exynos() thus making PMU implementation
independent of "plat/cpu.h".

Signed-off-by: Pankaj Dubey 
Signed-off-by: Young-Gun Jang 
---
 arch/arm/mach-exynos/pmu.c |  182 +---
 1 file changed, 138 insertions(+), 44 deletions(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 67116a5..abcf753 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -9,17 +9,31 @@
  * published by the Free Software Foundation.
  */
 
-#include 
 #include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "common.h"
 #include "regs-pmu.h"
 
+enum exynos_pmu_id {
+   PMU_EXYNOS4210,
+   PMU_EXYNOS4X12,
+   PMU_EXYNOS4412,
+   PMU_EXYNOS5250,
+};
+
+struct exynos_pmu_data {
+   enum exynos_pmu_id  pmu_id;
+   struct regmap   *pmu_regmap;
+};
+
+struct exynos_pmu_data *pmu_data;
 static const struct exynos_pmu_conf *exynos_pmu_config;
-static struct regmap *pmu_regmap;
+typedef void (*exynos_pmu_init_t)(void);
 
 static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
/* { .reg = address, .val = { AFTR, LPA, SLEEP } */
@@ -348,28 +362,31 @@ static void exynos5_init_pmu(void)
 * Enable both SC_FEEDBACK and SC_COUNTER
 */
for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) {
-   regmap_read(pmu_regmap, exynos5_list_both_cnt_feed[i], &tmp);
+   regmap_read(pmu_data->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], &tmp);
tmp |= (EXYNOS5_USE_SC_FEEDBACK |
EXYNOS5_USE_SC_COUNTER);
-   regmap_write(pmu_regmap, exynos5_list_both_cnt_feed[i], tmp);
+   regmap_write(pmu_data->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], tmp);
}
 
/*
 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
 */
-   regmap_read(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
+   regmap_read(pmu_data->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
-   regmap_write(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
+   regmap_write(pmu_data->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
 
/*
 * Disable WFI/WFE on XXX_OPTION
 */
for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) {
-   tmp = regmap_read(pmu_regmap, exynos5_list_diable_wfi_wfe[i],
-   &tmp);
+   tmp = regmap_read(pmu_data->pmu_regmap,
+   exynos5_list_diable_wfi_wfe[i], &tmp);
tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE |
 EXYNOS5_OPTION_USE_STANDBYWFI);
-   regmap_write(pmu_regmap, exynos5_list_diable_wfi_wfe[i], tmp);
+   regmap_write(pmu_data->pmu_regmap,
+   exynos5_list_diable_wfi_wfe[i], tmp);
}
 }
 
@@ -377,52 +394,129 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode)
 {
unsigned int i;
 
-   if (soc_is_exynos5250())
+   if (pmu_data->pmu_id == PMU_EXYNOS5250)
exynos5_init_pmu();
 
for (i = 0; (exynos_pmu_config[i].offset != PMU_TABLE_END) ; i++)
-   regmap_write(pmu_regmap, exynos_pmu_config[i].offset,
+   regmap_write(pmu_data->pmu_regmap, exynos_pmu_config[i].offset,
exynos_pmu_config[i].val[mode]);
 
-   if (soc_is_exynos4412()) {
+   if (pmu_data->pmu_id == PMU_EXYNOS4412) {
for (i = 0; exynos4412_pmu_config[i].offset != PMU_TABLE_END; 
i++)
-   regmap_write(pmu_regmap, 
exynos4412_pmu_config[i].offset,
+   regmap_write(pmu_data->pmu_regmap,
+   exynos4412_pmu_config[i].offset,
exynos4412_pmu_config[i].val[mode]);
}
 }
 
-static int __init exynos_pmu_init(void)
+static void exynos4210_pmu_init(void)
 {
-   unsigned int value;
-
exynos_pmu_config = exynos4210_pmu_config;
-   pmu_regmap = get_exynos_pmuregmap();
-
-   if (soc_is_exynos4210()) {
-   exynos_pmu_config = exynos4210_pmu_config;
-   pr_info("EXYNOS4210 PMU Initialize\n")

[PATCH v2 00/10] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-04-25 Thread Pankaj Dubey
This patch series, does some minor cleanup and modifies Exynos PMU related
code for mapping and initialization of Exynos Power Management Unit (PMU)
base address from device tree. This is also preparation for moving PMU
related code out of machine folder and moving into a "drivers/mfd", so that
ARM64 based SoC can utilize common piece of code. These patches require change
in Exynos4210, Exynos4212 and Exynos4412 dtsi files, which has been posted
as separate patch series [2]

These patches are created on top of Kukjin Kim's for-next (v3.15-rc1 tag)
branch.

These patches depends on following two patch series:
1) mfd: syscon: Support early initialization
   https://lkml.org/lkml/2014/4/8/239
2) Add PMU node for Exynos SoCs
   http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg29329.html

We have tested these patches on SMDK5250 and Arndale (Exynos5250) boards for
System boot and PMU initialization and S2R.

For testing on Arndale (Exynos5250) board:
Tested-by: Pankaj Dubey 

Changes Since v1:
 - Rebased on latest for-next of Kukjin Kim's tree.
 - Added patch: "Make exynos machine_ops as static". 
For making more cleanup in "mach-exynos/common.h"
as suggested by Tomasz Figa.
 - Addressed comments of Tomasz Figa for cleaning "mach-exynos/common.h".
 - Updated patch: Remove file path from comment section
As suggested by Michel Simek, instead of updating file path
lets remove them from each file under "mach-exynos".
Even though Kukjin pointed out that there is similar patch pending from
Sachin/Tushar but since I could not find I have included this here. If
I have missed something please point to any existing such patch.
 - Updated patch: Add support for mapping PMU base address via DT
- Removed __initdata from declaration of "exynos_pmu_base", as it caused
kernel crash as pointed out by Vikas Sajjan.
- Added support for Syscon initialization and getting PMU regmap handle
as suggested by Sylwester. Since current implementation of early
intialization [1] has limitation that "early_syscon_init" requires
DT to be unflattened and system should be able to allocate memory,
we can't use regmap handles for platsmp.c file as "smp_secondary_init"
will be called before DT unflattening. So I have kept both method for
accessing PMU base address. platsmp.c will use ioremmaped address where
as rest other files can use regmap handle.
 - Added patch: Remove "linux/bug.h" from pmu.c.
 - Updated patch: Refactored code for PMU register mapping via DT
- Modified to use regmap_read/write when using regmap handle.
 - Added patch: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
 - Added patch: Add device tree based initialization support for PMU.
- Convert existing PMU implementation to be a device tree based 
 before moving it to "drivers/mfd" folder. As suggested by Bartlomiej.
- Dropped making a platform_driver for PMU, as currently PMU binding
has two compatibility strings as "samsung, exynosxxx-pmu", "syscon",
once we enable MFD_SYSCON config option, current "syscon" driver probe
gets called and PMU probe never gets called. So modified PMU
initialization code to scan DT and match against supported compatiblity
string in driver code, and once we get matching node use that for
accessing PMU regmap handle using 
"syscon_early_regmap_lookup_by_phandle".
If there is any better solution please suggest.

Pankaj Dubey (6):
  ARM: EXYNOS: Make exynos machine_ops as static
  ARM: EXYNOS: Cleanup "mach-exynos/common.h" file
  ARM: EXYNOS: Remove file path from comment section
  ARM: EXYNOS: Refactored code for using PMU address via DT
  ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
  ARM: EXYNOS: Add device tree based initialization support for PMU.

Young-Gun Jang (4):
  ARM: EXYNOS: Move SYSREG definition into sys-reg specific file.
  ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain
  ARM: EXYNOS: Add support for mapping PMU base address via DT
  ARM: EXYNOS: Remove "linux/bug.h" from pmu.c

 arch/arm/mach-exynos/Kconfig   |2 +
 arch/arm/mach-exynos/common.h  |   13 +-
 arch/arm/mach-exynos/cpuidle.c |   37 +-
 arch/arm/mach-exynos/exynos.c  |  104 +-
 arch/arm/mach-exynos/headsmp.S |2 -
 arch/arm/mach-exynos/hotplug.c |7 +-
 arch/arm/mach-exynos/include/mach/map.h|3 -
 arch/arm/mach-exynos/include/mach/memory.h |3 +-
 arch/arm/mach-exynos/platsmp.c |   17 +-
 arch/arm/mach-exynos/pm.c  |   61 ++--
 arch/arm/mach-exynos/pm_domains.c

[PATCH v2 01/10] ARM: EXYNOS: Make exynos machine_ops as static

2014-04-25 Thread Pankaj Dubey
As machine function ops are used only in this file let's make
them static.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b32a907..2388ee4 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -198,7 +198,7 @@ static struct map_desc exynos5_iodesc[] __initdata = {
},
 };
 
-void exynos_restart(enum reboot_mode mode, const char *cmd)
+static void exynos_restart(enum reboot_mode mode, const char *cmd)
 {
struct device_node *np;
u32 val = 0x1;
@@ -235,7 +235,7 @@ void __init exynos_cpufreq_init(void)
platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
 }
 
-void __init exynos_init_late(void)
+static void __init exynos_init_late(void)
 {
if (of_machine_is_compatible("samsung,exynos5440"))
/* to be supported later */
@@ -296,7 +296,7 @@ static void __init exynos_map_io(void)
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
-void __init exynos_init_io(void)
+static void __init exynos_init_io(void)
 {
debug_ll_io_init();
 
-- 
1.7.10.4

--
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


[RFC PATCH v2 0/3] Add support for Exynos PMU driver

2014-04-25 Thread Pankaj Dubey
This patch series moves PMU implementation from "mach-exynos/pmu.c" to
"drivers/mfd/exynos-pmu.c". Patch v1 was posted as RFC [1].


In case of ARM32 we had machine folder such as "mach-exynos" but
moving forward with ARM64 SoC support we can not have any more such
machine folders, keeping that in mind we have planned to move PMU
implementation out of machine folder, so that common piece of code
can be reused.

This patch series is based on kgene for-next and depends on following
patch series
 a) [PATCH v2 0/5] Add PMU node for Exynos SoCs
https://lkml.org/lkml/2014/4/25/216
 b) [PATCH v2 00/10] ARM: Exynos: PMU cleanup and refactoring for using DT
https://lkml.org/lkml/2014/4/25/252


1) [RFC PATCH 0/2] Add support for Exynos PMU driver
https://lkml.org/lkml/2014/4/2/69

Changes since v1:
 - Rebased on Kukjin Kim's for-next (3.15_rc1 tag)
 - Added patch: Move PMU specific definitions from common.h
 - Added patch: Move pmu specific header files under "linux/mfd/samsung"
 - Removed patch: ARM: EXYNOS: remove arch specific PMU implementation
As suggested breaking down patches into smalled pieces for better 
review.
Also modified all changes in pmu.c under mach-exynos itself and then
prepared patches moving files from mach-exynos to "drivers/mfd"

Pankaj Dubey (2):
  ARM: EXYNOS: Move pmu specific header files under "linux/mfd/samsung"
  drivers: mfd: Add support for Exynos PMU driver

Younggun Jang (1):
  ARM: EXYNOS: Move PMU specific definitions from common.h

 arch/arm/mach-exynos/Kconfig|2 +
 arch/arm/mach-exynos/Makefile   |2 -
 arch/arm/mach-exynos/common.h   |   17 -
 arch/arm/mach-exynos/cpuidle.c  |3 +-
 arch/arm/mach-exynos/exynos.c   |2 +-
 arch/arm/mach-exynos/hotplug.c  |2 +-
 arch/arm/mach-exynos/platsmp.c  |2 +-
 arch/arm/mach-exynos/pm.c   |3 +-
 arch/arm/mach-exynos/pmu.c  |  522 ---
 arch/arm/mach-exynos/regs-pmu.h |  308 
 drivers/mfd/Kconfig |9 +
 drivers/mfd/Makefile|1 +
 drivers/mfd/exynos-pmu.c|  521 ++
 include/linux/mfd/samsung/exynos-pmu.h  |   31 ++
 include/linux/mfd/samsung/exynos-regs-pmu.h |  308 
 15 files changed, 879 insertions(+), 854 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/pmu.c
 delete mode 100644 arch/arm/mach-exynos/regs-pmu.h
 create mode 100644 drivers/mfd/exynos-pmu.c
 create mode 100644 include/linux/mfd/samsung/exynos-pmu.h
 create mode 100644 include/linux/mfd/samsung/exynos-regs-pmu.h

-- 
1.7.10.4

--
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


[RFC PATCH v2 2/3] ARM: EXYNOS: Move pmu specific header files under "linux/mfd/samsung"

2014-04-25 Thread Pankaj Dubey
Moving Exynos PMU specific header file into "include/linux/mfd/samsung"
thus updated affected files under "mach-exynos" to use new location of
these header files.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/cpuidle.c  |4 +-
 arch/arm/mach-exynos/exynos-pmu.h   |   31 ---
 arch/arm/mach-exynos/exynos.c   |2 +-
 arch/arm/mach-exynos/hotplug.c  |2 +-
 arch/arm/mach-exynos/platsmp.c  |2 +-
 arch/arm/mach-exynos/pm.c   |4 +-
 arch/arm/mach-exynos/pmu.c  |5 +-
 arch/arm/mach-exynos/regs-pmu.h |  308 ---
 include/linux/mfd/samsung/exynos-pmu.h  |   31 +++
 include/linux/mfd/samsung/exynos-regs-pmu.h |  308 +++
 10 files changed, 348 insertions(+), 349 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/exynos-pmu.h
 delete mode 100644 arch/arm/mach-exynos/regs-pmu.h
 create mode 100644 include/linux/mfd/samsung/exynos-pmu.h
 create mode 100644 include/linux/mfd/samsung/exynos-regs-pmu.h

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index ff3be9c..4c18087 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -31,8 +33,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
-#include "exynos-pmu.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos-pmu.h 
b/arch/arm/mach-exynos/exynos-pmu.h
deleted file mode 100644
index 1cc857b..000
--- a/arch/arm/mach-exynos/exynos-pmu.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * Header for EXYNOS PMU Driver support
- *
- * 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.
- */
-
-#ifndef __EXYNOS_PMU_H
-#define __EXYNOS_PMU_H
-
-#define PMU_TABLE_END  0x
-
-enum sys_powerdown {
-   SYS_AFTR,
-   SYS_LPA,
-   SYS_SLEEP,
-   NUM_SYS_POWERDOWN,
-};
-
-struct exynos_pmu_conf {
-   unsigned int offset;
-   unsigned int val[NUM_SYS_POWERDOWN];
-};
-
-extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
-
-#endif /* __EXYNOS_PMU_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b01987e..24c774a 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -32,7 +33,6 @@
 
 #include "common.h"
 #include "mfc.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 7831e64..1d3ad84 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -22,7 +23,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 static inline void cpu_enter_lowpower_a9(void)
 {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 3831e6c..54c0df8 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -29,7 +30,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 extern void exynos4_secondary_startup(void);
 static void __iomem *pmu_base;
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 103ab92..3e75565 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -35,9 +37,7 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
-#include "exynos-pmu.h"
 
 static struct regmap *pmu_regmap;
 
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index d020557..a26332f 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -15,9 +15,8 @@
 #include 
 #include 
 #include 
-
-#include "exynos-pmu.h"
-#include "regs-pmu.h"
+#include 
+#include 
 
 enum exynos_pmu_id {
PMU_EXYNOS4210,
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
deleted file mode 100644
index bb57b62..000
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright (c) 2010-201

[RFC PATCH v2 1/3] ARM: EXYNOS: Move PMU specific definitions from common.h

2014-04-25 Thread Pankaj Dubey
From: Younggun Jang 

This patch moves PMU specific definitions into a new file
as exynos-pmu.h. This will help in making PMU implementation
independent of common.h header.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |   17 -
 arch/arm/mach-exynos/cpuidle.c|1 +
 arch/arm/mach-exynos/exynos-pmu.h |   31 +++
 arch/arm/mach-exynos/pm.c |1 +
 arch/arm/mach-exynos/pmu.c|2 +-
 5 files changed, 34 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/mach-exynos/exynos-pmu.h

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ad5128e..d848ede 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -38,24 +38,7 @@ extern struct smp_operations exynos_smp_ops;
 
 extern void exynos_cpu_die(unsigned int cpu);
 
-/* PMU(Power Management Unit) support */
-
-#define PMU_TABLE_END  0x
-
-enum sys_powerdown {
-   SYS_AFTR,
-   SYS_LPA,
-   SYS_SLEEP,
-   NUM_SYS_POWERDOWN,
-};
-
 extern unsigned long l2x0_regs_phys;
-struct exynos_pmu_conf {
-   unsigned int offset;
-   unsigned int val[NUM_SYS_POWERDOWN];
-};
-
-extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 
 extern struct regmap *get_exynos_pmuregmap(void);
 extern void __iomem *get_exynos_pmuaddr(void);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 5dcdd46..ff3be9c 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -32,6 +32,7 @@
 
 #include "common.h"
 #include "regs-pmu.h"
+#include "exynos-pmu.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos-pmu.h 
b/arch/arm/mach-exynos/exynos-pmu.h
new file mode 100644
index 000..1cc857b
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-pmu.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Header for EXYNOS PMU Driver support
+ *
+ * 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.
+ */
+
+#ifndef __EXYNOS_PMU_H
+#define __EXYNOS_PMU_H
+
+#define PMU_TABLE_END  0x
+
+enum sys_powerdown {
+   SYS_AFTR,
+   SYS_LPA,
+   SYS_SLEEP,
+   NUM_SYS_POWERDOWN,
+};
+
+struct exynos_pmu_conf {
+   unsigned int offset;
+   unsigned int val[NUM_SYS_POWERDOWN];
+};
+
+extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
+
+#endif /* __EXYNOS_PMU_H */
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e4c10d4..103ab92 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -37,6 +37,7 @@
 #include "common.h"
 #include "regs-pmu.h"
 #include "regs-sys.h"
+#include "exynos-pmu.h"
 
 static struct regmap *pmu_regmap;
 
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index abcf753..d020557 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 
-#include "common.h"
+#include "exynos-pmu.h"
 #include "regs-pmu.h"
 
 enum exynos_pmu_id {
-- 
1.7.10.4

--
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


[RFC PATCH v2 3/3] drivers: mfd: Add support for Exynos PMU driver

2014-04-25 Thread Pankaj Dubey
This patch moves Exynos PMU driver implementation from
"arm/mach-exynos" to "drivers/mfd".
This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/Kconfig  |2 +
 arch/arm/mach-exynos/Makefile |2 -
 arch/arm/mach-exynos/pmu.c|  521 -
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/exynos-pmu.c  |  521 +
 6 files changed, 533 insertions(+), 523 deletions(-)
 delete mode 100644 arch/arm/mach-exynos/pmu.c
 create mode 100644 drivers/mfd/exynos-pmu.c

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2f60c90..79559b4 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -27,6 +27,7 @@ config ARCH_EXYNOS4
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS4 SoCs based systems
 
@@ -38,6 +39,7 @@ config ARCH_EXYNOS5
select HAVE_SMP
select PINCTRL
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index a656dbe..19fdf17 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -18,8 +18,6 @@ obj-$(CONFIG_PM_SLEEP)+= pm.o sleep.o
 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
 
-obj-$(CONFIG_ARCH_EXYNOS)  += pmu.o
-
 obj-$(CONFIG_SMP)  += platsmp.o headsmp.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
deleted file mode 100644
index a26332f..000
--- a/arch/arm/mach-exynos/pmu.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
- * http://www.samsung.com/
- *
- * EXYNOS - CPU PMU(Power Management Unit) support
- *
- * 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.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-enum exynos_pmu_id {
-   PMU_EXYNOS4210,
-   PMU_EXYNOS4X12,
-   PMU_EXYNOS4412,
-   PMU_EXYNOS5250,
-};
-
-struct exynos_pmu_data {
-   enum exynos_pmu_id  pmu_id;
-   struct regmap   *pmu_regmap;
-};
-
-struct exynos_pmu_data *pmu_data;
-static const struct exynos_pmu_conf *exynos_pmu_config;
-typedef void (*exynos_pmu_init_t)(void);
-
-static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
-   { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
-   { S5P_DIS_IRQ_CORE0,{ 0x0, 0x0, 0x0 } },
-   { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
-   { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
-   { S5P_DIS_IRQ_CORE1,{ 0x0, 0x0, 0x0 } },
-   { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
-   { S5P_ARM_COMMON_LOWPWR,{ 0x0, 0x0, 0x2 } },
-   { S5P_L2_0_LOWPWR,  { 0x2, 0x2, 0x3 } },
-   { S5P_L2_1_LOWPWR,  { 0x2, 0x2, 0x3 } },
-   { S5P_CMU_ACLKSTOP_LOWPWR,  { 0x1, 0x0, 0x0 } },
-   { S5P_CMU_SCLKSTOP_LOWPWR,  { 0x1, 0x0, 0x0 } },
-   { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_APLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_MPLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_VPLL_SYSCLK_LOWPWR,   { 0x1, 0x0, 0x0 } },
-   { S5P_EPLL_SYSCLK_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_RESET_GPSALIVE_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_CAM_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_TV_LOWPWR,{ 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_MFC_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_G3D_LOWPWR,   { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_LCD0_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_LCD1_LOWPWR,  { 0x1, 0x1, 0x0 } },
-   { S5P_CMU_CLKSTOP_MAUDIO_

Re: [PATCH v2 00/10] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-04-25 Thread Pankaj Dubey
Hi Tomasz,


On Sat, Apr 26, 2014 at 7:43 AM, Tomasz Figa  wrote:
>
> Hi Pankaj,
>
> Just a small note - please refrain from sending next versions of series in 
> reply to previous version. With threading applied, it gets hard to notice 
> that a new version was posted, because the first message of the thread is 
> always v1. Also it makes threads unnecessarily long.
>

OK. I will take care in future.


>
> Best regards,
> Tomasz
>
>
> On 25.04.2014 14:32, Pankaj Dubey wrote:
>>
>> This patch series, does some minor cleanup and modifies Exynos PMU related
>> code for mapping and initialization of Exynos Power Management Unit (PMU)
>> base address from device tree. This is also preparation for moving PMU
>> related code out of machine folder and moving into a "drivers/mfd", so that
>> ARM64 based SoC can utilize common piece of code. These patches require 
>> change
>> in Exynos4210, Exynos4212 and Exynos4412 dtsi files, which has been posted
>> as separate patch series [2]
>>
>> These patches are created on top of Kukjin Kim's for-next (v3.15-rc1 tag)
>> branch.
>>
>> These patches depends on following two patch series:
>> 1) mfd: syscon: Support early initialization
>> https://lkml.org/lkml/2014/4/8/239
>> 2) Add PMU node for Exynos SoCs
>> 
>> http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg29329.html
>>
>> We have tested these patches on SMDK5250 and Arndale (Exynos5250) boards for
>> System boot and PMU initialization and S2R.
>>
>> For testing on Arndale (Exynos5250) board:
>> Tested-by: Pankaj Dubey 
>>
>> Changes Since v1:
>>   - Rebased on latest for-next of Kukjin Kim's tree.
>>   - Added patch: "Make exynos machine_ops as static".
>> For making more cleanup in "mach-exynos/common.h"
>> as suggested by Tomasz Figa.
>>   - Addressed comments of Tomasz Figa for cleaning "mach-exynos/common.h".
>>   - Updated patch: Remove file path from comment section
>> As suggested by Michel Simek, instead of updating file path
>> lets remove them from each file under "mach-exynos".
>> Even though Kukjin pointed out that there is similar patch pending 
>> from
>> Sachin/Tushar but since I could not find I have included this here. 
>> If
>> I have missed something please point to any existing such patch.
>>   - Updated patch: Add support for mapping PMU base address via DT
>> - Removed __initdata from declaration of "exynos_pmu_base", as it 
>> caused
>> kernel crash as pointed out by Vikas Sajjan.
>> - Added support for Syscon initialization and getting PMU regmap 
>> handle
>> as suggested by Sylwester. Since current implementation of early
>> intialization [1] has limitation that "early_syscon_init" requires
>> DT to be unflattened and system should be able to allocate memory,
>> we can't use regmap handles for platsmp.c file as 
>> "smp_secondary_init"
>> will be called before DT unflattening. So I have kept both method for
>> accessing PMU base address. platsmp.c will use ioremmaped address 
>> where
>> as rest other files can use regmap handle.
>>   - Added patch: Remove "linux/bug.h" from pmu.c.
>>   - Updated patch: Refactored code for PMU register mapping via DT
>> - Modified to use regmap_read/write when using regmap handle.
>>   - Added patch: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
>>   - Added patch: Add device tree based initialization support for PMU.
>> - Convert existing PMU implementation to be a device tree based
>>  before moving it to "drivers/mfd" folder. As suggested by 
>> Bartlomiej.
>> - Dropped making a platform_driver for PMU, as currently PMU binding
>> has two compatibility strings as "samsung, exynosxxx-pmu", "syscon",
>> once we enable MFD_SYSCON config option, current "syscon" driver 
>> probe
>> gets called and PMU probe never gets called. So modified PMU
>> initialization code to scan DT and match against supported 
>> compatiblity
>> string in driver code, and once we get matching node use that for
>> accessing PMU regmap handle using 
>> "syscon_early_regmap_lookup_by_phandle".
>> If there is any better solution please suggest.
>>
>> Pankaj Dubey (6):
>>   

Re: [PATCH 1/4] ARM: dts: exynos4: add PMU syscon node

2014-04-25 Thread Pankaj Dubey
Hi Tomasz,

On Sat, Apr 26, 2014 at 8:52 AM, Tomasz Figa  wrote:
> Hi Vikas,
>
>
> On 25.04.2014 10:05, Vikas Sajjan wrote:
>>
>> Hi,
>>
>>
>> On Thu, Apr 24, 2014 at 9:37 PM, Tomasz Figa  wrote:
>>>
>>> Hi Chanho,
>>>
>>>
>>> On 14.04.2014 14:48, Chanho Park wrote:


 This patch adds a PMU(Power Management Unit) syscon node. This
 should be required for USB Phy syscon regmap I/F.

 Cc: Tomasz Figa 
 Cc: Kamil Debski 
 Signed-off-by: Chanho Park 
 ---
arch/arm/boot/dts/exynos4.dtsi | 5 +
1 file changed, 5 insertions(+)

 diff --git a/arch/arm/boot/dts/exynos4.dtsi
 b/arch/arm/boot/dts/exynos4.dtsi
 index 2f8bcd0..e565b86 100644
 --- a/arch/arm/boot/dts/exynos4.dtsi
 +++ b/arch/arm/boot/dts/exynos4.dtsi
 @@ -110,6 +110,11 @@
  reg = <0x1001 0x400>;
  };

 +   pmu_reg: syscon@1002 {
 +   compatible = "samsung,exynos4-pmureg", "syscon";
>>>
>>>
>>
>>   Assume a case where exynos PMU is made as platform driver [1] and we
>> need use the compatible  "samsung,exynos4-pmureg" in the driver.
>> But since syscon driver uses compatible "syscon" and once the syscon
>> driver is probed, the  exynos PMU platform driver [1] will NEVER be
>> probed.
>> So my question is, can we have 2 compatible strings for a DT node, and
>> both the compatible strings are used for probing purpose?
>> Recently I faced this issue on exynos5250, where i was testing PMU
>> driver [1] and I noticed that  PMU driver [1] was NEVER probed, if I
>> enable syscon driver in menuconfig.
>
>
> No, it is not possible to bind two drivers with different compatible strings
> to the same node. Basically this is because only one platform driver can be
> bound to particular platform device.
>

Yes, correct.

> The rule is that the most specific compatible string (e.g. the first from
> the left) that matches should be used, but I'm not sure if this is
> implemented this way in Linux kernel, especially considering that a platform
> driver usually probes when it is being registered. So we might have a race
> here, which you can work around by making sure that your PMU driver is
> always registered first (e.g. by lowering its initcall level).
>

I don't see it's using first compatible string from the left. I can
see whichever driver registers platform driver first, it's probe is
getting called. As in this particular case, PMU has two compatibility
string as "samsung, exynosxxx-pmu", "syscon". But since "syscon"
driver registers it's platform driver in postcore_initcall where as
PMU platform driver [1], was registering as arch_initcall, only
"syscon" probe got called.

In my V2 patch for converting PMU as driver form, I dropped idea of
converting into platform driver, because we can't remove "syscon" from
binding as many other driver wants to access PMU register via regmap
handle. By lowering it's initcall level may be I can make PMU probe
gets called but then how other drivers will be able to access PMU
regmap handles?

> Best regards,
> Tomasz
>
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
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 v2 08/10] ARM: EXYNOS: Refactored code for using PMU address via DT

2014-04-25 Thread Pankaj Dubey
Hi Tomasz,

Thanks for review.

On Sat, Apr 26, 2014 at 7:19 AM, Tomasz Figa  wrote:
> Hi,
>
>
> On 25.04.2014 14:32, Pankaj Dubey wrote:
>>
>> Under "arm/mach-exynos" many files are using PMU register offsets.
>> Since we have added support for accessing PMU base address via DT,
>> now we can remove PMU mapping from exynosX_iodesc.
>> Let's convert all these access using either of "get_exynos_pmuaddr"
>> or "get_exynos_regmap".
>> This will help us in removing static mapping of PMU base address
>> as well as help in reducing dependency over machine header files.
>> Thus helping for migration of PMU implementation from machine to driver
>> folder which can be reused for ARM64 bsed SoC.
>>
>> Signed-off-by: Pankaj Dubey 
>> ---
>>   arch/arm/mach-exynos/common.h   |4 +-
>>   arch/arm/mach-exynos/cpuidle.c  |   37 ++-
>>   arch/arm/mach-exynos/exynos.c   |   19 +-
>>   arch/arm/mach-exynos/hotplug.c  |4 +-
>>   arch/arm/mach-exynos/include/mach/map.h |3 -
>>   arch/arm/mach-exynos/platsmp.c  |   13 +-
>>   arch/arm/mach-exynos/pm.c   |   60 ++--
>>   arch/arm/mach-exynos/pmu.c  |   40 +--
>>   arch/arm/mach-exynos/regs-pmu.h |  506
>> +++
>>   9 files changed, 348 insertions(+), 338 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
>> index ecfd0fc..ad5128e 100644
>> --- a/arch/arm/mach-exynos/common.h
>> +++ b/arch/arm/mach-exynos/common.h
>> @@ -40,7 +40,7 @@ extern void exynos_cpu_die(unsigned int cpu);
>>
>>   /* PMU(Power Management Unit) support */
>>
>> -#define PMU_TABLE_END  NULL
>> +#define PMU_TABLE_END  0x
>
>
> IMHO (-1U) would be more appropriate.
>

OK.

>
>>
>>   enum sys_powerdown {
>> SYS_AFTR,
>> @@ -51,7 +51,7 @@ enum sys_powerdown {
>>
>>   extern unsigned long l2x0_regs_phys;
>>   struct exynos_pmu_conf {
>> -   void __iomem *reg;
>> +   unsigned int offset;
>> unsigned int val[NUM_SYS_POWERDOWN];
>>   };
>>
>> diff --git a/arch/arm/mach-exynos/cpuidle.c
>> b/arch/arm/mach-exynos/cpuidle.c
>> index c57cae0..5dcdd46 100644
>> --- a/arch/arm/mach-exynos/cpuidle.c
>> +++ b/arch/arm/mach-exynos/cpuidle.c
>> @@ -17,6 +17,7 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>>
>>   #include 
>>   #include 
>> @@ -34,10 +35,10 @@
>>
>>   #define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
>> S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0
>> ? \
>> -   (S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
>> +   0x24 : S5P_INFORM0))
>>   #define REG_DIRECTGO_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
>> S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0
>> ? \
>> -   (S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
>> +   0x20 : S5P_INFORM1))
>
>
> This patch seems to be based on old code, before Daniel Lezcano's Exynos
> cpuidle refactor [1] and it should be rebased on top of that series.
>
> [1] http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085
>
>

OK, I will rebase on top of it along with addressing all other review comments.

>>
>>   #define S5P_CHECK_AFTR0xFCBA0D10
>>
>> @@ -60,6 +61,8 @@
>>   #define PWR_CTRL2_CORE2_UP_RATIO  (1 << 4)
>>   #define PWR_CTRL2_CORE1_UP_RATIO  (1 << 0)
>>
>> +static struct regmap *pmu_regmap;
>> +
>>   static int exynos4_enter_lowpower(struct cpuidle_device *dev,
>> struct cpuidle_driver *drv,
>> int index);
>> @@ -87,7 +90,7 @@ static struct cpuidle_driver exynos4_idle_driver = {
>>   /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
>>   static void exynos4_set_wakeupmask(void)
>>   {
>> -   __raw_writel(0xff3e, S5P_WAKEUP_MASK);
>> +   regmap_write(pmu_regmap, S5P_WAKEUP_MASK, 0xff3e);
>>   }
>>
>>   static unsigned int g_pwr_ctrl, g_diag_reg;
>> @@ -120,22 +123,28 @@ static int exynos4_enter_core0_aftr(struct
>> cpuidle_device *dev,
>> struct cpuidle_driver *drv,
>> int index)
>>   {
>> -   unsigned long tm

Re: [PATCH v2 05/10] ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain

2014-04-25 Thread Pankaj Dubey
HI Tomasz,


On Sat, Apr 26, 2014 at 6:19 AM, Tomasz Figa  wrote:
> Hi,
>
>
> On 25.04.2014 14:32, Pankaj Dubey wrote:
>>
>> From: Young-Gun Jang 
>>
>> Current "pm_domain.c" file uses "S5P_INT_LOCAL_PWR_EN" definition from
>> "regs-pmu.h" and hence needs to include this header file. As there is
>> no other user of "S5P_INT_LOCAL_PWR_EN" definition other than pm_domain,
>> to remove "regs-pmu.h" header file dependency from "pm_domain.c"  it's
>> better we define this definition in "pm_domain.c" file itself and thus it
>> will help in removing header file inclusion from "pm_domain.c".
>>
>> Signed-off-by: Young-Gun Jang 
>> ---
>>   arch/arm/mach-exynos/pm_domains.c |2 +-
>>   arch/arm/mach-exynos/regs-pmu.h   |1 -
>>   2 files changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/pm_domains.c
>> b/arch/arm/mach-exynos/pm_domains.c
>> index fe6570e..f676b0a 100644
>> --- a/arch/arm/mach-exynos/pm_domains.c
>> +++ b/arch/arm/mach-exynos/pm_domains.c
>> @@ -22,7 +22,7 @@
>>   #include 
>>   #include 
>>
>> -#include "regs-pmu.h"
>> +#define S5P_INT_LOCAL_PWR_EN 0x7
>
>
> nit: You could indent the value a bit more in case of adding any new macros
> in future. While at it, you could probably also drop the S5P_ prefix.
>

Thanks for review.
Will take care of both suggestions.

Thanks,
Pankaj Dubey

> With these fixed, feel free to add my
>
> Reviewed-by: Tomasz Figa 
>
> Best regards,
> Tomasz
>
> --
> 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 v2 10/10] ARM: EXYNOS: Add device tree based initialization support for PMU.

2014-04-25 Thread Pankaj Dubey
HI Tomasz,

Thanks for review.

On Sat, Apr 26, 2014 at 7:40 AM, Tomasz Figa  wrote:
> Hi,
>
>
> On 25.04.2014 14:32, Pankaj Dubey wrote:
>>
>> This patch adds device tree based initialization for PMU and modifies
>> PMU initialization implementation in following way:
>>
>> 1: Let's initialize PMU based on device tree compatibility string.
>> 2: Obtain PMU regmap handle using "syscon_early_regmap_lookup_by_phandle"
>> so that we can reduce dependency over machine header files.
>> 3: Separate each SoC's PMU initialization function and bind this
>> initialization
>> function with PMU compatibility string.
>> 4 : It also removes uses of soc_is_exynosXXXX() thus making PMU
>> implementation
>> independent of "plat/cpu.h".
>>
>> Signed-off-by: Pankaj Dubey 
>> Signed-off-by: Young-Gun Jang 
>> ---
>>   arch/arm/mach-exynos/pmu.c |  182
>> +---
>>   1 file changed, 138 insertions(+), 44 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
>> index 67116a5..abcf753 100644
>> --- a/arch/arm/mach-exynos/pmu.c
>> +++ b/arch/arm/mach-exynos/pmu.c
>> @@ -9,17 +9,31 @@
>>* published by the Free Software Foundation.
>>*/
>>
>> -#include 
>>   #include 
>>   #include 
>> -
>> -#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>>
>>   #include "common.h"
>>   #include "regs-pmu.h"
>>
>> +enum exynos_pmu_id {
>> +   PMU_EXYNOS4210,
>> +   PMU_EXYNOS4X12,
>> +   PMU_EXYNOS4412,
>> +   PMU_EXYNOS5250,
>> +};
>> +
>> +struct exynos_pmu_data {
>> +   enum exynos_pmu_id  pmu_id;
>> +   struct regmap   *pmu_regmap;
>
>
> Again, since this uses the PMU node directly and doesn't seem to access any
> registers shared with other drivers (or at least not at the time most the
> functions from this file are called) I don't think there is any reason why
> not to use of_iomap() and access the registers directly.
>

Regarding using PMU base address as regmap handle or base address I
have replied to your comments in this thread [1], so let's decide
which way is the best. So I will update accordingly.

[1]: https://lkml.org/lkml/2014/4/25/751

> What about adding more fields to this struct? For example .pmu_config,
> .pmu_config_extra (for model-specific settings, like for Exynos4412, see my
> comment below) and (*pmu_init)? Of course the regmap (or base address) would
> have to be moved outside, as it isn't const data.
>
> Then for each PMU variant there would be a static const struct will all
> those fields already filled in and entries in OF match table would already
> point to appropriate structure.
>

Thanks for suggestion. I will take care in next version.

>
>> +};
>> +
>> +struct exynos_pmu_data *pmu_data;
>>   static const struct exynos_pmu_conf *exynos_pmu_config;
>> -static struct regmap *pmu_regmap;
>> +typedef void (*exynos_pmu_init_t)(void);
>>
>>   static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
>> /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
>> @@ -348,28 +362,31 @@ static void exynos5_init_pmu(void)
>>  * Enable both SC_FEEDBACK and SC_COUNTER
>>  */
>> for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) {
>> -   regmap_read(pmu_regmap, exynos5_list_both_cnt_feed[i],
>> &tmp);
>> +   regmap_read(pmu_data->pmu_regmap,
>> +   exynos5_list_both_cnt_feed[i], &tmp);
>> tmp |= (EXYNOS5_USE_SC_FEEDBACK |
>> EXYNOS5_USE_SC_COUNTER);
>> -   regmap_write(pmu_regmap, exynos5_list_both_cnt_feed[i],
>> tmp);
>> +   regmap_write(pmu_data->pmu_regmap,
>> +   exynos5_list_both_cnt_feed[i], tmp);
>> }
>>
>> /*
>>  * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
>>  */
>> -   regmap_read(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
>> +   regmap_read(pmu_data->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION,
>> &tmp);
>> tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
>> -   regmap_write(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
>> +   regmap_write(pmu_data->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION,
>> tmp);
>>
>> /*
>>  * Disabl

Re: [PATCH v2 01/10] ARM: EXYNOS: Make exynos machine_ops as static

2014-04-25 Thread Pankaj Dubey
HI Tomasz,

Thanks for review and suggestions.

On Sat, Apr 26, 2014 at 6:05 AM, Tomasz Figa  wrote:
> Hi Pankaj,
>
>
> On 25.04.2014 14:32, Pankaj Dubey wrote:
>>
>> As machine function ops are used only in this file let's make
>> them static.
>>
>> Signed-off-by: Pankaj Dubey 
>> ---
>>   arch/arm/mach-exynos/exynos.c |6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
>> index b32a907..2388ee4 100644
>> --- a/arch/arm/mach-exynos/exynos.c
>> +++ b/arch/arm/mach-exynos/exynos.c
>> @@ -198,7 +198,7 @@ static struct map_desc exynos5_iodesc[] __initdata = {
>> },
>>   };
>>
>> -void exynos_restart(enum reboot_mode mode, const char *cmd)
>> +static void exynos_restart(enum reboot_mode mode, const char *cmd)
>>   {
>> struct device_node *np;
>> u32 val = 0x1;
>> @@ -235,7 +235,7 @@ void __init exynos_cpufreq_init(void)
>> platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
>>   }
>>
>> -void __init exynos_init_late(void)
>> +static void __init exynos_init_late(void)
>>   {
>> if (of_machine_is_compatible("samsung,exynos5440"))
>> /* to be supported later */
>> @@ -296,7 +296,7 @@ static void __init exynos_map_io(void)
>> iotable_init(exynos5250_iodesc,
>> ARRAY_SIZE(exynos5250_iodesc));
>>   }
>>
>> -void __init exynos_init_io(void)
>> +static void __init exynos_init_io(void)
>>   {
>> debug_ll_io_init();
>>
>>
>
> This patch seems to be irrelevant to the rest of this series. Anyway, the
> changes itself are fine, except that I can see more functions that could be
> made static as well:
>  - exynos_cpuidle_init(),
>  - exynos_cpufreq_init().
>
> In fact, they both could be probably eliminated, as they are just oneliners
> doing things that could be done in exynos_dt_machine_init() directly.
>
> So, if you are doing this kind of cleanup, you could do this as well and
> probably also replace platform_device + platform_device_register() with
> platform_device_register_simple() for cpuidle, to reduce line count and make
> it consistent with cpufreq.
>

OK, I will take care of this.
Also will separate these patches from PMU series.

Thanks,
Pankaj Dubey

> Best regards,
> Tomasz
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
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 v2 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-27 Thread Pankaj Dubey

Hi Tomasz,

Thanks for review.

On 04/26/2014 06:43 AM, Tomasz Figa wrote:

Hi,

On 25.04.2014 14:32, Pankaj Dubey wrote:

From: Young-Gun Jang 

Add support for mapping Samsung Power Management Unit (PMU) base address
from device tree. Code will use existing samsung pmu binding information.
This patch also adds two helper functions as "get_exynos_pmuregmap" and
"get_exynos_pmuaddr".
"get_exynos_pmuregmap" returns a regmap based PMU register handle where as
"get_exynos_pmuaddr" returns ioremap virtual address.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/Kconfig  |2 ++
  arch/arm/mach-exynos/common.h |3 ++
  arch/arm/mach-exynos/exynos.c |   78 +
  3 files changed, 83 insertions(+)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fc8bf18..2f60c90 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -26,6 +26,7 @@ config ARCH_EXYNOS4
  select PINCTRL
  select PM_GENERIC_DOMAINS if PM_RUNTIME
  select S5P_DEV_MFC
+select MFD_SYSCON
  help
Samsung EXYNOS4 SoCs based systems

@@ -36,6 +37,7 @@ config ARCH_EXYNOS5
  select HAVE_ARM_SCU if SMP
  select HAVE_SMP
  select PINCTRL
+select MFD_SYSCON
  help
Samsung EXYNOS5 (Cortex-A15) SoC based systems

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 31c5964..ecfd0fc 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -57,4 +57,7 @@ struct exynos_pmu_conf {

  extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);

+extern struct regmap *get_exynos_pmuregmap(void);
+extern void __iomem *get_exynos_pmuaddr(void);


Do you really need these functions? Couldn't all the drivers using PMU simply 
call syscon_regmap_lookup_by_phandle() or of_iomap() directly?


Well, currently "get_exynos_pmuregmap" is used in three location under
mach-exynos as "exynos.c", "pm.c" and "hotplug.c" so just to avoid duplicate 
code
in all these files I added "get_exynos_pmuregmap" as helper function in 
"exynos.c".
So in my opinion it should be fine. What do you say?

Regarding "get_exynos_pmuaddr", only user of this function is "platsmp.c" so I 
can
move this function in platsmp.c and remove this helper. This will also solve the 
other

issue of early mapping as you raised below.




+
  #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index d6f405f..68f60e1 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -19,6 +19,7 @@
  #include 
  #include 
  #include 
+#include 

  #include 
  #include 
@@ -36,6 +37,9 @@
  #define L2_AUX_VAL 0x7C470001
  #define L2_AUX_MASK 0xC200

+static struct regmap *exynos_pmu_regmap;
+static void __iomem *exynos_pmu_base;
+
  static struct map_desc exynos4_iodesc[] __initdata = {
  {
  .virtual= (unsigned long)S3C_VA_SYS,
@@ -269,6 +273,46 @@ static int __init exynos_fdt_map_chipid(unsigned long 
node, const char *uname,

  return 1;
  }

+static const struct of_device_id exynos_dt_pmu_match[] = {
+{ .compatible = "samsung,exynos4210-pmu" },
+{ .compatible = "samsung,exynos4212-pmu" },
+{ .compatible = "samsung,exynos4412-pmu" },
+{ .compatible = "samsung,exynos5250-pmu" },
+{},
+};
+
+static int __init exynos_fdt_map_pmu(unsigned long node,
+const char *uname, int depth, void *data)
+{
+struct map_desc iodesc;
+__be32 *reg;
+unsigned long len;
+phys_addr_t phys_addr;
+const struct of_device_id *matches = exynos_dt_pmu_match;
+
+for (; matches->compatible[0]; matches++) {
+if (!of_flat_dt_is_compatible(node, matches->compatible))
+continue;
+reg = of_get_flat_dt_prop(node, "reg", &len);
+if (reg == NULL || len != (sizeof(unsigned long) * 2))
+return 0;
+
+phys_addr = be32_to_cpu(reg[0]);
+iodesc.pfn = __phys_to_pfn(phys_addr);
+iodesc.length = be32_to_cpu(reg[1]) - 1;
+iodesc.virtual = (unsigned long)S5P_VA_PMU;
+iodesc.type = MT_DEVICE;
+iotable_init(&iodesc, 1);
+
+exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1]));
+if (WARN_ON(!exynos_pmu_base))
+return -EFAULT;
+return 1;
+}
+
+return 0;
+}


Is such early mapping really needed? Couldn't the code using PMU be deferred 
to the stage that memory management is available and then of_iomap() used 
directly?


OK, not really required, If I move mapping of PMU base address to platsmp.c.
As "exynos_pmu_base" is only required in platsmp.c during 
"exynos_smp_prepare_cpus"
function call, I can move mapp

Re: [PATCH v2 1/5] ARM: dts: Add syscon handle in pmu node for exynos5250

2014-04-28 Thread Pankaj Dubey

Hi Tomasz,

On 04/26/2014 05:55 AM, Tomasz Figa wrote:

Hi Pankaj,

On 25.04.2014 13:54, Pankaj Dubey wrote:

Add "samsung,syscon-phandle" property pointing to PMU node
to access PMU register via PMU regmap handle.

Signed-off-by: Pankaj Dubey 
---
  arch/arm/boot/dts/exynos5250.dtsi |1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi

index 3742331..52801af 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -173,6 +173,7 @@
  pmu_system_controller: system-controller@1004 {
  compatible = "samsung,exynos5250-pmu", "syscon";
  reg = <0x1004 0x5000>;
+samsung,syscon-phandle = <&pmu_system_controller>;
  };

  watchdog@101D {



This looks strange. A node that refers back to itself. If I understand 
correctly, you are relying on the fact that if you don't use platform_driver 
model for the PMU driver, it won't bind to this node and instead the generic 
syscon driver will. I'm afraid this is incorrect, because the PMU driver 
should normally use the driver model.


No, let me explain you, property "samsung, syscon-phandle" referring back to 
it's own node
and I am not using platform_driver model for PMU driver are not related with 
each other.


We added "samsung, syscon-phandle" property to PMU node, as current syscon API's 
to get regmap
such as "syscon_regmap_lookup_by_phandle" expects "property_name" to lookup for 
proper device_node
which has regmap. So if we are passing PMU device_node to such API we should 
have that property under

PMU device node. So even though it's looking strange I do not think it's wrong.

But still since, you pointed out I checked syscon APIs carefully and found that 
we can avoid such property
which refers back to itself if we modify syscon APIs and allow them to accept 
"property" parameter as NULL,
assuming that device_node passed itself has regmap handle, following 
modification worked for me and if

it is acceptable I do not need to add such property in PMU device node.

==
struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
 const char *property)
 {
 struct device_node *syscon_np;
 struct regmap *regmap;
-
-syscon_np = of_parse_phandle(np, property, 0);
-if (!syscon_np)
-return ERR_PTR(-ENODEV);
-
-regmap = syscon_node_to_regmap(syscon_np);
-of_node_put(syscon_np);
-
+
+if (property) {
+syscon_np = of_parse_phandle(np, property, 0);
+if (!syscon_np)
+return ERR_PTR(-ENODEV);
+
+regmap = syscon_node_to_regmap(syscon_np);
+of_node_put(syscon_np);
+} else {
+regmap = syscon_node_to_regmap(np);
+}
 return regmap;
 }
=

Other problem as you are seeing that current patch does not uses platform_driver 
model for PMU
is because PMU device node has two compatibility string and "syscon" driver is 
getting registered as
core_initcall, much before PMU registration. So only "syscon" driver's probe is 
getting called. So it does

not depend whether we have this property in PMU device node or we do not have.



I see two possible options to solve this problem:

1) Instead, the PMU driver should bind to this node and become a syscon 
provider. This will require a small change in the syscon API, which would be 
reasonable anyway:


 a) instead of using driver_find_device() and dev_get_drvdata() in 
syscon_node_to_regmap(), a local list of syscon structs should be kept in this 
driver and then the look-up would just iterate over this list, that could 
contain external syscon implementations as well,


 b) syscon_register() function should be provided to register an external 
syscon provider from other drivers, like Exynos PMU driver.


Another solution would be:

2) Register a static platform device from Exynos PMU driver, with .of_node set 
to PMU node and .name to "syscon" to instantiate the syscon device and create 
a syscon provider, even though the PMU driver would be bound to the node.


I do not understand you here. Will you please explain a bit more here?

How come two driver with same ".name" can be registered? I can see if "syscon" 
driver
registration comes first, static registration from PMU driver, with same .name 
will fail.

Please correct me if I am wrong.




The change mentioned in point 1.a) should be implemented regardless of which 
solution is chosen, as iterating over all devices in the system and relying on 
their driver_data is rather a poor practice. A local list would be faster - 
all syscons to iterate over, instead of all devices in the system, and more 
flexible - a single device could be a provider of multiple resources.


Your suggestion 1.a) worked well and 

Re: [RFC PATCH v2 3/3] drivers: mfd: Add support for Exynos PMU driver

2014-04-28 Thread Pankaj Dubey

On 04/28/2014 08:21 PM, Lee Jones wrote:

On Fri, 25 Apr 2014, Pankaj Dubey wrote:


This patch moves Exynos PMU driver implementation from
"arm/mach-exynos" to "drivers/mfd".
This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/Kconfig  |2 +
  arch/arm/mach-exynos/Makefile |2 -
  arch/arm/mach-exynos/pmu.c|  521 -
  drivers/mfd/Kconfig   |9 +
  drivers/mfd/Makefile  |1 +
  drivers/mfd/exynos-pmu.c  |  521 +
  6 files changed, 533 insertions(+), 523 deletions(-)
  delete mode 100644 arch/arm/mach-exynos/pmu.c
  create mode 100644 drivers/mfd/exynos-pmu.c

Same with this patch, `git format-patch -M`.


OK, I will resubmit this series.



--
Best Regards,
Pankaj Dubey

--
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


[RESUBMIT RFC PATCH v2 0/3] Add support for Exynos PMU driver

2014-04-28 Thread Pankaj Dubey
This patch series moves PMU implementation from "mach-exynos/pmu.c" to
"drivers/mfd/exynos-pmu.c". Patch v1 was posted as RFC [1].

In case of ARM32 we had machine folder such as "mach-exynos" but
moving forward with ARM64 SoC support we can not have any more such
machine folders, keeping that in mind we have planned to move PMU
implementation out of machine folder, so that common piece of code
can be reused.

This patch series is based on kgene for-next and depends on following
patch series
 a) [PATCH v2 0/5] Add PMU node for Exynos SoCs
https://lkml.org/lkml/2014/4/25/216
 b) [PATCH v2 00/10] ARM: Exynos: PMU cleanup and refactoring for using DT
https://lkml.org/lkml/2014/4/25/252


1) [RFC PATCH 0/2] Add support for Exynos PMU driver
https://lkml.org/lkml/2014/4/2/69

Changes since v1:
 - Rebased on Kukjin Kim's for-next (3.15_rc1 tag)
 - Added patch: Move PMU specific definitions from common.h
 - Added patch: Move pmu specific header files under "linux/mfd/samsung"
 - Removed patch: ARM: EXYNOS: remove arch specific PMU implementation
As suggested breaking down patches into smalled pieces for better 
review.
Also modified all changes in pmu.c under mach-exynos itself and then
prepared patches moving files from mach-exynos to "drivers/mfd"


Pankaj Dubey (2):
  ARM: EXYNOS: Move pmu specific header files under "linux/mfd/samsung"
  drivers: mfd: Add support for Exynos PMU driver

Younggun Jang (1):
  ARM: EXYNOS: Move PMU specific definitions from common.h

 arch/arm/mach-exynos/Kconfig   |2 ++
 arch/arm/mach-exynos/Makefile  |2 --
 arch/arm/mach-exynos/common.h  |   17 ---
 arch/arm/mach-exynos/cpuidle.c |3 +-
 arch/arm/mach-exynos/exynos.c  |2 +-
 arch/arm/mach-exynos/hotplug.c |2 +-
 arch/arm/mach-exynos/platsmp.c |2 +-
 arch/arm/mach-exynos/pm.c  |3 +-
 drivers/mfd/Kconfig|9 ++
 drivers/mfd/Makefile   |1 +
 .../mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c  |5 ++--
 include/linux/mfd/samsung/exynos-pmu.h |   31 
 .../linux/mfd/samsung/exynos-regs-pmu.h|0
 13 files changed, 52 insertions(+), 27 deletions(-)
 rename arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c (99%)
 create mode 100644 include/linux/mfd/samsung/exynos-pmu.h
 rename arch/arm/mach-exynos/regs-pmu.h => 
include/linux/mfd/samsung/exynos-regs-pmu.h (100%)

-- 
1.7.10.4

--
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


[RESUBMIT RFC PATCH v2 2/3] ARM: EXYNOS: Move pmu specific header files under "linux/mfd/samsung"

2014-04-28 Thread Pankaj Dubey
Moving Exynos PMU specific header file into "include/linux/mfd/samsung"
thus updated affected files under "mach-exynos" to use new location of
these header files.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/cpuidle.c|4 ++--
 arch/arm/mach-exynos/exynos.c |2 +-
 arch/arm/mach-exynos/hotplug.c|2 +-
 arch/arm/mach-exynos/platsmp.c|2 +-
 arch/arm/mach-exynos/pm.c |4 ++--
 arch/arm/mach-exynos/pmu.c|5 ++---
 {arch/arm/mach-exynos => include/linux/mfd/samsung}/exynos-pmu.h  |0
 .../regs-pmu.h => include/linux/mfd/samsung/exynos-regs-pmu.h |0
 8 files changed, 9 insertions(+), 10 deletions(-)
 rename {arch/arm/mach-exynos => include/linux/mfd/samsung}/exynos-pmu.h (100%)
 rename arch/arm/mach-exynos/regs-pmu.h => 
include/linux/mfd/samsung/exynos-regs-pmu.h (100%)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index ff3be9c..4c18087 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -31,8 +33,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
-#include "exynos-pmu.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b01987e..24c774a 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -32,7 +33,6 @@
 
 #include "common.h"
 #include "mfc.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 7831e64..1d3ad84 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -22,7 +23,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 static inline void cpu_enter_lowpower_a9(void)
 {
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 3831e6c..54c0df8 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -29,7 +30,6 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 
 extern void exynos4_secondary_startup(void);
 static void __iomem *pmu_base;
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 103ab92..3e75565 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -35,9 +37,7 @@
 #include 
 
 #include "common.h"
-#include "regs-pmu.h"
 #include "regs-sys.h"
-#include "exynos-pmu.h"
 
 static struct regmap *pmu_regmap;
 
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index d020557..a26332f 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -15,9 +15,8 @@
 #include 
 #include 
 #include 
-
-#include "exynos-pmu.h"
-#include "regs-pmu.h"
+#include 
+#include 
 
 enum exynos_pmu_id {
PMU_EXYNOS4210,
diff --git a/arch/arm/mach-exynos/exynos-pmu.h 
b/include/linux/mfd/samsung/exynos-pmu.h
similarity index 100%
rename from arch/arm/mach-exynos/exynos-pmu.h
rename to include/linux/mfd/samsung/exynos-pmu.h
diff --git a/arch/arm/mach-exynos/regs-pmu.h 
b/include/linux/mfd/samsung/exynos-regs-pmu.h
similarity index 100%
rename from arch/arm/mach-exynos/regs-pmu.h
rename to include/linux/mfd/samsung/exynos-regs-pmu.h
-- 
1.7.10.4

--
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


[RESUBMIT RFC PATCH v2 1/3] ARM: EXYNOS: Move PMU specific definitions from common.h

2014-04-28 Thread Pankaj Dubey
From: Younggun Jang 

This patch moves PMU specific definitions into a new file
as exynos-pmu.h. This will help in making PMU implementation
independent of common.h header.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |   17 -
 arch/arm/mach-exynos/cpuidle.c|1 +
 arch/arm/mach-exynos/exynos-pmu.h |   31 +++
 arch/arm/mach-exynos/pm.c |1 +
 arch/arm/mach-exynos/pmu.c|2 +-
 5 files changed, 34 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/mach-exynos/exynos-pmu.h

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ad5128e..d848ede 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -38,24 +38,7 @@ extern struct smp_operations exynos_smp_ops;
 
 extern void exynos_cpu_die(unsigned int cpu);
 
-/* PMU(Power Management Unit) support */
-
-#define PMU_TABLE_END  0x
-
-enum sys_powerdown {
-   SYS_AFTR,
-   SYS_LPA,
-   SYS_SLEEP,
-   NUM_SYS_POWERDOWN,
-};
-
 extern unsigned long l2x0_regs_phys;
-struct exynos_pmu_conf {
-   unsigned int offset;
-   unsigned int val[NUM_SYS_POWERDOWN];
-};
-
-extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 
 extern struct regmap *get_exynos_pmuregmap(void);
 extern void __iomem *get_exynos_pmuaddr(void);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 5dcdd46..ff3be9c 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -32,6 +32,7 @@
 
 #include "common.h"
 #include "regs-pmu.h"
+#include "exynos-pmu.h"
 
 #define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
diff --git a/arch/arm/mach-exynos/exynos-pmu.h 
b/arch/arm/mach-exynos/exynos-pmu.h
new file mode 100644
index 000..1cc857b
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-pmu.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Header for EXYNOS PMU Driver support
+ *
+ * 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.
+ */
+
+#ifndef __EXYNOS_PMU_H
+#define __EXYNOS_PMU_H
+
+#define PMU_TABLE_END  0x
+
+enum sys_powerdown {
+   SYS_AFTR,
+   SYS_LPA,
+   SYS_SLEEP,
+   NUM_SYS_POWERDOWN,
+};
+
+struct exynos_pmu_conf {
+   unsigned int offset;
+   unsigned int val[NUM_SYS_POWERDOWN];
+};
+
+extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
+
+#endif /* __EXYNOS_PMU_H */
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e4c10d4..103ab92 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -37,6 +37,7 @@
 #include "common.h"
 #include "regs-pmu.h"
 #include "regs-sys.h"
+#include "exynos-pmu.h"
 
 static struct regmap *pmu_regmap;
 
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index abcf753..d020557 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 
-#include "common.h"
+#include "exynos-pmu.h"
 #include "regs-pmu.h"
 
 enum exynos_pmu_id {
-- 
1.7.10.4

--
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


[RESUBMIT RFC PATCH v2 3/3] drivers: mfd: Add support for Exynos PMU driver

2014-04-28 Thread Pankaj Dubey
This patch moves Exynos PMU driver implementation from
"arm/mach-exynos" to "drivers/mfd".
This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/Kconfig   |2 ++
 arch/arm/mach-exynos/Makefile  |2 --
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c |0
 5 files changed, 12 insertions(+), 2 deletions(-)
 rename arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c (100%)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2f60c90..79559b4 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -27,6 +27,7 @@ config ARCH_EXYNOS4
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS4 SoCs based systems
 
@@ -38,6 +39,7 @@ config ARCH_EXYNOS5
select HAVE_SMP
select PINCTRL
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index a656dbe..19fdf17 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -18,8 +18,6 @@ obj-$(CONFIG_PM_SLEEP)+= pm.o sleep.o
 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
 
-obj-$(CONFIG_ARCH_EXYNOS)  += pmu.o
-
 obj-$(CONFIG_SMP)  += platsmp.o headsmp.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 3383412..fd48870 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1203,6 +1203,15 @@ config MFD_STW481X
  in various ST Microelectronics and ST-Ericsson embedded
  Nomadik series.
 
+config MFD_EXYNOS_PMU
+   tristate "Support Exynos Power Managment Unit"
+   depends on ARM || ARM64
+   help
+   Exynos SoC have Power Management Unit (PMU) which controls power and
+   operation state of Exynos SoC in two different ways. This driver
+   provides impmentation of PMU driver and provides basic functionality
+   required during these operation state.
+
 menu "Multimedia Capabilities Port drivers"
depends on ARCH_SA1100
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2851275..7c43d07 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -166,3 +166,4 @@ obj-$(CONFIG_MFD_RETU)  += retu-mfd.o
 obj-$(CONFIG_MFD_AS3711)   += as3711.o
 obj-$(CONFIG_MFD_AS3722)   += as3722.o
 obj-$(CONFIG_MFD_STW481X)  += stw481x.o
+obj-$(CONFIG_MFD_EXYNOS_PMU)   += exynos-pmu.o
diff --git a/arch/arm/mach-exynos/pmu.c b/drivers/mfd/exynos-pmu.c
similarity index 100%
rename from arch/arm/mach-exynos/pmu.c
rename to drivers/mfd/exynos-pmu.c
-- 
1.7.10.4

--
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: [RESUBMIT RFC PATCH v2 3/3] drivers: mfd: Add support for Exynos PMU driver

2014-04-29 Thread Pankaj Dubey

On 04/28/2014 09:26 PM, Lee Jones wrote:

This patch moves Exynos PMU driver implementation from
"arm/mach-exynos" to "drivers/mfd".
This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/Kconfig   |2 ++
  arch/arm/mach-exynos/Makefile  |2 --
  drivers/mfd/Kconfig|9 +
  drivers/mfd/Makefile   |1 +
  arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c |0
  5 files changed, 12 insertions(+), 2 deletions(-)
  rename arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c (100%)

So I just took a look at the code as zero changes looks suspicious to
me. The driver can not simply be copied and pasted into the MFD
subsystem in its current state.

The fundamental question is; is this chip actually an MFD? What does
it do besides Power Management?


Exynos PMU chip controls different power states of Exynos, so mainly it
does power management related stuff. Apart from this it has few registers
which controls PHY of various IP blocks of Exynos such as USB, HDMI,
ADC etc. But these phy controlling register are currently being accessed
via "syscon" driver provided regmap APIs. For same the same reason
Exynos PMU has second compatibility string as "syscon".


diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2f60c90..79559b4 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -27,6 +27,7 @@ config ARCH_EXYNOS4
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS4 SoCs based systems
  
@@ -38,6 +39,7 @@ config ARCH_EXYNOS5

select HAVE_SMP
select PINCTRL
select MFD_SYSCON
+   select MFD_EXYNOS_PMU
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
  
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile

index a656dbe..19fdf17 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -18,8 +18,6 @@ obj-$(CONFIG_PM_SLEEP)+= pm.o sleep.o
  obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
  obj-$(CONFIG_CPU_IDLE)+= cpuidle.o
  
-obj-$(CONFIG_ARCH_EXYNOS)	+= pmu.o

-
  obj-$(CONFIG_SMP) += platsmp.o headsmp.o
  
  obj-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 3383412..fd48870 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1203,6 +1203,15 @@ config MFD_STW481X
  in various ST Microelectronics and ST-Ericsson embedded
  Nomadik series.
  
+config MFD_EXYNOS_PMU

+   tristate "Support Exynos Power Managment Unit"
+   depends on ARM || ARM64
+   help
+   Exynos SoC have Power Management Unit (PMU) which controls power and
+   operation state of Exynos SoC in two different ways. This driver
+   provides impmentation of PMU driver and provides basic functionality
+   required during these operation state.
+
  menu "Multimedia Capabilities Port drivers"
depends on ARCH_SA1100
  
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile

index 2851275..7c43d07 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -166,3 +166,4 @@ obj-$(CONFIG_MFD_RETU)  += retu-mfd.o
  obj-$(CONFIG_MFD_AS3711)  += as3711.o
  obj-$(CONFIG_MFD_AS3722)  += as3722.o
  obj-$(CONFIG_MFD_STW481X) += stw481x.o
+obj-$(CONFIG_MFD_EXYNOS_PMU)   += exynos-pmu.o
diff --git a/arch/arm/mach-exynos/pmu.c b/drivers/mfd/exynos-pmu.c
similarity index 100%
rename from arch/arm/mach-exynos/pmu.c
rename to drivers/mfd/exynos-pmu.c



--
Best Regards,
Pankaj Dubey

--
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: [RESUBMIT RFC PATCH v2 3/3] drivers: mfd: Add support for Exynos PMU driver

2014-04-29 Thread Pankaj Dubey

On 04/29/2014 02:37 AM, Catalin Marinas wrote:

On Mon, Apr 28, 2014 at 01:26:46PM +0100, Lee Jones wrote:

This patch moves Exynos PMU driver implementation from
"arm/mach-exynos" to "drivers/mfd".
This driver is mainly used for setting misc bits of register from PMU IP
of Exynos SoC which will be required to configure before Suspend/Resume.
Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but
moving ahead for ARM64 based SoC support, there is a need of DT based
implementation of PMU driver.
This driver uses already existing DT binding information.

CC: Sangbeom Kim 
CC: Samuel Ortiz 
CC: Lee Jones 
Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/Kconfig   |2 ++
  arch/arm/mach-exynos/Makefile  |2 --
  drivers/mfd/Kconfig|9 +
  drivers/mfd/Makefile   |1 +
  arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c |0
  5 files changed, 12 insertions(+), 2 deletions(-)
  rename arch/arm/mach-exynos/pmu.c => drivers/mfd/exynos-pmu.c (100%)

So I just took a look at the code as zero changes looks suspicious to
me. The driver can not simply be copied and pasted into the MFD
subsystem in its current state.

The fundamental question is; is this chip actually an MFD? What does
it do besides Power Management?

I looked at the code briefly as well and I don't think it matches the
mfd idea. Maybe it could be merged together with
arch/arm/mach-exynos/pm.c and moved to drivers/power/ or a more
appropriate directory for platform_suspend_ops.


Well I was also not quite sure about if "drivers/mfd" is proper place
for Exynos PMU, so I posted this patch as RFC.

If it does not seems matching with "drivers/mfd" idea, will it be suitable
for "drivers/power/" or should I go for something like "drivers/soc/samsung"?

Regarding your second point about merging this code with "mach-exynos/pm.c"
We have plan for this but, I would like to get it done via a separate patch 
series

as "mach-exynos/pm.c" has a lot of dependencies and requires significant
modifications. So this work can be treated as a first step towards that 
direction.


--
Best Regards,
Pankaj Dubey

--
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 v3 01/12] ARM: EXYNOS: Make exynos machine_ops as static

2014-04-29 Thread Pankaj Dubey
As machine function ops are used only in this file let's make
them static.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 3d69e8d..06dcce5 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -198,7 +198,7 @@ static struct map_desc exynos5_iodesc[] __initdata = {
},
 };
 
-void exynos_restart(enum reboot_mode mode, const char *cmd)
+static void exynos_restart(enum reboot_mode mode, const char *cmd)
 {
struct device_node *np;
u32 val = 0x1;
@@ -239,7 +239,7 @@ void __init exynos_cpufreq_init(void)
platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
 }
 
-void __init exynos_init_late(void)
+static void __init exynos_init_late(void)
 {
if (of_machine_is_compatible("samsung,exynos5440"))
/* to be supported later */
@@ -300,7 +300,7 @@ static void __init exynos_map_io(void)
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
-void __init exynos_init_io(void)
+static void __init exynos_init_io(void)
 {
debug_ll_io_init();
 
-- 
1.7.10.4

--
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 v3 04/12] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file.

2014-04-29 Thread Pankaj Dubey
From: Young-Gun Jang 

While making PMU implementation to be device tree based, there are
few register offsets related with SYSREG present in regs-pmu.h, so
let's make a new header file "regs-sys.h" to keep all such SYSREG
related register offsets and remove them from "regs-pmu.h"

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
Reviewed-by: Tomasz Figa 
---
 arch/arm/mach-exynos/exynos.c   |1 +
 arch/arm/mach-exynos/pm.c   |1 +
 arch/arm/mach-exynos/regs-pmu.h |3 ---
 arch/arm/mach-exynos/regs-sys.h |   22 ++
 4 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-exynos/regs-sys.h

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 9315bd8..a7b45db 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -31,6 +31,7 @@
 #include "common.h"
 #include "mfc.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index b380d48..f445c49 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -36,6 +36,7 @@
 
 #include "common.h"
 #include "regs-pmu.h"
+#include "regs-sys.h"
 
 /**
  * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 6c1d2db..b68b5cc 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -15,7 +15,6 @@
 #include 
 
 #define S5P_PMUREG(x)  (S5P_VA_PMU + (x))
-#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
 
 #define S5P_CENTRAL_SEQ_CONFIGURATION  S5P_PMUREG(0x0200)
 
@@ -178,8 +177,6 @@
 
 /* For EXYNOS5 */
 
-#define EXYNOS5_SYS_I2C_CFG
S5P_SYSREG(0x0234)
-
 #define EXYNOS5_AUTO_WDTRESET_DISABLE  
S5P_PMUREG(0x0408)
 #define EXYNOS5_MASK_WDTRESET_REQUEST  
S5P_PMUREG(0x040C)
 
diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h
new file mode 100644
index 000..84332b0
--- /dev/null
+++ b/arch/arm/mach-exynos/regs-sys.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * EXYNOS - system register definition
+ *
+ * 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.
+*/
+
+#ifndef __ASM_ARCH_REGS_SYS_H
+#define __ASM_ARCH_REGS_SYS_H __FILE__
+
+#include 
+
+#define S5P_SYSREG(x)  (S3C_VA_SYS + (x))
+
+/* For EXYNOS5 */
+#define EXYNOS5_SYS_I2C_CFGS5P_SYSREG(0x0234)
+
+#endif /* __ASM_ARCH_REGS_SYS_H */
-- 
1.7.10.4

--
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 v3 08/12] ARM: EXYNOS: Remove "linux/bug.h" from pmu.c

2014-04-29 Thread Pankaj Dubey
This patch removes unnecessary header file inclusion from pmu.c.

Signed-off-by: Young-Gun Jang 
Reviewed-by: Tomasz Figa 
---
 arch/arm/mach-exynos/pmu.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce1..4c3453a 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -11,7 +11,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
-- 
1.7.10.4

--
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 v3 12/12] ARM: EXYNOS: Move PMU specific definitions from common.h

2014-04-29 Thread Pankaj Dubey
From: Young-Gun Jang 

This patch moves PMU specific definitions into a new file
as exynos-pmu.h. This will help in making PMU implementation
independent of common.h header.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |   17 -
 arch/arm/mach-exynos/exynos-pmu.h |   31 +++
 arch/arm/mach-exynos/pm.c |1 +
 arch/arm/mach-exynos/pmu.c|2 +-
 4 files changed, 33 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/mach-exynos/exynos-pmu.h

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 2922f20..8f45a35 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -35,24 +35,7 @@ extern struct smp_operations exynos_smp_ops;
 
 extern void exynos_cpu_die(unsigned int cpu);
 
-/* PMU(Power Management Unit) support */
-
-#define PMU_TABLE_END  (-1U)
-
-enum sys_powerdown {
-   SYS_AFTR,
-   SYS_LPA,
-   SYS_SLEEP,
-   NUM_SYS_POWERDOWN,
-};
-
 extern unsigned long l2x0_regs_phys;
-struct exynos_pmu_conf {
-   unsigned int offset;
-   unsigned int val[NUM_SYS_POWERDOWN];
-};
-
-extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 extern void exynos_enter_aftr(void);
 
 extern struct regmap *get_exynos_pmuregmap(void);
diff --git a/arch/arm/mach-exynos/exynos-pmu.h 
b/arch/arm/mach-exynos/exynos-pmu.h
new file mode 100644
index 000..16ff036
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-pmu.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Header for EXYNOS PMU Driver support
+ *
+ * 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.
+ */
+
+#ifndef __EXYNOS_PMU_H
+#define __EXYNOS_PMU_H
+
+#define PMU_TABLE_END  (-1U)
+
+enum sys_powerdown {
+   SYS_AFTR,
+   SYS_LPA,
+   SYS_SLEEP,
+   NUM_SYS_POWERDOWN,
+};
+
+struct exynos_pmu_conf {
+   unsigned int offset;
+   unsigned int val[NUM_SYS_POWERDOWN];
+};
+
+extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
+
+#endif /* __EXYNOS_PMU_H */
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index ee427d7..a7a1b7f 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -38,6 +38,7 @@
 #include "common.h"
 #include "regs-pmu.h"
 #include "regs-sys.h"
+#include "exynos-pmu.h"
 
 static struct regmap *pmu_regmap;
 
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 030df96..1570761 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 
-#include "common.h"
+#include "exynos-pmu.h"
 #include "regs-pmu.h"
 
 struct exynos_pmu_data {
-- 
1.7.10.4

--
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 v3 05/12] ARM: EXYNOS: Remove file path from comment section

2014-04-29 Thread Pankaj Dubey
Many files under "arm/mach-exynos" are having file path in file
comment section which is invalid now.
So for better code maintainability let's remove them.

Signed-off-by: Pankaj Dubey 
Reviewed-by: Tomasz Figa 
---
 arch/arm/mach-exynos/headsmp.S |2 --
 arch/arm/mach-exynos/hotplug.c |3 +--
 arch/arm/mach-exynos/include/mach/memory.h |3 +--
 arch/arm/mach-exynos/platsmp.c |3 +--
 4 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S
index cdd9d91..698c57f 100644
--- a/arch/arm/mach-exynos/headsmp.S
+++ b/arch/arm/mach-exynos/headsmp.S
@@ -1,6 +1,4 @@
 /*
- *  linux/arch/arm/mach-exynos4/headsmp.S
- *
  *  Cloned from linux/arch/arm/mach-realview/headsmp.S
  *
  *  Copyright (c) 2003 ARM Limited
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead53..73b0b5c 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -1,5 +1,4 @@
-/* linux arch/arm/mach-exynos4/hotplug.c
- *
+/*
  *  Cloned from linux/arch/arm/mach-realview/hotplug.c
  *
  *  Copyright (C) 2002 ARM Ltd.
diff --git a/arch/arm/mach-exynos/include/mach/memory.h 
b/arch/arm/mach-exynos/include/mach/memory.h
index 2a4cdb7..e19df1f 100644
--- a/arch/arm/mach-exynos/include/mach/memory.h
+++ b/arch/arm/mach-exynos/include/mach/memory.h
@@ -1,5 +1,4 @@
-/* linux/arch/arm/mach-exynos4/include/mach/memory.h
- *
+/*
  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
  *
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 03e5e9f..29c2286 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -1,5 +1,4 @@
-/* linux/arch/arm/mach-exynos4/platsmp.c
- *
+/*
  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
  *
-- 
1.7.10.4

--
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 v3 03/12] ARM: EXYNOS: Cleanup "mach-exynos/common.h" file

2014-04-29 Thread Pankaj Dubey
Remove unused and unwanted declarations from "mach-exynos/common.h"

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h |9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 30123a0..8a4aa0b 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,15 +15,6 @@
 #include 
 #include 
 
-void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-
-struct map_desc;
-void exynos_init_io(void);
-void exynos_restart(enum reboot_mode mode, const char *cmd);
-void exynos_cpuidle_init(void);
-void exynos_cpufreq_init(void);
-void exynos_init_late(void);
-
 void exynos_firmware_init(void);
 
 #ifdef CONFIG_PINCTRL_EXYNOS
-- 
1.7.10.4

--
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 v3 02/12] ARM: EXYNOS: Move cpufreq and cpuidle device registration to init_machine

2014-04-29 Thread Pankaj Dubey
As exynos_cpuidle_init and exynos_cpufreq_init function have just one lines
of code for registering platform devices. We can move these lines to
exynos_dt_machine_init and delete exynos_cpuidle_init and exynos_cpufreq_init
function. This will help in reducing lines of code in exynos.c, making it
more cleaner.

Suggested-by: Tomasz Figa 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c |   19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 06dcce5..9315bd8 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -226,19 +226,6 @@ static struct platform_device exynos_cpuidle = {
.id= -1,
 };
 
-void __init exynos_cpuidle_init(void)
-{
-   if (soc_is_exynos5440())
-   return;
-
-   platform_device_register(&exynos_cpuidle);
-}
-
-void __init exynos_cpufreq_init(void)
-{
-   platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
-}
-
 static void __init exynos_init_late(void)
 {
if (of_machine_is_compatible("samsung,exynos5440"))
@@ -367,8 +354,10 @@ static void __init exynos_dt_machine_init(void)
}
}
 
-   exynos_cpuidle_init();
-   exynos_cpufreq_init();
+   if (!soc_is_exynos5440())
+   platform_device_register(&exynos_cpuidle);
+
+   platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
 
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
-- 
1.7.10.4

--
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 v3 11/12] ARM: EXYNOS: Add platform driver support for Exynos PMU.

2014-04-29 Thread Pankaj Dubey
This patch modifies Exynos Power Management Unit (PMU) initialization
implementation in following way:

- Added platform_device support by registering static platform device.
- Added platform struct exynos_pmu_data to hold platform specific data.
- For each SoC's PMU support now we can add platform data and statically
  bind PMU configuration and SoC specific initialization function.
- Probe function will scan DT and based on matching PMU compatibility
  string initialize pmu_context which will be platform_data for driver.
- Obtain PMU regmap handle using "syscon_regmap_lookup_by_phandle" so
  that we can reduce dependency over machine header files.
- Separate each SoC's PMU initialization function and make it as part of
  platform data.
- It also removes uses of soc_is_exynos() thus making PMU implementation
  independent of "plat/cpu.h".

Signed-off-by: Pankaj Dubey 
Signed-off-by: Young-Gun Jang 
---
 arch/arm/mach-exynos/pmu.c |  280 +++-
 1 file changed, 224 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 67116a5..030df96 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
  * http://www.samsung.com/
  *
  * EXYNOS - CPU PMU(Power Management Unit) support
@@ -9,20 +9,33 @@
  * published by the Free Software Foundation.
  */
 
-#include 
-#include 
+#include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "common.h"
 #include "regs-pmu.h"
 
-static const struct exynos_pmu_conf *exynos_pmu_config;
-static struct regmap *pmu_regmap;
+struct exynos_pmu_data {
+   const struct exynos_pmu_conf *pmu_config;
+   const struct exynos_pmu_conf *pmu_config_extra;
+   void (*pmu_init)(void);
+   void (*powerdown_conf)(enum sys_powerdown);
+};
+
+struct exynos_pmu_context {
+   struct device *dev;
+   struct exynos_pmu_data *pmu_data;
+   struct regmap   *pmu_regmap;
+};
+
+static struct exynos_pmu_context   *pmu_context;
 
 static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
+   /* { .offset = address, .val = { AFTR, LPA, SLEEP } */
{ S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
{ S5P_DIS_IRQ_CORE0,{ 0x0, 0x0, 0x0 } },
{ S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
@@ -216,7 +229,7 @@ static const struct exynos_pmu_conf exynos4412_pmu_config[] 
= {
 };
 
 static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
+   /* { .offset = address, .val = { AFTR, LPA, SLEEP } */
{ EXYNOS5_ARM_CORE0_SYS_PWR_REG,{ 0x0, 0x0, 0x2} },
{ EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG,  { 0x0, 0x0, 0x0} },
{ EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG,{ 0x0, 0x0, 
0x0} },
@@ -339,7 +352,7 @@ static unsigned int const exynos5_list_diable_wfi_wfe[] = {
EXYNOS5_ISP_ARM_OPTION,
 };
 
-static void exynos5_init_pmu(void)
+void exynos5_powerdown_conf(enum sys_powerdown mode)
 {
unsigned int i;
unsigned int tmp;
@@ -348,81 +361,236 @@ static void exynos5_init_pmu(void)
 * Enable both SC_FEEDBACK and SC_COUNTER
 */
for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) {
-   regmap_read(pmu_regmap, exynos5_list_both_cnt_feed[i], &tmp);
+   regmap_read(pmu_context->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], &tmp);
tmp |= (EXYNOS5_USE_SC_FEEDBACK |
EXYNOS5_USE_SC_COUNTER);
-   regmap_write(pmu_regmap, exynos5_list_both_cnt_feed[i], tmp);
+   regmap_write(pmu_context->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], tmp);
}
 
/*
 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
 */
-   regmap_read(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
+   regmap_read(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
-   regmap_write(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
+   regmap_write(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
 
/*
 * Disable WFI/WFE on XXX_OPTION
 */
for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) {
-   tmp = regmap_read(pmu_regmap, exynos5_list_diable_wfi_wfe[i],
-   &tmp);
+   tmp = regmap_read(pmu_context->pmu_regmap,
+   exynos5_list_diable_wfi_wfe[i], &tmp);

[PATCH v3 10/12] ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c

2014-04-29 Thread Pankaj Dubey
As we have removed static mappings from "regs-pmu.h" it does not
need map.h anymore. But "platsmp.c" needed this and till now it
got included indirectly. So lets move header inclusion of
"mach/map.h" from "regs-pmu.h" to "platsmp.c".

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/platsmp.c  |1 +
 arch/arm/mach-exynos/regs-pmu.h |2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 375ea4e..8f3b866 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 
 #include "common.h"
 #include "regs-pmu.h"
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index a72b1bc..1d83c7e 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -12,8 +12,6 @@
 #ifndef __ASM_ARCH_REGS_PMU_H
 #define __ASM_ARCH_REGS_PMU_H __FILE__
 
-#include 
-
 #define S5P_CENTRAL_SEQ_CONFIGURATION  0x0200
 
 #define S5P_CENTRAL_LOWPWR_CFG (1 << 16)
-- 
1.7.10.4

--
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 v3 00/12] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-04-29 Thread Pankaj Dubey
This patch series, does some minor cleanup of exynos machine files.
It also modifies Exynos Power Management Unit (PMU) related code for
converting it into a platform_driver.
This is also preparation for moving PMU related code out of machine
folder into a either "drivers/mfd", or "drivers/power" or some other
suitable place so that ARM64 based SoC can utilize common piece of code.
These patches require change in Exynos SoC dtsi files, which has been
posted as separate patch series [2]

These patches are created on top of Kukjin Kim's for-next (v3.15-rc1 tag)
branch and on top of Daniel Lezcano's Exynos cpuidle refactor patches [3].

These patches depends on following three patch series:
[1] mfd: syscon: Support early initialization
https://lkml.org/lkml/2014/4/8/239
[2] Add PMU node for Exynos SoCs
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg29329.html
[3] http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085  

We have tested these patches on SMDK5250 board for System boot and
Arndale (Exynos5250) board for System boot and PMU initialization and S2R.

For testing on Arndale (Exynos5250) board:
Tested-by: Pankaj Dubey 

Changes Since v2:
 - Rebased on top of Daniel Lezcano's Exynos cpuidle refactor patches.
 - Removed exynos_cpuidle_init and exynos_cpufreq_init code as suggested
   by Tomasz Figa.
 - Removed early mapping of PMU base address from exynos.c and removed
   "get_exynos_pmuaddr" function. Instead of this added code in platsmp.c
   to get PMU base address using of_iomap as suggested by Tomasz Figa.
 - Converted PMU implementation into platform_driver by using static
   platform_device method. 

Changes Since v1:
 - Rebased on latest for-next of Kukjin Kim's tree.
 - Added patch: "Make exynos machine_ops as static". 
For making more cleanup in "mach-exynos/common.h"
as suggested by Tomasz Figa.
 - Addressed comments of Tomasz Figa for cleaning "mach-exynos/common.h".
 - Updated patch: Remove file path from comment section
As suggested by Michel Simek, instead of updating file path
lets remove them from each file under "mach-exynos".
Even though Kukjin pointed out that there is similar patch pending from
Sachin/Tushar but since I could not find I have included this here. If
I have missed something please point to any existing such patch.
 - Updated patch: Add support for mapping PMU base address via DT
- Removed __initdata from declaration of "exynos_pmu_base", as it caused
kernel crash as pointed out by Vikas Sajjan.
- Added support for Syscon initialization and getting PMU regmap handle
as suggested by Sylwester. Since current implementation of early
intialization [1] has limitation that "early_syscon_init" requires
DT to be unflattened and system should be able to allocate memory,
we can't use regmap handles for platsmp.c file as "smp_secondary_init"
will be called before DT unflattening. So I have kept both method for
accessing PMU base address. platsmp.c will use ioremmaped address where
as rest other files can use regmap handle.
 - Added patch: Remove "linux/bug.h" from pmu.c.
 - Updated patch: Refactored code for PMU register mapping via DT
- Modified to use regmap_read/write when using regmap handle.
 - Added patch: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
 - Added patch: Add device tree based initialization support for PMU.
- Convert existing PMU implementation to be a device tree based 
 before moving it to "drivers/mfd" folder. As suggested by Bartlomiej.
- Dropped making a platform_driver for PMU, as currently PMU binding
has two compatibility strings as "samsung, exynosxxx-pmu", "syscon",
once we enable MFD_SYSCON config option, current "syscon" driver probe
gets called and PMU probe never gets called. So modified PMU
initialization code to scan DT and match against supported compatiblity
string in driver code, and once we get matching node use that for
accessing PMU regmap handle using 
"syscon_early_regmap_lookup_by_phandle".
If there is any better solution please suggest.

Pankaj Dubey (8):
  ARM: EXYNOS: Make exynos machine_ops as static
  ARM: EXYNOS: Move cpufreq and cpuidle device registration to
init_machine
  ARM: EXYNOS: Cleanup "mach-exynos/common.h" file
  ARM: EXYNOS: Remove file path from comment section
  ARM: EXYNOS: Remove "linux/bug.h" from pmu.c
  ARM: EXYNOS: Refactored code for using PMU address via DT
  ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
  ARM: EXYNOS: Add platform driver support for Exynos PMU.

Young-Gun Jang (4):
  ARM: EXYNOS:

[PATCH v3 06/12] ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain

2014-04-29 Thread Pankaj Dubey
From: Young-Gun Jang 

Current "pm_domain.c" file uses "S5P_INT_LOCAL_PWR_EN" definition from
"regs-pmu.h" and hence needs to include this header file. As there is
no other user of "S5P_INT_LOCAL_PWR_EN" definition other than pm_domain,
to remove "regs-pmu.h" header file dependency from "pm_domain.c"  it's
better we define this definition in "pm_domain.c" file itself and thus it
will help in removing header file inclusion from "pm_domain.c".
Also removing "S5P_" prefix from macro.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
Reviewed-by: Tomasz Figa 
---
 arch/arm/mach-exynos/pm_domains.c |8 
 arch/arm/mach-exynos/regs-pmu.h   |1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c 
b/arch/arm/mach-exynos/pm_domains.c
index fe6570e..e45d288 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include "regs-pmu.h"
+#define INT_LOCAL_PWR_EN   0x7
 
 /*
  * Exynos specific wrapper around the generic power domain
@@ -44,13 +44,13 @@ static int exynos_pd_power(struct generic_pm_domain 
*domain, bool power_on)
pd = container_of(domain, struct exynos_pm_domain, pd);
base = pd->base;
 
-   pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0;
+   pwr = power_on ? INT_LOCAL_PWR_EN : 0;
__raw_writel(pwr, base);
 
/* Wait max 1ms */
timeout = 10;
 
-   while ((__raw_readl(base + 0x4) & S5P_INT_LOCAL_PWR_EN) != pwr) {
+   while ((__raw_readl(base + 0x4) & INT_LOCAL_PWR_EN) != pwr) {
if (!timeout) {
op = (power_on) ? "enable" : "disable";
pr_err("Power domain %s %s failed\n", domain->name, op);
@@ -172,7 +172,7 @@ static __init int exynos4_pm_init_power_domain(void)
 
platform_set_drvdata(pdev, pd);
 
-   on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+   on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN;
 
pm_genpd_init(&pd->pd, NULL, !on);
}
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index b68b5cc..fd8a19d 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -116,7 +116,6 @@
 #define S5P_PAD_RET_EBIB_OPTIONS5P_PMUREG(0x31A8)
 
 #define S5P_CORE_LOCAL_PWR_EN  0x3
-#define S5P_INT_LOCAL_PWR_EN   0x7
 
 /* Only for EXYNOS4210 */
 #define S5P_CMU_CLKSTOP_LCD1_LOWPWRS5P_PMUREG(0x1154)
-- 
1.7.10.4

--
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 v3 09/12] ARM: EXYNOS: Refactored code for using PMU address via DT

2014-04-29 Thread Pankaj Dubey
Under "arm/mach-exynos" many files are using PMU register offsets.
Since we have added support for accessing PMU base address via DT,
now we can remove PMU mapping from exynosX_iodesc. Let's convert
all these access using either of iomapped address or regmap handle.
This will help us in removing static mapping of PMU base address
as well as help in reducing dependency over machine header files.
Thus helping for migration of PMU implementation from machine to
driver folder which can be reused for ARM64 bsed SoC.

CC: Ben Dooks 
CC: Kyungmin Park 
CC: Arnd Bergmann 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/common.h|4 +-
 arch/arm/mach-exynos/exynos.c|   19 +-
 arch/arm/mach-exynos/hotplug.c   |4 +-
 arch/arm/mach-exynos/include/mach/map.h  |3 -
 arch/arm/mach-exynos/platsmp.c   |   38 +-
 arch/arm/mach-exynos/pm.c|   77 ++--
 arch/arm/mach-exynos/pmu.c   |   40 +-
 arch/arm/mach-exynos/regs-pmu.h  |  506 +-
 arch/arm/plat-samsung/include/plat/map-s5p.h |1 -
 9 files changed, 362 insertions(+), 330 deletions(-)

diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 33a2bee..2922f20 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -37,7 +37,7 @@ extern void exynos_cpu_die(unsigned int cpu);
 
 /* PMU(Power Management Unit) support */
 
-#define PMU_TABLE_END  NULL
+#define PMU_TABLE_END  (-1U)
 
 enum sys_powerdown {
SYS_AFTR,
@@ -48,7 +48,7 @@ enum sys_powerdown {
 
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
-   void __iomem *reg;
+   unsigned int offset;
unsigned int val[NUM_SYS_POWERDOWN];
 };
 
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 9045fd6..a59b122 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -66,11 +67,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
.length = SZ_4K,
.type   = MT_DEVICE,
}, {
-   .virtual= (unsigned long)S5P_VA_PMU,
-   .pfn= __phys_to_pfn(EXYNOS4_PA_PMU),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S5P_VA_COMBINER_BASE,
.pfn= __phys_to_pfn(EXYNOS4_PA_COMBINER),
.length = SZ_4K,
@@ -194,11 +190,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.pfn= __phys_to_pfn(EXYNOS5_PA_CMU),
.length = 144 * SZ_1K,
.type   = MT_DEVICE,
-   }, {
-   .virtual= (unsigned long)S5P_VA_PMU,
-   .pfn= __phys_to_pfn(EXYNOS5_PA_PMU),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
},
 };
 
@@ -206,7 +197,7 @@ static void exynos_restart(enum reboot_mode mode, const 
char *cmd)
 {
struct device_node *np;
u32 val = 0x1;
-   void __iomem *addr = EXYNOS_SWRESET;
+   void __iomem *addr = NULL;
 
if (of_machine_is_compatible("samsung,exynos5440")) {
u32 status;
@@ -219,9 +210,9 @@ static void exynos_restart(enum reboot_mode mode, const 
char *cmd)
val = __raw_readl(addr);
 
val = (val & 0x) | (status & 0x);
-   }
-
-   __raw_writel(val, addr);
+   __raw_writel(val, addr);
+   } else
+   regmap_write(exynos_pmu_regmap, EXYNOS_SWRESET, val);
 }
 
 static struct platform_device exynos_cpuidle = {
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 73b0b5c..0243ef3 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -91,11 +92,12 @@ static inline void cpu_leave_lowpower(void)
 
 static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 {
+   struct regmap *pmu_regmap = get_exynos_pmuregmap();
for (;;) {
 
/* make cpu1 to be turned off at next WFI command */
if (cpu == 1)
-   __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
+   regmap_write(pmu_regmap, S5P_ARM_CORE1_CONFIGURATION, 
0);
 
/*
 * here's the WFI
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 7b046b5..1ba7fb5 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -35,9 +35,6 @@
 #define EXYNOS4_PA_SYSCON  0x1001
 #define EXYNOS5_PA_SYS

[PATCH v3 07/12] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-04-29 Thread Pankaj Dubey
From: Young-Gun Jang 

Add support for mapping Samsung Power Management Unit (PMU)
base address from device tree. This patch also adds helper
function as "get_exynos_pmuregmap". This function can be used
by other machine files such as "pm.c", "hotplug.c" for accessing
PMU regmap handle.

Signed-off-by: Young-Gun Jang 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/Kconfig  |2 ++
 arch/arm/mach-exynos/common.h |2 ++
 arch/arm/mach-exynos/exynos.c |   39 +++
 3 files changed, 43 insertions(+)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fc8bf18..2f60c90 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -26,6 +26,7 @@ config ARCH_EXYNOS4
select PINCTRL
select PM_GENERIC_DOMAINS if PM_RUNTIME
select S5P_DEV_MFC
+   select MFD_SYSCON
help
  Samsung EXYNOS4 SoCs based systems
 
@@ -36,6 +37,7 @@ config ARCH_EXYNOS5
select HAVE_ARM_SCU if SMP
select HAVE_SMP
select PINCTRL
+   select MFD_SYSCON
help
  Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8a4aa0b..33a2bee 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -55,4 +55,6 @@ struct exynos_pmu_conf {
 extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
 extern void exynos_enter_aftr(void);
 
+extern struct regmap *get_exynos_pmuregmap(void);
+
 #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a7b45db..9045fd6 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,6 +37,8 @@
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
 
+static struct regmap *exynos_pmu_regmap;
+
 static struct map_desc exynos4_iodesc[] __initdata = {
{
.virtual= (unsigned long)S3C_VA_SYS,
@@ -260,6 +263,14 @@ static int __init exynos_fdt_map_chipid(unsigned long 
node, const char *uname,
return 1;
 }
 
+static const struct of_device_id exynos_dt_pmu_match[] = {
+   { .compatible = "samsung,exynos4210-pmu" },
+   { .compatible = "samsung,exynos4212-pmu" },
+   { .compatible = "samsung,exynos4412-pmu" },
+   { .compatible = "samsung,exynos5250-pmu" },
+   {},
+};
+
 /*
  * exynos_map_io
  *
@@ -327,6 +338,32 @@ static int __init exynos4_l2x0_cache_init(void)
 }
 early_initcall(exynos4_l2x0_cache_init);
 
+
+struct regmap *get_exynos_pmuregmap()
+{
+   return exynos_pmu_regmap;
+}
+
+void __init exynos_map_pmu(void)
+{
+   struct device_node *np = NULL;
+
+   early_syscon_init();
+
+   np = of_find_matching_node(NULL, exynos_dt_pmu_match);
+
+   if (!np) {
+   pr_err("Failed to find PMU node\n");
+   return;
+   } else {
+   exynos_pmu_regmap = syscon_early_regmap_lookup_by_phandle(np,
+   "samsung,syscon-phandle");
+   }
+
+   if (IS_ERR(exynos_pmu_regmap))
+   pr_err("failed to find exynos_pmu_regmap\n");
+}
+
 static void __init exynos_dt_machine_init(void)
 {
struct device_node *i2c_np;
@@ -355,6 +392,8 @@ static void __init exynos_dt_machine_init(void)
}
}
 
+   exynos_map_pmu();
+
if (!soc_is_exynos5440())
platform_device_register(&exynos_cpuidle);
 
-- 
1.7.10.4

--
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 01/12] ARM: EXYNOS: Make exynos machine_ops as static

2014-04-30 Thread Pankaj Dubey

Hi Sachin,

On 04/30/2014 03:00 PM, Sachin Kamat wrote:

Hi Pankaj,

On 30 April 2014 10:47, Pankaj Dubey  wrote:

As machine function ops are used only in this file let's make
them static.

Signed-off-by: Pankaj Dubey 
---
  arch/arm/mach-exynos/exynos.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 3d69e8d..06dcce5 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -198,7 +198,7 @@ static struct map_desc exynos5_iodesc[] __initdata = {
 },
  };

-void exynos_restart(enum reboot_mode mode, const char *cmd)
+static void exynos_restart(enum reboot_mode mode, const char *cmd)
  {
 struct device_node *np;
 u32 val = 0x1;
@@ -239,7 +239,7 @@ void __init exynos_cpufreq_init(void)
 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
  }

-void __init exynos_init_late(void)
+static void __init exynos_init_late(void)
  {
 if (of_machine_is_compatible("samsung,exynos5440"))
 /* to be supported later */
@@ -300,7 +300,7 @@ static void __init exynos_map_io(void)
 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
  }

-void __init exynos_init_io(void)
+static void __init exynos_init_io(void)
  {
 debug_ll_io_init();


The declarations from common.h should also be removed in this patch to
avoid the below
build errors:


Thanks. I will merge changes in common.h in this patch itself.



arch/arm/mach-exynos/exynos.c:198:13: error: static declaration of
‘exynos_restart’ follows non-static declaration
  static void exynos_restart(enum reboot_mode mode, const char *cmd)
  ^
In file included from arch/arm/mach-exynos/exynos.c:31:0:
arch/arm/mach-exynos/common.h:22:6: note: previous declaration of
‘exynos_restart’ was here
  void exynos_restart(enum reboot_mode mode, const char *cmd);
   ^
arch/arm/mach-exynos/exynos.c:235:20: error: static declaration of
‘exynos_init_late’ follows non-static declaration
  static void __init exynos_init_late(void)
 ^
In file included from arch/arm/mach-exynos/exynos.c:31:0:
arch/arm/mach-exynos/common.h:25:6: note: previous declaration of
‘exynos_init_late’ was here
  void exynos_init_late(void);
   ^
arch/arm/mach-exynos/exynos.c:296:20: error: static declaration of
‘exynos_init_io’ follows non-static declaration
  static void __init exynos_init_io(void)
 ^
In file included from arch/arm/mach-exynos/exynos.c:31:0:
arch/arm/mach-exynos/common.h:21:6: note: previous declaration of
‘exynos_init_io’ was here
  void exynos_init_io(void);





--
Best Regards,
Pankaj Dubey

--
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 11/12] ARM: EXYNOS: Add platform driver support for Exynos PMU.

2014-04-30 Thread Pankaj Dubey

On 04/30/2014 03:05 PM, Vikas Sajjan wrote:

Hi Pankaj,

On Wed, Apr 30, 2014 at 10:47 AM, Pankaj Dubey  wrote:

This patch modifies Exynos Power Management Unit (PMU) initialization
implementation in following way:

- Added platform_device support by registering static platform device.
- Added platform struct exynos_pmu_data to hold platform specific data.
- For each SoC's PMU support now we can add platform data and statically
   bind PMU configuration and SoC specific initialization function.
- Probe function will scan DT and based on matching PMU compatibility
   string initialize pmu_context which will be platform_data for driver.
- Obtain PMU regmap handle using "syscon_regmap_lookup_by_phandle" so
   that we can reduce dependency over machine header files.
- Separate each SoC's PMU initialization function and make it as part of
   platform data.
- It also removes uses of soc_is_exynos() thus making PMU implementation
   independent of "plat/cpu.h".

Signed-off-by: Pankaj Dubey 
Signed-off-by: Young-Gun Jang 
---
  arch/arm/mach-exynos/pmu.c |  280 +++-
  1 file changed, 224 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 67116a5..030df96 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -1,5 +1,5 @@
  /*
- * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
   * http://www.samsung.com/
   *
   * EXYNOS - CPU PMU(Power Management Unit) support
@@ -9,20 +9,33 @@
   * published by the Free Software Foundation.
   */

-#include 
-#include 
+#include 
  #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 

  #include "common.h"
  #include "regs-pmu.h"

-static const struct exynos_pmu_conf *exynos_pmu_config;
-static struct regmap *pmu_regmap;
+struct exynos_pmu_data {
+   const struct exynos_pmu_conf *pmu_config;
+   const struct exynos_pmu_conf *pmu_config_extra;
+   void (*pmu_init)(void);
+   void (*powerdown_conf)(enum sys_powerdown);
+};
+
+struct exynos_pmu_context {
+   struct device *dev;
+   struct exynos_pmu_data *pmu_data;
+   struct regmap   *pmu_regmap;
+};
+
+static struct exynos_pmu_context   *pmu_context;

  static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
+   /* { .offset = address, .val = { AFTR, LPA, SLEEP } */
 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
 { S5P_DIS_IRQ_CORE0,{ 0x0, 0x0, 0x0 } },
 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
@@ -216,7 +229,7 @@ static const struct exynos_pmu_conf exynos4412_pmu_config[] 
= {
  };

  static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
-   /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
+   /* { .offset = address, .val = { AFTR, LPA, SLEEP } */
 { EXYNOS5_ARM_CORE0_SYS_PWR_REG,{ 0x0, 0x0, 0x2} },
 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG,  { 0x0, 0x0, 0x0} },
 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG,{ 0x0, 0x0, 
0x0} },
@@ -339,7 +352,7 @@ static unsigned int const exynos5_list_diable_wfi_wfe[] = {
 EXYNOS5_ISP_ARM_OPTION,
  };

-static void exynos5_init_pmu(void)
+void exynos5_powerdown_conf(enum sys_powerdown mode)
  {
 unsigned int i;
 unsigned int tmp;
@@ -348,81 +361,236 @@ static void exynos5_init_pmu(void)
  * Enable both SC_FEEDBACK and SC_COUNTER
  */
 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) {
-   regmap_read(pmu_regmap, exynos5_list_both_cnt_feed[i], &tmp);
+   regmap_read(pmu_context->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], &tmp);
 tmp |= (EXYNOS5_USE_SC_FEEDBACK |
 EXYNOS5_USE_SC_COUNTER);
-   regmap_write(pmu_regmap, exynos5_list_both_cnt_feed[i], tmp);
+   regmap_write(pmu_context->pmu_regmap,
+   exynos5_list_both_cnt_feed[i], tmp);
 }

 /*
  * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
  */
-   regmap_read(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
+   regmap_read(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, &tmp);
 tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
-   regmap_write(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);
+   regmap_write(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp);

 /*
  * Disable WFI/WFE on XXX_OPTION
  */
 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) {
-   tmp = regmap_read(pmu_regmap, exynos5_list_diable_wfi_wfe[i],
-   

Re: [PATCH v3 00/12] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-05-02 Thread Pankaj Dubey

Hi,

Gentle ping.

Tomasz, Kukjin will you please have a look on this series.


Thanks,
Pankaj Dubey

On 04/30/2014 02:17 PM, Pankaj Dubey wrote:

This patch series, does some minor cleanup of exynos machine files.
It also modifies Exynos Power Management Unit (PMU) related code for
converting it into a platform_driver.
This is also preparation for moving PMU related code out of machine
folder into a either "drivers/mfd", or "drivers/power" or some other
suitable place so that ARM64 based SoC can utilize common piece of code.
These patches require change in Exynos SoC dtsi files, which has been
posted as separate patch series [2]

These patches are created on top of Kukjin Kim's for-next (v3.15-rc1 tag)
branch and on top of Daniel Lezcano's Exynos cpuidle refactor patches [3].

These patches depends on following three patch series:
[1] mfd: syscon: Support early initialization
 https://lkml.org/lkml/2014/4/8/239
[2] Add PMU node for Exynos SoCs
 http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg29329.html
[3] http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085

We have tested these patches on SMDK5250 board for System boot and
Arndale (Exynos5250) board for System boot and PMU initialization and S2R.

For testing on Arndale (Exynos5250) board:
Tested-by: Pankaj Dubey 

Changes Since v2:
  - Rebased on top of Daniel Lezcano's Exynos cpuidle refactor patches.
  - Removed exynos_cpuidle_init and exynos_cpufreq_init code as suggested
by Tomasz Figa.
  - Removed early mapping of PMU base address from exynos.c and removed
"get_exynos_pmuaddr" function. Instead of this added code in platsmp.c
to get PMU base address using of_iomap as suggested by Tomasz Figa.
  - Converted PMU implementation into platform_driver by using static
platform_device method.

Changes Since v1:
  - Rebased on latest for-next of Kukjin Kim's tree.
  - Added patch: "Make exynos machine_ops as static".
For making more cleanup in "mach-exynos/common.h"
as suggested by Tomasz Figa.
  - Addressed comments of Tomasz Figa for cleaning "mach-exynos/common.h".
  - Updated patch: Remove file path from comment section
As suggested by Michel Simek, instead of updating file path
lets remove them from each file under "mach-exynos".
Even though Kukjin pointed out that there is similar patch pending from
Sachin/Tushar but since I could not find I have included this here. If
I have missed something please point to any existing such patch.
  - Updated patch: Add support for mapping PMU base address via DT
- Removed __initdata from declaration of "exynos_pmu_base", as it caused
kernel crash as pointed out by Vikas Sajjan.
- Added support for Syscon initialization and getting PMU regmap handle
as suggested by Sylwester. Since current implementation of early
intialization [1] has limitation that "early_syscon_init" requires
DT to be unflattened and system should be able to allocate memory,
we can't use regmap handles for platsmp.c file as "smp_secondary_init"
will be called before DT unflattening. So I have kept both method for
accessing PMU base address. platsmp.c will use ioremmaped address where
as rest other files can use regmap handle.
  - Added patch: Remove "linux/bug.h" from pmu.c.
  - Updated patch: Refactored code for PMU register mapping via DT
- Modified to use regmap_read/write when using regmap handle.
  - Added patch: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
  - Added patch: Add device tree based initialization support for PMU.
- Convert existing PMU implementation to be a device tree based
 before moving it to "drivers/mfd" folder. As suggested by Bartlomiej.
- Dropped making a platform_driver for PMU, as currently PMU binding
has two compatibility strings as "samsung, exynosxxx-pmu", "syscon",
once we enable MFD_SYSCON config option, current "syscon" driver probe
gets called and PMU probe never gets called. So modified PMU
initialization code to scan DT and match against supported compatiblity
string in driver code, and once we get matching node use that for
accessing PMU regmap handle using 
"syscon_early_regmap_lookup_by_phandle".
If there is any better solution please suggest.

Pankaj Dubey (8):
   ARM: EXYNOS: Make exynos machine_ops as static
   ARM: EXYNOS: Move cpufreq and cpuidle device registration to
 init_machine
   ARM: EXYNOS: Cleanup "mach-exynos/common.h" file
   ARM: EXYNOS: Remove file path from comment section
   ARM: EXYNOS: Remove "linux/bug.h" from pmu.c
   ARM: EXYNOS: Refactored code for using PMU address via DT
   A

[PATCH 3/4] misc: exynos-chipid: Add Exynos Chipid driver support

2014-05-02 Thread Pankaj Dubey
Exynos SoCs have Chipid IP, for identification of product IDs
and SoC revistions. Till now we are using static macros
such as soc_is_exynos and #ifdefs for run time identification
of SoCs and their revisions. This is leading to add new Kconfig,
soc_is_exynos definitions each time new SoC support is getting
added. So this driver intends to provide initialization code
all these functionalites and thus helping in removing macros.

CC: Arnd Bergmann 
CC: Greg Kroah-Hartman 
Signed-off-by: Pankaj Dubey 
---
 drivers/misc/Kconfig |7 
 drivers/misc/Makefile|1 +
 drivers/misc/exynos-chipid.c |   83 ++
 include/linux/exynos-soc.h   |   46 +++
 4 files changed, 137 insertions(+)
 create mode 100644 drivers/misc/exynos-chipid.c
 create mode 100644 include/linux/exynos-soc.h

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 1cb7408..f313bd3 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -515,6 +515,13 @@ config SRAM
  the genalloc API. It is supposed to be used for small on-chip SRAM
  areas found on many SoCs.
 
+config EXYNOS_CHIPID
+   tristate "Support Exynos CHIPID"
+   default y
+   depends on ARCH_EXYNOS || ARM64
+   help
+ If you say Y here you get support for the Exynos CHIP id.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 7eb4b69..48c8fb5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -55,3 +55,4 @@ obj-$(CONFIG_SRAM)+= sram.o
 obj-y  += mic/
 obj-$(CONFIG_GENWQE)   += genwqe/
 obj-$(CONFIG_ECHO) += echo/
+obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o
diff --git a/drivers/misc/exynos-chipid.c b/drivers/misc/exynos-chipid.c
new file mode 100644
index 000..eb23339
--- /dev/null
+++ b/drivers/misc/exynos-chipid.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
+ *   http://www.samsung.com/
+ *
+ * EXYNOS - CHIP ID support
+ * Author: Pankaj Dubey 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define EXYNOS4_SOC_MASK   0xFFFE0
+#define EXYNOS5_SOC_MASK   0xF
+
+#define PROD_ID_SHIFT  (12)
+
+static void __iomem*exynos_chipid_base;
+unsigned int exynos_soc_id = EXYNOS_SOC_UNKNOWN;
+unsigned int exynos_soc_rev;
+
+struct exynos_chipid_data {
+   unsigned int product_id_mask;
+   unsigned int product_id_shift;
+};
+
+static struct exynos_chipid_data exynos4_chipid_data = {
+   .product_id_mask= EXYNOS4_SOC_MASK,
+   .product_id_shift   = PROD_ID_SHIFT,
+};
+
+static struct exynos_chipid_data exynos5_chipid_data = {
+   .product_id_mask= EXYNOS5_SOC_MASK,
+   .product_id_shift   = PROD_ID_SHIFT,
+};
+
+static struct of_device_id of_exynos_chipid_ids[] = {
+   {
+   .compatible = "samsung,exynos4-chipid",
+   .data   = (void *)&exynos4_chipid_data,
+   },
+   {
+   .compatible = "samsung,exynos5-chipid",
+   .data   = (void *)&exynos5_chipid_data,
+   },
+   {},
+};
+
+/**
+ * early_exynos_chipid_init - Early chipid initialization
+ */
+void __init early_exynos_chipid_init(void)
+{
+   struct device_node *np = NULL;
+   const struct of_device_id *match;
+   struct exynos_chipid_data *chipid_data;
+   int pro_id;
+
+   if (!exynos_chipid_base) {
+   np = of_find_matching_node_and_match(NULL,
+   of_exynos_chipid_ids, &match);
+   if (!np)
+   panic("%s, failed to find chipid node\n", __func__);
+
+   chipid_data = (struct exynos_chipid_data *) match->data;
+   exynos_chipid_base = of_iomap(np, 0);
+
+   if (!exynos_chipid_base)
+   panic("%s: failed to map registers\n", __func__);
+
+   pro_id  = __raw_readl(exynos_chipid_base);
+   exynos_soc_id = (pro_id >> chipid_data->product_id_shift)
+   & chipid_data->product_id_mask;
+   exynos_soc_rev = pro_id & 0xFF;
+   pr_info("Exynos: CPUID[0x%x] CPU_REV[0x%x] Detected\n",
+   exynos_soc_id, exynos_soc_rev);
+   }
+}
diff --git a/include/linux/exynos-soc.h b/include/linux/exynos-soc.h
new file mode 100644
index 000..cb3ae06
--- /dev/null
+++ b/include/linux/exynos-soc.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 Samsung Electroni

[PATCH 0/4] Introducing Exynos ChipId driver

2014-05-02 Thread Pankaj Dubey
This patch series attempts to get rid of soc_is_exynos macros
and eventually with the help of this series we can probably get
rid of CONFIG_SOC_EXYNOS in near future.
Each Exynos SoC has ChipID block which can give information about
SoC's product Id and revision number. Currently we have single
DT binding information for this as "samsung,exynos4210-chipid".
But Exynos4 and Exynos5 SoC series have one small difference in
chip Id, with resepect to product id bit-masks. So it means we
should have separate compatible string for these different series
of SoCs. So I have created new binding information for handling
this difference. Also currently I can think of putting this driver
code under "drivers/misc/" but suggestions are welcome.
Also current form of driver is missing platfrom driver and needs
init function to be called from machine file (either exynos.c or
platsmp.c). I hope lot of suggestions and comments to improve this
further.

This patch series is based on Kukjin Kim's for-next (3.14_rc1 tag)
and prepared on top of following patch series and it's dependent
patch series.

[1]: Map SYSRAM through generic SRAM bindings.
http://www.spinics.net/lists/arm-kernel/msg327677.html
[2]: Exynos PMU cleanup and refactoring.
https://lkml.org/lkml/2014/4/30/44

Pankaj Dubey (4):
  ARM: EXYNOS: remove soc_is_exynos4/5 from exynos.c
  ARM:  EXYNOS: remove unused header inclusion from hotplug.c
  misc: exynos-chipid: Add Exynos Chipid driver support
  ARM: EXYNOS: Refactoring to remove soc_is_exynos macros from
exynos

 .../bindings/arm/samsung/exynos-chipid.txt |   15 
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 arch/arm/boot/dts/exynos5.dtsi |2 +-
 arch/arm/mach-exynos/exynos.c  |   66 
 arch/arm/mach-exynos/hotplug.c |2 -
 arch/arm/mach-exynos/platsmp.c |   10 ++-
 arch/arm/mach-exynos/pm.c  |   28 +++
 arch/arm/plat-samsung/include/plat/cpu.h   |   60 --
 drivers/clk/samsung/clk-exynos4.c  |2 +-
 drivers/cpufreq/exynos-cpufreq.c   |9 +--
 drivers/cpufreq/exynos-cpufreq.h   |1 -
 drivers/cpufreq/exynos4x12-cpufreq.c   |5 +-
 drivers/misc/Kconfig   |7 ++
 drivers/misc/Makefile  |1 +
 drivers/misc/exynos-chipid.c   |   83 
 include/linux/exynos-soc.h |   46 +++
 17 files changed, 215 insertions(+), 125 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
 create mode 100644 drivers/misc/exynos-chipid.c
 create mode 100644 include/linux/exynos-soc.h

-- 
1.7.10.4

--
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 1/4] ARM: EXYNOS: remove soc_is_exynos4/5 from exynos.c

2014-05-02 Thread Pankaj Dubey
This patch adds support for checking soc compatibility based on
compatibility match. It will help us in removing soc_is_exynos4
and soc_is_exynos5 function usage and definition.

CC: Russell King 
CC: Heiko Stuebner 
CC: Thomas Abraham 
Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/exynos.c|   30 +++---
 arch/arm/plat-samsung/include/plat/cpu.h |3 ---
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 59eb1f1..93ae076 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -212,6 +212,30 @@ static const struct of_device_id exynos_dt_pmu_match[] = {
{},
 };
 
+static const struct of_device_id exynos5_device_ids[] = {
+   { .compatible = "samsung,exynos5250", },
+   { .compatible = "samsung,exynos5420", },
+   {},
+};
+
+static const struct of_device_id exynos4_device_ids[] = {
+   { .compatible = "samsung,exynos4210", },
+   { .compatible = "samsung,exynos4212", },
+   { .compatible = "samsung,exynos4412", },
+   {},
+};
+
+static inline bool soc_is_compatible(const struct of_device_id *device_ids)
+{
+   unsigned long root = of_get_flat_dt_root();
+   const struct of_device_id *matches = device_ids;
+   for (; matches->compatible[0]; matches++) {
+   if (of_flat_dt_is_compatible(root, matches->compatible))
+   return true;
+   }
+   return false;
+}
+
 /*
  * exynos_map_io
  *
@@ -219,10 +243,10 @@ static const struct of_device_id exynos_dt_pmu_match[] = {
  */
 static void __init exynos_map_io(void)
 {
-   if (soc_is_exynos4())
+   if (soc_is_compatible(exynos4_device_ids))
iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
 
-   if (soc_is_exynos5())
+   if (soc_is_compatible(exynos5_device_ids))
iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
 }
 
@@ -306,7 +330,7 @@ static void __init exynos_dt_machine_init(void)
 * are available then re-configure the interrupts via the
 * system register.
 */
-   if (soc_is_exynos5()) {
+   if (soc_is_compatible(exynos5_device_ids)) {
for_each_compatible_node(i2c_np, NULL, i2c_compat) {
if (of_device_is_available(i2c_np)) {
id = of_alias_get_id(i2c_np, "i2c");
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h 
b/arch/arm/plat-samsung/include/plat/cpu.h
index 5992b8d..18a9a00 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -166,9 +166,6 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, 
EXYNOS5_SOC_MASK)
 # define soc_is_exynos5440()   0
 #endif
 
-#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
- soc_is_exynos4412())
-#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420())
 
 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, 
__phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
 
-- 
1.7.10.4

--
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 2/4] ARM: EXYNOS: remove unused header inclusion from hotplug.c

2014-05-02 Thread Pankaj Dubey
This patch removed "plat/cpu.h" inclusion from hotplug.c as it
is not required.

Signed-off-by: Pankaj Dubey 
---
 arch/arm/mach-exynos/hotplug.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 0243ef3..5e19601 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -19,8 +19,6 @@
 #include 
 #include 
 
-#include 
-
 #include "common.h"
 #include "regs-pmu.h"
 
-- 
1.7.10.4

--
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 0/4] Introducing Exynos ChipId driver

2014-05-05 Thread Pankaj Dubey

Hi Arnd,

Thanks for review and suggestions.

On 05/04/2014 12:02 AM, Arnd Bergmann wrote:

On Saturday 03 May 2014 15:11:36 Pankaj Dubey wrote:

This patch series attempts to get rid of soc_is_exynos macros
and eventually with the help of this series we can probably get
rid of CONFIG_SOC_EXYNOS in near future.
Each Exynos SoC has ChipID block which can give information about
SoC's product Id and revision number. Currently we have single
DT binding information for this as "samsung,exynos4210-chipid".
But Exynos4 and Exynos5 SoC series have one small difference in
chip Id, with resepect to product id bit-masks. So it means we
should have separate compatible string for these different series
of SoCs. So I have created new binding information for handling
this difference. Also currently I can think of putting this driver
code under "drivers/misc/" but suggestions are welcome.
Also current form of driver is missing platfrom driver and needs
init function to be called from machine file (either exynos.c or
platsmp.c). I hope lot of suggestions and comments to improve this
further.

This patch series is based on Kukjin Kim's for-next (3.14_rc1 tag)
and prepared on top of following patch series and it's dependent
patch series.

I think putting it into drivers/soc would be most appropriate.
We already have a few drivers lined up that we want in there,
although the directory currently doesn't exist.

OK. Will move to "drivers/soc". I can see already some patches
have been posted [1] by Andy Gross for creating directory
"drivers/soc" I will use those patches for adding samsung folder
under "drivers/soc".

[1]: https://lkml.org/lkml/2014/4/21/46



However, I would ask that you use the infrastructure provided by
drivers/base/soc.c when you add this driver, to also make the
information available to user space using a standard API.


OK. Will update in next version.



Ideally this should be done by slightly restructuring the DT
source to make all on-chip devices appear below the soc node.


Currently I can't see soc nodes in exynos4 and exynos5 DT files.
So isn't it should be a separate patch first to modify all exynos4
exynos5 DT files to move all devices under soc node?
In that case existing chipid node will be also moved under soc node.


We'd have to think a bit about how to best do this while
preserving compatibility with existing dts files.


Is it necessary in this case?
As I have mentioned there is difference in bit-mask among exynos4
and exynos5's chipid. So is this reason not sufficient to keep separate
compatible for both?
Also even if we get some way to preserve existing compatibility, I afraid
in chipid driver that implementation will not look good, at least I am not
able to think of any good way. Any suggestions?



Regarding patch 4, this is not what I meant when I asked for
removing the soc_is_exynos* macros. You basically do a 1:1 replacement
using a different interface, but you still have code that does
things differently based on a global identification.

I agree with what you are trying to say. But if you see recently we had some
patches (cpu_idle.c: [2], pmu.c: [3])  to remove usage of such macros from
exynos machine files. So only leftover files using these macros are exynos.c
platsmp.c and pm.c.

For exynos.c I have tried to remove soc_is_exynos4/exynos5 by matching with
compatible string in patch 1 of this series. Please let me know if that is OK?

Also for platsmp.c and pm.c I can think of following approaches
1: Keep these macros till we get generic solution?
2: Allow chipid driver to expose APIs to check SoC id and SoC revisions 
till we get

generic solution. So that at least we can remove #ifdef  based macros
as soc_is_exynosXYZ.
3: Use of "of_flat_dt_is_compatible" or similar APIs in these machine files 
till we get

generic solution. For some cases where we want to know SoC revision let us
map chipid register and get revision there itself.

Please let me know what approach you think will be good?

[2]: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085
[3]: https://lkml.org/lkml/2014/5/2/612

The only user left in device drivers is now the cpufreq driver,
which is going to be replaced anyway, so that is ok. Having
a global variable that is accessible to random device drivers
is probably not a good idea though, it will just lead to
bad coding in drivers again.

To give an example of how I think it should really be restructured,
let's look at one function:

static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
 { 76, BIT(1) }, /* RTC alarm */
 { 77, BIT(2) }, /* RTC tick */
 { /* sentinel */ },
};

static const struct exynos_wkup_irq exynos5250_wkup_irq[] = {
 { 75, BIT(1) }, /* RTC alarm */
 { 76, BIT(2) }, /* RTC tick */
 { /* sentinel */ },
};

static int exynos_irq_set_wake(struct irq_data *dat

Re: [PATCH 3/4] misc: exynos-chipid: Add Exynos Chipid driver support

2014-05-05 Thread Pankaj Dubey

On 05/05/2014 04:57 PM, Krzysztof Kozlowski wrote:

On sob, 2014-05-03 at 15:11 +0900, Pankaj Dubey wrote:

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 7eb4b69..48c8fb5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -55,3 +55,4 @@ obj-$(CONFIG_SRAM)+= sram.o
  obj-y += mic/
  obj-$(CONFIG_GENWQE)  += genwqe/
  obj-$(CONFIG_ECHO)+= echo/
+obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o
diff --git a/drivers/misc/exynos-chipid.c b/drivers/misc/exynos-chipid.c
new file mode 100644
index 000..eb23339
--- /dev/null
+++ b/drivers/misc/exynos-chipid.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
+ *   http://www.samsung.com/

I wonder why this is copyrighted in the future (2015)?


Thanks for pointing out, will correct it in next version.



Best regards,
Krzysztof






--
Best Regards,
Pankaj Dubey

--
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 0/4] Introducing Exynos ChipId driver

2014-05-05 Thread Pankaj Dubey

On 05/05/2014 11:58 PM, Arnd Bergmann wrote:

On Monday 05 May 2014 18:23:55 Pankaj Dubey wrote:

On 05/04/2014 12:02 AM, Arnd Bergmann wrote:

Ideally this should be done by slightly restructuring the DT
source to make all on-chip devices appear below the soc node.

Currently I can't see soc nodes in exynos4 and exynos5 DT files.
So isn't it should be a separate patch first to modify all exynos4
exynos5 DT files to move all devices under soc node?
In that case existing chipid node will be also moved under soc node.

Yes, that would be good. In fact the soc node could be identical
to the chipid node, effectively moving everything under chipid.


OK, in that case I would like to keep this as separate patch once
I do all other modifications.


We'd have to think a bit about how to best do this while
preserving compatibility with existing dts files.

Is it necessary in this case?
As I have mentioned there is difference in bit-mask among exynos4
and exynos5's chipid. So is this reason not sufficient to keep separate
compatible for both?

Having two "compatible" values for exynos4 and exynos5 is not a problem,
and it absolutely makes sense to have more specific values in there
as well:

compatible = "samsung,exynos4210-chipid", "samsung,exynos4-chipid";


OK, will keep compatible as you suggested.




Also even if we get some way to preserve existing compatibility, I afraid
in chipid driver that implementation will not look good, at least I am not
able to think of any good way. Any suggestions?

The compatibility I mean is to ensure everything keeps working if
the node is not present.


Regarding patch 4, this is not what I meant when I asked for
removing the soc_is_exynos* macros. You basically do a 1:1 replacement
using a different interface, but you still have code that does
things differently based on a global identification.

I agree with what you are trying to say. But if you see recently we had some
patches (cpu_idle.c: [2], pmu.c: [3])  to remove usage of such macros from
exynos machine files. So only leftover files using these macros are exynos.c
platsmp.c and pm.c.

For exynos.c I have tried to remove soc_is_exynos4/exynos5 by matching with
compatible string in patch 1 of this series. Please let me know if that is OK?

I've taken a closer look at that file now. My preferred solution
would be to go back to having two machine descriptors as it
was before Sachin Kamat's "ARM: EXYNOS: Consolidate exynos4 and
exynos5 machine files", but keep it all in one file and consolidated
as much as possible, e.g.


Yes, that case I do not need to add another function to compare compatible 
strings.
So if there is no issues in having two separate machine descriptor I will 
do this

modification in next version of patch.



static void __init exynos_dt_machine_init(void)
{
exynos_cpuidle_init();
exynos_cpufreq_init();

of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}

static void __init exynos5_dt_machine_init(void)
{
/*
 * Exynos5's legacy i2c controller and new high speed i2c
 * controller have muxed interrupt sources. By default the
 * interrupts for 4-channel HS-I2C controller are enabled.
 * If node for first four channels of legacy i2c controller
 * are available then re-configure the interrupts via the
 * system register.
 */
struct device_node *i2c_np;
const char *i2c_compat = "samsung,s3c2440-i2c";
unsigned int tmp;
int id;

for_each_compatible_node(i2c_np, NULL, i2c_compat) {
   if (of_device_is_available(i2c_np)) {
 id = of_alias_get_id(i2c_np, "i2c");
 if (id < 4) {
   tmp = readl(EXYNOS5_SYS_I2C_CFG);
   writel(tmp & ~(0x1 << id),  
EXYNOS5_SYS_I2C_CFG);
 }
}
}

exynos_dt_machine_init();
}

This way you can avoid having another check of the compatible node.
In the long run, all of the this code should go away: The cpuidle
and cpufreq drivers should become normal platform drivers that
get probed when the devices are present (just like it's required
for arm64 anyway), and the EXYNOS5_SYS_I2C_CFG register should
get set up by an appropriate driver, e.g. the i2c driver through
syscon, or a pinmux driver that changes the mux between the
sources based on DT information, whatever fits best.


OK, will move this in i2c driver and will use sysreg as syscon phandle.



Similarly for exynos_map_io(), with the sysram out of the picture,
it can be

void __init exynos4_init_io(void)
{
 debug_ll_io_init();
iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
}

void __init exynos5_init_io(void)
{
 debug_ll_io_init();
iotable_init(exynos5_iodesc, 

  1   2   3   4   5   6   >