Skip to contentSkip to conversation

atmel_nand: check gpio validity before using it

PATCH In review Eric Bénard 4 participants 27 messages Dec 7, 2013 – Dec 12, 2013

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

PATCH 1/7 atmel_nand: check gpio validity before using it

else we get : "invalid GPIO -22"
(as enable_pin is EINVAL)

tested on SAMA5D35

---
 drivers/mtd/nand/atmel_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
index a0f0966..658ae52 100644
@@ -107,7 +107,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
  */
 static void atmel_nand_enable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 0);
 }
 
@@ -116,7 +116,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host)
  */
 static void atmel_nand_disable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 1);
 }
 
Signature · 7 lines
1.8.3.1


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

PATCH 2/7 at91: introduce sama5d3's SMC support

there is a new register (timings) vs SAM9 and thus a new mapping

---
 arch/arm/mach-at91/generic.h                |   7 ++
 arch/arm/mach-at91/include/mach/sama5_smc.h | 124 +++++++++++++++++++++
 arch/arm/mach-at91/sama5_smc.c              | 161 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/sama5_smc.h
 create mode 100644 arch/arm/mach-at91/sama5_smc.c
arch/arm/mach-at91/generic.h +7 -0
index a47bcb2..3a510fb 100644
@@ -36,4 +36,11 @@ static inline struct device_d *at91_add_sam9_smc(int id, resource_size_t start,
 				  IORESOURCE_MEM, NULL);
 }
 
+static inline struct device_d *at91_add_sama5_smc(int id, resource_size_t start,
+						 resource_size_t size)
+{
+	return add_generic_device("at91sama5-smc", id, NULL, start, size,
+				  IORESOURCE_MEM, NULL);
+}
+
 void at91_rtt_irq_fixup(void *base);
arch/arm/mach-at91/include/mach/sama5_smc.h new file +124 -0

124 lines not on this page · raw message

arch/arm/mach-at91/sama5_smc.c new file +161 -0

161 lines not on this page · raw message

Signature · 7 lines
1.8.3.1


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

Re: [PATCH 2/7] at91: introduce sama5d3's SMC support

Quoted 10 lines · Eric B??nard

there is a new register (timings) vs SAM9 and thus a new mapping

---
 arch/arm/mach-at91/generic.h                |   7 ++
 arch/arm/mach-at91/include/mach/sama5_smc.h | 124 +++++++++++++++++++++
 arch/arm/mach-at91/sama5_smc.c              | 161 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/sama5_smc.h
 create mode 100644 arch/arm/mach-at91/sama5_smc.c

nack the sama5 smc share part of the same IP as the sam9 do not duplicate code share it

Best Regards,
J.

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

#3 lore raw

Re: [PATCH 2/7] at91: introduce sama5d3's SMC support

Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Eric B??nard

there is a new register (timings) vs SAM9 and thus a new mapping

---
 arch/arm/mach-at91/generic.h                |   7 ++
 arch/arm/mach-at91/include/mach/sama5_smc.h | 124 +++++++++++++++++++++
 arch/arm/mach-at91/sama5_smc.c              | 161 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/sama5_smc.h
 create mode 100644 arch/arm/mach-at91/sama5_smc.c
Quoted 2 lines

nack the sama5 smc share part of the same IP as the sam9 do not duplicate code share it

Indeed the code looks very similar. We could use id_table to distinguish between both.

Sascha

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
#4 lore raw

Re: [PATCH 2/7] at91: introduce sama5d3's SMC support

Quoted 13 lines · Sascha Hauer
Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Eric B??nard

there is a new register (timings) vs SAM9 and thus a new mapping

---
 arch/arm/mach-at91/generic.h                |   7 ++
 arch/arm/mach-at91/include/mach/sama5_smc.h | 124 +++++++++++++++++++++
 arch/arm/mach-at91/sama5_smc.c              | 161 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/sama5_smc.h
 create mode 100644 arch/arm/mach-at91/sama5_smc.c
Quoted 6 lines
Quoted 2 lines

nack the sama5 smc share part of the same IP as the sam9 do not duplicate code share it

Indeed the code looks very similar. We could use id_table to distinguish between both.

I was expecting this request ;-)
I'll update the patch in the coming days.

Eric
it.

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

#5 lore raw

PATCH 3/7 at91: sama5d3: use the sama5 smc instead of the sam9 one

