Re: [PATCH 04/16] page-flags: define PG_locked behavior on compound pages

2015-03-27 Thread Mateusz Krawczuk

Hi!

This patch breaks build of linux next since 2015-03-25 on arm using 
exynos_defconfig with arm-linux-gnueabi-linaro_4.7.4-2014.04, 
arm-linux-gnueabi-linaro_4.8.3-2014.04 and 
arm-linux-gnueabi-4.7.3-12ubuntu1(from ubuntu 14.04 lts). Compiler shows 
this error message:

mm/migrate.c: In function ‘migrate_pages’:
mm/migrate.c:1148:1: internal compiler error: in push_minipool_fix, at 
config/arm/arm.c:13500

Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

It builds fine with arm-linux-gnueabi-linaro_4.9.1-2014.07.

Best Regards
Mateusz Krawczuk
Samsung R Institute Poland

 dniu 19.03.2015 o 18:08, Kirill A. Shutemov pisze:

lock_page() must operate on the whole compound page. It doesn't make
much sense to lock part of compound page. Change code to use head page's
PG_locked, if tail page is passed.

This patch also get rid of custom helprer functions --
__set_page_locked() and __clear_page_locked(). They replaced with
helpers generated by __SETPAGEFLAG/__CLEARPAGEFLAG. Tail pages to these
helper would trigger VM_BUG_ON().

SLUB uses PG_locked as a bit spin locked. IIUC, tail pages should never
appear there. VM_BUG_ON() is added to make sure that this assumption is
correct.

Signed-off-by: Kirill A. Shutemov 
---
  fs/cifs/file.c |  8 
  include/linux/page-flags.h |  2 +-
  include/linux/pagemap.h| 25 -
  mm/filemap.c   | 15 +--
  mm/ksm.c   |  2 +-
  mm/memory-failure.c|  2 +-
  mm/migrate.c   |  2 +-
  mm/shmem.c |  4 ++--
  mm/slub.c  |  2 ++
  mm/swap_state.c|  4 ++--
  mm/vmscan.c|  4 ++--
  mm/zswap.c |  4 ++--
  12 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ca30c391a894..b9fd85dfee9b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3413,13 +3413,13 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
 * should have access to this page, we're safe to simply set
 * PG_locked without checking it first.
 */
-   __set_page_locked(page);
+   __SetPageLocked(page);
rc = add_to_page_cache_locked(page, mapping,
  page->index, GFP_KERNEL);

/* give up if we can't stick it in the cache */
if (rc) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
return rc;
}

@@ -3440,10 +3440,10 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
if (*bytes + PAGE_CACHE_SIZE > rsize)
break;

-   __set_page_locked(page);
+   __SetPageLocked(page);
if (add_to_page_cache_locked(page, mapping, page->index,
GFP_KERNEL)) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
break;
}
list_move_tail(>lru, tmplist);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 32ea62c0ad30..10bdde20b14c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page 
*page)
return page;
  }

-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
  PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
  PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, 
ANY)
__SETPAGEFLAG(Referenced, referenced, ANY)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4b3736f7065c..7c3790764795 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,18 +426,9 @@ extern int __lock_page_or_retry(struct page *page, struct 
mm_struct *mm,
unsigned int flags);
  extern void unlock_page(struct page *page);

-static inline void __set_page_locked(struct page *page)
-{
-   __set_bit(PG_locked, >flags);
-}
-
-static inline void __clear_page_locked(struct page *page)
-{
-   __clear_bit(PG_locked, >flags);
-}
-
  static inline int trylock_page(struct page *page)
  {
+   page = compound_head(page);
return (likely(!test_and_set_bit_lock(PG_locked, >flags)));
  }

@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page 
*page,

  static inline int wait_on_page_locked_killable(struct page *page)
  {
-   if (PageLocked(page))
-   return wait_on_page_bit_killable(page, PG_locked);
-   return 0;
+   if (!PageLocked(page))
+   return 0;
+   return wait_on_page_bit_killable(compound_head(page), PG_locked);
  }

  extern wait_queue_head_t *page_waitqueue(struct page *page);
@@ -511,7 +502,7 

Re: [PATCH 04/16] page-flags: define PG_locked behavior on compound pages

2015-03-27 Thread Mateusz Krawczuk

Hi!

This patch breaks build of linux next since 2015-03-25 on arm using 
exynos_defconfig with arm-linux-gnueabi-linaro_4.7.4-2014.04, 
arm-linux-gnueabi-linaro_4.8.3-2014.04 and 
arm-linux-gnueabi-4.7.3-12ubuntu1(from ubuntu 14.04 lts). Compiler shows 
this error message:

mm/migrate.c: In function ‘migrate_pages’:
mm/migrate.c:1148:1: internal compiler error: in push_minipool_fix, at 
config/arm/arm.c:13500

Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

It builds fine with arm-linux-gnueabi-linaro_4.9.1-2014.07.

Best Regards
Mateusz Krawczuk
Samsung R Institute Poland

 dniu 19.03.2015 o 18:08, Kirill A. Shutemov pisze:

lock_page() must operate on the whole compound page. It doesn't make
much sense to lock part of compound page. Change code to use head page's
PG_locked, if tail page is passed.

This patch also get rid of custom helprer functions --
__set_page_locked() and __clear_page_locked(). They replaced with
helpers generated by __SETPAGEFLAG/__CLEARPAGEFLAG. Tail pages to these
helper would trigger VM_BUG_ON().

SLUB uses PG_locked as a bit spin locked. IIUC, tail pages should never
appear there. VM_BUG_ON() is added to make sure that this assumption is
correct.

Signed-off-by: Kirill A. Shutemov 
---
  fs/cifs/file.c |  8 
  include/linux/page-flags.h |  2 +-
  include/linux/pagemap.h| 25 -
  mm/filemap.c   | 15 +--
  mm/ksm.c   |  2 +-
  mm/memory-failure.c|  2 +-
  mm/migrate.c   |  2 +-
  mm/shmem.c |  4 ++--
  mm/slub.c  |  2 ++
  mm/swap_state.c|  4 ++--
  mm/vmscan.c|  4 ++--
  mm/zswap.c |  4 ++--
  12 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ca30c391a894..b9fd85dfee9b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3413,13 +3413,13 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
 * should have access to this page, we're safe to simply set
 * PG_locked without checking it first.
 */
-   __set_page_locked(page);
+   __SetPageLocked(page);
rc = add_to_page_cache_locked(page, mapping,
  page->index, GFP_KERNEL);

/* give up if we can't stick it in the cache */
if (rc) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
return rc;
}

@@ -3440,10 +3440,10 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
if (*bytes + PAGE_CACHE_SIZE > rsize)
break;

-   __set_page_locked(page);
+   __SetPageLocked(page);
if (add_to_page_cache_locked(page, mapping, page->index,
GFP_KERNEL)) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
break;
}
list_move_tail(>lru, tmplist);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 32ea62c0ad30..10bdde20b14c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page 
*page)
return page;
  }

-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
  PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
  PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, 
ANY)
__SETPAGEFLAG(Referenced, referenced, ANY)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4b3736f7065c..7c3790764795 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,18 +426,9 @@ extern int __lock_page_or_retry(struct page *page, struct 
mm_struct *mm,
unsigned int flags);
  extern void unlock_page(struct page *page);

-static inline void __set_page_locked(struct page *page)
-{
-   __set_bit(PG_locked, >flags);
-}
-
-static inline void __clear_page_locked(struct page *page)
-{
-   __clear_bit(PG_locked, >flags);
-}
-
  static inline int trylock_page(struct page *page)
  {
+   page = compound_head(page);
return (likely(!test_and_set_bit_lock(PG_locked, >flags)));
  }

@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page 
*page,

  static inline int wait_on_page_locked_killable(struct page *page)
  {
-   if (PageLocked(page))
-   return wait_on_page_bit_killable(page, PG_locked);
-   return 0;
+   if (!PageLocked(page))
+   return 0;
+   return wait_on_page_bit_killable(compound_head(page), PG_locked);
  }

  extern wait_queue_head_t *page_waitqueue(struct page *page);
@@ -511,7 +502,7 

Re: [PATCH 04/16] page-flags: define PG_locked behavior on compound pages

2015-03-27 Thread Mateusz Krawczuk

Hi!

This patch breaks build of linux next since 2015-03-25 on arm using 
exynos_defconfig with arm-linux-gnueabi-linaro_4.7.4-2014.04, 
arm-linux-gnueabi-linaro_4.8.3-2014.04 and 
arm-linux-gnueabi-4.7.3-12ubuntu1(from ubuntu 14.04 lts). Compiler shows 
this error message:

mm/migrate.c: In function ‘migrate_pages’:
mm/migrate.c:1148:1: internal compiler error: in push_minipool_fix, at 
config/arm/arm.c:13500

Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.7/README.Bugs for instructions.

It builds fine with arm-linux-gnueabi-linaro_4.9.1-2014.07.

Best Regards
Mateusz Krawczuk
Samsung RD Institute Poland

 dniu 19.03.2015 o 18:08, Kirill A. Shutemov pisze:

lock_page() must operate on the whole compound page. It doesn't make
much sense to lock part of compound page. Change code to use head page's
PG_locked, if tail page is passed.

This patch also get rid of custom helprer functions --
__set_page_locked() and __clear_page_locked(). They replaced with
helpers generated by __SETPAGEFLAG/__CLEARPAGEFLAG. Tail pages to these
helper would trigger VM_BUG_ON().

SLUB uses PG_locked as a bit spin locked. IIUC, tail pages should never
appear there. VM_BUG_ON() is added to make sure that this assumption is
correct.

Signed-off-by: Kirill A. Shutemov kirill.shute...@linux.intel.com
---
  fs/cifs/file.c |  8 
  include/linux/page-flags.h |  2 +-
  include/linux/pagemap.h| 25 -
  mm/filemap.c   | 15 +--
  mm/ksm.c   |  2 +-
  mm/memory-failure.c|  2 +-
  mm/migrate.c   |  2 +-
  mm/shmem.c |  4 ++--
  mm/slub.c  |  2 ++
  mm/swap_state.c|  4 ++--
  mm/vmscan.c|  4 ++--
  mm/zswap.c |  4 ++--
  12 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ca30c391a894..b9fd85dfee9b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3413,13 +3413,13 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
 * should have access to this page, we're safe to simply set
 * PG_locked without checking it first.
 */
-   __set_page_locked(page);
+   __SetPageLocked(page);
rc = add_to_page_cache_locked(page, mapping,
  page-index, GFP_KERNEL);

/* give up if we can't stick it in the cache */
if (rc) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
return rc;
}

@@ -3440,10 +3440,10 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
if (*bytes + PAGE_CACHE_SIZE  rsize)
break;

-   __set_page_locked(page);
+   __SetPageLocked(page);
if (add_to_page_cache_locked(page, mapping, page-index,
GFP_KERNEL)) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
break;
}
list_move_tail(page-lru, tmplist);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 32ea62c0ad30..10bdde20b14c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page 
*page)
return page;
  }

-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
  PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
  PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, 
ANY)
__SETPAGEFLAG(Referenced, referenced, ANY)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4b3736f7065c..7c3790764795 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,18 +426,9 @@ extern int __lock_page_or_retry(struct page *page, struct 
mm_struct *mm,
unsigned int flags);
  extern void unlock_page(struct page *page);

-static inline void __set_page_locked(struct page *page)
-{
-   __set_bit(PG_locked, page-flags);
-}
-
-static inline void __clear_page_locked(struct page *page)
-{
-   __clear_bit(PG_locked, page-flags);
-}
-
  static inline int trylock_page(struct page *page)
  {
+   page = compound_head(page);
return (likely(!test_and_set_bit_lock(PG_locked, page-flags)));
  }

@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page 
*page,

  static inline int wait_on_page_locked_killable(struct page *page)
  {
-   if (PageLocked(page))
-   return wait_on_page_bit_killable(page, PG_locked);
-   return 0;
+   if (!PageLocked(page))
+   return 0;
+   return wait_on_page_bit_killable(compound_head(page), PG_locked);
  }

  extern

Re: [PATCH 04/16] page-flags: define PG_locked behavior on compound pages

2015-03-27 Thread Mateusz Krawczuk

Hi!

This patch breaks build of linux next since 2015-03-25 on arm using 
exynos_defconfig with arm-linux-gnueabi-linaro_4.7.4-2014.04, 
arm-linux-gnueabi-linaro_4.8.3-2014.04 and 
arm-linux-gnueabi-4.7.3-12ubuntu1(from ubuntu 14.04 lts). Compiler shows 
this error message:

mm/migrate.c: In function ‘migrate_pages’:
mm/migrate.c:1148:1: internal compiler error: in push_minipool_fix, at 
config/arm/arm.c:13500

Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.7/README.Bugs for instructions.

It builds fine with arm-linux-gnueabi-linaro_4.9.1-2014.07.

Best Regards
Mateusz Krawczuk
Samsung RD Institute Poland

 dniu 19.03.2015 o 18:08, Kirill A. Shutemov pisze:

lock_page() must operate on the whole compound page. It doesn't make
much sense to lock part of compound page. Change code to use head page's
PG_locked, if tail page is passed.

This patch also get rid of custom helprer functions --
__set_page_locked() and __clear_page_locked(). They replaced with
helpers generated by __SETPAGEFLAG/__CLEARPAGEFLAG. Tail pages to these
helper would trigger VM_BUG_ON().

SLUB uses PG_locked as a bit spin locked. IIUC, tail pages should never
appear there. VM_BUG_ON() is added to make sure that this assumption is
correct.

Signed-off-by: Kirill A. Shutemov kirill.shute...@linux.intel.com
---
  fs/cifs/file.c |  8 
  include/linux/page-flags.h |  2 +-
  include/linux/pagemap.h| 25 -
  mm/filemap.c   | 15 +--
  mm/ksm.c   |  2 +-
  mm/memory-failure.c|  2 +-
  mm/migrate.c   |  2 +-
  mm/shmem.c |  4 ++--
  mm/slub.c  |  2 ++
  mm/swap_state.c|  4 ++--
  mm/vmscan.c|  4 ++--
  mm/zswap.c |  4 ++--
  12 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ca30c391a894..b9fd85dfee9b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3413,13 +3413,13 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
 * should have access to this page, we're safe to simply set
 * PG_locked without checking it first.
 */
-   __set_page_locked(page);
+   __SetPageLocked(page);
rc = add_to_page_cache_locked(page, mapping,
  page-index, GFP_KERNEL);

/* give up if we can't stick it in the cache */
if (rc) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
return rc;
}

@@ -3440,10 +3440,10 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
if (*bytes + PAGE_CACHE_SIZE  rsize)
break;

-   __set_page_locked(page);
+   __SetPageLocked(page);
if (add_to_page_cache_locked(page, mapping, page-index,
GFP_KERNEL)) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
break;
}
list_move_tail(page-lru, tmplist);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 32ea62c0ad30..10bdde20b14c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page 
*page)
return page;
  }

-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
  PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
  PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, 
ANY)
__SETPAGEFLAG(Referenced, referenced, ANY)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4b3736f7065c..7c3790764795 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,18 +426,9 @@ extern int __lock_page_or_retry(struct page *page, struct 
mm_struct *mm,
unsigned int flags);
  extern void unlock_page(struct page *page);

-static inline void __set_page_locked(struct page *page)
-{
-   __set_bit(PG_locked, page-flags);
-}
-
-static inline void __clear_page_locked(struct page *page)
-{
-   __clear_bit(PG_locked, page-flags);
-}
-
  static inline int trylock_page(struct page *page)
  {
+   page = compound_head(page);
return (likely(!test_and_set_bit_lock(PG_locked, page-flags)));
  }

@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page 
*page,

  static inline int wait_on_page_locked_killable(struct page *page)
  {
-   if (PageLocked(page))
-   return wait_on_page_bit_killable(page, PG_locked);
-   return 0;
+   if (!PageLocked(page))
+   return 0;
+   return wait_on_page_bit_killable(compound_head(page), PG_locked);
  }

  extern

[PATCH v5 Resend 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk 

Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index e3973da..ab0365a 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -471,17 +471,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, "armclk");
+   cpu_clk = clk_get_sys("s5pv210-cpufreq", "armclk");
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, "sclk_dmc0");
+   dmc0_clk = clk_get_sys("s5pv210-cpufreq", "sclk_dmc0");
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, "hclk_msys");
+   dmc1_clk = clk_get_sys("s5pv210-cpufreq", "hclk_msys");
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.3.3

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


[PATCH v5 Resend 0/3] ARM: S5PV210: move to common clk framework

2013-12-28 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board
files.

This patch series is based on linux-next and has been tested on goni and
aquila boards using board file.

Since v4:
Corrected mux flags for finpll.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.

Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.3.3

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


[PATCH v5 Resend 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk 

This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -34,7 +35,13 @@
 #include 
 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -50,6 +57,9 @@
 
 #include "common.h"
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = "S5PV210/S5PC110";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include 
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index f52cc15..25dd2fa 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -285,7 +285,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uar

[PATCH v5 Resend 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk 

This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be "samsung,s5pv210-clock".
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti": external crystal oscillator connected to XXTI and XXTO pins of
+the SoC,
+ - "xusbxti": external crystal oscillator connected to XUSBXTI and XUSBXTO
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in
+board device tree, including the system base clock, as selected by XOM[0]
+pin of the SoC. Refer to generic fixed rate clock bindings
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@e290 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0xe290 0x400>;
+   interrupt-parent = <>;
+   interrupts = <10>;
+   clock-names = "uart", "clk_uart_baud0",
+   "clk_uart_baud1";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART0>;
+   status = "disabled";
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index b572dd7..c56db92 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -10,3 +10,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)  += clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..b35da19
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support fo

[PATCH v5 Resend 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk m.krawc...@partner.samsung.com

This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be samsung,s5pv210-clock.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - xxti: external crystal oscillator connected to XXTI and XXTO pins of
+the SoC,
+ - xusbxti: external crystal oscillator connected to XUSBXTI and XUSBXTO
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in
+board device tree, including the system base clock, as selected by XOM[0]
+pin of the SoC. Refer to generic fixed rate clock bindings
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = samsung,s5pv210-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = fixed-clock;
+   clock-output-names = xxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = fixed-clock;
+   clock-output-names = xusbxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  clocks and clock-names properties):
+
+   uart0: serial@e290 {
+   compatible = samsung,s5pv210-uart;
+   reg = 0xe290 0x400;
+   interrupt-parent = vic1;
+   interrupts = 10;
+   clock-names = uart, clk_uart_baud0,
+   clk_uart_baud1;
+   clocks = clocks UART0, clocks UART0,
+   clocks SCLK_UART0;
+   status = disabled;
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index b572dd7..c56db92 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -10,3 +10,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)  += clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..b35da19
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+ */
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h

[PATCH v5 Resend 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk m.krawc...@partner.samsung.com

This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool Common Clock Framework support
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu S5PC110 Machines
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include linux/sched.h
 #include linux/dma-mapping.h
 #include linux/serial_core.h
+#include linux/of.h
 
 #include asm/proc-fns.h
 #include asm/mach/arch.h
@@ -34,7 +35,13 @@
 #include mach/regs-clock.h
 
 #include plat/cpu.h
+
+#ifdef CONFIG_S5P_CLOCK
 #include plat/clock.h
+#else
+#include linux/clk-provider.h
+#endif
+
 #include plat/devs.h
 #include plat/sdhci.h
 #include plat/adc-core.h
@@ -50,6 +57,9 @@
 
 #include common.h
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = S5PV210/S5PC110;
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG %s: initializing clocks\n, __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include linux/reboot.h
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index f52cc15..25dd2fa 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -285,7 +285,7 @@ static struct platform_pwm_backlight_data

[PATCH v5 Resend 0/3] ARM: S5PV210: move to common clk framework

2013-12-28 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board
files.

This patch series is based on linux-next and has been tested on goni and
aquila boards using board file.

Since v4:
Corrected mux flags for finpll.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.

Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.3.3

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


[PATCH v5 Resend 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-12-28 Thread Mateusz Krawczuk
From: Mateusz Krawczuk m.krawc...@partner.samsung.com

Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index e3973da..ab0365a 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -471,17 +471,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, armclk);
+   cpu_clk = clk_get_sys(s5pv210-cpufreq, armclk);
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, sclk_dmc0);
+   dmc0_clk = clk_get_sys(s5pv210-cpufreq, sclk_dmc0);
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, hclk_msys);
+   dmc1_clk = clk_get_sys(s5pv210-cpufreq, hclk_msys);
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.3.3

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


