Re: [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree

2012-01-04 Thread Amit Kachhap
On 5 January 2012 10:06, Olof Johansson  wrote:
> On Wed, Jan 4, 2012 at 8:25 PM, Amit Daniel Kachhap
>  wrote:
>> This patch enables calling generic l2 setup functions if device tree is used.
>>
>> Signed-off-by: Amit Daniel Kachhap 
>> ---
>>  arch/arm/mach-exynos/common.c |   14 --
>>  1 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
>> index f8bb808..e91b92d 100644
>> --- a/arch/arm/mach-exynos/common.c
>> +++ b/arch/arm/mach-exynos/common.c
>> @@ -47,6 +47,8 @@
>>  #include 
>>
>>  #include "common.h"
>> +#define L2_AUX_VAL 0x7C470001
>> +#define L2_AUX_MASK 0xC200
>>
>>  static const char name_exynos4210[] = "EXYNOS4210";
>>  static const char name_exynos4212[] = "EXYNOS4212";
>> @@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
>>  #ifdef CONFIG_CACHE_L2X0
>>  static int __init exynos4_l2x0_cache_init(void)
>>  {
>> +#ifdef CONFIG_OF
>> +       int ret;
>> +       ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
>> +       if (!ret) {
>> +               l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
>> +               clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
>> +               return 0;
>> +       }
>> +#endif
>
> No need for ifdef here, if CONFIG_OF is off, then there's a static
> inline version of l2x_of_init() that will return -ENODEV.

Will accept your suggestion. Thanks

>
>
> -Olof
--
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: [lm-sensors] [RFC PATCH 2/3] thermal: exynos4: Register the tmu sensor with the thermal interface layer

2012-01-04 Thread Donggeun Kim
Actually, the TMU driver is closely related to thermal layer.
I think it's okay to move it to the thermal.

Thanks.
-Donggeun

On 2012년 01월 04일 19:14, Amit Kachhap wrote:
> Hi Guenter,
> 
> The main idea of this work is to leave the current userspace based
> notification scheme and add the kernel based cooling scheme on top of
> it. Anyway, It is a good idea to move the file hwmon/exynos4_tmu.c as
> this creates 2 hwmon entries.
> Adding CC: Donggeun Kim to know his opinion.
> 
> Thanks,
> Amit Daniel
> 
> On 4 January 2012 03:55, Guenter Roeck  wrote:
>> On Wed, 2011-12-21 at 06:59 -0500, Amit Daniel Kachhap wrote:
>>> Export and register information from the hwmon tmu sensor to the samsung
>>> exynos kernel thermal framework where different cooling devices and thermal
>>> zone are binded. The exported information is based according to the data
>>> structure thermal_sensor_conf present in exynos_thermal.h. HWMON sysfs
>>> functions are currently left although all of them are present in generic
>>> linux thermal layer.
>>> Also the platform data structure is modified to pass frequency cooling
>>> in percentages for each thermal level.
>>>
>> Hi Amit,
>>
>> wouldn't it make more sense to merge the code as necessary from
>> hwmon/exynos4_tmu.c into the new thermal/exynos_thermal.c, and drop
>> hwmon/exynos4_tmu.c entirely ?
>>
>> With that, you should get the hwmon entries for free, and we would not
>> have to maintain two drivers with overlapping functionality.
>>
>> Thanks,
>> Guenter
>>
>>> Signed-off-by: Amit Daniel Kachhap 
>>> ---
>>>  drivers/hwmon/exynos4_tmu.c   |   34 
>>> ++--
>>>  include/linux/platform_data/exynos4_tmu.h |7 ++
>>>  2 files changed, 38 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/hwmon/exynos4_tmu.c b/drivers/hwmon/exynos4_tmu.c
>>> index f2359a0..6912a7f 100644
>>> --- a/drivers/hwmon/exynos4_tmu.c
>>> +++ b/drivers/hwmon/exynos4_tmu.c
>>> @@ -37,6 +37,9 @@
>>>  #include 
>>>
>>>  #include 
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> +#include 
>>> +#endif
>>>
>>>  #define EXYNOS4_TMU_REG_TRIMINFO 0x0
>>>  #define EXYNOS4_TMU_REG_CONTROL  0x20
>>> @@ -248,10 +251,13 @@ static void exynos4_tmu_work(struct work_struct *work)
>>>
>>>   kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE);
>>>
>>> - enable_irq(data->irq);
>>>
>>>   clk_disable(data->clk);
>>>   mutex_unlock(&data->lock);
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> + exynos4_report_trigger();
>>> +#endif
>>> + enable_irq(data->irq);
>>>  }
>>>
>>>  static irqreturn_t exynos4_tmu_irq(int irq, void *id)
>>> @@ -345,6 +351,14 @@ static const struct attribute_group 
>>> exynos4_tmu_attr_group = {
>>>   .attrs = exynos4_tmu_attributes,
>>>  };
>>>
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> +static struct thermal_sensor_conf exynos4_sensor_conf = {
>>> + .name   = "exynos4-therm",
>>> + .read_temperature   = (int (*)(void *))exynos4_tmu_read,
>>> +};
>>> +#endif
>>> +/*CONFIG_SAMSUNG_THERMAL_INTERFACE*/
>>> +
>>>  static int __devinit exynos4_tmu_probe(struct platform_device *pdev)
>>>  {
>>>   struct exynos4_tmu_data *data;
>>> @@ -432,9 +446,20 @@ static int __devinit exynos4_tmu_probe(struct 
>>> platform_device *pdev)
>>>   }
>>>
>>>   exynos4_tmu_control(pdev, true);
>>> -
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> + (&exynos4_sensor_conf)->private_data = data;
>>> + (&exynos4_sensor_conf)->sensor_data = pdata;
>>> + ret = exynos4_register_thermal(&exynos4_sensor_conf);
>>> + if (ret) {
>>> + dev_err(&pdev->dev, "Failed to register thermal interface\n");
>>> + goto err_hwmon_device;
>>> + }
>>> +#endif
>>>   return 0;
>>> -
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> +err_hwmon_device:
>>> + hwmon_device_unregister(data->hwmon_dev);
>>> +#endif
>>>  err_create_group:
>>>   sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
>>>  err_clk:
>>> @@ -458,6 +483,9 @@ static int __devexit exynos4_tmu_remove(struct 
>>> platform_device *pdev)
>>>
>>>   exynos4_tmu_control(pdev, false);
>>>
>>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>>> + exynos4_unregister_thermal();
>>> +#endif
>>>   hwmon_device_unregister(data->hwmon_dev);
>>>   sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
>>>
>>> diff --git a/include/linux/platform_data/exynos4_tmu.h 
>>> b/include/linux/platform_data/exynos4_tmu.h
>>> index 39e038c..642c508 100644
>>> --- a/include/linux/platform_data/exynos4_tmu.h
>>> +++ b/include/linux/platform_data/exynos4_tmu.h
>>> @@ -21,6 +21,7 @@
>>>
>>>  #ifndef _LINUX_EXYNOS4_TMU_H
>>>  #define _LINUX_EXYNOS4_TMU_H
>>> +#include 
>>>
>>>  enum calibration_type {
>>>   TYPE_ONE_POINT_TRIMMING,
>>> @@ -64,6 +65,9 @@ enum calibration_type {
>>>   *   in the positive-TC generator block
>>>   *   0 <= reference_voltage <= 31
>>>   * @cal_type: calibration type for 

Re: [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree

2012-01-04 Thread Olof Johansson
On Wed, Jan 4, 2012 at 8:25 PM, Amit Daniel Kachhap
 wrote:
> This patch enables calling generic l2 setup functions if device tree is used.
>
> Signed-off-by: Amit Daniel Kachhap 
> ---
>  arch/arm/mach-exynos/common.c |   14 --
>  1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
> index f8bb808..e91b92d 100644
> --- a/arch/arm/mach-exynos/common.c
> +++ b/arch/arm/mach-exynos/common.c
> @@ -47,6 +47,8 @@
>  #include 
>
>  #include "common.h"
> +#define L2_AUX_VAL 0x7C470001
> +#define L2_AUX_MASK 0xC200
>
>  static const char name_exynos4210[] = "EXYNOS4210";
>  static const char name_exynos4212[] = "EXYNOS4212";
> @@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
>  #ifdef CONFIG_CACHE_L2X0
>  static int __init exynos4_l2x0_cache_init(void)
>  {
> +#ifdef CONFIG_OF
> +       int ret;
> +       ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
> +       if (!ret) {
> +               l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
> +               clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
> +               return 0;
> +       }
> +#endif

No need for ifdef here, if CONFIG_OF is off, then there's a static
inline version of l2x_of_init() that will return -ENODEV.


-Olof
--
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 V5 5/5] ARM: exynos: Enable l2 configuration through device tree

2012-01-04 Thread Amit Daniel Kachhap
This patch enables calling generic l2 setup functions if device tree is used.

Signed-off-by: Amit Daniel Kachhap 
---
 arch/arm/mach-exynos/common.c |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index f8bb808..e91b92d 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -47,6 +47,8 @@
 #include 
 
 #include "common.h"
+#define L2_AUX_VAL 0x7C470001
+#define L2_AUX_MASK 0xC200
 
 static const char name_exynos4210[] = "EXYNOS4210";
 static const char name_exynos4212[] = "EXYNOS4212";
@@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
 #ifdef CONFIG_CACHE_L2X0
 static int __init exynos4_l2x0_cache_init(void)
 {
+#ifdef CONFIG_OF
+   int ret;
+   ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
+   if (!ret) {
+   l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
+   clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
+   return 0;
+   }
+#endif
if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
/* TAG, Data Latency Control: 2 cycles */
@@ -486,8 +497,7 @@ static int __init exynos4_l2x0_cache_init(void)
clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
}
 
-   l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200);
-
+   l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
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 V5 4/5] ARM: exynos: remove useless code to save/restore L2

2012-01-04 Thread Amit Daniel Kachhap
Following the merge of CPU PM notifiers and L2 resume code, this patch
removes useless code to save and restore L2 registers.

This is now automatically covered by suspend calls which integrated
CPU PM notifiers and new sleep code that allows to resume L2 before MMU
is turned on.

Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Amit Daniel Kachhap 
---
 arch/arm/mach-exynos/pm.c |   15 ---
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index a4f61a4..2dd55a1 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -155,13 +155,6 @@ static struct sleep_save exynos4_core_save[] = {
SAVE_ITEM(S5P_SROM_BC3),
 };
 
-static struct sleep_save exynos4_l2cc_save[] = {
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL),
-   SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL),
-};
 
 /* For Cortex-A9 Diagnostic and Power control register */
 static unsigned int save_arm_register[2];