In reply to Eric Bénard
---
 arch/arm/mach-at91/Kconfig   | 1 -
 arch/arm/mach-at91/Makefile  | 2 +-
 arch/arm/mach-at91/sama5d3.c | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-at91/Kconfig +0 -1
index 6ab374e..d411edc 100644
@@ -24,7 +24,6 @@ config SOC_AT91SAM9
 config SOC_SAMA5
 	bool
 	select CPU_V7
-	select AT91SAM9_SMC
 	select AT91SAM9_TIMER
 
 config ARCH_TEXT_BASE
arch/arm/mach-at91/Makefile +1 -1
index ab80e5f..18d156c 100644
@@ -30,4 +30,4 @@ obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9X5)	+= at91sam9x5.o at91sam9x5_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9N12)	+= at91sam9n12.o at91sam9n12_devices.o
-obj-$(CONFIG_ARCH_SAMA5D3)	+= sama5d3.o sama5d3_devices.o
+obj-$(CONFIG_ARCH_SAMA5D3)	+= sama5d3.o sama5d3_devices.o sama5_smc.o
arch/arm/mach-at91/sama5d3.c +1 -1
index aa681aa..acbf018 100644
@@ -386,7 +386,7 @@ static void sama5d3_initialize(void)
 	at91_add_sam9x5_gpio(4, SAMA5D3_BASE_PIOE);
 
 	at91_add_pit(SAMA5D3_BASE_PIT);
-	at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
+	at91_add_sama5_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
 }
 
 AT91_SOC_START(sama5d3)
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 3/7] at91: sama5d3: use the sama5 smc instead of the sam9 one

Quoted 12 lines · Eric B??nard
---
 arch/arm/mach-at91/Kconfig   | 1 -
 arch/arm/mach-at91/Makefile  | 2 +-
 arch/arm/mach-at91/sama5d3.c | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-at91/Kconfig +0 -0
index 6ab374e..d411edc 100644

arch/arm/mach-at91/Kconfig config SOC_AT91SAM9 · line 27

Quoted 4 lines
arch/arm/mach-at91/Kconfig +0 -1
@@ -24,7 +24,6 @@ config SOC_AT91SAM9
 config SOC_SAMA5
 	bool
 	select CPU_V7
-	select AT91SAM9_SMC

select here I do not want to hack it again when having a new smc or a new SoC

Quoted 34 lines
arch/arm/mach-at91/Kconfig +0 -0
 	select AT91SAM9_TIMER
 
 config ARCH_TEXT_BASE
arch/arm/mach-at91/Makefile +1 -1
index ab80e5f..18d156c 100644
@@ -30,4 +30,4 @@ obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9X5)	+= at91sam9x5.o at91sam9x5_devices.o
 obj-$(CONFIG_ARCH_AT91SAM9N12)	+= at91sam9n12.o at91sam9n12_devices.o
-obj-$(CONFIG_ARCH_SAMA5D3)	+= sama5d3.o sama5d3_devices.o
+obj-$(CONFIG_ARCH_SAMA5D3)	+= sama5d3.o sama5d3_devices.o sama5_smc.o
arch/arm/mach-at91/sama5d3.c +1 -1
index aa681aa..acbf018 100644
@@ -386,7 +386,7 @@ static void sama5d3_initialize(void)
 	at91_add_sam9x5_gpio(4, SAMA5D3_BASE_PIOE);
 
 	at91_add_pit(SAMA5D3_BASE_PIT);
-	at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
+	at91_add_sama5_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
 }
 
 AT91_SOC_START(sama5d3)
Signature · 7 lines
1.8.3.1


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

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

#7 lore raw

PATCH 4/7 sama5d3xek: update nand timings

In reply to Eric Bénard

This updates nand timings to at91bootstrap's ones (branch 3.5.x) With this setting nand flash is properly detected when we boot from SPI NOR flash.

When booting on SPI NOR, log is now :
nand: ONFI param page 0 valid
nand: ONFI flash detected
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP), 256MiB, page size: 2048, OOB size: 64 atmel_nand atmel_nand0: Initialize PMECC params, cap: 4, sector: 512

---
 arch/arm/boards/sama5d3xek/init.c | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
arch/arm/boards/sama5d3xek/init.c +21 -13
index 482c74a..ff62550 100644
@@ -29,8 +29,7 @@
 #include <sizes.h>
 #include <linux/mtd/nand.h>
 #include <mach/board.h>