[PATCH 2/3] ARM: Samsung: DT: Add Device tree for s5pv210

2013-09-28 Thread Mateusz Krawczuk
Add generic device tree for s5pv210 and s5pv210-pinctrl

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi | 820 +
 arch/arm/boot/dts/s5pv210.dtsi | 498 
 2 files changed, 1318 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi

diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi 
b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
new file mode 100644
index 000..0f7b611
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -0,0 +1,820 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk 
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+ {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb: gpb {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe0: gpe0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe1: gpe1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf0: gpf0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf1: gpf1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf2: gpf2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf3: gpf3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg0: gpg0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg1: gpg1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg2: gpg2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg3: gpg3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpj0: gpj0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpj1: gpj1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+ 

[PATCH 1/3] ARM: s5pv210: Add board file for boot using Device Tree

2013-09-28 Thread Mateusz Krawczuk
This patch adds board file that will be used to boot S5PV210/S5PC110-based
boards using Device Tree.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig   | 14 +
 arch/arm/mach-s5pv210/Makefile  |  2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c | 92 +
 3 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index abad41f..be7a056 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -201,6 +201,20 @@ config MACH_TORBRECK
help
  Machine support for aESOP Torbreck
 
+config MACH_S5PV210_DT
+   bool "Samsung S5PV210/S5PC110 machine using Device Tree"
+   select CLKSRC_OF
+   select CPU_S5PV210
+   select PINCTRL
+   select PINCTRL_S5PV210
+   select USE_OF
+   help
+ Machine support for Samsung S5PV210/S5PC110 machines with Device Tree
+ enabled.
+ Select this if a fdt blob is available for your S5PV210 SoC based
+ board.
+ Note: This is under development and not all peripherals can be
+ supported with this machine file.
 endmenu
 
 endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 0c67fe2..46277d0 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MACH_GONI)   += mach-goni.o
 obj-$(CONFIG_MACH_SMDKC110)+= mach-smdkc110.o
 obj-$(CONFIG_MACH_SMDKV210)+= mach-smdkv210.o
 obj-$(CONFIG_MACH_TORBRECK)+= mach-torbreck.o
-
+obj-$(CONFIG_MACH_S5PV210_DT)  += mach-s5pv210-dt.o
 # device support
 
 obj-y  += dev-audio.o
diff --git a/arch/arm/mach-s5pv210/mach-s5pv210-dt.c 
b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
new file mode 100644
index 000..8944ae5
--- /dev/null
+++ b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
@@ -0,0 +1,92 @@
+
+/*
+ * Samsung's S5PV210/S5PC110 flattened device tree enabled machine
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "common.h"
+
+/*
+ * IO mapping for shared system controller IP.
+ *
+ * FIXME: Make remaining drivers use dynamic mapping.
+ */
+static struct map_desc s5pv210_dt_iodesc[] __initdata = {
+   {
+   .virtual = (unsigned long)S3C_VA_SYS,
+   .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
+   .length = SZ_64K,
+   .type = MT_DEVICE,
+   },
+};
+
+static void __init s5pv210_dt_map_io(void)
+{
+   debug_ll_io_init();
+   iotable_init(s5pv210_dt_iodesc, ARRAY_SIZE(s5pv210_dt_iodesc));
+}
+
+static void __init s5pv210_dt_init_irq(void)
+{
+   void __iomem *chipid_base;
+   struct device_node *np;
+
+   np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-chipid");
+   if (!np)
+   panic("%s: Unable to find device node!", __func__);
+
+   chipid_base = of_iomap(np, 0);
+   if (!chipid_base)
+   panic("Unable get a chipid!");
+
+   s5p_init_cpu(chipid_base);
+   iounmap(chipid_base);
+
+   if (!soc_is_s5pv210())
+   panic("SoC is not S5PV210/S5PC110!");
+
+   of_clk_init(NULL);
+   irqchip_init();
+};
+
+static void __init s5pv210_dt_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static char const *s5pv210_dt_compat[] __initconst = {
+   "samsung,s5pc110",
+   "samsung,s5pv210",
+   NULL
+};
+
+DT_MACHINE_START(S3C6400_DT, "Samsung S5PV210/S5PC110 (Flattened Device Tree)")
+   /* Maintainer: Mateusz Krawczuk  */
+   .dt_compat  = s5pv210_dt_compat,
+   .map_io= s5pv210_dt_map_io,
+   .init_irq  = s5pv210_dt_init_irq,
+   .init_machine  = s5pv210_dt_init_machine,
+   .restart= s5pv210_restart,
+MACHINE_END
-- 
1.8.1.2

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


[PATCH 3/3] ARM: Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-28 Thread Mateusz Krawczuk
Add DTS for s5pc110 boards: goni, aquila, smdkc110
s5pv210: smdkv210, tiny210, torbreck

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/Makefile |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts   | 407 +++
 arch/arm/boot/dts/s5pv210-goni.dts | 486 +
 arch/arm/boot/dts/s5pv210-smdkc110.dts | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts | 273 ++
 arch/arm/boot/dts/s5pv210-tiny210.dts  | 262 ++
 arch/arm/boot/dts/s5pv210-torbreck.dts | 157 +++
 7 files changed, 1756 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-torbreck.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf75889..759205b 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -199,6 +199,12 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
 dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
s3c6410-smdk6410.dtb
+dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
+   s5pv210-tiny210.dtb \
+   s5pv210-goni.dtb \
+   s5pv210-smdkc110.dtb \
+   s5pv210-smdkv210.dtb \
+   s5pv210-torbreck.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
emev2-kzm9d-reference.dtb \
r8a7740-armadillo800eva.dtb \
diff --git a/arch/arm/boot/dts/s5pv210-aquila.dts 
b/arch/arm/boot/dts/s5pv210-aquila.dts
new file mode 100644
index 000..f12d407
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-aquila.dts
@@ -0,0 +1,407 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk 
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include 
+#include "s5pv210.dtsi"
+
+/ {
+   model = "S5PC110 Aquila";
+   compatible = "samsung,aquila", "samsung,s5pv210";
+
+   chosen {
+   bootargs = "console=ttySAC2,115200n8 root=/dev/mmcblk1p5 rw 
rootwait ignore_loglevel earlyprintk";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x3000 0x0500
+   0x4000 0x1800>;
+   };
+
+   xusbxti: oscillator {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   clock-output-names = "xusbxti";
+   #clock-cells = <0>;
+   };
+
+   regulators {
+   compatible = "simple-bus";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vtf_reg: fixed-regulator@0 {
+   compatible = "regulator-fixed";
+   reg = <0>;
+   regulator-name = "V_TF_2.8V";
+   regulator-min-microvolt = <280>;
+   regulator-max-microvolt = <280>;
+   gpios = < 4 0>;
+   enable-active-high;
+   };
+
+   pda_reg: fixed-regulator@1 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_1.8V_PDA";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   reg = <1>;
+   };
+
+   bat_reg: fixed-regulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "V_BAT";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   reg = <2>;
+   };
+   };
+
+   i2c-pmic {
+   compatible = "i2c-gpio";
+   gpios = < 0 0>, /* sda */
+   < 3 0>; /* scl */
+   i2c-gpio,delay-us = <2>;/* ~100 kHz */
+   #address-cells = <1>;
+  

[PATCH 0/3] Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-28 Thread Mateusz Krawczuk
This patch series add initial device tree support for mach s5pv210. It provides 
dts for all old board files and add support for new board: 
Tiny210 from FriendlyARM
This patch series was tested on goni, aquila and tiny210.

Missing features:
 - i2s
 - audio
 - cpufreq
 - camera noon010pc30
 - lcd support(still waiting for Common Display Framework) 
 - touchscreen atmel_mxt_ts
Need to be tested:
 - i2c require touchscreen
 - fimd require lcd
 - fimc require camera
 - mfc require CMA
 - spi 

Mateusz Krawczuk (3):
  ARM: s5pv210: Add board file for boot using Device Tree
  ARM: Samsung: DT: Add Device tree for s5pv210
  ARM: Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

 arch/arm/boot/dts/Makefile  |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts| 407 
 arch/arm/boot/dts/s5pv210-goni.dts  | 486 +++
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi  | 820 
 arch/arm/boot/dts/s5pv210-smdkc110.dts  | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts  | 273 +++
 arch/arm/boot/dts/s5pv210-tiny210.dts   | 262 ++
 arch/arm/boot/dts/s5pv210-torbreck.dts  | 157 ++
 arch/arm/boot/dts/s5pv210.dtsi  | 498 +++
 arch/arm/mach-s5pv210/Kconfig   |  14 +
 arch/arm/mach-s5pv210/Makefile  |   2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c |  92 
 12 files changed, 3181 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-torbreck.dts
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

-- 
1.8.1.2

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


[PATCH 0/3] Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-28 Thread Mateusz Krawczuk
This patch series add initial device tree support for mach s5pv210. It provides 
dts for all old board files and add support for new board: 
Tiny210 from FriendlyARM
This patch series was tested on goni, aquila and tiny210.

Missing features:
 - i2s
 - audio
 - cpufreq
 - camera noon010pc30
 - lcd support(still waiting for Common Display Framework) 
 - touchscreen atmel_mxt_ts
Need to be tested:
 - i2c require touchscreen
 - fimd require lcd
 - fimc require camera
 - mfc require CMA
 - spi 

Mateusz Krawczuk (3):
  ARM: s5pv210: Add board file for boot using Device Tree
  ARM: Samsung: DT: Add Device tree for s5pv210
  ARM: Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

 arch/arm/boot/dts/Makefile  |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts| 407 
 arch/arm/boot/dts/s5pv210-goni.dts  | 486 +++
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi  | 820 
 arch/arm/boot/dts/s5pv210-smdkc110.dts  | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts  | 273 +++
 arch/arm/boot/dts/s5pv210-tiny210.dts   | 262 ++
 arch/arm/boot/dts/s5pv210-torbreck.dts  | 157 ++
 arch/arm/boot/dts/s5pv210.dtsi  | 498 +++
 arch/arm/mach-s5pv210/Kconfig   |  14 +
 arch/arm/mach-s5pv210/Makefile  |   2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c |  92 
 12 files changed, 3181 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-torbreck.dts
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

-- 
1.8.1.2

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


[PATCH 2/3] ARM: Samsung: DT: Add Device tree for s5pv210

2013-09-28 Thread Mateusz Krawczuk
Add generic device tree for s5pv210 and s5pv210-pinctrl

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi | 820 +
 arch/arm/boot/dts/s5pv210.dtsi | 498 
 2 files changed, 1318 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi

diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi 
b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
new file mode 100644
index 000..0f7b611
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -0,0 +1,820 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+pinctrl0 {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpb: gpb {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpe0: gpe0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpe1: gpe1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf0: gpf0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf1: gpf1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf2: gpf2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf3: gpf3 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg0: gpg0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg1: gpg1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg2: gpg2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg3: gpg3 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj0: gpj0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj1: gpj1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj2: gpj2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj3: gpj3 {
+   gpio

[PATCH 1/3] ARM: s5pv210: Add board file for boot using Device Tree

2013-09-28 Thread Mateusz Krawczuk
This patch adds board file that will be used to boot S5PV210/S5PC110-based
boards using Device Tree.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig   | 14 +
 arch/arm/mach-s5pv210/Makefile  |  2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c | 92 +
 3 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index abad41f..be7a056 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -201,6 +201,20 @@ config MACH_TORBRECK
help
  Machine support for aESOP Torbreck
 
+config MACH_S5PV210_DT
+   bool Samsung S5PV210/S5PC110 machine using Device Tree
+   select CLKSRC_OF
+   select CPU_S5PV210
+   select PINCTRL
+   select PINCTRL_S5PV210
+   select USE_OF
+   help
+ Machine support for Samsung S5PV210/S5PC110 machines with Device Tree
+ enabled.
+ Select this if a fdt blob is available for your S5PV210 SoC based
+ board.
+ Note: This is under development and not all peripherals can be
+ supported with this machine file.
 endmenu
 
 endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 0c67fe2..46277d0 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MACH_GONI)   += mach-goni.o
 obj-$(CONFIG_MACH_SMDKC110)+= mach-smdkc110.o
 obj-$(CONFIG_MACH_SMDKV210)+= mach-smdkv210.o
 obj-$(CONFIG_MACH_TORBRECK)+= mach-torbreck.o
-
+obj-$(CONFIG_MACH_S5PV210_DT)  += mach-s5pv210-dt.o
 # device support
 
 obj-y  += dev-audio.o
diff --git a/arch/arm/mach-s5pv210/mach-s5pv210-dt.c 
b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
new file mode 100644
index 000..8944ae5
--- /dev/null
+++ b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
@@ -0,0 +1,92 @@
+
+/*
+ * Samsung's S5PV210/S5PC110 flattened device tree enabled machine
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/clk-provider.h
+#include linux/irqchip.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/of_platform.h
+
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/system_misc.h
+
+#include plat/cpu.h
+#include plat/watchdog-reset.h
+
+#include mach/map.h
+
+#include common.h
+
+/*
+ * IO mapping for shared system controller IP.
+ *
+ * FIXME: Make remaining drivers use dynamic mapping.
+ */
+static struct map_desc s5pv210_dt_iodesc[] __initdata = {
+   {
+   .virtual = (unsigned long)S3C_VA_SYS,
+   .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
+   .length = SZ_64K,
+   .type = MT_DEVICE,
+   },
+};
+
+static void __init s5pv210_dt_map_io(void)
+{
+   debug_ll_io_init();
+   iotable_init(s5pv210_dt_iodesc, ARRAY_SIZE(s5pv210_dt_iodesc));
+}
+
+static void __init s5pv210_dt_init_irq(void)
+{
+   void __iomem *chipid_base;
+   struct device_node *np;
+
+   np = of_find_compatible_node(NULL, NULL, samsung,s5pv210-chipid);
+   if (!np)
+   panic(%s: Unable to find device node!, __func__);
+
+   chipid_base = of_iomap(np, 0);
+   if (!chipid_base)
+   panic(Unable get a chipid!);
+
+   s5p_init_cpu(chipid_base);
+   iounmap(chipid_base);
+
+   if (!soc_is_s5pv210())
+   panic(SoC is not S5PV210/S5PC110!);
+
+   of_clk_init(NULL);
+   irqchip_init();
+};
+
+static void __init s5pv210_dt_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static char const *s5pv210_dt_compat[] __initconst = {
+   samsung,s5pc110,
+   samsung,s5pv210,
+   NULL
+};
+
+DT_MACHINE_START(S3C6400_DT, Samsung S5PV210/S5PC110 (Flattened Device Tree))
+   /* Maintainer: Mateusz Krawczuk m.krawc...@partner.samsung.com */
+   .dt_compat  = s5pv210_dt_compat,
+   .map_io= s5pv210_dt_map_io,
+   .init_irq  = s5pv210_dt_init_irq,
+   .init_machine  = s5pv210_dt_init_machine,
+   .restart= s5pv210_restart,
+MACHINE_END
-- 
1.8.1.2

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


[PATCH 3/3] ARM: Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-28 Thread Mateusz Krawczuk
Add DTS for s5pc110 boards: goni, aquila, smdkc110
s5pv210: smdkv210, tiny210, torbreck

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/boot/dts/Makefile |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts   | 407 +++
 arch/arm/boot/dts/s5pv210-goni.dts | 486 +
 arch/arm/boot/dts/s5pv210-smdkc110.dts | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts | 273 ++
 arch/arm/boot/dts/s5pv210-tiny210.dts  | 262 ++
 arch/arm/boot/dts/s5pv210-torbreck.dts | 157 +++
 7 files changed, 1756 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-torbreck.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf75889..759205b 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -199,6 +199,12 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
 dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
s3c6410-smdk6410.dtb
+dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
+   s5pv210-tiny210.dtb \
+   s5pv210-goni.dtb \
+   s5pv210-smdkc110.dtb \
+   s5pv210-smdkv210.dtb \
+   s5pv210-torbreck.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
emev2-kzm9d-reference.dtb \
r8a7740-armadillo800eva.dtb \
diff --git a/arch/arm/boot/dts/s5pv210-aquila.dts 
b/arch/arm/boot/dts/s5pv210-aquila.dts
new file mode 100644
index 000..f12d407
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-aquila.dts
@@ -0,0 +1,407 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include dt-bindings/input/input.h
+#include s5pv210.dtsi
+
+/ {
+   model = S5PC110 Aquila;
+   compatible = samsung,aquila, samsung,s5pv210;
+
+   chosen {
+   bootargs = console=ttySAC2,115200n8 root=/dev/mmcblk1p5 rw 
rootwait ignore_loglevel earlyprintk;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x3000 0x0500
+   0x4000 0x1800;
+   };
+
+   xusbxti: oscillator {
+   compatible = fixed-clock;
+   clock-frequency = 2400;
+   clock-output-names = xusbxti;
+   #clock-cells = 0;
+   };
+
+   regulators {
+   compatible = simple-bus;
+   #address-cells = 1;
+   #size-cells = 0;
+
+   vtf_reg: fixed-regulator@0 {
+   compatible = regulator-fixed;
+   reg = 0;
+   regulator-name = V_TF_2.8V;
+   regulator-min-microvolt = 280;
+   regulator-max-microvolt = 280;
+   gpios = mp05 4 0;
+   enable-active-high;
+   };
+
+   pda_reg: fixed-regulator@1 {
+   compatible = regulator-fixed;
+   regulator-name = VCC_1.8V_PDA;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   reg = 1;
+   };
+
+   bat_reg: fixed-regulator@2 {
+   compatible = regulator-fixed;
+   regulator-name = V_BAT;
+   regulator-min-microvolt = 370;
+   regulator-max-microvolt = 370;
+   reg = 2;
+   };
+   };
+
+   i2c-pmic {
+   compatible = i2c-gpio;
+   gpios = gpj4 0 0, /* sda */
+   gpj4 3 0; /* scl */
+   i2c-gpio,delay-us = 2;/* ~100 kHz */
+   #address-cells = 1;
+   #size-cells = 0;
+
+   pmic@66 {
+   compatible = national,lp3974;
+   reg = 0x66;
+
+   max8998,pmic-buck1-default-dvs-idx = 0

[RFC 3/3] Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-26 Thread Mateusz Krawczuk
Add DTS for s5pc110 boards: goni, aquila, smdkc110
s5pv210: smdkv210, tiny210
Torbreck is replaced by FriendlyARM Tiny210 board.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/Makefile |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts   | 407 +++
 arch/arm/boot/dts/s5pv210-goni.dts | 486 +
 arch/arm/boot/dts/s5pv210-smdkc110.dts | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts | 273 ++
 arch/arm/boot/dts/s5pv210-tiny210.dts  | 262 ++
 6 files changed, 1599 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf75889..c8c7e8f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -199,6 +199,12 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
 dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
s3c6410-smdk6410.dtb
+dtb-$(CONFIG_ARCH_S5PC100) += s5pc100-smdkc100.dtb
+dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
+   s5pv210-tiny210.dtb \
+   s5pv210-goni.dtb \
+   s5pv210-smdkc110.dtb \
+   s5pv210-smdkv210.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
emev2-kzm9d-reference.dtb \
r8a7740-armadillo800eva.dtb \
diff --git a/arch/arm/boot/dts/s5pv210-aquila.dts 
b/arch/arm/boot/dts/s5pv210-aquila.dts
new file mode 100644
index 000..f12d407
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-aquila.dts
@@ -0,0 +1,407 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk 
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include 
+#include "s5pv210.dtsi"
+
+/ {
+   model = "S5PC110 Aquila";
+   compatible = "samsung,aquila", "samsung,s5pv210";
+
+   chosen {
+   bootargs = "console=ttySAC2,115200n8 root=/dev/mmcblk1p5 rw 
rootwait ignore_loglevel earlyprintk";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x3000 0x0500
+   0x4000 0x1800>;
+   };
+
+   xusbxti: oscillator {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   clock-output-names = "xusbxti";
+   #clock-cells = <0>;
+   };
+
+   regulators {
+   compatible = "simple-bus";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vtf_reg: fixed-regulator@0 {
+   compatible = "regulator-fixed";
+   reg = <0>;
+   regulator-name = "V_TF_2.8V";
+   regulator-min-microvolt = <280>;
+   regulator-max-microvolt = <280>;
+   gpios = < 4 0>;
+   enable-active-high;
+   };
+
+   pda_reg: fixed-regulator@1 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_1.8V_PDA";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   reg = <1>;
+   };
+
+   bat_reg: fixed-regulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "V_BAT";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   reg = <2>;
+   };
+   };
+
+   i2c-pmic {
+   compatible = "i2c-gpio";
+   gpios = < 0 0>, /* sda */
+   < 3 0>; /* scl */
+   i2c-gpio,delay-us = <2>;/* ~100 kHz */
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   pmic@66 {
+ 

[RFC 2/3] Samsung: DT: Add Device tree for s5pv210

2013-09-26 Thread Mateusz Krawczuk
Add generic device tree for s5pv210 and s5pv210-pinctrl

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi | 820 +
 arch/arm/boot/dts/s5pv210.dtsi | 498 
 2 files changed, 1318 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi

diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi 
b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
new file mode 100644
index 000..0f7b611
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -0,0 +1,820 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk 
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+ {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb: gpb {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe0: gpe0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe1: gpe1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf0: gpf0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf1: gpf1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf2: gpf2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf3: gpf3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg0: gpg0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg1: gpg1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg2: gpg2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg3: gpg3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpj0: gpj0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpj1: gpj1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+ 

[RFC 1/3] ARM: s5pv210: Add board file for boot using Device Tree

2013-09-26 Thread Mateusz Krawczuk
This patch adds board file that will be used to boot S5PV210/S5PC110-based
boards using Device Tree.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig   | 14 +
 arch/arm/mach-s5pv210/Makefile  |  2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c | 92 +
 3 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index abad41f..be7a056 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -201,6 +201,20 @@ config MACH_TORBRECK
help
  Machine support for aESOP Torbreck
 
+config MACH_S5PV210_DT
+   bool "Samsung S5PV210/S5PC110 machine using Device Tree"
+   select CLKSRC_OF
+   select CPU_S5PV210
+   select PINCTRL
+   select PINCTRL_S5PV210
+   select USE_OF
+   help
+ Machine support for Samsung S5PV210/S5PC110 machines with Device Tree
+ enabled.
+ Select this if a fdt blob is available for your S5PV210 SoC based
+ board.
+ Note: This is under development and not all peripherals can be
+ supported with this machine file.
 endmenu
 
 endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 0c67fe2..46277d0 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MACH_GONI)   += mach-goni.o
 obj-$(CONFIG_MACH_SMDKC110)+= mach-smdkc110.o
 obj-$(CONFIG_MACH_SMDKV210)+= mach-smdkv210.o
 obj-$(CONFIG_MACH_TORBRECK)+= mach-torbreck.o
-
+obj-$(CONFIG_MACH_S5PV210_DT)  += mach-s5pv210-dt.o
 # device support
 
 obj-y  += dev-audio.o
diff --git a/arch/arm/mach-s5pv210/mach-s5pv210-dt.c 
b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
new file mode 100644
index 000..f7e5fa8
--- /dev/null
+++ b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
@@ -0,0 +1,92 @@
+
+/*
+ * Samsung's S5PV210/S5PC110 flattened device tree enabled machine
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "common.h"
+
+/*
+ * IO mapping for shared system controller IP.
+ *
+ * FIXME: Make remaining drivers use dynamic mapping.
+ */
+static struct map_desc s5pv210_dt_iodesc[] __initdata = {
+   {
+   .virtual = (unsigned long)S3C_VA_SYS,
+   .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
+   .length = SZ_64K,
+   .type = MT_DEVICE,
+   },
+};
+
+static void __init s5pv210_dt_map_io(void)
+{
+   debug_ll_io_init();
+   iotable_init(s5pv210_dt_iodesc, ARRAY_SIZE(s5pv210_dt_iodesc));
+}
+
+static void __init s5pv210_dt_init_irq(void)
+{
+   void __iomem *chipid_base;
+   struct device_node *np;
+
+   np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-chipid");
+   if (!np)
+   panic("%s: Unable to find device node!", __func__);
+
+   chipid_base = of_iomap(np, 0);
+   if (!chipid_base)
+   panic("Unable get a chipid!");
+
+   s5p_init_cpu(chipid_base);
+   iounmap(chipid_base);
+
+   if (!soc_is_s5pv210())
+   panic("SoC is not S5PV210/S5PC110!");
+
+   of_clk_init(NULL);
+   irqchip_init();
+};
+
+static void __init s5pv210_dt_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static char const *s5pv210_dt_compat[] __initdata = {
+   "samsung,s5pc110",
+   "samsung,s5pv210",
+   NULL
+};
+
+DT_MACHINE_START(S3C6400_DT, "Samsung S5PV210/S5PC110 (Flattened Device Tree)")
+   /* Maintainer: Mateusz Krawczuk  */
+   .dt_compat  = s5pv210_dt_compat,
+   .map_io= s5pv210_dt_map_io,
+   .init_irq  = s5pv210_dt_init_irq,
+   .init_machine  = s5pv210_dt_init_machine,
+   .restart= s5pv210_restart,
+MACHINE_END
-- 
1.8.1.2

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


[RFC 0/3]ARM: SAMSUNG: MACH S5PV210: Add support for Devicetree

2013-09-26 Thread Mateusz Krawczuk
This patch series add initial device tree support for mach s5pv210.
It was tested on goni, aquila and tiny210.

Mateusz Krawczuk (3):
  ARM: s5pv210: Add board file for boot using Device Tree
  Samsung: DT: Add Device tree for s5pv210
  Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

 arch/arm/boot/dts/Makefile  |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts| 407 
 arch/arm/boot/dts/s5pv210-goni.dts  | 486 +++
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi  | 820 
 arch/arm/boot/dts/s5pv210-smdkc110.dts  | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts  | 273 +++
 arch/arm/boot/dts/s5pv210-tiny210.dts   | 262 ++
 arch/arm/boot/dts/s5pv210.dtsi  | 498 +++
 arch/arm/mach-s5pv210/Kconfig   |  14 +
 arch/arm/mach-s5pv210/Makefile  |   2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c |  92 
 11 files changed, 3024 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

-- 
1.8.1.2

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


[RFC 0/3]ARM: SAMSUNG: MACH S5PV210: Add support for Devicetree

2013-09-26 Thread Mateusz Krawczuk
This patch series add initial device tree support for mach s5pv210.
It was tested on goni, aquila and tiny210.

Mateusz Krawczuk (3):
  ARM: s5pv210: Add board file for boot using Device Tree
  Samsung: DT: Add Device tree for s5pv210
  Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

 arch/arm/boot/dts/Makefile  |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts| 407 
 arch/arm/boot/dts/s5pv210-goni.dts  | 486 +++
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi  | 820 
 arch/arm/boot/dts/s5pv210-smdkc110.dts  | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts  | 273 +++
 arch/arm/boot/dts/s5pv210-tiny210.dts   | 262 ++
 arch/arm/boot/dts/s5pv210.dtsi  | 498 +++
 arch/arm/mach-s5pv210/Kconfig   |  14 +
 arch/arm/mach-s5pv210/Makefile  |   2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c |  92 
 11 files changed, 3024 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

-- 
1.8.1.2

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


[RFC 1/3] ARM: s5pv210: Add board file for boot using Device Tree

2013-09-26 Thread Mateusz Krawczuk
This patch adds board file that will be used to boot S5PV210/S5PC110-based
boards using Device Tree.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig   | 14 +
 arch/arm/mach-s5pv210/Makefile  |  2 +-
 arch/arm/mach-s5pv210/mach-s5pv210-dt.c | 92 +
 3 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-s5pv210/mach-s5pv210-dt.c

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index abad41f..be7a056 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -201,6 +201,20 @@ config MACH_TORBRECK
help
  Machine support for aESOP Torbreck
 
+config MACH_S5PV210_DT
+   bool Samsung S5PV210/S5PC110 machine using Device Tree
+   select CLKSRC_OF
+   select CPU_S5PV210
+   select PINCTRL
+   select PINCTRL_S5PV210
+   select USE_OF
+   help
+ Machine support for Samsung S5PV210/S5PC110 machines with Device Tree
+ enabled.
+ Select this if a fdt blob is available for your S5PV210 SoC based
+ board.
+ Note: This is under development and not all peripherals can be
+ supported with this machine file.
 endmenu
 
 endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 0c67fe2..46277d0 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MACH_GONI)   += mach-goni.o
 obj-$(CONFIG_MACH_SMDKC110)+= mach-smdkc110.o
 obj-$(CONFIG_MACH_SMDKV210)+= mach-smdkv210.o
 obj-$(CONFIG_MACH_TORBRECK)+= mach-torbreck.o
-
+obj-$(CONFIG_MACH_S5PV210_DT)  += mach-s5pv210-dt.o
 # device support
 
 obj-y  += dev-audio.o
diff --git a/arch/arm/mach-s5pv210/mach-s5pv210-dt.c 
b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
new file mode 100644
index 000..f7e5fa8
--- /dev/null
+++ b/arch/arm/mach-s5pv210/mach-s5pv210-dt.c
@@ -0,0 +1,92 @@
+
+/*
+ * Samsung's S5PV210/S5PC110 flattened device tree enabled machine
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/clk-provider.h
+#include linux/irqchip.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/of_platform.h
+
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/system_misc.h
+
+#include plat/cpu.h
+#include plat/watchdog-reset.h
+
+#include mach/map.h
+
+#include common.h
+
+/*
+ * IO mapping for shared system controller IP.
+ *
+ * FIXME: Make remaining drivers use dynamic mapping.
+ */
+static struct map_desc s5pv210_dt_iodesc[] __initdata = {
+   {
+   .virtual = (unsigned long)S3C_VA_SYS,
+   .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
+   .length = SZ_64K,
+   .type = MT_DEVICE,
+   },
+};
+
+static void __init s5pv210_dt_map_io(void)
+{
+   debug_ll_io_init();
+   iotable_init(s5pv210_dt_iodesc, ARRAY_SIZE(s5pv210_dt_iodesc));
+}
+
+static void __init s5pv210_dt_init_irq(void)
+{
+   void __iomem *chipid_base;
+   struct device_node *np;
+
+   np = of_find_compatible_node(NULL, NULL, samsung,s5pv210-chipid);
+   if (!np)
+   panic(%s: Unable to find device node!, __func__);
+
+   chipid_base = of_iomap(np, 0);
+   if (!chipid_base)
+   panic(Unable get a chipid!);
+
+   s5p_init_cpu(chipid_base);
+   iounmap(chipid_base);
+
+   if (!soc_is_s5pv210())
+   panic(SoC is not S5PV210/S5PC110!);
+
+   of_clk_init(NULL);
+   irqchip_init();
+};
+
+static void __init s5pv210_dt_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static char const *s5pv210_dt_compat[] __initdata = {
+   samsung,s5pc110,
+   samsung,s5pv210,
+   NULL
+};
+
+DT_MACHINE_START(S3C6400_DT, Samsung S5PV210/S5PC110 (Flattened Device Tree))
+   /* Maintainer: Mateusz Krawczuk m.krawc...@partner.samsung.com */
+   .dt_compat  = s5pv210_dt_compat,
+   .map_io= s5pv210_dt_map_io,
+   .init_irq  = s5pv210_dt_init_irq,
+   .init_machine  = s5pv210_dt_init_machine,
+   .restart= s5pv210_restart,
+MACHINE_END
-- 
1.8.1.2

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


[RFC 2/3] Samsung: DT: Add Device tree for s5pv210

2013-09-26 Thread Mateusz Krawczuk
Add generic device tree for s5pv210 and s5pv210-pinctrl

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/boot/dts/s5pv210-pinctrl.dtsi | 820 +
 arch/arm/boot/dts/s5pv210.dtsi | 498 
 2 files changed, 1318 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s5pv210.dtsi

diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi 
b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
new file mode 100644
index 000..0f7b611
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -0,0 +1,820 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+pinctrl0 {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpb: gpb {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpe0: gpe0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpe1: gpe1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf0: gpf0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf1: gpf1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf2: gpf2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpf3: gpf3 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg0: gpg0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg1: gpg1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg2: gpg2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpg3: gpg3 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj0: gpj0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj1: gpj1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj2: gpj2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpj3: gpj3 {
+   gpio

[RFC 3/3] Samsung: DT: Add Device tree for S5PC110/S5PV210 Boards

2013-09-26 Thread Mateusz Krawczuk
Add DTS for s5pc110 boards: goni, aquila, smdkc110
s5pv210: smdkv210, tiny210
Torbreck is replaced by FriendlyARM Tiny210 board.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/boot/dts/Makefile |   6 +
 arch/arm/boot/dts/s5pv210-aquila.dts   | 407 +++
 arch/arm/boot/dts/s5pv210-goni.dts | 486 +
 arch/arm/boot/dts/s5pv210-smdkc110.dts | 165 +++
 arch/arm/boot/dts/s5pv210-smdkv210.dts | 273 ++
 arch/arm/boot/dts/s5pv210-tiny210.dts  | 262 ++
 6 files changed, 1599 insertions(+)
 create mode 100644 arch/arm/boot/dts/s5pv210-aquila.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-goni.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkc110.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-smdkv210.dts
 create mode 100644 arch/arm/boot/dts/s5pv210-tiny210.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf75889..c8c7e8f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -199,6 +199,12 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
 dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
s3c6410-smdk6410.dtb
+dtb-$(CONFIG_ARCH_S5PC100) += s5pc100-smdkc100.dtb
+dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
+   s5pv210-tiny210.dtb \
+   s5pv210-goni.dtb \
+   s5pv210-smdkc110.dtb \
+   s5pv210-smdkv210.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
emev2-kzm9d-reference.dtb \
r8a7740-armadillo800eva.dtb \
diff --git a/arch/arm/boot/dts/s5pv210-aquila.dts 
b/arch/arm/boot/dts/s5pv210-aquila.dts
new file mode 100644
index 000..f12d407
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-aquila.dts
@@ -0,0 +1,407 @@
+/*
+ * Samsung's S5PV210 SoC device tree source
+ *
+ * Copyright (c) 2013 Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include dt-bindings/input/input.h
+#include s5pv210.dtsi
+
+/ {
+   model = S5PC110 Aquila;
+   compatible = samsung,aquila, samsung,s5pv210;
+
+   chosen {
+   bootargs = console=ttySAC2,115200n8 root=/dev/mmcblk1p5 rw 
rootwait ignore_loglevel earlyprintk;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x3000 0x0500
+   0x4000 0x1800;
+   };
+
+   xusbxti: oscillator {
+   compatible = fixed-clock;
+   clock-frequency = 2400;
+   clock-output-names = xusbxti;
+   #clock-cells = 0;
+   };
+
+   regulators {
+   compatible = simple-bus;
+   #address-cells = 1;
+   #size-cells = 0;
+
+   vtf_reg: fixed-regulator@0 {
+   compatible = regulator-fixed;
+   reg = 0;
+   regulator-name = V_TF_2.8V;
+   regulator-min-microvolt = 280;
+   regulator-max-microvolt = 280;
+   gpios = mp05 4 0;
+   enable-active-high;
+   };
+
+   pda_reg: fixed-regulator@1 {
+   compatible = regulator-fixed;
+   regulator-name = VCC_1.8V_PDA;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   reg = 1;
+   };
+
+   bat_reg: fixed-regulator@2 {
+   compatible = regulator-fixed;
+   regulator-name = V_BAT;
+   regulator-min-microvolt = 370;
+   regulator-max-microvolt = 370;
+   reg = 2;
+   };
+   };
+
+   i2c-pmic {
+   compatible = i2c-gpio;
+   gpios = gpj4 0 0, /* sda */
+   gpj4 3 0; /* scl */
+   i2c-gpio,delay-us = 2;/* ~100 kHz */
+   #address-cells = 1;
+   #size-cells = 0;
+
+   pmic@66 {
+   compatible = national,lp3974;
+   reg = 0x66;
+
+   max8998,pmic-buck1-default-dvs-idx = 0;
+   max8998,pmic-buck1-dvs-gpios = gph0 3 0

[PATCH 0/3] ARM: S5PC100: move to common clk framework

2013-09-24 Thread Mateusz Krawczuk
This patch series is the new s5pc100 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board files.

This patch series is based on linux-next and has been tested on smdkc100 
board using board file.

Mateusz Krawczuk (3):
  clk: samsung: pll: Add support for PLL6545a and PLL6522x
  clk: samsung: Add clock driver for s5pc100
  ARM: s5pc100: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 arch/arm/mach-s5pc100/Kconfig  |   8 +
 arch/arm/mach-s5pc100/Makefile |   4 +-
 arch/arm/mach-s5pc100/common.c |  23 +-
 arch/arm/mach-s5pc100/common.h |  13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c  |   3 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   1 +
 drivers/clk/samsung/clk-pll.c  |   2 +
 drivers/clk/samsung/clk-pll.h  |   2 +
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 12 files changed, 1022 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

-- 
1.8.1.2

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


[PATCH 2/3] clk: samsung: Add clock driver for s5pc100

2013-09-24 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PC100 SoCs. The driver is just added.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 drivers/clk/samsung/Makefile   |   1 +
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 4 files changed, 970 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
new file mode 100644
index 000..d026595
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC100 Clock Controller
+
+The S5PC100 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC100 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - "samsung,s5pc100-clock" - controller compatible with S5PC100 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC100 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pc100-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti"- xtal - required
+ - "xusbxti" - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pc100-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <1200>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <4800>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@ec00 {
+   compatible = "samsung,s5pc100-uart";
+   reg = <0xec00 0x100>;
+   interrupt-parent = <>;
+   interrupts = <5>;
+   clock-names = "uart", "clk_uart_baud2",
+   "clk_uart_baud3";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART>;
+   status = "disabled";
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index e08c45e..2db3459 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -11,4 +11,5 @@ obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+obj-$(CONFIG_ARCH_S5PC100) += clk-s5pc100.o
 endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pc100.c 
b/drivers/clk/samsung/clk-s5pc100.c
new file mode 100644
index 000..c85414a
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pc100.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC100 SoCs.
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h"
+#include "clk-pll.h"
+
+#include 
+
+/* S5PC100 clock controller register offsets */

[PATCH 1/3] clk: samsung: pll: Add support for PLL6545a and PLL6522x

2013-09-24 Thread Mateusz Krawczuk
Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/clk/samsung/clk-pll.c | 2 ++
 drivers/clk/samsung/clk-pll.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 529e11d..dea8715 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -773,6 +773,8 @@ static void __init _samsung_clk_register_pll(struct 
samsung_pll_clock *pll_clk,
init.ops = _pll36xx_clk_ops;
break;
case pll_6552:
+   case pll_6545a:
+   case pll_6522x:
init.ops = _pll6552_clk_ops;
break;
case pll_6553:
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
index 6c39030..e786875 100644
--- a/drivers/clk/samsung/clk-pll.h
+++ b/drivers/clk/samsung/clk-pll.h
@@ -25,6 +25,8 @@ enum samsung_pll_type {
pll_4650c,
pll_6552,
pll_6553,
+   pll_6545a,
+   pll_6522x,
 };
 
 #define PLL_35XX_RATE(_rate, _m, _p, _s)   \
-- 
1.8.1.2

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


[PATCH 3/3] ARM: s5pc100: Migrate clock handling to Common Clock Framework

2013-09-24 Thread Mateusz Krawczuk
This patch migrates the s5pc100 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pc100/Kconfig |  8 
 arch/arm/mach-s5pc100/Makefile|  4 ++--
 arch/arm/mach-s5pc100/common.c| 23 ++-
 arch/arm/mach-s5pc100/common.h| 13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c |  3 ++-
 arch/arm/plat-samsung/Kconfig |  2 +-
 6 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be..2f27923 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -11,6 +11,7 @@ config CPU_S5PC100
bool
select S5P_EXT_INT
select SAMSUNG_DMADEV
+   select S5P_CLOCK if !COMMON_CLK
help
  Enable S5PC100 CPU support
 
@@ -50,6 +51,13 @@ config S5PC100_SETUP_SPI
help
  Common setup code for SPI GPIO configurations.
 
+config COMMON_CLK_S5PC100
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Common setup code for common clock framework.
+
 config MACH_SMDKC100
bool "SMDKC100"
select CPU_S5PC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index 118c711..74b90ec 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -11,8 +11,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-y  += dma.o
 
 # machine support
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index c5a8eea..d8db7b2 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -40,7 +40,13 @@
 
 #include 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -54,6 +60,18 @@
 
 #include "common.h"
 
+static unsigned long xxti_f, xusbxti_f;
+
+void __init s5pc100_set_xxti_freq(unsigned long freq)
+{
+   xxti_f = freq;
+}
+
+void __init s5pc100_set_xusbxti_freq(unsigned long freq)
+{
+   xusbxti_f = freq;
+}
+
 static const char name_s5pc100[] = "S5PC100";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -201,13 +219,14 @@ void __init s5pc100_map_io(void)
 
 void __init s5pc100_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pc100_register_clocks();
s5pc100_setup_clocks();
-   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
+#endif
 }
 
 void __init s5pc100_init_irq(void)
@@ -216,6 +235,8 @@ void __init s5pc100_init_irq(void)
 
/* VIC0, VIC1, and VIC2 are fully populated. */
s5p_init_irq(vic, ARRAY_SIZE(vic));
+   s5pc100_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS);
+   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
 }
 
 static struct bus_type s5pc100_subsys = {
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
index 08d782d..d7d80b8 100644
--- a/arch/arm/mach-s5pc100/common.h
+++ b/arch/arm/mach-s5pc100/common.h
@@ -14,6 +14,19 @@
 
 #include 
 
+void s5pc100_set_xxti_freq(unsigned long freq);
+void s5pc100_set_xusbxti_freq(unsigned long freq);
+
+#ifdef CONFIG_COMMON_CLK_S5PC100
+void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pc100_init_io(struct map_desc *mach_desc, int size);
 void s5pc100_init_irq(void);
 
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c 
b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 7c57a22..1087dcb 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -221,7 +221,8 @@ static struct platform_pwm_backlight_data smdkc100_bl_data 
= {
 static void __init smdkc100_map_io(void)
 {
s5pc100_init_io(NULL, 0);
-   s3c24xx_init_clocks(1200);
+   s5pc100_set_xxti_freq(1200);
+   s5pc100_set_xusbxti_freq(2400);
s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 2a98613..645f21c 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -91,7 +91,7 @@ config SAMSUNG_CLKSRC
  used by newer systems such as the S3C64XX.
 
 config S5P_CL

[PATCH v2] Spi s3c64xx fix for s5pv210

2013-09-24 Thread Mateusz Krawczuk
Replace all symbols by simple dependency PLAT_SAMSUNG.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 734eaa5..eb1f1ef 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -394,7 +394,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
tristate "Samsung S3C64XX series type SPI"
-   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS)
+   depends on PLAT_SAMSUNG
select S3C64XX_DMA if ARCH_S3C64XX
help
  SPI driver for Samsung S3C64XX and newer SoCs.
-- 
1.8.1.2

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


[PATCH v2] ARM: SAMSUNG: S5P: If detected device tree skip irq init

2013-09-24 Thread Mateusz Krawczuk
It prevents from executing things already handled by pinctrl-exynos driver,
when device tree is available.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/plat-samsung/s5p-irq-eint.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c 
b/arch/arm/plat-samsung/s5p-irq-eint.c
index faa6516..ebee4dc 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
int irq;
 
+   if (of_have_populated_dt())
+   return -ENODEV;
+
for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
irq_set_chip(irq, _irq_vic_eint);
 
-- 
1.8.1.2

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


[PATCH] pinctrl: Correct number of pins for s5pv210

2013-09-24 Thread Mateusz Krawczuk
Values of pins in table s5pv210 bank are incorrect. This patch correct values.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/pinctrl/pinctrl-exynos.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 2689f8d..155b1b3 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -663,18 +663,18 @@ static void exynos_pinctrl_resume(struct 
samsung_pinctrl_drv_data *drvdata)
 /* pin banks of s5pv210 pin-controller */
 static struct samsung_pin_bank s5pv210_pin_bank[] = {
EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
-   EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpa1", 0x04),
EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
EXYNOS_PIN_BANK_EINTG(4, 0x0a0, "gpd0", 0x14),
-   EXYNOS_PIN_BANK_EINTG(4, 0x0c0, "gpd1", 0x18),
-   EXYNOS_PIN_BANK_EINTG(5, 0x0e0, "gpe0", 0x1c),
-   EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20),
-   EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpf0", 0x24),
+   EXYNOS_PIN_BANK_EINTG(6, 0x0c0, "gpd1", 0x18),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0e0, "gpe0", 0x1c),
+   EXYNOS_PIN_BANK_EINTG(5, 0x100, "gpe1", 0x20),
+   EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpf0", 0x24),
EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpf1", 0x28),
EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpf2", 0x2c),
-   EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf3", 0x30),
+   EXYNOS_PIN_BANK_EINTG(6, 0x180, "gpf3", 0x30),
EXYNOS_PIN_BANK_EINTG(7, 0x1a0, "gpg0", 0x34),
EXYNOS_PIN_BANK_EINTG(7, 0x1c0, "gpg1", 0x38),
EXYNOS_PIN_BANK_EINTG(7, 0x1e0, "gpg2", 0x3c),
-- 
1.8.1.2

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


[PATCH v5 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-09-24 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -34,7 +35,13 @@
 #include 
 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -50,6 +57,9 @@
 
 #include "common.h"
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = "S5PV210/S5PC110";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include 
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6d72bb99..f13aa99 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -284,7 +284,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smd

[PATCH v5 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-24 Thread Mateusz Krawczuk
Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index 5c77570..33948d6 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -511,17 +511,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, "armclk");
+   cpu_clk = clk_get_sys("s5pv210-cpufreq", "armclk");
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, "sclk_dmc0");
+   dmc0_clk = clk_get_sys("s5pv210-cpufreq", "sclk_dmc0");
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, "hclk_msys");
+   dmc1_clk = clk_get_sys("s5pv210-cpufreq", "hclk_msys");
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.1.2

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


[PATCH v5 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-09-24 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be "samsung,s5pv210-clock".
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti": external crystal oscillator connected to XXTI and XXTO pins of 
+the SoC,
+ - "xusbxti": external crystal oscillator connected to XUSBXTI and XUSBXTO 
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in 
+board device tree, including the system base clock, as selected by XOM[0] 
+pin of the SoC. Refer to generic fixed rate clock bindings 
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@e290 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0xe290 0x400>;
+   interrupt-parent = <>;
+   interrupts = <10>;
+   clock-names = "uart", "clk_uart_baud0",
+   "clk_uart_baud1";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART0>;
+   status = "disabled";
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..b35da19
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV21

[PATCH v5 0/3] ARM: S5PV210: move to common clk framework

2013-09-24 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board
files.

This patch series is based on linux-next and has been tested on goni and
aquila
boards using board file.

Since v4:
Corrected mux flags for finpll.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.


Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v5 0/3] ARM: S5PV210: move to common clk framework

2013-09-24 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board
files.

This patch series is based on linux-next and has been tested on goni and
aquila
boards using board file.

Since v4:
Corrected mux flags for finpll.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.


Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v5 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-24 Thread Mateusz Krawczuk
Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index 5c77570..33948d6 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -511,17 +511,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, armclk);
+   cpu_clk = clk_get_sys(s5pv210-cpufreq, armclk);
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, sclk_dmc0);
+   dmc0_clk = clk_get_sys(s5pv210-cpufreq, sclk_dmc0);
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, hclk_msys);
+   dmc1_clk = clk_get_sys(s5pv210-cpufreq, hclk_msys);
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.1.2

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


[PATCH v5 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-09-24 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be samsung,s5pv210-clock.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - xxti: external crystal oscillator connected to XXTI and XXTO pins of 
+the SoC,
+ - xusbxti: external crystal oscillator connected to XUSBXTI and XUSBXTO 
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in 
+board device tree, including the system base clock, as selected by XOM[0] 
+pin of the SoC. Refer to generic fixed rate clock bindings 
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = samsung,s5pv210-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = fixed-clock;
+   clock-output-names = xxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = fixed-clock;
+   clock-output-names = xusbxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  clocks and clock-names properties):
+
+   uart0: serial@e290 {
+   compatible = samsung,s5pv210-uart;
+   reg = 0xe290 0x400;
+   interrupt-parent = vic1;
+   interrupts = 10;
+   clock-names = uart, clk_uart_baud0,
+   clk_uart_baud1;
+   clocks = clocks UART0, clocks UART0,
+   clocks SCLK_UART0;
+   status = disabled;
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..b35da19
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+ */
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h
+#include linux/of_address.h
+
+#include clk.h
+#include

[PATCH v5 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-09-24 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool Common Clock Framework support
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu S5PC110 Machines
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include linux/sched.h
 #include linux/dma-mapping.h
 #include linux/serial_core.h
+#include linux/of.h
 
 #include asm/proc-fns.h
 #include asm/mach/arch.h
@@ -34,7 +35,13 @@
 #include mach/regs-clock.h
 
 #include plat/cpu.h
+
+#ifdef CONFIG_S5P_CLOCK
 #include plat/clock.h
+#else
+#include linux/clk-provider.h
+#endif
+
 #include plat/devs.h
 #include plat/sdhci.h
 #include plat/adc-core.h
@@ -50,6 +57,9 @@
 
 #include common.h
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = S5PV210/S5PC110;
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG %s: initializing clocks\n, __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include linux/reboot.h
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6d72bb99..f13aa99 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -284,7 +284,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io

[PATCH] pinctrl: Correct number of pins for s5pv210

2013-09-24 Thread Mateusz Krawczuk
Values of pins in table s5pv210 bank are incorrect. This patch correct values.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/pinctrl/pinctrl-exynos.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 2689f8d..155b1b3 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -663,18 +663,18 @@ static void exynos_pinctrl_resume(struct 
samsung_pinctrl_drv_data *drvdata)
 /* pin banks of s5pv210 pin-controller */
 static struct samsung_pin_bank s5pv210_pin_bank[] = {
EXYNOS_PIN_BANK_EINTG(8, 0x000, gpa0, 0x00),
-   EXYNOS_PIN_BANK_EINTG(6, 0x020, gpa1, 0x04),
+   EXYNOS_PIN_BANK_EINTG(4, 0x020, gpa1, 0x04),
EXYNOS_PIN_BANK_EINTG(8, 0x040, gpb, 0x08),
EXYNOS_PIN_BANK_EINTG(5, 0x060, gpc0, 0x0c),
EXYNOS_PIN_BANK_EINTG(5, 0x080, gpc1, 0x10),
EXYNOS_PIN_BANK_EINTG(4, 0x0a0, gpd0, 0x14),
-   EXYNOS_PIN_BANK_EINTG(4, 0x0c0, gpd1, 0x18),
-   EXYNOS_PIN_BANK_EINTG(5, 0x0e0, gpe0, 0x1c),
-   EXYNOS_PIN_BANK_EINTG(8, 0x100, gpe1, 0x20),
-   EXYNOS_PIN_BANK_EINTG(6, 0x120, gpf0, 0x24),
+   EXYNOS_PIN_BANK_EINTG(6, 0x0c0, gpd1, 0x18),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0e0, gpe0, 0x1c),
+   EXYNOS_PIN_BANK_EINTG(5, 0x100, gpe1, 0x20),
+   EXYNOS_PIN_BANK_EINTG(8, 0x120, gpf0, 0x24),
EXYNOS_PIN_BANK_EINTG(8, 0x140, gpf1, 0x28),
EXYNOS_PIN_BANK_EINTG(8, 0x160, gpf2, 0x2c),
-   EXYNOS_PIN_BANK_EINTG(8, 0x180, gpf3, 0x30),
+   EXYNOS_PIN_BANK_EINTG(6, 0x180, gpf3, 0x30),
EXYNOS_PIN_BANK_EINTG(7, 0x1a0, gpg0, 0x34),
EXYNOS_PIN_BANK_EINTG(7, 0x1c0, gpg1, 0x38),
EXYNOS_PIN_BANK_EINTG(7, 0x1e0, gpg2, 0x3c),
-- 
1.8.1.2

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


[PATCH v2] ARM: SAMSUNG: S5P: If detected device tree skip irq init

2013-09-24 Thread Mateusz Krawczuk
It prevents from executing things already handled by pinctrl-exynos driver,
when device tree is available.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/plat-samsung/s5p-irq-eint.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c 
b/arch/arm/plat-samsung/s5p-irq-eint.c
index faa6516..ebee4dc 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -16,6 +16,7 @@
 #include linux/device.h
 #include linux/gpio.h
 #include linux/irqchip/arm-vic.h
+#include linux/of.h
 
 #include plat/regs-irqtype.h
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
int irq;
 
+   if (of_have_populated_dt())
+   return -ENODEV;
+
for (irq = IRQ_EINT(0); irq = IRQ_EINT(15); irq++)
irq_set_chip(irq, s5p_irq_vic_eint);
 
-- 
1.8.1.2

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


[PATCH v2] Spi s3c64xx fix for s5pv210

2013-09-24 Thread Mateusz Krawczuk
Replace all symbols by simple dependency PLAT_SAMSUNG.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 734eaa5..eb1f1ef 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -394,7 +394,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
tristate Samsung S3C64XX series type SPI
-   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS)
+   depends on PLAT_SAMSUNG
select S3C64XX_DMA if ARCH_S3C64XX
help
  SPI driver for Samsung S3C64XX and newer SoCs.
-- 
1.8.1.2

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


[PATCH 3/3] ARM: s5pc100: Migrate clock handling to Common Clock Framework

2013-09-24 Thread Mateusz Krawczuk
This patch migrates the s5pc100 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pc100/Kconfig |  8 
 arch/arm/mach-s5pc100/Makefile|  4 ++--
 arch/arm/mach-s5pc100/common.c| 23 ++-
 arch/arm/mach-s5pc100/common.h| 13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c |  3 ++-
 arch/arm/plat-samsung/Kconfig |  2 +-
 6 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be..2f27923 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -11,6 +11,7 @@ config CPU_S5PC100
bool
select S5P_EXT_INT
select SAMSUNG_DMADEV
+   select S5P_CLOCK if !COMMON_CLK
help
  Enable S5PC100 CPU support
 
@@ -50,6 +51,13 @@ config S5PC100_SETUP_SPI
help
  Common setup code for SPI GPIO configurations.
 
+config COMMON_CLK_S5PC100
+   bool Common Clock Framework support
+   default y
+   select COMMON_CLK
+   help
+ Common setup code for common clock framework.
+
 config MACH_SMDKC100
bool SMDKC100
select CPU_S5PC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index 118c711..74b90ec 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -11,8 +11,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-y  += dma.o
 
 # machine support
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index c5a8eea..d8db7b2 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -40,7 +40,13 @@
 
 #include plat/cpu.h
 #include plat/devs.h
+
+#ifdef CONFIG_S5P_CLOCK
 #include plat/clock.h
+#else
+#include linux/clk-provider.h
+#endif
+
 #include plat/sdhci.h
 #include plat/adc-core.h
 #include plat/ata-core.h
@@ -54,6 +60,18 @@
 
 #include common.h
 
+static unsigned long xxti_f, xusbxti_f;
+
+void __init s5pc100_set_xxti_freq(unsigned long freq)
+{
+   xxti_f = freq;
+}
+
+void __init s5pc100_set_xusbxti_freq(unsigned long freq)
+{
+   xusbxti_f = freq;
+}
+
 static const char name_s5pc100[] = S5PC100;
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -201,13 +219,14 @@ void __init s5pc100_map_io(void)
 
 void __init s5pc100_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG %s: initializing clocks\n, __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pc100_register_clocks();
s5pc100_setup_clocks();
-   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
+#endif
 }
 
 void __init s5pc100_init_irq(void)
@@ -216,6 +235,8 @@ void __init s5pc100_init_irq(void)
 
/* VIC0, VIC1, and VIC2 are fully populated. */
s5p_init_irq(vic, ARRAY_SIZE(vic));
+   s5pc100_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS);
+   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
 }
 
 static struct bus_type s5pc100_subsys = {
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
index 08d782d..d7d80b8 100644
--- a/arch/arm/mach-s5pc100/common.h
+++ b/arch/arm/mach-s5pc100/common.h
@@ -14,6 +14,19 @@
 
 #include linux/reboot.h
 
+void s5pc100_set_xxti_freq(unsigned long freq);
+void s5pc100_set_xusbxti_freq(unsigned long freq);
+
+#ifdef CONFIG_COMMON_CLK_S5PC100
+void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pc100_init_io(struct map_desc *mach_desc, int size);
 void s5pc100_init_irq(void);
 
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c 
b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 7c57a22..1087dcb 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -221,7 +221,8 @@ static struct platform_pwm_backlight_data smdkc100_bl_data 
= {
 static void __init smdkc100_map_io(void)
 {
s5pc100_init_io(NULL, 0);
-   s3c24xx_init_clocks(1200);
+   s5pc100_set_xxti_freq(1200);
+   s5pc100_set_xusbxti_freq(2400);
s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 2a98613..645f21c 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -91,7 +91,7

[PATCH 2/3] clk: samsung: Add clock driver for s5pc100

2013-09-24 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PC100 SoCs. The driver is just added.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 drivers/clk/samsung/Makefile   |   1 +
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 4 files changed, 970 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
new file mode 100644
index 000..d026595
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC100 Clock Controller
+
+The S5PC100 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC100 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - samsung,s5pc100-clock - controller compatible with S5PC100 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC100 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pc100-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - xxti- xtal - required
+ - xusbxti - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = samsung,s5pc100-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = fixed-clock;
+   clock-output-names = xxti;
+   clock-frequency = 1200;
+   #clock-cells = 0;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = fixed-clock;
+   clock-output-names = xusbxti;
+   clock-frequency = 4800;
+   #clock-cells = 0;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  clocks and clock-names properties):
+
+   uart0: serial@ec00 {
+   compatible = samsung,s5pc100-uart;
+   reg = 0xec00 0x100;
+   interrupt-parent = vic1;
+   interrupts = 5;
+   clock-names = uart, clk_uart_baud2,
+   clk_uart_baud3;
+   clocks = clock UART0, clocks UART0,
+   clock SCLK_UART;
+   status = disabled;
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index e08c45e..2db3459 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -11,4 +11,5 @@ obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+obj-$(CONFIG_ARCH_S5PC100) += clk-s5pc100.o
 endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pc100.c 
b/drivers/clk/samsung/clk-s5pc100.c
new file mode 100644
index 000..c85414a
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pc100.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC100 SoCs.
+*/
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h
+#include linux/of_address.h
+#include mach/regs-clock.h
+
+#include clk.h
+#include clk-pll.h
+
+#include dt-bindings/clock/samsung,s5pc100-clock.h
+
+/* S5PC100 clock controller register offsets */
+#define APLL_LOCK  0x
+#define MPLL_LOCK

[PATCH 1/3] clk: samsung: pll: Add support for PLL6545a and PLL6522x

2013-09-24 Thread Mateusz Krawczuk
Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/clk/samsung/clk-pll.c | 2 ++
 drivers/clk/samsung/clk-pll.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 529e11d..dea8715 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -773,6 +773,8 @@ static void __init _samsung_clk_register_pll(struct 
samsung_pll_clock *pll_clk,
init.ops = samsung_pll36xx_clk_ops;
break;
case pll_6552:
+   case pll_6545a:
+   case pll_6522x:
init.ops = samsung_pll6552_clk_ops;
break;
case pll_6553:
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
index 6c39030..e786875 100644
--- a/drivers/clk/samsung/clk-pll.h
+++ b/drivers/clk/samsung/clk-pll.h
@@ -25,6 +25,8 @@ enum samsung_pll_type {
pll_4650c,
pll_6552,
pll_6553,
+   pll_6545a,
+   pll_6522x,
 };
 
 #define PLL_35XX_RATE(_rate, _m, _p, _s)   \
-- 
1.8.1.2

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


[PATCH 0/3] ARM: S5PC100: move to common clk framework

2013-09-24 Thread Mateusz Krawczuk
This patch series is the new s5pc100 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board files.

This patch series is based on linux-next and has been tested on smdkc100 
board using board file.

Mateusz Krawczuk (3):
  clk: samsung: pll: Add support for PLL6545a and PLL6522x
  clk: samsung: Add clock driver for s5pc100
  ARM: s5pc100: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 arch/arm/mach-s5pc100/Kconfig  |   8 +
 arch/arm/mach-s5pc100/Makefile |   4 +-
 arch/arm/mach-s5pc100/common.c |  23 +-
 arch/arm/mach-s5pc100/common.h |  13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c  |   3 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   1 +
 drivers/clk/samsung/clk-pll.c  |   2 +
 drivers/clk/samsung/clk-pll.h  |   2 +
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 12 files changed, 1022 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

-- 
1.8.1.2

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


[PATCH v2] MTD: Onenand: Add device tree support for samsung onenand

2013-09-23 Thread Mateusz Krawczuk
This patch add clk and device tree nodes for samsung onenand driver.

since v1:
Updated Documentation according to Mark Rutland notes.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../devicetree/bindings/mtd/samsung-onenand.txt| 44 ++
 drivers/mtd/onenand/samsung.c  | 37 +-
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt

diff --git a/Documentation/devicetree/bindings/mtd/samsung-onenand.txt 
b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
new file mode 100644
index 000..5bf931c
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
@@ -0,0 +1,44 @@
+Device tree bindings for Samsung Onenand
+
+Required properties:
+  - compatible: value should be either of the following.
+  (a) "samsung,s3c6400-onenand",
+   for onenand controller compatible with s3c6400.
+  (b) "samsung,s3c6410-onenand",
+   for onenand controller compatible with s3c6410.
+  (c) "samsung,s5pc100-onenand",
+   for onenand controller compatible with s5pc100.
+  (d) "samsung,s5pc110-onenand",
+  for s5pc100-like onenand controller used on s5pc110 which supports DMA.
+
+Required properties for s5pc110:
+
+ - reg: the offset and length of the control registers. First region describes
+   OneNAND interface, second control registers.
+ - interrupt-parent, interruptsOnenand memory interrupts
+
+Required properties for others:
+
+ - reg: the offset and length of the control registers. First region describes
+   control registers, second OneNAND interface.
+
+Clocks:
+ - gate - clock which output is supplied to external OneNAND flash memory.
+
+
+For partiton table parsing (optional) please refer to:
+ [1] Documentation/devicetree/bindings/mtd/partition.txt
+
+Example for an s5pv210 board:
+
+   onenand@b000 {
+   compatible = "samsung,s5pc110-onenand";
+   reg = <0xb000 0x2>, <0xb060 0x2000>;
+   interrupt-parent = <>;
+   interrupts = <31>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   clocks = < NANDXL>;
+   clock-names = "gate";
+   status = "okay";
+   };
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index df7400d..5a2cc4b 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -14,6 +14,7 @@
  * S5PC110: use DMA
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -24,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -133,6 +135,7 @@ enum soc_type {
 struct s3c_onenand {
struct mtd_info *mtd;
struct platform_device  *pdev;
+   struct clk *gate;
enum soc_type   type;
void __iomem*base;
struct resource *base_res;
@@ -859,6 +862,19 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
this->write_bufferram = onenand_write_bufferram;
 }
 
+static const struct of_device_id onenand_s3c_dt_match[] = {
+   { .compatible = "samsung,s3c6400-onenand",
+   .data = (void *)TYPE_S3C6400 },
+   { .compatible = "samsung,s3c6410-onenand",
+   .data = (void *)TYPE_S3C6410 },
+   { .compatible = "samsung,s5pc100-onenand",
+   .data = (void *)TYPE_S5PC100 },
+   { .compatible = "samsung,s5pc110-onenand",
+   .data = (void *)TYPE_S5PC110 },
+   {},
+};
+MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
+
 static int s3c_onenand_probe(struct platform_device *pdev)
 {
struct onenand_platform_data *pdata;
@@ -883,12 +899,26 @@ static int s3c_onenand_probe(struct platform_device *pdev)
goto onenand_fail;
}
 
+   onenand->gate = clk_get(>dev, "gate");
+   if (IS_ERR(onenand->gate))
+   return PTR_ERR(onenand->gate);
+   clk_prepare_enable(onenand->gate);
+
this = (struct onenand_chip *) [1];
mtd->priv = this;
mtd->dev.parent = >dev;
mtd->owner = THIS_MODULE;
onenand->pdev = pdev;
-   onenand->type = platform_get_device_id(pdev)->driver_data;
+
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+
+   match = of_match_node(onenand_s3c_dt_match, pdev->dev.of_node);
+   onenand->type = (enum soc_type)match->data;
+   } else {
+   onenand->type = platform_get_device_id(pdev)->driver_data;
+   }
+
 
s3c_onenand_setup(mtd);
 
@@ -1077,6 +1107,10 @@ static int s3c_one

[PATCH] DT: if dt is available don't use s3c_arch_init

2013-09-23 Thread Mateusz Krawczuk
It prevents from executing platform code, when booting from device tree.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/plat-samsung/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index aa9511b..0ace02d 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -152,6 +153,8 @@ static int __init s3c_arch_init(void)
 {
int ret;
 
+   if (of_have_populated_dt())
+   return 0;
// do the correct init for cpu
 
if (cpu == NULL) {
-- 
1.8.1.2

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


[PATCH] DT: S5P: If detected device tree skip irq init

2013-09-23 Thread Mateusz Krawczuk
It prevents from executing code already called by device tree.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/plat-samsung/s5p-irq-eint.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c 
b/arch/arm/plat-samsung/s5p-irq-eint.c
index faa6516..ebee4dc 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
int irq;
 
+   if (of_have_populated_dt())
+   return -ENODEV;
+
for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
irq_set_chip(irq, _irq_vic_eint);
 
-- 
1.8.1.2

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


[PATCH] spi: s3c64xx: Add missing compatibles

2013-09-23 Thread Mateusz Krawczuk
Add compatibles for s3c6410, s5pc100 and s5pc110/s5pv210 boards.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/spi/spi-s3c64xx.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 8bed27a..84cc6ac 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1612,6 +1612,18 @@ static struct platform_device_id 
s3c64xx_spi_driver_ids[] = {
 };
 
 static const struct of_device_id s3c64xx_spi_dt_match[] = {
+   { .compatible = "samsung,s3c2443-spi",
+   .data = (void *)_spi_port_config,
+   },
+   { .compatible = "samsung,s3c6410-spi",
+   .data = (void *)_spi_port_config,
+   },
+   { .compatible = "samsung,s5pc100-spi",
+   .data = (void *)_spi_port_config,
+   },
+   { .compatible = "samsung,s5pv210-spi",
+   .data = (void *)_spi_port_config,
+   },
{ .compatible = "samsung,exynos4210-spi",
.data = (void *)_spi_port_config,
},
-- 
1.8.1.2

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


[PATCH] Spi s3c64xx fix for s5pv210

2013-09-23 Thread Mateusz Krawczuk
Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 734eaa5..124d7fa 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -394,7 +394,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
tristate "Samsung S3C64XX series type SPI"
-   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS)
+   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 || 
ARCH_S5P64X0 || ARCH_EXYNOS)
select S3C64XX_DMA if ARCH_S3C64XX
help
  SPI driver for Samsung S3C64XX and newer SoCs.
-- 
1.8.1.2

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


[PATCH] MTD: Onenand: Add device tree support for samsung onenand

2013-09-23 Thread Mateusz Krawczuk
This patch add clk and device tree nodes for samsung onenand driver.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../devicetree/bindings/mtd/samsung-onenand.txt| 40 ++
 drivers/mtd/onenand/samsung.c  | 37 +++-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt

diff --git a/Documentation/devicetree/bindings/mtd/samsung-onenand.txt 
b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
new file mode 100644
index 000..cc46160
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
@@ -0,0 +1,40 @@
+Device tree bindings for Samsung Onenand
+
+Required properties:
+  - compatible: value should be either of the following.
+  (a) "samsung, s3c6400-onenand", for onenand compatible with s3c6400 
onenand.
+  (b) "samsung, s3c6410-onenand", for onenand compatible with s3c6410 
onenand.
+  (c) "samsung, s5pc100-onenand", for onenand compatible with s5pc100 
onenand.
+  (d) "samsung, s5pc110-onenand", for s5pc100-like onenand used
+  on s5pc110 which supports DMA.
+
+Required properties:
+
+ - reg:The CS line the peripheral
+   is connected to
+ - interrupt-parent, interruptsWidth of the ONENAND device
+ - connected to the Samsung SoC
+   in bytes. Must be 1 or 2.
+
+Optional properties:
+
+ - dma-channel:DMA Channel index
+
+For inline partiton table parsing (optional):
+
+ - #address-cells: should be set to 1
+ - #size-cells: should be set to 1
+
+Example for an s5pv210 board:
+
+   onenand@b000 {
+   compatible = "samsung,s5pc110-onenand";
+   reg = <0xb000 0x2>, <0xb060 0x2000>;
+   interrupt-parent = <>;
+   interrupts = <31>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   clocks = < NANDXL>;
+   clock-names = "gate";
+   status = "okay";
+   };
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index df7400d..5a2cc4b 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -14,6 +14,7 @@
  * S5PC110: use DMA
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -24,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -133,6 +135,7 @@ enum soc_type {
 struct s3c_onenand {
struct mtd_info *mtd;
struct platform_device  *pdev;
+   struct clk *gate;
enum soc_type   type;
void __iomem*base;
struct resource *base_res;
@@ -859,6 +862,19 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
this->write_bufferram = onenand_write_bufferram;
 }
 
+static const struct of_device_id onenand_s3c_dt_match[] = {
+   { .compatible = "samsung,s3c6400-onenand",
+   .data = (void *)TYPE_S3C6400 },
+   { .compatible = "samsung,s3c6410-onenand",
+   .data = (void *)TYPE_S3C6410 },
+   { .compatible = "samsung,s5pc100-onenand",
+   .data = (void *)TYPE_S5PC100 },
+   { .compatible = "samsung,s5pc110-onenand",
+   .data = (void *)TYPE_S5PC110 },
+   {},
+};
+MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
+
 static int s3c_onenand_probe(struct platform_device *pdev)
 {
struct onenand_platform_data *pdata;
@@ -883,12 +899,26 @@ static int s3c_onenand_probe(struct platform_device *pdev)
goto onenand_fail;
}
 
+   onenand->gate = clk_get(>dev, "gate");
+   if (IS_ERR(onenand->gate))
+   return PTR_ERR(onenand->gate);
+   clk_prepare_enable(onenand->gate);
+
this = (struct onenand_chip *) [1];
mtd->priv = this;
mtd->dev.parent = >dev;
mtd->owner = THIS_MODULE;
onenand->pdev = pdev;
-   onenand->type = platform_get_device_id(pdev)->driver_data;
+
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+
+   match = of_match_node(onenand_s3c_dt_match, pdev->dev.of_node);
+   onenand->type = (enum soc_type)match->data;
+   } else {
+   onenand->type = platform_get_device_id(pdev)->driver_data;
+   }
+
 
s3c_onenand_setup(mtd);
 
@@ -1077,6 +1107,10 @@ static int s3c_onenand_remove(struct platform_device 
*pdev)
kfree(onenand->page_buf);
kfree(onenand);
kfree(mtd);
+
+   clk_disable_unprepa

[PATCH] MTD: Onenand: Add device tree support for samsung onenand

2013-09-23 Thread Mateusz Krawczuk
This patch add clk and device tree nodes for samsung onenand driver.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../devicetree/bindings/mtd/samsung-onenand.txt| 40 ++
 drivers/mtd/onenand/samsung.c  | 37 +++-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt

diff --git a/Documentation/devicetree/bindings/mtd/samsung-onenand.txt 
b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
new file mode 100644
index 000..cc46160
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
@@ -0,0 +1,40 @@
+Device tree bindings for Samsung Onenand
+
+Required properties:
+  - compatible: value should be either of the following.
+  (a) samsung, s3c6400-onenand, for onenand compatible with s3c6400 
onenand.
+  (b) samsung, s3c6410-onenand, for onenand compatible with s3c6410 
onenand.
+  (c) samsung, s5pc100-onenand, for onenand compatible with s5pc100 
onenand.
+  (d) samsung, s5pc110-onenand, for s5pc100-like onenand used
+  on s5pc110 which supports DMA.
+
+Required properties:
+
+ - reg:The CS line the peripheral
+   is connected to
+ - interrupt-parent, interruptsWidth of the ONENAND device
+ - connected to the Samsung SoC
+   in bytes. Must be 1 or 2.
+
+Optional properties:
+
+ - dma-channel:DMA Channel index
+
+For inline partiton table parsing (optional):
+
+ - #address-cells: should be set to 1
+ - #size-cells: should be set to 1
+
+Example for an s5pv210 board:
+
+   onenand@b000 {
+   compatible = samsung,s5pc110-onenand;
+   reg = 0xb000 0x2, 0xb060 0x2000;
+   interrupt-parent = vic1;
+   interrupts = 31;
+   #address-cells = 1;
+   #size-cells = 1;
+   clocks = clocks NANDXL;
+   clock-names = gate;
+   status = okay;
+   };
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index df7400d..5a2cc4b 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -14,6 +14,7 @@
  * S5PC110: use DMA
  */
 
+#include linux/clk.h
 #include linux/module.h
 #include linux/platform_device.h
 #include linux/sched.h
@@ -24,6 +25,7 @@
 #include linux/dma-mapping.h
 #include linux/interrupt.h
 #include linux/io.h
+#include linux/of.h
 
 #include asm/mach/flash.h
 
@@ -133,6 +135,7 @@ enum soc_type {
 struct s3c_onenand {
struct mtd_info *mtd;
struct platform_device  *pdev;
+   struct clk *gate;
enum soc_type   type;
void __iomem*base;
struct resource *base_res;
@@ -859,6 +862,19 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
this-write_bufferram = onenand_write_bufferram;
 }
 
+static const struct of_device_id onenand_s3c_dt_match[] = {
+   { .compatible = samsung,s3c6400-onenand,
+   .data = (void *)TYPE_S3C6400 },
+   { .compatible = samsung,s3c6410-onenand,
+   .data = (void *)TYPE_S3C6410 },
+   { .compatible = samsung,s5pc100-onenand,
+   .data = (void *)TYPE_S5PC100 },
+   { .compatible = samsung,s5pc110-onenand,
+   .data = (void *)TYPE_S5PC110 },
+   {},
+};
+MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
+
 static int s3c_onenand_probe(struct platform_device *pdev)
 {
struct onenand_platform_data *pdata;
@@ -883,12 +899,26 @@ static int s3c_onenand_probe(struct platform_device *pdev)
goto onenand_fail;
}
 
+   onenand-gate = clk_get(pdev-dev, gate);
+   if (IS_ERR(onenand-gate))
+   return PTR_ERR(onenand-gate);
+   clk_prepare_enable(onenand-gate);
+
this = (struct onenand_chip *) mtd[1];
mtd-priv = this;
mtd-dev.parent = pdev-dev;
mtd-owner = THIS_MODULE;
onenand-pdev = pdev;
-   onenand-type = platform_get_device_id(pdev)-driver_data;
+
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+
+   match = of_match_node(onenand_s3c_dt_match, pdev-dev.of_node);
+   onenand-type = (enum soc_type)match-data;
+   } else {
+   onenand-type = platform_get_device_id(pdev)-driver_data;
+   }
+
 
s3c_onenand_setup(mtd);
 
@@ -1077,6 +1107,10 @@ static int s3c_onenand_remove(struct platform_device 
*pdev)
kfree(onenand-page_buf);
kfree(onenand);
kfree(mtd);
+
+   clk_disable_unprepare(onenand-gate);
+   clk_put(onenand-gate);
+
return 0;
 }
 
@@ -1125,6 +1159,7

[PATCH] Spi s3c64xx fix for s5pv210

2013-09-23 Thread Mateusz Krawczuk
Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 734eaa5..124d7fa 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -394,7 +394,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
tristate Samsung S3C64XX series type SPI
-   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS)
+   depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 || 
ARCH_S5P64X0 || ARCH_EXYNOS)
select S3C64XX_DMA if ARCH_S3C64XX
help
  SPI driver for Samsung S3C64XX and newer SoCs.
-- 
1.8.1.2

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


[PATCH] spi: s3c64xx: Add missing compatibles

2013-09-23 Thread Mateusz Krawczuk
Add compatibles for s3c6410, s5pc100 and s5pc110/s5pv210 boards.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/spi/spi-s3c64xx.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 8bed27a..84cc6ac 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1612,6 +1612,18 @@ static struct platform_device_id 
s3c64xx_spi_driver_ids[] = {
 };
 
 static const struct of_device_id s3c64xx_spi_dt_match[] = {
+   { .compatible = samsung,s3c2443-spi,
+   .data = (void *)s3c2443_spi_port_config,
+   },
+   { .compatible = samsung,s3c6410-spi,
+   .data = (void *)s3c6410_spi_port_config,
+   },
+   { .compatible = samsung,s5pc100-spi,
+   .data = (void *)s5pc100_spi_port_config,
+   },
+   { .compatible = samsung,s5pv210-spi,
+   .data = (void *)s5pv210_spi_port_config,
+   },
{ .compatible = samsung,exynos4210-spi,
.data = (void *)exynos4_spi_port_config,
},
-- 
1.8.1.2

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


[PATCH] DT: S5P: If detected device tree skip irq init

2013-09-23 Thread Mateusz Krawczuk
It prevents from executing code already called by device tree.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/plat-samsung/s5p-irq-eint.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c 
b/arch/arm/plat-samsung/s5p-irq-eint.c
index faa6516..ebee4dc 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -16,6 +16,7 @@
 #include linux/device.h
 #include linux/gpio.h
 #include linux/irqchip/arm-vic.h
+#include linux/of.h
 
 #include plat/regs-irqtype.h
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
int irq;
 
+   if (of_have_populated_dt())
+   return -ENODEV;
+
for (irq = IRQ_EINT(0); irq = IRQ_EINT(15); irq++)
irq_set_chip(irq, s5p_irq_vic_eint);
 
-- 
1.8.1.2

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


[PATCH] DT: if dt is available don't use s3c_arch_init

2013-09-23 Thread Mateusz Krawczuk
It prevents from executing platform code, when booting from device tree.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/plat-samsung/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index aa9511b..0ace02d 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -20,6 +20,7 @@
 #include linux/module.h
 #include linux/interrupt.h
 #include linux/ioport.h
+#include linux/of.h
 #include linux/serial_core.h
 #include linux/platform_device.h
 #include linux/of.h
@@ -152,6 +153,8 @@ static int __init s3c_arch_init(void)
 {
int ret;
 
+   if (of_have_populated_dt())
+   return 0;
// do the correct init for cpu
 
if (cpu == NULL) {
-- 
1.8.1.2

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


[PATCH v2] MTD: Onenand: Add device tree support for samsung onenand

2013-09-23 Thread Mateusz Krawczuk
This patch add clk and device tree nodes for samsung onenand driver.

since v1:
Updated Documentation according to Mark Rutland notes.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../devicetree/bindings/mtd/samsung-onenand.txt| 44 ++
 drivers/mtd/onenand/samsung.c  | 37 +-
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/samsung-onenand.txt

diff --git a/Documentation/devicetree/bindings/mtd/samsung-onenand.txt 
b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
new file mode 100644
index 000..5bf931c
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/samsung-onenand.txt
@@ -0,0 +1,44 @@
+Device tree bindings for Samsung Onenand
+
+Required properties:
+  - compatible: value should be either of the following.
+  (a) samsung,s3c6400-onenand,
+   for onenand controller compatible with s3c6400.
+  (b) samsung,s3c6410-onenand,
+   for onenand controller compatible with s3c6410.
+  (c) samsung,s5pc100-onenand,
+   for onenand controller compatible with s5pc100.
+  (d) samsung,s5pc110-onenand,
+  for s5pc100-like onenand controller used on s5pc110 which supports DMA.
+
+Required properties for s5pc110:
+
+ - reg: the offset and length of the control registers. First region describes
+   OneNAND interface, second control registers.
+ - interrupt-parent, interruptsOnenand memory interrupts
+
+Required properties for others:
+
+ - reg: the offset and length of the control registers. First region describes
+   control registers, second OneNAND interface.
+
+Clocks:
+ - gate - clock which output is supplied to external OneNAND flash memory.
+
+
+For partiton table parsing (optional) please refer to:
+ [1] Documentation/devicetree/bindings/mtd/partition.txt
+
+Example for an s5pv210 board:
+
+   onenand@b000 {
+   compatible = samsung,s5pc110-onenand;
+   reg = 0xb000 0x2, 0xb060 0x2000;
+   interrupt-parent = vic1;
+   interrupts = 31;
+   #address-cells = 1;
+   #size-cells = 1;
+   clocks = clocks NANDXL;
+   clock-names = gate;
+   status = okay;
+   };
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index df7400d..5a2cc4b 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -14,6 +14,7 @@
  * S5PC110: use DMA
  */
 
+#include linux/clk.h
 #include linux/module.h
 #include linux/platform_device.h
 #include linux/sched.h
@@ -24,6 +25,7 @@
 #include linux/dma-mapping.h
 #include linux/interrupt.h
 #include linux/io.h
+#include linux/of.h
 
 #include asm/mach/flash.h
 
@@ -133,6 +135,7 @@ enum soc_type {
 struct s3c_onenand {
struct mtd_info *mtd;
struct platform_device  *pdev;
+   struct clk *gate;
enum soc_type   type;
void __iomem*base;
struct resource *base_res;
@@ -859,6 +862,19 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
this-write_bufferram = onenand_write_bufferram;
 }
 
+static const struct of_device_id onenand_s3c_dt_match[] = {
+   { .compatible = samsung,s3c6400-onenand,
+   .data = (void *)TYPE_S3C6400 },
+   { .compatible = samsung,s3c6410-onenand,
+   .data = (void *)TYPE_S3C6410 },
+   { .compatible = samsung,s5pc100-onenand,
+   .data = (void *)TYPE_S5PC100 },
+   { .compatible = samsung,s5pc110-onenand,
+   .data = (void *)TYPE_S5PC110 },
+   {},
+};
+MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
+
 static int s3c_onenand_probe(struct platform_device *pdev)
 {
struct onenand_platform_data *pdata;
@@ -883,12 +899,26 @@ static int s3c_onenand_probe(struct platform_device *pdev)
goto onenand_fail;
}
 
+   onenand-gate = clk_get(pdev-dev, gate);
+   if (IS_ERR(onenand-gate))
+   return PTR_ERR(onenand-gate);
+   clk_prepare_enable(onenand-gate);
+
this = (struct onenand_chip *) mtd[1];
mtd-priv = this;
mtd-dev.parent = pdev-dev;
mtd-owner = THIS_MODULE;
onenand-pdev = pdev;
-   onenand-type = platform_get_device_id(pdev)-driver_data;
+
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+
+   match = of_match_node(onenand_s3c_dt_match, pdev-dev.of_node);
+   onenand-type = (enum soc_type)match-data;
+   } else {
+   onenand-type = platform_get_device_id(pdev)-driver_data;
+   }
+
 
s3c_onenand_setup(mtd);
 
@@ -1077,6 +1107,10 @@ static int s3c_onenand_remove(struct platform_device 
*pdev)
kfree(onenand-page_buf

[PATCH v4 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-09-21 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be "samsung,s5pv210-clock".
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti": external crystal oscillator connected to XXTI and XXTO pins of 
+the SoC,
+ - "xusbxti": external crystal oscillator connected to XUSBXTI and XUSBXTO 
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in 
+board device tree, including the system base clock, as selected by XOM[0] 
+pin of the SoC. Refer to generic fixed rate clock bindings 
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@e290 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0xe290 0x400>;
+   interrupt-parent = <>;
+   interrupts = <10>;
+   clock-names = "uart", "clk_uart_baud0",
+   "clk_uart_baud1";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART0>;
+   status = "disabled";
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..4eeaa27
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV21

[PATCH v4 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-09-21 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -34,7 +35,13 @@
 #include 
 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -50,6 +57,9 @@
 
 #include "common.h"
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = "S5PV210/S5PC110";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include 
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6d72bb99..f13aa99 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -284,7 +284,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smd

[PATCH v4 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-21 Thread Mateusz Krawczuk
Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index 5c77570..33948d6 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -511,17 +511,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, "armclk");
+   cpu_clk = clk_get_sys("s5pv210-cpufreq", "armclk");
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, "sclk_dmc0");
+   dmc0_clk = clk_get_sys("s5pv210-cpufreq", "sclk_dmc0");
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, "hclk_msys");
+   dmc1_clk = clk_get_sys("s5pv210-cpufreq", "hclk_msys");
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.1.2

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


[PATCH v4 0/3] ARM: S5PV210: move to common clk framework

2013-09-21 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board 
files.

This patch series is based on linux-next and has been tested on goni and 
aquila 
boards using board file.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.

Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v5 3/4] media: s5p-tv: Fix sdo driver to work with CCF

2013-09-21 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index e49ac6c..17272e1 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -208,9 +208,9 @@ static int sdo_streamon(struct sdo_device *sdev)
clk_get_rate(sdev->fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   ret = clk_enable(sdev->dacphy);
+   ret = clk_prepare_enable(sdev->dacphy);
if (ret < 0) {
-   dev_err(sdev->dev, "clk_enable(dacphy) failed\n");
+   dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n");
goto fail;
}
/* enable DAC */
@@ -229,7 +229,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
int tries;
 
sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC);
-   clk_disable(sdev->dacphy);
+   clk_disable_unprepare(sdev->dacphy);
sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
for (tries = 100; tries; --tries) {
if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY)
@@ -273,7 +273,7 @@ static int sdo_runtime_suspend(struct device *dev)
dev_info(dev, "suspend\n");
regulator_disable(sdev->vdet);
regulator_disable(sdev->vdac);
-   clk_disable(sdev->sclk_dac);
+   clk_disable_unprepare(sdev->sclk_dac);
return 0;
 }
 
@@ -285,7 +285,7 @@ static int sdo_runtime_resume(struct device *dev)
 
dev_info(dev, "resume\n");
 
-   ret = clk_enable(sdev->sclk_dac);
+   ret = clk_prepare_enable(sdev->sclk_dac);
if (ret < 0)
return ret;
 
@@ -318,7 +318,7 @@ static int sdo_runtime_resume(struct device *dev)
 vdac_r_dis:
regulator_disable(sdev->vdac);
 dac_clk_dis:
-   clk_disable(sdev->sclk_dac);
+   clk_disable_unprepare(sdev->sclk_dac);
return ret;
 }
 
@@ -424,7 +424,11 @@ static int sdo_probe(struct platform_device *pdev)
}
 
/* enable gate for dac clock, because mixer uses it */
-   clk_enable(sdev->dac);
+   ret = clk_prepare_enable(sdev->dac);
+   if (ret < 0) {
+   dev_err(dev, "clk_prepare_enable(dac) failed\n");
+   goto fail_fout_vpll;
+   }
 
/* configure power management */
pm_runtime_enable(dev);
@@ -463,7 +467,7 @@ static int sdo_remove(struct platform_device *pdev)
struct sdo_device *sdev = sd_to_sdev(sd);
 
pm_runtime_disable(>dev);
-   clk_disable(sdev->dac);
+   clk_disable_unprepare(sdev->dac);
clk_put(sdev->fout_vpll);
clk_put(sdev->dacphy);
clk_put(sdev->dac);
-- 
1.8.1.2

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


[PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF

2013-09-21 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/media/platform/s5p-tv/mixer_drv.c | 34 +--
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 8ce7c3e..7eea286 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev)
 {
struct mxr_device *mdev = to_mdev(dev);
struct mxr_resources *res = >res;
+   int ret;
 
dev_dbg(mdev->dev, "resume - start\n");
mutex_lock(>mutex);
/* turn clocks on */
-   clk_enable(res->mixer);
-   clk_enable(res->vp);
-   clk_enable(res->sclk_mixer);
+   ret = clk_prepare_enable(res->mixer);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n");
+   goto fail;
+   }
+   ret = clk_prepare_enable(res->vp);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n");
+   goto fail_mixer;
+   }
+   ret = clk_prepare_enable(res->sclk_mixer);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n");
+   goto fail_vp;
+   }
/* apply default configuration */
mxr_reg_reset(mdev);
dev_dbg(mdev->dev, "resume - finished\n");
 
mutex_unlock(>mutex);
return 0;
+
+fail_vp:
+   clk_disable_unprepare(res->vp);
+fail_mixer:
+   clk_disable_unprepare(res->mixer);
+fail:
+   mutex_unlock(>mutex);
+   dev_err(mdev->dev, "resume failed\n");
+   return ret;
 }
 
 static int mxr_runtime_suspend(struct device *dev)
@@ -369,9 +391,9 @@ static int mxr_runtime_suspend(struct device *dev)
dev_dbg(mdev->dev, "suspend - start\n");
mutex_lock(>mutex);
/* turn clocks off */
-   clk_disable(res->sclk_mixer);
-   clk_disable(res->vp);
-   clk_disable(res->mixer);
+   clk_disable_unprepare(res->sclk_mixer);
+   clk_disable_unprepare(res->vp);
+   clk_disable_unprepare(res->mixer);
mutex_unlock(>mutex);
dev_dbg(mdev->dev, "suspend - finished\n");
return 0;
-- 
1.8.1.2

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


[PATCH v5 2/4] media: s5p-tv: Restore vpll clock rate

2013-09-21 Thread Mateusz Krawczuk
Restore vpll clock rate if start stream fail or stream is off.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..e49ac6c 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+   /** vpll rate before sdo stream was on */
+   unsigned long vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,33 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+   int ret;
+
/* set proper clock for Timing Generator */
-   clk_set_rate(sdev->fout_vpll, 5400);
+   sdev->vpll_rate = clk_get_rate(sdev->fout_vpll);
+   ret = clk_set_rate(sdev->fout_vpll, 5400);
+   if (ret < 0) {
+   dev_err(sdev->dev, "Failed to set vpll rate\n");
+   return ret;
+   }
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
clk_get_rate(sdev->fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   clk_enable(sdev->dacphy);
+   ret = clk_enable(sdev->dacphy);
+   if (ret < 0) {
+   dev_err(sdev->dev, "clk_enable(dacphy) failed\n");
+   goto fail;
+   }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+   
+fail:
+   sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
+   return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +238,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev->dev, "failed to stop streaming\n");
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
return tries ? 0 : -EIO;
 }
 
-- 
1.8.1.2

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


[PATCH v5 1/4] media: s5p-tv: Replace mxr_ macro by default dev_

2013-09-21 Thread Mateusz Krawczuk
Replace mxr_dbg, mxr_info and mxr_warn by generic solution.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 6 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer.h 
b/drivers/media/platform/s5p-tv/mixer.h
index 04e6490..c054106 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -327,18 +327,6 @@ void mxr_streamer_put(struct mxr_device *mdev);
 void mxr_get_mbus_fmt(struct mxr_device *mdev,
struct v4l2_mbus_framefmt *mbus_fmt);
 
-/* Debug */
-
-#define mxr_err(mdev, fmt, ...)  dev_err(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_warn(mdev, fmt, ...) dev_warn(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_info(mdev, fmt, ...) dev_info(mdev->dev, fmt, ##__VA_ARGS__)
-
-#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG
-   #define mxr_dbg(mdev, fmt, ...)  dev_dbg(mdev->dev, fmt, ##__VA_ARGS__)
-#else
-   #define mxr_dbg(mdev, fmt, ...)  do { (void) mdev; } while (0)
-#endif
-
 /* accessing Mixer's and Video Processor's registers */
 
 void mxr_vsync_set_update(struct mxr_device *mdev, int en);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..8ce7c3e 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -59,7 +59,7 @@ void mxr_streamer_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 1) {
struct v4l2_subdev *sd = to_outsd(mdev);
struct v4l2_mbus_framefmt mbus_fmt;
@@ -91,7 +91,7 @@ void mxr_streamer_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 0) {
int ret;
struct v4l2_subdev *sd = to_outsd(mdev);
@@ -113,7 +113,7 @@ void mxr_output_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 1)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 1);
@@ -124,7 +124,7 @@ void mxr_output_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 0)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 0);
@@ -159,42 +159,42 @@ static int mxr_acquire_plat_resources(struct mxr_device 
*mdev,
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mxr");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail;
}
 