@@ -182,7 +175,6 @@ static void exynos4_pm_prepare(void)
u32 tmp;
 
s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
-   s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
 
@@ -386,13 +378,6 @@ static void exynos4_pm_resume(void)
 
scu_enable(S5P_VA_SCU);
 
-#ifdef CONFIG_CACHE_L2X0
-   s3c_pm_do_restore_core(exynos4_l2cc_save, 
ARRAY_SIZE(exynos4_l2cc_save));
-   outer_inv_all();
-   /* enable L2X0*/
-   writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
-#endif
-
 early_wakeup:
return;
 }
-- 
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 V5 3/5] ARM: exynos: save L2 settings during bootup

2012-01-04 Thread Amit Daniel Kachhap
This patch adds code to save L2 register configuration at boot, and
later used to resume L2 before MMU is enabled in suspend and cpuidle
resume paths.

Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Amit Daniel Kachhap 
---
 arch/arm/mach-exynos/common.c |   42 ++--
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba4ab1f..f8bb808 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,10 +26,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -451,20 +453,38 @@ core_initcall(exynos4_core_init);
 #ifdef CONFIG_CACHE_L2X0
 static int __init exynos4_l2x0_cache_init(void)
 {
-   /* TAG, Data Latency Control: 2cycle */
-   __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
+   if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
+   l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
+   /* TAG, Data Latency Control: 2 cycles */
+   l2x0_saved_regs.tag_latency = 0x110;
 
-   if (soc_is_exynos4210())
-   __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
-   else if (soc_is_exynos4212() || soc_is_exynos4412())
-   __raw_writel(0x120, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
+   if (soc_is_exynos4212() || soc_is_exynos4412())
+   l2x0_saved_regs.data_latency = 0x120;
+   else
+   l2x0_saved_regs.data_latency = 0x110;
+
+   l2x0_saved_regs.prefetch_ctrl = 0x3007;
+   l2x0_saved_regs.pwr_ctrl =
+   (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
+
+   l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
 
-   /* L2X0 Prefetch Control */
-   __raw_writel(0x3007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
+   __raw_writel(l2x0_saved_regs.tag_latency,
+   S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
+   __raw_writel(l2x0_saved_regs.data_latency,
+   S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
 
-   /* L2X0 Power Control */
-   __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
-S5P_VA_L2CC + L2X0_POWER_CTRL);
+   /* L2X0 Prefetch Control */
+   __raw_writel(l2x0_saved_regs.prefetch_ctrl,
+   S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
+
+   /* L2X0 Power Control */
+   __raw_writel(l2x0_saved_regs.pwr_ctrl,
+   S5P_VA_L2CC + L2X0_POWER_CTRL);
+
+   clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
+   clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
+   }
 
l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200);
 
-- 
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 V5 2/5] ARM: s5p: add L2 early resume code

2012-01-04 Thread Amit Daniel Kachhap
This patch adds code to resume L2 before MMU is enabled in
suspend and cpuidle resume paths. s3c_cpu_resume is moved to the
data section with appropriate comments.

Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Amit Daniel Kachhap 
---
 arch/arm/plat-s5p/sleep.S |   44 ++--
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-s5p/sleep.S b/arch/arm/plat-s5p/sleep.S
index 0fd591b..006bd01 100644
--- a/arch/arm/plat-s5p/sleep.S
+++ b/arch/arm/plat-s5p/sleep.S
@@ -23,9 +23,18 @@
 */
 
 #include 
-#include 
+#include 
+#include 
 
-   .text
+/*
+ *  The following code is located into the .data section. This is to
+ *  allow l2x0_regs_phys to be accessed with a relative load while we
+ *  can't rely on any MMU translation. We could have put l2x0_regs_phys
+ *  in the .text section as well, but some setups might insist on it to
+ *  be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
+ */
+   .data
+   .align
 
/*
 * sleep magic, to allow the bootloader to check for an valid
@@ -39,11 +48,34 @@
 * s3c_cpu_resume
 *
 * resume code entry for bootloader to call
-*
-* we must put this code here in the data segment as we have no
-* other way of restoring the stack pointer after sleep, and we
-* must not write to the code segment (code is read-only)
 */
 
 ENTRY(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+   adr r0, l2x0_regs_phys
+   ldr r0, [r0]
+   ldr r1, [r0, #L2X0_R_PHY_BASE]
+   ldr r2, [r1, #L2X0_CTRL]
+   tst r2, #0x1
+   bne resume_l2on
+   ldr r2, [r0, #L2X0_R_AUX_CTRL]
+   str r2, [r1, #L2X0_AUX_CTRL]
+   ldr r2, [r0, #L2X0_R_TAG_LATENCY]
+   str r2, [r1, #L2X0_TAG_LATENCY_CTRL]
+   ldr r2, [r0, #L2X0_R_DATA_LATENCY]
+   str r2, [r1, #L2X0_DATA_LATENCY_CTRL]
+   ldr r2, [r0, #L2X0_R_PREFETCH_CTRL]
+   str r2, [r1, #L2X0_PREFETCH_CTRL]
+   ldr r2, [r0, #L2X0_R_PWR_CTRL]
+   str r2, [r1, #L2X0_POWER_CTRL]
+   mov r2, #1
+   str r2, [r1, #L2X0_CTRL]
+resume_l2on:
+#endif
b   cpu_resume
+ENDPROC(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+   .globl l2x0_regs_phys
+l2x0_regs_phys:
+   .long   0
+#endif
-- 
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 V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210

2012-01-04 Thread Amit Daniel Kachhap
This patch adds support AFTR(ARM OFF TOP RUNNING) mode in
cpuidle driver. L2 cache keeps their data in this mode.
This patch ports the code to the latest interfaces to
save/restore CPU state inclusive of CPU PM notifiers, l2
resume and cpu_suspend/resume.

Signed-off-by: Jaecheol Lee 
Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Amit Daniel Kachhap 
---
 arch/arm/mach-exynos/cpuidle.c  |  149 ++-
 arch/arm/mach-exynos/include/mach/pmu.h |2 +
 2 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 4ebb382..1f882af 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -11,15 +11,36 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_DIRECTGO_ADDR  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
+   S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+   (S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
+#define REG_DIRECTGO_FLAG  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
+   S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+   (S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
+
+#define S5P_CHECK_AFTR (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+   0xBAD0 : 0xFCBA0D10)
 
 static int exynos4_enter_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
  int index);
+static int exynos4_enter_lowpower(struct cpuidle_device *dev,
+   struct cpuidle_driver *drv,
+   int index);
 
 static struct cpuidle_state exynos4_cpuidle_set[] = {
[0] = {
@@ -27,9 +48,17 @@ static struct cpuidle_state exynos4_cpuidle_set[] = {
.exit_latency   = 1,
.target_residency   = 10,
.flags  = CPUIDLE_FLAG_TIME_VALID,
-   .name   = "IDLE",
+   .name   = "C0",
.desc   = "ARM clock gating(WFI)",
},
+   [1] = {
+   .enter  = exynos4_enter_lowpower,
+   .exit_latency   = 300,
+   .target_residency   = 10,
+   .flags  = CPUIDLE_FLAG_TIME_VALID,
+   .name   = "C1",
+   .desc   = "ARM power down",
+   },
 };
 
 static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
@@ -39,9 +68,101 @@ static struct cpuidle_driver exynos4_idle_driver = {
.owner  = THIS_MODULE,
 };
 
+/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
+static void exynos4_set_wakeupmask(void)
+{
+   __raw_writel(0xff3e, S5P_WAKEUP_MASK);
+}
+
+static unsigned int g_pwr_ctrl, g_diag_reg;
+
+static void save_cpu_arch_register(void)
+{
+   /*read power control register*/
+   asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc");
+   /*read diagnostic register*/
+   asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
+   return;
+}
+
+static void restore_cpu_arch_register(void)
+{
+   /*write power control register*/
+   asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc");
+   /*write diagnostic register*/
+   asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
+   return;
+}
+
+static int idle_finisher(unsigned long flags)
+{
+   cpu_do_idle();
+   return 1;
+}
+
+static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
+   struct cpuidle_driver *drv,
+   int index)
+{
+   struct timeval before, after;
+   int idle_time;
+   unsigned long tmp;
+
+   local_irq_disable();
+   do_gettimeofday(&before);
+
+   exynos4_set_wakeupmask();
+
+   /* Set value of power down register for aftr mode */
+   exynos4_sys_powerdown_conf(SYS_AFTR);
+
+   __raw_writel(BSYM(virt_to_phys(s3c_cpu_resume)),
+REG_DIRECTGO_ADDR);
+   __raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
+
+   save_cpu_arch_register();
+
+   /* Setting Central Sequence Register for power down mode */
+   tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+   tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
+   __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+
+   cpu_pm_enter();
+   cpu_suspend(0, idle_finisher);
+
+   scu_enable(S5P_VA_SCU);
+   cpu_pm_exit();
+
+   restore_cpu_arch_register();
+
+   /*
+* If PMU failed while entering sleep mode, WFI will be
+* ignored by PMU and then exiting cpu_do_idle().
+* S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
+* 

[PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state

2012-01-04 Thread Amit Daniel Kachhap
Changes since V4:
*Rebased the patchset against for-next of samsung kernel tree.
*Added Tushar suggestion of putting a check if L2 cache dt node not found.
*Added Inder suggestion of removing the BUG_ON check in cpuidle driver.

Changes since V3:
*Implemented Russell feedback and moved sleep magic 4byte memory before 
s3c_cpu_resume to data section.

Changes since V2:
*Implemented the suggestion of MyungJoo Ham and used INFORM0/1
registers for resume for some board versions.
*Added back save/restore through CPU PM notifiers as suggested by 
Lorenzo Pieralisi. This is useful to restore vfp state.
*some patch modularization (s5p/exynos) and proper commit logs.  

Changes since V1:
*rebased the whole patch against 3.2-rc1 tree
*removed GIC save/restore in AFTR cpuidle state as it is external
to cpu powerdomain
*Added L2 setup code through device tree
*Removed only l2 save/restore registers in sleep

This Patch series adds support for AFTR mode cpuidle state based on
patch (http://www.spinics.net/lists/arm-kernel/msg132243.html) earlier
submitted by Jaecheol Lee .

This patch uses CPU PM notifiers , common l2 save/restore and
new cpu_suspend/resume interfaces and is based on the tip of
for-next branch of samsung tree
(git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git for-next)
since commit id 44ceab1ea847daa03d1d58a20c43a83e8b99a2f9.

Amit Daniel Kachhap (5):
  ARM: exynos: Add support AFTR mode on EXYNOS4210
  ARM: s5p: add L2 early resume code
  ARM: exynos: save L2 settings during bootup
  ARM: exynos: remove useless code to save/restore L2
  ARM: exynos: Enable l2 configuration through device tree

 arch/arm/mach-exynos/common.c   |   54 +---
 arch/arm/mach-exynos/cpuidle.c  |  149 ++-
 arch/arm/mach-exynos/include/mach/pmu.h |2 +
 arch/arm/mach-exynos/pm.c   |   15 ---
 arch/arm/plat-s5p/sleep.S   |   44 --
 5 files changed, 228 insertions(+), 36 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


Re: [PATCH V4 0/5] ARM: exynos: Add l2 retention mode cpuidle state

2012-01-04 Thread Amit Kachhap
On 3 January 2012 18:52, Kukjin Kim  wrote:
> amit kachhap wrote:
>>
>> Hi Mr kim,
>>
>> All the comments have been addressed for the Exynos cpu idle patchset.
>> The updated patchset was posted about one month back and there have
>> been no further comments on the patchset since then.
>>
>> As this patchset seems to be stable now, do you think these these
>> patches can merged in this 3.3 merge window? Kindly let me know your
>> opinion.
>>
>
> This conflicts with local common.[ch] working for ARM restart. Please wait
> until after the merge window for this patches.
>
Thanks for the update.
Actually I have fixed the merging issue in common.[ch] files so
sending the V5 series of the patchset shortly. If possible add in this
merge window or next merge window is also fine.

Regards,
Amit daniel
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim , Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: dw_mmc: Clear the DDR mode for non-DDR

2012-01-04 Thread Chris Ball
Hi,

On Tue, Jan 03 2012, Will Newton wrote:
> On Mon, Jan 2, 2012 at 7:00 AM, Seungwon Jeon  wrote:
>> UHS_REG should be cleared for non-DDR mode. But currently there is
>> no way to clear DDR mode, if it is already set once. This patch adds
>> clearing DDR mode for non-DDD mode.
>>
>> Signed-off-by: Seungwon Jeon 
>> ---
>>  drivers/mmc/host/dw_mmc.c |   11 +++
>>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> Looks ok to me, although I don't have any DDR capable hardware to test.
>
> Acked-by: Will Newton 

Thanks, pushed to mmc-next for 3.3.

- Chris.
-- 
Chris Ball  
One Laptop Per Child
--
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] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support

2012-01-04 Thread Kukjin Kim
Heiko Stübner wrote:
> 
> Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree
block)
> and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
> introduced build-failures with enabled CONFIG_USE_OF option.
> 
> This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
> the of_device_id.data property.
> 
> Reported-by: Sylwester Nawrocki 
> Signed-off-by: Heiko Stuebner 

Acked-by: Kukjin Kim 

Arnd,
Could you please pick this up in your next/driver2 for samsung-rtc?

Thanks.

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

> ---
>  drivers/rtc/rtc-s3c.c |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index bb0f320..2b4feb8 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>   if (pdev->dev.of_node) {
>   const struct of_device_id *match;
>   match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> - return match->data;
> + return (int)match->data;
>   }
>  #endif
>   return platform_get_device_id(pdev)->driver_data;
> @@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev)
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>   {
> - .compatible = "samsung,s3c2410-rtc"
> - .data = TYPE_S3C2410,
> + .compatible = "samsung,s3c2410-rtc",
> + .data = (void *)TYPE_S3C2410,
>   }, {
> - .compatible = "samsung,s3c2416-rtc"
> - .data = TYPE_S3C2416,
> + .compatible = "samsung,s3c2416-rtc",
> + .data = (void *)TYPE_S3C2416,
>   }, {
> - .compatible = "samsung,s3c2443-rtc"
> - .data = TYPE_S3C2443,
> + .compatible = "samsung,s3c2443-rtc",
> + .data = (void *)TYPE_S3C2443,
>   }, {
> - .compatible = "samsung,s3c6410-rtc"
> - .data = TYPE_S3C64XX,
> + .compatible = "samsung,s3c6410-rtc",
> + .data = (void *)TYPE_S3C64XX,
>   },
>   {},
>  };
> --
> 1.7.5.4

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


RE: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

2012-01-04 Thread Kukjin Kim
Heiko Stübner wrote:

> 
> Hi Kgene,
> 
> Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> > Hi Sylwester,
> >
> > Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > > Hello,
> > >
> > > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > > Use the data field of of_device_id to hold the type for
> > > > s3c_cpu_type.
> > > >
> > > > Signed-off-by: Heiko Stuebner 
> > > > Reviewed-by: Thomas Abraham 
> > > > ---
> > >
> > > This patch makes compilation with CONFIG_OF enabled fail with errors
> > > and warnings:
> > >
> > > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > > without a cast
> > > drivers/rtc/rtc-s3c.c: At top level:
> > > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> >
> > thanks for spotting this.
> >
> > @kgene: Should this go on top of the rtc series, or should I prepare a
> v4
> > with these fixes included?
> never mind, I did both.
> 
> In reply to this mail you will find:
> - a single patch on top of the 4 original patches, fixing the problems
> sylwester reported
> - a v4 of the original series including the fixes to the problems, based
> on
> the code that you have in your rtc-branch
> 
> Please pick the apropriate variant to fix the problem :-)
> 
OK, since it has been merged into arm-soc, I will send a single patch to
arm-soc.

Thanks.

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

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


Re: [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions

2012-01-04 Thread Russell King - ARM Linux
On Wed, Jan 04, 2012 at 03:15:44PM +0100, Heiko Stübner wrote:
> regs-rtc.h uses a mixture of tabs and spaces and also (x< to format bits. So, before adding new stuff clean up the formatting
> and also add spaces to the bit definitions (i.e. (x << y) )

Ok, so this is just a formatting change - and it should stay that way.

However, there's an opportunity missed here.

Are these register definitions used anywhere else other than in the
drivers/rtc driver?  If not, they should be placed along side that
driver or even inside the driver itself.
--
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 0/2] ommu/exynos: Add IOMMU/System MMU driver for Samsung Exynos

2012-01-04 Thread Russell King - ARM Linux
On Wed, Jan 04, 2012 at 04:01:01PM +0100, Joerg Roedel wrote:
> On Tue, Jan 03, 2012 at 09:55:27AM +, Russell King - ARM Linux wrote:
> > It comes through when I stick it in my tree because of a month of asking
> > for help to fix something and getting zero response from the maintainers.
> > 
> > It's a way to flag to them that they're doing something wrong - and in
> > fact something is broken, and that that brokenness will happen at the
> > next merge window unless they get off their butt and do something about
> > it.
> 
> Okay, fine with me if it really will be fixed in 3.3-rc1 :)

I can do better than that - and report that it's fixed now.  It should
show up in linux-next sometime after Stephen pulls this evening.  The
#error did its job in this case, and ensured that it got fixed!
--
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: [linux-pm] [lm-sensors] [RFC PATCH 2/3] thermal: exynos4: Register the tmu sensor with the thermal interface layer

2012-01-04 Thread Guenter Roeck
On Wed, 2012-01-04 at 05:23 -0500, R, Durgadoss wrote:
> Hi Amit Daniel,
> 
> > Hi Guenter,
> > 
> > The main idea of this work is to leave the current userspace based
> > notification scheme and add the kernel based cooling scheme on top of
> > it. Anyway, It is a good idea to move the file hwmon/exynos4_tmu.c as
> 
> But, What I feel is, kernel based cooling scheme will work only for
> Controlling 'CPU' frequency. But in SoC's there are other devices that
> Contribute to Thermal. For example, GPU, Display, Battery (during charging)
> etc.. In this case, we need a user space to control these devices. So, in a
> way, the user space notification mechanism is a unified solution for
> throttling all devices and keeps the kernel code light weight.
> 
> I am also curious to know why the existing mechanism did not work for you ?
> 
That is one question. 

For me, the main concern is that the proposed implementation creates
duplicate hwmon entries for the same device, which is simply messy. If
both the kernel thermal mechanism and the userspace mechanism are
needed, I think it would make more sense to use a thermal driver and
have that thermal driver generate the necessary userspace events.

Thanks,
Guenter

> Thanks,
> Durga
> 
> > this creates 2 hwmon entries.
> > Adding CC: Donggeun Kim to know his opinion.
> > 
> > Thanks,
> > Amit Daniel
> [snip.]


--
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 6/6] mmc: sdhci-s3c: Add device tree support

2012-01-04 Thread Sylwester Nawrocki
Hi Kgene, Thomas

On 11/08/2011 04:23 PM, Thomas Abraham wrote:
> Hi Grant,
> 
> On 8 November 2011 02:47, Grant Likely  wrote:
>> On Thu, Nov 03, 2011 at 02:06:03AM +0530, Thomas Abraham wrote:
>>> Add device tree based discovery support for Samsung's sdhci controller
>>>
>>> Cc: Ben Dooks 
>>> Signed-off-by: Thomas Abraham 
>>> ---
>>> +Example:
>>> + sdhci@1253 {
>>> + compatible = "samsung,exynos4210-sdhci";
>>> + reg = <0x1253 0x100>;
>>> + interrupts = <139>;
>>> + samsung,sdhci-bus-width = <4>;
>>> + linux,mmc_cap_4_bit_data;
>>
>> Following on from my reply on patch 5, this is an example of exactly
>> what I'm talking about.  This node both sets bus-width to '4', and
>> sets the 4_bit_data flag.  Don't you think that the driver would be
>> smart enough to set the 4_bit_data flag when the bus width was set to
>> 4?
> 
> Yes, that is true. I will modify the driver based on your comments and
> resubmit this patch.

Are we going to have those patches in 3.3-rc1 or only in 3.4 ?

--
Regards,
Sylwester
--
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 0/2] ommu/exynos: Add IOMMU/System MMU driver for Samsung Exynos

2012-01-04 Thread Joerg Roedel
On Tue, Jan 03, 2012 at 09:55:27AM +, Russell King - ARM Linux wrote:
> On Mon, Jan 02, 2012 at 04:58:20PM +0100, Joerg Roedel wrote:
> > On Tue, Jan 03, 2012 at 12:21:30AM +0900, KyongHo Cho wrote:
> > > > I still get
> > > >
> > > >  LD      .tmp_vmlinux1
> > > > /data/cross/gcc-4.6.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld:
> > > >  no machine record defined
> > > > /data/cross/gcc-4.6.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld:
> > > >  no machine record defined
> > > > /data/cross/gcc-4.6.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld:
> > > >  no machine record defined
> > > > make[1]: *** [.tmp_vmlinux1] Error 1
> > > >
> > > > when trying to compile ARM/Exynos with 3.2-rc7. Am I doing something
> > > > wrong or is this not expected to work?
> > > >
> > > Do you?
> > > Ok. I will check my configuration with linux-next git.
> > 
> > Compiling my exynos-config with linux-next gives me:
> > 
> >   CC  arch/arm/kernel/process.o
> > In file included from 
> > /data/lemmy/linux.trees.git/arch/arm/mach-exynos/include/mach/system.h:16:0,
> >  from 
> > /data/lemmy/linux.trees.git/arch/arm/kernel/process.c:64:
> > /data/lemmy/linux.trees.git/arch/arm/plat-samsung/include/plat/system-reset.h:19:2:
> >  error: #error Fix me up
> > 
> > I better not ask the question how such an #error statement can come
> > through to linux-next.
> 
> It comes through when I stick it in my tree because of a month of asking
> for help to fix something and getting zero response from the maintainers.
> 
> It's a way to flag to them that they're doing something wrong - and in
> fact something is broken, and that that brokenness will happen at the
> next merge window unless they get off their butt and do something about
> it.

Okay, fine with me if it really will be fixed in 3.3-rc1 :)

Thanks,

Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

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


[PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

2012-01-04 Thread Heiko Stübner
As the S3C24xx SoCs use the same rtc device a renaming capability like in
the adc driver is necessary.

This patch adds a s3c_rtc_setname function and names the rtc devices for
S3C2443 and S3C2416 accordingly.

Signed-off-by: Heiko Stuebner 
Signed-off-by: Kukjin Kim 
---
 arch/arm/mach-s3c2416/s3c2416.c   |2 +
 arch/arm/mach-s3c2443/s3c2443.c   |2 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 +
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc..604cf98 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static struct map_desc s3c2416_iodesc[] __initdata = {
IODESC_ENT(WATCHDOG),
@@ -99,6 +100,7 @@ int __init s3c2416_init(void)
s3c_fb_setname("s3c2443-fb");
 
s3c_adc_setname("s3c2416-adc");
+   s3c_rtc_setname("s3c2416-rtc");
 
 #ifdef CONFIG_PM
register_syscore_ops(&s3c2416_pm_syscore_ops);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771..9e6be20 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static struct map_desc s3c2443_iodesc[] __initdata = {
IODESC_ENT(WATCHDOG),
@@ -72,6 +73,7 @@ int __init s3c2443_init(void)
s3c_fb_setname("s3c2443-fb");
 
s3c_adc_setname("s3c2443-adc");
+   s3c_rtc_setname("s3c2443-rtc");
 
/* change WDT IRQ number */
s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h 
b/arch/arm/plat-samsung/include/plat/rtc-core.h
new file mode 100644
index 000..21d8594
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -0,0 +1,27 @@
+/* linux/arch/arm/plat-samsung/include/plat/rtc-core.h
+ *
+ * Copyright (c) 2011 Heiko Stuebner 
+ *
+ * Samsung RTC Controller core functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_RTC_CORE_H
+#define __ASM_PLAT_RTC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
+   s3c_device_rtc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_RTC_CORE_H */
-- 
1.7.5.4

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


[PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416

2012-01-04 Thread Heiko Stübner
Especially the TICNT registers are different from the two rtc
types that currently exists.

Signed-off-by: Heiko Stuebner 
Acked-by: Alessandro Zummo 
Signed-off-by: Kukjin Kim 
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   17 ++
 drivers/rtc/rtc-s3c.c |   40 ++--
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h 
b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index a7d944f..0f8263e 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -22,11 +22,28 @@
 #define S3C2410_RTCCON_RTCEN   (1 << 0)
 #define S3C2410_RTCCON_CNTSEL  (1 << 2)
 #define S3C2410_RTCCON_CLKRST  (1 << 3)
+#define S3C2443_RTCCON_TICSEL  (1 << 4)
 #define S3C64XX_RTCCON_TICEN   (1 << 8)
 
 #define S3C2410_TICNT  S3C2410_RTCREG(0x44)
 #define S3C2410_TICNT_ENABLE   (1 << 7)
 
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)  ((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1 S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x) (x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2 S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x) ((x & 0x8000) >> 15)
+
 #define S3C2410_RTCALM S3C2410_RTCREG(0x50)
 #define S3C2410_RTCALM_ALMEN   (1 << 6)
 #define S3C2410_RTCALM_YEAREN  (1 << 5)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index dc0f65e..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -35,6 +35,8 @@
 
 enum s3c_cpu_type {
TYPE_S3C2410,
+   TYPE_S3C2416,
+   TYPE_S3C2443,
TYPE_S3C64XX,
 };
 
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
struct platform_device *pdev = to_platform_device(dev);
struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
unsigned int tmp = 0;
+   int val;
 
if (!is_power_of_2(freq))
return -EINVAL;
@@ -139,12 +142,22 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
clk_enable(rtc_clk);
spin_lock_irq(&s3c_rtc_pie_lock);
 
-   if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+   if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
tmp = readb(s3c_rtc_base + S3C2410_TICNT);
tmp &= S3C2410_TICNT_ENABLE;
}
 
-   tmp |= (rtc_dev->max_user_freq / freq)-1;
+   val = (rtc_dev->max_user_freq / freq) - 1;
+
+   if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == 
TYPE_S3C2443) {
+   tmp |= S3C2443_TICNT_PART(val);
+   writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1);
+
+   if (s3c_rtc_cpu_type == TYPE_S3C2416)
+   writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + 
S3C2416_TICNT2);
+   } else {
+   tmp |= val;
+   }
 
writel(tmp, s3c_rtc_base + S3C2410_TICNT);
spin_unlock_irq(&s3c_rtc_pie_lock);
@@ -371,7 +384,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, 
int en)
tmp &= ~S3C2410_RTCCON_RTCEN;
writew(tmp, base + S3C2410_RTCCON);
 
-   if (s3c_rtc_cpu_type == TYPE_S3C2410) {
+   if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
tmp = readb(base + S3C2410_TICNT);
tmp &= ~S3C2410_TICNT_ENABLE;
writeb(tmp, base + S3C2410_TICNT);
@@ -448,6 +461,7 @@ static int __devinit s3c_rtc_probe(struct platform_device 
*pdev)
struct rtc_time rtc_tm;
struct resource *res;
int ret;
+   int tmp;
 
pr_debug("%s: probe=%p\n", __func__, pdev);
 
@@ -541,11 +555,17 @@ static int __devinit s3c_rtc_probe(struct platform_device 
*pdev)
dev_warn(&pdev->dev, "warning: invalid RTC value so 
initializing it\n");
}
 
-   if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+   if (s3c_rtc_cpu_type != TYPE_S3C2410)
rtc->max_user_freq = 32768;
else
rtc->max_user_freq = 128;
 
+   if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == 
TYPE_S3C2443) {
+   tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
+   tmp |= S3C2443_RTCCON_TICSEL;
+   writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
+   }
+
platform_set_drvdata(pdev, rtc);
 
s3c_rtc_setfreq(&pdev->dev, 1);
@@ -650,6 +670,12 @@ static const struct of_device_id s3c_rtc_dt_match[] = {
.compatible = "samsung,s3c2410-rtc",
.data = (void *)TYPE_S3C2410,
}, {
+   .compatible = "samsung,s3c2416-rtc",
+   .data = (void *)TYPE_S3C2416,
+   }, {
+   .compatible = "samsung,s3c2443-rtc",
+  

[PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

2012-01-04 Thread Heiko Stübner
Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner 
Reviewed-by: Thomas Abraham 
Acked-by: Alessandro Zummo 
Signed-off-by: Kukjin Kim 
---
 drivers/rtc/rtc-s3c.c |   31 ++-
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..dc0f65e 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device 
*dev)
return 0;
 }
 
+static const struct of_device_id s3c_rtc_dt_match[];
+
+static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+   return (int)match->data;
+   }
+#endif
+   return platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
struct rtc_device *rtc;
@@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device 
*pdev)
goto err_nortc;
}
 
-#ifdef CONFIG_OF
-   if (pdev->dev.of_node)
-   s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
-   "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
-   else
-#endif
-   s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+   s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
 
/* Check RTC Time */
 
@@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
-   { .compatible = "samsung,s3c2410-rtc" },
-   { .compatible = "samsung,s3c6410-rtc" },
+   {
+   .compatible = "samsung,s3c2410-rtc",
+   .data = (void *)TYPE_S3C2410,
+   }, {
+   .compatible = "samsung,s3c6410-rtc",
+   .data = (void *)TYPE_S3C64XX,
+   },
{},
 };
 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
-- 
1.7.5.4

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


[PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions

2012-01-04 Thread Heiko Stübner
regs-rtc.h uses a mixture of tabs and spaces and also (x<
Signed-off-by: Kukjin Kim 
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   78 ++---
 1 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h 
b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index 30b7cc1..a7d944f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -18,51 +18,37 @@
 #define S3C2410_INTP_ALM   (1 << 1)
 #define S3C2410_INTP_TIC   (1 << 0)
 
-#define S3C2410_RTCCON   S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN  (1<<0)
-#define S3C2410_RTCCON_CLKSEL (1<<1)
-#define S3C2410_RTCCON_CNTSEL (1<<2)
-#define S3C2410_RTCCON_CLKRST (1<<3)
-#define S3C64XX_RTCCON_TICEN  (1<<8)
-
-#define S3C64XX_RTCCON_TICMSK (0xF<<7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNTS3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (1<<7)
-
-#define S3C2410_RTCALM   S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (1<<6)
-#define S3C2410_RTCALM_YEAREN (1<<5)
-#define S3C2410_RTCALM_MONEN  (1<<4)
-#define S3C2410_RTCALM_DAYEN  (1<<3)
-#define S3C2410_RTCALM_HOUREN (1<<2)
-#define S3C2410_RTCALM_MINEN  (1<<1)
-#define S3C2410_RTCALM_SECEN  (1<<0)
-
-#define S3C2410_RTCALM_ALL \
-  S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\
-  S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\
-  S3C2410_RTCALM_SECEN
-
-
-#define S3C2410_ALMSEC   S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN   S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR  S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE  S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON   S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR  S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCRST   S3C2410_RTCREG(0x6c)
-
-#define S3C2410_RTCSEC   S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN   S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR  S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE  S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCDAY   S3C2410_RTCREG(0x80)
-#define S3C2410_RTCMON   S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR  S3C2410_RTCREG(0x88)
-
+#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN   (1 << 0)
+#define S3C2410_RTCCON_CNTSEL  (1 << 2)
+#define S3C2410_RTCCON_CLKRST  (1 << 3)
+#define S3C64XX_RTCCON_TICEN   (1 << 8)
+
+#define S3C2410_TICNT  S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE   (1 << 7)
+
+#define S3C2410_RTCALM S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN   (1 << 6)
+#define S3C2410_RTCALM_YEAREN  (1 << 5)
+#define S3C2410_RTCALM_MONEN   (1 << 4)
+#define S3C2410_RTCALM_DAYEN   (1 << 3)
+#define S3C2410_RTCALM_HOUREN  (1 << 2)
+#define S3C2410_RTCALM_MINEN   (1 << 1)
+#define S3C2410_RTCALM_SECEN   (1 << 0)
+
+#define S3C2410_ALMSEC S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOURS3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATES3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEARS3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOURS3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATES3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEARS3C2410_RTCREG(0x88)
 
 #endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.7.5.4

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


[PATCH v4 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450

2012-01-04 Thread Heiko Stübner
Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v3:
fixes missing "," in s3c_rtc_dt_match and wrong handling of the
of_device_id.data property, as reported-by Sylwester Nawrocki

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code


Heiko Stuebner (4):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c   |2 +
 arch/arm/mach-s3c2443/s3c2443.c   |2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 
 drivers/rtc/rtc-s3c.c |   71 ++
 5 files changed, 131 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h

-- 
1.7.5.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] rtc-s3c: Fix breakage introduced by S3C2443/S3C2416 support

2012-01-04 Thread Heiko Stübner
Commits 7006ee4f (rtc-s3c: make room for more variants in devicetree block)
and 6c0a2365 (rtc-s3c: add variants for S3C2443 and S3C2416)
introduced build-failures with enabled CONFIG_USE_OF option.

This patch fixes missing "," in s3c_rtc_dt_match and wrong handling of
the of_device_id.data property.

Reported-by: Sylwester Nawrocki 
Signed-off-by: Heiko Stuebner 
---
 drivers/rtc/rtc-s3c.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index bb0f320..2b4feb8 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -449,7 +449,7 @@ static inline int s3c_rtc_get_driver_data(struct 
platform_device *pdev)
if (pdev->dev.of_node) {
const struct of_device_id *match;
match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-   return match->data;
+   return (int)match->data;
}
 #endif
return platform_get_device_id(pdev)->driver_data;
@@ -667,17 +667,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
{
-   .compatible = "samsung,s3c2410-rtc"
-   .data = TYPE_S3C2410,
+   .compatible = "samsung,s3c2410-rtc",
+   .data = (void *)TYPE_S3C2410,
}, {
-   .compatible = "samsung,s3c2416-rtc"
-   .data = TYPE_S3C2416,
+   .compatible = "samsung,s3c2416-rtc",
+   .data = (void *)TYPE_S3C2416,
}, {
-   .compatible = "samsung,s3c2443-rtc"
-   .data = TYPE_S3C2443,
+   .compatible = "samsung,s3c2443-rtc",
+   .data = (void *)TYPE_S3C2443,
}, {
-   .compatible = "samsung,s3c6410-rtc"
-   .data = TYPE_S3C64XX,
+   .compatible = "samsung,s3c6410-rtc",
+   .data = (void *)TYPE_S3C64XX,
},
{},
 };
-- 
1.7.5.4

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


Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

2012-01-04 Thread Heiko Stübner
Hi Kgene,

Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> Hi Sylwester,
> 
> Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > Hello,
> > 
> > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > Use the data field of of_device_id to hold the type for
> > > s3c_cpu_type.
> > > 
> > > Signed-off-by: Heiko Stuebner 
> > > Reviewed-by: Thomas Abraham 
> > > ---
> > 
> > This patch makes compilation with CONFIG_OF enabled fail with errors
> > and warnings:
> > 
> > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > without a cast
> > drivers/rtc/rtc-s3c.c: At top level:
> > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> > not a structure or union
> > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> 
> thanks for spotting this.
> 
> @kgene: Should this go on top of the rtc series, or should I prepare a v4
> with these fixes included?
never mind, I did both.

In reply to this mail you will find:
- a single patch on top of the 4 original patches, fixing the problems 
sylwester reported
- a v4 of the original series including the fixes to the problems, based on 
the code that you have in your rtc-branch

Please pick the apropriate variant to fix the problem :-)

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


Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

2012-01-04 Thread Heiko Stübner
Hi Sylwester,

Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> Hello,
> 
> On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > Use the data field of of_device_id to hold the type for
> > s3c_cpu_type.
> > 
> > Signed-off-by: Heiko Stuebner 
> > Reviewed-by: Thomas Abraham 
> > ---
> > 
> This patch makes compilation with CONFIG_OF enabled fail with errors
> and warnings:
> 
> drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> without a cast
> drivers/rtc/rtc-s3c.c: At top level:
> drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> not a structure or union
> make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
thanks for spotting this.

@kgene: Should this go on top of the rtc series, or should I prepare a v4 with 
these fixes included?


> And the following patch fixes this:
> 
> 8<
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 4498053..9a0d388 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
> if (pdev->dev.of_node) {
> const struct of_device_id *match;
> match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -   return match->data;
> +   return (int)match->data;
> }
>  #endif
> return platform_get_device_id(pdev)->driver_data;
> @@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev) #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
> {
> -   .compatible = "samsung,s3c2410-rtc"
> -   .data = TYPE_S3C2410,
> +   .compatible = "samsung,s3c2410-rtc",
> +   .data = (void*)TYPE_S3C2410,
> }, {
> -   .compatible = "samsung,s3c2443-rtc"
> -   .data = TYPE_S3C2443,
> +   .compatible = "samsung,s3c2443-rtc",
> +   .data = (void*)TYPE_S3C2443,
> }, {
> -   .compatible = "samsung,s3c2416-rtc"
> -   .data = TYPE_S3C2416,
> +   .compatible = "samsung,s3c2416-rtc",
> +   .data = (void*)TYPE_S3C2416,
> }, {
> -   .compatible = "samsung,s3c6410-rtc"
> -   .data = TYPE_S3C64XX,
> +   .compatible = "samsung,s3c6410-rtc",
> +   .data = (void*)TYPE_S3C64XX,
> },
> {},
>  };
> 
> 8<-

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


Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

2012-01-04 Thread Sylwester Nawrocki
Hello,

On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> Use the data field of of_device_id to hold the type for
> s3c_cpu_type.
> 
> Signed-off-by: Heiko Stuebner 
> Reviewed-by: Thomas Abraham 
> ---
>  drivers/rtc/rtc-s3c.c |   31 ++-
>  1 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 175067a..2885b25 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct 
> platform_device *dev)
>   return 0;
>  }
>  
> +static const struct of_device_id s3c_rtc_dt_match[];
> +
> +static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
> +{
> +#ifdef CONFIG_OF
> + if (pdev->dev.of_node) {
> + const struct of_device_id *match;
> + match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> + return match->data;
> + }
> +#endif
> + return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  {
>   struct rtc_device *rtc;
> @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct 
> platform_device *pdev)
>   goto err_nortc;
>   }
>  
> -#ifdef CONFIG_OF
> - if (pdev->dev.of_node)
> - s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
> - "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
> - else
> -#endif
> - s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> + s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
>  
>   /* Check RTC Time */
>  
> @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
>  
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
> - { .compatible = "samsung,s3c2410-rtc" },
> - { .compatible = "samsung,s3c6410-rtc" },
> + {
> + .compatible = "samsung,s3c2410-rtc"
> + .data = TYPE_S3C2410,
> + }, {
> + .compatible = "samsung,s3c6410-rtc"
> + .data = TYPE_S3C64XX,
> + },
>   {},
>  };
>  MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);

This patch makes compilation with CONFIG_OF enabled fail with errors
and warnings:

drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer without a
cast
drivers/rtc/rtc-s3c.c: At top level:
drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something not a
structure or union
make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1

And the following patch fixes this:

8<

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4498053..9a0d388 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
platform_device *pdev)
if (pdev->dev.of_node) {
const struct of_device_id *match;
match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-   return match->data;
+   return (int)match->data;
}
 #endif
return platform_get_device_id(pdev)->driver_data;
@@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
{
-   .compatible = "samsung,s3c2410-rtc"
-   .data = TYPE_S3C2410,
+   .compatible = "samsung,s3c2410-rtc",
+   .data = (void*)TYPE_S3C2410,
}, {
-   .compatible = "samsung,s3c2443-rtc"
-   .data = TYPE_S3C2443,
+   .compatible = "samsung,s3c2443-rtc",
+   .data = (void*)TYPE_S3C2443,
}, {
-   .compatible = "samsung,s3c2416-rtc"
-   .data = TYPE_S3C2416,
+   .compatible = "samsung,s3c2416-rtc",
+   .data = (void*)TYPE_S3C2416,
}, {
-   .compatible = "samsung,s3c6410-rtc"
-   .data = TYPE_S3C64XX,
+   .compatible = "samsung,s3c6410-rtc",
+   .data = (void*)TYPE_S3C64XX,
},
{},
 };

8<-

--

Regards,
Sylwester
--
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: [linux-pm] [lm-sensors] [RFC PATCH 2/3] thermal: exynos4: Register the tmu sensor with the thermal interface layer

2012-01-04 Thread R, Durgadoss
Hi Amit Daniel,

> Hi Guenter,
> 
> The main idea of this work is to leave the current userspace based
> notification scheme and add the kernel based cooling scheme on top of
> it. Anyway, It is a good idea to move the file hwmon/exynos4_tmu.c as

But, What I feel is, kernel based cooling scheme will work only for
Controlling 'CPU' frequency. But in SoC's there are other devices that
Contribute to Thermal. For example, GPU, Display, Battery (during charging)
etc.. In this case, we need a user space to control these devices. So, in a
way, the user space notification mechanism is a unified solution for
throttling all devices and keeps the kernel code light weight.

I am also curious to know why the existing mechanism did not work for you ?

Thanks,
Durga

> this creates 2 hwmon entries.
> Adding CC: Donggeun Kim to know his opinion.
> 
> Thanks,
> Amit Daniel
[snip.]
--
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: [lm-sensors] [RFC PATCH 2/3] thermal: exynos4: Register the tmu sensor with the thermal interface layer

2012-01-04 Thread Amit Kachhap
Hi Guenter,

The main idea of this work is to leave the current userspace based
notification scheme and add the kernel based cooling scheme on top of
it. Anyway, It is a good idea to move the file hwmon/exynos4_tmu.c as
this creates 2 hwmon entries.
Adding CC: Donggeun Kim to know his opinion.

Thanks,
Amit Daniel

On 4 January 2012 03:55, Guenter Roeck  wrote:
> On Wed, 2011-12-21 at 06:59 -0500, Amit Daniel Kachhap wrote:
>> Export and register information from the hwmon tmu sensor to the samsung
>> exynos kernel thermal framework where different cooling devices and thermal
>> zone are binded. The exported information is based according to the data
>> structure thermal_sensor_conf present in exynos_thermal.h. HWMON sysfs
>> functions are currently left although all of them are present in generic
>> linux thermal layer.
>> Also the platform data structure is modified to pass frequency cooling
>> in percentages for each thermal level.
>>
> Hi Amit,
>
> wouldn't it make more sense to merge the code as necessary from
> hwmon/exynos4_tmu.c into the new thermal/exynos_thermal.c, and drop
> hwmon/exynos4_tmu.c entirely ?
>
> With that, you should get the hwmon entries for free, and we would not
> have to maintain two drivers with overlapping functionality.
>
> Thanks,
> Guenter
>
>> Signed-off-by: Amit Daniel Kachhap 
>> ---
>>  drivers/hwmon/exynos4_tmu.c               |   34 
>> ++--
>>  include/linux/platform_data/exynos4_tmu.h |    7 ++
>>  2 files changed, 38 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/hwmon/exynos4_tmu.c b/drivers/hwmon/exynos4_tmu.c
>> index f2359a0..6912a7f 100644
>> --- a/drivers/hwmon/exynos4_tmu.c
>> +++ b/drivers/hwmon/exynos4_tmu.c
>> @@ -37,6 +37,9 @@
>>  #include 
>>
>>  #include 
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +#include 
>> +#endif
>>
>>  #define EXYNOS4_TMU_REG_TRIMINFO     0x0
>>  #define EXYNOS4_TMU_REG_CONTROL              0x20
>> @@ -248,10 +251,13 @@ static void exynos4_tmu_work(struct work_struct *work)
>>
>>       kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE);
>>
>> -     enable_irq(data->irq);
>>
>>       clk_disable(data->clk);
>>       mutex_unlock(&data->lock);
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +     exynos4_report_trigger();
>> +#endif
>> +     enable_irq(data->irq);
>>  }
>>
>>  static irqreturn_t exynos4_tmu_irq(int irq, void *id)
>> @@ -345,6 +351,14 @@ static const struct attribute_group 
>> exynos4_tmu_attr_group = {
>>       .attrs = exynos4_tmu_attributes,
>>  };
>>
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +static struct thermal_sensor_conf exynos4_sensor_conf = {
>> +     .name                   = "exynos4-therm",
>> +     .read_temperature       = (int (*)(void *))exynos4_tmu_read,
>> +};
>> +#endif
>> +/*CONFIG_SAMSUNG_THERMAL_INTERFACE*/
>> +
>>  static int __devinit exynos4_tmu_probe(struct platform_device *pdev)
>>  {
>>       struct exynos4_tmu_data *data;
>> @@ -432,9 +446,20 @@ static int __devinit exynos4_tmu_probe(struct 
>> platform_device *pdev)
>>       }
>>
>>       exynos4_tmu_control(pdev, true);
>> -
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +     (&exynos4_sensor_conf)->private_data = data;
>> +     (&exynos4_sensor_conf)->sensor_data = pdata;
>> +     ret = exynos4_register_thermal(&exynos4_sensor_conf);
>> +     if (ret) {
>> +             dev_err(&pdev->dev, "Failed to register thermal interface\n");
>> +             goto err_hwmon_device;
>> +     }
>> +#endif
>>       return 0;
>> -
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +err_hwmon_device:
>> +     hwmon_device_unregister(data->hwmon_dev);
>> +#endif
>>  err_create_group:
>>       sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
>>  err_clk:
>> @@ -458,6 +483,9 @@ static int __devexit exynos4_tmu_remove(struct 
>> platform_device *pdev)
>>
>>       exynos4_tmu_control(pdev, false);
>>
>> +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
>> +     exynos4_unregister_thermal();
>> +#endif
>>       hwmon_device_unregister(data->hwmon_dev);
>>       sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
>>
>> diff --git a/include/linux/platform_data/exynos4_tmu.h 
>> b/include/linux/platform_data/exynos4_tmu.h
>> index 39e038c..642c508 100644
>> --- a/include/linux/platform_data/exynos4_tmu.h
>> +++ b/include/linux/platform_data/exynos4_tmu.h
>> @@ -21,6 +21,7 @@
>>
>>  #ifndef _LINUX_EXYNOS4_TMU_H
>>  #define _LINUX_EXYNOS4_TMU_H
>> +#include 
>>
>>  enum calibration_type {
>>       TYPE_ONE_POINT_TRIMMING,
>> @@ -64,6 +65,9 @@ enum calibration_type {
>>   *   in the positive-TC generator block
>>   *   0 <= reference_voltage <= 31
>>   * @cal_type: calibration type for temperature
>> + * @freq_pctg_table: Table representing frequency reduction percentage.
>> + * @freq_tab_count: Count of the above table as frequency reduction may
>> + *   applicable to only some of the trigger levels.
>>   *
>>   * This structure is required for configuration of exynos4_tmu driver.
>>   */
>> @@ -79,5