Skip to contentSkip to conversation

at91sam9x5ek: add spi and mci support

PATCH Superseded Jean-Christophe PLAGNIOL-VILLARD 1 participant 6 messages Nov 1, 2012 – Nov 2, 2012

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover at91sam9x5ek: add spi and mci support

HI,

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 04ffb7b107af50bd64d803b72e5fc315180381a2:

m25p80: sync flash support with the kernel (2012-11-01 12:15:26 +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 86d0ef8200bfea132613e7654a6eb4f0d1c77cba:

at91sam9x5ek: add mci support (2012-11-01 12:39:52 +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 v2 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 v2 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 48eebac..afb50e8 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"
 
@@ -125,6 +126,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
  */
@@ -181,6 +217,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 c71fe0d..5611b95 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 v2 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 v2 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 afb50e8..da488bd 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);
+}
+
 static struct i2c_board_info i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("qt1070", 0x1b),
@@ -218,6 +237,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 5611b95..d097683 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
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD

HI,

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

Quoted 6 lines

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

v2 rebase agains i2c patch serie v2

The following changes since commit 244b46fb5c4663cba1df182670c212b8b4b7a4b0:

m25p80: sync flash support with the kernel (2012-11-02 02:28:41 +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 9d74c51ca7d8d9a959aa989f83bbb3e1a9e3a129:

at91sam9x5ek: add mci support (2012-11-02 02:28:42 +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