mdev->res.mxr_regs = ioremap(res->start, resource_size(res));
if (mdev->res.mxr_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vp");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
mdev->res.vp_regs = ioremap(res->start, resource_size(res));
if (mdev->res.vp_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq");
   

[PATCH v5 0/4] media: s5p-tv: clean-up and fixes

2013-09-21 Thread Mateusz Krawczuk
This patch series add restoring previous vpll rate after driver offs stream 
or recives error.
It also replace mxr_info, mxr_dbg, mxr_warn and mxr_err macro 
by generic solution.

Mateusz Krawczuk (4):
  media: s5p-tv: Replace mxr_ macro by default dev_
  media: s5p-tv: Restore vpll clock rate
  media: s5p-tv: Fix sdo driver to work with CCF
  media: s5p-tv: Fix mixer driver to work with CCF

 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  81 ---
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 drivers/media/platform/s5p-tv/sdo_drv.c |  39 +++--
 7 files changed, 137 insertions(+), 105 deletions(-)

-- 
1.8.1.2

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


[PATCH v5 0/4] media: s5p-tv: clean-up and fixes

2013-09-21 Thread Mateusz Krawczuk
This patch series add restoring previous vpll rate after driver offs stream 
or recives error.
It also replace mxr_info, mxr_dbg, mxr_warn and mxr_err macro 
by generic solution.

Mateusz Krawczuk (4):
  media: s5p-tv: Replace mxr_ macro by default dev_
  media: s5p-tv: Restore vpll clock rate
  media: s5p-tv: Fix sdo driver to work with CCF
  media: s5p-tv: Fix mixer driver to work with CCF

 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  81 ---
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 drivers/media/platform/s5p-tv/sdo_drv.c |  39 +++--
 7 files changed, 137 insertions(+), 105 deletions(-)

-- 
1.8.1.2

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


[PATCH v5 1/4] media: s5p-tv: Replace mxr_ macro by default dev_

2013-09-21 Thread Mateusz Krawczuk
Replace mxr_dbg, mxr_info and mxr_warn by generic solution.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 6 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer.h 
b/drivers/media/platform/s5p-tv/mixer.h
index 04e6490..c054106 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -327,18 +327,6 @@ void mxr_streamer_put(struct mxr_device *mdev);
 void mxr_get_mbus_fmt(struct mxr_device *mdev,
struct v4l2_mbus_framefmt *mbus_fmt);
 
-/* Debug */
-
-#define mxr_err(mdev, fmt, ...)  dev_err(mdev-dev, fmt, ##__VA_ARGS__)
-#define mxr_warn(mdev, fmt, ...) dev_warn(mdev-dev, fmt, ##__VA_ARGS__)
-#define mxr_info(mdev, fmt, ...) dev_info(mdev-dev, fmt, ##__VA_ARGS__)
-
-#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG
-   #define mxr_dbg(mdev, fmt, ...)  dev_dbg(mdev-dev, fmt, ##__VA_ARGS__)
-#else
-   #define mxr_dbg(mdev, fmt, ...)  do { (void) mdev; } while (0)
-#endif
-
 /* accessing Mixer's and Video Processor's registers */
 
 void mxr_vsync_set_update(struct mxr_device *mdev, int en);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..8ce7c3e 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -59,7 +59,7 @@ void mxr_streamer_get(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
++mdev-n_streamer;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_streamer);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_streamer);
if (mdev-n_streamer == 1) {
struct v4l2_subdev *sd = to_outsd(mdev);
struct v4l2_mbus_framefmt mbus_fmt;
@@ -91,7 +91,7 @@ void mxr_streamer_put(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
--mdev-n_streamer;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_streamer);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_streamer);
if (mdev-n_streamer == 0) {
int ret;
struct v4l2_subdev *sd = to_outsd(mdev);
@@ -113,7 +113,7 @@ void mxr_output_get(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
++mdev-n_output;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_output);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_output);
/* turn on auxiliary driver */
if (mdev-n_output == 1)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 1);
@@ -124,7 +124,7 @@ void mxr_output_put(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
--mdev-n_output;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_output);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_output);
/* turn on auxiliary driver */
if (mdev-n_output == 0)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 0);
@@ -159,42 +159,42 @@ static int mxr_acquire_plat_resources(struct mxr_device 
*mdev,
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, mxr);
if (res == NULL) {
-   mxr_err(mdev, get memory resource failed.\n);
+   dev_err(mdev-dev, get memory resource failed.\n);
ret = -ENXIO;
goto fail;
}
 
