Skip to contentSkip to conversation

at91sam9x5 add nand pmecc support

PATCH Applied Jean-Christophe PLAGNIOL-VILLARD 2 participants 5 messages Oct 17, 2012 – Oct 21, 2012

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

cover at91sam9x5 add nand pmecc support

HI,

on the sam9x5 series we have now a working hw ecc and it's needed for nand boot

add it's support to barebox

The following changes since commit 44003508719639b99c1724d27019f778ec0546b7:

at91sam9x5ek: fix bootstrap size to 256KiB (2012-10-17 15:05:52 +0800)

are available in the git repository at:

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

for you to fetch changes up to 14311f1005341b9019afe4ec10c5a1494e68a42c:

at91sam9x5ek: switch to hw pmecc nand support (2012-10-17 16:59:55 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
nand: atmel add pmecc support
at91sam9x5: add pmecc support
at91sam9x5ek: switch to hw pmecc nand support

 arch/arm/boards/at91sam9x5ek/init.c     |    3 +
 arch/arm/configs/at91sam9x5ek_defconfig |   11 +-
 arch/arm/mach-at91/at91sam9x5_devices.c |   16 +-
 arch/arm/mach-at91/include/mach/board.h |    4 +
 drivers/mtd/nand/Kconfig                |    8 +
 drivers/mtd/nand/atmel_nand.c           |  782 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 drivers/mtd/nand/atmel_nand_ecc.h       |  114 +++++++++++++-
 7 files changed, 886 insertions(+), 52 deletions(-)

Best Regards,
J.

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

#1 lore raw

PATCH 1/3 nand: atmel add pmecc support

This patch is from linux 3.7-rc1 and adapt to Barebox

---
 arch/arm/mach-at91/include/mach/board.h |    4 +
 drivers/mtd/nand/Kconfig                |    8 +
 drivers/mtd/nand/atmel_nand.c           |  782 +++++++++++++++++++++++++++++--
 drivers/mtd/nand/atmel_nand_ecc.h       |  114 ++++-
 4 files changed, 863 insertions(+), 45 deletions(-)
arch/arm/mach-at91/include/mach/board.h +4 -0
index 670c73d..af436a8 100644
@@ -53,6 +53,10 @@ struct atmel_nand_data {
 	u8		bus_width_16;	/* buswidth is 16 bit */
 	u8		ecc_mode;	/* NAND_ECC_* */
 	u8		on_flash_bbt;	/* Use flash based bbt */
+
+	u8		pmecc_corr_cap;
+	u16		pmecc_sector_size;
+	u32		pmecc_lookup_table_offset;
 };
 
 void at91_add_device_nand(struct atmel_nand_data *data);
drivers/mtd/nand/Kconfig +8 -0
index 6889b44..74aa47f 100644
@@ -70,6 +70,14 @@ config NAND_ATMEL
 	prompt "Atmel (AT91SAM9xxx) NAND driver"
 	depends on ARCH_AT91
 
+config NAND_ATMEL_PMECC
+	bool
+	prompt "PMECC support"
+	depends on NAND_ATMEL
+	select NAND_ECC_HW
+	help
+	 Support for PMECC present on the SoC sam9x5 and sam9n12
+
 config NAND_S3C24XX
 	bool
 	prompt "Samsung S3C24XX NAND driver"
drivers/mtd/nand/atmel_nand.c +738 -44

821 lines not on this page · raw message

drivers/mtd/nand/atmel_nand_ecc.h +113 -1

124 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 2/3 at91sam9x5: add pmecc support

---
 arch/arm/mach-at91/at91sam9x5_devices.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
arch/arm/mach-at91/at91sam9x5_devices.c +14 -2
index 26a380d..4e59d8d 100644
@@ -135,9 +135,19 @@ static struct resource nand_resources[] = {
 	},
 	[1] = {
 		.start	= AT91_BASE_SYS + AT91_PMECC,
-		.end	= AT91_BASE_SYS + AT91_PMECC + 512 - 1,
+		.end	= AT91_BASE_SYS + AT91_PMECC + 0x600 - 1,
 		.flags	= IORESOURCE_MEM,
-	}
+	},
+	[2] = {
+		.start	= AT91_BASE_SYS + AT91_PMERRLOC,
+		.end	= AT91_BASE_SYS + AT91_PMERRLOC + 0x200 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[3] = {
+		.start	= AT91SAM9X5_ROM_BASE,
+		.end	= AT91SAM9X5_ROM_BASE + AT91SAM9X5_ROM_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
 };
 
 void __init at91_add_device_nand(struct atmel_nand_data *data)
@@ -150,6 +160,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
 	csa = at91_sys_read(AT91_MATRIX_EBICSA);
 	at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_NANDFLASH);
 