-#include <mach/at91sam9_smc.h>
-#include <mach/at91sam9_smc.h>
+#include <mach/sama5_smc.h>
 #include <gpio.h>
 #include <mach/io.h>
 #include <mach/iomux.h>
@@ -71,19 +70,28 @@ static struct atmel_nand_data nand_pdata = {
 	.on_flash_bbt	= 1,
 };
 
-static struct sam9_smc_config cm_nand_smc_config = {
-	.ncs_read_setup		= 0,
-	.nrd_setup		= 1,
-	.ncs_write_setup	= 0,
+static struct sama5_smc_config cm_nand_smc_config = {
+	.ncs_read_setup		= 1,
+	.nrd_setup		= 2,
+	.ncs_write_setup	= 1,
 	.nwe_setup		= 1,
 
-	.ncs_read_pulse		= 6,
-	.nrd_pulse		= 4,
-	.ncs_write_pulse	= 5,
-	.nwe_pulse		= 3,
+	.ncs_read_pulse		= 7,
+	.nrd_pulse		= 5,
+	.ncs_write_pulse	= 7,
+	.nwe_pulse		= 5,
 
-	.read_cycle		= 6,
-	.write_cycle		= 5,
+	.read_cycle		= 9,
+	.write_cycle		= 8,
+
+	.cle_to_ren_low_delay	= 3,
+	.ale_to_data_start	= 10,
+	.ale_to_ren_low_delay	= 3,
+	.off_chip_memory_scrambling_enable = 0,
+	.ready_to_ren_low_delay = 4,
+	.wen_high_to_ren_to_busy = 5,
+	.ready_busy_line_selection = 3,
+	.nand_flash_selection	= 1,
 
 	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
 	.tdf_cycles		= 1,
@@ -102,7 +110,7 @@ static void ek_add_device_nand(void)
 		cm_nand_smc_config.mode |= AT91_SMC_DBW_8;
 
 	/* configure chip-select 3 (NAND) */
-	sam9_smc_configure(0, 3, &cm_nand_smc_config);
+	sama5_smc_configure(0, 3, &cm_nand_smc_config);
 
 	at91_add_device_nand(&nand_pdata);
 }
Signature · 7 lines
1.8.3.1


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

PATCH 5/7 atmel_nand: make chip_delay configurable

In reply to Eric Bénard

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

---
 arch/arm/mach-at91/include/mach/board.h | 1 +
 drivers/mtd/nand/atmel_nand.c           | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-at91/include/mach/board.h +1 -0
index aa0fdae..4e6fa8b 100644
@@ -64,6 +64,7 @@ struct atmel_nand_data {
 	u8		ecc_mode;	/* NAND_ECC_* */
 	u8		on_flash_bbt;	/* Use flash based bbt */
 	u8		bus_on_d0;
+	int		chip_delay;
 
 	u8		pmecc_corr_cap;
 	u16		pmecc_sector_size;
drivers/mtd/nand/atmel_nand.c +4 -1
index 658ae52..2ff7427 100644
@@ -1161,7 +1161,10 @@ static int __init atmel_nand_probe(struct device_d *dev)
 		nand_chip->ecc.mode = NAND_ECC_HW;
 	}
 
-	nand_chip->chip_delay = 20;		/* 20us command delay time */
+	if (host->board->chip_delay > 0)
+		nand_chip->chip_delay = host->board->chip_delay;
+	else
+		nand_chip->chip_delay = 20;		/* 20us command delay time */
 
 	if (host->board->bus_width_16) {	/* 16-bit bus width */
 		nand_chip->options |= NAND_BUSWIDTH_16;
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

Quoted 2 lines · Eric B??nard

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

Quoted 43 lines
---
 arch/arm/mach-at91/include/mach/board.h | 1 +
 drivers/mtd/nand/atmel_nand.c           | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-at91/include/mach/board.h +1 -0
index aa0fdae..4e6fa8b 100644
@@ -64,6 +64,7 @@ struct atmel_nand_data {
 	u8		ecc_mode;	/* NAND_ECC_* */
 	u8		on_flash_bbt;	/* Use flash based bbt */
 	u8		bus_on_d0;
+	int		chip_delay;
 
 	u8		pmecc_corr_cap;
 	u16		pmecc_sector_size;
drivers/mtd/nand/atmel_nand.c +4 -1
index 658ae52..2ff7427 100644
@@ -1161,7 +1161,10 @@ static int __init atmel_nand_probe(struct device_d *dev)
 		nand_chip->ecc.mode = NAND_ECC_HW;
 	}
 
-	nand_chip->chip_delay = 20;		/* 20us command delay time */
+	if (host->board->chip_delay > 0)
+		nand_chip->chip_delay = host->board->chip_delay;
+	else
+		nand_chip->chip_delay = 20;		/* 20us command delay time */
 
 	if (host->board->bus_width_16) {	/* 16-bit bus width */
 		nand_chip->options |= NAND_BUSWIDTH_16;
Signature · 7 lines
1.8.3.1


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

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

#10 lore raw

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Eric B??nard

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

that's an information which can be usefull for other users on custom boards. Sorry if you don't like to read the word "u-boot" ;-)

Eric

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

#11 lore raw

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

Quoted 10 lines · Eric B??nard
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Eric B??nard

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

that's an information which can be usefull for other users on custom boards. Sorry if you don't like to read the word "u-boot" ;-)

so this part is useless

Best Regards,
J.

Quoted 2 lines

Eric

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

#12 lore raw

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Eric B??nard
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

On 10:36 Sat 07 Dec , Eric B??nard wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

that's an information which can be usefull for other users on custom boards. Sorry if you don't like to read the word "u-boot" ;-)