mdev-res.mxr_regs = ioremap(res-start, resource_size(res));
if (mdev-res.mxr_regs == NULL) {
-   mxr_err(mdev, register mapping failed.\n);
+   dev_err(mdev-dev, register mapping failed.\n);
ret = -ENXIO;
goto fail;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, vp);
if (res == NULL) {
-   mxr_err(mdev, get memory resource failed.\n);
+   dev_err(mdev-dev, get memory resource failed.\n);
ret = -ENXIO;
goto fail_mxr_regs;
}
 
mdev-res.vp_regs = ioremap(res-start, resource_size(res));
if (mdev-res.vp_regs == NULL) {
-   mxr_err(mdev, register mapping failed.\n);
+   dev_err(mdev-dev, register mapping failed.\n);
ret = -ENXIO;
goto fail_mxr_regs;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, irq);
if (res == NULL) {
-   mxr_err(mdev, get interrupt resource failed.\n);
+   dev_err(mdev-dev, get interrupt resource failed.\n);
ret = -ENXIO;
goto fail_vp_regs;
}
 
ret = request_irq(res-start, mxr_irq_handler, 0, s5p-mixer, mdev

[PATCH v5 3/4] media: s5p-tv: Fix sdo driver to work with CCF

2013-09-21 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index e49ac6c..17272e1 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -208,9 +208,9 @@ static int sdo_streamon(struct sdo_device *sdev)
clk_get_rate(sdev-fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   ret = clk_enable(sdev-dacphy);
+   ret = clk_prepare_enable(sdev-dacphy);
if (ret  0) {
-   dev_err(sdev-dev, clk_enable(dacphy) failed\n);
+   dev_err(sdev-dev, clk_prepare_enable(dacphy) failed\n);
goto fail;
}
/* enable DAC */
@@ -229,7 +229,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
int tries;
 
sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC);
-   clk_disable(sdev-dacphy);
+   clk_disable_unprepare(sdev-dacphy);
sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
for (tries = 100; tries; --tries) {
if (sdo_read(sdev, SDO_CLKCON)  SDO_TVOUT_CLOCK_READY)
@@ -273,7 +273,7 @@ static int sdo_runtime_suspend(struct device *dev)
dev_info(dev, suspend\n);
regulator_disable(sdev-vdet);
regulator_disable(sdev-vdac);
-   clk_disable(sdev-sclk_dac);
+   clk_disable_unprepare(sdev-sclk_dac);
return 0;
 }
 
@@ -285,7 +285,7 @@ static int sdo_runtime_resume(struct device *dev)
 
dev_info(dev, resume\n);
 
-   ret = clk_enable(sdev-sclk_dac);
+   ret = clk_prepare_enable(sdev-sclk_dac);
if (ret  0)
return ret;
 
@@ -318,7 +318,7 @@ static int sdo_runtime_resume(struct device *dev)
 vdac_r_dis:
regulator_disable(sdev-vdac);
 dac_clk_dis:
-   clk_disable(sdev-sclk_dac);
+   clk_disable_unprepare(sdev-sclk_dac);
return ret;
 }
 
