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 guenter.ro...@ericsson.com 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 amit.kach...@linaro.org
 ---
  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 linux/hwmon-sysfs.h

  #include linux/platform_data/exynos4_tmu.h
 +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
 +#include linux/exynos_thermal.h
 +#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 linux/cpu_cooling.h

  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 +83,8 @@ struct exynos4_tmu_platform_data {
       u8 reference_voltage;

       enum calibration_type cal_type;
 +
 +     struct 

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: [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 he...@sntech.de
 Reviewed-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  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: [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 he...@sntech.de
   Reviewed-by: Thomas Abraham thomas.abra...@linaro.org
   ---
  
  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


[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 s.nawro...@samsung.com
Signed-off-by: Heiko Stuebner he...@sntech.de
---
 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


[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 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 (xy)
to format bits. So, before adding new stuff clean up the formatting
and also add spaces to the bit definitions (i.e. (x  y) )

Signed-off-by: Heiko Stuebner he...@sntech.de
Signed-off-by: Kukjin Kim kgene@samsung.com
---
 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  (10)
-#define S3C2410_RTCCON_CLKSEL (11)
-#define S3C2410_RTCCON_CNTSEL (12)
-#define S3C2410_RTCCON_CLKRST (13)
-#define S3C64XX_RTCCON_TICEN  (18)
-
-#define S3C64XX_RTCCON_TICMSK (0xF7)
-#define S3C64XX_RTCCON_TICSHT (7)
-
-#define S3C2410_TICNTS3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE  (17)
-
-#define S3C2410_RTCALM   S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN  (16)
-#define S3C2410_RTCALM_YEAREN (15)
-#define S3C2410_RTCALM_MONEN  (14)
-#define S3C2410_RTCALM_DAYEN  (13)
-#define S3C2410_RTCALM_HOUREN (12)
-#define S3C2410_RTCALM_MINEN  (11)
-#define S3C2410_RTCALM_SECEN  (10)
-
-#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 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 he...@sntech.de
Reviewed-by: Thomas Abraham thomas.abra...@linaro.org
Acked-by: Alessandro Zummo a.zu...@towertech.it
Signed-off-by: Kukjin Kim kgene@samsung.com
---
 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 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 he...@sntech.de
Acked-by: Alessandro Zummo a.zu...@towertech.it
Signed-off-by: Kukjin Kim kgene@samsung.com
---
 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,

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


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 grant.lik...@secretlab.ca 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 ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 +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: [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 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: [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 (xy)
 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 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 he...@sntech.de
Reviewed-by: Thomas Abraham thomas.abra...@linaro.org
---
  
   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 kgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to 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 s.nawro...@samsung.com
 Signed-off-by: Heiko Stuebner he...@sntech.de

Acked-by: Kukjin Kim kgene@samsung.com

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

Thanks.

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

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to 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 lorenzo.pieral...@arm.com
Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 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 asm/hardware/gic.h
 #include asm/mach/map.h
 #include asm/mach/irq.h
+#include asm/cacheflush.h
 
 #include mach/regs-irq.h
 #include mach/regs-pmu.h
 #include mach/regs-gpio.h
+#include mach/pmu.h
 
 #include plat/cpu.h
 #include plat/clock.h
@@ -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 lorenzo.pieral...@arm.com
Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 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 linux/linkage.h
-#include asm/assembler.h
+#include asm/asm-offsets.h
+#include asm/hardware/cache-l2x0.h
 
-   .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 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 lorenzo.pieral...@arm.com
Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
---
 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 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 amit.kach...@linaro.org
---
 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 plat/regs-serial.h
 
 #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


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
amit.kach...@linaro.org wrote:
 This patch enables calling generic l2 setup functions if device tree is used.

 Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
 ---
  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 plat/regs-serial.h

  #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


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 guenter.ro...@ericsson.com 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 amit.kach...@linaro.org
 ---
  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 linux/hwmon-sysfs.h

  #include linux/platform_data/exynos4_tmu.h
 +#ifdef CONFIG_SAMSUNG_THERMAL_INTERFACE
 +#include linux/exynos_thermal.h
 +#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 linux/cpu_cooling.h

  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 

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 o...@lixom.net wrote:
 On Wed, Jan 4, 2012 at 8:25 PM, Amit Daniel Kachhap
 amit.kach...@linaro.org wrote:
 This patch enables calling generic l2 setup functions if device tree is used.

 Signed-off-by: Amit Daniel Kachhap amit.kach...@linaro.org
 ---
  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 plat/regs-serial.h

  #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