[PATCH] ARM: samsung: use #include for all device trees

2013-05-07 Thread Padmavathi Venna
Replace /include/ (dtc) with #include (C pre-processor) for all
Samsung DT files

Signed-off-by: Padmavathi Venna padm...@samsung.com
---

This patch is dependent on below patches by Stephen Warren
http://www.spinics.net/lists/linux-kbuild/msg07616.html

 arch/arm/boot/dts/exynos4.dtsi|2 +-
 arch/arm/boot/dts/exynos4210-origen.dts   |2 +-
 arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +-
 arch/arm/boot/dts/exynos4210-trats.dts|2 +-
 arch/arm/boot/dts/exynos4210.dtsi |4 ++--
 arch/arm/boot/dts/exynos4212.dtsi |2 +-
 arch/arm/boot/dts/exynos4412-odroidx.dts  |2 +-
 arch/arm/boot/dts/exynos4412-origen.dts   |2 +-
 arch/arm/boot/dts/exynos4412-smdk4412.dts |2 +-
 arch/arm/boot/dts/exynos4412.dtsi |2 +-
 arch/arm/boot/dts/exynos4x12.dtsi |4 ++--
 arch/arm/boot/dts/exynos5250-arndale.dts  |2 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +-
 arch/arm/boot/dts/exynos5250-snow.dts |4 ++--
 arch/arm/boot/dts/exynos5250.dtsi |4 ++--
 arch/arm/boot/dts/exynos5440-sd5v1.dts|2 +-
 arch/arm/boot/dts/exynos5440-ssdk5440.dts |2 +-
 arch/arm/boot/dts/exynos5440.dtsi |2 +-
 18 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index efd441a..e6f4261 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -19,7 +19,7 @@
  * published by the Free Software Foundation.
  */
 