@@ -424,7 +424,11 @@ static int sdo_probe(struct platform_device *pdev)
}
 
/* enable gate for dac clock, because mixer uses it */
-   clk_enable(sdev-dac);
+   ret = clk_prepare_enable(sdev-dac);
+   if (ret  0) {
+   dev_err(dev, clk_prepare_enable(dac) failed\n);
+   goto fail_fout_vpll;
+   }
 
/* configure power management */
pm_runtime_enable(dev);
@@ -463,7 +467,7 @@ static int sdo_remove(struct platform_device *pdev)
struct sdo_device *sdev = sd_to_sdev(sd);
 
pm_runtime_disable(pdev-dev);
-   clk_disable(sdev-dac);
+   clk_disable_unprepare(sdev-dac);
clk_put(sdev-fout_vpll);
clk_put(sdev-dacphy);
clk_put(sdev-dac);
-- 
1.8.1.2

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


[PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF

2013-09-21 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/platform/s5p-tv/mixer_drv.c | 34 +--
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 8ce7c3e..7eea286 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev)
 {
struct mxr_device *mdev = to_mdev(dev);
struct mxr_resources *res = mdev-res;
+   int ret;
 
dev_dbg(mdev-dev, resume - start\n);
mutex_lock(mdev-mutex);
/* turn clocks on */
-   clk_enable(res-mixer);
-   clk_enable(res-vp);
-   clk_enable(res-sclk_mixer);
+   ret = clk_prepare_enable(res-mixer);
+   if (ret  0) {
+   dev_err(mdev-dev, clk_prepare_enable(mixer) failed\n);
+   goto fail;
+   }
+   ret = clk_prepare_enable(res-vp);
+   if (ret  0) {
+   dev_err(mdev-dev, clk_prepare_enable(vp) failed\n);
+   goto fail_mixer;
+   }
+   ret = clk_prepare_enable(res-sclk_mixer);
+   if (ret  0) {
+   dev_err(mdev-dev, clk_prepare_enable(sclk_mixer) failed\n);
+   goto fail_vp;
+   }
/* apply default configuration */
mxr_reg_reset(mdev);
dev_dbg(mdev-dev, resume - finished\n);
 
mutex_unlock(mdev-mutex);
return 0;
+
+fail_vp:
+   clk_disable_unprepare(res-vp);
+fail_mixer:
+   clk_disable_unprepare(res-mixer);
+fail:
+   mutex_unlock(mdev-mutex);
+   dev_err(mdev-dev, resume failed\n);
+   return ret;
 }
 
 static int mxr_runtime_suspend(struct device *dev)
