From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Rob Emanuele <rob@emanuele.us>, Andrew Victor <avictor.za@gmail.com>
Cc: haavard.skinnemoen@atmel.com,
linux-arm-kernel@lists.arm.linux.org.uk,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] atmel-mci: Platform configuration to the the atmel-mci driver
Date: Wed, 17 Jun 2009 12:27:39 +0200 [thread overview]
Message-ID: <4A38C51B.1070209@atmel.com> (raw)
In-Reply-To: <1245200079-6323-2-git-send-email-rob@emanuele.us>
Rob Emanuele :
> Created a modified version of the at91sam9g20 evaluation kit platform (board-sam9g20ek-2slot-mmc.c) and device support to make use of the updated atmel-mci driver.
>
> This patch shows how an AT91 developer could add support for both SD slots for their project.
Comment formated.
> This requires getting the most updated arch/arm/tools/mach-types from http://www.arm.linux.org.uk/developer/machines/download.php to have the machine type for the modified at91sam9g20ek.
Ok moved below "---"
> Signed-off-by: Rob Emanuele <rob@emanuele.us>
> ---
> arch/arm/mach-at91/Kconfig | 7 +
> arch/arm/mach-at91/Makefile | 1 +
> arch/arm/mach-at91/at91sam9260_devices.c | 95 ++++++++
> arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c | 277 ++++++++++++++++++++++++
> arch/arm/mach-at91/include/mach/board.h | 5 +
> 5 files changed, 385 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
>
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 323b47f..5c8d770 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -276,6 +276,13 @@ config MACH_AT91SAM9G20EK
> help
> Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit.
>
> +config MACH_AT91SAM9G20EK_2MMC
> + bool "Atmel AT91SAM9G20-EK Evaluation Kit modified for 2 MMC Slots"
> + depends on ARCH_AT91SAM9G20
> + help
> + Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
> + Rev A or B modified for 2 MMC Slots.
> +
> endif
>
> # ----------------------------------------------------------
> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
> index c69ff23..cdddba8 100644
> --- a/arch/arm/mach-at91/Makefile
> +++ b/arch/arm/mach-at91/Makefile
> @@ -54,6 +54,7 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
>
> # AT91SAM9G20 board-specific support
> obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
> +obj-$(CONFIG_MACH_AT91SAM9G20EK_2MMC) += board-sam9g20ek-2slot-mmc.o
>
> # AT91CAP9 board-specific support
> obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
> diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
> index d74c9ac..c372f4f 100644
> --- a/arch/arm/mach-at91/at91sam9260_devices.c
> +++ b/arch/arm/mach-at91/at91sam9260_devices.c
> @@ -278,6 +278,101 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
> void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
> #endif
>
> +/* --------------------------------------------------------------------
> + * MMC / SD Slot for Atmel MCI Driver
> + * -------------------------------------------------------------------- */
> +
> +#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
> +static u64 mmc_dmamask = DMA_BIT_MASK(32);
> +static struct mci_platform_data mmc_data;
> +
> +static struct resource mmc_resources[] = {
> + [0] = {
> + .start = AT91SAM9260_BASE_MCI,
> + .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = AT91SAM9260_ID_MCI,
> + .end = AT91SAM9260_ID_MCI,
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> +static struct platform_device at91sam9260_mmc_device = {
> + .name = "atmel_mci",
> + .id = -1,
> + .dev = {
> + .dma_mask = &mmc_dmamask,
> + .coherent_dma_mask = DMA_BIT_MASK(32),
> + .platform_data = &mmc_data,
> + },
> + .resource = mmc_resources,
> + .num_resources = ARRAY_SIZE(mmc_resources),
> +};
> +
> +void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
> +{
> + unsigned int i;
> + unsigned int slot_count = 0;
> +
> + if (!data)
> + return;
> +
> + for (i = 0; i < ATMEL_MCI_MAX_NR_SLOTS; i++) {
> + if (data->slot[i].bus_width) {
Indentation.
> + /* input/irq */
> + if (data->slot[i].detect_pin) {
> + at91_set_gpio_input(data->slot[i].detect_pin, 1);
> + at91_set_deglitch(data->slot[i].detect_pin, 1);
> + }
> + if (data->slot[i].wp_pin)
> + at91_set_gpio_input(data->slot[i].wp_pin, 1);
> +
> + switch(i) {
> + case 0:
> + /* CMD */
> + at91_set_A_periph(AT91_PIN_PA7, 1);
> + /* DAT0, maybe DAT1..DAT3 */
> + at91_set_A_periph(AT91_PIN_PA6, 1);
> + if (data->slot[i].bus_width == 4) {
> + at91_set_A_periph(AT91_PIN_PA9, 1);
> + at91_set_A_periph(AT91_PIN_PA10, 1);
> + at91_set_A_periph(AT91_PIN_PA11, 1);
> + }
I put slot_count here...
+ slot_count++;
> + break;
> + case 1:
> + /* CMD */
> + at91_set_B_periph(AT91_PIN_PA1, 1);
> + /* DAT0, maybe DAT1..DAT3 */
> + at91_set_B_periph(AT91_PIN_PA0, 1);
> + if (data->slot[i].bus_width == 4) {
> + at91_set_B_periph(AT91_PIN_PA5, 1);
> + at91_set_B_periph(AT91_PIN_PA4, 1);
> + at91_set_B_periph(AT91_PIN_PA3, 1);
> + }
and here...
+ slot_count++;
> + break;
> + default:
> + printk("Configuration Error, No MMC Port %d\n",i);
Replaced with:
printk(KERN_ERR
"AT91: SD/MMC slot %d not available\n", i);
> + break;
> + };
removed here.
> + slot_count++;
> + }
> + }
> +
> + if (slot_count) {
> + /* CLK */
> + at91_set_A_periph(AT91_PIN_PA8, 0);
> +
> + mmc_data = *data;
> + platform_device_register(&at91sam9260_mmc_device);
> + }
> +}
> +#else
> +void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
> +#endif
> +
> +
>
> /* --------------------------------------------------------------------
> * NAND / SmartMedia
> diff --git a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
> new file mode 100644
> index 0000000..a28e53f
> --- /dev/null
> +++ b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
Ok. True that it duplicates code but it is simpler.
It also can be a testbed for future -EK revision D and following.
[..]
> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
> index e6afff8..a635dad 100644
> --- a/arch/arm/mach-at91/include/mach/board.h
> +++ b/arch/arm/mach-at91/include/mach/board.h
> @@ -37,6 +37,7 @@
> #include <linux/leds.h>
> #include <linux/spi/spi.h>
> #include <linux/usb/atmel_usba_udc.h>
> +#include <linux/atmel-mci.h>
>
> /* USB Device */
> struct at91_udc_data {
> @@ -63,6 +64,7 @@ struct at91_cf_data {
> extern void __init at91_add_device_cf(struct at91_cf_data *data);
>
> /* MMC / SD */
> + /* at91_mci platform config */
> struct at91_mmc_data {
> u8 det_pin; /* card detect IRQ */
> unsigned slot_b:1; /* uses Slot B */
> @@ -72,6 +74,9 @@ struct at91_mmc_data {
> };
> extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
>
> + /* atmel-mci platform config */
> +extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
> +
> /* Ethernet (EMAC & MACB) */
> struct at91_eth_data {
> u32 phy_mask;
Ok.
I post the patch to Andrew Victor with the tiny
modifications above (your SOB & From: preserved of course).
Thanks, Bye,
--
Nicolas Ferre
next prev parent reply other threads:[~2009-06-17 10:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 0:54 [PATCH 1/6] atmel-mci: Unified Atmel MCI drivers (AVR32 & AT91) Rob Emanuele
2009-06-17 0:54 ` [PATCH 2/6] atmel-mci: Platform configuration to the the atmel-mci driver Rob Emanuele
2009-06-17 10:27 ` Nicolas Ferre [this message]
2009-06-18 19:58 ` Andrew Victor
2009-06-18 20:00 ` Andrew Victor
2009-06-17 0:54 ` [PATCH 3/6] atmel-mci: Optional controller reset before every command Rob Emanuele
2009-06-17 8:32 ` Marc Pignat
2009-06-17 18:27 ` Robert Emanuele
2009-06-17 0:54 ` [PATCH 4/6] atmel-mci: CLKDIV cap to restrict the MCI controller speed Rob Emanuele
2009-06-17 0:54 ` [PATCH 5/6] atmel-mci: Power control option for each MMC Slot Rob Emanuele
2009-06-17 8:08 ` Marc Pignat
2009-06-17 0:54 ` [PATCH 6/6] atmel-mci: Platform driver MMC slot power control Rob Emanuele
2009-06-17 1:23 ` Ryan Mallon
2009-06-17 9:56 ` [PATCH 1/6] atmel-mci: Unified Atmel MCI drivers (AVR32 & AT91) Nicolas Ferre
2009-06-17 10:08 ` Haavard Skinnemoen
2009-06-23 16:28 ` Nicolas Ferre
[not found] ` <95818a17c2b96d3769f4e1d3de26208647111758.1245778411.git.nicolas.ferre@atmel.com>
2009-06-23 17:39 ` [PATCH 1/2] " Nicolas Ferre
2009-09-02 7:31 ` Haavard Skinnemoen
[not found] ` <f8889fb59887a970581697beb313363a6a065606.1245778411.git.nicolas.ferre@atmel.com>
2009-06-23 17:39 ` [PATCH 2/2] AT91: atmel-mci: Platform configuration to the the atmel-mci driver Nicolas Ferre
2009-06-23 21:36 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-26 19:26 ` Robert Emanuele
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=4A38C51B.1070209@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=avictor.za@gmail.com \
--cc=haavard.skinnemoen@atmel.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rob@emanuele.us \
/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