-/include/ skeleton.dtsi
+#include skeleton.dtsi
 
 / {
interrupt-parent = gic;
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
b/arch/arm/boot/dts/exynos4210-origen.dts
index 8b0a781..8d7a9e5 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -15,7 +15,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4210.dtsi
+#include exynos4210.dtsi
 
 / {
model = Insignal Origen evaluation board based on Exynos4210;
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts 
b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 91332b7..9c01b71 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -15,7 +15,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4210.dtsi
+#include exynos4210.dtsi
 
 / {
model = Samsung smdkv310 evaluation board based on Exynos4210;
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts 
b/arch/arm/boot/dts/exynos4210-trats.dts
index 9a14484..94eebff 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -13,7 +13,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4210.dtsi
+#include exynos4210.dtsi
 
 / {
model = Samsung Trats based on Exynos4210;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 5d925ed..e9f878e 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -19,8 +19,8 @@
  * published by the Free Software Foundation.
 */
 
-/include/ exynos4.dtsi
-/include/ exynos4210-pinctrl.dtsi
+#include exynos4.dtsi
+#include exynos4210-pinctrl.dtsi
 
 / {
compatible = samsung,exynos4210;
diff --git a/arch/arm/boot/dts/exynos4212.dtsi 
b/arch/arm/boot/dts/exynos4212.dtsi
index 36d4299..c7a9193 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -17,7 +17,7 @@
  * published by the Free Software Foundation.
 */
 
-/include/ exynos4x12.dtsi
+#include exynos4x12.dtsi
 
 / {
compatible = samsung,exynos4212;
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts 
b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 15dc0a3..9f7f467 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -12,7 +12,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4412.dtsi
+#include exynos4412.dtsi
 
 / {
model = Hardkernel ODROID-X board based on Exynos4412;
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts 
b/arch/arm/boot/dts/exynos4412-origen.dts
index 65e9c57..cfc6208 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -13,7 +13,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4412.dtsi
+#include exynos4412.dtsi
 
 / {
model = Insignal Origen evaluation board based on Exynos4412;
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts 
b/arch/arm/boot/dts/exynos4412-smdk4412.dts
index c52b01f..1e816fa 100644
--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts
+++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts
@@ -13,7 +13,7 @@
 */
 
 /dts-v1/;
-/include/ exynos4412.dtsi
+#include exynos4412.dtsi
 
 / {
model = Samsung SMDK evaluation board based on Exynos4412;
diff --git a/arch/arm/boot/dts/exynos4412.dtsi 
b/arch/arm/boot/dts/exynos4412.dtsi
index 7f42827..fae4f81 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -17,7 +17,7 @@
  * published by the Free Software Foundation.
 */
 
-/include/ exynos4x12.dtsi
+#include 

[PATCH V2 0/3] clk: Samsung: audss: Register audio subsytem clocks using common clk framework

2013-05-07 Thread Padmavathi Venna
Samsung S5PV210 and Exynos SoC has a separate subsystem for audio. This 
subsystem
has a internal clock controller which controls i2s0 and pcm0 clocks. This patch
series adds the Samsung audio subsytem clock to the common clock framework and
provides the I2S controllers clock information in the dtsi file.

This patch series is dependent on 
https://patchwork.kernel.org/patch/2532091/
http://www.spinics.net/lists/linux-kbuild/msg07616.html

This patch series is made based on Kukjin Kim for-next branch

Changes since V1:
- Reworked on all review comments by Sylwester Nawrocki
- Added a header file for all clock indexes as requested by Sylwester
- Added different compatible names for s5pv210, exynos4 and exynos5
- Registered the pcm clocks with common clock framework

Padmavathi Venna (3):
  clk: samsung: register audio subsystem clocks using common clock
framework
  ARM: dts: add Exynos audio subsystem clock controller node
  ARM: dts: add clock provider information for i2s controllers in
Exynos5250

 .../bindings/clock/clk-samsung-audss.txt   |   64 +
 arch/arm/boot/dts/exynos5250.dtsi  |   16 +++
 drivers/clk/samsung/Makefile   |1 +
 drivers/clk/samsung/clk-samsung-audss.c|  137 
 include/dt-bindings/clk/samsung-audss-clk.h|   25 
 5 files changed, 243 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/clk-samsung-audss.txt
 create mode 100644 drivers/clk/samsung/clk-samsung-audss.c
 create mode 100644 include/dt-bindings/clk/samsung-audss-clk.h

-- 
1.7.4.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/3] clk: samsung: register audio subsystem clocks using common clock framework

2013-05-07 Thread Padmavathi Venna
Audio subsystem is introduced in s5pv210 and exynos platforms.
This has seperate clock controller which can control i2s0 and
pcm0 clocks. This patch registers the audio subsystem clocks
with the common clock framework.

Signed-off-by: Padmavathi Venna padm...@samsung.com
---
 .../bindings/clock/clk-samsung-audss.txt   |   64 +
 drivers/clk/samsung/Makefile   |1 +
 drivers/clk/samsung/clk-samsung-audss.c|  137 
 include/dt-bindings/clk/samsung-audss-clk.h|   25 
 4 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/clk-samsung-audss.txt
 create mode 100644 drivers/clk/samsung/clk-samsung-audss.c
 create mode 100644 include/dt-bindings/clk/samsung-audss-clk.h

diff --git a/Documentation/devicetree/bindings/clock/clk-samsung-audss.txt 
b/Documentation/devicetree/bindings/clock/clk-samsung-audss.txt
new file mode 100644
index 000..ec2cd0b
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/clk-samsung-audss.txt
@@ -0,0 +1,64 @@
+* Samsung Audio Subsystem Clock Controller
+
+The Samsung Audio Subsystem clock controller generates and supplies clocks
+to Audio Subsystem block available in the S5PV210 and Exynos SoCs. The clock
+binding described here is applicable to all SoC's in the S5PV210 and Exynos
+family.
+
+Required Properties:
+
+- compatible: should be one of the following:
+  - samsung,s5pv210-audss-clock - controller compatible with all S5PV210 
SoCs.
+  - samsung,exynos4210-audss-clock - controller compatible with all Exynos4 
SoCs.
+  - samsung,exynos5250-audss-clock - controller compatible with all Exynos5 
SoCs.
+
+- reg: physical base address and length of the controller's register set.
+
+- #clock-cells: should be 1.
+
+The following is the list of clocks generated by the controller. Each clock is
+assigned an identifier and client nodes use this identifier to specify the
+clock which they consume. Some of the clocks are available only on a particular
+Exynos4 SoC and this is specified where applicable.
+
+Provided clocks:
+
+Clock   ID  SoC (if specific)
+---
+
+mout_audss  0
+mout_i2s1
+dout_srp2
+dout_bus3
+dout_i2s4
+srp_clk 5
+i2s_bus 6
+sclk_i2s7
+pcm_bus 8
+sclk_pcm9
+
+Example 1: An example of a clock controller node is listed below.
+
+clock_audss: audss-clock-controller@0381 {
+   compatible = samsung,exynos5250-audss-clock;
+   reg = 0x0381 0x0C;
+   #clock-cells = 1;
+};
+
+Example 2: I2S controller node that consumes the clock generated by the clock
+   controller. Refer to the standard clock bindings for information
+   about 'clocks' and 'clock-names' property.
+
+ i2s0: i2s@0383 {
+   compatible = samsung,i2s-v5;
+   reg = 0x0383 0x100;
+   dmas = pdma0 10
+   pdma0 9
+   pdma0 8;
+   dma-names = tx, rx, tx-sec;
+   clocks = clock_audss SAMSUNG_I2S_BUS,
+   clock_audss SAMSUNG_I2S_BUS,
+   clock_audss SAMSUNG_SCLK_I2S;
+   clock-names = iis, i2s_opclk0, i2s_opclk1;
+};
+
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index b7c232e..5425fa8 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_COMMON_CLK)+= clk.o clk-pll.o
 obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
 obj-$(CONFIG_SOC_EXYNOS5250)   += clk-exynos5250.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
+obj-$(CONFIG_PLAT_SAMSUNG) += clk-samsung-audss.o
diff --git a/drivers/clk/samsung/clk-samsung-audss.c 
b/drivers/clk/samsung/clk-samsung-audss.c
new file mode 100644
index 000..97526b7
--- /dev/null
+++ b/drivers/clk/samsung/clk-samsung-audss.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Padmavathi Venna padm...@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.
+ *
+ * Common Clock Framework support for Audio Subsystem Clock Controller.
+*/
+
+#include linux/clkdev.h
+#include linux/io.h
+#include linux/clk-provider.h
+#include linux/of_address.h
+#include linux/syscore_ops.h
+
+#include dt-bindings/clk/samsung-audss-clk.h
+
+static DEFINE_SPINLOCK(lock);
+static struct clk **clk_table;
+static void __iomem *reg_base;
+static struct clk_onecell_data clk_data;
+
+#define ASS_CLK_SRC 0x0
+#define ASS_CLK_DIV 0x4
+#define ASS_CLK_GATE 0x8
+
+static unsigned long reg_save[][2] = {
+   {ASS_CLK_SRC,  0},
+   {ASS_CLK_DIV,  0},
+   {ASS_CLK_GATE, 0},
+};
+
+/* list of all parent clock list */
+static const char *mout_audss_p[] = { fin_pll, 

[PATCH V2 2/3] ARM: dts: add Exynos audio subsystem clock controller node

2013-05-07 Thread Padmavathi Venna
Audio subsystem introduced in s5pv210 and exynos platforms
which has a internal clock controller. This patch adds a node
for the same on exynos5250.

Signed-off-by: Padmavathi Venna padm...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 36c9d8d..7026de0 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -72,6 +72,12 @@
#clock-cells = 1;
};
 
+   clock_audss: audss-clock-controller@0x0381 {
+   compatible = samsung,exynos5250-audss-clock;
+   reg = 0x0381 0x0C;
+   #clock-cells = 1;
+   };
+
gic:interrupt-controller@10481000 {
compatible = arm,cortex-a15-gic, arm,cortex-a9-gic;
#interrupt-cells = 3;
-- 
1.7.4.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/3] ARM: dts: add clock provider information for i2s controllers in Exynos5250

2013-05-07 Thread Padmavathi Venna
Add clock lookup information for i2s controllers on exynos5250 SoC.

Signed-off-by: Padmavathi Venna padm...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 7026de0..13305b9 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -20,6 +20,8 @@
 #include skeleton.dtsi
 #include exynos5250-pinctrl.dtsi
 
+#include dt-bindings/clk/samsung-audss-clk.h
+
 / {
compatible = samsung,exynos5250;
interrupt-parent = gic;
@@ -457,6 +459,10 @@
pdma0 9
pdma0 8;
dma-names = tx, rx, tx-sec;
+   clocks = clock_audss SAMSUNG_I2S_BUS,
+   clock_audss SAMSUNG_I2S_BUS,
+   clock_audss SAMSUNG_SCLK_I2S;
+   clock-names = iis, i2s_opclk0, i2s_opclk1;
samsung,supports-6ch;
samsung,supports-rstclr;
samsung,supports-secdai;
@@ -471,6 +477,8 @@
dmas = pdma1 12
pdma1 11;
dma-names = tx, rx;
+   clocks = clock 307;
+   clock-names = iis;
pinctrl-names = default;
pinctrl-0 = i2s1_bus;
};
@@ -481,6 +489,8 @@
dmas = pdma0 12
pdma0 11;
dma-names = tx, rx;
+   clocks = clock 308;
+   clock-names = iis;
pinctrl-names = default;
pinctrl-0 = i2s2_bus;
};
-- 
1.7.4.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: [RFC PATCH V2] ARM: EXYNOS: Fix hotplug when CPUs boot in HYP mode

2013-05-07 Thread Marc Zyngier
On 07/05/13 06:54, Giridhar Maruthy wrote:
 This patch is a modification from the Christoffer Dall's u-boot
 patch. This is required to put the secondary processors in hyp
 mode during cpu hotplug when u-boot is no longer alive.
 
 Marc Zyngier suggested this logic to go into firmware or, u-boot
 putting a trampoline code into a page /memreserve/d by DT. But
 this seemed to have a problem. Once the cpu is hotplugged in
 runtime, the control is in ROM code and waits for event.
 Kernel provides a return address in kernel to which the processor
 jumps once it gets an event. If the control branches to the
 trampoline code here, this trampoline code has no kernel return
 address.
 
 Someone with better logic or better placement of this logic
 elsewhere is welcome.

What prevents you from writing the kernel address in the memreserved
page? Some obvious location, like the last word of the page? You only
have to do it once (from the boot CPU, for example).

Or did I miss something else?

M.
-- 
Jazz is not dead. It just smells funny...

--
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] ASoC: Samsung: i2s: Fix crash in i2s driver

2013-05-07 Thread Mark Brown
On Tue, May 07, 2013 at 09:09:01AM +0530, Padmavathi Venna wrote:
 This patch fixes a null pointer deference in i2s driver in DT
 case
 
 Signed-off-by: Padmavathi Venna padm...@samsung.com
 ---
 
 This patch is dependent on below patch posted by Thomas Abraham.
 https://patchwork.kernel.org/patch/2224801/

Please don't submit patches that can't be applied, the two patches need
to be submitted together.  Please also remember to include human
readable descriptions of patches in e-mails for the benefit of human
readers, commit IDs and URLs aren't immediately comprehensible.

Please further note my new e-mail address.


signature.asc
Description: Digital signature


Re: [PATCH V2 2/3] ARM: dts: add Exynos audio subsystem clock controller node

2013-05-07 Thread Tomasz Figa
Hi Padmavathi,

On Tuesday 07 of May 2013 12:13:35 Padmavathi Venna wrote:
 Audio subsystem introduced in s5pv210 and exynos platforms
 which has a internal clock controller. This patch adds a node
 for the same on exynos5250.
 
 Signed-off-by: Padmavathi Venna padm...@samsung.com
 ---
  arch/arm/boot/dts/exynos5250.dtsi |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi
 b/arch/arm/boot/dts/exynos5250.dtsi index 36c9d8d..7026de0 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -72,6 +72,12 @@
   #clock-cells = 1;
   };
 
 + clock_audss: audss-clock-controller@0x0381 {

Just a nitpick: this should be @381, without the 0x and leading zeroes.

Best regards,
-- 
Tomasz Figa
Samsung Poland RD Center
SW Solution Development, Kernel and System Framework

 + compatible = samsung,exynos5250-audss-clock;
 + reg = 0x0381 0x0C;
 + #clock-cells = 1;
 + };
 +
   gic:interrupt-controller@10481000 {
   compatible = arm,cortex-a15-gic, arm,cortex-a9-gic;
   #interrupt-cells = 3;

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


Re: [PATCH V2 01/20] thermal: exynos: Moving exynos thermal files into samsung directory

2013-05-07 Thread Tomasz Figa
On Monday 06 of May 2013 23:05:06 Zhang Rui wrote:
 On Fri, 2013-04-26 at 16:07 +0530, Amit Daniel Kachhap wrote:
  This movement of files is done for easy maintenance and adding more
  new sensor's support for exynos platform easily . This will also help in
  bifurcating exynos common, sensor driver and sensor data related parts.
  
  Acked-by: Kukjin Kim kgene@samsung.com
  Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
  ---
  
   drivers/thermal/Kconfig|   13 +
   drivers/thermal/Makefile   |2 +-
   drivers/thermal/samsung/Kconfig|9 +
   drivers/thermal/samsung/Makefile   |4 
   drivers/thermal/{ = samsung}/exynos_thermal.c |0
   5 files changed, 19 insertions(+), 9 deletions(-)
   create mode 100644 drivers/thermal/samsung/Kconfig
   create mode 100644 drivers/thermal/samsung/Makefile
   rename drivers/thermal/{ = samsung}/exynos_thermal.c (100%)
  
  diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
  index 5e3c025..081ddc5 100644
  --- a/drivers/thermal/Kconfig
  +++ b/drivers/thermal/Kconfig
  @@ -114,14 +114,6 @@ config KIRKWOOD_THERMAL
  
Support for the Kirkwood thermal sensor driver into the Linux thermal
framework. Only kirkwood 88F6282 and 88F6283 have this sensor.
  
  -config EXYNOS_THERMAL
  -   tristate Temperature sensor on Samsung EXYNOS
  -   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
  -   depends on CPU_THERMAL
  -   help
  - If you say yes here you get support for TMU (Thermal Management
  - Unit) on SAMSUNG EXYNOS series of SoC.
  -
  
   config DOVE_THERMAL
   
  tristate Temperature sensor on Marvell Dove SoCs
  depends on ARCH_DOVE
  
  @@ -169,4 +161,9 @@ config INTEL_POWERCLAMP
  
enforce idle time which results in more package C-state residency. The
user interface is exposed via generic thermal framework.
  
  +menu Exynos thermal drivers
 
 would it be more proper to use Samsung thermal drivers or Samsung
 Exynos thermal drivers instead?

+1

Still, I wonder if it really makes sense to create a separate directory and 
submenu for this.

  +depends on PLAT_SAMSUNG
  +source drivers/thermal/samsung/Kconfig
  +endmenu
  +
 
 sorry I know few about arm,
 could you tell me the difference between
 CONFIG_ARCH_EXYNOS4/CONFIG_ARCH_EXYNOS5 and CONFIG_PLAT_SAMSUNG please,
 I do not see the dependency between these in Kconfig file?

If those files were kept at thermal/, there would be no need for this check. 
Just particular drivers would depend on platform they are for.

Best regards,
-- 
Tomasz Figa
Samsung Poland RD Center
SW Solution Development, Kernel and System Framework
 
   endif
  
  diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
  index c054d41..b3063a9 100644
  --- a/drivers/thermal/Makefile
  +++ b/drivers/thermal/Makefile
  @@ -17,7 +17,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
  
   obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
   obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
   obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
  
  -obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
  +obj-y  += samsung/
  
   obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
   obj-$(CONFIG_DB8500_THERMAL)   += db8500_thermal.o
   obj-$(CONFIG_ARMADA_THERMAL)   += armada_thermal.o
  
  diff --git a/drivers/thermal/samsung/Kconfig
  b/drivers/thermal/samsung/Kconfig new file mode 100644
  index 000..2d3d9dc
  --- /dev/null
  +++ b/drivers/thermal/samsung/Kconfig
  @@ -0,0 +1,9 @@
  +config EXYNOS_THERMAL
  +   tristate Temperature sensor on Samsung EXYNOS
  +   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
  +   depends on CPU_THERMAL
  +   help
  + If you say yes here you get support for TMU (Thermal Management
  + Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
  + the exynos thermal driver with the core thermal layer and cpu
  + cooling API's.
  diff --git a/drivers/thermal/samsung/Makefile
  b/drivers/thermal/samsung/Makefile new file mode 100644
  index 000..1fe6d93
  --- /dev/null
  +++ b/drivers/thermal/samsung/Makefile
  @@ -0,0 +1,4 @@
  +#
  +# Samsung thermal specific Makefile
  +#
  +obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
  diff --git a/drivers/thermal/exynos_thermal.c
  b/drivers/thermal/samsung/exynos_thermal.c similarity index 100%
  rename from drivers/thermal/exynos_thermal.c
  rename to drivers/thermal/samsung/exynos_thermal.c
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc
 in the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


Re: [PATCH] ASoC: Samsung: i2s: Fix crash in i2s driver

2013-05-07 Thread Padma Venkat
Hi Tomasz,

On Tue, May 7, 2013 at 3:20 PM, Tomasz Figa t.f...@samsung.com wrote:
 Hi Padmavathi,

 On Tuesday 07 of May 2013 09:09:01 Padmavathi Venna wrote:
 This patch fixes a null pointer deference in i2s driver in DT
 case

 Signed-off-by: Padmavathi Venna padm...@samsung.com
 ---

 This patch is dependent on below patch posted by Thomas Abraham.
 https://patchwork.kernel.org/patch/2224801/

  sound/soc/samsung/i2s.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
 index 7ce7c50..eaf6439 100644
 --- a/sound/soc/samsung/i2s.c
 +++ b/sound/soc/samsung/i2s.c
 @@ -1182,7 +1182,7 @@ static int samsung_i2s_probe(struct platform_device
 *pdev) pri_dai-sec_dai = sec_dai;
   }

 - if (i2s_pdata-cfg_gpio  i2s_pdata-cfg_gpio(pdev)) {
 + if (i2s_pdata  i2s_pdata-cfg_gpio  i2s_pdata-cfg_gpio(pdev)) {

 This is a problem that needs to be fixed indeed. However the same problem
 exists in samsung_i2s_remove() as well (at least in latest linux-next).

This will go off once Thomas ASoC: samsung: let device core setup the
default pin configuration
patch get merged.


 This makes me wonder what happens with i2s_pdata in DT case. Most of drivers
 allocate a pdata struct anyway and fill it with data parsed from device tree.
 This allows rest of the code to remain unmodified and consider DT and non-DT
 cases equal.

This driver doesn't allocate the i2s_pdata in DT case. It directly
parse the information form DT file
and assign that information to i2s_dai.

Thanks
Padma


 Best regards,
 --
 Tomasz Figa
 Samsung Poland RD Center
 SW Solution Development, Kernel and System Framework

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


Re: [PATCH V2 2/3] ARM: dts: add Exynos audio subsystem clock controller node

2013-05-07 Thread Padma Venkat
Hi Tomasz,

On Tue, May 7, 2013 at 3:24 PM, Tomasz Figa t.f...@samsung.com wrote:
 Hi Padmavathi,

 On Tuesday 07 of May 2013 12:13:35 Padmavathi Venna wrote:
 Audio subsystem introduced in s5pv210 and exynos platforms
 which has a internal clock controller. This patch adds a node
 for the same on exynos5250.

 Signed-off-by: Padmavathi Venna padm...@samsung.com
 ---
  arch/arm/boot/dts/exynos5250.dtsi |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/exynos5250.dtsi
 b/arch/arm/boot/dts/exynos5250.dtsi index 36c9d8d..7026de0 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -72,6 +72,12 @@
   #clock-cells = 1;
   };

 + clock_audss: audss-clock-controller@0x0381 {

 Just a nitpick: this should be @381, without the 0x and leading zeroes.

Okey. I will change this.


 Best regards,
 --
 Tomasz Figa
 Samsung Poland RD Center
 SW Solution Development, Kernel and System Framework

 + compatible = samsung,exynos5250-audss-clock;
 + reg = 0x0381 0x0C;
 + #clock-cells = 1;
 + };
 +
   gic:interrupt-controller@10481000 {
   compatible = arm,cortex-a15-gic, arm,cortex-a9-gic;
   #interrupt-cells = 3;

Thanks
Padma
--
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] usb: gadget: s3c2410_udc: fix error return code in s3c2410_udc_probe()

2013-05-07 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fix to return a negative error code in the gpio_to_irq() error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/usb/gadget/s3c2410_udc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index d0e75e1..c974776 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1851,6 +1851,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
irq = gpio_to_irq(udc_info-vbus_pin);
if (irq  0) {
dev_err(dev, no irq for gpio vbus pin\n);
+   retval = irq;
goto err_gpio_claim;
}
 

--
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 v8] i2c: exynos5: add High Speed I2C controller driver

2013-05-07 Thread Sachin Kamat
On 7 May 2013 08:20, Naveen Krishna Chatradhi
naveenkrishna...@gmail.com wrote:
 From: Naveen Krishna Chatradhi ch.nav...@samsung.com

 Adds support for High Speed I2C driver found in Exynos5 and
 later SoCs from Samsung.

 Driver only supports Device Tree method.

 Changes since v1:
 1. Added FIFO functionality
 2. Added High speed mode functionality
 3. Remove SMBUS_QUICK
 4. Remove the debugfs functionality
 5. Use devm_* functions where ever possible
 6. Driver is free from GPIO configs
 7. Use OF data string clock-frequency to get the bus operating frequencies
 8. Split the clock divisor calculation function
 9. Add resets for the failed transacton cases
 10. few other bug fixes and cosmetic changes

 Signed-off-by: Taekgyun Ko taeggyun...@samsung.com
 Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com
 Reviewed-by: Simon Glass s...@google.com
 Tested-by: Andrew Bresticker abres...@google.com
 Signed-off-by: Yuvaraj Kumar C D yuvaraj...@samsung.com
 Signed-off-by: Andrew Bresticker abres...@google.com
 ---
 Changes since v7:
 1. used devm_ioremap_resource for register base address
 2. merged FIFO fix from Yuvaraj
https://patchwork.kernel.org/patch/2420351/
 3. merged hsi2c clock config patch from Yuvaraj
https://patchwork.kernel.org/patch/2464681/

  .../devicetree/bindings/i2c/i2c-exynos5.txt|   41 +
  drivers/i2c/busses/Kconfig |7 +
  drivers/i2c/busses/Makefile|1 +
  drivers/i2c/busses/i2c-exynos5.c   |  888 
 
  4 files changed, 937 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-exynos5.txt
  create mode 100644 drivers/i2c/busses/i2c-exynos5.c

 diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt 
 b/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt
 new file mode 100644
 index 000..6e613b6
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt
 @@ -0,0 +1,41 @@
 +* Samsung's High Speed I2C controller
 +
 +The Samsung's High Speed I2C controller is used to interface with I2C devices
 +at various speeds ranging from 100khz to 3.4Mhz.
 +
 +Required properties:
 +  - compatible: value should be.
 +  (a) samsung,exynos5-hsi2c, for i2c compatible with exynos5 hsi2c.

Since this is the only string supported as of now, (a) could be dropped.

 +  - reg: physical base address of the controller and length of memory mapped
 +region.
 +  - interrupts: interrupt number to the cpu.
 +
 +  - Pinctrl variant (preferred, if available):

Is the non-pinctrl variant still supported?

 +- pinctrl-0: Pin control group to be used for this controller.
 +- pinctrl-names: Should contain only one value - default.

What about address-cells and size-cells property?

 +
 +Optional properties:
 +  - samsung,hs-mode: Mode of operation, High speed or Fast speed mode. If not
 +specified, default value is 0.
 +  - clock-frequency: Desired operating frequency in Hz of the bus.
 +If not specified, the default value in Hz is 10.
 +
 +Example:
 +
 +   hsi2c@12ca {
 +   compatible = samsung,exynos5-hsi2c;
 +   reg = 0x12ca 0x100;
 +   interrupts = 56;
 +   clock-frequency = 10;
 +   /* Pinctrl variant begins here */
 +   pinctrl-0 = i2c4_bus;
 +   pinctrl-names = default;
 +   /* Pinctrl variant ends here */
 +   #address-cells = 1;
 +   #size-cells = 0;
 +
 +   s2mps11_pmic@66 {
 +   compatible = samsung,s2mps11-pmic;
 +   reg = 0x66;
 +   };
 +   };

[snip]

 +static int exynos5_i2c_probe(struct platform_device *pdev)
 +{
 +   struct device_node *np = pdev-dev.of_node;
 +   struct exynos5_i2c *i2c;
 +   struct resource *mem;
 +   int ret;
 +
 +   if (!np) {
 +   dev_err(pdev-dev, no device node\n);
 +   return -ENOENT;
 +   }
 +
 +   i2c = devm_kzalloc(pdev-dev, sizeof(struct exynos5_i2c), 
 GFP_KERNEL);
 +   if (!i2c) {
 +   dev_err(pdev-dev, no memory for state\n);
 +   return -ENOMEM;
 +   }
 +
 +   /* Mode of operation High/Fast Speed mode */
 +   if (of_get_property(np, samsung,hs-mode, NULL)) {
 +   i2c-speed_mode = HSI2C_HIGH_SPD;
 +   i2c-fs_clock = HSI2C_FS_TX_CLOCK;
 +   if (of_property_read_u32(np, clock-frequency, 
 i2c-hs_clock))
 +   i2c-hs_clock = HSI2C_HS_TX_CLOCK;
 +   } else {
 +   i2c-speed_mode = HSI2C_FAST_SPD;
 +   if (of_property_read_u32(np, clock-frequency, 
 i2c-fs_clock))
 +   i2c-fs_clock = HSI2C_FS_TX_CLOCK;
 +   }
 +
 +   strlcpy(i2c-adap.name, exynos5-i2c, sizeof(i2c-adap.name));
 +   i2c-adap.owner   = THIS_MODULE;
 +   i2c-adap.algo= exynos5_i2c_algorithm;
 +   

[PATCH V3 0/20] thermal: exynos: Add thermal driver for exynos5440

2013-05-07 Thread Amit Daniel Kachhap
Changes in V3:
* Added proper dependency of different exynos thermal Kconfig symbols. 
Basically 3
 Kconfig can be enabled now and corresponds to tmu driver. exynos common part
 and exynos configuration data. This issue was raised by Rui Zhang.

Changes in V2:
* Separated SOC data from TMU driver. This is as per suggestion from Eduardo.
* Merged the new file created for exynos5440 TMU controller with the existing
 TMU controller code.
* Removed the DT parsing code as now the SOC specific data are cleanly put
 inside the data specific file.
* Even the register definations/bitfields are treated as data as there is
 some variation across SOC's.

This patchset adds TMU(Thermal management Unit) driver support for
exynos5440 platform. There are 3 instances of the TMU controllers so
necessary cleanup/re-structure is done to handle multiple thermal zone.

Patch (exynos4: Add documentation for Exynos SoC thermal bindings) from
Lukasz Majewski is already posted to mainline. Adding it here for completeness.
(http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg17817.html)

Patch (thermal: exynos: Support thermal tripping ) from Jonghwan Choi is
added here with some changes.
(https://patchwork.kernel.org/patch/1668371/)

Patch (thermal: exynos: Support for TMU regulator defined at device tree)
is a repost of my earlier 
patch(https://patchwork-mail1.kernel.org/patch/2510771/) 
and adds regulator support.

Patch (ARM: dts: Add device tree node for exynos5440 TMU controller) can be
merged through exynos platform maintainer as this can cause merge conflict.

All these patches are based on thermal maintainers git tree,
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next.

Amit Daniel Kachhap (20):
  thermal: exynos: Moving exynos thermal files into samsung directory
  thermal: exynos: Bifurcate exynos thermal common and tmu controller
code
  thermal: exynos: Rename exynos_thermal.c to exynos_tmu.c
  thermal: exynos: Move exynos_thermal.h from include/* to driver/*
folder
  thermal: exynos: Bifurcate exynos tmu driver and configuration data
  thermal: exynos: Add missing definations and code cleanup
  thermal: exynos: Add extra entries in the tmu platform data
  thermal: exynos: Support thermal tripping
  thermal: exynos: Move register definitions from driver file to data
file
  thermal: exynos: Fix to clear only the generated interrupts
  thermal: exynos: Add support for instance based register/unregister
  thermal: exynos: Modify private_data to appropriate name driver_data
  thermal: exynos: Return success even if no cooling data supplied
  thermal: exynos: Make the zone handling dependent on trip count
  thermal: exynos: Add support to handle many instances of TMU
  thermal: exynos: Add features to check instead of using SOC type
  thermal: exynos: Add support for exynos5440 TMU sensor.
  Documentation: thermal: Explain the exynos thermal driver model
  thermal: exynos: Support for TMU regulator defined at device tree
  ARM: dts: Add device tree node for exynos5440 TMU controller

Lukasz Majewski (1):
  ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal
bindings

 .../devicetree/bindings/thermal/exynos-thermal.txt |   53 +
 Documentation/thermal/exynos_thermal   |   43 +-
 arch/arm/boot/dts/exynos5440.dtsi  |   30 +
 drivers/thermal/Kconfig|   13 +-
 drivers/thermal/Makefile   |2 +-
 drivers/thermal/exynos_thermal.c   | 1066 
 drivers/thermal/samsung/Kconfig|   28 +
 drivers/thermal/samsung/Makefile   |7 +
 drivers/thermal/samsung/exynos_thermal_common.c|  401 
 drivers/thermal/samsung/exynos_thermal_common.h|   96 ++
 drivers/thermal/samsung/exynos_tmu.c   |  738 ++
 drivers/thermal/samsung/exynos_tmu.h   |  225 
 drivers/thermal/samsung/exynos_tmu_data.c  |  224 
 drivers/thermal/samsung/exynos_tmu_data.h  |  149 +++
 include/linux/platform_data/exynos_thermal.h   |  119 ---
 15 files changed, 1991 insertions(+), 1203 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
 delete mode 100644 drivers/thermal/exynos_thermal.c
 create mode 100644 drivers/thermal/samsung/Kconfig
 create mode 100644 drivers/thermal/samsung/Makefile
 create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c
 create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h
 create mode 100644 drivers/thermal/samsung/exynos_tmu.c
 create mode 100644 drivers/thermal/samsung/exynos_tmu.h
 create mode 100644 drivers/thermal/samsung/exynos_tmu_data.c
 create mode 100644 drivers/thermal/samsung/exynos_tmu_data.h
 delete mode 100644 include/linux/platform_data/exynos_thermal.h

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to 

[PATCH V3 01/21] thermal: exynos: Moving exynos thermal files into samsung directory

2013-05-07 Thread Amit Daniel Kachhap
This movement of files is done for easy maintenance and adding more
new sensor's support for exynos platform easily . This will also help in
bifurcating exynos common, sensor driver and sensor data related parts.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/Kconfig|   13 +
 drivers/thermal/Makefile   |2 +-
 drivers/thermal/samsung/Kconfig|9 +
 drivers/thermal/samsung/Makefile   |4 
 drivers/thermal/{ = samsung}/exynos_thermal.c |0
 5 files changed, 19 insertions(+), 9 deletions(-)
 create mode 100644 drivers/thermal/samsung/Kconfig
 create mode 100644 drivers/thermal/samsung/Makefile
 rename drivers/thermal/{ = samsung}/exynos_thermal.c (100%)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 5e3c025..081ddc5 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -114,14 +114,6 @@ config KIRKWOOD_THERMAL
  Support for the Kirkwood thermal sensor driver into the Linux thermal
  framework. Only kirkwood 88F6282 and 88F6283 have this sensor.
 
-config EXYNOS_THERMAL
-   tristate Temperature sensor on Samsung EXYNOS
-   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
-   depends on CPU_THERMAL
-   help
- If you say yes here you get support for TMU (Thermal Management
- Unit) on SAMSUNG EXYNOS series of SoC.
-
 config DOVE_THERMAL
tristate Temperature sensor on Marvell Dove SoCs
depends on ARCH_DOVE
@@ -169,4 +161,9 @@ config INTEL_POWERCLAMP
  enforce idle time which results in more package C-state residency. The
  user interface is exposed via generic thermal framework.
 
+menu Exynos thermal drivers
+depends on PLAT_SAMSUNG
+source drivers/thermal/samsung/Kconfig
+endmenu
+
 endif
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c054d41..b3063a9 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -17,7 +17,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
 obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
 obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
-obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
+obj-y  += samsung/
 obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
 obj-$(CONFIG_DB8500_THERMAL)   += db8500_thermal.o
 obj-$(CONFIG_ARMADA_THERMAL)   += armada_thermal.o
diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
new file mode 100644
index 000..2d3d9dc
--- /dev/null
+++ b/drivers/thermal/samsung/Kconfig
@@ -0,0 +1,9 @@
+config EXYNOS_THERMAL
+   tristate Temperature sensor on Samsung EXYNOS
+   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
+   depends on CPU_THERMAL
+   help
+ If you say yes here you get support for TMU (Thermal Management
+ Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
+ the exynos thermal driver with the core thermal layer and cpu
+ cooling API's.
diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
new file mode 100644
index 000..1fe6d93
--- /dev/null
+++ b/drivers/thermal/samsung/Makefile
@@ -0,0 +1,4 @@
+#
+# Samsung thermal specific Makefile
+#
+obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
diff --git a/drivers/thermal/exynos_thermal.c 
b/drivers/thermal/samsung/exynos_thermal.c
similarity index 100%
rename from drivers/thermal/exynos_thermal.c
rename to drivers/thermal/samsung/exynos_thermal.c
-- 
1.7.1

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


[PATCH V3 02/21] thermal: exynos: Bifurcate exynos thermal common and tmu controller code

2013-05-07 Thread Amit Daniel Kachhap
This code bifurcates exynos thermal implementation into common and sensor
specific parts. The common thermal code interacts with core thermal layer and
core cpufreq cooling parts and is independent of SOC specific driver. This
change is needed to cleanly add support for new TMU sensors.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/Kconfig |   20 +-
 drivers/thermal/samsung/Makefile|4 +-
 drivers/thermal/samsung/exynos_thermal.c|  421 +--
 drivers/thermal/samsung/exynos_thermal_common.c |  389 +
 drivers/thermal/samsung/exynos_thermal_common.h |   83 +
 5 files changed, 498 insertions(+), 419 deletions(-)
 create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c
 create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h

diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
index 2d3d9dc..7857e20 100644
--- a/drivers/thermal/samsung/Kconfig
+++ b/drivers/thermal/samsung/Kconfig
@@ -1,9 +1,17 @@
 config EXYNOS_THERMAL
-   tristate Temperature sensor on Samsung EXYNOS
+   tristate Exynos thermal management unit driver
depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
-   depends on CPU_THERMAL
help
- If you say yes here you get support for TMU (Thermal Management
- Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
- the exynos thermal driver with the core thermal layer and cpu
- cooling API's.
+ If you say yes here you get support for the exynos thermal driver
+ for exynos4 and exynos5 soc. This driver initialises the TMU, reports
+ temperature and handles cooling action if defined. This driver uses
+ core thermal API's.
+
+config EXYNOS_THERMAL_CORE
+   bool Core thermal framework support for EXYNOS SOC's
+   depends on EXYNOS_THERMAL
+   help
+ If you say yes here you get support for EXYNOS TMU
+ (Thermal Management Unit) common registration/unregistration
+ functions to the core thermal layer and also to use the generic
+ cpu cooling API's.
diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
index 1fe6d93..6227d4f 100644
--- a/drivers/thermal/samsung/Makefile
+++ b/drivers/thermal/samsung/Makefile
@@ -1,4 +1,6 @@
 #
 # Samsung thermal specific Makefile
 #
-obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
+obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_soc_thermal.o
+exynos_soc_thermal-y   := exynos_thermal.o
+exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
diff --git a/drivers/thermal/samsung/exynos_thermal.c 
b/drivers/thermal/samsung/exynos_thermal.c
index d20ce9e..4c85945 100644
--- a/drivers/thermal/samsung/exynos_thermal.c
+++ b/drivers/thermal/samsung/exynos_thermal.c
@@ -21,23 +21,19 @@
  *
  */
 
-#include linux/module.h
-#include linux/err.h
-#include linux/kernel.h
-#include linux/slab.h
-#include linux/platform_device.h
-#include linux/interrupt.h
 #include linux/clk.h
-#include linux/workqueue.h
-#include linux/sysfs.h
-#include linux/kobject.h
 #include linux/io.h
+#include linux/interrupt.h
+#include linux/kernel.h
+#include linux/kobject.h
+#include linux/module.h
 #include linux/mutex.h
-#include linux/platform_data/exynos_thermal.h
-#include linux/thermal.h
-#include linux/cpufreq.h
-#include linux/cpu_cooling.h
 #include linux/of.h
+#include linux/platform_device.h
+#include linux/platform_data/exynos_thermal.h
+#include linux/slab.h
+#include linux/workqueue.h
+#include exynos_thermal_common.h
 
 /* Exynos generic registers */
 #define EXYNOS_TMU_REG_TRIMINFO0x0
@@ -88,16 +84,6 @@
 #define EFUSE_MIN_VALUE 40
 #define EFUSE_MAX_VALUE 100
 
-/* In-kernel thermal framework related macros  definations */
-#define SENSOR_NAME_LEN16
-#define MAX_TRIP_COUNT 8
-#define MAX_COOLING_DEVICE 4
-#define MAX_THRESHOLD_LEVS 4
-
-#define ACTIVE_INTERVAL 500
-#define IDLE_INTERVAL 1
-#define MCELSIUS   1000
-
 #ifdef CONFIG_THERMAL_EMULATION
 #define EXYNOS_EMUL_TIME   0x57F0
 #define EXYNOS_EMUL_TIME_SHIFT 16
@@ -106,17 +92,6 @@
 #define EXYNOS_EMUL_ENABLE 0x1
 #endif /* CONFIG_THERMAL_EMULATION */
 
-/* CPU Zone information */
-#define PANIC_ZONE  4
-#define WARN_ZONE   3
-#define MONITOR_ZONE2
-#define SAFE_ZONE   1
-
-#define GET_ZONE(trip) (trip + 2)
-#define GET_TRIP(zone) (zone - 2)
-
-#define EXYNOS_ZONE_COUNT  3
-
 struct exynos_tmu_data {
struct exynos_tmu_platform_data *pdata;
struct resource *mem;
@@ -129,384 +104,6 @@ struct exynos_tmu_data {
u8 temp_error1, temp_error2;
 };
 
-struct thermal_trip_point_conf {
-   int trip_val[MAX_TRIP_COUNT];
-   int trip_count;
-   u8 trigger_falling;
-};
-
-struct thermal_cooling_conf {
-   struct 

[PATCH V3 09/21] thermal: exynos: Move register definitions from driver file to data file

2013-05-07 Thread Amit Daniel Kachhap
This patch migrates the TMU register definition/bitfields to data file. This
is needed to support SoC's which use the same TMU controller but register
validity, offsets or bitfield may slightly vary across SOC's.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_tmu.c  |  177 +---
 drivers/thermal/samsung/exynos_tmu.h  |   76 
 drivers/thermal/samsung/exynos_tmu_data.c |   59 ++
 drivers/thermal/samsung/exynos_tmu_data.h |   68 +++
 4 files changed, 260 insertions(+), 120 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 23baeeb..97b87aa 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -36,77 +36,6 @@
 #include exynos_tmu.h
 #include exynos_tmu_data.h
 
-/* Exynos generic registers */
-#define EXYNOS_TMU_REG_TRIMINFO0x0
-#define EXYNOS_TMU_REG_CONTROL 0x20
-#define EXYNOS_TMU_REG_STATUS  0x28
-#define EXYNOS_TMU_REG_CURRENT_TEMP0x40
-#define EXYNOS_TMU_REG_INTEN   0x70
-#define EXYNOS_TMU_REG_INTSTAT 0x74
-#define EXYNOS_TMU_REG_INTCLEAR0x78
-
-#define EXYNOS_TMU_TRIM_TEMP_MASK  0xff
-#define EXYNOS_TMU_GAIN_SHIFT  8
-#define EXYNOS_TMU_GAIN_MASK   0xf
-#define EXYNOS_TMU_REF_VOLTAGE_SHIFT   24
-#define EXYNOS_TMU_REF_VOLTAGE_MASK0x1f
-#define EXYNOS_TMU_BUF_SLOPE_SEL_MASK  0xf
-#define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8
-#define EXYNOS_TMU_CORE_EN_SHIFT   0
-
-/* Exynos4210 specific registers */
-#define EXYNOS4210_TMU_REG_THRESHOLD_TEMP  0x44
-#define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50
-#define EXYNOS4210_TMU_REG_TRIG_LEVEL1 0x54
-#define EXYNOS4210_TMU_REG_TRIG_LEVEL2 0x58
-#define EXYNOS4210_TMU_REG_TRIG_LEVEL3 0x5C
-#define EXYNOS4210_TMU_REG_PAST_TEMP0  0x60
-#define EXYNOS4210_TMU_REG_PAST_TEMP1  0x64
-#define EXYNOS4210_TMU_REG_PAST_TEMP2  0x68
-#define EXYNOS4210_TMU_REG_PAST_TEMP3  0x6C
-
-#define EXYNOS4210_TMU_TRIG_LEVEL0_MASK0x1
-#define EXYNOS4210_TMU_TRIG_LEVEL1_MASK0x10
-#define EXYNOS4210_TMU_TRIG_LEVEL2_MASK0x100
-#define EXYNOS4210_TMU_TRIG_LEVEL3_MASK0x1000
-#define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x
-#define EXYNOS4210_TMU_INTCLEAR_VAL0x
-
-/* Exynos5250 and Exynos4412 specific registers */
-#define EXYNOS_TMU_TRIMINFO_CON0x14
-#define EXYNOS_THD_TEMP_RISE   0x50
-#define EXYNOS_THD_TEMP_FALL   0x54
-#define EXYNOS_EMUL_CON0x80
-
-#define EXYNOS_TRIMINFO_RELOAD 0x1
-#define EXYNOS_TRIMINFO_SHIFT  0x0
-#define EXYNOS_TMU_RISE_INT_MASK   0x111
-#define EXYNOS_TMU_RISE_INT_SHIFT  0
-#define EXYNOS_TMU_FALL_INT_MASK   0x111
-#define EXYNOS_TMU_FALL_INT_SHIFT  12
-#define EXYNOS_TMU_CLEAR_RISE_INT  0x111
-#define EXYNOS_TMU_CLEAR_FALL_INT  (0x111  12)
-#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
-#define EXYNOS_TMU_TRIP_MODE_MASK  0x7
-#define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12
-
-#define EXYNOS_TMU_INTEN_RISE0_SHIFT   0
-#define EXYNOS_TMU_INTEN_RISE1_SHIFT   4
-#define EXYNOS_TMU_INTEN_RISE2_SHIFT   8
-#define EXYNOS_TMU_INTEN_RISE3_SHIFT   12
-#define EXYNOS_TMU_INTEN_FALL0_SHIFT   16
-#define EXYNOS_TMU_INTEN_FALL1_SHIFT   20
-#define EXYNOS_TMU_INTEN_FALL2_SHIFT   24
-
-#ifdef CONFIG_THERMAL_EMULATION
-#define EXYNOS_EMUL_TIME   0x57F0
-#define EXYNOS_EMUL_TIME_MASK  0x
-#define EXYNOS_EMUL_TIME_SHIFT 16
-#define EXYNOS_EMUL_DATA_SHIFT 8
-#define EXYNOS_EMUL_DATA_MASK  0xFF
-#define EXYNOS_EMUL_ENABLE 0x1
-#endif /* CONFIG_THERMAL_EMULATION */
-
 struct exynos_tmu_data {
struct exynos_tmu_platform_data *pdata;
struct resource *mem;
@@ -191,6 +120,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
 {
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct exynos_tmu_platform_data *pdata = data-pdata;
+   struct exynos_tmu_registers *reg = pdata-registers;
unsigned int status, trim_info, con;
unsigned int rising_threshold = 0, falling_threshold = 0;
int ret = 0, threshold_code, i, trigger_levs = 0;
@@ -198,20 +128,20 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
mutex_lock(data-lock);
clk_enable(data-clk);
 
-   status = readb(data-base + EXYNOS_TMU_REG_STATUS);
+   status = readb(data-base + reg-tmu_status);
if (!status) {
ret = -EBUSY;
goto out;
}
 
-   if (data-soc == SOC_ARCH_EXYNOS) {
-   __raw_writel(EXYNOS_TRIMINFO_RELOAD,
-   data-base + EXYNOS_TMU_TRIMINFO_CON);
-   }
+   if (data-soc == SOC_ARCH_EXYNOS)
+   __raw_writel(1, data-base + reg-triminfo_ctrl);
+
/* Save trimming info in order to perform calibration */
-   trim_info = readl(data-base 

[PATCH V3 11/21] thermal: exynos: Add support for instance based register/unregister

2013-05-07 Thread Amit Daniel Kachhap
This code modifies the thermal driver to have multiple thermal zone
support by replacing the global thermal zone variable with device data
member of thermal_zone_device.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_thermal_common.c |   36 ++
 drivers/thermal/samsung/exynos_thermal_common.h |9 +++--
 drivers/thermal/samsung/exynos_tmu.c|   15 +
 3 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index dae5476..d4cd5ec 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -41,12 +41,11 @@ struct exynos_thermal_zone {
bool bind;
 };
 
-static struct exynos_thermal_zone *th_zone;
-
 /* Get mode callback functions for thermal zone */
 static int exynos_get_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
 {
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
if (th_zone)
*mode = th_zone-mode;
return 0;
@@ -56,25 +55,26 @@ static int exynos_get_mode(struct thermal_zone_device 
*thermal,
 static int exynos_set_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode mode)
 {
-   if (!th_zone-therm_dev) {
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
+   if (!th_zone) {
pr_notice(thermal zone not registered\n);
return 0;
}
 
-   mutex_lock(th_zone-therm_dev-lock);
+   mutex_lock(thermal-lock);
 
if (mode == THERMAL_DEVICE_ENABLED 
!th_zone-sensor_conf-trip_data.trigger_falling)
-   th_zone-therm_dev-polling_delay = IDLE_INTERVAL;
+   thermal-polling_delay = IDLE_INTERVAL;
else
-   th_zone-therm_dev-polling_delay = 0;
+   thermal-polling_delay = 0;
 
-   mutex_unlock(th_zone-therm_dev-lock);
+   mutex_unlock(thermal-lock);
 
th_zone-mode = mode;
-   thermal_zone_device_update(th_zone-therm_dev);
+   thermal_zone_device_update(thermal);
pr_info(thermal polling set for duration=%d msec\n,
-   th_zone-therm_dev-polling_delay);
+   thermal-polling_delay);
return 0;
 }
 
@@ -101,6 +101,8 @@ static int exynos_get_trip_type(struct thermal_zone_device 
*thermal, int trip,
 static int exynos_get_trip_temp(struct thermal_zone_device *thermal, int trip,
unsigned long *temp)
 {
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
+
if (trip  GET_TRIP(MONITOR_ZONE) || trip  GET_TRIP(PANIC_ZONE))
return -EINVAL;
 
@@ -127,6 +129,7 @@ static int exynos_bind(struct thermal_zone_device *thermal,
 {
int ret = 0, i, tab_size, level;
struct freq_clip_table *tab_ptr, *clip_data;
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
struct thermal_sensor_conf *data = th_zone-sensor_conf;
 
tab_ptr = (struct freq_clip_table *)data-cooling_data.freq_data;
@@ -173,6 +176,7 @@ static int exynos_unbind(struct thermal_zone_device 
*thermal,
struct thermal_cooling_device *cdev)
 {
int ret = 0, i, tab_size;
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
struct thermal_sensor_conf *data = th_zone-sensor_conf;
 
if (th_zone-bind == false)
@@ -215,6 +219,7 @@ static int exynos_unbind(struct thermal_zone_device 
*thermal,
 static int exynos_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
 {
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
void *data;
 
if (!th_zone-sensor_conf) {
@@ -234,6 +239,7 @@ static int exynos_set_emul_temp(struct thermal_zone_device 
*thermal,
 {
void *data;
int ret = -EINVAL;
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
 
if (!th_zone-sensor_conf) {
pr_info(Temperature sensor not initialised\n);
@@ -281,11 +287,12 @@ static struct thermal_zone_device_ops const 
exynos_dev_ops = {
  * This function may be called from interrupt based temperature sensor
  * when threshold is changed.
  */
-void exynos_report_trigger(void)
+void exynos_report_trigger(struct thermal_sensor_conf *conf)
 {
unsigned int i;
char data[10];
char *envp[] = { data, NULL };
+   struct exynos_thermal_zone *th_zone = conf-pzone_data;
 
if (!th_zone || !th_zone-therm_dev)
return;
@@ -326,6 +333,7 @@ int exynos_register_thermal(struct thermal_sensor_conf 
*sensor_conf)
 {
int ret;
struct cpumask mask_val;
+   struct exynos_thermal_zone *th_zone;
 
if (!sensor_conf || !sensor_conf-read_temperature) 

[PATCH V3 13/21] thermal: exynos: Return success even if no cooling data supplied

2013-05-07 Thread Amit Daniel Kachhap
This patch removes the error return in the bind/unbind routine
as the platform may not register any cpufreq cooling data.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_thermal_common.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index c0e4bdb..b7ca8a4 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -136,7 +136,7 @@ static int exynos_bind(struct thermal_zone_device *thermal,
tab_size = data-cooling_data.freq_clip_count;
 
if (tab_ptr == NULL || tab_size == 0)
-   return -EINVAL;
+   return 0;
 
/* find the cooling device registered*/
for (i = 0; i  th_zone-cool_dev_size; i++)
@@ -185,7 +185,7 @@ static int exynos_unbind(struct thermal_zone_device 
*thermal,
tab_size = data-cooling_data.freq_clip_count;
 
if (tab_size == 0)
-   return -EINVAL;
+   return 0;
 
/* find the cooling device registered*/
for (i = 0; i  th_zone-cool_dev_size; i++)
-- 
1.7.1

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


[PATCH V3 20/21] thermal: exynos: Support for TMU regulator defined at device tree

2013-05-07 Thread Amit Daniel Kachhap
TMU probe function now checks for a device tree defined regulator.
For compatibility reasons it is allowed to probe driver even without
this regulator defined.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 .../devicetree/bindings/thermal/exynos-thermal.txt |4 
 drivers/thermal/samsung/exynos_tmu.c   |   19 +++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt 
b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
index 970eeba..ff62f7a 100644
--- a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
@@ -14,6 +14,9 @@
 - interrupts : Should contain interrupt for thermal system
 - clocks : The main clock for TMU device
 - clock-names : Thermal system clock name
+- vtmu-supply: This entry is optional and provides the regulator node supplying
+   voltage to TMU. If needed this entry can be placed inside
+   board/platform specific dts file.
 
 Example 1):
 
@@ -25,6 +28,7 @@ Example 1):
clocks = clock 383;
clock-names = tmu_apbif;
status = disabled;
+   vtmu-supply = tmu_regulator_node;
};
 
 Example 2):
diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 72446c9..b7c609a 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -32,6 +32,7 @@
 #include linux/of_address.h
 #include linux/of_irq.h
 #include linux/platform_device.h
+#include linux/regulator/consumer.h
 #include linux/slab.h
 #include linux/workqueue.h
 #include exynos_thermal_common.h
@@ -52,6 +53,7 @@
  * @clk: pointer to the clock structure.
  * @temp_error1: fused value of the first point trim.
  * @temp_error2: fused value of the second point trim.
+ * @regulator: pointer to the TMU regulator structure.
  * @reg_conf: pointer to structure to register with core thermal.
  */
 struct exynos_tmu_data {
@@ -65,6 +67,7 @@ struct exynos_tmu_data {
struct mutex lock;
struct clk *clk;
u8 temp_error1, temp_error2;
+   struct regulator *regulator;
struct thermal_sensor_conf *reg_conf;
 };
 
@@ -501,10 +504,23 @@ static int exynos_map_dt_data(struct platform_device 
*pdev)
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct exynos_tmu_platform_data *pdata = data-pdata;
struct resource res;
+   int ret;
 
if (!data)
return -ENODEV;
 
+   /* Try enabling the regulator if found */
+   data-regulator = devm_regulator_get(pdev-dev, vtmu);
+   if (!IS_ERR(data-regulator)) {
+   ret = regulator_enable(data-regulator);
+   if (ret) {
+   dev_err(pdev-dev, failed to enable vtmu\n);
+   return ret;
+   }
+   } else {
+   dev_info(pdev-dev, Regulator node (vtmu) not found\n);
+   }
+
data-id = of_alias_get_id(pdev-dev.of_node, tmuctrl);
if (data-id  0)
data-id = 0;
@@ -669,6 +685,9 @@ static int exynos_tmu_remove(struct platform_device *pdev)
 
clk_unprepare(data-clk);
 
+   if (!IS_ERR(data-regulator))
+   regulator_disable(data-regulator);
+
platform_set_drvdata(pdev, NULL);
 
return 0;
-- 
1.7.1

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


[PATCH V3 21/21] ARM: dts: Add device tree node for exynos5440 TMU controller

2013-05-07 Thread Amit Daniel Kachhap
This patch adds device node for TMU controller. There are 3
instances of the controllers so 3 nodes are created.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 arch/arm/boot/dts/exynos5440.dtsi |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5440.dtsi 
b/arch/arm/boot/dts/exynos5440.dtsi
index 9a99755..433e92e 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -16,6 +16,12 @@
 
interrupt-parent = gic;
 
+   aliases {
+   tmuctrl0 = tmuctrl_0;
+   tmuctrl1 = tmuctrl_1;
+   tmuctrl2 = tmuctrl_2;
+   };
+
gic:interrupt-controller@2E {
compatible = arm,cortex-a15-gic;
#interrupt-cells = 3;
@@ -162,4 +168,28 @@
reg = 0x13 0x1000;
interrupts = 0 17 0, 0 16 0;
};
+
+   tmuctrl_0: tmuctrl@160118 {
+   compatible = samsung,exynos5440-tmu;
+   reg = 0x160118 0x230, 0x160368 0x10;
+   interrupts = 0 58 0;
+   clocks = clock 21;
+   clock-names = tmu_apbif;
+   };
+
+   tmuctrl_1: tmuctrl@16011C {
+   compatible = samsung,exynos5440-tmu;
+   reg = 0x16011C 0x230, 0x160368 0x10;
+   interrupts = 0 58 0;
+   clocks = clock 21;
+   clock-names = tmu_apbif;
+   };
+
+   tmuctrl_2: tmuctrl@160120 {
+   compatible = samsung,exynos5440-tmu;
+   reg = 0x160120 0x230, 0x160368 0x10;
+   interrupts = 0 58 0;
+   clocks = clock 21;
+   clock-names = tmu_apbif;
+   };
 };
-- 
1.7.1

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


[PATCH V3 10/21] thermal: exynos: Fix to clear only the generated interrupts

2013-05-07 Thread Amit Daniel Kachhap
This patch uses the TMU status register to know the generated interrupts
and only clear them in the interrupt handler.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_tmu.c  |   10 --
 drivers/thermal/samsung/exynos_tmu_data.c |2 ++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 97b87aa..082d5a2 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -325,17 +325,15 @@ static void exynos_tmu_work(struct work_struct *work)
struct exynos_tmu_data, irq_work);
struct exynos_tmu_platform_data *pdata = data-pdata;
struct exynos_tmu_registers *reg = pdata-registers;
+   unsigned int val_irq;
 
exynos_report_trigger();
mutex_lock(data-lock);
clk_enable(data-clk);
 
-   if (data-soc == SOC_ARCH_EXYNOS)
-   writel((reg-inten_rise_mask  reg-inten_rise_shift) |
-   (reg-inten_fall_mask  reg-inten_fall_shift),
-   data-base + reg-tmu_intclear);
-   else
-   writel(reg-inten_rise_mask, data-base + reg-tmu_intclear);
+   val_irq = readl(data-base + reg-tmu_intstat);
+   /* clear the interrupts */
+   writel(val_irq, data-base + reg-tmu_intclear);
 
clk_disable(data-clk);
mutex_unlock(data-lock);
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 3a1ded1..7322597 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -45,6 +45,7 @@ static struct exynos_tmu_registers exynos4210_tmu_registers = 
{
.inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
.inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
.inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
+   .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
 };
 struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
@@ -111,6 +112,7 @@ static struct exynos_tmu_registers exynos5250_tmu_registers 
= {
.inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
.inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
.inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
+   .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
.emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
-- 
1.7.1

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


[PATCH V3 12/21] thermal: exynos: Modify private_data to appropriate name driver_data

2013-05-07 Thread Amit Daniel Kachhap
This patch renames member private_data to driver_data of the thermal
zone registration structure as this item stores the driver related
data and uses it to call the driver related callbacks.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_thermal_common.c |4 ++--
 drivers/thermal/samsung/exynos_thermal_common.h |2 +-
 drivers/thermal/samsung/exynos_tmu.c|2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index d4cd5ec..c0e4bdb 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -226,7 +226,7 @@ static int exynos_get_temp(struct thermal_zone_device 
*thermal,
pr_info(Temperature sensor not initialised\n);
return -EINVAL;
}
-   data = th_zone-sensor_conf-private_data;
+   data = th_zone-sensor_conf-driver_data;
*temp = th_zone-sensor_conf-read_temperature(data);
/* convert the temperature into millicelsius */
*temp = *temp * MCELSIUS;
@@ -245,7 +245,7 @@ static int exynos_set_emul_temp(struct thermal_zone_device 
*thermal,
pr_info(Temperature sensor not initialised\n);
return -EINVAL;
}
-   data = th_zone-sensor_conf-private_data;
+   data = th_zone-sensor_conf-driver_data;
if (th_zone-sensor_conf-write_emul_temp)
ret = th_zone-sensor_conf-write_emul_temp(data, temp);
return ret;
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h 
b/drivers/thermal/samsung/exynos_thermal_common.h
index 1105ecd..0acde95 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -76,7 +76,7 @@ struct thermal_sensor_conf {
int (*write_emul_temp)(void *drv_data, unsigned long temp);
struct thermal_trip_point_conf trip_data;
struct thermal_cooling_conf cooling_data;
-   void *private_data;
+   void *driver_data;
void *pzone_data;
 };
 
diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 133d3f5..bdf40ef 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -482,7 +482,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
exynos_tmu_control(pdev, true);
 
/* Register the sensor with thermal management interface */
-   (exynos_sensor_conf)-private_data = data;
+   (exynos_sensor_conf)-driver_data = data;
exynos_sensor_conf.trip_data.trip_count = pdata-trigger_enable[0] +
pdata-trigger_enable[1] + pdata-trigger_enable[2]+
pdata-trigger_enable[3];
-- 
1.7.1

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


[PATCH V3 14/21] thermal: exynos: Make the zone handling dependent on trip count

2013-05-07 Thread Amit Daniel Kachhap
This code simplifies the zone handling to use the trip count passed
by the TMU driver. This also helps in adding more zone support.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_thermal_common.c |   55 ---
 drivers/thermal/samsung/exynos_thermal_common.h |2 -
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index b7ca8a4..b0dc63e 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -83,17 +83,16 @@ static int exynos_set_mode(struct thermal_zone_device 
*thermal,
 static int exynos_get_trip_type(struct thermal_zone_device *thermal, int trip,
 enum thermal_trip_type *type)
 {
-   switch (GET_ZONE(trip)) {
-   case MONITOR_ZONE:
-   case WARN_ZONE:
-   *type = THERMAL_TRIP_ACTIVE;
-   break;
-   case PANIC_ZONE:
-   *type = THERMAL_TRIP_CRITICAL;
-   break;
-   default:
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
+   int max_trip = th_zone-sensor_conf-trip_data.trip_count;
+
+   if (trip  0 || trip = max_trip)
return -EINVAL;
-   }
+   else if (trip == (max_trip - 1))
+   *type = THERMAL_TRIP_CRITICAL;
+   else
+   *type = THERMAL_TRIP_ACTIVE;
+
return 0;
 }
 
@@ -102,8 +101,9 @@ static int exynos_get_trip_temp(struct thermal_zone_device 
*thermal, int trip,
unsigned long *temp)
 {
struct exynos_thermal_zone *th_zone = thermal-devdata;
+   int max_trip = th_zone-sensor_conf-trip_data.trip_count;
 
-   if (trip  GET_TRIP(MONITOR_ZONE) || trip  GET_TRIP(PANIC_ZONE))
+   if (trip  0 || trip = max_trip)
return -EINVAL;
 
*temp = th_zone-sensor_conf-trip_data.trip_val[trip];
@@ -117,10 +117,10 @@ static int exynos_get_trip_temp(struct 
thermal_zone_device *thermal, int trip,
 static int exynos_get_crit_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
 {
-   int ret;
-   /* Panic zone */
-   ret = exynos_get_trip_temp(thermal, GET_TRIP(PANIC_ZONE), temp);
-   return ret;
+   struct exynos_thermal_zone *th_zone = thermal-devdata;
+   int max_trip = th_zone-sensor_conf-trip_data.trip_count;
+   /* Get the temp of highest trip*/
+   return exynos_get_trip_temp(thermal, max_trip - 1, temp);
 }
 
 /* Bind callback functions for thermal zone */
@@ -345,19 +345,22 @@ int exynos_register_thermal(struct thermal_sensor_conf 
*sensor_conf)
return -ENOMEM;
 
th_zone-sensor_conf = sensor_conf;
-   cpumask_set_cpu(0, mask_val);
-   th_zone-cool_dev[0] = cpufreq_cooling_register(mask_val);
-   if (IS_ERR(th_zone-cool_dev[0])) {
-   pr_err(Failed to register cpufreq cooling device\n);
-   ret = -EINVAL;
-   goto err_unregister;
+   if (sensor_conf-cooling_data.freq_clip_count  0) {
+   cpumask_set_cpu(0, mask_val);
+   th_zone-cool_dev[0] = cpufreq_cooling_register(mask_val);
+   if (IS_ERR(th_zone-cool_dev[0])) {
+   pr_err(Failed to register cpufreq cooling device\n);
+   ret = -EINVAL;
+   goto err_unregister;
+   }
+   th_zone-cool_dev_size++;
}
-   th_zone-cool_dev_size++;
 
-   th_zone-therm_dev = thermal_zone_device_register(sensor_conf-name,
-   EXYNOS_ZONE_COUNT, 0, th_zone, exynos_dev_ops, NULL, 0,
-   sensor_conf-trip_data.trigger_falling ?
-   0 : IDLE_INTERVAL);
+   th_zone-therm_dev = thermal_zone_device_register(
+   sensor_conf-name, sensor_conf-trip_data.trip_count,
+   0, th_zone, exynos_dev_ops, NULL, 0,
+   sensor_conf-trip_data.trigger_falling ? 0 :
+   IDLE_INTERVAL);
 
if (IS_ERR(th_zone-therm_dev)) {
pr_err(Failed to register thermal zone device\n);
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h 
b/drivers/thermal/samsung/exynos_thermal_common.h
index 0acde95..1dd1b9e 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -42,8 +42,6 @@
 #define GET_ZONE(trip) (trip + 2)
 #define GET_TRIP(zone) (zone - 2)
 
-#define EXYNOS_ZONE_COUNT  3
-
 /**
  * struct freq_clip_table
  * @freq_clip_max: maximum frequency allowed for this cooling state.
-- 
1.7.1

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

[PATCH V3 17/21] ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal bindings

2013-05-07 Thread Amit Daniel Kachhap
From: Lukasz Majewski l.majew...@samsung.com

Proper description for Exynos4 bindings added to Documentation/devicetree/
bindings

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   25 
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt 
b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
new file mode 100644
index 000..535fd0e
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
@@ -0,0 +1,25 @@
+* Exynos Thermal Management Unit (TMU)
+
+** Required properties:
+
+- compatible : One of the following:
+  samsung,exynos4412-tmu
+  samsung,exynos4210-tmu
+  samsung,exynos5250-tmu
+- interrupt-parent : The phandle for the interrupt controller
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clock-names : Thermal system clock name
+
+Example:
+
+   tmu@100C {
+   compatible = samsung,exynos4412-tmu;
+   interrupt-parent = combiner;
+   reg = 0x100C 0x100;
+   interrupts = 2 4;
+   clocks = clock 383;
+   clock-names = tmu_apbif;
+   status = disabled;
+   };
-- 
1.7.1

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


[PATCH V3 19/21] Documentation: thermal: Explain the exynos thermal driver model

2013-05-07 Thread Amit Daniel Kachhap
This patch updates the documentation to explain the driver model
and file layout.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 Documentation/thermal/exynos_thermal |   43 ++---
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/Documentation/thermal/exynos_thermal 
b/Documentation/thermal/exynos_thermal
index 2b46f67..9010c44 100644
--- a/Documentation/thermal/exynos_thermal
+++ b/Documentation/thermal/exynos_thermal
@@ -1,17 +1,17 @@
-Kernel driver exynos4_tmu
+Kernel driver exynos_tmu
 =
 
 Supported chips:
-* ARM SAMSUNG EXYNOS4 series of SoC
-  Prefix: 'exynos4-tmu'
+* ARM SAMSUNG EXYNOS4, EXYNOS5 series of SoC
   Datasheet: Not publicly available
 
 Authors: Donggeun Kim dg77@samsung.com
+Authors: Amit Daniel amit.dan...@samsung.com
 
-Description

+TMU controller Description:
+---
 
-This driver allows to read temperature inside SAMSUNG EXYNOS4 series of SoC.
+This driver allows to read temperature inside SAMSUNG EXYNOS4/5 series of SoC.
 
 The chip only exposes the measured 8-bit temperature code value
 through a register.
@@ -34,9 +34,9 @@ The three equations are:
   TI2: Trimming info for 85 degree Celsius (stored at TRIMINFO register)
Temperature code measured at 85 degree Celsius which is unchanged
 
-TMU(Thermal Management Unit) in EXYNOS4 generates interrupt
+TMU(Thermal Management Unit) in EXYNOS4/5 generates interrupt
 when temperature exceeds pre-defined levels.
-The maximum number of configurable threshold is four.
+The maximum number of configurable threshold is five.
 The threshold levels are defined as follows:
   Level_0: current temperature  trigger_level_0 + threshold
   Level_1: current temperature  trigger_level_1 + threshold
@@ -47,6 +47,31 @@ The threshold levels are defined as follows:
   through the corresponding registers.
 
 When an interrupt occurs, this driver notify kernel thermal framework
-with the function exynos4_report_trigger.
+with the function exynos_report_trigger.
 Although an interrupt condition for level_0 can be set,
 it can be used to synchronize the cooling action.
+
+TMU driver description:
+---
+
+The exynos thermal driver is structured as,
+
+   Kernel Core thermal framework
+   (thermal_core.c, step_wise.c, cpu_cooling.c)
+   ^
+   |
+   |
+TMU configuration data --- TMU Driver  -- Exynos Core thermal 
wrapper
+(exynos_tmu_data.c)  (exynos_tmu.c)   (exynos_thermal_common.c)
+(exynos_tmu_data.h)  (exynos_tmu.h)   (exynos_thermal_common.h)
+
+a) TMU configuration data: This consist of TMU register offsets/bitfields
+   described through structure exynos_tmu_registers. Also several
+   other platform data (struct exynos_tmu_platform_data) members
+   are used to configure the TMU.
+b) TMU driver: This component initialises the TMU controller and sets different
+   thresholds. It invokes core thermal implementation with the call
+   exynos_report_trigger.
+c) Exynos Core thermal wrapper: This provides 3 wrapper function to use the
+   Kernel core thermal framework. They are 
exynos_unregister_thermal,
+   exynos_register_thermal and exynos_report_trigger.
-- 
1.7.1

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


[PATCH V3 03/21] thermal: exynos: Rename exynos_thermal.c to exynos_tmu.c

2013-05-07 Thread Amit Daniel Kachhap
This patch renames exynos_thermal.c to exynos_tmu.c. This change is needed as
this file now just contains exynos tmu driver related codes and thermal zone
or cpufreq cooling registration related changes are not there anymore.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/Makefile   |6 +++---
 .../samsung/{exynos_thermal.c = exynos_tmu.c} |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
 rename drivers/thermal/samsung/{exynos_thermal.c = exynos_tmu.c} (99%)

diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
index 6227d4f..22528d6 100644
--- a/drivers/thermal/samsung/Makefile
+++ b/drivers/thermal/samsung/Makefile
@@ -1,6 +1,6 @@
 #
 # Samsung thermal specific Makefile
 #
-obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_soc_thermal.o
-exynos_soc_thermal-y   := exynos_thermal.o
-exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
+obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
+exynos_thermal-y   := exynos_tmu.o
+exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE)   += exynos_thermal_common.o
diff --git a/drivers/thermal/samsung/exynos_thermal.c 
b/drivers/thermal/samsung/exynos_tmu.c
similarity index 99%
rename from drivers/thermal/samsung/exynos_thermal.c
rename to drivers/thermal/samsung/exynos_tmu.c
index 4c85945..3de3e61 100644
--- a/drivers/thermal/samsung/exynos_thermal.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1,5 +1,5 @@
 /*
- * exynos_thermal.c - Samsung EXYNOS TMU (Thermal Management Unit)
+ * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
  *
  *  Copyright (C) 2011 Samsung Electronics
  *  Donggeun Kim dg77@samsung.com
-- 
1.7.1

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


[PATCH V3 05/21] thermal: exynos: Bifurcate exynos tmu driver and configuration data

2013-05-07 Thread Amit Daniel Kachhap
This code splits the exynos tmu driver code into SOC specific data parts.
This will simplify adding new SOC specific data to the same TMU controller.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/Kconfig |   13 -
 drivers/thermal/samsung/Makefile|1 +
 drivers/thermal/samsung/exynos_thermal_common.h |3 +-
 drivers/thermal/samsung/exynos_tmu.c|   67 +--
 drivers/thermal/samsung/exynos_tmu_data.c   |   78 +++
 drivers/thermal/samsung/exynos_tmu_data.h   |   41 
 6 files changed, 137 insertions(+), 66 deletions(-)
 create mode 100644 drivers/thermal/samsung/exynos_tmu_data.c
 create mode 100644 drivers/thermal/samsung/exynos_tmu_data.h

diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
index 7857e20..f23f533 100644
--- a/drivers/thermal/samsung/Kconfig
+++ b/drivers/thermal/samsung/Kconfig
@@ -5,7 +5,8 @@ config EXYNOS_THERMAL
  If you say yes here you get support for the exynos thermal driver
  for exynos4 and exynos5 soc. This driver initialises the TMU, reports
  temperature and handles cooling action if defined. This driver uses
- core thermal API's.
+ core thermal API's and TMU configuration data from the supported
+ soc's.
 
 config EXYNOS_THERMAL_CORE
bool Core thermal framework support for EXYNOS SOC's
@@ -15,3 +16,13 @@ config EXYNOS_THERMAL_CORE
  (Thermal Management Unit) common registration/unregistration
  functions to the core thermal layer and also to use the generic
  cpu cooling API's.
+
+config EXYNOS_THERMAL_DATA
+   bool Temperature sensor congiguration data for EXYNOS series SOC
+   depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412 || 
SOC_EXYNOS5250)
+   depends on EXYNOS_THERMAL
+   help
+ If you say yes here you can enable TMU (Thermal Management Unit) on
+ SAMSUNG EXYNOS 4210, 4412, 4414 and 5250 series of SoC. This option
+ enables/prepares the configuration, trip and cooling data for the TMU
+ driver.
diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
index 22528d6..c0446e8 100644
--- a/drivers/thermal/samsung/Makefile
+++ b/drivers/thermal/samsung/Makefile
@@ -4,3 +4,4 @@
 obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
 exynos_thermal-y   := exynos_tmu.o
 exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE)   += exynos_thermal_common.o
+exynos_thermal-$(CONFIG_EXYNOS_THERMAL_DATA)   += exynos_tmu_data.o
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h 
b/drivers/thermal/samsung/exynos_thermal_common.h
index 1c3f8b7..3b85858 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -62,7 +62,7 @@ struct freq_clip_table {
 struct thermal_trip_point_conf {
int trip_val[MAX_TRIP_COUNT];
int trip_count;
-   u8 trigger_falling;
+   unsigned char trigger_falling;
 };
 
 struct thermal_cooling_conf {
@@ -93,6 +93,5 @@ exynos_register_thermal(struct thermal_sensor_conf 
*sensor_conf) { return 0; }
 
 static inline void
 exynos_report_trigger(void) { return; }
-
 #endif /* CONFIG_EXYNOS_COMMON */
 #endif /* _LINUX_EXYNOS_THERMAL_COMMON_H */
diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index a02f2c9..05b5068 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -34,6 +34,7 @@
 #include linux/workqueue.h
 #include exynos_thermal_common.h
 #include exynos_tmu.h
+#include exynos_tmu_data.h
 
 /* Exynos generic registers */
 #define EXYNOS_TMU_REG_TRIMINFO0x0
@@ -385,66 +386,6 @@ static struct thermal_sensor_conf exynos_sensor_conf = {
.write_emul_temp= exynos_tmu_set_emulation,
 };
 
-#if defined(CONFIG_CPU_EXYNOS4210)
-static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
-   .threshold = 80,
-   .trigger_levels[0] = 5,
-   .trigger_levels[1] = 20,
-   .trigger_levels[2] = 30,
-   .trigger_level0_en = 1,
-   .trigger_level1_en = 1,
-   .trigger_level2_en = 1,
-   .trigger_level3_en = 0,
-   .gain = 15,
-   .reference_voltage = 7,
-   .cal_type = TYPE_ONE_POINT_TRIMMING,
-   .freq_tab[0] = {
-   .freq_clip_max = 800 * 1000,
-   .temp_level = 85,
-   },
-   .freq_tab[1] = {
-   .freq_clip_max = 200 * 1000,
-   .temp_level = 100,
-   },
-   .freq_tab_count = 2,
-   .type = SOC_ARCH_EXYNOS4210,
-};
-#define EXYNOS4210_TMU_DRV_DATA (exynos4210_default_tmu_data)
-#else
-#define EXYNOS4210_TMU_DRV_DATA (NULL)
-#endif
-
-#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
-static struct 

[PATCH V3 06/21] thermal: exynos: Add missing definations and code cleanup

2013-05-07 Thread Amit Daniel Kachhap
This patch adds some extra register bitfield definations and cleans
up the code to prepare for moving register macros and definations inside
the TMU data section.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/samsung/exynos_tmu.c |   62 +-
 1 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 05b5068..a43afc4 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -47,9 +47,12 @@
 
 #define EXYNOS_TMU_TRIM_TEMP_MASK  0xff
 #define EXYNOS_TMU_GAIN_SHIFT  8
+#define EXYNOS_TMU_GAIN_MASK   0xf
 #define EXYNOS_TMU_REF_VOLTAGE_SHIFT   24
-#define EXYNOS_TMU_CORE_ON 3
-#define EXYNOS_TMU_CORE_OFF2
+#define EXYNOS_TMU_REF_VOLTAGE_MASK0x1f
+#define EXYNOS_TMU_BUF_SLOPE_SEL_MASK  0xf
+#define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8
+#define EXYNOS_TMU_CORE_EN_SHIFT   0
 #define EXYNOS_TMU_DEF_CODE_TO_TEMP_OFFSET 50
 
 /* Exynos4210 specific registers */
@@ -67,6 +70,7 @@
 #define EXYNOS4210_TMU_TRIG_LEVEL1_MASK0x10
 #define EXYNOS4210_TMU_TRIG_LEVEL2_MASK0x100
 #define EXYNOS4210_TMU_TRIG_LEVEL3_MASK0x1000
+#define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x
 #define EXYNOS4210_TMU_INTCLEAR_VAL0x
 
 /* Exynos5250 and Exynos4412 specific registers */
@@ -76,17 +80,30 @@
 #define EXYNOS_EMUL_CON0x80
 
 #define EXYNOS_TRIMINFO_RELOAD 0x1
+#define EXYNOS_TRIMINFO_SHIFT  0x0
+#define EXYNOS_TMU_RISE_INT_MASK   0x111
+#define EXYNOS_TMU_RISE_INT_SHIFT  0
+#define EXYNOS_TMU_FALL_INT_MASK   0x111
+#define EXYNOS_TMU_FALL_INT_SHIFT  12
 #define EXYNOS_TMU_CLEAR_RISE_INT  0x111
 #define EXYNOS_TMU_CLEAR_FALL_INT  (0x111  12)
-#define EXYNOS_MUX_ADDR_VALUE  6
-#define EXYNOS_MUX_ADDR_SHIFT  20
 #define EXYNOS_TMU_TRIP_MODE_SHIFT 13
+#define EXYNOS_TMU_TRIP_MODE_MASK  0x7
+
+#define EXYNOS_TMU_INTEN_RISE0_SHIFT   0
+#define EXYNOS_TMU_INTEN_RISE1_SHIFT   4
+#define EXYNOS_TMU_INTEN_RISE2_SHIFT   8
+#define EXYNOS_TMU_INTEN_RISE3_SHIFT   12
+#define EXYNOS_TMU_INTEN_FALL0_SHIFT   16
+#define EXYNOS_TMU_INTEN_FALL1_SHIFT   20
+#define EXYNOS_TMU_INTEN_FALL2_SHIFT   24
 
 #define EFUSE_MIN_VALUE 40
 #define EFUSE_MAX_VALUE 100
 
 #ifdef CONFIG_THERMAL_EMULATION
 #define EXYNOS_EMUL_TIME   0x57F0
+#define EXYNOS_EMUL_TIME_MASK  0x
 #define EXYNOS_EMUL_TIME_SHIFT 16
 #define EXYNOS_EMUL_DATA_SHIFT 8
 #define EXYNOS_EMUL_DATA_MASK  0xFF
@@ -265,24 +282,37 @@ static void exynos_tmu_control(struct platform_device 
*pdev, bool on)
mutex_lock(data-lock);
clk_enable(data-clk);
 
-   con = pdata-reference_voltage  EXYNOS_TMU_REF_VOLTAGE_SHIFT |
-   pdata-gain  EXYNOS_TMU_GAIN_SHIFT;
+   con = readl(data-base + EXYNOS_TMU_REG_CONTROL);
 
-   if (data-soc == SOC_ARCH_EXYNOS) {
-   con |= pdata-noise_cancel_mode  EXYNOS_TMU_TRIP_MODE_SHIFT;
-   con |= (EXYNOS_MUX_ADDR_VALUE  EXYNOS_MUX_ADDR_SHIFT);
+   if (pdata-reference_voltage) {
+   con = ~(EXYNOS_TMU_REF_VOLTAGE_MASK 
+   EXYNOS_TMU_REF_VOLTAGE_SHIFT);
+   con |= pdata-reference_voltage  EXYNOS_TMU_REF_VOLTAGE_SHIFT;
+   }
+
+   if (pdata-gain) {
+   con = ~(EXYNOS_TMU_GAIN_MASK  EXYNOS_TMU_GAIN_SHIFT);
+   con |= (pdata-gain  EXYNOS_TMU_GAIN_SHIFT);
+   }
+
+   if (pdata-noise_cancel_mode) {
+   con = ~(EXYNOS_TMU_TRIP_MODE_MASK 
+   EXYNOS_TMU_TRIP_MODE_SHIFT);
+   con |= (pdata-noise_cancel_mode  EXYNOS_TMU_TRIP_MODE_SHIFT);
}
 
if (on) {
-   con |= EXYNOS_TMU_CORE_ON;
-   interrupt_en = pdata-trigger_level3_en  12 |
-   pdata-trigger_level2_en  8 |
-   pdata-trigger_level1_en  4 |
-   pdata-trigger_level0_en;
+   con |= (1  EXYNOS_TMU_CORE_EN_SHIFT);
+   interrupt_en =
+   pdata-trigger_level3_en  EXYNOS_TMU_INTEN_RISE3_SHIFT |
+   pdata-trigger_level2_en  EXYNOS_TMU_INTEN_RISE2_SHIFT |
+   pdata-trigger_level1_en  EXYNOS_TMU_INTEN_RISE1_SHIFT |
+   pdata-trigger_level0_en  EXYNOS_TMU_INTEN_RISE0_SHIFT;
if (pdata-threshold_falling)
-   interrupt_en |= interrupt_en  16;
+   interrupt_en |=
+   interrupt_en  EXYNOS_TMU_INTEN_FALL0_SHIFT;
} else {
-   con |= EXYNOS_TMU_CORE_OFF;
+   con = ~(1  EXYNOS_TMU_CORE_EN_SHIFT);
interrupt_en = 0; /* Disable all interrupts */
}
writel(interrupt_en, data-base + EXYNOS_TMU_REG_INTEN);
-- 
1.7.1

--
To unsubscribe 

[RESEND PATCH V3 01/21] thermal: exynos: Moving exynos thermal files into samsung directory

2013-05-07 Thread Amit Daniel Kachhap
This movement of files is done for easy maintenance and adding more
new sensor's support for exynos platform easily . This will also help in
bifurcating exynos common, sensor driver and sensor data related parts.

Acked-by: Kukjin Kim kgene@samsung.com
Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
---
 drivers/thermal/Kconfig|   13 +
 drivers/thermal/Makefile   |2 +-
 drivers/thermal/samsung/Kconfig|9 +
 drivers/thermal/samsung/Makefile   |4 
 drivers/thermal/{ = samsung}/exynos_thermal.c |0
 5 files changed, 19 insertions(+), 9 deletions(-)
 create mode 100644 drivers/thermal/samsung/Kconfig
 create mode 100644 drivers/thermal/samsung/Makefile
 rename drivers/thermal/{ = samsung}/exynos_thermal.c (100%)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 5e3c025..081ddc5 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -114,14 +114,6 @@ config KIRKWOOD_THERMAL
  Support for the Kirkwood thermal sensor driver into the Linux thermal
  framework. Only kirkwood 88F6282 and 88F6283 have this sensor.
 
-config EXYNOS_THERMAL
-   tristate Temperature sensor on Samsung EXYNOS
-   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
-   depends on CPU_THERMAL
-   help
- If you say yes here you get support for TMU (Thermal Management
- Unit) on SAMSUNG EXYNOS series of SoC.
-
 config DOVE_THERMAL
tristate Temperature sensor on Marvell Dove SoCs
depends on ARCH_DOVE
@@ -169,4 +161,9 @@ config INTEL_POWERCLAMP
  enforce idle time which results in more package C-state residency. The
  user interface is exposed via generic thermal framework.
 
+menu Samsung thermal drivers
+depends on PLAT_SAMSUNG
+source drivers/thermal/samsung/Kconfig
+endmenu
+
 endif
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c054d41..b3063a9 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -17,7 +17,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
 obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
 obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
-obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
+obj-y  += samsung/
 obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
 obj-$(CONFIG_DB8500_THERMAL)   += db8500_thermal.o
 obj-$(CONFIG_ARMADA_THERMAL)   += armada_thermal.o
diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
new file mode 100644
index 000..2d3d9dc
--- /dev/null
+++ b/drivers/thermal/samsung/Kconfig
@@ -0,0 +1,9 @@
+config EXYNOS_THERMAL
+   tristate Temperature sensor on Samsung EXYNOS
+   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
+   depends on CPU_THERMAL
+   help
+ If you say yes here you get support for TMU (Thermal Management
+ Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
+ the exynos thermal driver with the core thermal layer and cpu
+ cooling API's.
diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
new file mode 100644
index 000..1fe6d93
--- /dev/null
+++ b/drivers/thermal/samsung/Makefile
@@ -0,0 +1,4 @@
+#
+# Samsung thermal specific Makefile
+#
+obj-$(CONFIG_EXYNOS_THERMAL)   += exynos_thermal.o
diff --git a/drivers/thermal/exynos_thermal.c 
b/drivers/thermal/samsung/exynos_thermal.c
similarity index 100%
rename from drivers/thermal/exynos_thermal.c
rename to drivers/thermal/samsung/exynos_thermal.c
-- 
1.7.1

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


Re: [PATCH V2 01/20] thermal: exynos: Moving exynos thermal files into samsung directory

2013-05-07 Thread amit daniel kachhap
Hi Rui,

On Mon, May 6, 2013 at 8:35 PM, Zhang Rui rui.zh...@intel.com wrote:
 On Fri, 2013-04-26 at 16:07 +0530, Amit Daniel Kachhap wrote:
 This movement of files is done for easy maintenance and adding more
 new sensor's support for exynos platform easily . This will also help in
 bifurcating exynos common, sensor driver and sensor data related parts.

 Acked-by: Kukjin Kim kgene@samsung.com
 Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
 ---
  drivers/thermal/Kconfig|   13 +
  drivers/thermal/Makefile   |2 +-
  drivers/thermal/samsung/Kconfig|9 +
  drivers/thermal/samsung/Makefile   |4 
  drivers/thermal/{ = samsung}/exynos_thermal.c |0
  5 files changed, 19 insertions(+), 9 deletions(-)
  create mode 100644 drivers/thermal/samsung/Kconfig
  create mode 100644 drivers/thermal/samsung/Makefile
  rename drivers/thermal/{ = samsung}/exynos_thermal.c (100%)

 diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
 index 5e3c025..081ddc5 100644
 --- a/drivers/thermal/Kconfig
 +++ b/drivers/thermal/Kconfig
 @@ -114,14 +114,6 @@ config KIRKWOOD_THERMAL
 Support for the Kirkwood thermal sensor driver into the Linux thermal
 framework. Only kirkwood 88F6282 and 88F6283 have this sensor.

 -config EXYNOS_THERMAL
 - tristate Temperature sensor on Samsung EXYNOS
 - depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
 - depends on CPU_THERMAL
 - help
 -   If you say yes here you get support for TMU (Thermal Management
 -   Unit) on SAMSUNG EXYNOS series of SoC.
 -
  config DOVE_THERMAL
   tristate Temperature sensor on Marvell Dove SoCs
   depends on ARCH_DOVE
 @@ -169,4 +161,9 @@ config INTEL_POWERCLAMP
 enforce idle time which results in more package C-state residency. 
 The
 user interface is exposed via generic thermal framework.

 +menu Exynos thermal drivers

 would it be more proper to use Samsung thermal drivers or Samsung
 Exynos thermal drivers instead?
Yes Samsung thermal drivers will look fine. Submitted with this change.

 +depends on PLAT_SAMSUNG
 +source drivers/thermal/samsung/Kconfig
 +endmenu
 +
 sorry I know few about arm,
 could you tell me the difference between
 CONFIG_ARCH_EXYNOS4/CONFIG_ARCH_EXYNOS5 and CONFIG_PLAT_SAMSUNG please,
 I do not see the dependency between these in Kconfig file?
PLAT_SAMSUNG is the superset of ARCH_EXYNOS4/5 so I used this
dependency but currently only exynos based soc's have TMU driver. Also
it matches with the folder name.

Thanks,
Amit Daniel

 thanks,
 rui
  endif
 diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
 index c054d41..b3063a9 100644
 --- a/drivers/thermal/Makefile
 +++ b/drivers/thermal/Makefile
 @@ -17,7 +17,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL)   += cpu_cooling.o
  obj-$(CONFIG_SPEAR_THERMAL)  += spear_thermal.o
  obj-$(CONFIG_RCAR_THERMAL)   += rcar_thermal.o
  obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
 -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
 +obj-y+= samsung/
  obj-$(CONFIG_DOVE_THERMAL)   += dove_thermal.o
  obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o
  obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o
 diff --git a/drivers/thermal/samsung/Kconfig 
 b/drivers/thermal/samsung/Kconfig
 new file mode 100644
 index 000..2d3d9dc
 --- /dev/null
 +++ b/drivers/thermal/samsung/Kconfig
 @@ -0,0 +1,9 @@
 +config EXYNOS_THERMAL
 + tristate Temperature sensor on Samsung EXYNOS
 + depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
 + depends on CPU_THERMAL
 + help
 +   If you say yes here you get support for TMU (Thermal Management
 +   Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
 +   the exynos thermal driver with the core thermal layer and cpu
 +   cooling API's.
 diff --git a/drivers/thermal/samsung/Makefile 
 b/drivers/thermal/samsung/Makefile
 new file mode 100644
 index 000..1fe6d93
 --- /dev/null
 +++ b/drivers/thermal/samsung/Makefile
 @@ -0,0 +1,4 @@
 +#
 +# Samsung thermal specific Makefile
 +#
 +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
 diff --git a/drivers/thermal/exynos_thermal.c 
 b/drivers/thermal/samsung/exynos_thermal.c
 similarity index 100%
 rename from drivers/thermal/exynos_thermal.c
 rename to drivers/thermal/samsung/exynos_thermal.c


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


Re: [PATCH V2 02/20] thermal: exynos: Bifurcate exynos thermal common and tmu controller code

2013-05-07 Thread amit daniel kachhap
Hi Rui,

On Mon, May 6, 2013 at 8:46 PM, Zhang Rui rui.zh...@intel.com wrote:
 On Fri, 2013-04-26 at 16:07 +0530, Amit Daniel Kachhap wrote:
 This code bifurcates exynos thermal implementation into common and sensor
 specific parts. The common thermal code interacts with core thermal layer and
 core cpufreq cooling parts and is independent of SOC specific driver. This
 change is needed to cleanly add support for new TMU sensors.

 Acked-by: Kukjin Kim kgene@samsung.com
 Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
 ---
  drivers/thermal/samsung/Kconfig |   26 +-
  drivers/thermal/samsung/Makefile|4 +-
  drivers/thermal/samsung/exynos_thermal.c|  421 
 +--
  drivers/thermal/samsung/exynos_thermal_common.c |  389 +
  drivers/thermal/samsung/exynos_thermal_common.h |   71 
  5 files changed, 491 insertions(+), 420 deletions(-)
  create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c
  create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h

 diff --git a/drivers/thermal/samsung/Kconfig 
 b/drivers/thermal/samsung/Kconfig
 index 2d3d9dc..1e3ba31 100644
 --- a/drivers/thermal/samsung/Kconfig
 +++ b/drivers/thermal/samsung/Kconfig
 @@ -1,9 +1,21 @@
 -config EXYNOS_THERMAL
 - tristate Temperature sensor on Samsung EXYNOS
 +config EXYNOS_COMMON

 EXYNOS_COMMON is misleading here, better use EXYNOS_THERMAL_COMMON?
Yes  submitted V3 version with this change.

 + bool Common thermal support for EXYNOS SOC's
   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
 - depends on CPU_THERMAL
   help
 -   If you say yes here you get support for TMU (Thermal Management
 -   Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
 -   the exynos thermal driver with the core thermal layer and cpu
 -   cooling API's.
 +   If you say yes here you get support for EXYNOS TMU
 +   (Thermal Management Unit) common registration/unregistration
 +   functions to the core thermal layer and also to use the generic
 +   cpu cooling API's.
 +
 +if EXYNOS_COMMON
 +
 +config EXYNOS_SOC_THERMAL
 + tristate Temperature sensor on Samsung EXYNOS series SOC
 + depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412 || 
 SOC_EXYNOS5250)
 + help
 +   If you say yes here you can enable TMU (Thermal Management Unit) on
 +   SAMSUNG EXYNOS 4210, 4412, 4414 and 5250 series of SoC. This option
 +   initialises the TMU controller and registers/unregisters with exynos
 +   common thermal layer.
 +
 +endif
 diff --git a/drivers/thermal/samsung/Makefile 
 b/drivers/thermal/samsung/Makefile
 index 1fe6d93..fcda5b4 100644
 --- a/drivers/thermal/samsung/Makefile
 +++ b/drivers/thermal/samsung/Makefile
 @@ -1,4 +1,6 @@
  #
  # Samsung thermal specific Makefile
  #
 -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
 +obj-$(CONFIG_EXYNOS_SOC_THERMAL) += exynos_soc_thermal.o
 +exynos_soc_thermal-y := exynos_thermal.o
 +exynos_soc_thermal-$(CONFIG_EXYNOS_COMMON)   += exynos_thermal_common.o

 the Makefile suggests that exynos_soc_thermal driver could be built
 without CONFIG_EXYNOS_COMMON.
 But the Kconfig file shows that exynos_soc_thermal depends on
 CONFIG_EXYNOS_COMMON.
 If exynos_thermal_common.c contains the code to interact with the
 generic thermal layer and you do not want a soc driver without thermal
 support, just remove CONFIG_EXYNOS_COMMON and always build it into
 exynos_soc_thermal.o.
 what do you think?

This is a good catch. I somehow missed this. I just submitted a patch
fixing this issue. Actually CONFIG_EXYNOS_COMMON is independent of
CONFIG_EXYNOS_SOC_THERMAL. Now I have added 3
 Kconfig symbol that maps to tmu driver. exynos common part and exynos
configuration data.
In the makefile TMU driver is selected when CONFIG_EXYNOS_SOC_THERMAL
is enabled. To have extra support for common part and configuration
data, those configs need to be enabled

Thanks,
Amit Daniel

 thanks,
 rui
 diff --git a/drivers/thermal/samsung/exynos_thermal.c 
 b/drivers/thermal/samsung/exynos_thermal.c
 index d20ce9e..4c85945 100644
 --- a/drivers/thermal/samsung/exynos_thermal.c
 +++ b/drivers/thermal/samsung/exynos_thermal.c
 @@ -21,23 +21,19 @@
   *
   */

 -#include linux/module.h
 -#include linux/err.h
 -#include linux/kernel.h
 -#include linux/slab.h
 -#include linux/platform_device.h
 -#include linux/interrupt.h
  #include linux/clk.h
 -#include linux/workqueue.h
 -#include linux/sysfs.h
 -#include linux/kobject.h
  #include linux/io.h
 +#include linux/interrupt.h
 +#include linux/kernel.h
 +#include linux/kobject.h
 +#include linux/module.h
  #include linux/mutex.h
 -#include linux/platform_data/exynos_thermal.h
 -#include linux/thermal.h
 -#include linux/cpufreq.h
 -#include linux/cpu_cooling.h
  #include linux/of.h
 +#include linux/platform_device.h
 +#include linux/platform_data/exynos_thermal.h
 +#include 

Re: [PATCH V2 01/20] thermal: exynos: Moving exynos thermal files into samsung directory

2013-05-07 Thread Tomasz Figa
On Tuesday 07 of May 2013 18:48:46 amit daniel kachhap wrote:
 Hi Tomasz Figa,
 
 On Tue, May 7, 2013 at 3:51 PM, Tomasz Figa t.f...@samsung.com wrote:
  On Monday 06 of May 2013 23:05:06 Zhang Rui wrote:
  On Fri, 2013-04-26 at 16:07 +0530, Amit Daniel Kachhap wrote:
   This movement of files is done for easy maintenance and adding more
   new sensor's support for exynos platform easily . This will also help
   in
   bifurcating exynos common, sensor driver and sensor data related parts.
   
   Acked-by: Kukjin Kim kgene@samsung.com
   Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
   ---
   
drivers/thermal/Kconfig|   13 +
drivers/thermal/Makefile   |2 +-
drivers/thermal/samsung/Kconfig|9 +
drivers/thermal/samsung/Makefile   |4 
drivers/thermal/{ = samsung}/exynos_thermal.c |0
5 files changed, 19 insertions(+), 9 deletions(-)
create mode 100644 drivers/thermal/samsung/Kconfig
create mode 100644 drivers/thermal/samsung/Makefile
rename drivers/thermal/{ = samsung}/exynos_thermal.c (100%)
   
   diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
   index 5e3c025..081ddc5 100644
   --- a/drivers/thermal/Kconfig
   +++ b/drivers/thermal/Kconfig
   @@ -114,14 +114,6 @@ config KIRKWOOD_THERMAL
   
 Support for the Kirkwood thermal sensor driver into the Linux
 thermal
 framework. Only kirkwood 88F6282 and 88F6283 have this sensor.
   
   -config EXYNOS_THERMAL
   -   tristate Temperature sensor on Samsung EXYNOS
   -   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
   -   depends on CPU_THERMAL
   -   help
   - If you say yes here you get support for TMU (Thermal Management
   - Unit) on SAMSUNG EXYNOS series of SoC.
   -
   
config DOVE_THERMAL

   tristate Temperature sensor on Marvell Dove SoCs
   depends on ARCH_DOVE
   
   @@ -169,4 +161,9 @@ config INTEL_POWERCLAMP
   
 enforce idle time which results in more package C-state
 residency. The
 user interface is exposed via generic thermal framework.
   
   +menu Exynos thermal drivers
  
  would it be more proper to use Samsung thermal drivers or Samsung
  Exynos thermal drivers instead?
  
  +1
  
  Still, I wonder if it really makes sense to create a separate directory
  and
  submenu for this.
 
 Yes separate directory was needed as the current TMU drivers supports
 many exynos SOC's with some differences in the controller itself. This
 has made it unmanageable and unclean and configuration data need to be
 separated from driver. With all these re-structuring, tmu support for
 exynos5440 is added very cleanly. Also many changes in this patchset
 are for making the driver multi-stance which is needed for 5440.

I fully understand the need to restructure this driver. I'm just thinking if 
there is really a reason to have a separate directory with its own Makefile and 
Kconfig just for six source files, which could be placed in drivers/thermal/ 
directly as well. I guess it's just a matter of preference, though.

Best regards,
-- 
Tomasz Figa
Samsung Poland RD Center
SW Solution Development, Kernel and System Framework

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


Re: [PATCH V3 02/21] thermal: exynos: Bifurcate exynos thermal common and tmu controller code

2013-05-07 Thread Zhang Rui
On Tue, 2013-05-07 at 18:30 +0530, Amit Daniel Kachhap wrote:
 This code bifurcates exynos thermal implementation into common and sensor
 specific parts. The common thermal code interacts with core thermal layer and
 core cpufreq cooling parts and is independent of SOC specific driver. This
 change is needed to cleanly add support for new TMU sensors.
 
 Acked-by: Kukjin Kim kgene@samsung.com
 Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
 ---
  drivers/thermal/samsung/Kconfig |   20 +-
  drivers/thermal/samsung/Makefile|4 +-
  drivers/thermal/samsung/exynos_thermal.c|  421 
 +--
  drivers/thermal/samsung/exynos_thermal_common.c |  389 +
  drivers/thermal/samsung/exynos_thermal_common.h |   83 +
  5 files changed, 498 insertions(+), 419 deletions(-)
  create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c
  create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h
 
 diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
 index 2d3d9dc..7857e20 100644
 --- a/drivers/thermal/samsung/Kconfig
 +++ b/drivers/thermal/samsung/Kconfig
 @@ -1,9 +1,17 @@
  config EXYNOS_THERMAL
 - tristate Temperature sensor on Samsung EXYNOS
 + tristate Exynos thermal management unit driver
   depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5)
 - depends on CPU_THERMAL
   help
 -   If you say yes here you get support for TMU (Thermal Management
 -   Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering
 -   the exynos thermal driver with the core thermal layer and cpu
 -   cooling API's.
 +   If you say yes here you get support for the exynos thermal driver
 +   for exynos4 and exynos5 soc. This driver initialises the TMU, reports
 +   temperature and handles cooling action if defined. This driver uses
 +   core thermal API's.
 +
 +config EXYNOS_THERMAL_CORE
 + bool Core thermal framework support for EXYNOS SOC's
 + depends on EXYNOS_THERMAL
 + help
 +   If you say yes here you get support for EXYNOS TMU
 +   (Thermal Management Unit) common registration/unregistration
 +   functions to the core thermal layer and also to use the generic
 +   cpu cooling API's.

I'm still not quite clear what you want to get there.
If EXYNOS_THERMAL=y and EXYNOS_THERMAL_CORE=n, you'll get an Exynos tmu
driver which is not shown in /sys/class/thermal/ and can not be used for
thermal management?

thanks,
rui
 diff --git a/drivers/thermal/samsung/Makefile 
 b/drivers/thermal/samsung/Makefile
 index 1fe6d93..6227d4f 100644
 --- a/drivers/thermal/samsung/Makefile
 +++ b/drivers/thermal/samsung/Makefile
 @@ -1,4 +1,6 @@
  #
  # Samsung thermal specific Makefile
  #
 -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
 +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o
 +exynos_soc_thermal-y := exynos_thermal.o
 +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
 diff --git a/drivers/thermal/samsung/exynos_thermal.c 
 b/drivers/thermal/samsung/exynos_thermal.c
 index d20ce9e..4c85945 100644
 --- a/drivers/thermal/samsung/exynos_thermal.c
 +++ b/drivers/thermal/samsung/exynos_thermal.c
 @@ -21,23 +21,19 @@
   *
   */
  
 -#include linux/module.h
 -#include linux/err.h
 -#include linux/kernel.h
 -#include linux/slab.h
 -#include linux/platform_device.h
 -#include linux/interrupt.h
  #include linux/clk.h
 -#include linux/workqueue.h
 -#include linux/sysfs.h
 -#include linux/kobject.h
  #include linux/io.h
 +#include linux/interrupt.h
 +#include linux/kernel.h
 +#include linux/kobject.h
 +#include linux/module.h
  #include linux/mutex.h
 -#include linux/platform_data/exynos_thermal.h
 -#include linux/thermal.h
 -#include linux/cpufreq.h
 -#include linux/cpu_cooling.h
  #include linux/of.h
 +#include linux/platform_device.h
 +#include linux/platform_data/exynos_thermal.h
 +#include linux/slab.h
 +#include linux/workqueue.h
 +#include exynos_thermal_common.h
  
  /* Exynos generic registers */
  #define EXYNOS_TMU_REG_TRIMINFO  0x0
 @@ -88,16 +84,6 @@
  #define EFUSE_MIN_VALUE 40
  #define EFUSE_MAX_VALUE 100
  
 -/* In-kernel thermal framework related macros  definations */
 -#define SENSOR_NAME_LEN  16
 -#define MAX_TRIP_COUNT   8
 -#define MAX_COOLING_DEVICE 4
 -#define MAX_THRESHOLD_LEVS 4
 -
 -#define ACTIVE_INTERVAL 500
 -#define IDLE_INTERVAL 1
 -#define MCELSIUS 1000
 -
  #ifdef CONFIG_THERMAL_EMULATION
  #define EXYNOS_EMUL_TIME 0x57F0
  #define EXYNOS_EMUL_TIME_SHIFT   16
 @@ -106,17 +92,6 @@
  #define EXYNOS_EMUL_ENABLE   0x1
  #endif /* CONFIG_THERMAL_EMULATION */
  
 -/* CPU Zone information */
 -#define PANIC_ZONE  4
 -#define WARN_ZONE   3
 -#define MONITOR_ZONE2
 -#define SAFE_ZONE   1
 -
 -#define GET_ZONE(trip) (trip + 2)
 -#define GET_TRIP(zone) (zone - 2)
 -
 -#define EXYNOS_ZONE_COUNT3
 -
  

[PATCH v9 2/3] of/pci: mips: convert to common of_pci_range_parser

2013-05-07 Thread Andrew Murray
This patch converts the pci_load_of_ranges function to use the new common
of_pci_range_parser.

Signed-off-by: Andrew Murray andrew.mur...@arm.com
Signed-off-by: Liviu Dudau liviu.du...@arm.com
Signed-off-by: Gabor Juhos juh...@openwrt.org
Reviewed-by: Rob Herring rob.herr...@calxeda.com
Reviewed-by: Grant Likely grant.lik...@secretlab.ca
Tested-by: Linus Walleij linus.wall...@linaro.org
---
 arch/mips/pci/pci.c |   50 ++
 1 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 0872f12..0d291e9 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -122,51 +122,37 @@ static void pcibios_scanbus(struct pci_controller *hose)
 #ifdef CONFIG_OF
 void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
 {
-   const __be32 *ranges;
-   int rlen;
-   int pna = of_n_addr_cells(node);
-   int np = pna + 5;
+   struct of_pci_range range;
+   struct of_pci_range_parser parser;
 
pr_info(PCI host bridge %s ranges:\n, node-full_name);
-   ranges = of_get_property(node, ranges, rlen);
-   if (ranges == NULL)
-   return;
hose-of_node = node;
 
-   while ((rlen -= np * 4) = 0) {
-   u32 pci_space;
+   if (of_pci_range_parser_init(parser, node))
+   return;
+
+   for_each_of_pci_range(parser, range) {
struct resource *res = NULL;
-   u64 addr, size;
-
-   pci_space = be32_to_cpup(ranges[0]);
-   addr = of_translate_address(node, ranges + 3);
-   size = of_read_number(ranges + pna + 3, 2);
-   ranges += np;
-   switch ((pci_space  24)  0x3) {
-   case 1: /* PCI IO space */
+
+   switch (range.flags  IORESOURCE_TYPE_BITS) {
+   case IORESOURCE_IO:
pr_info(  IO 0x%016llx..0x%016llx\n,
-   addr, addr + size - 1);
+   range.cpu_addr,
+   range.cpu_addr + range.size - 1);
hose-io_map_base =
-   (unsigned long)ioremap(addr, size);
+   (unsigned long)ioremap(range.cpu_addr,
+  range.size);
res = hose-io_resource;
-   res-flags = IORESOURCE_IO;
break;
-   case 2: /* PCI Memory space */
-   case 3: /* PCI 64 bits Memory space */
+   case IORESOURCE_MEM:
pr_info( MEM 0x%016llx..0x%016llx\n,
-   addr, addr + size - 1);
+   range.cpu_addr,
+   range.cpu_addr + range.size - 1);
res = hose-mem_resource;
-   res-flags = IORESOURCE_MEM;
break;
}
-   if (res != NULL) {
-   res-start = addr;
-   res-name = node-full_name;
-   res-end = res-start + size - 1;
-   res-parent = NULL;
-   res-sibling = NULL;
-   res-child = NULL;
-   }
+   if (res != NULL)
+   of_pci_range_to_resource(range, node, res);
}
 }
 #endif
-- 
1.7.0.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 v9 3/3] of/pci: microblaze: convert to common of_pci_range_parser

2013-05-07 Thread Andrew Murray
This patch converts the pci_load_of_ranges function to use the new common
of_pci_range_parser.

Signed-off-by: Andrew Murray andrew.mur...@arm.com
Signed-off-by: Liviu Dudau liviu.du...@arm.com
---
 arch/microblaze/pci/pci-common.c |  106 ++
 1 files changed, 38 insertions(+), 68 deletions(-)

diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 9ea521e..ba9e4a1 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -658,67 +658,42 @@ void pci_resource_to_user(const struct pci_dev *dev, int 
bar,
 void pci_process_bridge_OF_ranges(struct pci_controller *hose,
  struct device_node *dev, int primary)
 {
-   const u32 *ranges;
-   int rlen;
-   int pna = of_n_addr_cells(dev);
-   int np = pna + 5;
int memno = 0, isa_hole = -1;
-   u32 pci_space;
-   unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size;
unsigned long long isa_mb = 0;
struct resource *res;
+   struct of_pci_range range;
+   struct of_pci_range_parser parser;
 
pr_info(PCI host bridge %s %s ranges:\n,
   dev-full_name, primary ? (primary) : );
 
-   /* Get ranges property */
-   ranges = of_get_property(dev, ranges, rlen);
-   if (ranges == NULL)
+   /* Check for ranges property */
+   if (of_pci_range_parser_init(parser, dev))
return;
 
-   /* Parse it */
pr_debug(Parsing ranges property...\n);
-   while ((rlen -= np * 4) = 0) {
+   for_each_of_pci_range(parser, range) {
/* Read next ranges element */
-   pci_space = ranges[0];
-   pci_addr = of_read_number(ranges + 1, 2);
-   cpu_addr = of_translate_address(dev, ranges + 3);
-   size = of_read_number(ranges + pna + 3, 2);
-
pr_debug(pci_space: 0x%08x pci_addr:0x%016llx ,
-   pci_space, pci_addr);
+   range.pci_space, range.pci_addr);
pr_debug(cpu_addr:0x%016llx size:0x%016llx\n,
-   cpu_addr, size);
-
-   ranges += np;
+   range.cpu_addr, range.size);
 
/* If we failed translation or got a zero-sized region
 * (some FW try to feed us with non sensical zero sized regions
 * such as power3 which look like some kind of attempt
 * at exposing the VGA memory hole)
 */
-   if (cpu_addr == OF_BAD_ADDR || size == 0)
+   if (range.cpu_addr == OF_BAD_ADDR || range.size == 0)
continue;
 
-   /* Now consume following elements while they are contiguous */
-   for (; rlen = np * sizeof(u32);
-ranges += np, rlen -= np * 4) {
-   if (ranges[0] != pci_space)
-   break;
-   pci_next = of_read_number(ranges + 1, 2);
-   cpu_next = of_translate_address(dev, ranges + 3);
-   if (pci_next != pci_addr + size ||
-   cpu_next != cpu_addr + size)
-   break;
-   size += of_read_number(ranges + pna + 3, 2);
-   }
-
/* Act based on address space type */
res = NULL;
-   switch ((pci_space  24)  0x3) {
-   case 1: /* PCI IO space */
+   switch (range.flags  IORESOURCE_TYPE_BITS) {
+   case IORESOURCE_IO:
pr_info(  IO 0x%016llx..0x%016llx - 0x%016llx\n,
-  cpu_addr, cpu_addr + size - 1, pci_addr);
+   range.cpu_addr, range.cpu_addr + range.size - 1,
+   range.pci_addr);
 
/* We support only one IO range */
if (hose-pci_io_size) {
@@ -726,11 +701,12 @@ void pci_process_bridge_OF_ranges(struct pci_controller 
*hose,
continue;
}
/* On 32 bits, limit I/O space to 16MB */
-   if (size  0x0100)
-   size = 0x0100;
+   if (range.size  0x0100)
+   range.size = 0x0100;
 
/* 32 bits needs to map IOs here */
-   hose-io_base_virt = ioremap(cpu_addr, size);
+   hose-io_base_virt = ioremap(range.cpu_addr,
+   range.size);
 
/* Expect trouble if pci_addr is not 0 */
if (primary)
@@ -739,19 +715,20 @@ void pci_process_bridge_OF_ranges(struct pci_controller 
*hose,
/* 

[PATCH v9 0/3] of/pci: Provide common support for PCI DT parsing

2013-05-07 Thread Andrew Murray
This patchset factors out duplicated code associated with parsing PCI
DT ranges properties across the architectures and introduces a
ranges parser. This parser of_pci_range_parser can be used directly
by ARM host bridge drivers enabling them to obtain ranges from device
trees.

I've included the Reviewed-by, Tested-by and Acked-by's received from
v5/v6/v7/v8 in this patchset, earlier versions of this patchset (v3) have been
tested-by:

Thierry Reding thierry.red...@avionic-design.de
Jingoo Han jg1@samsung.com

I've tested that this patchset builds and runs on ARM and that it builds on
PowerPC, x86_64, MIPS and Microblaze.

Compared to the v8 sent by Andrew Murray, the following changes have been made
(please note that the MIPS patch is unchanged from v8):

 * Remove the unification of pci_process_bridge_OF_ranges between PowerPC and
   Microblaze. Feedback from Bjorn and Benjamin (along with a NAK) suggested
   that this goes against their future direction (using more of struct
   pci_host_bridge and less of arch specific struct pci_controller).

Compared to the v7 sent by Andrew Murray, the following changes have been made
(please note that the first patch is unchanged from v7):

 * Rename of_pci_range_parser to of_pci_range_parser_init and
   of_pci_process_ranges to of_pci_range_parser_one as suggested by Grant
   Likely.

 * Reverted back to using a switch statement instead of if/else in
   pci_process_bridge_OF_ranges. Grant Likely highlighted this change from
   the original code which was unnecessary.

 * Squashed in a patch provided by Gabor Juhos which fixes build errors on
   MIPS found in the last patchset.

Compared to the v6 sent by Andrew Murray, the following changes have
been made in response to build errors/warnings:

 * Inclusion of linux/of_address.h in of_pci.c as suggested by Michal
   Simek to prevent compilation failures on Microblaze (and others) and his
   ack.

 * Use of externs, static inlines and a typo in linux/of_address.h in response
   to linker errors (multiple defination) on x86_64 as spotted by a kbuild test
   robot on (jcooper/linux.git mvebu/drivers)

 * Add EXPORT_SYMBOL_GPL to of_pci_range_parser function to be consistent
   with of_pci_process_ranges function

Compared to the v5 sent by Andrew Murray, the following changes have
been made:

 * Use of CONFIG_64BIT instead of CONFIG_[a32bitarch] as suggested by
   Rob Herring in drivers/of/of_pci.c

 * Added forward declaration of struct pci_controller in linux/of_pci.h
   to prevent compiler warning as suggested by Thomas Petazzoni

 * Improved error checking (!range check), removal of unnecessary be32_to_cpup
   call, improved formatting of struct of_pci_range_parser layout and
   replacement of macro with a static inline. All suggested by Rob Herring.

Compared to the v4 (incorrectly labelled v3) sent by Andrew Murray,
the following changes have been made:

 * Split the patch as suggested by Rob Herring

Compared to the v3 sent by Andrew Murray, the following changes have
been made:

 * Unify and move duplicate pci_process_bridge_OF_ranges functions to
   drivers/of/of_pci.c as suggested by Rob Herring

 * Fix potential build errors with Microblaze/MIPS

Compared to [PATCH v5 01/17] of/pci: Provide support for parsing PCI DT
ranges property, the following changes have been made:

 * Correct use of IORESOURCE_* as suggested by Russell King

 * Improved interface and naming as suggested by Thierry Reding

Compared to the v2 sent by Andrew Murray, Thomas Petazzoni did:

 * Add a memset() on the struct of_pci_range_iter when starting the
   for loop in for_each_pci_range(). Otherwise, with an uninitialized
   of_pci_range_iter, of_pci_process_ranges() may crash.

 * Add parenthesis around 'res', 'np' and 'iter' in the
   for_each_of_pci_range macro definitions. Otherwise, passing
   something like foobar as 'res' didn't work.

 * Rebased on top of 3.9-rc2, which required fixing a few conflicts in
   the Microblaze code.

v2:
  This follows on from suggestions made by Grant Likely
  (marc.info/?l=linux-kernelm=136079602806328)

Andrew Murray (3):
  of/pci: Provide support for parsing PCI DT ranges property
  of/pci: mips: convert to common of_pci_range_parser
  of/pci: microblaze: convert to common of_pci_range_parser

 arch/microblaze/pci/pci-common.c |  106 ++
 arch/mips/pci/pci.c  |   50 ++---
 drivers/of/address.c |   67 
 include/linux/of_address.h   |   48 +
 4 files changed, 171 insertions(+), 100 deletions(-)

--
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 v9 1/3] of/pci: Provide support for parsing PCI DT ranges property

2013-05-07 Thread Andrew Murray
This patch factors out common implementation patterns to reduce overall kernel
code and provide a means for host bridge drivers to directly obtain struct
resources from the DT's ranges property without relying on architecture specific
DT handling. This will make it easier to write archiecture independent host 
bridge
drivers and mitigate against further duplication of DT parsing code.

This patch can be used in the following way:

struct of_pci_range_parser parser;
struct of_pci_range range;

if (of_pci_range_parser_init(parser, np))
; //no ranges property

for_each_of_pci_range(parser, range) {

/*
directly access properties of the address range, e.g.:
range.pci_space, range.pci_addr, range.cpu_addr,
range.size, range.flags

alternatively obtain a struct resource, e.g.:
struct resource res;
of_pci_range_to_resource(range, np, res);
*/
}

Additionally the implementation takes care of adjacent ranges and merges them
into a single range (as was the case with powerpc and microblaze).

Signed-off-by: Andrew Murray andrew.mur...@arm.com
Signed-off-by: Liviu Dudau liviu.du...@arm.com
Signed-off-by: Thomas Petazzoni thomas.petazz...@free-electrons.com
Reviewed-by: Rob Herring rob.herr...@calxeda.com
Tested-by: Thomas Petazzoni thomas.petazz...@free-electrons.com
Tested-by: Linus Walleij linus.wall...@linaro.org
Tested-by: Jingoo Han jg1@samsung.com
Acked-by: Grant Likely grant.lik...@secretlab.ca
---
 drivers/of/address.c   |   67 
 include/linux/of_address.h |   48 +++
 2 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 04da786..fdd0636 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -227,6 +227,73 @@ int of_pci_address_to_resource(struct device_node *dev, 
int bar,
return __of_address_to_resource(dev, addrp, size, flags, NULL, r);
 }
 EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
+
+int of_pci_range_parser_init(struct of_pci_range_parser *parser,
+   struct device_node *node)
+{
+   const int na = 3, ns = 2;
+   int rlen;
+
+   parser-node = node;
+   parser-pna = of_n_addr_cells(node);
+   parser-np = parser-pna + na + ns;
+
+   parser-range = of_get_property(node, ranges, rlen);
+   if (parser-range == NULL)
+   return -ENOENT;
+
+   parser-end = parser-range + rlen / sizeof(__be32);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(of_pci_range_parser_init);
+
+struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser 
*parser,
+   struct of_pci_range *range)
+{
+   const int na = 3, ns = 2;
+
+   if (!range)
+   return NULL;
+
+   if (!parser-range || parser-range + parser-np  parser-end)
+   return NULL;
+
+   range-pci_space = parser-range[0];
+   range-flags = of_bus_pci_get_flags(parser-range);
+   range-pci_addr = of_read_number(parser-range + 1, ns);
+   range-cpu_addr = of_translate_address(parser-node,
+   parser-range + na);
+   range-size = of_read_number(parser-range + parser-pna + na, ns);
+
+   parser-range += parser-np;
+
+   /* Now consume following elements while they are contiguous */
+   while (parser-range + parser-np = parser-end) {
+   u32 flags, pci_space;
+   u64 pci_addr, cpu_addr, size;
+
+   pci_space = be32_to_cpup(parser-range);
+   flags = of_bus_pci_get_flags(parser-range);
+   pci_addr = of_read_number(parser-range + 1, ns);
+   cpu_addr = of_translate_address(parser-node,
+   parser-range + na);
+   size = of_read_number(parser-range + parser-pna + na, ns);
+
+   if (flags != range-flags)
+   break;
+   if (pci_addr != range-pci_addr + range-size ||
+   cpu_addr != range-cpu_addr + range-size)
+   break;
+
+   range-size += size;
+   parser-range += parser-np;
+   }
+
+   return range;
+}
+EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
+
 #endif /* CONFIG_PCI */
 
 /*
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 0506eb5..4c2e6f2 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,36 @@
 #include linux/errno.h
 #include linux/of.h
 
+struct of_pci_range_parser {
+   struct device_node *node;
+   const __be32 *range;
+   const __be32 *end;
+   int np;
+   int pna;
+};
+
+struct of_pci_range {
+   u32 pci_space;
+   u64 pci_addr;
+   u64 cpu_addr;
+   u64 

Re: [PATCH] usb: gadget: s3c2410_udc: fix error return code in s3c2410_udc_probe()

2013-05-07 Thread Jingoo Han
On Tuesday, May 07, 2013 8:48 PM, Wei Yongjun wrote:
 
 From: Wei Yongjun yongjun_...@trendmicro.com.cn
 
 Fix to return a negative error code in the gpio_to_irq() error handling
 case instead of 0, as done elsewhere in this function.
 
 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn

Reviewed-by: Jingoo Han jg1@samsung.com

Best regards,
Jingoo Han


 ---
  drivers/usb/gadget/s3c2410_udc.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/usb/gadget/s3c2410_udc.c 
 b/drivers/usb/gadget/s3c2410_udc.c
 index d0e75e1..c974776 100644
 --- a/drivers/usb/gadget/s3c2410_udc.c
 +++ b/drivers/usb/gadget/s3c2410_udc.c
 @@ -1851,6 +1851,7 @@ static int s3c2410_udc_probe(struct platform_device 
 *pdev)
   irq = gpio_to_irq(udc_info-vbus_pin);
   if (irq  0) {
   dev_err(dev, no irq for gpio vbus pin\n);
 + retval = irq;
   goto err_gpio_claim;
   }
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

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