@@ -369,9 +391,9 @@ static int mxr_runtime_suspend(struct device *dev)
dev_dbg(mdev-dev, suspend - start\n);
mutex_lock(mdev-mutex);
/* turn clocks off */
-   clk_disable(res-sclk_mixer);
-   clk_disable(res-vp);
-   clk_disable(res-mixer);
+   clk_disable_unprepare(res-sclk_mixer);
+   clk_disable_unprepare(res-vp);
+   clk_disable_unprepare(res-mixer);
mutex_unlock(mdev-mutex);
dev_dbg(mdev-dev, suspend - finished\n);
return 0;
-- 
1.8.1.2

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


[PATCH v5 2/4] media: s5p-tv: Restore vpll clock rate

2013-09-21 Thread Mateusz Krawczuk
Restore vpll clock rate if start stream fail or stream is off.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..e49ac6c 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+   /** vpll rate before sdo stream was on */
+   unsigned long vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,33 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+   int ret;
+
/* set proper clock for Timing Generator */
-   clk_set_rate(sdev-fout_vpll, 5400);
+   sdev-vpll_rate = clk_get_rate(sdev-fout_vpll);
+   ret = clk_set_rate(sdev-fout_vpll, 5400);
+   if (ret  0) {
+   dev_err(sdev-dev, Failed to set vpll rate\n);
+   return ret;
+   }
dev_info(sdev-dev, fout_vpll.rate = %lu\n,
clk_get_rate(sdev-fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   clk_enable(sdev-dacphy);
+   ret = clk_enable(sdev-dacphy);
+   if (ret  0) {
+   dev_err(sdev-dev, clk_enable(dacphy) failed\n);
+   goto fail;
+   }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+   
+fail:
+   sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+   clk_set_rate(sdev-fout_vpll, sdev-vpll_rate);
+   return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +238,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev-dev, failed to stop streaming\n);
+   clk_set_rate(sdev-fout_vpll, sdev-vpll_rate);
return tries ? 0 : -EIO;
 }
 
