Skip to contentSkip to conversation

at91sam9x5ek: add spi and mci support

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 1 participant 6 messages Nov 3, 2012 – Nov 15, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover at91sam9x5ek: add spi and mci support

HI,
v3: rebase on the v3 of at91sam9xek i2c support

with this +1 patch serie the support of the at91sam9x5ek is mostly complete

This will add spi and mci0 support as spi0 and mci0 conflict

We are still missing framebuffer, usb host and device and hardware i2c support but this wil be added later

This patch serie depedsn on the at91sam9x5ek i2c and m25p80 patcheries

the correct version

this one work but brake the etherent as it mux the 4 cs as gpio and we use them on the eth0

The following changes since commit b3a0963d358e14180e9bbde68ab78fdebae071b7:

m25p80: sync flash support with the kernel (2012-11-03 04:23:15 +0800)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git delivery/at91sam9x5ek_mci_spi

for you to fetch changes up to dc7e1ce2a4ca879d07ba5786cfaa84f54d2ee763:

at91sam9x5ek: add mci support (2012-11-03 04:23:48 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (4):
at91sam9x5: add spi support
at91sam9x5ek: add spi support
at91sam9x5: add mci support
at91sam9x5ek: add mci support

 arch/arm/boards/at91sam9x5ek/init.c     |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |   10 +++++++---
 arch/arm/mach-at91/at91sam9x5.c         |    4 ++++
 arch/arm/mach-at91/at91sam9x5_devices.c |  124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 3 deletions(-)

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH v3 1/4 at91sam9x5: add spi support

---
 arch/arm/mach-at91/at91sam9x5.c         |    2 +
 arch/arm/mach-at91/at91sam9x5_devices.c |   62 +++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
arch/arm/mach-at91/at91sam9x5.c +2 -0
index c256989..a9065ff 100644
@@ -205,6 +205,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("macb_clk", "macb0", &macb0_clk),
 	CLKDEV_CON_DEV_ID("macb_clk", "macb1", &macb1_clk),
 	CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
+	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
+	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi1", &spi1_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9x5_devices.c +62 -0

68 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v3 2/4 at91sam9x5ek: add spi support

on all the cpu module we have a at25 except on the cogent where we have a at45

---
 arch/arm/boards/at91sam9x5ek/init.c     |   37 +++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |    5 ++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
arch/arm/boards/at91sam9x5ek/init.c +37 -0
index dbb9bb5..d97da2b 100644
@@ -41,6 +41,7 @@
 #include <readkey.h>
 #include <linux/w1-gpio.h>
 #include <w1_mac_address.h>
+#include <spi/spi.h>
 
 #include "hw_version.h"
 
@@ -132,6 +133,41 @@ static void ek_add_device_i2c(void)
 	at91_add_device_i2c(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 }
 
+static const struct spi_board_info ek_cm_cogent_spi_devices[] = {
+	{
+		.name		= "mtd_dataflash",
+		.chip_select	= 0,
+		.max_speed_hz	= 15 * 1000 * 1000,
+		.bus_num	= 0,
+	}
+};
+
+static const struct spi_board_info ek_spi_devices[] = {
+	{
+		.name		= "m25p80",
+		.chip_select	= 0,
+		.max_speed_hz	= 30 * 1000 * 1000,
+		.bus_num	= 0,
+	}
+};
+
+static unsigned spi0_standard_cs[] = { AT91_PIN_PA14};
+static struct at91_spi_platform_data spi_pdata = {
+	.chipselect = spi0_standard_cs,
+	.num_chipselect = ARRAY_SIZE(spi0_standard_cs),
+};
+
+static void ek_add_device_spi(void)
+{
+	if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT))
+		spi_register_board_info(ek_cm_cogent_spi_devices,
+				ARRAY_SIZE(ek_cm_cogent_spi_devices));
+	else
+		spi_register_board_info(ek_spi_devices,
+				ARRAY_SIZE(ek_spi_devices));
+	at91_add_device_spi(0, &spi_pdata);
+}
+
 /*
  * USB Host port
  */
@@ -188,6 +224,7 @@ static int at91sam9x5ek_devices_init(void)
 	ek_add_device_w1();
 	ek_add_device_nand();
 	ek_add_device_eth();
+	ek_add_device_spi();
 	at91_add_device_usbh_ohci(&ek_usbh_data);
 	ek_add_led();
 	ek_add_device_i2c();
arch/arm/configs/at91sam9x5ek_defconfig +4 -1
index 3e66c44..5b17002 100644
@@ -52,10 +52,13 @@ CONFIG_CMD_TFTP=y
 CONFIG_FS_TFTP=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_DRIVER_NET_MACB=y