so this part is useless

why ?

Eric

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

#13 lore raw

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Eric B??nard
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

On 10:36 Sat 07 Dec , Eric B??nard wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

that's an information which can be usefull for other users on custom boards. Sorry if you don't like to read the word "u-boot" ;-)

so this part is useless

I think it's useful to tell the default value used by the other reference bootloader.

Eric

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

#14 lore raw

Re: [PATCH 5/7] atmel_nand: make chip_delay configurable

Quoted 12 lines · Eric Bénard
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Eric B??nard
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Eric B??nard

this is usefull for custom boards with different NAND flashs (for informations u-boot defaults chip_delay to 75)

drop this comment on u-boot as in barebox we use the kernel driver

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

that's an information which can be usefull for other users on custom boards. Sorry if you don't like to read the word "u-boot" ;-)

so this part is useless

I think it's useful to tell the default value used by the other reference bootloader.

I for once have nothing against using the word U-Boot in commit messages.

Sascha

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
#15 lore raw

PATCH 6/7 sama5d3xek: add NOR CFI support

In reply to Eric Bénard

log is now :
cfi_flash cfi_flash0: found cfi flash at 10000000, size 16777216

---
 arch/arm/boards/sama5d3xek/init.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/boards/sama5d3xek/init.c +35 -0
index ff62550..f7dfea0 100644
@@ -118,6 +118,40 @@ static void ek_add_device_nand(void)
 static void ek_add_device_nand(void) {}
 #endif
 
+#if defined(CONFIG_DRIVER_CFI)
+static struct sama5_smc_config __initdata cm_nor_smc_config = {
+	.ncs_read_setup		= 10,
+	.nrd_setup		= 10,
+	.ncs_write_setup	= 10,
+	.nwe_setup		= 10,
+
+	.ncs_read_pulse		= 11,
+	.nrd_pulse		= 11,
+	.ncs_write_pulse	= 11,
+	.nwe_pulse		= 11,
+
+	.read_cycle		= 22,
+	.write_cycle		= 22,
+
+	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_DBW_16,
+	.tdf_cycles		= 6,
+};
+
+static void ek_add_device_norcfi(void)
+{
+	struct clk *clk = clk_get(NULL, "smc_clk");
+
+	clk_enable(clk);
+
+	/* configure chip-select 0 (NOR) */
+	sama5_smc_configure(0, 0, &cm_nor_smc_config);
+
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 256 * 1024 * 1024, 0);
+}
+#else
+static void ek_add_device_norcfi(void) {}
+#endif
+
 #if defined(CONFIG_DRIVER_NET_MACB)
 static struct macb_platform_data gmac_pdata = {
 	.phy_interface = PHY_INTERFACE_MODE_RGMII,
@@ -413,6 +447,7 @@ static int at91sama5d3xek_devices_init(void)
 	ek_add_device_w1();
 	ek_add_device_hdmi();
 	ek_add_device_nand();
+	ek_add_device_norcfi();
 	ek_add_led();
 	ek_add_device_eth();
 	ek_add_device_spi();
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 6/7] sama5d3xek: add NOR CFI support

