[PATCH v3 1/3] ARM: dts: Add PMU node to exynos4210

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

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 d3d727b..d23d3f0 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -99,6 +99,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 v3 2/3] ARM: dts: Add PMU node to exynos4212 and exynos4412

2014-05-10 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 pankaj.du...@samsung.com
---
 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


[PATCH v3 0/3] Add PMU node for Exynos4 SoCs

2014-05-10 Thread Pankaj Dubey
This patch 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.

Revision 2 was posted here 
 - https://lkml.org/lkml/2014/4/25/216 

Changes since v2:
 - Dropped addition of new property followed by one simple fix in syscon driver
   posted here [1].
 - Addressed review comments [2] by Tomasz Figa about property pointing back to
   self device node.
 - Updated binding doc with example.

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.

[1]: Allow NULL property in syscon_early_regmap_lookup_by_phandle
 https://lkml.org/lkml/2014/5/10/10 and
 https://lkml.org/lkml/2014/4/29/661

[2]: https://lkml.org/lkml/2014/4/25/762

Pankaj Dubey (3):
  ARM: dts: Add PMU node to exynos4210
  ARM: dts: Add PMU node to exynos4212 and exynos4412
  Documentation: update samsung pmu binding information

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

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

CC: Leela Krishna Amudala l.kris...@samsung.com
CC: Tomasz Figa t.f...@samsung.com
CC: Guenter Roeck li...@roeck-us.net
CC: Rob Landley r...@landley.net
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 v4 02/11] ARM: EXYNOS: Move cpufreq and cpuidle device registration to init_machine

2014-05-10 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 t.f...@samsung.com
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 bf8a473..288e414 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -176,19 +176,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))
@@ -303,8 +290,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 v4 00/11] ARM: Exynos: PMU cleanup and refactoring for using DT

2014-05-10 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 Exynos4 SoC dtsi files, which has been
posted as separate patch series. 

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 [2].

These patches depends on following three patch series:
[1] mfd: syscon: Support early initialization
https://lkml.org/lkml/2014/4/8/239
[2] Daniel Lezcano's Exynos cpuidle refactor patches
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085
[3] Allow NULL property in syscon_early_regmap_lookup_by_phandle
https://lkml.org/lkml/2014/5/10/10 and
https://lkml.org/lkml/2014/4/29/661

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 pankaj.du...@samsung.com

Changes Since v3:
 - Addressed build fail issue in exynos.c as reported by Sachin Kamat.
 - Optimized exynos_pmu_probe function by removing exynos_pmu_data_init
   as suggested by Vikas Sajjan.
 - Rebased on top of Sysram patches by Sachin Kamat.
 - Modified syscon_early_regmap_lookup_by_phandle and
   syscon_regmap_lookup_by_phandle function call to pass property as NULL.

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 (7):
  ARM: EXYNOS: Make exynos machine_ops as static
  ARM: EXYNOS: Move cpufreq and cpuidle device registration to
init_machine
  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 

[PATCH v4 11/11] ARM: EXYNOS: Move PMU specific definitions from common.h

2014-05-10 Thread Pankaj Dubey
From: Young-Gun Jang yg1004.j...@samsung.com

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 yg1004.j...@samsung.com
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 58b2b5d..abcb074 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -37,24 +37,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 6a7fa8e..50c33c9 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -16,7 +16,7 @@
 #include linux/slab.h
 #include linux/mfd/syscon.h
 
-#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 v4 03/11] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file.

2014-05-10 Thread Pankaj Dubey
From: Young-Gun Jang yg1004.j...@samsung.com

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 yg1004.j...@samsung.com
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
Reviewed-by: Tomasz Figa t.f...@samsung.com
---
 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 288e414..e4a4be0 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 mach/map.h
 
 #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 mach/map.h
+
+#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 v4 10/11] ARM: EXYNOS: Add platform driver support for Exynos PMU.

2014-05-10 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_exynosXYZ() thus making PMU implementation
  independent of plat/cpu.h.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
Signed-off-by: Young-Gun Jang yg1004.j...@samsung.com
---
 arch/arm/mach-exynos/pmu.c |  266 ++--
 1 file changed, 210 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 67116a5..6a7fa8e 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 linux/io.h
-#include linux/kernel.h
+#include linux/module.h
 #include linux/regmap.h
-
-#include plat/cpu.h
+#include linux/of.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/mfd/syscon.h
 
 #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,222 @@ 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,
+   

[PATCH v4 04/11] ARM: EXYNOS: Remove file path from comment section

2014-05-10 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 pankaj.du...@samsung.com
Reviewed-by: Tomasz Figa t.f...@samsung.com
---
 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 3611241..1f63596 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 v4 08/11] ARM: EXYNOS: Refactored code for using PMU address via DT

2014-05-10 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.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 d533e2d..58b2b5d 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -39,7 +39,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,
@@ -50,7 +50,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 3b1d245..59eb1f1 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -20,6 +20,7 @@
 #include linux/platform_device.h
 #include linux/pm_domain.h
 #include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include asm/cacheflush.h
 #include asm/hardware/cache-l2x0.h
@@ -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,
@@ -144,11 +140,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,
},
 };
 
@@ -156,7 +147,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;
@@ -169,9 +160,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 linux/errno.h
 #include linux/smp.h
 #include linux/io.h
+#include linux/regmap.h
 
 #include asm/cacheflush.h
 #include asm/cp15.h
@@ -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 548269a..34eee6e 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ 

[PATCH v4 09/11] ARM: EXYNOS: Move mach/map.h inclusion from regs-pmu.h to platsmp.c

2014-05-10 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 pankaj.du...@samsung.com
---
 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 33eb364..d0482c2 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -27,6 +27,7 @@
 #include asm/firmware.h
 
 #include plat/cpu.h
+#include mach/map.h
 
 #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 mach/map.h
-
 #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 v4 07/11] ARM: EXYNOS: Remove linux/bug.h from pmu.c

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

Signed-off-by: Young-Gun Jang yg1004.j...@samsung.com
Reviewed-by: Tomasz Figa t.f...@samsung.com
---
 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 linux/io.h
 #include linux/kernel.h
-#include linux/bug.h
 
 #include plat/cpu.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 v4 05/11] ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain

2014-05-10 Thread Pankaj Dubey
From: Young-Gun Jang yg1004.j...@samsung.com

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 yg1004.j...@samsung.com
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
Reviewed-by: Tomasz Figa t.f...@samsung.com
---
 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 linux/of_platform.h
 #include linux/sched.h
 
-#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 v4 06/11] ARM: EXYNOS: Add support for mapping PMU base address via DT

2014-05-10 Thread Pankaj Dubey
From: Young-Gun Jang yg1004.j...@samsung.com

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 yg1004.j...@samsung.com
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 arch/arm/Kconfig  |1 +
 arch/arm/mach-exynos/common.h |2 ++
 arch/arm/mach-exynos/exynos.c |   39 +++
 3 files changed, 42 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 732a134..a4eac2f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -855,6 +855,7 @@ config ARCH_EXYNOS
select SPARSE_IRQ
select SRAM
select USE_OF
+   select MFD_SYSCON
help
  Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
 
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 69739e4..d533e2d 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -57,4 +57,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 e4a4be0..3b1d245 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -19,6 +19,7 @@
 #include linux/of_platform.h
 #include linux/platform_device.h
 #include linux/pm_domain.h
+#include linux/mfd/syscon.h
 
 #include asm/cacheflush.h
 #include asm/hardware/cache-l2x0.h
@@ -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,
@@ -210,6 +213,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
  *
@@ -263,6 +274,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,
+   NULL);
+   }
+
+   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;
@@ -291,6 +328,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


[PATCH v3 0/6] Introducing Exynos ChipId driver

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

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 added second compatible string for handling
this difference. 
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 by Sachin Kamat.
http://www.spinics.net/lists/arm-kernel/msg327677.html
[2]: Exynos PMU cleanup and refactoring.
https://lkml.org/lkml/2014/4/30/44
[3]: Introduce drivers/soc and add QCOM GSBI driver.
https://lkml.org/lkml/2014/4/24/520

Revision 2 and it's discussion can be found here
 - https://lkml.org/lkml/2014/5/6/100

Changes since v2:
 - Reorganized patches as suggested by Tomasz Figa.
 - Addressed review comments of Tomasz Figa in i2c-s3c2410.c file.

Changes since v1:
 - Added patch to move i2c interrupt re-configuration code from exynos.c
   to i2c driver, as suggested by Arnd.
 - After above patch only user of SYS_I2C_CFG register is pm.c so moving
   save/restore of this register also into i2c driver.
 - Spiltted up exynos4 and exynos5 machine descriptors to get rid from
   soc_is_exynos4/exynos5 kind of macros, as suggested by Arnd.
 - Changed location of chipid driver to drivers/soc.
 - Added drivers/base/soc.c provided infrastructure to make SoC specific 
   information avaible to user space via sysfs entry, as suggested by Arnd.


