From patchwork Mon Aug 8 08:47:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 1043322 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p788q3Zk005060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 8 Aug 2011 08:52:24 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QqLYt-0008A2-C2; Mon, 08 Aug 2011 08:51:52 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QqLYs-0002bi-0V; Mon, 08 Aug 2011 08:51:50 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QqLXb-0002FG-N8 for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2011 08:50:33 +0000 Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LPL00AWCPUNLPT0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2011 17:49:56 +0900 (KST) X-AuditID: cbfee61b-b7c3dae000002cb8-8a-4e3fa3347ad6 Received: from epmmp1 ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id C9.45.11448.433AF3E4; Mon, 08 Aug 2011 17:49:56 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LPL00BGTPUTHJ@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2011 17:49:56 +0900 (KST) Date: Mon, 08 Aug 2011 14:17:56 +0530 From: Rajeshwari Shinde Subject: RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support In-reply-to: <1312793277-18689-1-git-send-email-rajeshwari.s@samsung.com> To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, cjb@laptop.org, ben-linux@fluff.org Message-id: <1312793277-18689-7-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 References: <1312793277-18689-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110808_045032_211606_13F36F50 X-CRM114-Status: GOOD ( 23.12 ) X-Spam-Score: -3.1 (---) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-3.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [203.254.224.34 listed in list.dnswl.org] -0.8 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 08 Aug 2011 08:52:24 +0000 (UTC) Bus clock alias names created and added to clkdev which will be used by HSMMC driver. Signed-off-by: Rajeshwari Shinde --- .../include/mach/s5p64x0-common-sdhci.h | 2 + arch/arm/mach-s5p64x0/mach-smdk6440.c | 5 ++ arch/arm/mach-s5p64x0/mach-smdk6450.c | 5 ++ arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c | 7 +++ arch/arm/plat-samsung/Makefile | 1 + arch/arm/plat-samsung/clkdev-busalias.c | 44 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/sdhci.h | 8 ++++ 7 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-samsung/clkdev-busalias.c diff --git a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h index a3381f0..b81e6dd 100644 --- a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h +++ b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h @@ -10,6 +10,8 @@ #include +extern char *hsmmc_busclksrcs[4]; + extern struct s3c_sdhci_platdata smdk64x0_hsmmc0_pdata; extern struct s3c_sdhci_platdata smdk64x0_hsmmc1_pdata; extern struct s3c_sdhci_platdata smdk64x0_hsmmc2_pdata; diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 065977f..ad1b49d 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c @@ -177,6 +177,11 @@ static void __init smdk6440_machine_init(void) s3c_sdhci2_set_platdata(&smdk64x0_hsmmc2_pdata); platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices)); + + /* create alias for clocks required by SDHCI */ + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc0, hsmmc_busclksrcs); + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc1, hsmmc_busclksrcs); + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc2, hsmmc_busclksrcs); } MACHINE_START(SMDK6440, "SMDK6440") diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 9e6fcef..f3f656e 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c @@ -196,6 +196,11 @@ static void __init smdk6450_machine_init(void) s3c_sdhci2_set_platdata(&smdk64x0_hsmmc2_pdata); platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices)); + + /* create alias for clocks required by SDHCI */ + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc0, hsmmc_busclksrcs); + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc1, hsmmc_busclksrcs); + s3c_sdhci_add_busclk_alias(&s3c_device_hsmmc2, hsmmc_busclksrcs); } MACHINE_START(SMDK6450, "SMDK6450") diff --git a/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c b/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c index 03d89f6..9721b2d 100644 --- a/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c +++ b/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c @@ -14,6 +14,13 @@ #include +char *hsmmc_busclksrcs[4] = { + [0] = NULL, + [1] = NULL, + [2] = "sclk_mmc", /* mmc bus clock */ + [3] = NULL, +}; + struct s3c_sdhci_platdata smdk64x0_hsmmc0_pdata __initdata = { .cd_type = S3C_SDHCI_CD_NONE, .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 853764b..0aae4fa 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_S3C_ADC) += adc.o # devices obj-y += platformdata.o +obj-y += clkdev-busalias.o obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o diff --git a/arch/arm/plat-samsung/clkdev-busalias.c b/arch/arm/plat-samsung/clkdev-busalias.c new file mode 100644 index 0000000..3e085a2 --- /dev/null +++ b/arch/arm/plat-samsung/clkdev-busalias.c @@ -0,0 +1,44 @@ +/* linux/arch/arm/plat-samsung/clkdev_busalias.c + * + * Copyright (c) 2011 Simtec Electronics + * http://www.samsung.com + * + * Helper function to add clkdev bus clocks alias names. + * + * 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 + +#define MAX_BUS_CLK (4) + +void s3c_sdhci_add_busclk_alias(struct platform_device *pdev, + char **mmc_busclks) +{ + int clk_cnt = 0, ptr; + char devname[14]; + + sprintf(devname, "s3c-sdhci.%d", pdev->id); + + for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { + char *bus_name = mmc_busclks[ptr]; + + if (bus_name != NULL) { + char name[14]; + sprintf(name, "mmc_busclk.%d", ptr); + clk_add_alias(name, devname, bus_name, + &pdev->dev); + clk_cnt++; + } + } + + if (clk_cnt == 0) + dev_err(&pdev->dev, "No MMC bus clocks!"); +} diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h index dde13aa..4933b6a 100644 --- a/arch/arm/plat-samsung/include/plat/sdhci.h +++ b/arch/arm/plat-samsung/include/plat/sdhci.h @@ -131,6 +131,14 @@ extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w); extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w); extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w); +/* + * s3c_sdhci_set_busclk - Add alias to bus clocks supported, for clkdev support. + * @pdev: platform device to which the busclks are to be initialised. + * @mmc_busclks: Bus clocks suppored by SDHCI +*/ +extern void s3c_sdhci_add_busclk_alias(struct platform_device *pdev, + char **mmc_busclks); + /* S3C2416 SDHCI setup */ #ifdef CONFIG_S3C2416_SETUP_SDHCI