-- 
1.8.1.2

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


[PATCH v4 0/3] ARM: S5PV210: move to common clk framework

2013-09-21 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board 
files.

This patch series is based on linux-next and has been tested on goni and 
aquila 
boards using board file.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.

Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v4 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-09-21 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool Common Clock Framework support
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu S5PC110 Machines
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include linux/sched.h
 #include linux/dma-mapping.h
 #include linux/serial_core.h
+#include linux/of.h
 
 #include asm/proc-fns.h
 #include asm/mach/arch.h
@@ -34,7 +35,13 @@
 #include mach/regs-clock.h
 
 #include plat/cpu.h
+
+#ifdef CONFIG_S5P_CLOCK
 #include plat/clock.h
+#else
+#include linux/clk-provider.h
+#endif
+
 #include plat/devs.h
 #include plat/sdhci.h
 #include plat/adc-core.h
@@ -50,6 +57,9 @@
 
 #include common.h
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = S5PV210/S5PC110;
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG %s: initializing clocks\n, __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include linux/reboot.h
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6d72bb99..f13aa99 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -284,7 +284,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io

[PATCH v4 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-21 Thread Mateusz Krawczuk
Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index 5c77570..33948d6 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -511,17 +511,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, armclk);
+   cpu_clk = clk_get_sys(s5pv210-cpufreq, armclk);
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, sclk_dmc0);
+   dmc0_clk = clk_get_sys(s5pv210-cpufreq, sclk_dmc0);
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, hclk_msys);
+   dmc1_clk = clk_get_sys(s5pv210-cpufreq, hclk_msys);
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.1.2

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


[PATCH v4 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-09-21 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be samsung,s5pv210-clock.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - xxti: external crystal oscillator connected to XXTI and XXTO pins of 
+the SoC,
+ - xusbxti: external crystal oscillator connected to XUSBXTI and XUSBXTO 
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in 
+board device tree, including the system base clock, as selected by XOM[0] 
+pin of the SoC. Refer to generic fixed rate clock bindings 
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = samsung,s5pv210-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = fixed-clock;
+   clock-output-names = xxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = fixed-clock;
+   clock-output-names = xusbxti;
+   clock-frequency = 2400;
+   #clock-cells = 0;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  clocks and clock-names properties):
+
+   uart0: serial@e290 {
+   compatible = samsung,s5pv210-uart;
+   reg = 0xe290 0x400;
+   interrupt-parent = vic1;
+   interrupts = 10;
+   clock-names = uart, clk_uart_baud0,
+   clk_uart_baud1;
+   clocks = clocks UART0, clocks UART0,
+   clocks SCLK_UART0;
+   status = disabled;
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..4eeaa27
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+ */
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h
+#include linux/of_address.h
+
+#include clk.h
+#include

[PATCH v4 0/2] media: s5p-tv: clean-up and fixes

2013-08-30 Thread Mateusz Krawczuk
This patch series add restoring previous vpll rate after driver offs stream 
or recives error.
It also replace mxr_info, mxr_dbg, mxr_warn and mxr_err macro 
by generic solution.

Mateusz Krawczuk (2):
  media: s5p-tv: Replace mxr_ macro by default dev_
  media: s5p-tv: Restore vpll clock rate

 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 drivers/media/platform/s5p-tv/sdo_drv.c |  25 +-
 7 files changed, 101 insertions(+), 93 deletions(-)

-- 
1.8.1.2

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


[PATCH v4 1/2] media: s5p-tv: Replace mxr_ macro by default dev_

2013-08-30 Thread Mateusz Krawczuk
Replace mxr_dbg, mxr_info and mxr_warn by generic solution.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 6 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer.h 
b/drivers/media/platform/s5p-tv/mixer.h
index 04e6490..c054106 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -327,18 +327,6 @@ void mxr_streamer_put(struct mxr_device *mdev);
 void mxr_get_mbus_fmt(struct mxr_device *mdev,
struct v4l2_mbus_framefmt *mbus_fmt);
 
-/* Debug */
-
-#define mxr_err(mdev, fmt, ...)  dev_err(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_warn(mdev, fmt, ...) dev_warn(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_info(mdev, fmt, ...) dev_info(mdev->dev, fmt, ##__VA_ARGS__)
-
-#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG
-   #define mxr_dbg(mdev, fmt, ...)  dev_dbg(mdev->dev, fmt, ##__VA_ARGS__)
-#else
-   #define mxr_dbg(mdev, fmt, ...)  do { (void) mdev; } while (0)
-#endif
-
 /* accessing Mixer's and Video Processor's registers */
 
 void mxr_vsync_set_update(struct mxr_device *mdev, int en);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..8ce7c3e 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -59,7 +59,7 @@ void mxr_streamer_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 1) {
struct v4l2_subdev *sd = to_outsd(mdev);
struct v4l2_mbus_framefmt mbus_fmt;
@@ -91,7 +91,7 @@ void mxr_streamer_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 0) {
int ret;
struct v4l2_subdev *sd = to_outsd(mdev);
@@ -113,7 +113,7 @@ void mxr_output_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 1)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 1);
@@ -124,7 +124,7 @@ void mxr_output_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 0)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 0);
@@ -159,42 +159,42 @@ static int mxr_acquire_plat_resources(struct mxr_device 
*mdev,
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mxr");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail;
}
 
mdev->res.mxr_regs = ioremap(res->start, resource_size(res));
if (mdev->res.mxr_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vp");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
mdev->res.vp_regs = ioremap(res->start, resource_size(res));
if (mdev->res.vp_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq");
if (res == NULL) {
-

[PATCH v4 2/2] media: s5p-tv: Restore vpll clock rate

2013-08-30 Thread Mateusz Krawczuk
Restore vpll clock rate if start stream fail or stream is off.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..73a0ca6 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+   /** vpll rate before sdo stream was on */
+   unsigned long vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,35 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+   int ret;
+
/* set proper clock for Timing Generator */
-   clk_set_rate(sdev->fout_vpll, 5400);
+   sdev->vpll_rate = clk_get_rate(sdev->fout_vpll);
+   ret = clk_set_rate(sdev->fout_vpll, 5400);
+   if (ret < 0) {
+   dev_err(sdev->dev,
+   "Failed to set vpll rate\n");
+   return ret;
+   }
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
clk_get_rate(sdev->fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   clk_enable(sdev->dacphy);
+   ret = clk_enable(sdev->dacphy);
+   if (ret < 0) {
+   dev_err(sdev->dev,
+   "clk_enable(dacphy) failed\n");
+   goto fail;
+   }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+   
+fail:
+   sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
+   return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +240,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev->dev, "failed to stop streaming\n");
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
return tries ? 0 : -EIO;
 }
 
-- 
1.8.1.2

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


[PATCH v4 1/2] media: s5p-tv: Replace mxr_ macro by default dev_

2013-08-30 Thread Mateusz Krawczuk
Replace mxr_dbg, mxr_info and mxr_warn by generic solution.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
---
 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 6 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer.h 
b/drivers/media/platform/s5p-tv/mixer.h
index 04e6490..c054106 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -327,18 +327,6 @@ void mxr_streamer_put(struct mxr_device *mdev);
 void mxr_get_mbus_fmt(struct mxr_device *mdev,
struct v4l2_mbus_framefmt *mbus_fmt);
 
-/* Debug */
-
-#define mxr_err(mdev, fmt, ...)  dev_err(mdev-dev, fmt, ##__VA_ARGS__)
-#define mxr_warn(mdev, fmt, ...) dev_warn(mdev-dev, fmt, ##__VA_ARGS__)
-#define mxr_info(mdev, fmt, ...) dev_info(mdev-dev, fmt, ##__VA_ARGS__)
-
-#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG
-   #define mxr_dbg(mdev, fmt, ...)  dev_dbg(mdev-dev, fmt, ##__VA_ARGS__)
-#else
-   #define mxr_dbg(mdev, fmt, ...)  do { (void) mdev; } while (0)
-#endif
-
 /* accessing Mixer's and Video Processor's registers */
 
 void mxr_vsync_set_update(struct mxr_device *mdev, int en);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..8ce7c3e 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -59,7 +59,7 @@ void mxr_streamer_get(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
++mdev-n_streamer;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_streamer);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_streamer);
if (mdev-n_streamer == 1) {
struct v4l2_subdev *sd = to_outsd(mdev);
struct v4l2_mbus_framefmt mbus_fmt;
@@ -91,7 +91,7 @@ void mxr_streamer_put(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
--mdev-n_streamer;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_streamer);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_streamer);
if (mdev-n_streamer == 0) {
int ret;
struct v4l2_subdev *sd = to_outsd(mdev);
@@ -113,7 +113,7 @@ void mxr_output_get(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
++mdev-n_output;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_output);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_output);
/* turn on auxiliary driver */
if (mdev-n_output == 1)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 1);
@@ -124,7 +124,7 @@ void mxr_output_put(struct mxr_device *mdev)
 {
mutex_lock(mdev-mutex);
--mdev-n_output;
-   mxr_dbg(mdev, %s(%d)\n, __func__, mdev-n_output);
+   dev_dbg(mdev-dev, %s(%d)\n, __func__, mdev-n_output);
/* turn on auxiliary driver */
if (mdev-n_output == 0)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 0);
@@ -159,42 +159,42 @@ static int mxr_acquire_plat_resources(struct mxr_device 
*mdev,
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, mxr);
if (res == NULL) {
-   mxr_err(mdev, get memory resource failed.\n);
+   dev_err(mdev-dev, get memory resource failed.\n);
ret = -ENXIO;
goto fail;
}
 
mdev-res.mxr_regs = ioremap(res-start, resource_size(res));
if (mdev-res.mxr_regs == NULL) {
-   mxr_err(mdev, register mapping failed.\n);
+   dev_err(mdev-dev, register mapping failed.\n);
ret = -ENXIO;
goto fail;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, vp);
if (res == NULL) {
-   mxr_err(mdev, get memory resource failed.\n);
+   dev_err(mdev-dev, get memory resource failed.\n);
ret = -ENXIO;
goto fail_mxr_regs;
}
 
mdev-res.vp_regs = ioremap(res-start, resource_size(res));
if (mdev-res.vp_regs == NULL) {
-   mxr_err(mdev, register mapping failed.\n);
+   dev_err(mdev-dev, register mapping failed.\n);
ret = -ENXIO;
goto fail_mxr_regs;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, irq);
if (res == NULL) {
-   mxr_err(mdev, get interrupt resource failed.\n);
+   dev_err(mdev-dev, get interrupt resource failed.\n);
ret = -ENXIO;
goto fail_vp_regs;
}
 