Quoted 13 lines · Eric B??nard

log is now :
cfi_flash cfi_flash0: found cfi flash at 10000000, size 16777216

---
 arch/arm/boards/sama5d3xek/init.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/boards/sama5d3xek/init.c +0 -0
index ff62550..f7dfea0 100644

arch/arm/boards/sama5d3xek/init.c static void ek_add_device_nand(void) · line 122

Quoted 5 lines
arch/arm/boards/sama5d3xek/init.c +2 -0
@@ -118,6 +118,40 @@ static void ek_add_device_nand(void)
 static void ek_add_device_nand(void) {}
 #endif
 
+#if defined(CONFIG_DRIVER_CFI)
+static struct sama5_smc_config __initdata cm_nor_smc_config = {

drop the __initdata

Quoted 17 lines
arch/arm/boards/sama5d3xek/init.c +17 -0
+	.ncs_read_setup		= 10,
+	.nrd_setup		= 10,
+	.ncs_write_setup	= 10,
+	.nwe_setup		= 10,
+
+	.ncs_read_pulse		= 11,
+	.nrd_pulse		= 11,
+	.ncs_write_pulse	= 11,
+	.nwe_pulse		= 11,
+
+	.read_cycle		= 22,
+	.write_cycle		= 22,
+
+	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_DBW_16,
+	.tdf_cycles		= 6,
+};
+

arch/arm/boards/sama5d3xek/init.c static void ek_add_device_nand(void) · line 149

Quoted 10 lines
arch/arm/boards/sama5d3xek/init.c +10 -0
+static void ek_add_device_norcfi(void)
+{
+	struct clk *clk = clk_get(NULL, "smc_clk");
+
+	clk_enable(clk);
+
+	/* configure chip-select 0 (NOR) */
+	sama5_smc_configure(0, 0, &cm_nor_smc_config);
+
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 256 * 1024 * 1024, 0);

no put the right size or 0 for auto detect not 256MiB

Best Regards,
J.

Quoted 24 lines
arch/arm/boards/sama5d3xek/init.c +6 -0
+}
+#else
+static void ek_add_device_norcfi(void) {}
+#endif
+
 #if defined(CONFIG_DRIVER_NET_MACB)
 static struct macb_platform_data gmac_pdata = {
 	.phy_interface = PHY_INTERFACE_MODE_RGMII,
@@ -413,6 +447,7 @@ static int at91sama5d3xek_devices_init(void)
 	ek_add_device_w1();
 	ek_add_device_hdmi();
 	ek_add_device_nand();
+	ek_add_device_norcfi();
 	ek_add_led();
 	ek_add_device_eth();
 	ek_add_device_spi();
Signature · 7 lines
1.8.3.1


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

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

#17 lore raw

Re: [PATCH 6/7] sama5d3xek: add NOR CFI support

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/boards/sama5d3xek/init.c static void ek_add_device_nand(void) · line 149

Quoted 7 lines
arch/arm/boards/sama5d3xek/init.c +7 -0
+
+	clk_enable(clk);
+
+	/* configure chip-select 0 (NOR) */
+	sama5_smc_configure(0, 0, &cm_nor_smc_config);
+
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 256 * 1024 * 1024, 0);

no put the right size or 0 for auto detect not 256MiB

'0' only works because the cfi flash driver completely ignores the resource size. If 256MiB is the maximum flash size or the size of this particular chipselect I see nothing wrong in assigning 256MiB to the device.

Sascha

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
#18 lore raw

Re: [PATCH 6/7] sama5d3xek: add NOR CFI support

Hi Sascha,

Quoted 10 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/boards/sama5d3xek/init.c static void ek_add_device_nand(void) · line 149

Quoted 7 lines
arch/arm/boards/sama5d3xek/init.c +7 -0
+
+	clk_enable(clk);
+
+	/* configure chip-select 0 (NOR) */
+	sama5_smc_configure(0, 0, &cm_nor_smc_config);
+
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 256 * 1024 * 1024, 0);

no put the right size or 0 for auto detect not 256MiB

Quoted 5 lines

'0' only works because the cfi flash driver completely ignores the resource size. If 256MiB is the maximum flash size or the size of this particular chipselect I see nothing wrong in assigning 256MiB to the device.

256MiB is the maximul size this chip select can address

