* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
@ 2016-03-09 23:18 Vikas Manocha
2016-03-09 23:18 ` [U-Boot] [RESEND 2/2] stm32f746-disco: enable flash support Vikas Manocha
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Vikas Manocha @ 2016-03-09 23:18 UTC (permalink / raw)
To: u-boot
Same flash driver can be used by other stm32 families like stm32f7.
Better place for this driver would be mtd driver location.
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
arch/arm/include/asm/arch-stm32f4/stm32.h | 31 ++++++-------------
arch/arm/mach-stm32/stm32f4/Makefile | 2 +-
arch/arm/mach-stm32/stm32f4/clock.c | 10 +------
drivers/mtd/Makefile | 1 +
.../stm32f4/flash.c => drivers/mtd/stm32_flash.c | 35 +++++++++++-----------
drivers/mtd/stm32_flash.h | 27 +++++++++++++++++
include/configs/stm32f429-discovery.h | 1 +
include/flash.h | 2 +-
8 files changed, 59 insertions(+), 50 deletions(-)
rename arch/arm/mach-stm32/stm32f4/flash.c => drivers/mtd/stm32_flash.c (82%)
create mode 100644 drivers/mtd/stm32_flash.h
diff --git a/arch/arm/include/asm/arch-stm32f4/stm32.h b/arch/arm/include/asm/arch-stm32f4/stm32.h
index 7d6331b..6cc1966 100644
--- a/arch/arm/include/asm/arch-stm32f4/stm32.h
+++ b/arch/arm/include/asm/arch-stm32f4/stm32.h
@@ -82,16 +82,6 @@ struct stm32_pwr_regs {
u32 csr;
};
-struct stm32_flash_regs {
- u32 acr;
- u32 key;
- u32 optkeyr;
- u32 sr;
- u32 cr;
- u32 optcr;
- u32 optcr1;
-};
-
/*
* Registers access macros
*/
@@ -104,18 +94,6 @@ struct stm32_flash_regs {
#define STM32_PWR_BASE (STM32_APB1PERIPH_BASE + 0x7000)
#define STM32_PWR ((struct stm32_pwr_regs *)STM32_PWR_BASE)
-#define STM32_FLASH_BASE (STM32_AHB1PERIPH_BASE + 0x3C00)
-#define STM32_FLASH ((struct stm32_flash_regs *)STM32_FLASH_BASE)
-
-#define STM32_FLASH_SR_BSY (1 << 16)
-
-#define STM32_FLASH_CR_PG (1 << 0)
-#define STM32_FLASH_CR_SER (1 << 1)
-#define STM32_FLASH_CR_STRT (1 << 16)
-#define STM32_FLASH_CR_LOCK (1 << 31)
-#define STM32_FLASH_CR_SNB_OFFSET 3
-#define STM32_FLASH_CR_SNB_MASK (15 << STM32_FLASH_CR_SNB_OFFSET)
-
/*
* Peripheral base addresses
*/
@@ -124,6 +102,14 @@ struct stm32_flash_regs {
#define STM32_USART3_BASE (STM32_APB1PERIPH_BASE + 0x4800)
#define STM32_USART6_BASE (STM32_APB2PERIPH_BASE + 0x1400)
+#define FLASH_CNTL_BASE (STM32_AHB1PERIPH_BASE + 0x3C00)
+
+static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
+ [0 ... 3] = 16 * 1024,
+ [4] = 64 * 1024,
+ [5 ... 11] = 128 * 1024
+};
+
enum clock {
CLOCK_CORE,
CLOCK_AHB,
@@ -133,5 +119,6 @@ enum clock {
int configure_clocks(void);
unsigned long clock_get(enum clock clck);
+void stm32_flash_latency_cfg(int latency);
#endif /* _MACH_STM32_H_ */
diff --git a/arch/arm/mach-stm32/stm32f4/Makefile b/arch/arm/mach-stm32/stm32f4/Makefile
index 42d01db..020e783 100644
--- a/arch/arm/mach-stm32/stm32f4/Makefile
+++ b/arch/arm/mach-stm32/stm32f4/Makefile
@@ -8,4 +8,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += soc.o clock.o timer.o flash.o
+obj-y += soc.o clock.o timer.o
diff --git a/arch/arm/mach-stm32/stm32f4/clock.c b/arch/arm/mach-stm32/stm32f4/clock.c
index 631f36a..15fcadb 100644
--- a/arch/arm/mach-stm32/stm32f4/clock.c
+++ b/arch/arm/mach-stm32/stm32f4/clock.c
@@ -66,11 +66,6 @@
#define PWR_CR_VOS_SCALE_MODE_2 (PWR_CR_VOS1)
#define PWR_CR_VOS_SCALE_MODE_3 (PWR_CR_VOS0)
-#define FLASH_ACR_WS(n) n
-#define FLASH_ACR_PRFTEN (1 << 8)
-#define FLASH_ACR_ICEN (1 << 9)
-#define FLASH_ACR_DCEN (1 << 10)
-
/*
* RCC GPIO specific definitions
*/
@@ -181,10 +176,7 @@ int configure_clocks(void)
while (!(readl(&STM32_RCC->cr) & RCC_CR_PLLRDY))
;
- /* 5 wait states, Prefetch enabled, D-Cache enabled, I-Cache enabled */
- writel(FLASH_ACR_WS(5) | FLASH_ACR_PRFTEN | FLASH_ACR_ICEN
- | FLASH_ACR_DCEN, &STM32_FLASH->acr);
-
+ stm32_flash_latency_cfg(5);
clrbits_le32(&STM32_RCC->cfgr, (RCC_CFGR_SW0 | RCC_CFGR_SW1));
setbits_le32(&STM32_RCC->cfgr, RCC_CFGR_SW_PLL);
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 7f018a4..703700a 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_FTSMC020) += ftsmc020.o
obj-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
obj-$(CONFIG_MW_EEPROM) += mw_eeprom.o
obj-$(CONFIG_ST_SMI) += st_smi.o
+obj-$(CONFIG_STM32_FLASH) += stm32_flash.o
diff --git a/arch/arm/mach-stm32/stm32f4/flash.c b/drivers/mtd/stm32_flash.c
similarity index 82%
rename from arch/arm/mach-stm32/stm32f4/flash.c
rename to drivers/mtd/stm32_flash.c
index a379f47..71f4854 100644
--- a/arch/arm/mach-stm32/stm32f4/flash.c
+++ b/drivers/mtd/stm32_flash.c
@@ -8,19 +8,20 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/stm32.h>
-
-#define STM32_FLASH_KEY1 0x45670123
-#define STM32_FLASH_KEY2 0xCDEF89AB
+#include "stm32_flash.h"
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
- [0 ... 3] = 16 * 1024,
- [4] = 64 * 1024,
- [5 ... 11] = 128 * 1024
-};
+#define STM32_FLASH ((struct stm32_flash_regs *)FLASH_CNTL_BASE)
+
+void stm32_flash_latency_cfg(int latency)
+{
+ /* 5 wait states, Prefetch enabled, D-Cache enabled, I-Cache enabled */
+ writel(FLASH_ACR_WS(5) | FLASH_ACR_PRFTEN | FLASH_ACR_ICEN
+ | FLASH_ACR_DCEN, &STM32_FLASH->acr);
+}
-static void stm32f4_flash_lock(u8 lock)
+static void stm32_flash_lock(u8 lock)
{
if (lock) {
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_LOCK);
@@ -36,7 +37,7 @@ unsigned long flash_init(void)
u8 i, j;
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
- flash_info[i].flash_id = FLASH_STM32F4;
+ flash_info[i].flash_id = FLASH_STM32;
flash_info[i].sector_count = CONFIG_SYS_MAX_FLASH_SECT;
flash_info[i].start[0] = CONFIG_SYS_FLASH_BASE + (i << 20);
flash_info[i].size = sect_sz_kb[0];
@@ -58,8 +59,8 @@ void flash_print_info(flash_info_t *info)
if (info->flash_id == FLASH_UNKNOWN) {
printf("missing or unknown FLASH type\n");
return;
- } else if (info->flash_id == FLASH_STM32F4) {
- printf("STM32F4 Embedded Flash\n");
+ } else if (info->flash_id == FLASH_STM32) {
+ printf("stm32 Embedded Flash\n");
}
printf(" Size: %ld MB in %d Sectors\n",
@@ -91,7 +92,7 @@ int flash_erase(flash_info_t *info, int first, int last)
if (bank == 0xFF)
return -1;
- stm32f4_flash_lock(0);
+ stm32_flash_lock(0);
for (i = first; i <= last; i++) {
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY)
@@ -107,7 +108,7 @@ int flash_erase(flash_info_t *info, int first, int last)
setbits_le32(&STM32_FLASH->cr,
((0x10 | i) << STM32_FLASH_CR_SNB_OFFSET));
} else {
- stm32f4_flash_lock(1);
+ stm32_flash_lock(1);
return -1;
}
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_SER);
@@ -119,7 +120,7 @@ int flash_erase(flash_info_t *info, int first, int last)
clrbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_SER);
}
- stm32f4_flash_lock(1);
+ stm32_flash_lock(1);
return 0;
}
@@ -130,7 +131,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY)
;
- stm32f4_flash_lock(0);
+ stm32_flash_lock(0);
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_PG);
/* To make things simple use byte writes only */
@@ -140,7 +141,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
;
}
clrbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_PG);
- stm32f4_flash_lock(1);
+ stm32_flash_lock(1);
return 0;
}
diff --git a/drivers/mtd/stm32_flash.h b/drivers/mtd/stm32_flash.h
new file mode 100644
index 0000000..8cb81ef
--- /dev/null
+++ b/drivers/mtd/stm32_flash.h
@@ -0,0 +1,27 @@
+struct stm32_flash_regs {
+ u32 acr;
+ u32 key;
+ u32 optkeyr;
+ u32 sr;
+ u32 cr;
+ u32 optcr;
+ u32 optcr1;
+};
+
+#define STM32_FLASH_KEY1 0x45670123
+#define STM32_FLASH_KEY2 0xCDEF89AB
+
+#define STM32_FLASH_SR_BSY (1 << 16)
+
+#define STM32_FLASH_CR_PG (1 << 0)
+#define STM32_FLASH_CR_SER (1 << 1)
+#define STM32_FLASH_CR_STRT (1 << 16)
+#define STM32_FLASH_CR_LOCK (1 << 31)
+#define STM32_FLASH_CR_SNB_OFFSET 3
+#define STM32_FLASH_CR_SNB_MASK (15 << STM32_FLASH_CR_SNB_OFFSET)
+
+/* Flash ACR: Access control register */
+#define FLASH_ACR_WS(n) n
+#define FLASH_ACR_PRFTEN (1 << 8)
+#define FLASH_ACR_ICEN (1 << 9)
+#define FLASH_ACR_DCEN (1 << 10)
diff --git a/include/configs/stm32f429-discovery.h b/include/configs/stm32f429-discovery.h
index 85d492d..87901e8 100644
--- a/include/configs/stm32f429-discovery.h
+++ b/include/configs/stm32f429-discovery.h
@@ -49,6 +49,7 @@
#define CONFIG_GREEN_LED 109
#define CONFIG_STM32_GPIO
+#define CONFIG_STM32_FLASH
#define CONFIG_STM32_SERIAL
#define CONFIG_STM32_HSE_HZ 8000000
diff --git a/include/flash.h b/include/flash.h
index f53ace7..c6321a0 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -465,7 +465,7 @@ extern flash_info_t *flash_get_info(ulong base);
#define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
#define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
-#define FLASH_STM32F4 0x00F2 /* STM32F4 Embedded Flash */
+#define FLASH_STM32 0x00F2 /* STM32 Embedded Flash */
#define FLASH_STM32F1 0x00F3 /* STM32F1 Embedded Flash */
#define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [RESEND 2/2] stm32f746-disco: enable flash support
2016-03-09 23:18 [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Vikas Manocha
@ 2016-03-09 23:18 ` Vikas Manocha
2016-03-27 22:23 ` [U-Boot] [U-Boot, RESEND, " Tom Rini
2016-03-10 2:52 ` [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Jagan Teki
2016-03-27 22:23 ` [U-Boot] [U-Boot, RESEND, " Tom Rini
2 siblings, 1 reply; 14+ messages in thread
From: Vikas Manocha @ 2016-03-09 23:18 UTC (permalink / raw)
To: u-boot
This patch enables embedded flash for stm32f746 discovery board.
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
arch/arm/include/asm/arch-stm32f7/stm32.h | 6 ++++++
include/configs/stm32f746-disco.h | 11 ++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/arm/include/asm/arch-stm32f7/stm32.h b/arch/arm/include/asm/arch-stm32f7/stm32.h
index 713eb2e..68bdab0 100644
--- a/arch/arm/include/asm/arch-stm32f7/stm32.h
+++ b/arch/arm/include/asm/arch-stm32f7/stm32.h
@@ -50,6 +50,12 @@
#define SDRAM_FMC_BASE (AHB3_PERIPH_BASE + 0x4A0000140)
+static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
+ [0 ... 3] = 32 * 1024,
+ [4] = 128 * 1024,
+ [5 ... 7] = 256 * 1024
+};
+
enum clock {
CLOCK_CORE,
CLOCK_AHB,
diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h
index e1b8bcb..807ab65 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -9,7 +9,7 @@
#define __CONFIG_H
#define CONFIG_SYS_THUMB_BUILD
-#define CONFIG_SYS_NO_FLASH
+/*#define CONFIG_SYS_NO_FLASH*/
#define CONFIG_OF_LIBFDT
#define CONFIG_BOARD_EARLY_INIT_F
@@ -33,17 +33,14 @@
#define CONFIG_SYS_LOAD_ADDR 0x20000000
#define CONFIG_LOADADDR 0x20000000
-#define CONFIG_SYS_MAX_FLASH_SECT 12
-#define CONFIG_SYS_MAX_FLASH_BANKS 2
+#define CONFIG_SYS_MAX_FLASH_SECT 8
+#define CONFIG_SYS_MAX_FLASH_BANKS 1
-#ifndef CONFIG_SYS_NO_FLASH
-#define CONFIG_ENV_IS_IN_FLASH
-#else
#define CONFIG_ENV_IS_NOWHERE
-#endif
#define CONFIG_ENV_SIZE (8 << 10)
#define CONFIG_STM32_GPIO
+#define CONFIG_STM32_FLASH
#define CONFIG_STM32X7_SERIAL
#define CONFIG_SYS_CLK_FREQ 16*1000*1000 /* 180 MHz */
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-09 23:18 [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Vikas Manocha
2016-03-09 23:18 ` [U-Boot] [RESEND 2/2] stm32f746-disco: enable flash support Vikas Manocha
@ 2016-03-10 2:52 ` Jagan Teki
2016-03-10 4:18 ` Vikas MANOCHA
2016-03-27 22:23 ` [U-Boot] [U-Boot, RESEND, " Tom Rini
2 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2016-03-10 2:52 UTC (permalink / raw)
To: u-boot
On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
> Same flash driver can be used by other stm32 families like stm32f7.
> Better place for this driver would be mtd driver location.
What kind of flash is it, parallel or serial NOR?
>
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
> ---
> arch/arm/include/asm/arch-stm32f4/stm32.h | 31 ++++++-------------
> arch/arm/mach-stm32/stm32f4/Makefile | 2 +-
> arch/arm/mach-stm32/stm32f4/clock.c | 10 +------
> drivers/mtd/Makefile | 1 +
> .../stm32f4/flash.c => drivers/mtd/stm32_flash.c | 35 +++++++++++-----------
> drivers/mtd/stm32_flash.h | 27 +++++++++++++++++
> include/configs/stm32f429-discovery.h | 1 +
> include/flash.h | 2 +-
> 8 files changed, 59 insertions(+), 50 deletions(-)
> rename arch/arm/mach-stm32/stm32f4/flash.c => drivers/mtd/stm32_flash.c (82%)
> create mode 100644 drivers/mtd/stm32_flash.h
--
Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 2:52 ` [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Jagan Teki
@ 2016-03-10 4:18 ` Vikas MANOCHA
2016-03-10 5:01 ` jteki at openedev.com
0 siblings, 1 reply; 14+ messages in thread
From: Vikas MANOCHA @ 2016-03-10 4:18 UTC (permalink / raw)
To: u-boot
Hi Jagan ,
> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
>
>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
>> Same flash driver can be used by other stm32 families like stm32f7.
>> Better place for this driver would be mtd driver location.
>
> What kind of flash is it, parallel or serial NOR?
It is embedded 256 bit NOR flash.
Cheers,
Vikas
>
>>
>> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
>> ---
>> arch/arm/include/asm/arch-stm32f4/stm32.h | 31 ++++++-------------
>> arch/arm/mach-stm32/stm32f4/Makefile | 2 +-
>> arch/arm/mach-stm32/stm32f4/clock.c | 10 +------
>> drivers/mtd/Makefile | 1 +
>> .../stm32f4/flash.c => drivers/mtd/stm32_flash.c | 35 +++++++++++-----------
>> drivers/mtd/stm32_flash.h | 27 +++++++++++++++++
>> include/configs/stm32f429-discovery.h | 1 +
>> include/flash.h | 2 +-
>> 8 files changed, 59 insertions(+), 50 deletions(-)
>> rename arch/arm/mach-stm32/stm32f4/flash.c => drivers/mtd/stm32_flash.c (82%)
>> create mode 100644 drivers/mtd/stm32_flash.h
>
> --
> Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 4:18 ` Vikas MANOCHA
@ 2016-03-10 5:01 ` jteki at openedev.com
2016-03-10 17:41 ` Vikas MANOCHA
0 siblings, 1 reply; 14+ messages in thread
From: jteki at openedev.com @ 2016-03-10 5:01 UTC (permalink / raw)
To: u-boot
On 2016-03-09 23:18, Vikas MANOCHA wrote:
> Hi Jagan ,
>
>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
>>
>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
>>> Same flash driver can be used by other stm32 families like stm32f7.
>>> Better place for this driver would be mtd driver location.
>>
>> What kind of flash is it, parallel or serial NOR?
>
> It is embedded 256 bit NOR flash.
OK, I thought it's similar to SST25L.
Can't we detect this through cfi_flash framework?
--
Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 5:01 ` jteki at openedev.com
@ 2016-03-10 17:41 ` Vikas MANOCHA
2016-03-10 17:46 ` Jagan Teki
0 siblings, 1 reply; 14+ messages in thread
From: Vikas MANOCHA @ 2016-03-10 17:41 UTC (permalink / raw)
To: u-boot
Hi Jagan,
> -----Original Message-----
> From: jteki at openedev.com [mailto:jteki at openedev.com]
> Sent: Wednesday, March 09, 2016 9:02 PM
> To: Vikas MANOCHA
> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
> Roese; Thomas Chou; Vadzim Dambrouski
> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
> location
>
> On 2016-03-09 23:18, Vikas MANOCHA wrote:
> > Hi Jagan ,
> >
> >> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
> >>
> >>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
> >>> Same flash driver can be used by other stm32 families like stm32f7.
> >>> Better place for this driver would be mtd driver location.
> >>
> >> What kind of flash is it, parallel or serial NOR?
> >
> > It is embedded 256 bit NOR flash.
>
> OK, I thought it's similar to SST25L.
>
> Can't we detect this through cfi_flash framework?
No, it is not possible.
Cheers,
Vikas
>
> --
> Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 17:41 ` Vikas MANOCHA
@ 2016-03-10 17:46 ` Jagan Teki
2016-03-10 17:52 ` Vikas MANOCHA
0 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2016-03-10 17:46 UTC (permalink / raw)
To: u-boot
On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
> Hi Jagan,
>
>> -----Original Message-----
>> From: jteki at openedev.com [mailto:jteki at openedev.com]
>> Sent: Wednesday, March 09, 2016 9:02 PM
>> To: Vikas MANOCHA
>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
>> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
>> Roese; Thomas Chou; Vadzim Dambrouski
>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
>> location
>>
>> On 2016-03-09 23:18, Vikas MANOCHA wrote:
>>> Hi Jagan ,
>>>
>>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
>>>>
>>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
>>>>> Same flash driver can be used by other stm32 families like stm32f7.
>>>>> Better place for this driver would be mtd driver location.
>>>>
>>>> What kind of flash is it, parallel or serial NOR?
>>>
>>> It is embedded 256 bit NOR flash.
>>
>> OK, I thought it's similar to SST25L.
>>
>> Can't we detect this through cfi_flash framework?
>
> No, it is not possible.
Sorry, please add some details why it couldn't?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 17:46 ` Jagan Teki
@ 2016-03-10 17:52 ` Vikas MANOCHA
2016-03-10 17:58 ` Jagan Teki
0 siblings, 1 reply; 14+ messages in thread
From: Vikas MANOCHA @ 2016-03-10 17:52 UTC (permalink / raw)
To: u-boot
Hi,
> -----Original Message-----
> From: Jagan Teki [mailto:jteki at openedev.com]
> Sent: Thursday, March 10, 2016 9:46 AM
> To: Vikas MANOCHA
> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
> Roese; Thomas Chou; Vadzim Dambrouski
> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
> location
>
> On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
> > Hi Jagan,
> >
> >> -----Original Message-----
> >> From: jteki at openedev.com [mailto:jteki at openedev.com]
> >> Sent: Wednesday, March 09, 2016 9:02 PM
> >> To: Vikas MANOCHA
> >> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
> >> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
> >> driver location
> >>
> >> On 2016-03-09 23:18, Vikas MANOCHA wrote:
> >>> Hi Jagan ,
> >>>
> >>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
> >>>>
> >>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
> >>>>> Same flash driver can be used by other stm32 families like stm32f7.
> >>>>> Better place for this driver would be mtd driver location.
> >>>>
> >>>> What kind of flash is it, parallel or serial NOR?
> >>>
> >>> It is embedded 256 bit NOR flash.
> >>
> >> OK, I thought it's similar to SST25L.
> >>
> >> Can't we detect this through cfi_flash framework?
> >
> > No, it is not possible.
>
> Sorry, please add some details why it couldn't?
The embedded flash in stm32 is not cfi flash. Cfi tables to find the flash characteristics are not implemented.
Cheers,
Vikas
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 17:52 ` Vikas MANOCHA
@ 2016-03-10 17:58 ` Jagan Teki
2016-03-10 18:17 ` Vikas MANOCHA
0 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2016-03-10 17:58 UTC (permalink / raw)
To: u-boot
On Thursday 10 March 2016 11:22 PM, Vikas MANOCHA wrote:
> Hi,
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jteki at openedev.com]
>> Sent: Thursday, March 10, 2016 9:46 AM
>> To: Vikas MANOCHA
>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
>> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
>> Roese; Thomas Chou; Vadzim Dambrouski
>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
>> location
>>
>> On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
>>> Hi Jagan,
>>>
>>>> -----Original Message-----
>>>> From: jteki at openedev.com [mailto:jteki at openedev.com]
>>>> Sent: Wednesday, March 09, 2016 9:02 PM
>>>> To: Vikas MANOCHA
>>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
>>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
>>>> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
>>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
>>>> driver location
>>>>
>>>> On 2016-03-09 23:18, Vikas MANOCHA wrote:
>>>>> Hi Jagan ,
>>>>>
>>>>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com> wrote:
>>>>>>
>>>>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
>>>>>>> Same flash driver can be used by other stm32 families like stm32f7.
>>>>>>> Better place for this driver would be mtd driver location.
>>>>>>
>>>>>> What kind of flash is it, parallel or serial NOR?
>>>>>
>>>>> It is embedded 256 bit NOR flash.
>>>>
>>>> OK, I thought it's similar to SST25L.
>>>>
>>>> Can't we detect this through cfi_flash framework?
>>>
>>> No, it is not possible.
>>
>> Sorry, please add some details why it couldn't?
>
> The embedded flash in stm32 is not cfi flash. Cfi tables to find the flash characteristics are not implemented.
OK, all your saying that this not quite exactly a cfi, different kind
wrt sst32. true? then please convert this into MTD driver model format.
If needed take an example of existing MTD uclass driver.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 17:58 ` Jagan Teki
@ 2016-03-10 18:17 ` Vikas MANOCHA
2016-03-10 18:38 ` Jagan Teki
0 siblings, 1 reply; 14+ messages in thread
From: Vikas MANOCHA @ 2016-03-10 18:17 UTC (permalink / raw)
To: u-boot
Hi Jagan,
> -----Original Message-----
> From: Jagan Teki [mailto:jteki at openedev.com]
> Sent: Thursday, March 10, 2016 9:58 AM
> To: Vikas MANOCHA
> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
> Roese; Thomas Chou; Vadzim Dambrouski
> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
> location
>
> On Thursday 10 March 2016 11:22 PM, Vikas MANOCHA wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Jagan Teki [mailto:jteki at openedev.com]
> >> Sent: Thursday, March 10, 2016 9:46 AM
> >> To: Vikas MANOCHA
> >> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
> >> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
> >> driver location
> >>
> >> On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
> >>> Hi Jagan,
> >>>
> >>>> -----Original Message-----
> >>>> From: jteki at openedev.com [mailto:jteki at openedev.com]
> >>>> Sent: Wednesday, March 09, 2016 9:02 PM
> >>>> To: Vikas MANOCHA
> >>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
> >>>> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
> >>>> driver location
> >>>>
> >>>> On 2016-03-09 23:18, Vikas MANOCHA wrote:
> >>>>> Hi Jagan ,
> >>>>>
> >>>>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com>
> wrote:
> >>>>>>
> >>>>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
> >>>>>>> Same flash driver can be used by other stm32 families like stm32f7.
> >>>>>>> Better place for this driver would be mtd driver location.
> >>>>>>
> >>>>>> What kind of flash is it, parallel or serial NOR?
> >>>>>
> >>>>> It is embedded 256 bit NOR flash.
> >>>>
> >>>> OK, I thought it's similar to SST25L.
> >>>>
> >>>> Can't we detect this through cfi_flash framework?
> >>>
> >>> No, it is not possible.
> >>
> >> Sorry, please add some details why it couldn't?
> >
> > The embedded flash in stm32 is not cfi flash. Cfi tables to find the flash
> characteristics are not implemented.
>
> OK, all your saying that this not quite exactly a cfi, different kind wrt sst32.
> true?
Yes, flash is embedded in the stm32 micro & details like data width etc are not relevant for the user.
Sst32 ? , sorry but I am not aware of it and sst32L.
>then please convert this into MTD driver model format.
>
> If needed take an example of existing MTD uclass driver.
Can you please point me to it ?
Cheers,
Vikas
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 18:17 ` Vikas MANOCHA
@ 2016-03-10 18:38 ` Jagan Teki
2016-03-21 21:53 ` Vikas MANOCHA
0 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2016-03-10 18:38 UTC (permalink / raw)
To: u-boot
On Thursday 10 March 2016 11:47 PM, Vikas MANOCHA wrote:
> Hi Jagan,
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jteki at openedev.com]
>> Sent: Thursday, March 10, 2016 9:58 AM
>> To: Vikas MANOCHA
>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
>> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
>> Roese; Thomas Chou; Vadzim Dambrouski
>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
>> location
>>
>> On Thursday 10 March 2016 11:22 PM, Vikas MANOCHA wrote:
>>> Hi,
>>>
>>>> -----Original Message-----
>>>> From: Jagan Teki [mailto:jteki at openedev.com]
>>>> Sent: Thursday, March 10, 2016 9:46 AM
>>>> To: Vikas MANOCHA
>>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
>>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
>>>> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
>>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
>>>> driver location
>>>>
>>>> On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
>>>>> Hi Jagan,
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: jteki at openedev.com [mailto:jteki at openedev.com]
>>>>>> Sent: Wednesday, March 09, 2016 9:02 PM
>>>>>> To: Vikas MANOCHA
>>>>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
>>>>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
>>>>>> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
>>>>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
>>>>>> driver location
>>>>>>
>>>>>> On 2016-03-09 23:18, Vikas MANOCHA wrote:
>>>>>>> Hi Jagan ,
>>>>>>>
>>>>>>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com>
>> wrote:
>>>>>>>>
>>>>>>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
>>>>>>>>> Same flash driver can be used by other stm32 families like stm32f7.
>>>>>>>>> Better place for this driver would be mtd driver location.
>>>>>>>>
>>>>>>>> What kind of flash is it, parallel or serial NOR?
>>>>>>>
>>>>>>> It is embedded 256 bit NOR flash.
>>>>>>
>>>>>> OK, I thought it's similar to SST25L.
>>>>>>
>>>>>> Can't we detect this through cfi_flash framework?
>>>>>
>>>>> No, it is not possible.
>>>>
>>>> Sorry, please add some details why it couldn't?
>>>
>>> The embedded flash in stm32 is not cfi flash. Cfi tables to find the flash
>> characteristics are not implemented.
>>
>> OK, all your saying that this not quite exactly a cfi, different kind wrt sst32.
>> true?
>
> Yes, flash is embedded in the stm32 micro & details like data width etc are not relevant for the user.
> Sst32 ? , sorry but I am not aware of it and sst32L.
>
>> then please convert this into MTD driver model format.
>>
>> If needed take an example of existing MTD uclass driver.
>
> Can you please point me to it ?
The board your using with this driver has fdt and dm support?
If so, it is quite straight forward, take an example of this
drivers/mtd/altera_qspi.c
- register with MTD_UCLASS
- add your erase/write and read ops through mtd_ops
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-10 18:38 ` Jagan Teki
@ 2016-03-21 21:53 ` Vikas MANOCHA
0 siblings, 0 replies; 14+ messages in thread
From: Vikas MANOCHA @ 2016-03-21 21:53 UTC (permalink / raw)
To: u-boot
Hi Jagan,
> -----Original Message-----
> From: Jagan Teki [mailto:jteki at openedev.com]
> Sent: Thursday, March 10, 2016 10:38 AM
> To: Vikas MANOCHA
> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko Schocher;
> Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon Glass; Stefan
> Roese; Thomas Chou; Vadzim Dambrouski
> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver
> location
>
> On Thursday 10 March 2016 11:47 PM, Vikas MANOCHA wrote:
> > Hi Jagan,
> >
> >> -----Original Message-----
> >> From: Jagan Teki [mailto:jteki at openedev.com]
> >> Sent: Thursday, March 10, 2016 9:58 AM
> >> To: Vikas MANOCHA
> >> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
> >> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
> >> driver location
> >>
> >> On Thursday 10 March 2016 11:22 PM, Vikas MANOCHA wrote:
> >>> Hi,
> >>>
> >>>> -----Original Message-----
> >>>> From: Jagan Teki [mailto:jteki at openedev.com]
> >>>> Sent: Thursday, March 10, 2016 9:46 AM
> >>>> To: Vikas MANOCHA
> >>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood; Simon
> >>>> Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to mtd
> >>>> driver location
> >>>>
> >>>> On Thursday 10 March 2016 11:11 PM, Vikas MANOCHA wrote:
> >>>>> Hi Jagan,
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: jteki at openedev.com [mailto:jteki at openedev.com]
> >>>>>> Sent: Wednesday, March 09, 2016 9:02 PM
> >>>>>> To: Vikas MANOCHA
> >>>>>> Cc: u-boot at lists.denx.de; Albert Aribaud; Antonio Borneo; Heiko
> >>>>>> Schocher; Kamil Lulko; Matt Porter; rev13 at wp.pl; Scott Wood;
> >>>>>> Simon Glass; Stefan Roese; Thomas Chou; Vadzim Dambrouski
> >>>>>> Subject: Re: [RESEND 1/2] stm32: stm32f4: move flash driver to
> >>>>>> mtd driver location
> >>>>>>
> >>>>>> On 2016-03-09 23:18, Vikas MANOCHA wrote:
> >>>>>>> Hi Jagan ,
> >>>>>>>
> >>>>>>>> On Mar 9, 2016, at 6:53 PM, Jagan Teki <jteki@openedev.com>
> >> wrote:
> >>>>>>>>
> >>>>>>>>> On Thursday 10 March 2016 04:48 AM, Vikas Manocha wrote:
> >>>>>>>>> Same flash driver can be used by other stm32 families like
> stm32f7.
> >>>>>>>>> Better place for this driver would be mtd driver location.
> >>>>>>>>
> >>>>>>>> What kind of flash is it, parallel or serial NOR?
> >>>>>>>
> >>>>>>> It is embedded 256 bit NOR flash.
> >>>>>>
> >>>>>> OK, I thought it's similar to SST25L.
> >>>>>>
> >>>>>> Can't we detect this through cfi_flash framework?
> >>>>>
> >>>>> No, it is not possible.
> >>>>
> >>>> Sorry, please add some details why it couldn't?
> >>>
> >>> The embedded flash in stm32 is not cfi flash. Cfi tables to find the
> >>> flash
> >> characteristics are not implemented.
> >>
> >> OK, all your saying that this not quite exactly a cfi, different kind wrt sst32.
> >> true?
> >
> > Yes, flash is embedded in the stm32 micro & details like data width etc are
> not relevant for the user.
> > Sst32 ? , sorry but I am not aware of it and sst32L.
> >
> >> then please convert this into MTD driver model format.
> >>
> >> If needed take an example of existing MTD uclass driver.
> >
> > Can you please point me to it ?
>
> The board your using with this driver has fdt and dm support?
>
> If so, it is quite straight forward, take an example of this
> drivers/mtd/altera_qspi.c
>
> - register with MTD_UCLASS
> - add your erase/write and read ops through mtd_ops
Thanks for the pointer but what I am trying is to add (actually moving from stm32f4 area) the support for stm32 inbuilt flash memory e.g. to support flash operations required by flash commands like flinfo, erase, protect.
I am not looking to add mtd support, I just saw one similar example here ("st_smi" in drivers/mtd) & thought of putting stm32 flash driver also here.
The purpose is to make this driver available to other SOCs ( STM32s). Might be better place would be common area of arch/stm32...
Cheers,
Vikas
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [U-Boot, RESEND, 1/2] stm32: stm32f4: move flash driver to mtd driver location
2016-03-09 23:18 [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Vikas Manocha
2016-03-09 23:18 ` [U-Boot] [RESEND 2/2] stm32f746-disco: enable flash support Vikas Manocha
2016-03-10 2:52 ` [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Jagan Teki
@ 2016-03-27 22:23 ` Tom Rini
2 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2016-03-27 22:23 UTC (permalink / raw)
To: u-boot
On Wed, Mar 09, 2016 at 03:18:13PM -0800, Vikas Manocha wrote:
> Same flash driver can be used by other stm32 families like stm32f7.
> Better place for this driver would be mtd driver location.
>
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160327/d8a50cd1/attachment.sig>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-03-27 22:23 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 23:18 [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Vikas Manocha
2016-03-09 23:18 ` [U-Boot] [RESEND 2/2] stm32f746-disco: enable flash support Vikas Manocha
2016-03-27 22:23 ` [U-Boot] [U-Boot, RESEND, " Tom Rini
2016-03-10 2:52 ` [U-Boot] [RESEND 1/2] stm32: stm32f4: move flash driver to mtd driver location Jagan Teki
2016-03-10 4:18 ` Vikas MANOCHA
2016-03-10 5:01 ` jteki at openedev.com
2016-03-10 17:41 ` Vikas MANOCHA
2016-03-10 17:46 ` Jagan Teki
2016-03-10 17:52 ` Vikas MANOCHA
2016-03-10 17:58 ` Jagan Teki
2016-03-10 18:17 ` Vikas MANOCHA
2016-03-10 18:38 ` Jagan Teki
2016-03-21 21:53 ` Vikas MANOCHA
2016-03-27 22:23 ` [U-Boot] [U-Boot, RESEND, " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox