linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ben-linux@fluff.org (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] s5pv210: Aquila: add definitions for sdhci devices
Date: Fri, 11 Jun 2010 06:18:25 +0100	[thread overview]
Message-ID: <20100611051825.GW7248@trinity.fluff.org> (raw)
In-Reply-To: <1276076345-24370-4-git-send-email-m.szyprowski@samsung.com>

On Wed, Jun 09, 2010 at 11:39:05AM +0200, Marek Szyprowski wrote:
> This patch add support for SDHCI blocks on Samsung Aquila board. The
> following host controllers are defined:
> 1. Internal MoviNAND device (permanently wired to the controller)
> 2. Internal WiFI SDIO device (card is activated by power regualor)
> 3. External MMC/SD socket (card detection is provided by external
> gpio interrupt)
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-s5pv210/Kconfig       |    4 ++
>  arch/arm/mach-s5pv210/mach-aquila.c |   66 +++++++++++++++++++++++++++++++++++
>  2 files changed, 70 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
> index b7a2f38..dcc9d74 100644
> --- a/arch/arm/mach-s5pv210/Kconfig
> +++ b/arch/arm/mach-s5pv210/Kconfig
> @@ -57,7 +57,11 @@ config MACH_AQUILA
>  	select CPU_S5PV210
>  	select ARCH_SPARSEMEM_ENABLE
>  	select S5PV210_SETUP_FB_24BPP
> +	select S5PV210_SETUP_SDHCI
>  	select S3C_DEV_FB
> +	select S3C_DEV_HSMMC
> +	select S3C_DEV_HSMMC1
> +	select S3C_DEV_HSMMC2
>  	select S5PC110_DEV_ONENAND
>  	help
>  	  Machine support for the Samsung Aquila target based on S5PC110 SoC
> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
> index fb9dbb2..1b7fe79 100644
> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> @@ -13,6 +13,7 @@
>  #include <linux/init.h>
>  #include <linux/serial_core.h>
>  #include <linux/fb.h>
> +#include <linux/gpio.h>
>  
>  #include <asm/mach/arch.h>
>  #include <asm/mach/map.h>
> @@ -22,12 +23,15 @@
>  #include <mach/map.h>
>  #include <mach/regs-clock.h>
>  #include <mach/regs-fb.h>
> +#include <mach/regs-gpio.h>
>  
>  #include <plat/regs-serial.h>
>  #include <plat/s5pv210.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/fb.h>
> +#include <plat/gpio-cfg.h>
> +#include <plat/sdhci.h>
>  
>  /* Following are default values for UCON, ULCON and UFCON UART registers */
>  #define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
> @@ -116,9 +120,66 @@ static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
>  	.setup_gpio	= s5pv210_fb_gpio_setup_24bpp,
>  };
>  
> +/* MoviNAND */
> +static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
> +	.max_width		= 4,
> +	.cd_type		= S3C_SDHCI_CD_PERMANENT,
> +};
> +
> +/* Wireless LAN */
> +static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
> +	.max_width		= 4,
> +	.cd_type		= S3C_SDHCI_CD_EXTERNAL,
> +	/* ext_cd_{init,cleanup} callbacks will be added later */
> +};
> +
> +/* External Flash */
> +#define AQUILA_EXT_FLASH_IRQ	IRQ_EINT(28)	/* S5PV210_GPH3(4) */
> +#define AQUILA_EXT_FLASH_EN	S5PV210_MP05(4)
> +#define AQUILA_EXT_FLASH_CD	S5PV210_GPH3(4)
> +
> +static irqreturn_t aquila_ext_flash_card_detect_isr(int irq, void *dev_id)
> +{
> +	void (*notify_func)(struct platform_device *, int state) = dev_id;
> +	notify_func(&s3c_device_hsmmc2, !gpio_get_value(AQUILA_EXT_FLASH_CD));
> +	return IRQ_HANDLED;
> +}

hmm, not very nice this.

I'd much prefer to see a gpio-based handler in either the sdhci core or
at-least in the driver's directory since I'm sure that his is (a) something
Thomas Abrahama has already published patches for (which do need work) and
(b) probably going to be needed by other boards and/or other architectures.

> +static int aquila_ext_flash_card_detect_init(
> +		void (*notify_func)(struct platform_device *, int state))
> +{
> +	gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
> +	gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
> +
> +	if (request_irq(AQUILA_EXT_FLASH_IRQ, aquila_ext_flash_card_detect_isr,
> +				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> +				"SDHCI card detect", notify_func))
> +		printk(KERN_ERR "Error: cannot request irq for External Flash\n");
> +	return 0;
> +}
> +
> +static int aquila_ext_flash_card_detect_cleanup(
> +		void (*notify_func)(struct platform_device *, int state))
> +{
> +	free_irq(AQUILA_EXT_FLASH_IRQ, notify_func);
> +	gpio_direction_output(AQUILA_EXT_FLASH_EN, 0);
> +	gpio_free(AQUILA_EXT_FLASH_EN);
> +	return 0;
> +}
> +
> +static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
> +	.max_width		= 4,
> +	.cd_type		= S3C_SDHCI_CD_EXTERNAL,
> +	.ext_cd_init		= aquila_ext_flash_card_detect_init,
> +	.ext_cd_cleanup		= aquila_ext_flash_card_detect_cleanup,
> +};
> +
>  static struct platform_device *aquila_devices[] __initdata = {
>  	&s3c_device_fb,
>  	&s5pc110_device_onenand,
> +	&s3c_device_hsmmc0,
> +	&s3c_device_hsmmc1,
> +	&s3c_device_hsmmc2,
>  };
>  
>  static void __init aquila_map_io(void)
> @@ -130,6 +191,11 @@ static void __init aquila_map_io(void)
>  
>  static void __init aquila_machine_init(void)
>  {
> +	/* SDHCI */
> +	s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
> +	s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
> +	s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
> +
>  	/* FB */
>  	s3c_fb_set_platdata(&aquila_lcd_pdata);
>  
> -- 
> 1.7.1.240.g225c
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
-- 
Ben

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

  reply	other threads:[~2010-06-11  5:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  9:39 [PATCH] SDHCI-S3C fixes and enhancements (platform specific code) Marek Szyprowski
2010-06-09  9:39 ` [PATCH 1/3] s3c64xx: Fix build without SDHCI controllers Marek Szyprowski
2010-06-11  0:56   ` Kukjin Kim
2010-06-11  3:30     ` Kyungmin Park
2010-06-11  3:58       ` Kukjin Kim
2010-06-11  4:34         ` Kyungmin Park
2010-06-11  6:26           ` Kukjin Kim
2010-06-11  5:59     ` [PATCH v2] " Marek Szyprowski
2010-06-22 12:29       ` Kukjin Kim
2010-06-09  9:39 ` [PATCH 2/3] Samsung: sdhci-s3c: add support for new card detection methods Marek Szyprowski
2010-06-09  9:39 ` [PATCH 3/3] s5pv210: Aquila: add definitions for sdhci devices Marek Szyprowski
2010-06-11  5:18   ` Ben Dooks [this message]
2010-06-11  5:29     ` Marek Szyprowski
2010-06-11  6:05     ` Kyungmin Park

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=20100611051825.GW7248@trinity.fluff.org \
    --to=ben-linux@fluff.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).