Pankaj Dubey (6):
  i2c: s3c2410: Handle i2c sys_cfg register in i2c driver
  ARM: EXYNOS: Remove i2c sys configuration related code
  ARM: EXYNOS: Remove soc_is_exynos4/5 from exynos.c
  ARM:  EXYNOS: Remove unused header inclusion from hotplug.c
  soc: samsung: exynos-chipid: Add Exynos Chipid driver support
  ARM: EXYNOS: Refactoring to remove soc_is_exynos macros from exynos

 .../bindings/arm/samsung/exynos-chipid.txt |   21 +++
 .../devicetree/bindings/arm/samsung/sysreg.txt |1 +
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 arch/arm/boot/dts/exynos5.dtsi |7 +-
 arch/arm/boot/dts/exynos5250.dtsi  |4 +
 arch/arm/boot/dts/exynos5420.dtsi  |4 +
 arch/arm/mach-exynos/exynos.c  |  119 --
 arch/arm/mach-exynos/hotplug.c |2 -
 arch/arm/mach-exynos/include/mach/map.h|3 -
 arch/arm/mach-exynos/platsmp.c |   11 +-
 arch/arm/mach-exynos/pm.c  |   36 ++---
 arch/arm/mach-exynos/regs-sys.h|   22 ---
 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/i2c/busses/i2c-s3c2410.c   |   32 
 drivers/soc/Kconfig|1 +
 drivers/soc/Makefile   |1 +
 drivers/soc/samsung/Kconfig|   10 ++
 drivers/soc/samsung/Makefile   |1 +
 drivers/soc/samsung/exynos-chipid.c|  166 
 include/linux/exynos-soc.h |   46 ++
 25 files changed, 357 insertions(+), 210 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
 delete mode 100644 arch/arm/mach-exynos/regs-sys.h
 create mode 100644 drivers/soc/samsung/Kconfig
 create mode 100644 drivers/soc/samsung/Makefile
 create mode 100644 drivers/soc/samsung/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 v3 4/6] ARM: EXYNOS: Remove unused header inclusion from hotplug.c

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

This patch removed plat/cpu.h inclusion from hotplug.c as it
is not required.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 asm/cp15.h
 #include asm/smp_plat.h
 
-#include plat/cpu.h
-
 #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


[PATCH v3 1/6] i2c: s3c2410: Handle i2c sys_cfg register in i2c driver

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

Let's handle i2c interrupt re-configuration in i2c driver. This will
help us in removing some soc specific checks from machine files.
Since only Exynos5250, and Exynos5420 need to do this, added syscon
based phandle to i2c device nodes of respective SoC DT files.
Also handle saving and restoring of SYS_I2C_CFG register during
suspend and resume of i2c driver. This will help in removing soc
specific check from mach-exynos/pm.c.

CC: Rob Herring robh...@kernel.org
CC: Randy Dunlap rdun...@infradead.org
CC: Wolfram Sang w...@the-dreams.de
CC: Russell King li...@arm.linux.org.uk
CC: devicet...@vger.kernel.org
CC: linux-...@vger.kernel.org
CC: linux-...@vger.kernel.org
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 .../devicetree/bindings/arm/samsung/sysreg.txt |1 +
 arch/arm/boot/dts/exynos5.dtsi |5 +++
 arch/arm/boot/dts/exynos5250.dtsi  |4 +++
 arch/arm/boot/dts/exynos5420.dtsi  |4 +++
 drivers/i2c/busses/i2c-s3c2410.c   |   32 
 5 files changed, 46 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt 
b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
index 0ab3251..fd71581 100644
--- a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
@@ -3,6 +3,7 @@ SAMSUNG S5P/Exynos SoC series System Registers (SYSREG)
 Properties:
  - compatible : should contain samsung,chip name-sysreg, syscon;
For Exynos4 SoC series it should be samsung,exynos4-sysreg, syscon;
+   For Exynos5 SoC series it should be samsung,exynos5-sysreg, syscon;
  - reg : offset and length of the register set.
 
 Example:
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 79d0608..3027e37 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -99,4 +99,9 @@
#size-cells = 0;
status = disabled;
};
+
+   sys_reg: syscon@1005 {
+   compatible = samsung,exynos5-sysreg, syscon;
+   reg = 0x1005 0x400;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 8d724d5..46f0233 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -285,6 +285,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c0_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -298,6 +299,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c1_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -311,6 +313,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c2_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -324,6 +327,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c3_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index ff496ad..762128c 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -517,6 +517,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c0_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -530,6 +531,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c1_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -543,6 +545,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c2_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -556,6 +559,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c3_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index ae44910..e707062 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -39,6 +39,8 @@
 #include linux/of.h
 #include linux/of_gpio.h
 #include linux/pinctrl/consumer.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include asm/irq.h
 
@@ -91,6 +93,9 @@
 /* Max time to wait for bus to become idle after a xfer (in us) */
 #define S3C2410_IDLE_TIMEOUT   5000
 
+/* Exynos5 Sysreg offset */
+#define 

[PATCH v3 5/6] soc: samsung: exynos-chipid: Add Exynos Chipid driver support

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

Exynos SoCs have Chipid, 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.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 drivers/soc/Kconfig |1 +
 drivers/soc/Makefile|1 +
 drivers/soc/samsung/Kconfig |   10 +++
 drivers/soc/samsung/Makefile|1 +
 drivers/soc/samsung/exynos-chipid.c |  166 +++
 include/linux/exynos-soc.h  |   46 ++
 6 files changed, 225 insertions(+)
 create mode 100644 drivers/soc/samsung/Kconfig
 create mode 100644 drivers/soc/samsung/Makefile
 create mode 100644 drivers/soc/samsung/exynos-chipid.c
 create mode 100644 include/linux/exynos-soc.h

diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 07a11be..86e52b1 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,5 +1,6 @@
 menu SOC specific Drivers
 
 source drivers/soc/qcom/Kconfig
+source drivers/soc/samsung/Kconfig
 
 endmenu
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 0f7c447..ee890aa 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_ARCH_QCOM)+= qcom/
+obj-$(CONFIG_ARCH_EXYNOS)  += samsung/
diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig
new file mode 100644
index 000..dacc95d
--- /dev/null
+++ b/drivers/soc/samsung/Kconfig
@@ -0,0 +1,10 @@
+
+# SAMSUNG Soc drivers
+#
+config EXYNOS_CHIPID
+   tristate Support Exynos CHIPID
+   default y
+   select SOC_BUS
+   depends on ARCH_EXYNOS || ARM64
+   help
+ If you say Y here you get support for the Exynos CHIP id.
diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile
new file mode 100644
index 000..855ca05
--- /dev/null
+++ b/drivers/soc/samsung/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o
diff --git a/drivers/soc/samsung/exynos-chipid.c 
b/drivers/soc/samsung/exynos-chipid.c
new file mode 100644
index 000..b5bccd9
--- /dev/null
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *   http://www.samsung.com/
+ *
+ * EXYNOS - CHIP ID support
+ * Author: Pankaj Dubey pankaj.du...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/of.h
+#include linux/slab.h
+#include linux/sys_soc.h
+#include linux/of_address.h
+#include linux/exynos-soc.h
+
+#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;
+enum exynos_soc_revision exynos_revision;
+
+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,
+   },
+   {},
+};
+
+bool is_soc_id_compatible(enum exynos_soc_id soc_id)
+{
+   return soc_id == exynos_soc_id;
+}
+
+bool is_soc_rev_compatible(enum exynos_soc_revision soc_rev)
+{
+   return soc_rev == exynos_revision;
+}
+
+static const char *exynos_soc_id_to_name(enum exynos_soc_id id)
+{
+   const char *soc_name;
+   switch (id) {
+   case EXYNOS4210:
+   soc_name = EXYNOS4210;
+   break;
+   case EXYNOS4212:
+   soc_name = EXYNOS4212;
+   break;
+   case EXYNOS4412:
+   soc_name = EXYNOS4412;
+   break;
+   case EXYNOS5250:
+   soc_name = EXYNOS5250;
+   break;
+   case EXYNOS5420:
+   soc_name = EXYNOS5420;
+   break;
+   case EXYNOS5440:
+   soc_name = EXYNOS5440;
+   break;
+   default:
+   soc_name = ;
+   }
+   return 

[PATCH v3 6/6] ARM: EXYNOS: Refactoring to remove soc_is_exynos macros from exynos

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

This patch enables chipid driver for ARCH_EXYNOS and refactors
machine code as well as exynos cpufreq driver code for using
chipid driver for identification of SoC ID and SoC rev.

This patch also updates DT binding information in exynos4 and
exynos5 dtsi file. As to differentiate product id bit-mask we need
separate compatible string for exynos4 and exynos5. Hoping this will
be helpful in future as bit-mask and bit-shift bit may differ.
Added binding information as well.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 .../bindings/arm/samsung/exynos-chipid.txt |   21 
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 arch/arm/boot/dts/exynos5.dtsi |2 +-
 arch/arm/mach-exynos/exynos.c  |   47 
 arch/arm/mach-exynos/platsmp.c |   11 ++--
 arch/arm/mach-exynos/pm.c  |   26 -
 arch/arm/plat-samsung/include/plat/cpu.h   |   57 
 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 +-
 12 files changed, 61 insertions(+), 123 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt

diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt 
b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
new file mode 100644
index 000..a496459
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
@@ -0,0 +1,21 @@
+SAMSUNG Exynos4/Exynos5 SoCs Chipid driver.
+
+Required properties:
+- compatible : Should at least contain samsung,exynos4210-chipid. More
+   specific compatible string specify which SoC version (exynos4 or
+   exynos5) are paired with.
+  Details:
+  samsung,exynos4-chipid: Exynos4 SoCs has Chip ID block that can provide
+   product id, revision number and package information.
+   It has different product-id bit-mask than Exynos5 series SoC.
+  samsung,exynos5-chipid: Exynos5 SoCs has Chip ID block that can provide
+   product id, revision number and package information.
+   It has different product-id bit-mask then Exynos4 series SoC.
+
+- reg: offset and length of the register set
+
+Example:
+   chipid@1000 {
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos4-chipid;
+   reg = 0x1000 0x100;
+   };
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a4eac2f..06f14a4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -856,6 +856,7 @@ config ARCH_EXYNOS
select SRAM
select USE_OF
select MFD_SYSCON
+   select EXYNOS_CHIPID
help
  Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
 
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 2f8bcd0..d4c0657 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -46,7 +46,7 @@
};
 
