All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajeshwari Shinde <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
Subject: RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support
Date: Mon, 08 Aug 2011 14:17:56 +0530	[thread overview]
Message-ID: <1312793277-18689-7-git-send-email-rajeshwari.s@samsung.com> (raw)
In-Reply-To: <1312793277-18689-1-git-send-email-rajeshwari.s@samsung.com>

Bus clock alias names created and added to clkdev which will be used
by HSMMC driver.

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
 .../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 <plat/sdhci.h>
 
+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 <mach/s5p64x0-common-sdhci.h>
 
+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 <linux/clk.h>
+#include <linux/device.h>
+#include <linux/types.h>
+#include <linux/platform_device.h>
+
+#include <plat/sdhci.h>
+
+#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
-- 
1.7.4.4

WARNING: multiple messages have this Message-ID (diff)
From: rajeshwari.s@samsung.com (Rajeshwari Shinde)
To: linux-arm-kernel@lists.infradead.org
Subject: RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support
Date: Mon, 08 Aug 2011 14:17:56 +0530	[thread overview]
Message-ID: <1312793277-18689-7-git-send-email-rajeshwari.s@samsung.com> (raw)
In-Reply-To: <1312793277-18689-1-git-send-email-rajeshwari.s@samsung.com>

Bus clock alias names created and added to clkdev which will be used
by HSMMC driver.

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
 .../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 <plat/sdhci.h>
 
+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 <mach/s5p64x0-common-sdhci.h>
 
+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 <linux/clk.h>
+#include <linux/device.h>
+#include <linux/types.h>
+#include <linux/platform_device.h>
+
+#include <plat/sdhci.h>
+
+#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
-- 
1.7.4.4

  parent reply	other threads:[~2011-08-08  8:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08  8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev Rajeshwari Shinde
2011-08-08  8:47 ` Rajeshwari Shinde
2011-08-08  8:47 ` RFC[PATCH 1/6] SDHCI: S3C: Use bus clocks created " Rajeshwari Shinde
2011-08-08  8:47   ` Rajeshwari Shinde
2011-08-08  8:47 ` RFC[PATCH 2/6] ARM: S5P64X0: Enable SDHCI device Rajeshwari Shinde
2011-08-08  8:47   ` Rajeshwari Shinde
2011-08-08  8:47 ` RFC[PATCH 3/6] ARM: S5P64X0: Add pin-mux setup support for SDHCI Rajeshwari Shinde
2011-08-08  8:47   ` Rajeshwari Shinde
2011-08-09  6:02   ` Subash Patel
2011-08-09  6:02     ` Subash Patel
2011-08-08  8:47 ` RFC[PATCH 4/6] ARM: S5P64X0: Populate default platform data for SDHCI devices Rajeshwari Shinde
2011-08-08  8:47   ` Rajeshwari Shinde
2011-08-08  8:47 ` RFC[PATCH 5/6] ARM: S5P64X0: Enable SDHCI support Rajeshwari Shinde
2011-08-08  8:47   ` Rajeshwari Shinde
2011-08-08  8:47 ` Rajeshwari Shinde [this message]
2011-08-08  8:47   ` RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support Rajeshwari Shinde
2011-08-08 10:21   ` Sylwester Nawrocki
2011-08-08 10:21     ` Sylwester Nawrocki
2011-08-09  6:03     ` Subash Patel
2011-08-09  6:03       ` Subash Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312793277-18689-7-git-send-email-rajeshwari.s@samsung.com \
    --to=rajeshwari.s@samsung.com \
    --cc=ben-linux@fluff.org \
    --cc=cjb@laptop.org \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.