Eric

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

#19 lore raw

PATCH 7/7 samsa5d3xek: update defconfig

In reply to Eric Bénard
---
 arch/arm/configs/sama5d3xek_defconfig | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/configs/sama5d3xek_defconfig +6 -3
index 970ded5..bd331c3 100644
@@ -41,8 +41,7 @@ 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_MEMTEST=y
 CONFIG_CMD_SPLASH=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
@@ -65,13 +64,17 @@ CONFIG_I2C_GPIO=y
 CONFIG_MTD=y
 # CONFIG_MTD_OOB_DEVICE is not set
 CONFIG_MTD_M25P80=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set
+CONFIG_CFI_BUFFER_WRITE=y
 CONFIG_NAND=y
 # 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_MTD_UBI=y
 CONFIG_VIDEO=y
 CONFIG_DRIVER_VIDEO_ATMEL_HLCD=y
 CONFIG_MCI=y
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 7/7] samsa5d3xek: update defconfig

more comment here

Quoted 10 lines · Eric B??nard
---
 arch/arm/configs/sama5d3xek_defconfig | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/configs/sama5d3xek_defconfig +0 -0
index 970ded5..bd331c3 100644

arch/arm/configs/sama5d3xek_defconfig CONFIG_CMD_UIMAGE=y · line 44

Quoted 6 lines
arch/arm/configs/sama5d3xek_defconfig +1 -2
@@ -41,8 +41,7 @@ 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_MEMTEST=y

why?

Quoted 30 lines
arch/arm/configs/sama5d3xek_defconfig +5 -1
 CONFIG_CMD_SPLASH=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
@@ -65,13 +64,17 @@ CONFIG_I2C_GPIO=y
 CONFIG_MTD=y
 # CONFIG_MTD_OOB_DEVICE is not set
 CONFIG_MTD_M25P80=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set
+CONFIG_CFI_BUFFER_WRITE=y
 CONFIG_NAND=y
 # 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_MTD_UBI=y
 CONFIG_VIDEO=y
 CONFIG_DRIVER_VIDEO_ATMEL_HLCD=y
 CONFIG_MCI=y
Signature · 7 lines
1.8.3.1


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

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

#21 lore raw

Re: [PATCH 7/7] samsa5d3xek: update defconfig

Hi Jean-Christophe,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

more comment here

Quoted 5 lines · Eric B??nard
---
 arch/arm/configs/sama5d3xek_defconfig | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Quoted 12 lines

arch/arm/configs/sama5d3xek_defconfig CONFIG_CMD_UIMAGE=y · line 44

Quoted 11 lines
arch/arm/configs/sama5d3xek_defconfig +1 -2
index 970ded5..bd331c3 100644
@@ -41,8 +41,7 @@ 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_MEMTEST=y

why?

because MTEST became MEMTEST so as you initialy enabled it, I updated the defconfig to keep the same functionnality.
mtest was removed in :
47f9da43801d7a345569a35d23cd49eb355a891a
memtest was added in :
842308e29774c577291cae09a8a71ecc3b708b92

Quoted 11 lines
Quoted 11 lines
arch/arm/configs/sama5d3xek_defconfig +4 -0
 CONFIG_CMD_SPLASH=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
@@ -65,13 +64,17 @@ CONFIG_I2C_GPIO=y
 CONFIG_MTD=y
 # CONFIG_MTD_OOB_DEVICE is not set
 CONFIG_MTD_M25P80=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set
+CONFIG_CFI_BUFFER_WRITE=y
Quoted 8 lines

arch/arm/configs/sama5d3xek_defconfig CONFIG_I2C_GPIO=y · line 77

Quoted 8 lines
arch/arm/configs/sama5d3xek_defconfig +1 -1
 CONFIG_NAND=y
 # 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_MTD_UBI=y

same thing here.

Eric

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

#22 lore raw

Re: [PATCH 7/7] samsa5d3xek: update defconfig

Quoted 25 lines · Eric B??nard

Hi Jean-Christophe,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

more comment here

Quoted 5 lines · Eric B??nard
---
 arch/arm/configs/sama5d3xek_defconfig | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Quoted 12 lines

arch/arm/configs/sama5d3xek_defconfig CONFIG_CMD_UIMAGE=y · line 44