chipid@1000 {
-   compatible = samsung,exynos4210-chipid;
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos4-chipid;
reg = 0x1000 0x100;
};
 
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 3027e37..1d0b569 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -19,7 +19,7 @@
interrupt-parent = gic;
 
chipid@1000 {
-   compatible = samsung,exynos4210-chipid;
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos5-chipid;
reg = 0x1000 0x100;
};
 
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 9902e52..26f5e8c 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -21,6 +21,7 @@
 #include linux/pm_domain.h
 #include linux/mfd/syscon.h
 #include linux/regmap.h
+#include linux/exynos-soc.h
 
 #include asm/cacheflush.h
 #include asm/hardware/cache-l2x0.h
@@ -28,7 +29,6 @@
 #include asm/mach/map.h
 #include asm/memory.h
 
-#include plat/cpu.h
 #include mach/map.h
 
 #include common.h
@@ -171,29 +171,6 @@ static void __init exynos_init_late(void)
exynos_pm_init();
 }
 
-static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
-   int depth, void *data)
-{
-   struct map_desc iodesc;
-   __be32 *reg;
-   unsigned long len;
-
-   if (!of_flat_dt_is_compatible(node, samsung,exynos4210-chipid) 
-   !of_flat_dt_is_compatible(node, samsung,exynos5440-clock))
-   return 0;
-
-   reg = of_get_flat_dt_prop(node, reg, len);
-   if (reg == NULL || len != 

[PATCH v3 2/6] ARM: EXYNOS: Remove i2c sys configuration related code

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

Since all these code has been moved into i2c driver, now we can
safely remove them from machine files.

CC: Russell King li...@arm.linux.org.uk
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 arch/arm/mach-exynos/exynos.c   |   38 +--
 arch/arm/mach-exynos/include/mach/map.h |3 ---
 arch/arm/mach-exynos/pm.c   |   10 
 arch/arm/mach-exynos/regs-sys.h |   22 --
 4 files changed, 1 insertion(+), 72 deletions(-)
 delete 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 59eb1f1..09063ee 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -29,11 +29,11 @@
 #include asm/memory.h
 
 #include plat/cpu.h
+#include mach/map.h
 
 #include common.h
 #include mfc.h
 #include regs-pmu.h
-#include regs-sys.h
 
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
@@ -42,11 +42,6 @@ static struct regmap *exynos_pmu_regmap;
 
 static struct map_desc exynos4_iodesc[] __initdata = {
{
-   .virtual= (unsigned long)S3C_VA_SYS,
-   .pfn= __phys_to_pfn(EXYNOS4_PA_SYSCON),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_TIMER,
.pfn= __phys_to_pfn(EXYNOS4_PA_TIMER),
.length = SZ_16K,
@@ -116,11 +111,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
 
 static struct map_desc exynos5_iodesc[] __initdata = {
{
-   .virtual= (unsigned long)S3C_VA_SYS,
-   .pfn= __phys_to_pfn(EXYNOS5_PA_SYSCON),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_TIMER,
.pfn= __phys_to_pfn(EXYNOS5_PA_TIMER),
.length = SZ_16K,
@@ -293,32 +283,6 @@ void __init exynos_map_pmu(void)
 
 static void __init exynos_dt_machine_init(void)
 {
-   struct device_node *i2c_np;
-   const char *i2c_compat = samsung,s3c2440-i2c;
-   unsigned int tmp;
-   int id;
-
-   /*
-* 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.
-*/
-   if (soc_is_exynos5()) {
-   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_map_pmu();
 
if (!soc_is_exynos5440())
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 34eee6e..bd4a320 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -25,9 +25,6 @@
 
 #define EXYNOS_PA_CHIPID   0x1000
 
-#define EXYNOS4_PA_SYSCON  0x1001
-#define EXYNOS5_PA_SYSCON  0x10050100
-
 #define EXYNOS4_PA_CMU 0x1003
 #define EXYNOS5_PA_CMU 0x1001
 
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index a7a1b7f..59e5604 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -37,7 +37,6 @@
 
 #include common.h
 #include regs-pmu.h
-#include regs-sys.h
 #include exynos-pmu.h
 
 static struct regmap *pmu_regmap;
@@ -52,10 +51,6 @@ struct exynos_wkup_irq {
u32 mask;
 };
 
-static struct sleep_save exynos5_sys_save[] = {
-   SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
-};
-
 static struct sleep_save exynos_core_save[] = {
/* SROM side */
SAVE_ITEM(S5P_SROM_BW),
@@ -211,7 +206,6 @@ static void exynos_pm_prepare(void)
s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
 
if (soc_is_exynos5250()) {
-   s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save));
/* Disable USE_RETENTION of JPEG_MEM_OPTION */
regmap_read(pmu_regmap, EXYNOS5_JPEG_MEM_OPTION, tmp);
tmp = ~EXYNOS5_OPTION_USE_RETENTION;
@@ -296,10 +290,6 @@ static void exynos_pm_resume(void)
regmap_write(pmu_regmap, S5P_PAD_RET_EBIA_OPTION, (1  28));

[PATCH v3 0/6] Introducing Exynos ChipId driver

2014-05-10 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 added second compatible string for handling
this difference. 
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 by Sachin Kamat.
http://www.spinics.net/lists/arm-kernel/msg327677.html
[2]: Exynos PMU cleanup and refactoring.
https://lkml.org/lkml/2014/4/30/44
[3]: Introduce drivers/soc and add QCOM GSBI driver.
https://lkml.org/lkml/2014/4/24/520

Revision 2 and it's discussion can be found here
 - https://lkml.org/lkml/2014/5/6/100

Changes since v2:
 - Reorganized patches as suggested by Tomasz Figa.
 - Addressed review comments of Tomasz Figa in i2c-s3c2410.c file.

Changes since v1:
 - Added patch to move i2c interrupt re-configuration code from exynos.c
   to i2c driver, as suggested by Arnd.
 - After above patch only user of SYS_I2C_CFG register is pm.c so moving
   save/restore of this register also into i2c driver.
 - Spiltted up exynos4 and exynos5 machine descriptors to get rid from
   soc_is_exynos4/exynos5 kind of macros, as suggested by Arnd.
 - Changed location of chipid driver to drivers/soc.
 - Added drivers/base/soc.c provided infrastructure to make SoC specific 
   information avaible to user space via sysfs entry, as suggested by Arnd.


Pankaj Dubey (6):
  i2c: s3c2410: Handle i2c sys_cfg register in i2c driver
  ARM: EXYNOS: Remove i2c sys configuration related code
  ARM: EXYNOS: Remove soc_is_exynos4/5 from exynos.c
  ARM:  EXYNOS: Remove unused header inclusion from hotplug.c
  soc: samsung: exynos-chipid: Add Exynos Chipid driver support
  ARM: EXYNOS: Refactoring to remove soc_is_exynos macros from exynos

 .../bindings/arm/samsung/exynos-chipid.txt |   21 +++
 .../devicetree/bindings/arm/samsung/sysreg.txt |1 +
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 arch/arm/boot/dts/exynos5.dtsi |7 +-
 arch/arm/boot/dts/exynos5250.dtsi  |4 +
 arch/arm/boot/dts/exynos5420.dtsi  |4 +
 arch/arm/mach-exynos/exynos.c  |  119 --
 arch/arm/mach-exynos/hotplug.c |2 -
 arch/arm/mach-exynos/include/mach/map.h|3 -
 arch/arm/mach-exynos/platsmp.c |   11 +-
 arch/arm/mach-exynos/pm.c  |   36 ++---
 arch/arm/mach-exynos/regs-sys.h|   22 ---
 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/i2c/busses/i2c-s3c2410.c   |   32 
 drivers/soc/Kconfig|1 +
 drivers/soc/Makefile   |1 +
 drivers/soc/samsung/Kconfig|   10 ++
 drivers/soc/samsung/Makefile   |1 +
 drivers/soc/samsung/exynos-chipid.c|  166 
 include/linux/exynos-soc.h |   46 ++
 25 files changed, 357 insertions(+), 210 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
 delete mode 100644 arch/arm/mach-exynos/regs-sys.h
 create mode 100644 drivers/soc/samsung/Kconfig
 create mode 100644 drivers/soc/samsung/Makefile
 create mode 100644 drivers/soc/samsung/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 v3 3/6] ARM: EXYNOS: Remove soc_is_exynos4/5 from exynos.c

2014-05-10 Thread Pankaj Dubey
This patch removes usage of soc_is_exynos4/5 from exynos.c.
For this we need to separate machine descriptors for exynos4
and exynos5. While doing this patch does some consolidation also.

CC: Russell King li...@arm.linux.org.uk
CC: Thomas Abraham thomas.abra...@linaro.org
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 arch/arm/mach-exynos/exynos.c|   52 +++---
 arch/arm/plat-samsung/include/plat/cpu.h |3 --
 2 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 09063ee..9902e52 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -202,20 +202,6 @@ static const struct of_device_id exynos_dt_pmu_match[] = {
{},
 };
 
-/*
- * exynos_map_io
- *
- * register the standard cpu IO areas
- */
-static void __init exynos_map_io(void)
-{
-   if (soc_is_exynos4())
-   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
-
-   if (soc_is_exynos5())
-   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-}
-
 static void __init exynos_init_io(void)
 {
debug_ll_io_init();
@@ -224,8 +210,18 @@ static void __init exynos_init_io(void)
 
/* detect cpu id and rev. */
s5p_init_cpu(S5P_VA_CHIPID);
+}
+
+static void __init exynos5_init_io(void)
+{
+   exynos_init_io();
+   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
+}
 
-   exynos_map_io();
+static void __init exynos4_init_io(void)
+{
+   exynos_init_io();
+   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
 }
 
 struct bus_type exynos_subsys = {
@@ -293,11 +289,15 @@ static void __init exynos_dt_machine_init(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
-static char const *exynos_dt_compat[] __initconst = {
+static char const *exynos4_dt_compat[] __initconst = {
samsung,exynos4,
samsung,exynos4210,
samsung,exynos4212,
samsung,exynos4412,
+   NULL
+};
+
+static char const *exynos5_dt_compat[] __initconst = {
samsung,exynos5,
samsung,exynos5250,
samsung,exynos5420,
@@ -321,15 +321,29 @@ static void __init exynos_reserve(void)
 #endif
 }
 
-DT_MACHINE_START(EXYNOS_DT, SAMSUNG EXYNOS (Flattened Device Tree))
+DT_MACHINE_START(EXYNOS5_DT, SAMSUNG EXYNOS (Flattened Device Tree))
+   /* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
+   /* Maintainer: Kukjin Kim kgene@samsung.com */
+   .smp= smp_ops(exynos_smp_ops),
+   .map_io = exynos5_init_io,
+   .init_early = exynos_firmware_init,
+   .init_machine   = exynos_dt_machine_init,
+   .init_late  = exynos_init_late,
+   .dt_compat  = exynos5_dt_compat,
+   .restart= exynos_restart,
+   .reserve= exynos_reserve,
+MACHINE_END
+
+
+DT_MACHINE_START(EXYNOS4_DT, SAMSUNG EXYNOS (Flattened Device Tree))
/* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
/* Maintainer: Kukjin Kim kgene@samsung.com */
.smp= smp_ops(exynos_smp_ops),
-   .map_io = exynos_init_io,
+   .map_io = exynos4_init_io,
.init_early = exynos_firmware_init,
.init_machine   = exynos_dt_machine_init,
.init_late  = exynos_init_late,
-   .dt_compat  = exynos_dt_compat,
+   .dt_compat  = exynos4_dt_compat,
.restart= exynos_restart,
.reserve= exynos_reserve,
 MACHINE_END
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 v3 3/6] ARM: EXYNOS: Remove soc_is_exynos4/5 from exynos.c

2014-05-10 Thread y
From: Pankaj Dubey pankaj.du...@samsung.com

This patch removes usage of soc_is_exynos4/5 from exynos.c.
For this we need to separate machine descriptors for exynos4
and exynos5. While doing this patch does some consolidation also.

CC: Russell King li...@arm.linux.org.uk
CC: Thomas Abraham thomas.abra...@linaro.org
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 arch/arm/mach-exynos/exynos.c|   52 +++---
 arch/arm/plat-samsung/include/plat/cpu.h |3 --
 2 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 09063ee..9902e52 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -202,20 +202,6 @@ static const struct of_device_id exynos_dt_pmu_match[] = {
{},
 };
 
-/*
- * exynos_map_io
- *
- * register the standard cpu IO areas
- */
-static void __init exynos_map_io(void)
-{
-   if (soc_is_exynos4())
-   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
-
-   if (soc_is_exynos5())
-   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-}
-
 static void __init exynos_init_io(void)
 {
debug_ll_io_init();
@@ -224,8 +210,18 @@ static void __init exynos_init_io(void)
 
/* detect cpu id and rev. */
s5p_init_cpu(S5P_VA_CHIPID);
+}
+
+static void __init exynos5_init_io(void)
+{
+   exynos_init_io();
+   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
+}
 
-   exynos_map_io();
+static void __init exynos4_init_io(void)
+{
+   exynos_init_io();
+   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
 }
 
 struct bus_type exynos_subsys = {
@@ -293,11 +289,15 @@ static void __init exynos_dt_machine_init(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
-static char const *exynos_dt_compat[] __initconst = {
+static char const *exynos4_dt_compat[] __initconst = {
samsung,exynos4,
samsung,exynos4210,
samsung,exynos4212,
samsung,exynos4412,
+   NULL
+};
+
+static char const *exynos5_dt_compat[] __initconst = {
samsung,exynos5,
samsung,exynos5250,
samsung,exynos5420,
@@ -321,15 +321,29 @@ static void __init exynos_reserve(void)
 #endif
 }
 
-DT_MACHINE_START(EXYNOS_DT, SAMSUNG EXYNOS (Flattened Device Tree))
+DT_MACHINE_START(EXYNOS5_DT, SAMSUNG EXYNOS (Flattened Device Tree))
+   /* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
+   /* Maintainer: Kukjin Kim kgene@samsung.com */
+   .smp= smp_ops(exynos_smp_ops),
+   .map_io = exynos5_init_io,
+   .init_early = exynos_firmware_init,
+   .init_machine   = exynos_dt_machine_init,
+   .init_late  = exynos_init_late,
+   .dt_compat  = exynos5_dt_compat,
+   .restart= exynos_restart,
+   .reserve= exynos_reserve,
+MACHINE_END
+
+
+DT_MACHINE_START(EXYNOS4_DT, SAMSUNG EXYNOS (Flattened Device Tree))
/* Maintainer: Thomas Abraham thomas.abra...@linaro.org */
/* Maintainer: Kukjin Kim kgene@samsung.com */
.smp= smp_ops(exynos_smp_ops),
-   .map_io = exynos_init_io,
+   .map_io = exynos4_init_io,
.init_early = exynos_firmware_init,
.init_machine   = exynos_dt_machine_init,
.init_late  = exynos_init_late,
-   .dt_compat  = exynos_dt_compat,
+   .dt_compat  = exynos4_dt_compat,
.restart= exynos_restart,
.reserve= exynos_reserve,
 MACHINE_END
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 v3 4/6] ARM: EXYNOS: Remove unused header inclusion from hotplug.c

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

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 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 asm/cp15.h
 #include asm/smp_plat.h
 
-#include plat/cpu.h
-
 #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


[PATCH v3 6/6] ARM: EXYNOS: Refactoring to remove soc_is_exynos macros from exynos

2014-05-10 Thread Pankaj Dubey
This patch enables chipid driver for ARCH_EXYNOS and refactors
machine code as well as exynos cpufreq driver code for using
chipid driver for identification of SoC ID and SoC rev.

This patch also updates DT binding information in exynos4 and
exynos5 dtsi file. As to differentiate product id bit-mask we need
separate compatible string for exynos4 and exynos5. Hoping this will
be helpful in future as bit-mask and bit-shift bit may differ.
Added binding information as well.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 .../bindings/arm/samsung/exynos-chipid.txt |   21 
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 arch/arm/boot/dts/exynos5.dtsi |2 +-
 arch/arm/mach-exynos/exynos.c  |   47 
 arch/arm/mach-exynos/platsmp.c |   11 ++--
 arch/arm/mach-exynos/pm.c  |   26 -
 arch/arm/plat-samsung/include/plat/cpu.h   |   57 
 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 +-
 12 files changed, 61 insertions(+), 123 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt

diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt 
b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
new file mode 100644
index 000..a496459
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.txt
@@ -0,0 +1,21 @@
+SAMSUNG Exynos4/Exynos5 SoCs Chipid driver.
+
+Required properties:
+- compatible : Should at least contain samsung,exynos4210-chipid. More
+   specific compatible string specify which SoC version (exynos4 or
+   exynos5) are paired with.
+  Details:
+  samsung,exynos4-chipid: Exynos4 SoCs has Chip ID block that can provide
+   product id, revision number and package information.
+   It has different product-id bit-mask than Exynos5 series SoC.
+  samsung,exynos5-chipid: Exynos5 SoCs has Chip ID block that can provide
+   product id, revision number and package information.
+   It has different product-id bit-mask then Exynos4 series SoC.
+
+- reg: offset and length of the register set
+
+Example:
+   chipid@1000 {
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos4-chipid;
+   reg = 0x1000 0x100;
+   };
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a4eac2f..06f14a4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -856,6 +856,7 @@ config ARCH_EXYNOS
select SRAM
select USE_OF
select MFD_SYSCON
+   select EXYNOS_CHIPID
help
  Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
 
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 2f8bcd0..d4c0657 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -46,7 +46,7 @@
};
 
chipid@1000 {
-   compatible = samsung,exynos4210-chipid;
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos4-chipid;
reg = 0x1000 0x100;
};
 
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 3027e37..1d0b569 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -19,7 +19,7 @@
interrupt-parent = gic;
 
chipid@1000 {
-   compatible = samsung,exynos4210-chipid;
+   compatible = samsung,exynos4210-chipid, 
samsung,exynos5-chipid;
reg = 0x1000 0x100;
};
 
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 9902e52..26f5e8c 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -21,6 +21,7 @@
 #include linux/pm_domain.h
 #include linux/mfd/syscon.h
 #include linux/regmap.h
+#include linux/exynos-soc.h
 
 #include asm/cacheflush.h
 #include asm/hardware/cache-l2x0.h
@@ -28,7 +29,6 @@
 #include asm/mach/map.h
 #include asm/memory.h
 
-#include plat/cpu.h
 #include mach/map.h
 
 #include common.h
@@ -171,29 +171,6 @@ static void __init exynos_init_late(void)
exynos_pm_init();
 }
 
-static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
-   int depth, void *data)
-{
-   struct map_desc iodesc;
-   __be32 *reg;
-   unsigned long len;
-
-   if (!of_flat_dt_is_compatible(node, samsung,exynos4210-chipid) 
-   !of_flat_dt_is_compatible(node, samsung,exynos5440-clock))
-   return 0;
-
-   reg = of_get_flat_dt_prop(node, reg, len);
-   if (reg == NULL || len != (sizeof(unsigned long) * 2))
-   return 0;
-
-   

[PATCH v3 2/6] ARM: EXYNOS: Remove i2c sys configuration related code

2014-05-10 Thread Pankaj Dubey
Since all these code has been moved into i2c driver, now we can
safely remove them from machine files.

CC: Russell King li...@arm.linux.org.uk
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 arch/arm/mach-exynos/exynos.c   |   38 +--
 arch/arm/mach-exynos/include/mach/map.h |3 ---
 arch/arm/mach-exynos/pm.c   |   10 
 arch/arm/mach-exynos/regs-sys.h |   22 --
 4 files changed, 1 insertion(+), 72 deletions(-)
 delete 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 59eb1f1..09063ee 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -29,11 +29,11 @@
 #include asm/memory.h
 
 #include plat/cpu.h
+#include mach/map.h
 
 #include common.h
 #include mfc.h
 #include regs-pmu.h
-#include regs-sys.h
 
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
@@ -42,11 +42,6 @@ static struct regmap *exynos_pmu_regmap;
 
 static struct map_desc exynos4_iodesc[] __initdata = {
{
-   .virtual= (unsigned long)S3C_VA_SYS,
-   .pfn= __phys_to_pfn(EXYNOS4_PA_SYSCON),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_TIMER,
.pfn= __phys_to_pfn(EXYNOS4_PA_TIMER),
.length = SZ_16K,
@@ -116,11 +111,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
 
 static struct map_desc exynos5_iodesc[] __initdata = {
{
-   .virtual= (unsigned long)S3C_VA_SYS,
-   .pfn= __phys_to_pfn(EXYNOS5_PA_SYSCON),
-   .length = SZ_64K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_TIMER,
.pfn= __phys_to_pfn(EXYNOS5_PA_TIMER),
.length = SZ_16K,
@@ -293,32 +283,6 @@ void __init exynos_map_pmu(void)
 
 static void __init exynos_dt_machine_init(void)
 {
-   struct device_node *i2c_np;
-   const char *i2c_compat = samsung,s3c2440-i2c;
-   unsigned int tmp;
-   int id;
-
-   /*
-* 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.
-*/
-   if (soc_is_exynos5()) {
-   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_map_pmu();
 
if (!soc_is_exynos5440())
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 34eee6e..bd4a320 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -25,9 +25,6 @@
 
 #define EXYNOS_PA_CHIPID   0x1000
 
-#define EXYNOS4_PA_SYSCON  0x1001
-#define EXYNOS5_PA_SYSCON  0x10050100
-
 #define EXYNOS4_PA_CMU 0x1003
 #define EXYNOS5_PA_CMU 0x1001
 
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index a7a1b7f..59e5604 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -37,7 +37,6 @@
 
 #include common.h
 #include regs-pmu.h
-#include regs-sys.h
 #include exynos-pmu.h
 
 static struct regmap *pmu_regmap;
@@ -52,10 +51,6 @@ struct exynos_wkup_irq {
u32 mask;
 };
 
-static struct sleep_save exynos5_sys_save[] = {
-   SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
-};
-
 static struct sleep_save exynos_core_save[] = {
/* SROM side */
SAVE_ITEM(S5P_SROM_BW),
@@ -211,7 +206,6 @@ static void exynos_pm_prepare(void)
s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
 
if (soc_is_exynos5250()) {
-   s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save));
/* Disable USE_RETENTION of JPEG_MEM_OPTION */
regmap_read(pmu_regmap, EXYNOS5_JPEG_MEM_OPTION, tmp);
tmp = ~EXYNOS5_OPTION_USE_RETENTION;
@@ -296,10 +290,6 @@ static void exynos_pm_resume(void)
regmap_write(pmu_regmap, S5P_PAD_RET_EBIA_OPTION, (1  28));
regmap_write(pmu_regmap, S5P_PAD_RET_EBIB_OPTION, (1  

[PATCH v3 1/6] i2c: s3c2410: Handle i2c sys_cfg register in i2c driver

2014-05-10 Thread Pankaj Dubey
Let's handle i2c interrupt re-configuration in i2c driver. This will
help us in removing some soc specific checks from machine files.
Since only Exynos5250, and Exynos5420 need to do this, added syscon
based phandle to i2c device nodes of respective SoC DT files.
Also handle saving and restoring of SYS_I2C_CFG register during
suspend and resume of i2c driver. This will help in removing soc
specific check from mach-exynos/pm.c.

CC: Rob Herring robh...@kernel.org
CC: Randy Dunlap rdun...@infradead.org
CC: Wolfram Sang w...@the-dreams.de
CC: Russell King li...@arm.linux.org.uk
CC: devicet...@vger.kernel.org
CC: linux-...@vger.kernel.org
CC: linux-...@vger.kernel.org
Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 .../devicetree/bindings/arm/samsung/sysreg.txt |1 +
 arch/arm/boot/dts/exynos5.dtsi |5 +++
 arch/arm/boot/dts/exynos5250.dtsi  |4 +++
 arch/arm/boot/dts/exynos5420.dtsi  |4 +++
 drivers/i2c/busses/i2c-s3c2410.c   |   32 
 5 files changed, 46 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt 
b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
index 0ab3251..fd71581 100644
--- a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt
@@ -3,6 +3,7 @@ SAMSUNG S5P/Exynos SoC series System Registers (SYSREG)
 Properties:
  - compatible : should contain samsung,chip name-sysreg, syscon;
For Exynos4 SoC series it should be samsung,exynos4-sysreg, syscon;
+   For Exynos5 SoC series it should be samsung,exynos5-sysreg, syscon;
  - reg : offset and length of the register set.
 
 Example:
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 79d0608..3027e37 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -99,4 +99,9 @@
#size-cells = 0;
status = disabled;
};
+
+   sys_reg: syscon@1005 {
+   compatible = samsung,exynos5-sysreg, syscon;
+   reg = 0x1005 0x400;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 8d724d5..46f0233 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -285,6 +285,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c0_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -298,6 +299,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c1_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -311,6 +313,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c2_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -324,6 +327,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c3_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index ff496ad..762128c 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -517,6 +517,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c0_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -530,6 +531,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c1_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -543,6 +545,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c2_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
@@ -556,6 +559,7 @@
clock-names = i2c;
pinctrl-names = default;
pinctrl-0 = i2c3_bus;
+   samsung,syscon-phandle = sys_reg;
status = disabled;
};
 
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index ae44910..e707062 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -39,6 +39,8 @@
 #include linux/of.h
 #include linux/of_gpio.h
 #include linux/pinctrl/consumer.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include asm/irq.h
 
@@ -91,6 +93,9 @@
 /* Max time to wait for bus to become idle after a xfer (in us) */
 #define S3C2410_IDLE_TIMEOUT   5000
 
+/* Exynos5 Sysreg offset */
+#define EXYNOS5_SYS_I2C_CFG0x0234
+
 /* i2c controller 

[PATCH v3 5/6] soc: samsung: exynos-chipid: Add Exynos Chipid driver support

2014-05-10 Thread Pankaj Dubey
Exynos SoCs have Chipid, 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.

Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
---
 drivers/soc/Kconfig |1 +
 drivers/soc/Makefile|1 +
 drivers/soc/samsung/Kconfig |   10 +++
 drivers/soc/samsung/Makefile|1 +
 drivers/soc/samsung/exynos-chipid.c |  166 +++
 include/linux/exynos-soc.h  |   46 ++
 6 files changed, 225 insertions(+)
 create mode 100644 drivers/soc/samsung/Kconfig
 create mode 100644 drivers/soc/samsung/Makefile
 create mode 100644 drivers/soc/samsung/exynos-chipid.c
 create mode 100644 include/linux/exynos-soc.h

diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 07a11be..86e52b1 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,5 +1,6 @@
 menu SOC specific Drivers
 
 source drivers/soc/qcom/Kconfig
+source drivers/soc/samsung/Kconfig
 
 endmenu
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 0f7c447..ee890aa 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_ARCH_QCOM)+= qcom/
+obj-$(CONFIG_ARCH_EXYNOS)  += samsung/
diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig
new file mode 100644
index 000..dacc95d
--- /dev/null
+++ b/drivers/soc/samsung/Kconfig
@@ -0,0 +1,10 @@
+
+# SAMSUNG Soc drivers
+#
+config EXYNOS_CHIPID
+   tristate Support Exynos CHIPID
+   default y
+   select SOC_BUS
+   depends on ARCH_EXYNOS || ARM64
+   help
+ If you say Y here you get support for the Exynos CHIP id.
diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile
new file mode 100644
index 000..855ca05
--- /dev/null
+++ b/drivers/soc/samsung/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o
diff --git a/drivers/soc/samsung/exynos-chipid.c 
b/drivers/soc/samsung/exynos-chipid.c
new file mode 100644
index 000..b5bccd9
--- /dev/null
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *   http://www.samsung.com/
+ *
+ * EXYNOS - CHIP ID support
+ * Author: Pankaj Dubey pankaj.du...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/of.h
+#include linux/slab.h
+#include linux/sys_soc.h
+#include linux/of_address.h
+#include linux/exynos-soc.h
+
+#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;
+enum exynos_soc_revision exynos_revision;
+
+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,
+   },
+   {},
+};
+
+bool is_soc_id_compatible(enum exynos_soc_id soc_id)
+{
+   return soc_id == exynos_soc_id;
+}
+
+bool is_soc_rev_compatible(enum exynos_soc_revision soc_rev)
+{
+   return soc_rev == exynos_revision;
+}
+
+static const char *exynos_soc_id_to_name(enum exynos_soc_id id)
+{
+   const char *soc_name;
+   switch (id) {
+   case EXYNOS4210:
+   soc_name = EXYNOS4210;
+   break;
+   case EXYNOS4212:
+   soc_name = EXYNOS4212;
+   break;
+   case EXYNOS4412:
+   soc_name = EXYNOS4412;
+   break;
+   case EXYNOS5250:
+   soc_name = EXYNOS5250;
+   break;
+   case EXYNOS5420:
+   soc_name = EXYNOS5420;
+   break;
+   case EXYNOS5440:
+   soc_name = EXYNOS5440;
+   break;
+   default:
+   soc_name = ;
+   }
+   return soc_name;
+}
+
+struct device * __init 

[PATCH 6/6] usb: host: ohci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ohci-exynos.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 9cf80cb..aa64fb5 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -120,9 +120,8 @@ skip_phy:
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
err = -ENOMEM;
goto fail_io;
}
-- 
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/6] usb: host: Cleanup for ioremap'ing hcd memory

2014-05-10 Thread Vivek Gautam
Based on 'usb-next' branch of Greg's usb tree.

devm_ioremap_resource() API is advantageous over devm_ioremap()
and should therefore be preferred to request any ioremap'ed address
for hcd.

Vivek Gautam (6):
  usb: host: ehci-exynos: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-msm: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-mv: Use devm_ioremap_resource instead of devm_ioremap
  usb: host: ehci-spear: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-tegra: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ohci-exynos: Use devm_ioremap_resource instead of
devm_ioremap

 drivers/usb/host/ehci-exynos.c |3 +--
 drivers/usb/host/ehci-msm.c|3 +--
 drivers/usb/host/ehci-mv.c |8 ++--
 drivers/usb/host/ehci-spear.c  |9 +
 drivers/usb/host/ehci-tegra.c  |3 +--
 drivers/usb/host/ohci-exynos.c |3 +--
 6 files changed, 7 insertions(+), 22 deletions(-)

-- 
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/6] usb: host: ehci-mv: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-mv.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index bd61612..5d03787 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -176,10 +176,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
goto err_put_hcd;
}
 
-   ehci_mv-phy_regs = devm_ioremap(pdev-dev, r-start,
-resource_size(r));
+   ehci_mv-phy_regs = devm_ioremap_resource(pdev-dev, r);
if (!ehci_mv-phy_regs) {
-   dev_err(pdev-dev, failed to map phy I/O memory\n);
retval = -EFAULT;
goto err_put_hcd;
}
@@ -191,10 +189,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
goto err_put_hcd;
}
 
-   ehci_mv-cap_regs = devm_ioremap(pdev-dev, r-start,
-resource_size(r));
+   ehci_mv-cap_regs = devm_ioremap_resource(pdev-dev, r);
if (ehci_mv-cap_regs == NULL) {
-   dev_err(pdev-dev, failed to map I/O memory\n);
retval = -EFAULT;
goto err_put_hcd;
}
-- 
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 4/6] usb: host: ehci-spear: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-spear.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 8bd915b..6d84cf2 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -106,15 +106,8 @@ static int spear_ehci_hcd_drv_probe(struct platform_device 
*pdev)
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   if (!devm_request_mem_region(pdev-dev, hcd-rsrc_start, hcd-rsrc_len,
-   driver-description)) {
-   retval = -EBUSY;
-   goto err_put_hcd;
-   }
-
-   hcd-regs = devm_ioremap(pdev-dev, hcd-rsrc_start, hcd-rsrc_len);
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (hcd-regs == NULL) {
-   dev_dbg(pdev-dev, error mapping memory\n);
retval = -ENOMEM;
goto err_put_hcd;
}
-- 
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 5/6] usb: host: ehci-tegra: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-tegra.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 572634c..ccc6433 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -411,9 +411,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
}
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, resource_size(res));
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
err = -ENOMEM;
goto cleanup_clk_en;
}
-- 
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/6] usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-msm.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index f341651..99989aa 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -96,9 +96,8 @@ static int ehci_msm_probe(struct platform_device *pdev)
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, hcd-rsrc_start, hcd-rsrc_len);
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (!hcd-regs) {
-   dev_err(pdev-dev, ioremap failed\n);
ret = -ENOMEM;
goto put_hcd;
}
-- 
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/6] usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-exynos.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 7f425ac..bccb6f1 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -135,9 +135,8 @@ skip_phy:
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
err = -ENOMEM;
goto fail_io;
}
-- 
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 1/6] usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Alexander Shiyan
Sat, 10 May 2014 15:26:58 +0530 от Vivek Gautam gautam.vi...@samsung.com:
 Using devm_ioremap_resource() API should actually be preferred over
 devm_ioremap(), since the former request the mem region first and then
 gives back the ioremap'ed memory pointer.
 devm_ioremap_resource() calls request_mem_region(), therby preventing
 other drivers to make any overlapping call to the same region.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/ehci-exynos.c |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
 index 7f425ac..bccb6f1 100644
 --- a/drivers/usb/host/ehci-exynos.c
 +++ b/drivers/usb/host/ehci-exynos.c
 @@ -135,9 +135,8 @@ skip_phy:
  
   hcd-rsrc_start = res-start;
   hcd-rsrc_len = resource_size(res);
 - hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
 + hcd-regs = devm_ioremap_resource(pdev-dev, res);
   if (!hcd-regs) {
 - dev_err(pdev-dev, Failed to remap I/O memory\n);
   err = -ENOMEM;
   goto fail_io;
   }

You should check this as:

if (IS_ERR(hcd-regs)) {
err = PTR_ERR(hcd-regs);
...

Same in other patches in this series.

---



Re: [PATCH 1/6] usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Hi,


On Sat, May 10, 2014 at 3:36 PM, Alexander Shiyan shc_w...@mail.ru wrote:
 Sat, 10 May 2014 15:26:58 +0530 от Vivek Gautam gautam.vi...@samsung.com:
 Using devm_ioremap_resource() API should actually be preferred over
 devm_ioremap(), since the former request the mem region first and then
 gives back the ioremap'ed memory pointer.
 devm_ioremap_resource() calls request_mem_region(), therby preventing
 other drivers to make any overlapping call to the same region.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/ehci-exynos.c |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
 index 7f425ac..bccb6f1 100644
 --- a/drivers/usb/host/ehci-exynos.c
 +++ b/drivers/usb/host/ehci-exynos.c
 @@ -135,9 +135,8 @@ skip_phy:

   hcd-rsrc_start = res-start;
   hcd-rsrc_len = resource_size(res);
 - hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
 + hcd-regs = devm_ioremap_resource(pdev-dev, res);
   if (!hcd-regs) {
 - dev_err(pdev-dev, Failed to remap I/O memory\n);
   err = -ENOMEM;
   goto fail_io;
   }

 You should check this as:

 if (IS_ERR(hcd-regs)) {
 err = PTR_ERR(hcd-regs);
 ...

Thanks for pointing out. Will change this.


 Same in other patches in this series.

 ---




-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
--
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/6] usb: host: ehci-tegra: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-tegra.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 572634c..6fdcb8a 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -411,10 +411,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
}
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, resource_size(res));
-   if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
-   err = -ENOMEM;
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(hcd-regs)) {
+   err = PTR_ERR(hcd-regs);
goto cleanup_clk_en;
}
ehci-caps = hcd-regs + 0x100;
-- 
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 6/6] usb: host: ohci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ohci-exynos.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 9cf80cb..dec691d 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -120,10 +120,9 @@ skip_phy:
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
-   err = -ENOMEM;
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(hcd-regs)) {
+   err = PTR_ERR(hcd-regs);
goto fail_io;
}
 
-- 
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/6] usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-msm.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index f341651..982c09b 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -96,10 +96,9 @@ static int ehci_msm_probe(struct platform_device *pdev)
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, hcd-rsrc_start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   dev_err(pdev-dev, ioremap failed\n);
-   ret = -ENOMEM;
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(hcd-regs)) {
+   ret = PTR_ERR(hcd-regs);
goto put_hcd;
}
 
-- 
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/6] usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-exynos.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 7f425ac..c23a6d9 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -135,10 +135,9 @@ skip_phy:
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   dev_err(pdev-dev, Failed to remap I/O memory\n);
-   err = -ENOMEM;
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(hcd-regs)) {
+   err = PTR_ERR(hcd-regs);
goto fail_io;
}
 
-- 
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/6] usb: host: ehci-mv: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-mv.c |   16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index bd61612..08147c3 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -176,11 +176,9 @@ static int mv_ehci_probe(struct platform_device *pdev)
goto err_put_hcd;
}
 
-   ehci_mv-phy_regs = devm_ioremap(pdev-dev, r-start,
-resource_size(r));
-   if (!ehci_mv-phy_regs) {
-   dev_err(pdev-dev, failed to map phy I/O memory\n);
-   retval = -EFAULT;
+   ehci_mv-phy_regs = devm_ioremap_resource(pdev-dev, r);
+   if (IS_ERR(ehci_mv-phy_regs)) {
+   retval = PTR_ERR(ehci_mv-phy_regs);
goto err_put_hcd;
}
 
@@ -191,11 +189,9 @@ static int mv_ehci_probe(struct platform_device *pdev)
goto err_put_hcd;
}
 
-   ehci_mv-cap_regs = devm_ioremap(pdev-dev, r-start,
-resource_size(r));
-   if (ehci_mv-cap_regs == NULL) {
-   dev_err(pdev-dev, failed to map I/O memory\n);
-   retval = -EFAULT;
+   ehci_mv-cap_regs = devm_ioremap_resource(pdev-dev, r);
+   if (IS_ERR(ehci_mv-cap_regs)) {
+   retval = PTR_ERR(ehci_mv-cap_regs);
goto err_put_hcd;
}
 
-- 
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/6] usb: host: ehci-spear: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Vivek Gautam
Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-spear.c |   13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 8bd915b..1d59958 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -106,16 +106,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device 
*pdev)
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   if (!devm_request_mem_region(pdev-dev, hcd-rsrc_start, hcd-rsrc_len,
-   driver-description)) {
-   retval = -EBUSY;
-   goto err_put_hcd;
-   }
-
-   hcd-regs = devm_ioremap(pdev-dev, hcd-rsrc_start, hcd-rsrc_len);
-   if (hcd-regs == NULL) {
-   dev_dbg(pdev-dev, error mapping memory\n);
-   retval = -ENOMEM;
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(hcd-regs)) {
+   retval = PTR_ERR(hcd-regs);
goto err_put_hcd;
}
 
-- 
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 0/6] usb: host: Cleanup for ioremap'ing hcd memory

2014-05-10 Thread Vivek Gautam
Based on 'usb-next' branch of Greg's usb tree.

devm_ioremap_resource() API is advantageous over devm_ioremap()
and should therefore be preferred to request any ioremap'ed address
for hcd.

Changes from v1:
 - Changed the way returned pointer is checked for error value
   as pointed out in the review comment in the mailing list.

Vivek Gautam (6):
  usb: host: ehci-exynos: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-msm: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-mv: Use devm_ioremap_resource instead of devm_ioremap
  usb: host: ehci-spear: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ehci-tegra: Use devm_ioremap_resource instead of
devm_ioremap
  usb: host: ohci-exynos: Use devm_ioremap_resource instead of
devm_ioremap

 drivers/usb/host/ehci-exynos.c |7 +++
 drivers/usb/host/ehci-msm.c|7 +++
 drivers/usb/host/ehci-mv.c |   16 ++--
 drivers/usb/host/ehci-spear.c  |   13 +++--
 drivers/usb/host/ehci-tegra.c  |7 +++
 drivers/usb/host/ohci-exynos.c |7 +++
 6 files changed, 21 insertions(+), 36 deletions(-)

-- 
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] mmc: dw_mmc: change to use recommended reset procedure

2014-05-10 Thread Seungwon Jeon
Hi Sonny,

Can you separate procedure?
Reset all are handled in fifo-reset.
And ciu reset is always needed for error handling?

Thanks,
Seungwon Jeon

On Sat, May 10, 2014, Sonny Rao wrote:
 On Fri, May 9, 2014 at 12:32 AM, Jaehoon Chung jh80.ch...@samsung.com wrote:
  Hi, Sonny.
 
  You can discard the my previous some comment.
  As you mentioned, this reset sequence is recommended at Synopsys TRM.
 
  Add the minor question.
 
  On 05/09/2014 01:27 PM, Jaehoon Chung wrote:
  Hi, Sonny.
 
  I have checked the Synopsys TRM..
 
  On 05/09/2014 10:34 AM, Sonny Rao wrote:
  On Thu, May 8, 2014 at 6:15 PM, Jaehoon Chung jh80.ch...@samsung.com 
  wrote:
  On 05/08/2014 06:40 PM, Yuvaraj Kumar wrote:
  Any comments on this patch?
 
  On Wed, Mar 26, 2014 at 5:16 PM, Yuvaraj Kumar C D 
  yuvaraj...@gmail.com wrote:
  From: Sonny Rao sonny...@chromium.org
 
  This patch changes the fifo reset code to follow the reset procedure
  outlined in the documentation of Synopsys  Mobile storage host databook
  7.2.13.
  Without this patch, we could able to see eMMC was not detected after
  multiple reboots due to driver hangs while eMMC tuning for HS200.
 
  Signed-off-by: Sonny Rao sonny...@chromium.org
  Signed-off-by: Yuvaraj Kumar C D yuvaraj...@samsung.org
  ---
   drivers/mmc/host/dw_mmc.c |   48 
  -
   drivers/mmc/host/dw_mmc.h |1 +
   2 files changed, 48 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
  index 32dd81d..1d77431 100644
  --- a/drivers/mmc/host/dw_mmc.c
  +++ b/drivers/mmc/host/dw_mmc.c
  @@ -2220,7 +2220,53 @@ static inline bool dw_mci_fifo_reset(struct 
  dw_mci *host)
  host-sg = NULL;
  }
 
  -   return dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
  +   /*
  +* The recommended method for resetting is to always reset the
  +* controller and the fifo, but differs slightly depending on 
  the mode.
  +* Note that this doesn't handle the generic DMA (not IDMAC) 
  case.
  +*/
 
  not IDMAC is confused..
 
 
  The documentation describes three different possible modes.  There's a
  mode that doesn't use IDMAC but still does DMA.  But as far as I can
  tell this driver doesn't support that way.  We can just remove that
  wording if it's confusing.
 
  How did it know whether dma is generic DMA or not?
 
 
 That's a good question.  I wasn't sure whether the driver supported it
 or not.  It looks like it definitely supports IDMAC through the
 CONFIG_MMC_DW_IDMAC flag, but I wasn't sure if it was supported the
 generic dma.  Maybe if CONFIG_MMC_DW_IDMAC isn't specified but
 host-dma_ops is not NULL then we are using the generic dma mode.
 
 
  +   if (dw_mci_ctrl_reset(host, SDMMC_CTRL_RESET | 
  SDMMC_CTRL_FIFO_RESET)) {
  +   unsigned long timeout = jiffies + 
  msecs_to_jiffies(500);
  +   u32 status, rint;
  +
  +   /* if using dma we wait for dma_req to clear */
  +   if (host-using_dma) {
  +   do {
  +   status = mci_readl(host, STATUS);
  +   if (!(status  SDMMC_STATUS_DMA_REQ))
  +   break;
  +   cpu_relax();
  +   } while (time_before(jiffies, timeout));
  +
  +   if (status  SDMMC_STATUS_DMA_REQ)
  +   dev_err(host-dev,
  +   %s: Timeout waiting for 
  dma_req to 
  +   clear during reset, 
  __func__);
  +
  +   /* when using DMA next we reset the fifo again 
  */
  +   dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
  +   }
  +   /*
  +* In all cases we clear the RAWINTS register to clear 
  any
  +* interrupts.
  +*/
  +   rint = mci_readl(host, RINTSTS);
  +   rint = rint  (~mci_readl(host, MINTSTS));
  you use the status or temp instead of rint. (you can reuse the variable.)
  And can use status = ~mci_readl(host,MINTSTS);
 
 
  Just clear the RINTSTS register? why do you add these?
 
 
  This will look at what is not masked, and only clear those bits.
  Well, i known if clear the RINTSTS register,
  recommended to use 0xfff and set the value for interrupt.
 
  Can be used 0xfff?
 
 
 Yeah we probably can.  We just lose information about interrupts that
 were masked, but maybe we just don't care about any of them anyway, so
 it doesn't matter.
 
  Best Regards,
  Jaehoon Chung
 
 
  +   if (rint)
  +   mci_writel(host, RINTSTS, rint);
  +
  +   } else
  +   dev_err(host-dev, %s: Reset bits didn't clear, 
  __func__);
 
  Just display the error log? I didn't understand this.
  If you displayed the error log, then 

RE: [PATCH] mmc: dw_mmc: Make sure we don't get stuck when we get an error

2014-05-10 Thread Seungwon Jeon
On Fri, May 09, 2014, Sonny Rao wrote:
 On Thu, May 8, 2014 at 2:42 AM, Yuvaraj Kumar yuvaraj...@gmail.com wrote:
  Any comments on this patch?
 
 
 I'll just add that without this fix, running the tuning loop for UHS
 modes is not reliable on dw_mmc because errors will happen and you
 will eventually hit this race and hang.  This can happen any time
 there is tuning like during boot or during resume from suspend.
 
  On Thu, Mar 27, 2014 at 11:48 AM, Yuvaraj Kumar C D
  yuvaraj...@gmail.com wrote:
  From: Doug Anderson diand...@chromium.org
 
  If we happened to get a data error at just the wrong time the dw_mmc
  driver could get into a state where it would never complete its
  request.  That would leave the caller just hanging there.
 
  We fix this two ways and both of the two fixes on their own appear to
  fix the problems we've seen:
 
  1. Fix a race in the tasklet where the interrupt setting the data
 error happens _just after_ we check for it, then we get a
 EVENT_XFER_COMPLETE.  We fix this by repeating a bit of code.
I think repeating is not good approach to fix race.
In your case, XFER_COMPLETE preceded data error and DTO didn't come?
It seems strange case.
I want to know actual error value if you can reproduce.

  2. Fix it so that if we detect that we've got an error in the data
 busy state and we're not going to do anything else we end the
 request and unblock anyone waiting.
 
  Signed-off-by: Doug Anderson diand...@chromium.org
  Signed-off-by: Yuvaraj Kumar C D yuvaraj...@gmail.com
  ---
   drivers/mmc/host/dw_mmc.c |   47 
  +
   1 file changed, 47 insertions(+)
 
  diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
  index 1d77431..4c589f1 100644
  --- a/drivers/mmc/host/dw_mmc.c
  +++ b/drivers/mmc/host/dw_mmc.c
  @@ -1300,6 +1300,14 @@ static void dw_mci_tasklet_func(unsigned long priv)
  /* fall through */
 
  case STATE_SENDING_DATA:
  +   /*
  +* We could get a data error and never a transfer
  +* complete so we'd better check for it here.
  +*
  +* Note that we don't really care if we also got a
  +* transfer complete; stopping the DMA and sending 
  an
  +* abort won't hurt.
  +*/
  if (test_and_clear_bit(EVENT_DATA_ERROR,
 host-pending_events)) {
  dw_mci_stop_dma(host);
  @@ -1313,7 +1321,29 @@ static void dw_mci_tasklet_func(unsigned long priv)
  break;
 
  set_bit(EVENT_XFER_COMPLETE, 
  host-completed_events);
  +
  +   /*
  +* Handle an EVENT_DATA_ERROR that might have 
  shown up
  +* before the transfer completed.  This might not 
  have
  +* been caught by the check above because the 
  interrupt
  +* could have gone off between the previous check 
  and
  +* the check for transfer complete.
  +*
  +* Technically this ought not be needed assuming we
  +* get a DATA_COMPLETE eventually (we'll notice the
  +* error and end the request), but it shouldn't 
  hurt.
  +*
  +* This has the advantage of sending the stop 
  command.
  +*/
  +   if (test_and_clear_bit(EVENT_DATA_ERROR,
  +  host-pending_events)) {
  +   dw_mci_stop_dma(host);
  +   send_stop_abort(host, data);
  +   state = STATE_DATA_ERROR;
  +   break;
  +   }
  prev_state = state = STATE_DATA_BUSY;
  +
  /* fall through */
 
  case STATE_DATA_BUSY:
  @@ -1336,6 +1366,23 @@ static void dw_mci_tasklet_func(unsigned long priv)
  /* stop command for open-ended transfer*/
  if (data-stop)
  send_stop_abort(host, data);
  +   } else {
  +   /*
  +* If we don't have a command complete now 
  we'll
  +* never get one since we just reset 
  everything;
  +* better end the request.
  +*
  +* If we do have a command complete we'll 
  fall
  +* through to the SENDING_STOP 

Re: [PATCH v2 0/6] usb: host: Cleanup for ioremap'ing hcd memory

2014-05-10 Thread Alexander Shiyan
Sat, 10 May 2014 17:30:04 +0530 от Vivek Gautam gautam.vi...@samsung.com:
 Based on 'usb-next' branch of Greg's usb tree.
 
 devm_ioremap_resource() API is advantageous over devm_ioremap()
 and should therefore be preferred to request any ioremap'ed address
 for hcd.
 
 Changes from v1:
  - Changed the way returned pointer is checked for error value
as pointed out in the review comment in the mailing list.

hcd-rsrc_len field can be removed entirely, since I cannot find any reason
how this filed can be used in the drivers now.
This is of course should be in an another series. This one looks good.

---



Re: [PATCH 5/6] usb: host: ehci-tegra: Use devm_ioremap_resource instead of devm_ioremap

2014-05-10 Thread Sergei Shtylyov

Hello.

On 05/10/2014 01:57 PM, Vivek Gautam wrote:


Using devm_ioremap_resource() API should actually be preferred over
devm_ioremap(), since the former request the mem region first and then
gives back the ioremap'ed memory pointer.
devm_ioremap_resource() calls request_mem_region(), therby preventing
other drivers to make any overlapping call to the same region.



Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
  drivers/usb/host/ehci-tegra.c |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)



diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 572634c..ccc6433 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -411,9 +411,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
}
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
-   hcd-regs = devm_ioremap(pdev-dev, res-start, resource_size(res));
+   hcd-regs = devm_ioremap_resource(pdev-dev, res);
if (!hcd-regs) {


   This has to be changed as well as devm_ioremap_resource() returns error, 
not NULL.



-   dev_err(pdev-dev, Failed to remap I/O memory\n);
err = -ENOMEM;


   This needs to be changed as well, to pass up the error code 
devm_ioremap_resource() returned.


WBR, Sergei

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