From patchwork Thu Sep 27 10:23:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmavathi Venna X-Patchwork-Id: 1512731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 218A93FC71 for ; Thu, 27 Sep 2012 10:20:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THBBY-0001BR-6t; Thu, 27 Sep 2012 10:19:12 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THBBS-0001Ac-Qr for linux-arm-kernel@lists.infradead.org; Thu, 27 Sep 2012 10:19:08 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB000M5N7BLX0E0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 27 Sep 2012 19:19:04 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id CE.94.03860.71824605; Thu, 27 Sep 2012 19:19:03 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-e5-506428177c50 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 0E.94.03860.71824605; Thu, 27 Sep 2012 19:19:03 +0900 (KST) Received: from padma-linuxpc.sisodomain.com ([107.108.83.35]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MB0007E47BJ0P60@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 27 Sep 2012 19:19:03 +0900 (KST) From: Padmavathi Venna To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH V2] ARM: EXYNOS5: Add clocks for EXYNOS5 Audio Subsystem. Date: Thu, 27 Sep 2012 15:53:48 +0530 Message-id: <1348741428-29368-1-git-send-email-padma.v@samsung.com> X-Mailer: git-send-email 1.7.4.4 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrILMWRmVeSWpSXmKPExsWyRsSkWldcIyXA4Ocla4tNj6+xOjB6bF5S H8AYxWWTkpqTWZZapG+XwJUxfQJ7QZ9zxaKlSxkbGLebdzFyckgImEhc+T+DDcIWk7hwbz2Q zcUhJLCUUeJA5wxGmKJL534wQSQWMUq8+9nKDuFsZZJ49O8akMPBwSagI9Fy1gXEFBHwllh+ TRGkhFmgnVFi/eP7jCBxYQFPiRePNEFmsgioSpxYMoEVxOYVcJZYsGQrK8QuBYljU7+yQtQI SHybfIgFpFVCQFZi0wFmkJESAjvYJK5uWQZ1tKTEwRU3WCYwCi5gZFjFKJpakFxQnJSea6RX nJhbXJqXrpecn7uJERhOp/89k97BuKrB4hCjAAejEg9vgHtygBBrYllxZe4hRgkOZiUR3ijV lAAh3pTEyqrUovz4otKc1OJDjD5Al0xklhJNzgeGel5JvKGxibmpsamlkZGZqSkOYSVxXuFP gQFCAumJJanZqakFqUUw45g4OKUaGFeGGy06dcbV7XuX7bdisWzbGyUL52vG7njZKv7i8huv veeUZ8vKLTjpz8P56PYD180SN3vvnE88Zp1Q8OpZqrG44n7RBQYmfjPZQ79Hf+k4I72/pO2b F/MuJdNJGsbxU1wt3607bnj2B7/P6U3nd78L+e/8XGsFX+k/zdZz/I+vzX12ZtbBeQlKLMUZ iYZazEXFiQC++2yQVAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrALMWRmVeSWpSXmKPExsVy+t9jAV1xjZQAg+4FKhabHl9jdWD02Lyk PoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYxY/oE9oI+54pFS5cyNjBu N+9i5OSQEDCRuHTuBxOELSZx4d56ti5GLg4hgUWMEu9+trJDOFuZJB79uwbkcHCwCehItJx1 ATFFBLwlll9TBClhFmhnlFj/+D4jSFxYwFPixSNNkJksAqoSJ5ZMYAWxeQWcJRYs2coKsUtB 4tjUr6wTGLkXMDKsYhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAgO1mfSOxhXNVgcYhTgYFTi 4Q1wTw4QYk0sK67MPcQowcGsJMIbpZoSIMSbklhZlVqUH19UmpNafIjRB2j7RGYp0eR8YCTl lcQbGpuYmxqbWppYmJhZ4hBWEucV/hQYICSQnliSmp2aWpBaBDOOiYNTqoExS3TrjHdnryy4 7Bl069/7K8kzw39NXnnusKk+c0oqf6qRUtKRd6GzavsnhHm/ulbzPj7+0CbF8xkJVQVmeby9 fJnnT5mz75cw23dE4WlEfpNS5gpdq11e20XZ/A70zRAoZ+yt9Wn9Pu/pq+nNmZNXXjS+777h z/WyhDfPPH2u5XjmLrOQ3KqoxFKckWioxVxUnAgA33VXQIMCAAA= X-CFilter-Loop: Reflected X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.8 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, padma.v@samsung.com, sbkim73@samsung.com, sangsu4u.park@samsung.com, ben-linux@fluff.org, olofj@google.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds all the required clock instances for audio subsystem and adds the clock alias names for sclk-i2s and i2s-bus clks. This patch also do the static mapping of audss clock base address to control audss clocks in CMU clock framework. Signed-off-by: Padmavathi Venna --- arch/arm/mach-exynos/clock-exynos5.c | 117 ++++++++++++++++++++++++ arch/arm/mach-exynos/common.c | 5 + arch/arm/mach-exynos/include/mach/map.h | 1 + arch/arm/mach-exynos/include/mach/regs-audss.h | 7 +- arch/arm/plat-samsung/include/plat/map-s5p.h | 2 + 5 files changed, 131 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c index f3171c3..8ee7928 100644 --- a/arch/arm/mach-exynos/clock-exynos5.c +++ b/arch/arm/mach-exynos/clock-exynos5.c @@ -24,6 +24,7 @@ #include #include +#include #include #include "common.h" @@ -166,6 +167,16 @@ static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable) return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable); } +static int exynos5_clksrc_mask_maudio_ctrl(struct clk *clk, int enable) +{ + return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_MAUDIO, clk, enable); +} + +static int exynos5_clk_audss_ctrl(struct clk *clk, int enable) +{ + return s5p_gatectrl(EXYNOS_CLKGATE_AUDSS, clk, enable); +} + static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable) { return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable); @@ -692,6 +703,11 @@ static struct clk exynos5_init_clocks_off[] = { .ctrlbit = (1 << 3), }, { .name = "iis", + .devname = "samsung-i2s.0", + .enable = exynos5_clk_audss_ctrl, + .ctrlbit = (3 << 2), + }, { + .name = "iis", .devname = "samsung-i2s.1", .enable = exynos5_clk_ip_peric_ctrl, .ctrlbit = (1 << 20), @@ -702,6 +718,11 @@ static struct clk exynos5_init_clocks_off[] = { .ctrlbit = (1 << 21), }, { .name = "pcm", + .devname = "samsung-pcm.0", + .enable = exynos5_clk_audss_ctrl, + .ctrlbit = (3 << 4), + }, { + .name = "pcm", .devname = "samsung-pcm.1", .enable = exynos5_clk_ip_peric_ctrl, .ctrlbit = (1 << 22), @@ -943,6 +964,95 @@ static struct clk exynos5_init_clocks_on[] = { } }; +static struct clk *clkset_sclk_audio0_list[] = { + [0] = NULL, + [1] = &clk_ext_xtal_mux, + [2] = &exynos5_clk_sclk_hdmi27m, + [3] = &exynos5_clk_sclk_dptxphy, + [4] = &exynos5_clk_sclk_usbphy, + [5] = &exynos5_clk_sclk_hdmiphy, + [6] = &exynos5_clk_mout_mpll.clk, + [7] = &exynos5_clk_mout_epll.clk, + [8] = &exynos5_clk_sclk_vpll.clk, + [9] = &exynos5_clk_mout_cpll.clk, +}; + +static struct clksrc_sources exynos5_clkset_sclk_audio0 = { + .sources = clkset_sclk_audio0_list, + .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list), +}; + +static struct clksrc_clk exynos5_clk_sclk_audio0 = { + .clk = { + .name = "sclk-audio0", + .enable = exynos5_clksrc_mask_maudio_ctrl, + .ctrlbit = (1 << 0), + }, + .sources = &exynos5_clkset_sclk_audio0, + .reg_src = { .reg = EXYNOS5_CLKSRC_MAUDIO, .shift = 0, .size = 4 }, + .reg_div = { .reg = EXYNOS5_CLKDIV_MAUDIO, .shift = 0, .size = 4 }, +}; + +static struct clk *exynos5_clkset_mout_audss_list[] = { + &clk_ext_xtal_mux, + &clk_fout_epll, +}; + +static struct clksrc_sources clkset_mout_audss = { + .sources = exynos5_clkset_mout_audss_list, + .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_audss_list), +}; + +static struct clksrc_clk exynos5_clk_mout_audss = { + .clk = { + .name = "mout_audss", + }, + .sources = &clkset_mout_audss, + .reg_src = { .reg = EXYNOS_CLKSRC_AUDSS, .shift = 0, .size = 1 }, +}; + +static struct clk *exynos5_clkset_sclk_i2s_list[] = { + [0] = &exynos5_clk_mout_audss.clk, + [1] = NULL, + [2] = &exynos5_clk_sclk_audio0.clk, +}; + +static struct clksrc_sources exynos5_clkset_sclk_i2s = { + .sources = exynos5_clkset_sclk_i2s_list, + .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_i2s_list), +}; + +static struct clksrc_clk exynos5_clk_sclk_i2s = { + .clk = { + .name = "sclk-i2s", + .devname = "samsung-i2s.0", + .enable = exynos5_clk_audss_ctrl, + .ctrlbit = (1 << 3), + }, + .sources = &exynos5_clkset_sclk_i2s, + .reg_src = { .reg = EXYNOS_CLKSRC_AUDSS, .shift = 2, .size = 2 }, + .reg_div = { .reg = EXYNOS_CLKDIV_AUDSS, .shift = 8, .size = 4 }, +}; + +static struct clksrc_clk exynos5_clk_dout_srp = { + .clk = { + .name = "dout_srp", + .parent = &exynos5_clk_mout_audss.clk, + }, + .reg_div = { .reg = EXYNOS_CLKDIV_AUDSS, .shift = 0, .size = 4 }, +}; + +static struct clksrc_clk exynos5_clk_i2s_bus = { + .clk = { + .name = "i2s-bus", + .devname = "samsung-i2s.0", + .parent = &exynos5_clk_dout_srp.clk, + .enable = exynos5_clk_audss_ctrl, + .ctrlbit = (1 << 2), + }, + .reg_div = { .reg = EXYNOS_CLKDIV_AUDSS, .shift = 4, .size = 4 }, +}; + static struct clk exynos5_clk_pdma0 = { .name = "dma", .devname = "dma-pl330.0", @@ -1327,6 +1437,9 @@ static struct clksrc_clk *exynos5_sysclks[] = { &exynos5_clk_mdout_spi1, &exynos5_clk_mdout_spi2, &exynos5_clk_sclk_fimd1, + &exynos5_clk_mout_audss, + &exynos5_clk_dout_srp, + &exynos5_clk_sclk_audio0, }; static struct clk *exynos5_clk_cdev[] = { @@ -1345,6 +1458,8 @@ static struct clksrc_clk *exynos5_clksrc_cdev[] = { &exynos5_clk_sclk_mmc1, &exynos5_clk_sclk_mmc2, &exynos5_clk_sclk_mmc3, + &exynos5_clk_i2s_bus, + &exynos5_clk_sclk_i2s, }; static struct clk_lookup exynos5_clk_lookup[] = { @@ -1363,6 +1478,8 @@ static struct clk_lookup exynos5_clk_lookup[] = { CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), CLKDEV_INIT("exynos5-fb.1", "lcd", &exynos5_clk_fimd1), + CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &exynos5_clk_sclk_i2s.clk), + CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &exynos5_clk_i2s_bus.clk), }; static unsigned long exynos5_epll_get_rate(struct clk *clk) diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 715b690..8369bd8 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -109,6 +109,11 @@ static struct map_desc exynos_iodesc[] __initdata = { .pfn = __phys_to_pfn(EXYNOS_PA_CHIPID), .length = SZ_4K, .type = MT_DEVICE, + }, { + .virtual = (unsigned long)S5P_VA_AUDSS, + .pfn = __phys_to_pfn(EXYNOS_PA_AUDSS), + .length = SZ_4K, + .type = MT_DEVICE, }, }; diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 792c0bd..ab11ba3 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -45,6 +45,7 @@ #define EXYNOS5_PA_I2S0 0x03830000 #define EXYNOS5_PA_I2S1 0x12D60000 #define EXYNOS5_PA_I2S2 0x12D70000 +#define EXYNOS_PA_AUDSS 0x03810000 #define EXYNOS4_PA_PCM0 0x03840000 #define EXYNOS4_PA_PCM1 0x13980000 diff --git a/arch/arm/mach-exynos/include/mach/regs-audss.h b/arch/arm/mach-exynos/include/mach/regs-audss.h index ca5a8b6..3b23b0d 100644 --- a/arch/arm/mach-exynos/include/mach/regs-audss.h +++ b/arch/arm/mach-exynos/include/mach/regs-audss.h @@ -3,7 +3,7 @@ * Copyright (c) 2011 Samsung Electronics * http://www.samsung.com * - * Exynos4 Audio SubSystem clock register definitions + * Exynos Audio SubSystem clock register definitions * * 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 @@ -15,4 +15,9 @@ #define EXYNOS4_AUDSS_INT_MEM (0x03000000) +#define EXYNOS_AUDSSREG(x) (S5P_VA_AUDSS + (x)) + +#define EXYNOS_CLKSRC_AUDSS EXYNOS_AUDSSREG(0x0) +#define EXYNOS_CLKDIV_AUDSS EXYNOS_AUDSSREG(0x4) +#define EXYNOS_CLKGATE_AUDSS EXYNOS_AUDSSREG(0x8) #endif /* _PLAT_REGS_AUDSS_H */ diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h index c2d7bda..038aa96 100644 --- a/arch/arm/plat-samsung/include/plat/map-s5p.h +++ b/arch/arm/plat-samsung/include/plat/map-s5p.h @@ -40,6 +40,8 @@ #define S5P_VA_GIC_CPU S3C_ADDR(0x02810000) #define S5P_VA_GIC_DIST S3C_ADDR(0x02820000) +#define S5P_VA_AUDSS S3C_ADDR(0x02830000) + #define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) #define VA_VIC0 VA_VIC(0) #define VA_VIC1 VA_VIC(1)