-# CONFIG_SPI is not set
+CONFIG_DRIVER_SPI_ATMEL=y
+CONFIG_MTD_M25P80=y
 CONFIG_I2C=y
 CONFIG_I2C_GPIO=y
 CONFIG_MTD=y
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_MTD_DATAFLASH=y
 CONFIG_NAND=y
 # CONFIG_NAND_ECC_HW is not set
 # CONFIG_NAND_ECC_HW_SYNDROME is not set
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v3 3/4 at91sam9x5: add mci support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/mach-at91/at91sam9x5.c         |    2 +
 arch/arm/mach-at91/at91sam9x5_devices.c |   62 +++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
arch/arm/mach-at91/at91sam9x5.c +2 -0
index a9065ff..7c7d997 100644
@@ -207,6 +207,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi1", &spi1_clk),
+	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci0", &mmc0_clk),
+	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci1", &mmc1_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9x5_devices.c +62 -0

68 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v3 4/4 at91sam9x5ek: add mci support

In reply to Jean-Christophe PLAGNIOL-VILLARD

only add mci0 (microSD slot) as mci1 conflict with spi0

---
 arch/arm/boards/at91sam9x5ek/init.c     |   20 ++++++++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |    5 +++--
 2 files changed, 23 insertions(+), 2 deletions(-)
arch/arm/boards/at91sam9x5ek/init.c +20 -0
index d97da2b..4b3c099 100644
@@ -115,6 +115,25 @@ static void ek_add_device_eth(void)
 	at91_add_device_eth(0, &macb_pdata);
 }
 
+/*
+ * MCI (SD/MMC)
+ */
+/* mci0 detect_pin is revision dependent */
+static struct atmel_mci_platform_data mci0_data = {
+	.bus_width	= 4,
+	.detect_pin	= AT91_PIN_PD15,
+	.wp_pin		= 0,
+};
+
+static void ek_add_device_mci(void)
+{
+	if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT))
+		mci0_data.detect_pin = 0;
+
+	/* MMC0 */
+	at91_add_device_mci(0, &mci0_data);
+}
+
 struct qt1070_platform_data qt1070_pdata = {
 	.irq_pin	= AT91_PIN_PA7,
 };
@@ -225,6 +244,7 @@ static int at91sam9x5ek_devices_init(void)
 	ek_add_device_nand();
 	ek_add_device_eth();
 	ek_add_device_spi();
+	ek_add_device_mci();
 	at91_add_device_usbh_ohci(&ek_usbh_data);
 	ek_add_led();
 	ek_add_device_i2c();
arch/arm/configs/at91sam9x5ek_defconfig +3 -2
index 5b17002..354cf08 100644
@@ -65,8 +65,9 @@ CONFIG_NAND=y
 # CONFIG_NAND_ECC_HW_NONE is not set
 CONFIG_NAND_ATMEL=y
 CONFIG_UBI=y
-CONFIG_DISK=y
-CONFIG_DISK_WRITE=y
+CONFIG_MCI=y
+CONFIG_MCI_STARTUP=y
+CONFIG_MCI_ATMEL=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD

ping

Quoted 43 lines · Jean-Christophe PLAGNIOL-VILLARD

HI,
v3: rebase on the v3 of at91sam9xek i2c support

with this +1 patch serie the support of the at91sam9x5ek is mostly complete

This will add spi and mci0 support as spi0 and mci0 conflict

We are still missing framebuffer, usb host and device and hardware i2c support but this wil be added later

This patch serie depedsn on the at91sam9x5ek i2c and m25p80 patcheries

the correct version

this one work but brake the etherent as it mux the 4 cs as gpio and we use them on the eth0

The following changes since commit b3a0963d358e14180e9bbde68ab78fdebae071b7:

m25p80: sync flash support with the kernel (2012-11-03 04:23:15 +0800)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git delivery/at91sam9x5ek_mci_spi

for you to fetch changes up to dc7e1ce2a4ca879d07ba5786cfaa84f54d2ee763:

at91sam9x5ek: add mci support (2012-11-03 04:23:48 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (4):
at91sam9x5: add spi support
at91sam9x5ek: add spi support
at91sam9x5: add mci support
at91sam9x5ek: add mci support

 arch/arm/boards/at91sam9x5ek/init.c     |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |   10 +++++++---
 arch/arm/mach-at91/at91sam9x5.c         |    4 ++++
 arch/arm/mach-at91/at91sam9x5_devices.c |  124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 3 deletions(-)
Quoted 7 lines

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox