* RFC[PATCH 1/6] SDHCI: S3C: Use bus clocks created using clkdev
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 2/6] ARM: S5P64X0: Enable SDHCI device Rajeshwari Shinde
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
This patch modifies the driver to stop depending on the clock names
being passed from the platform and switch over to lookup clocks generic
names created using clkdev.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
drivers/mmc/host/sdhci-s3c.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 69e3ee3..d07d774 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -426,14 +426,12 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
struct clk *clk;
- char *name = pdata->clocks[ptr];
+ char name[14];
- if (name == NULL)
- continue;
+ sprintf(name, "mmc_busclk.%d", ptr);
clk = clk_get(dev, name);
if (IS_ERR(clk)) {
- dev_err(dev, "failed to get clock %s\n", name);
continue;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 2/6] ARM: S5P64X0: Enable SDHCI device
2011-08-08 8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev 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 3/6] ARM: S5P64X0: Add pin-mux setup support for SDHCI Rajeshwari Shinde
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
Select HSMMC device for S5P6440 and S5P6450.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
arch/arm/mach-s5p64x0/Kconfig | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index 65c7518..bbc533e 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -26,6 +26,18 @@ config S5P64X0_SETUP_I2C1
help
Common setup code for i2c bus 1.
+config S5P64X0_SETUP_SDHCI
+ bool
+ select S5P64X0_SETUP_SDHCI_GPIO
+ help
+ Internal helper functions for S5P64X0 based SDHCI systems
+
+config S5P64X0_SETUP_SDHCI_GPIO
+ bool
+ help
+ Common setup code for SDHCI gpio.
+ Gpio values are machine specific.
+
# machine support
config MACH_SMDK6440
@@ -34,12 +46,16 @@ config MACH_SMDK6440
select S3C_DEV_I2C1
select S3C_DEV_RTC
select S3C_DEV_WDT
+ select S3C_DEV_HSMMC
+ select S3C_DEV_HSMMC1
+ select S3C_DEV_HSMMC2
select S3C64XX_DEV_SPI
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_PWM
select SAMSUNG_DEV_TS
select S5P64X0_SETUP_I2C1
+ select S5P64X0_SETUP_SDHCI
help
Machine support for the Samsung SMDK6440
@@ -49,13 +65,27 @@ config MACH_SMDK6450
select S3C_DEV_I2C1
select S3C_DEV_RTC
select S3C_DEV_WDT
+ select S3C_DEV_HSMMC
+ select S3C_DEV_HSMMC1
+ select S3C_DEV_HSMMC2
select S3C64XX_DEV_SPI
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_PWM
select SAMSUNG_DEV_TS
select S5P64X0_SETUP_I2C1
+ select S5P64X0_SETUP_SDHCI
help
Machine support for the Samsung SMDK6450
+menu "Use 8-bit SDHCI bus width"
+
+config S5P64X0_SD_CH1_8BIT
+ bool "SDHCI Channel 1 (Slot 1)"
+ depends on MACH_SMDK6450 || MACH_SMDK6440
+ help
+ Support SDHCI Channel 1 8-bit bus.
+
+endmenu
+
endif
--
1.7.4.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 3/6] ARM: S5P64X0: Add pin-mux setup support for SDHCI
2011-08-08 8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev Rajeshwari Shinde
2011-08-08 8:47 ` RFC[PATCH 1/6] SDHCI: S3C: Use bus clocks created " 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-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
` (2 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
This patch provides pin-mux setup files for HSMMC support on
S5P6440 and S5P6450 platforms.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
arch/arm/mach-s5p64x0/Makefile | 2 +
arch/arm/mach-s5p64x0/setup-sdhci-gpio.c | 109 ++++++++++++++++++++++++++++++
arch/arm/mach-s5p64x0/setup-sdhci.c | 46 +++++++++++++
3 files changed, 157 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
create mode 100644 arch/arm/mach-s5p64x0/setup-sdhci.c
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index 5f6afdf..6642448 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -28,3 +28,5 @@ obj-y += dev-audio.o
obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
+obj-$(CONFIG_S5P64X0_SETUP_SDHCI) += setup-sdhci.o
+obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
new file mode 100644
index 0000000..616b277
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
@@ -0,0 +1,109 @@
+/* linux/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * S5P64X0 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
+ *
+ * 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/platform_device.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include <mach/regs-gpio.h>
+#include <mach/regs-clock.h>
+
+#include <plat/gpio-cfg.h>
+#include <plat/sdhci.h>
+
+#define S5P6450_ID (0x50000)
+
+void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
+{
+ struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
+ unsigned int id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
+
+ /* Set all the necessary GPG pins to special-function 2 -
+ * CLK, CMD and Data pins
+ */
+ if (id == S5P6450_ID)
+ s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width,
+ S3C_GPIO_SFN(2));
+ else
+ s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width,
+ S3C_GPIO_SFN(2));
+
+ /* Set GPG[6] pin to special-function 2 - MMC0 CDn */
+ if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+ if (id == S5P6450_ID) {
+ s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
+ } else {
+ s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
+ }
+ }
+}
+
+void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
+{
+ struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
+ unsigned int id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
+
+ /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
+ if (id == S5P6450_ID)
+ s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
+ else
+ s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
+
+ switch (width) {
+ case 8:
+ /* Set data pins GPH[6:9] special-function 2 */
+ if (id == S5P6450_ID)
+ s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
+ S3C_GPIO_SFN(2));
+ else
+ s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
+ S3C_GPIO_SFN(2));
+ case 4:
+ /* set data pins GPH[2:5] special-function 2 */
+ if (id == S5P6450_ID)
+ s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
+ S3C_GPIO_SFN(2));
+ else
+ s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
+ S3C_GPIO_SFN(2));
+ default:
+ break;
+ }
+
+ /* Set GPG[6] pin to special-funtion 3 : MMC1 CDn */
+ if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+ if (id == S5P6450_ID) {
+ s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
+ } else {
+ s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
+ }
+ }
+}
+
+void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
+{
+ /* Set GPC[4:5] pins to special-function 3 - CLK and CMD */
+ s3c_gpio_cfgrange_nopull(S5P6440_GPC(4), 2, S3C_GPIO_SFN(3));
+
+ /* Set data pins GPH[6:9] pins to special-function 3 */
+ s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4, S3C_GPIO_SFN(3));
+}
+
+void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
+{
+ /* Set all the necessary GPG pins to special-function 3 */
+ s3c_gpio_cfgrange_nopull(S5P6450_GPG(7), 2 + width, S3C_GPIO_SFN(3));
+}
diff --git a/arch/arm/mach-s5p64x0/setup-sdhci.c b/arch/arm/mach-s5p64x0/setup-sdhci.c
new file mode 100644
index 0000000..4c64db6
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-sdhci.c
@@ -0,0 +1,46 @@
+/* linux/arch/arm/mach-s5p64x0/setup-sdhci.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * S5P64X0 - Helper functions for setting up SDHCI device(s) (HSMMC)
+ *
+ * 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/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
+
+#include <plat/regs-sdhci.h>
+#include <plat/sdhci.h>
+
+void s5p64x0_setup_sdhci_cfg_card(struct platform_device *dev,
+ void __iomem *r,
+ struct mmc_ios *ios,
+ struct mmc_card *card)
+{
+ u32 ctrl2;
+
+ /* don't need to alter anything acording to card-type */
+ __raw_writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,
+ r + S3C64XX_SDHCI_CONTROL4);
+
+ ctrl2 = __raw_readl(r + S3C_SDHCI_CONTROL2);
+ ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
+
+ ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
+ S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
+ S3C_SDHCI_CTRL2_DFCNT_NONE |
+ S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
+
+ __raw_writel(ctrl2, r + S3C_SDHCI_CONTROL2);
+ __raw_writel(0, r + S3C_SDHCI_CONTROL3);
+}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 3/6] ARM: S5P64X0: Add pin-mux setup support for SDHCI
2011-08-08 8:47 ` RFC[PATCH 3/6] ARM: S5P64X0: Add pin-mux setup support for SDHCI Rajeshwari Shinde
@ 2011-08-09 6:02 ` Subash Patel
0 siblings, 0 replies; 10+ messages in thread
From: Subash Patel @ 2011-08-09 6:02 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rajeshwari,
Please find my comments below:
On 08/08/2011 02:17 PM, Rajeshwari Shinde wrote:
> This patch provides pin-mux setup files for HSMMC support on
> S5P6440 and S5P6450 platforms.
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> ---
> arch/arm/mach-s5p64x0/Makefile | 2 +
> arch/arm/mach-s5p64x0/setup-sdhci-gpio.c | 109 ++++++++++++++++++++++++++++++
> arch/arm/mach-s5p64x0/setup-sdhci.c | 46 +++++++++++++
> 3 files changed, 157 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
> create mode 100644 arch/arm/mach-s5p64x0/setup-sdhci.c
>
> diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
> index 5f6afdf..6642448 100644
> --- a/arch/arm/mach-s5p64x0/Makefile
> +++ b/arch/arm/mach-s5p64x0/Makefile
> @@ -28,3 +28,5 @@ obj-y += dev-audio.o
> obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
>
> obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
> +obj-$(CONFIG_S5P64X0_SETUP_SDHCI) += setup-sdhci.o
> +obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
> diff --git a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
> new file mode 100644
> index 0000000..616b277
> --- /dev/null
> +++ b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
> @@ -0,0 +1,109 @@
> +/* linux/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
> + *
> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> + * http://www.samsung.com/
> + *
> + * S5P64X0 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
> + *
> + * 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/platform_device.h>
> +#include<linux/io.h>
> +#include<linux/gpio.h>
> +
> +#include<mach/regs-gpio.h>
> +#include<mach/regs-clock.h>
> +
> +#include<plat/gpio-cfg.h>
> +#include<plat/sdhci.h>
> +
> +#define S5P6450_ID (0x50000)
> +
> +void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
> +{
> + struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
You have used struct platform_device *pdev and struct platform_device
*dev alternatively in this patch series. Its better to maintain
consistency. As a practice pdev is used for struct platform_device and
dev is used for struct device for keeping code readable (else it is
confusing as one above)
> + unsigned int id = __raw_readl(S5P64X0_SYS_ID)& 0xFF000;
> +
proper indentation of code required.
> + /* Set all the necessary GPG pins to special-function 2 -
> + * CLK, CMD and Data pins
> + */
> + if (id == S5P6450_ID)
> + s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width,
> + S3C_GPIO_SFN(2));
> + else
> + s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width,
> + S3C_GPIO_SFN(2));
> +
> + /* Set GPG[6] pin to special-function 2 - MMC0 CDn */
> + if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
> + if (id == S5P6450_ID) {
> + s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
> + s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
> + } else {
> + s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
> + s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
> + }
> + }
> +}
> +
> +void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
> +{
> + struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
> + unsigned int id = __raw_readl(S5P64X0_SYS_ID)& 0xFF000;
indentation between &
> +
> + /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
> + if (id == S5P6450_ID)
> + s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
> + else
> + s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
> +
> + switch (width) {
> + case 8:
> + /* Set data pins GPH[6:9] special-function 2 */
> + if (id == S5P6450_ID)
> + s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
> + S3C_GPIO_SFN(2));
> + else
> + s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
> + S3C_GPIO_SFN(2));
> + case 4:
> + /* set data pins GPH[2:5] special-function 2 */
> + if (id == S5P6450_ID)
> + s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
> + S3C_GPIO_SFN(2));
> + else
> + s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
> + S3C_GPIO_SFN(2));
> + default:
> + break;
> + }
> +
> + /* Set GPG[6] pin to special-funtion 3 : MMC1 CDn */
> + if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
> + if (id == S5P6450_ID) {
> + s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
> + s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
> + } else {
> + s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
> + s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
> + }
> + }
> +}
> +
> +void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
> +{
> + /* Set GPC[4:5] pins to special-function 3 - CLK and CMD */
> + s3c_gpio_cfgrange_nopull(S5P6440_GPC(4), 2, S3C_GPIO_SFN(3));
> +
> + /* Set data pins GPH[6:9] pins to special-function 3 */
> + s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4, S3C_GPIO_SFN(3));
> +}
> +
> +void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
> +{
> + /* Set all the necessary GPG pins to special-function 3 */
> + s3c_gpio_cfgrange_nopull(S5P6450_GPG(7), 2 + width, S3C_GPIO_SFN(3));
> +}
> diff --git a/arch/arm/mach-s5p64x0/setup-sdhci.c b/arch/arm/mach-s5p64x0/setup-sdhci.c
> new file mode 100644
> index 0000000..4c64db6
> --- /dev/null
> +++ b/arch/arm/mach-s5p64x0/setup-sdhci.c
> @@ -0,0 +1,46 @@
> +/* linux/arch/arm/mach-s5p64x0/setup-sdhci.c
> + *
> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> + * http://www.samsung.com/
> + *
> + * S5P64X0 - Helper functions for setting up SDHCI device(s) (HSMMC)
> + *
> + * 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/kernel.h>
> +#include<linux/types.h>
> +#include<linux/interrupt.h>
> +#include<linux/platform_device.h>
> +#include<linux/io.h>
> +
> +#include<linux/mmc/card.h>
> +#include<linux/mmc/host.h>
> +
> +#include<plat/regs-sdhci.h>
> +#include<plat/sdhci.h>
> +
> +void s5p64x0_setup_sdhci_cfg_card(struct platform_device *dev,
> + void __iomem *r,
> + struct mmc_ios *ios,
> + struct mmc_card *card)
> +{
> + u32 ctrl2;
> +
> + /* don't need to alter anything acording to card-type */
Should the comment be -> "no need to alter anything according to card
type" instead?
> + __raw_writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,
> + r + S3C64XX_SDHCI_CONTROL4);
> +
> + ctrl2 = __raw_readl(r + S3C_SDHCI_CONTROL2);
> + ctrl2&= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
ctrl &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
> +
> + ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
> + S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
> + S3C_SDHCI_CTRL2_DFCNT_NONE |
> + S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
> +
> + __raw_writel(ctrl2, r + S3C_SDHCI_CONTROL2);
> + __raw_writel(0, r + S3C_SDHCI_CONTROL3);
> +}
Regards,
Subash
^ permalink raw reply [flat|nested] 10+ messages in thread
* RFC[PATCH 4/6] ARM: S5P64X0: Populate default platform data for SDHCI devices
2011-08-08 8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev Rajeshwari Shinde
` (2 preceding siblings ...)
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-08 8:47 ` RFC[PATCH 5/6] ARM: S5P64X0: Enable SDHCI support Rajeshwari Shinde
2011-08-08 8:47 ` RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support Rajeshwari Shinde
5 siblings, 0 replies; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
This patch populates the default platform data required by
SDHCI devices for S5P6440 and S5P6450.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
arch/arm/mach-s5p64x0/cpu.c | 9 +++++
arch/arm/plat-samsung/include/plat/sdhci.h | 50 ++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
index a5c0095..1b2063c 100644
--- a/arch/arm/mach-s5p64x0/cpu.c
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -38,6 +38,7 @@
#include <plat/s5p6440.h>
#include <plat/s5p6450.h>
#include <plat/adc-core.h>
+#include <plat/sdhci.h>
/* Initial IO mappings */
@@ -109,6 +110,10 @@ void __init s5p6440_map_io(void)
/* initialize any device information early */
s3c_adc_setname("s3c64xx-adc");
+ s5p64x0_default_sdhci0();
+ s5p64x0_default_sdhci1();
+ s5p6440_default_sdhci2();
+
iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
}
@@ -118,6 +123,10 @@ void __init s5p6450_map_io(void)
/* initialize any device information early */
s3c_adc_setname("s3c64xx-adc");
+ s5p64x0_default_sdhci0();
+ s5p64x0_default_sdhci1();
+ s5p6450_default_sdhci2();
+
iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
}
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 058e096..dde13aa 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -126,6 +126,10 @@ extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
+extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
+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);
/* S3C2416 SDHCI setup */
@@ -390,4 +394,50 @@ static inline void exynos4_default_sdhci3(void) { }
#endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
+/* S5P64X0 SDHCI setup */
+#ifdef CONFIG_S5P64X0_SETUP_SDHCI
+extern void s5p64x0_setup_sdhci_cfg_card(struct platform_device *dev,
+ void __iomem *r,
+ struct mmc_ios *ios,
+ struct mmc_card *card);
+
+static inline void s5p64x0_default_sdhci0(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC
+ s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
+ s3c_hsmmc0_def_platdata.cfg_card = s5p64x0_setup_sdhci_cfg_card;
+#endif /* CONFIG_S3C_DEV_HSMMC */
+}
+
+static inline void s5p64x0_default_sdhci1(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC1
+ s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
+ s3c_hsmmc1_def_platdata.cfg_card = s5p64x0_setup_sdhci_cfg_card;
+#endif /* CONFIG_S3C_DEV_HSMMC1 */
+}
+
+static inline void s5p6440_default_sdhci2(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC2
+ s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s5p64x0_setup_sdhci_cfg_card;
+#endif /* CONFIG_S3C_DEV_HSMMC2 */
+}
+
+static inline void s5p6450_default_sdhci2(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC2
+ s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s5p64x0_setup_sdhci_cfg_card;
+#endif /* CONFIG_S3C_DEV_HSMMC2 */
+}
+
+#else
+static inline void s5p64x0_default_sdhci0(void) { }
+static inline void s5p64x0_default_sdhci1(void) { }
+static inline void s5p6440_default_sdhci2(void) { }
+static inline void s5p6450_default_sdhci2(void) { }
+#endif /* CONFIG_S5P64X0_SETUP_SDHCI */
+
#endif /* __PLAT_S3C_SDHCI_H */
--
1.7.4.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 5/6] ARM: S5P64X0: Enable SDHCI support
2011-08-08 8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev Rajeshwari Shinde
` (3 preceding siblings ...)
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 6/6] ARM: S5P64X0: Add clkdev bus lookup support Rajeshwari Shinde
5 siblings, 0 replies; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
This patch initializes default sdhci devices and platform
data for SMDK6440 and SMDK6450.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
arch/arm/mach-s5p64x0/Makefile | 2 +-
.../include/mach/s5p64x0-common-sdhci.h | 15 +++++++++
arch/arm/mach-s5p64x0/mach-smdk6440.c | 10 ++++++
arch/arm/mach-s5p64x0/mach-smdk6450.c | 10 ++++++
arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c | 34 ++++++++++++++++++++
5 files changed, 70 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h
create mode 100644 arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index 6642448..e8dd7c6 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -28,5 +28,5 @@ obj-y += dev-audio.o
obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
-obj-$(CONFIG_S5P64X0_SETUP_SDHCI) += setup-sdhci.o
+obj-$(CONFIG_S5P64X0_SETUP_SDHCI) += setup-sdhci.o s5p64x0-common-sdhci.o
obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h
new file mode 100644
index 0000000..a3381f0
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h
@@ -0,0 +1,15 @@
+/* linux/arch/arm/mach-s5p64x0/include/mach/s5p64x0-common-sdhci.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.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 <plat/sdhci.h>
+
+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 346f8df..065977f 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -23,6 +23,7 @@
#include <linux/clk.h>
#include <linux/gpio.h>
#include <linux/pwm_backlight.h>
+#include <linux/mmc/host.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -34,6 +35,7 @@
#include <mach/regs-clock.h>
#include <mach/i2c.h>
#include <mach/regs-gpio.h>
+#include <mach/s5p64x0-common-sdhci.h>
#include <plat/regs-serial.h>
#include <plat/gpio-cfg.h>
@@ -47,6 +49,7 @@
#include <plat/ts.h>
#include <plat/s5p-time.h>
#include <plat/backlight.h>
+#include <plat/sdhci.h>
#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
@@ -101,6 +104,9 @@ static struct platform_device *smdk6440_devices[] __initdata = {
&s3c_device_wdt,
&samsung_asoc_dma,
&s5p6440_device_iis,
+ &s3c_device_hsmmc0,
+ &s3c_device_hsmmc1,
+ &s3c_device_hsmmc2,
};
static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
@@ -166,6 +172,10 @@ static void __init smdk6440_machine_init(void)
samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
+ s3c_sdhci0_set_platdata(&smdk64x0_hsmmc0_pdata);
+ s3c_sdhci1_set_platdata(&smdk64x0_hsmmc1_pdata);
+ s3c_sdhci2_set_platdata(&smdk64x0_hsmmc2_pdata);
+
platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
}
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 33f2adf..9e6fcef 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -23,6 +23,7 @@
#include <linux/clk.h>
#include <linux/gpio.h>
#include <linux/pwm_backlight.h>
+#include <linux/mmc/host.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -34,6 +35,7 @@
#include <mach/regs-clock.h>
#include <mach/i2c.h>
#include <mach/regs-gpio.h>
+#include <mach/s5p64x0-common-sdhci.h>
#include <plat/regs-serial.h>
#include <plat/gpio-cfg.h>
@@ -47,6 +49,7 @@
#include <plat/ts.h>
#include <plat/s5p-time.h>
#include <plat/backlight.h>
+#include <plat/sdhci.h>
#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
@@ -119,6 +122,9 @@ static struct platform_device *smdk6450_devices[] __initdata = {
&s3c_device_wdt,
&samsung_asoc_dma,
&s5p6450_device_iis0,
+ &s3c_device_hsmmc0,
+ &s3c_device_hsmmc1,
+ &s3c_device_hsmmc2,
/* s5p6450_device_spi0 will be added */
};
@@ -185,6 +191,10 @@ static void __init smdk6450_machine_init(void)
samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
+ s3c_sdhci0_set_platdata(&smdk64x0_hsmmc0_pdata);
+ s3c_sdhci1_set_platdata(&smdk64x0_hsmmc1_pdata);
+ s3c_sdhci2_set_platdata(&smdk64x0_hsmmc2_pdata);
+
platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
}
diff --git a/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c b/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c
new file mode 100644
index 0000000..03d89f6
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c
@@ -0,0 +1,34 @@
+/* linux/arch/arm/mach-s5p64x0/s5p64x0-common-sdhci.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.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/init.h>
+#include <linux/mmc/host.h>
+#include <linux/types.h>
+
+#include <mach/s5p64x0-common-sdhci.h>
+
+struct s3c_sdhci_platdata smdk64x0_hsmmc0_pdata __initdata = {
+ .cd_type = S3C_SDHCI_CD_NONE,
+ .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
+};
+
+struct s3c_sdhci_platdata smdk64x0_hsmmc1_pdata __initdata = {
+ .cd_type = S3C_SDHCI_CD_NONE,
+#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
+ .max_width = 8,
+ .host_caps = MMC_CAP_8_BIT_DATA,
+#endif
+ .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
+};
+
+struct s3c_sdhci_platdata smdk64x0_hsmmc2_pdata __initdata = {
+ .cd_type = S3C_SDHCI_CD_NONE,
+ .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
+};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support
2011-08-08 8:47 RFC[PATCH 0/6] ARM: S5P64X0: Add SDHCI support using clkdev Rajeshwari Shinde
` (4 preceding siblings ...)
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 10:21 ` Sylwester Nawrocki
5 siblings, 1 reply; 10+ messages in thread
From: Rajeshwari Shinde @ 2011-08-08 8:47 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 10+ messages in thread* RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support
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-09 6:03 ` Subash Patel
0 siblings, 1 reply; 10+ messages in thread
From: Sylwester Nawrocki @ 2011-08-08 10:21 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On 08/08/2011 10:47 AM, Rajeshwari Shinde wrote:
> 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
Is this a correct copyright notice?
> + *
> + * 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!");
> +}
Can you explain why these aliases are needed ?
That seems redundant to me, as the clock 'con_id's could be properly created
right away when registering the clock with clkdev.
> 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
--
Sylwester Nawrocki
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 10+ messages in thread* RFC[PATCH 6/6] ARM: S5P64X0: Add clkdev bus lookup support
2011-08-08 10:21 ` Sylwester Nawrocki
@ 2011-08-09 6:03 ` Subash Patel
0 siblings, 0 replies; 10+ messages in thread
From: Subash Patel @ 2011-08-09 6:03 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On 08/08/2011 03:51 PM, Sylwester Nawrocki wrote:
> Hello,
>
> On 08/08/2011 10:47 AM, Rajeshwari Shinde wrote:
>> 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,
>> +};
Good to use MAX_BUS_CLK instead of 4.
>> +
>> 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
>
> Is this a correct copyright notice?
>
>> + *
>> + * 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)
This macro is already defined in drivers/mmc/host/sdhci-s3c.c. Instead
of redefining it in different places, cant it be moved to some better
location?
>> +
>> +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!");
>> +}
>
>
> Can you explain why these aliases are needed ?
> That seems redundant to me, as the clock 'con_id's could be properly created
> right away when registering the clock with clkdev.
>
I think this aliased name is being used in other place (ref patch 1 in
this series).
>
>> 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
>
Regards,
Subash
^ permalink raw reply [flat|nested] 10+ messages in thread