mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] tny-a9g20: add mmc spi support
Date: Tue, 13 Nov 2012 22:13:18 +0100	[thread overview]
Message-ID: <1352841198-22595-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1352841198-22595-1-git-send-email-plagnioj@jcrosoft.com>

on the 9g20 low power version we have a mmc spi as microSD

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/tny-a926x/init.c     |   41 ++++++++++++++++++++++++++++------
 arch/arm/configs/tny_a9g20_defconfig |    5 +++++
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boards/tny-a926x/init.c b/arch/arm/boards/tny-a926x/init.c
index ce36570..270becf 100644
--- a/arch/arm/boards/tny-a926x/init.c
+++ b/arch/arm/boards/tny-a926x/init.c
@@ -31,6 +31,7 @@
 #include <linux/clk.h>
 #include <mach/board.h>
 #include <mach/at91sam9_smc.h>
+#include <mach/at91sam9_sdramc.h>
 #include <mach/sam9_smc.h>
 #include <gpio.h>
 #include <mach/io.h>
@@ -151,12 +152,27 @@ static struct spi_board_info tny_a9g20_spi_devices[] = {
 	},
 };
 
+static struct spi_board_info tny_a9g20_lpw_spi_devices[] = {
+	{
+		.name = "spi_mci",
+		.max_speed_hz = 25 * 1000 * 1000,
+		.bus_num = 1,
+		.chip_select = 0,
+	},
+};
+
 static int spi0_standard_cs[] = { AT91_PIN_PC11 };
-struct at91_spi_platform_data spi_pdata = {
+struct at91_spi_platform_data spi0_pdata = {
 	.chipselect = spi0_standard_cs,
 	.num_chipselect = ARRAY_SIZE(spi0_standard_cs),
 };
 
+static int spi1_standard_cs[] = { AT91_PIN_PC3 };
+struct at91_spi_platform_data spi1_pdata = {
+	.chipselect = spi1_standard_cs,
+	.num_chipselect = ARRAY_SIZE(spi1_standard_cs),
+};
+
 static void __init ek_add_device_udc(void)
 {
 	if (machine_is_tny_a9260() || machine_is_tny_a9g20())
@@ -165,6 +181,22 @@ static void __init ek_add_device_udc(void)
 	at91_add_device_udc(&ek_udc_data);
 }
 
+static void __init ek_add_device_spi(void)
+{
+	if (machine_is_tny_a9263())
+		return;
+
+	if (machine_is_tny_a9g20() && at91_is_low_power_sdram()) {
+		spi_register_board_info(tny_a9g20_lpw_spi_devices,
+			ARRAY_SIZE(tny_a9g20_lpw_spi_devices));
+		at91_add_device_spi(1, &spi1_pdata);
+	} else {
+		spi_register_board_info(tny_a9g20_spi_devices,
+			ARRAY_SIZE(tny_a9g20_spi_devices));
+		at91_add_device_spi(0, &spi0_pdata);
+	}
+}
+
 static int tny_a9260_mem_init(void)
 {
 	at91_add_device_sdram(0);
@@ -178,16 +210,11 @@ static int tny_a9260_devices_init(void)
 	tny_a9260_add_device_nand();
 	ek_add_device_macb();
 	ek_add_device_udc();
+	ek_add_device_spi();
 
 	armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100));
 	tny_a9260_set_board_type();
 
-	if (machine_is_tny_a9260() || machine_is_tny_a9g20()) {
-		spi_register_board_info(tny_a9g20_spi_devices,
-			ARRAY_SIZE(tny_a9g20_spi_devices));
-		at91_add_device_spi(0, &spi_pdata);
-	}
-
 	devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
 	dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
 	devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
diff --git a/arch/arm/configs/tny_a9g20_defconfig b/arch/arm/configs/tny_a9g20_defconfig
index cf5d4c5..a84e90f 100644
--- a/arch/arm/configs/tny_a9g20_defconfig
+++ b/arch/arm/configs/tny_a9g20_defconfig
@@ -51,6 +51,7 @@ CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_SPI=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_NFS=y
@@ -70,4 +71,8 @@ CONFIG_NAND_ATMEL=y
 CONFIG_UBI=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_SERIAL=y
+CONFIG_MCI=y
+CONFIG_MCI_STARTUP=y
+CONFIG_MCI_SPI=y
+CONFIG_MMC_SPI_CRC_ON=y
 CONFIG_EEPROM_AT25=y
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2012-11-13 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 21:13 [PATCH 1/3] at91sam9: add detection of low power sdram Jean-Christophe PLAGNIOL-VILLARD
2012-11-13 21:13 ` [PATCH 2/3] usb-a9g20: add mmc spi support Jean-Christophe PLAGNIOL-VILLARD
2012-11-13 21:13 ` Jean-Christophe PLAGNIOL-VILLARD [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=1352841198-22595-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@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