* [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support
2012-08-16 4:44 [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
@ 2012-08-16 4:44 ` Bo Shen
2012-08-17 4:18 ` Mike Frysinger
2012-09-17 17:02 ` Andreas Bießmann
2012-08-16 4:44 ` [U-Boot] [PATCH 2/3] arm : at91sam9x5 : enable serial flash boot Bo Shen
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: Bo Shen @ 2012-08-16 4:44 UTC (permalink / raw)
To: u-boot
Add atmel at25df321 serial flash support
Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
drivers/mtd/spi/atmel.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c
index 1ecece0..89ebe9d 100644
--- a/drivers/mtd/spi/atmel.c
+++ b/drivers/mtd/spi/atmel.c
@@ -109,6 +109,14 @@ static const struct atmel_spi_flash_params atmel_spi_flash_table[] = {
.nr_sectors = 32,
.name = "AT45DB642D",
},
+ {
+ .idcode1 = 0x47,
+ .l2_page_size = 8,
+ .pages_per_block = 16,
+ .blocks_per_sector = 16,
+ .nr_sectors = 64,
+ .name = "AT25DF321",
+ },
};
static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)
@@ -515,6 +523,8 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
case DF_FAMILY_AT26F:
case DF_FAMILY_AT26DF:
asf->flash.read = spi_flash_cmd_read_fast;
+ asf->flash.write = dataflash_write_p2;
+ asf->flash.erase = dataflash_erase_p2;
break;
default:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread* [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support
2012-08-16 4:44 ` [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support Bo Shen
@ 2012-08-17 4:18 ` Mike Frysinger
2012-08-17 5:08 ` Bo Shen
2012-09-17 17:02 ` Andreas Bießmann
1 sibling, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2012-08-17 4:18 UTC (permalink / raw)
To: u-boot
On Thursday 16 August 2012 00:44:25 Bo Shen wrote:
> Add atmel at25df321 serial flash support
thanks, merged into my spi flash branch
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/615cb614/attachment.pgp>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support
2012-08-17 4:18 ` Mike Frysinger
@ 2012-08-17 5:08 ` Bo Shen
2012-08-17 18:55 ` Mike Frysinger
0 siblings, 1 reply; 12+ messages in thread
From: Bo Shen @ 2012-08-17 5:08 UTC (permalink / raw)
To: u-boot
Hi Mike,
On 8/17/2012 12:18, Mike Frysinger wrote:
> On Thursday 16 August 2012 00:44:25 Bo Shen wrote:
>> Add atmel at25df321 serial flash support
>
After reading the spi framework. I found there are common interface for
serial flash. So, I plan to use the common interface
(spi_flash_cmd_write_multi) while not the private interface
(dataflash_write_p2), and etc.
I am sorry for this inconvenience. :(
Will you revert this patch? Or, maybe I should submit a patch for this
base on the merged code?
which one will you prefer to?
> thanks, merged into my spi flash branch
> -mike
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support
2012-08-17 5:08 ` Bo Shen
@ 2012-08-17 18:55 ` Mike Frysinger
0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2012-08-17 18:55 UTC (permalink / raw)
To: u-boot
On Friday 17 August 2012 01:08:01 Bo Shen wrote:
> On 8/17/2012 12:18, Mike Frysinger wrote:
> > On Thursday 16 August 2012 00:44:25 Bo Shen wrote:
> >> Add atmel at25df321 serial flash support
>
> After reading the spi framework. I found there are common interface for
> serial flash. So, I plan to use the common interface
> (spi_flash_cmd_write_multi) while not the private interface
> (dataflash_write_p2), and etc.
>
> I am sorry for this inconvenience. :(
>
> Will you revert this patch? Or, maybe I should submit a patch for this
> base on the merged code?
>
> which one will you prefer to?
i think this is an independent issue that the atmel driver has long not been
using the unified pieces. if you want to submit a patch on top of this one,
that'd be best.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/77d71606/attachment.pgp>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support
2012-08-16 4:44 ` [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support Bo Shen
2012-08-17 4:18 ` Mike Frysinger
@ 2012-09-17 17:02 ` Andreas Bießmann
1 sibling, 0 replies; 12+ messages in thread
From: Andreas Bießmann @ 2012-09-17 17:02 UTC (permalink / raw)
To: u-boot
Dear Bo Shen,
On 16.08.2012 06:44, Bo Shen wrote:
> Add atmel at25df321 serial flash support
>
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
since this patch did not appear to be merged by Mike as mentioned
earlier ([1], [2], [3]) I did apply it to u-boot-atmel/master, thanks!
Best regards
Andreas Bie?mann
[1]
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/138226/focus=138332
[2]
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/137983/focus=139926
[3]
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/140642/focus=140774
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/3] arm : at91sam9x5 : enable serial flash boot
2012-08-16 4:44 [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
2012-08-16 4:44 ` [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support Bo Shen
@ 2012-08-16 4:44 ` Bo Shen
2012-08-16 7:36 ` Andreas Bießmann
2012-08-16 4:44 ` [U-Boot] [PATCH 3/3] arm : at91sam9x5 : fix a small bug for NAND Bo Shen
2012-08-16 7:14 ` [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
3 siblings, 1 reply; 12+ messages in thread
From: Bo Shen @ 2012-08-16 4:44 UTC (permalink / raw)
To: u-boot
enable at91sam9x5 boot from serial flash
Use at91sam9x5_dataflash to configure the u-boot
Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 4 ++--
boards.cfg | 1 +
include/configs/at91sam9x5ek.h | 18 ++++++++++++++----
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 7558ca2..6d77219 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -121,7 +121,7 @@ void at91_serial2_hw_init(void)
#ifdef CONFIG_ATMEL_SPI
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
at91_set_a_periph(AT91_PIO_PORTA, 11, 0); /* SPI0_MISO */
at91_set_a_periph(AT91_PIO_PORTA, 12, 0); /* SPI0_MOSI */
@@ -150,7 +150,7 @@ void at91_spi0_hw_init(unsigned long cs_mask)
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
at91_set_b_periph(AT91_PIO_PORTA, 21, 0); /* SPI1_MISO */
at91_set_b_periph(AT91_PIO_PORTA, 22, 0); /* SPI1_MOSI */
diff --git a/boards.cfg b/boards.cfg
index edd750c..945ef09 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -91,6 +91,7 @@ at91sam9m10g45ek_nandflash arm arm926ejs at91sam9m10g45ek atmel
at91sam9rlek_dataflash arm arm926ejs at91sam9rlek atmel at91 at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
at91sam9rlek_nandflash arm arm926ejs at91sam9rlek atmel at91 at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
at91sam9x5ek_nandflash arm arm926ejs at91sam9x5ek atmel at91 at91sam9x5ek:AT91SAM9X5,SYS_USE_NANDFLASH
+at91sam9x5ek_dataflash arm arm926ejs at91sam9x5ek atmel at91 at91sam9x5ek:AT91SAM9X5,SYS_USE_DATAFLASH
at91sam9xeek_dataflash_cs0 arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
at91sam9xeek_dataflash_cs1 arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
at91sam9xeek_nandflash arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 82f6b48..21ef862 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -86,6 +86,7 @@
#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_NAND
+#define CONFIG_CMD_SF
/* SDRAM */
#define CONFIG_NR_DRAM_BANKS 1
@@ -96,12 +97,10 @@
(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
/* DataFlash */
-#ifdef CONFIG_ATMEL_SPI
-#define CONFIG_CMD_SF
-#define CONFIG_CMD_SPI
+#ifdef CONFIG_CMD_SF
+#define CONFIG_ATMEL_SPI
#define CONFIG_SPI_FLASH
#define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SYS_MAX_DATAFLASH_BANKS
#endif
/* no NOR flash */
@@ -149,6 +148,17 @@
#define CONFIG_BOOTCOMMAND "nand read " \
"0x22000000 0x200000 0x300000; " \
"bootm 0x22000000"
+#else
+#ifdef CONFIG_SYS_USE_DATAFLASH
+/* bootstrap + u-boot + env + linux in data flash */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET 0x5000
+#define CONFIG_ENV_SIZE 0x3000
+#define CONFIG_ENV_SECT_SIZE 0x1000
+#define CONFIG_BOOTCOMMAND "sf probe 0; " \
+ "sf read 0x22000000 0x100000 0x300000; " \
+ "bootm 0x22000000"
+#endif
#endif
#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 " \
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread* [U-Boot] [PATCH 2/3] arm : at91sam9x5 : enable serial flash boot
2012-08-16 4:44 ` [U-Boot] [PATCH 2/3] arm : at91sam9x5 : enable serial flash boot Bo Shen
@ 2012-08-16 7:36 ` Andreas Bießmann
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Bießmann @ 2012-08-16 7:36 UTC (permalink / raw)
To: u-boot
Dear Bo Shen,
On 16.08.2012 06:44, Bo Shen wrote:
> enable at91sam9x5 boot from serial flash
>
> Use at91sam9x5_dataflash to configure the u-boot
>
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
> arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 4 ++--
> boards.cfg | 1 +
> include/configs/at91sam9x5ek.h | 18 ++++++++++++++----
> 3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> index 7558ca2..6d77219 100644
> --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> @@ -121,7 +121,7 @@ void at91_serial2_hw_init(void)
> #ifdef CONFIG_ATMEL_SPI
> void at91_spi0_hw_init(unsigned long cs_mask)
> {
> - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
> + at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
>
> at91_set_a_periph(AT91_PIO_PORTA, 11, 0); /* SPI0_MISO */
> at91_set_a_periph(AT91_PIO_PORTA, 12, 0); /* SPI0_MOSI */
> @@ -150,7 +150,7 @@ void at91_spi0_hw_init(unsigned long cs_mask)
>
> void at91_spi1_hw_init(unsigned long cs_mask)
> {
> - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
> + at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
>
> at91_set_b_periph(AT91_PIO_PORTA, 21, 0); /* SPI1_MISO */
> at91_set_b_periph(AT91_PIO_PORTA, 22, 0); /* SPI1_MOSI */
I would like to see these two fixes in a separate patch 'fix spi access'
or something else.
rest of this patch looks sane to me.
Best regards
Andreas Bie?mann
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 3/3] arm : at91sam9x5 : fix a small bug for NAND
2012-08-16 4:44 [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
2012-08-16 4:44 ` [U-Boot] [PATCH 1/3] spi: add atmel at25df321 serial flash support Bo Shen
2012-08-16 4:44 ` [U-Boot] [PATCH 2/3] arm : at91sam9x5 : enable serial flash boot Bo Shen
@ 2012-08-16 4:44 ` Bo Shen
2012-08-17 9:26 ` Andreas Bießmann
2012-08-16 7:14 ` [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
3 siblings, 1 reply; 12+ messages in thread
From: Bo Shen @ 2012-08-16 4:44 UTC (permalink / raw)
To: u-boot
fix a bug:
when not boot from NAND, the NAND flash can not be detected.
Using this to fix it
Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
board/atmel/at91sam9x5ek/at91sam9x5ek.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 17db0fd..88b3478 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -60,6 +60,8 @@ static void at91sam9x5ek_nand_hw_init(void)
/* Enable CS3 */
csa = readl(&matrix->ebicsa);
csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA;
+ /* NAND flash on D16 */
+ csa |= AT91_MATRIX_NFD0_ON_D16;
writel(csa, &matrix->ebicsa);
/* Configure SMC CS3 for NAND/SmartMedia */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash
2012-08-16 4:44 [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
` (2 preceding siblings ...)
2012-08-16 4:44 ` [U-Boot] [PATCH 3/3] arm : at91sam9x5 : fix a small bug for NAND Bo Shen
@ 2012-08-16 7:14 ` Bo Shen
2012-08-16 7:37 ` Andreas Bießmann
3 siblings, 1 reply; 12+ messages in thread
From: Bo Shen @ 2012-08-16 7:14 UTC (permalink / raw)
To: u-boot
Hi Andreas,
On 8/16/2012 12:44, Bo Shen wrote:
> This series patches enable at91sam9x5 boot from serial flash
>
> Bo Shen (3):
> spi: add atmel at25db321 serial flash support
> arm : at91sam9x5 : enable serial flash boot
> arm : at91sam9x5 : make nand available when not boot from nand
>
Please don't take this serial patches.
I found the spi only works at 1MHz speed which is too slow.
I will resend it let it work at a higher speed.
BRs,
Bo Shen
> arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 4 ++--
> board/atmel/at91sam9x5ek/at91sam9x5ek.c | 2 ++
> boards.cfg | 1 +
> drivers/mtd/spi/atmel.c | 10 ++++++++++
> include/configs/at91sam9x5ek.h | 18 ++++++++++++++----
> 5 files changed, 29 insertions(+), 6 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread* [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash
2012-08-16 7:14 ` [U-Boot] [PATCH 0/3] Enable at91sam9x5 boot from serial flash Bo Shen
@ 2012-08-16 7:37 ` Andreas Bießmann
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Bießmann @ 2012-08-16 7:37 UTC (permalink / raw)
To: u-boot
Hi Bo,
On 16.08.2012 09:14, Bo Shen wrote:
> Hi Andreas,
>
> On 8/16/2012 12:44, Bo Shen wrote:
>> This series patches enable at91sam9x5 boot from serial flash
>>
>> Bo Shen (3):
>> spi: add atmel at25db321 serial flash support
>> arm : at91sam9x5 : enable serial flash boot
>> arm : at91sam9x5 : make nand available when not boot from nand
>>
>
> Please don't take this serial patches.
> I found the spi only works at 1MHz speed which is too slow.
> I will resend it let it work at a higher speed.
Ok, please split 2/3 into a 'fix spi' and a 'enable spi for <board>'
Best regards
Andreas Bie?mann
^ permalink raw reply [flat|nested] 12+ messages in thread