All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: Thomas Abraham <thomas.ab@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH] S5P6440: Add support for SDHCI on SMDK6440 board.
Date: Tue, 4 May 2010 08:20:57 +0100	[thread overview]
Message-ID: <20100504072057.GG26401@trinity.fluff.org> (raw)
In-Reply-To: <1268141997-11015-1-git-send-email-thomas.ab@samsung.com>

On Tue, Mar 09, 2010 at 07:09:57PM +0530, Thomas Abraham wrote:
> This patch adds support for SDHCI interface on SMDK6440 board.
> 
> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
> ---
>  arch/arm/mach-s5p6440/mach-smdk6440.c |   69 +++++++++++++++++++++++++++++++++
>  1 files changed, 69 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-s5p6440/mach-smdk6440.c b/arch/arm/mach-s5p6440/mach-smdk6440.c
> index 3ae88f2..e039128 100644
> --- a/arch/arm/mach-s5p6440/mach-smdk6440.c
> +++ b/arch/arm/mach-s5p6440/mach-smdk6440.c
> @@ -20,6 +20,7 @@
>  #include <linux/io.h>
>  #include <linux/module.h>
>  #include <linux/clk.h>
> +#include <linux/irq.h>
>  
>  #include <asm/mach/arch.h>
>  #include <asm/mach/map.h>
> @@ -38,6 +39,12 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/pll.h>
> +#include <plat/sdhci.h>
> +#include <plat/s5p-clock.h>
> +
> +#include <mach/gpio.h>
> +#include <plat/gpio-core.h>
> +#include <plat/gpio-cfg.h>
>  
>  #define S5P6440_UCON_DEFAULT    (S3C2410_UCON_TXILEVEL |	\
>  				S3C2410_UCON_RXILEVEL |		\
> @@ -84,6 +91,10 @@ static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
>  };
>  
>  static struct platform_device *smdk6440_devices[] __initdata = {
> +#ifdef CONFIG_MMC_SDHCI_S3C
> +	&s3c_device_hsmmc0,
> +	&s3c_device_hsmmc1,
> +#endif
>  };
>  
>  static void __init smdk6440_map_io(void)
> @@ -93,9 +104,67 @@ static void __init smdk6440_map_io(void)
>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
>  }
>  
> +#ifdef CONFIG_MMC_SDHCI_S3C
> +static void smdk6440_sdhci0_cfg_ext_cd(void)
> +{
> +	s3c_gpio_cfgpin(S5P6440_GPN(8), S3C_GPIO_SFN(2));
> +	s3c_gpio_setpull(S5P6440_GPN(8), S3C_GPIO_PULL_NONE);
> +	set_irq_type(IRQ_EINT(8), IRQ_TYPE_EDGE_BOTH);
> +}

set_irq_type() is not recommended, please use the relevant flags
to request_irq().

> +static u32 smdk6440_sdhci0_card_detect(void)
> +{
> +	struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(S5P6440_GPN(8));
> +	struct gpio_chip *gc = &chip->chip;
> +	u32 present;
> +	int offset;
> +
> +	offset = S5P6440_GPN(8) - chip->chip.base;
> +	present = gc->get(gc, offset);
> +	return !present;
> +}

argh, much abuse of the gpio layer here.

gpio_get_value() is what you want here.


> +static void smdk6440_sdhci_setup_clocks(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct clk *parent;
> +
> +	parent = clk_get(NULL, "dout_mpll");
> +	if (IS_ERR(parent)) {
> +		dev_err(dev, "failed to get parent clock of mmc_bus clock\n");
> +		return;
> +	}
> +
> +	if (!s5p_setup_sdhci_sclk(pdev, parent))
> +		clk_put(parent);
> +}
> +
> +static void __init smdk6440_sdhci_setup_platdata(void)
> +{
> +	struct s3c_sdhci_platdata *pdata;
> +
> +	/* SDHCI Slot 0 platform data */
> +	/* SMDK6440 uses EINT(8) for SD/MMC card detection for slot 0 */
> +	pdata = &s3c_hsmmc0_def_platdata;
> +	pdata->cfg_ext_cd = smdk6440_sdhci0_cfg_ext_cd;
> +	pdata->is_card_present = smdk6440_sdhci0_card_detect;
> +	pdata->ext_cd = S5P_EINT(8);
> +	pdata->cfg_clocks = smdk6440_sdhci_setup_clocks;
> +	pdata->sclk_mmc_freq = 50 * MHZ;
> +
> +	/* SDHCI Slot 1 platform data */
> +	pdata = &s3c_hsmmc1_def_platdata;
> +	s3c_hsmmc1_def_platdata.cfg_clocks = smdk6440_sdhci_setup_clocks;
> +	s3c_hsmmc1_def_platdata.sclk_mmc_freq = 50 * MHZ;
> +}
> +#endif /* CONFIG_MMC_SDHCI_S3C */
> +
>  static void __init smdk6440_machine_init(void)
>  {
>  	platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
> +#ifdef CONFIG_MMC_SDHCI_S3C
> +	smdk6440_sdhci_setup_platdata();
> +#endif
>  }
>  
>  MACHINE_START(SMDK6440, "SMDK6440")
> -- 
> 1.6.6.rc2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

      reply	other threads:[~2010-05-04  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 13:39 [PATCH] S5P6440: Add support for SDHCI on SMDK6440 board Thomas Abraham
2010-05-04  7:20 ` Ben Dooks [this message]

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=20100504072057.GG26401@trinity.fluff.org \
    --to=ben-linux@fluff.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=thomas.ab@samsung.com \
    /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.