Quoted 11 lines
arch/arm/configs/sama5d3xek_defconfig +1 -2
index 970ded5..bd331c3 100644
@@ -41,8 +41,7 @@ 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_MEMTEST=y

why?

Quoted 6 lines

because MTEST became MEMTEST so as you initialy enabled it, I updated the defconfig to keep the same functionnality.
mtest was removed in :
47f9da43801d7a345569a35d23cd49eb355a891a
memtest was added in :
842308e29774c577291cae09a8a71ecc3b708b92

so put this in the commit messasge

Best Regards,
J.

Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
arch/arm/configs/sama5d3xek_defconfig +4 -0
 CONFIG_CMD_SPLASH=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
@@ -65,13 +64,17 @@ CONFIG_I2C_GPIO=y
 CONFIG_MTD=y
 # CONFIG_MTD_OOB_DEVICE is not set
 CONFIG_MTD_M25P80=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set
+CONFIG_CFI_BUFFER_WRITE=y
Quoted 8 lines

arch/arm/configs/sama5d3xek_defconfig CONFIG_I2C_GPIO=y · line 77

Quoted 8 lines
arch/arm/configs/sama5d3xek_defconfig +1 -1
 CONFIG_NAND=y
 # 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_MTD_UBI=y

same thing here.

Quoted 1 line

Eric

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

#23 lore raw

Re: [PATCH 7/7] samsa5d3xek: update defconfig

In reply to Eric Bénard
Quoted 25 lines · Eric Bénard

Hi Jean-Christophe,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

more comment here

Quoted 5 lines · Eric B??nard
---
 arch/arm/configs/sama5d3xek_defconfig | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Quoted 12 lines

arch/arm/configs/sama5d3xek_defconfig CONFIG_CMD_UIMAGE=y · line 44

Quoted 11 lines
arch/arm/configs/sama5d3xek_defconfig +1 -2
index 970ded5..bd331c3 100644
@@ -41,8 +41,7 @@ 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_MEMTEST=y

why?

Quoted 7 lines

because MTEST became MEMTEST so as you initialy enabled it, I updated the defconfig to keep the same functionnality.
mtest was removed in :
47f9da43801d7a345569a35d23cd49eb355a891a
memtest was added in :
842308e29774c577291cae09a8a71ecc3b708b92

oh damn, and I though the it's because the new memtest command is just a cool command which everybody needs. :-)

- Alex

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

#24 lore raw
In reply to Eric Bénard

The series looks fine for me. Jean-Christophe?

Sascha

Quoted 40 lines · Eric Bénard

else we get : "invalid GPIO -22"
(as enable_pin is EINVAL)

tested on SAMA5D35

---
 drivers/mtd/nand/atmel_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
index a0f0966..658ae52 100644
@@ -107,7 +107,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
  */
 static void atmel_nand_enable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 0);
 }
 
@@ -116,7 +116,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host)
  */
 static void atmel_nand_disable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 1);
 }
 
Signature · 7 lines
1.8.3.1


_______________________________________________
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
#25 lore raw
Quoted 2 lines · Sascha Hauer

The series looks fine for me. Jean-Christophe?

small issues

Quoted 36 lines

Sascha

Quoted 32 lines · Eric Bénard

else we get : "invalid GPIO -22"
(as enable_pin is EINVAL)

tested on SAMA5D35

---
 drivers/mtd/nand/atmel_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
index a0f0966..658ae52 100644
@@ -107,7 +107,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
  */
 static void atmel_nand_enable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 0);
 }
 
@@ -116,7 +116,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host)
  */
 static void atmel_nand_disable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 1);
 }
 
Quoted 14 lines
Quoted 8 lines
Signature · 7 lines
1.8.3.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 4 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

#26 lore raw
In reply to Eric Bénard
Quoted 4 lines · Eric B??nard

else we get : "invalid GPIO -22"
(as enable_pin is EINVAL)

tested on SAMA5D35

Quoted 36 lines
---
 drivers/mtd/nand/atmel_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
index a0f0966..658ae52 100644
@@ -107,7 +107,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
  */
 static void atmel_nand_enable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 0);
 }
 
@@ -116,7 +116,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host)
  */
 static void atmel_nand_disable(struct atmel_nand_host *host)
 {
-	if (host->board->enable_pin)
+	if (gpio_is_valid(host->board->enable_pin))
 		gpio_set_value(host->board->enable_pin, 1);
 }
 
Signature · 7 lines
1.8.3.1


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

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