ret = request_irq(res-start, mxr_irq_handler, 0, s5p-mixer, mdev);
if (ret) {
-   mxr_err(mdev, request

[PATCH v4 2/2] media: s5p-tv: Restore vpll clock rate

2013-08-30 Thread Mateusz Krawczuk
Restore vpll clock rate if start stream fail or stream is off.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..73a0ca6 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+   /** vpll rate before sdo stream was on */
+   unsigned long vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,35 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+   int ret;
+
/* set proper clock for Timing Generator */
-   clk_set_rate(sdev-fout_vpll, 5400);
+   sdev-vpll_rate = clk_get_rate(sdev-fout_vpll);
+   ret = clk_set_rate(sdev-fout_vpll, 5400);
+   if (ret  0) {
+   dev_err(sdev-dev,
+   Failed to set vpll rate\n);
+   return ret;
+   }
dev_info(sdev-dev, fout_vpll.rate = %lu\n,
clk_get_rate(sdev-fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   clk_enable(sdev-dacphy);
+   ret = clk_enable(sdev-dacphy);
+   if (ret  0) {
+   dev_err(sdev-dev,
+   clk_enable(dacphy) failed\n);
+   goto fail;
+   }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+   
+fail:
+   sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+   clk_set_rate(sdev-fout_vpll, sdev-vpll_rate);
+   return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +240,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev-dev, failed to stop streaming\n);
+   clk_set_rate(sdev-fout_vpll, sdev-vpll_rate);
return tries ? 0 : -EIO;
 }
 
-- 
1.8.1.2

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


[PATCH v4 0/2] media: s5p-tv: clean-up and fixes

2013-08-30 Thread Mateusz Krawczuk
This patch series add restoring previous vpll rate after driver offs stream 
or recives error.
It also replace mxr_info, mxr_dbg, mxr_warn and mxr_err macro 
by generic solution.

Mateusz Krawczuk (2):
  media: s5p-tv: Replace mxr_ macro by default dev_
  media: s5p-tv: Restore vpll clock rate

 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 drivers/media/platform/s5p-tv/sdo_drv.c |  25 +-
 7 files changed, 101 insertions(+), 93 deletions(-)

-- 
1.8.1.2

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


[RFC 3/3] ARM: s5pc100: Migrate clock handling to Common Clock Framework

2013-08-28 Thread Mateusz Krawczuk
This patch migrates the s5pc100 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
---
 arch/arm/mach-s5pc100/Kconfig |  8 
 arch/arm/mach-s5pc100/Makefile|  4 ++--
 arch/arm/mach-s5pc100/common.c| 23 ++-
 arch/arm/mach-s5pc100/common.h| 13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c |  3 ++-
 arch/arm/plat-samsung/Kconfig |  2 +-
 6 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be..ed50897 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -11,6 +11,7 @@ config CPU_S5PC100
bool
select S5P_EXT_INT
select SAMSUNG_DMADEV
+   select S5P_CLOCK if !COMMON_CLK_S5PC100
help
  Enable S5PC100 CPU support
 
@@ -50,6 +51,13 @@ config S5PC100_SETUP_SPI
help
  Common setup code for SPI GPIO configurations.
 
+config COMMON_CLK_S5PC100
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Common setup code for common clock framework.
+
 config MACH_SMDKC100
bool "SMDKC100"
select CPU_S5PC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index 118c711..74b90ec 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -11,8 +11,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-y  += dma.o
 
 # machine support
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index c5a8eea..d8db7b2 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -40,7 +40,13 @@
 
 #include 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -54,6 +60,18 @@
 
 #include "common.h"
 
+static unsigned long xxti_f, xusbxti_f;
+
+void __init s5pc100_set_xxti_freq(unsigned long freq)
+{
+   xxti_f = freq;
+}
+
+void __init s5pc100_set_xusbxti_freq(unsigned long freq)
+{
+   xusbxti_f = freq;
+}
+
 static const char name_s5pc100[] = "S5PC100";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -201,13 +219,14 @@ void __init s5pc100_map_io(void)
 
 void __init s5pc100_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pc100_register_clocks();
s5pc100_setup_clocks();
-   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
+#endif
 }
 
 void __init s5pc100_init_irq(void)
@@ -216,6 +235,8 @@ void __init s5pc100_init_irq(void)
 
/* VIC0, VIC1, and VIC2 are fully populated. */
s5p_init_irq(vic, ARRAY_SIZE(vic));
+   s5pc100_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS);
+   samsung_wdt_reset_init(S3C_VA_WATCHDOG);
 }
 
 static struct bus_type s5pc100_subsys = {
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
index 08d782d..d7d80b8 100644
--- a/arch/arm/mach-s5pc100/common.h
+++ b/arch/arm/mach-s5pc100/common.h
@@ -14,6 +14,19 @@
 
 #include 
 
+void s5pc100_set_xxti_freq(unsigned long freq);
+void s5pc100_set_xusbxti_freq(unsigned long freq);
+
+#ifdef CONFIG_COMMON_CLK_S5PC100
+void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pc100_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pc100_init_io(struct map_desc *mach_desc, int size);
 void s5pc100_init_irq(void);
 
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c 
b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 7c57a22..1087dcb 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -221,7 +221,8 @@ static struct platform_pwm_backlight_data smdkc100_bl_data 
= {
 static void __init smdkc100_map_io(void)
 {
s5pc100_init_io(NULL, 0);
-   s3c24xx_init_clocks(1200);
+   s5pc100_set_xxti_freq(1200);
+   s5pc100_set_xusbxti_freq(2400);
s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 2a98613..645f21c 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -91,7 +91,7 @@ config SAMSUNG_CLKSRC
  used by newer systems such as the S3C64XX.
 
 config S5P_CLOCK
-   def_bool (ARCH_S5P6

[RFC 2/3] clk: samsung: Add clock driver for s5pc100

2013-08-28 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PC100 SoCs. The driver is just added.

Signed-off-by: Mateusz Krawczuk 
---
 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 drivers/clk/samsung/Makefile   |   3 +-
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 4 files changed, 971 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
new file mode 100644
index 000..d026595
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC100 Clock Controller
+
+The S5PC100 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC100 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - "samsung,s5pc100-clock" - controller compatible with S5PC100 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC100 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pc100-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti"- xtal - required
+ - "xusbxti" - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pc100-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <1200>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <4800>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@ec00 {
+   compatible = "samsung,s5pc100-uart";
+   reg = <0xec00 0x100>;
+   interrupt-parent = <>;
+   interrupts = <5>;
+   clock-names = "uart", "clk_uart_baud2",
+   "clk_uart_baud3";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART>;
+   status = "disabled";
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index e08c45e..ff2d65e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -11,4 +11,5 @@ obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
-endif
\ No newline at end of file
+obj-$(CONFIG_ARCH_S5PC100) += clk-s5pc100.o
+endif
diff --git a/drivers/clk/samsung/clk-s5pc100.c 
b/drivers/clk/samsung/clk-s5pc100.c
new file mode 100644
index 000..d4d24f1
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pc100.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC100 SoCs.
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h"
+#include "clk-pll.h"
+
+#include 
+
+/* S5PC100 clock controller register offsets */

[RFC 1/3] clk: samsung: pll: Add support for PLL6545a and PLL6522x

2013-08-28 Thread Mateusz Krawczuk
Signed-off-by: Mateusz Krawczuk 
---
 drivers/clk/samsung/clk-pll.c | 2 ++
 drivers/clk/samsung/clk-pll.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 7572d1d..c62ddfc 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -644,6 +644,8 @@ static void __init _samsung_clk_register_pll(struct 
samsung_pll_clock *pll_clk,
init.ops = _pll36xx_clk_ops;
break;
case pll_6552:
+   case pll_6545a:
+   case pll_6522x:
init.ops = _pll6552_clk_ops;
break;
case pll_6553:
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
index cd11037..7679c4c 100644
--- a/drivers/clk/samsung/clk-pll.h
+++ b/drivers/clk/samsung/clk-pll.h
@@ -19,6 +19,8 @@ enum samsung_pll_type {
pll_2650,
pll_6552,
pll_6553,
+   pll_6545a,
+   pll_6522x,
 };
 
 #define PLL_35XX_RATE(_rate, _m, _p, _s)   \
-- 
1.8.1.2

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


[RFC 0/3] ARM: S5PC100: move to common clk framework

2013-08-28 Thread Mateusz Krawczuk
This patch series is the new s5pc100 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board files.

This patch series is based on linux-next and has been tested on smdkc100 
board using board file.

Mateusz Krawczuk (3):
  clk: samsung: pll: Add support for PLL6545a and PLL6522x
  clk: samsung: Add clock driver for s5pc100
  ARM: s5pc100: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pc100-clock.txt   |  72 +++
 arch/arm/mach-s5pc100/Kconfig  |   8 +
 arch/arm/mach-s5pc100/Makefile |   4 +-
 arch/arm/mach-s5pc100/common.c |  23 +-
 arch/arm/mach-s5pc100/common.h |  13 +
 arch/arm/mach-s5pc100/mach-smdkc100.c  |   3 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +-
 drivers/clk/samsung/clk-pll.c  |   2 +
 drivers/clk/samsung/clk-pll.h  |   2 +
 drivers/clk/samsung/clk-s5pc100.c  | 695 +
 include/dt-bindings/clock/samsung,s5pc100-clock.h  | 202 ++
 12 files changed, 1023 insertions(+), 6 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pc100-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pc100.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pc100-clock.h

-- 
1.8.1.2

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


[PATCH v3 4/6] media: s5p-tv: Fix mixer driver to work with CCF

2013-08-28 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/mixer_drv.c | 35 ---
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 8ce7c3e..3b2b305 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -347,19 +347,40 @@ static int mxr_runtime_resume(struct device *dev)
 {
struct mxr_device *mdev = to_mdev(dev);
struct mxr_resources *res = >res;
+   int ret;
 
dev_dbg(mdev->dev, "resume - start\n");
mutex_lock(>mutex);
/* turn clocks on */
-   clk_enable(res->mixer);
-   clk_enable(res->vp);
-   clk_enable(res->sclk_mixer);
+   ret = clk_prepare_enable(res->mixer);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n");
+   goto fail;
+   }
+   ret = clk_prepare_enable(res->vp);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n");
+   goto fail_mixer;
+   }
+   ret = clk_prepare_enable(res->sclk_mixer);
+   if (ret < 0) {
+   dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n");
+   goto fail_vp;
+   }
/* apply default configuration */
mxr_reg_reset(mdev);
-   dev_dbg(mdev->dev, "resume - finished\n");
 
mutex_unlock(>mutex);
+   dev_dbg(mdev->dev, "resume - finished\n");
return 0;
+fail_vp:
+   clk_disable_unprepare(res->vp);
+fail_mixer:
+   clk_disable_unprepare(res->mixer);
+fail:
+   mutex_unlock(>mutex);
+   dev_info(mdev->dev, "resume failed\n");
+   return ret;
 }
 
 static int mxr_runtime_suspend(struct device *dev)
@@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev)
dev_dbg(mdev->dev, "suspend - start\n");
mutex_lock(>mutex);
/* turn clocks off */
-   clk_disable(res->sclk_mixer);
-   clk_disable(res->vp);
-   clk_disable(res->mixer);
+   clk_disable_unprepare(res->sclk_mixer);
+   clk_disable_unprepare(res->vp);
+   clk_disable_unprepare(res->mixer);
mutex_unlock(>mutex);
dev_dbg(mdev->dev, "suspend - finished\n");
return 0;
-- 
1.8.1.2

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


[PATCH v3 5/6] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-08-28 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 732 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 221 +++
 4 files changed, 1028 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..753c8f9
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - "samsung,s5pv210-clock" - controller compatible with S5PC110/S5PV210 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC110/S5PV210 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti"- xtal - required
+ - "xusbxti" - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <1200>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <4800>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@7f005000 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0x7f005000 0x100>;
+   interrupt-parent = <>;
+   interrupts = <5>;
+   clock-names = "uart", "clk_uart_baud2",
+   "clk_uart_baud3";
+   clocks = < PCLK_UART0>, < PCLK_UART0>,
+   < SCLK_UART>;
+   status = "disabled";
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..1c5ea5c
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "

[PATCH v3 6/6] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-08-28 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 13 +
 arch/arm/mach-s5pv210/mach-aquila.c   |  1 +
 arch/arm/mach-s5pv210/mach-goni.c |  3 ++-
 arch/arm/mach-s5pv210/mach-smdkc110.c |  1 +
 arch/arm/mach-s5pv210/mach-smdkv210.c |  1 +
 arch/arm/mach-s5pv210/mach-torbreck.c |  1 +
 arch/arm/plat-samsung/Kconfig |  2 +-
 arch/arm/plat-samsung/init.c  |  2 --
 11 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..ad4546e 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -15,6 +15,7 @@ config CPU_S5PV210
select S5P_PM if PM
select S5P_SLEEP if PM
select SAMSUNG_DMADEV
+   select S5P_CLOCK if !COMMON_CLK
help
  Enable S5PV210 CPU support
 
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..a1d86a1 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -34,7 +34,13 @@
 #include 
 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -50,6 +56,14 @@
 
 #include "common.h"
 
+/* External clock frequency */
+static unsigned long xusbxti_f, xxti_f;
+
+void __init s5pv210_set_xusbxti_freq(unsigned long freq)
+{
+   xusbxti_f = freq;
+}
+
 static const char name_s5pv210[] = "S5PV210/S5PC110";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +243,14 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +264,7 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+   s5pv210_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..2db2a15 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,19 @@
 
 #include 
 
+void s5pv210_set_xxti_freq(unsigned long freq);
+void s5pv210_set_xusbxti_freq(unsigned long freq);
+
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c 
b/arch/arm/mach-s5pv210/mach-aquila.c
index ad40ab0..e37a311 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -646,6 +646,7 @@ static void __init aquila_map_io(void)
 {
s5pv210_init_io(NULL, 0);
s3c24xx_init_clocks(2400);
+   s5pv210_set_xusbxti_freq(2400);
s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..a1955e9 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,8 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL

[PATCH v3 2/6] media: s5p-tv: Restore vpll clock rate

2013-08-28 Thread Mateusz Krawczuk
Restore vpll clock rate if start stream fail or stream is off.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..9dbdfe6 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+   /** vpll rate before sdo stream was on */
+   int vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,34 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+   int ret;
+
/* set proper clock for Timing Generator */
-   clk_set_rate(sdev->fout_vpll, 5400);
+   sdev->vpll_rate = clk_get_rate(sdev->fout_vpll);
+   ret = clk_set_rate(sdev->fout_vpll, 5400);
+   if (ret < 0) {
+   dev_err(sdev->dev,
+   "Failed to set vpll rate!\n");
+   return ret;
+   }
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
clk_get_rate(sdev->fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   clk_enable(sdev->dacphy);
+   ret = clk_enable(sdev->dacphy);
+   if (ret < 0) {
+   dev_err(sdev->dev,
+   "clk_enable(dacphy) failed !\n");
+   goto fail;
+   }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+fail:
+   sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
+   return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +239,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev->dev, "failed to stop streaming\n");
+   clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
return tries ? 0 : -EIO;
 }
 
-- 
1.8.1.2

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


[PATCH v3 3/6] media: s5p-tv: Fix sdo driver to work with CCF

2013-08-28 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/sdo_drv.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index 9dbdfe6..a79e620 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -209,10 +209,10 @@ static int sdo_streamon(struct sdo_device *sdev)
clk_get_rate(sdev->fout_vpll));
/* enable clock in SDO */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-   ret = clk_enable(sdev->dacphy);
+   ret = clk_prepare_enable(sdev->dacphy);
if (ret < 0) {
dev_err(sdev->dev,
-   "clk_enable(dacphy) failed !\n");
+   "clk_prepare_enable(dacphy) failed !\n");
goto fail;
}
/* enable DAC */
@@ -230,7 +230,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
int tries;
 
sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC);
-   clk_disable(sdev->dacphy);
+   clk_disable_unprepare(sdev->dacphy);
sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
for (tries = 100; tries; --tries) {
if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY)
@@ -274,7 +274,7 @@ static int sdo_runtime_suspend(struct device *dev)
dev_info(dev, "suspend\n");
regulator_disable(sdev->vdet);
regulator_disable(sdev->vdac);
-   clk_disable(sdev->sclk_dac);
+   clk_disable_unprepare(sdev->sclk_dac);
return 0;
 }
 
@@ -286,7 +286,7 @@ static int sdo_runtime_resume(struct device *dev)
 
dev_info(dev, "resume\n");
 
-   ret = clk_enable(sdev->sclk_dac);
+   ret = clk_prepare_enable(sdev->sclk_dac);
if (ret < 0)
return ret;
 
@@ -319,7 +319,7 @@ static int sdo_runtime_resume(struct device *dev)
 vdac_r_dis:
regulator_disable(sdev->vdac);
 dac_clk_dis:
-   clk_disable(sdev->sclk_dac);
+   clk_disable_unprepare(sdev->sclk_dac);
return ret;
 }
 
@@ -333,7 +333,7 @@ static int sdo_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct sdo_device *sdev;
struct resource *res;
-   int ret = 0;
+   int ret;
struct clk *sclk_vpll;
 
dev_info(dev, "probe start\n");
@@ -425,8 +425,13 @@ static int sdo_probe(struct platform_device *pdev)
}
 
/* enable gate for dac clock, because mixer uses it */
-   clk_enable(sdev->dac);
-
+   ret = clk_prepare_enable(sdev->dac);
+   if (ret < 0) {
+   dev_err(dev,
+   "clk_prepare_enable_enable(dac) failed !\n");
+   ret = PTR_ERR(sdev->dac);
+   goto fail_fout_vpll;
+   }
/* configure power management */
pm_runtime_enable(dev);
 
@@ -464,7 +469,7 @@ static int sdo_remove(struct platform_device *pdev)
struct sdo_device *sdev = sd_to_sdev(sd);
 
pm_runtime_disable(>dev);
-   clk_disable(sdev->dac);
+   clk_disable_unprepare(sdev->dac);
clk_put(sdev->fout_vpll);
clk_put(sdev->dacphy);
clk_put(sdev->dac);
-- 
1.8.1.2

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


[PATCH v3 1/6] media: s5p-tv: Replace mxr_ macro by default dev_

2013-08-28 Thread Mateusz Krawczuk
Replace mxr_dbg, mxr_info and mxr_warn by generic solution.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/mixer.h   |  12 ---
 drivers/media/platform/s5p-tv/mixer_drv.c   |  47 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c   |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c | 100 
 drivers/media/platform/s5p-tv/mixer_vp_layer.c  |   2 +-
 6 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer.h 
b/drivers/media/platform/s5p-tv/mixer.h
index 04e6490..c054106 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -327,18 +327,6 @@ void mxr_streamer_put(struct mxr_device *mdev);
 void mxr_get_mbus_fmt(struct mxr_device *mdev,
struct v4l2_mbus_framefmt *mbus_fmt);
 
-/* Debug */
-
-#define mxr_err(mdev, fmt, ...)  dev_err(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_warn(mdev, fmt, ...) dev_warn(mdev->dev, fmt, ##__VA_ARGS__)
-#define mxr_info(mdev, fmt, ...) dev_info(mdev->dev, fmt, ##__VA_ARGS__)
-
-#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG
-   #define mxr_dbg(mdev, fmt, ...)  dev_dbg(mdev->dev, fmt, ##__VA_ARGS__)
-#else
-   #define mxr_dbg(mdev, fmt, ...)  do { (void) mdev; } while (0)
-#endif
-
 /* accessing Mixer's and Video Processor's registers */
 
 void mxr_vsync_set_update(struct mxr_device *mdev, int en);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..8ce7c3e 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -59,7 +59,7 @@ void mxr_streamer_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 1) {
struct v4l2_subdev *sd = to_outsd(mdev);
struct v4l2_mbus_framefmt mbus_fmt;
@@ -91,7 +91,7 @@ void mxr_streamer_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_streamer;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_streamer);
if (mdev->n_streamer == 0) {
int ret;
struct v4l2_subdev *sd = to_outsd(mdev);
@@ -113,7 +113,7 @@ void mxr_output_get(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
++mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 1)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 1);
@@ -124,7 +124,7 @@ void mxr_output_put(struct mxr_device *mdev)
 {
mutex_lock(>mutex);
--mdev->n_output;
-   mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output);
+   dev_dbg(mdev->dev, "%s(%d)\n", __func__, mdev->n_output);
/* turn on auxiliary driver */
if (mdev->n_output == 0)
v4l2_subdev_call(to_outsd(mdev), core, s_power, 0);
@@ -159,42 +159,42 @@ static int mxr_acquire_plat_resources(struct mxr_device 
*mdev,
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mxr");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail;
}
 
mdev->res.mxr_regs = ioremap(res->start, resource_size(res));
if (mdev->res.mxr_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vp");
if (res == NULL) {
-   mxr_err(mdev, "get memory resource failed.\n");
+   dev_err(mdev->dev, "get memory resource failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
mdev->res.vp_regs = ioremap(res->start, resource_size(res));
if (mdev->res.vp_regs == NULL) {
-   mxr_err(mdev, "register mapping failed.\n");
+   dev_err(mdev->dev, "register mapping failed.\n");
ret = -ENXIO;
goto fail_mxr_regs;
}
 
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq");
if (res == NULL) {
-

[PATCH v3 0/6] ARM: S5PV210: move to common clk framework

2013-08-28 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board files.

This patch series is based on linux-next and has been tested on goni and aquila 
boards using board file.

This patch series require adding new registration method
for PLL45xx and PLL46xx, which is included in this patch series:
clk: samsung: pll: Use new registration method for PLL46xx
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg21653.html
clk: samsung: pll: Use new registration method for PLL45xx
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg21652.html
clk: samsung: exynos4: Rename exynos4_plls to exynos4x12_plls
http://www.spinics.net/lists/arm-kernel/msg268486.html

Mateusz Krawczuk (6):
  media: s5p-tv: Replace mxr_ macro by default dev_
  media: s5p-tv: Restore vpll clock rate
  media: s5p-tv: Fix sdo driver to work with CCF
  media: s5p-tv: Fix mixer driver to work with CCF
  clk: samsung: Add clock driver for s5pc110/s5pv210
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  13 +
 arch/arm/mach-s5pv210/mach-aquila.c|   1 +
 arch/arm/mach-s5pv210/mach-goni.c  |   3 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c  |   1 +
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   1 +
 arch/arm/mach-s5pv210/mach-torbreck.c  |   1 +
 arch/arm/plat-samsung/Kconfig  |   2 +-
 arch/arm/plat-samsung/init.c   |   2 -
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 732 +
 drivers/media/platform/s5p-tv/mixer.h  |  12 -
 drivers/media/platform/s5p-tv/mixer_drv.c  |  80 ++-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c|   2 +-
 drivers/media/platform/s5p-tv/mixer_reg.c  |   6 +-
 drivers/media/platform/s5p-tv/mixer_video.c| 100 +--
 drivers/media/platform/s5p-tv/mixer_vp_layer.c |   2 +-
 drivers/media/platform/s5p-tv/sdo_drv.c|  45 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 221 +++
 22 files changed, 1216 insertions(+), 113 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v2 0/5] ARM: S5PV210: move to common clk framework

2013-08-28 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board files.

This patch series is based on linux-next and has been tested on goni and aquila 
boards using board file.

This patch series require adding new registration method
for PLL45xx and PLL46xx, which is included in this patch series:
clk: samsung: pll: Use new registration method for PLL46xx
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg21653.html
clk: samsung: pll: Use new registration method for PLL45xx
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg21652.html
clk: samsung: exynos4: Rename exynos4_plls to exynos4x12_plls
http://www.spinics.net/lists/arm-kernel/msg268486.html

Mateusz Krawczuk (5):
  media: s5p-tv: Restore vpll clock rate
  media: s5p-tv: Fix sdo driver to work with CCF
  media: s5p-tv: Fix mixer driver to work with CCF
  clk: samsung: Add clock driver for s5pc110/s5pv210
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  13 +
 arch/arm/mach-s5pv210/mach-aquila.c|   1 +
 arch/arm/mach-s5pv210/mach-goni.c  |   3 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c  |   1 +
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   1 +
 arch/arm/mach-s5pv210/mach-torbreck.c  |   1 +
 arch/arm/plat-samsung/Kconfig  |   2 +-
 arch/arm/plat-samsung/init.c   |   2 -
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 733 +
 drivers/media/platform/s5p-tv/mixer_drv.c  |  35 +-
 drivers/media/platform/s5p-tv/sdo_drv.c|  45 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 221 +++
 17 files changed, 1140 insertions(+), 23 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

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


[PATCH v2 4/5] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-08-28 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 733 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 221 +++
 4 files changed, 1029 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..753c8f9
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - "samsung,s5pv210-clock" - controller compatible with S5PC110/S5PV210 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC110/S5PV210 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti"- xtal - required
+ - "xusbxti" - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <1200>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <4800>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@7f005000 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0x7f005000 0x100>;
+   interrupt-parent = <>;
+   interrupts = <5>;
+   clock-names = "uart", "clk_uart_baud2",
+   "clk_uart_baud3";
+   clocks = < PCLK_UART0>, < PCLK_UART0>,
+   < SCLK_UART>;
+   status = "disabled";
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..c51f2bb 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifdef CONFIG_COMMON_CLK
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..d1b86c3
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,733 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h&quo

[PATCH v2 3/5] media: s5p-tv: Fix mixer driver to work with CCF

2013-08-28 Thread Mateusz Krawczuk
Replace clk_enable by clock_enable_prepare and clk_disable with 
clk_disable_unprepare.
Clock prepare is required by Clock Common Framework, and old clock driver 
didn`t support it.
Without it Common Clock Framework prints a warning.

Signed-off-by: Mateusz Krawczuk 
---
 drivers/media/platform/s5p-tv/mixer_drv.c | 35 ---
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c 
b/drivers/media/platform/s5p-tv/mixer_drv.c
index 51805a5..435c8c0 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -345,21 +345,42 @@ fail:
 
 static int mxr_runtime_resume(struct device *dev)
 {
+   int ret;
struct mxr_device *mdev = to_mdev(dev);
struct mxr_resources *res = >res;
 
mxr_dbg(mdev, "resume - start\n");
mutex_lock(>mutex);
/* turn clocks on */
-   clk_enable(res->mixer);
-   clk_enable(res->vp);
-   clk_enable(res->sclk_mixer);
+   ret = clk_prepare_enable(res->mixer);
+   if (ret < 0) {
+   mxr_err(mdev, "clk_prepare_enable(mixer) failed\n");
+   goto fail;
+   }
+   ret = clk_prepare_enable(res->vp);
+   if (ret < 0) {
+   mxr_err(mdev, "clk_prepare_enable(vp) failed\n");
+   goto fail_mixer;
+   }
+   ret = clk_prepare_enable(res->sclk_mixer);
+   if (ret < 0) {
+   mxr_err(mdev, "clk_prepare_enable(sclk_mixer) failed\n");
+   goto fail_vp;
+   }
/* apply default configuration */
mxr_reg_reset(mdev);
-   mxr_dbg(mdev, "resume - finished\n");
 
mutex_unlock(>mutex);
+   mxr_dbg(mdev, "resume - finished\n");
return 0;
+fail_vp:
+   clk_disable_unprepare(res->vp);
+fail_mixer:
+   clk_disable_unprepare(res->mixer);
+fail:
+   mutex_unlock(>mutex);
+   mxr_info(mdev, "resume failed\n");
+   return ret;
 }
 
 static int mxr_runtime_suspend(struct device *dev)
@@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev)
mxr_dbg(mdev, "suspend - start\n");
mutex_lock(>mutex);
/* turn clocks off */
-   clk_disable(res->sclk_mixer);
-   clk_disable(res->vp);
-   clk_disable(res->mixer);
+   clk_disable_unprepare(res->sclk_mixer);
+   clk_disable_unprepare(res->vp);
+   clk_disable_unprepare(res->mixer);
mutex_unlock(>mutex);
mxr_dbg(mdev, "suspend - finished\n");
return 0;
-- 
1.8.1.2

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


  1   2   >