+	data->pmecc_lookup_table_offset = 0x8000;
+
 	/* enable pin */
 	if (data->enable_pin)
 		at91_set_gpio_output(data->enable_pin, 1);
Signature · 7 lines
1.7.10.4


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

PATCH 3/3 at91sam9x5ek: switch to hw pmecc nand support

In reply to Jean-Christophe PLAGNIOL-VILLARD

now we can flash barebox by itself as the bootstrap need to use pmecc

---
 arch/arm/boards/at91sam9x5ek/init.c     |    3 +++
 arch/arm/configs/at91sam9x5ek_defconfig |   11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
arch/arm/boards/at91sam9x5ek/init.c +3 -0
index 58c945c..d15b75a 100644
@@ -45,6 +45,9 @@ static struct atmel_nand_data nand_pdata = {
 	.det_pin	= 0,
 	.rdy_pin	= AT91_PIN_PD5,
 	.enable_pin	= AT91_PIN_PD4,
+	.ecc_mode	= NAND_ECC_HW,
+	.pmecc_sector_size = 512,
+	.pmecc_corr_cap = 2,
 #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
 	.bus_width_16	= 1,
 #endif
arch/arm/configs/at91sam9x5ek_defconfig +6 -5
index cda360d..7ce5b71 100644
@@ -23,11 +23,10 @@ CONFIG_CMD_SAVEENV=y
 CONFIG_CMD_EXPORT=y
 CONFIG_CMD_PRINTENV=y
 CONFIG_CMD_READLINE=y
+CONFIG_CMD_TFTP=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
-CONFIG_CMD_MTEST=y
-CONFIG_CMD_MTEST_ALTERNATIVE=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_BOOTM_SHOW_TYPE=y
 CONFIG_CMD_BOOTM_INITRD=y
@@ -38,6 +37,8 @@ CONFIG_CMD_UIMAGE=y
 CONFIG_CMD_RESET=y
 CONFIG_CMD_GO=y
 CONFIG_CMD_OFTREE=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_MTEST_ALTERNATIVE=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_GPIO=y
@@ -47,17 +48,16 @@ CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_NFS=y
 CONFIG_NET_PING=y
-CONFIG_CMD_TFTP=y
-CONFIG_FS_TFTP=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_DRIVER_NET_MACB=y
 # CONFIG_SPI is not set
 CONFIG_MTD=y
 CONFIG_NAND=y
-# CONFIG_NAND_ECC_HW is not set
+# CONFIG_NAND_ECC_SOFT is not set
 # CONFIG_NAND_ECC_HW_SYNDROME is not set
 # CONFIG_NAND_ECC_HW_NONE is not set
 CONFIG_NAND_ATMEL=y
+CONFIG_NAND_ATMEL_PMECC=y
 CONFIG_UBI=y
 CONFIG_DISK=y
 CONFIG_DISK_WRITE=y
@@ -65,6 +65,7 @@ CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
 CONFIG_KEYBOARD_GPIO=y
+CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
Signature · 7 lines
1.7.10.4


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

HI,

on the sam9x5 series we have now a working hw ecc and it's needed for nand boot

add it's support to barebox

Quoted 7 lines

The following changes since commit 44003508719639b99c1724d27019f778ec0546b7:

at91sam9x5ek: fix bootstrap size to 256KiB (2012-10-17 15:05:52 +0800)

are available in the git repository at:

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

Applied, thanks

Sascha

Quoted 28 lines

for you to fetch changes up to 14311f1005341b9019afe4ec10c5a1494e68a42c:

at91sam9x5ek: switch to hw pmecc nand support (2012-10-17 16:59:55 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
nand: atmel add pmecc support
at91sam9x5: add pmecc support
at91sam9x5ek: switch to hw pmecc nand support

 arch/arm/boards/at91sam9x5ek/init.c     |    3 +
 arch/arm/configs/at91sam9x5ek_defconfig |   11 +-
 arch/arm/mach-at91/at91sam9x5_devices.c |   16 +-
 arch/arm/mach-at91/include/mach/board.h |    4 +
 drivers/mtd/nand/Kconfig                |    8 +
 drivers/mtd/nand/atmel_nand.c           |  782 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 drivers/mtd/nand/atmel_nand_ecc.h       |  114 +++++++++++++-
 7 files changed, 886 insertions(+), 52 deletions(-)

Best Regards,
J.

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

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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