Aspeed SMC improvements
Subsystems (3)
v2 cover Aspeed SMC improvements
Hello,
Here is short serie improving the Aspeed SMC driver. There are a couple of fixes and also changes preparing ground for read optimization.
Patch 1 and 2 are fixes for the current driver. When merging all the code before sending a v1 to mainline, a few minor errors slipped through.
Patch 3 and 4 are cleanups.
Patch 5 and 6 should not have any impacts as we are not using DMAs or fast reads, yet.
Patch 7 is more important as the IO routines are completely reworked.
I dropped the patch activating command mode for read. It is broken on the witherspoon because the size of the flash module is larger than the maximum allowable segment window for a CS. It would nice to activate it when possible but this requires more checks.
I gave the patches a good test on a palmetto, an ast2500 evb and a witherspool and the overall result should be a v2 for upstream.
Cheers,
C.
Cédric Le Goater (7):
mtd: spi-nor: aspeed: fix setting of the register control value for
writes
mtd: spi-nor: aspeed: improve 4 bytes mode
mtd: spi-nor: aspeed: extend the bits definitions
mtd: spi-nor: aspeed: add some logging
mtd: spi-nor: aspeed: use smc_read mode when doing DMAs
mtd: spi-nor: aspeed: prepare for fast read
mtd: spi-nor: aspeed: rework io routines
drivers/mtd/spi-nor/aspeed-smc.c | 265 ++++++++++++++++++++++----------------- 1 file changed, 151 insertions(+), 114 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/7 mtd: spi-nor: aspeed: fix setting of the register control value for writes
The setting of the register control value for writes depends on the base value which was defined only if the mask applied to it changed the register control value.
Fix that.
---
I kept the info level because nothing wrong is happening. we are just possibly changing an optimized value for a non optimized value
drivers/mtd/spi-nor/aspeed-smc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +5 -4
@@ -756,7 +756,7 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip, {struct aspeed_smc_controller *controller = chip->controller;const struct aspeed_smc_info *info = controller->info; -u32 reg; +u32 reg, base_reg;/* * Always turn on the write enable bit to allow opcodes to be
@@ -789,12 +789,13 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip, reg =readl (chip->ctl);dev_dbg (controller->dev,"control register: %08x\n" , reg); -if ((reg &CONTROL_SPI_KEEP_MASK ) != reg) { - chip->ctl_val[smc_base] = reg &CONTROL_SPI_KEEP_MASK ; + base_reg = reg &CONTROL_SPI_KEEP_MASK ; +if (base_reg != reg) {dev_info (controller->dev,"control register changed to: %08x\n" , - chip->ctl_val[smc_base]); + base_reg); } + chip->ctl_val[smc_base] = base_reg;/* * Retain the prior value of the control register as the
Signature · 1 line
2.7.4
PATCH v2 3/7 mtd: spi-nor: aspeed: extend the bits definitions
In reply to Cédric Le Goater--- drivers/mtd/spi-nor/aspeed-smc.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +26 -6
@@ -261,16 +261,36 @@ struct aspeed_smc_controller { };/* -* FMC Type setting Register -* or -* SPI Flash Configuration Register +* SPI Flash Configuration Register (AST2400 SPI) */ #define CONFIG_REG 0x0 +#define CONFIG_ENABLE_CE_INACTIVE BIT(1) +#define CONFIG_WRITE BIT(0)/* -* CE Control Register +* SPI Flash Configuration Register (AST2500 SPI) +* Type setting Register (AST2500 FMC and AST2400 FMC) +*/ +#define TYPE_SETTING_REG 0x0 +#define CONFIG_DISABLE_LEGACY BIT(31)/* 1 on AST2500 FMC */ + +#define CONFIG_CE2_WRITE BIT(18) +#define CONFIG_CE1_WRITE BIT(17) +#define CONFIG_CE0_WRITE BIT(16) + +#define CONFIG_CE2_TYPE BIT(4)/* FMC only */ +#define CONFIG_CE1_TYPE BIT(2)/* FMC only */ +#define CONFIG_CE0_TYPE BIT(0)/* FMC only */ + +/* +* CE Control Register (AST2500 SPI,FMC and AST2400 FMC) */ #define CE_CONTROL_REG 0x4 +#define CE2_ENABLE_CE_INACTIVE BIT(10) +#define CE1_ENABLE_CE_INACTIVE BIT(9) +#define CE0_ENABLE_CE_INACTIVE BIT(8) +#define CE2_CONTROL_EXTENDED BIT(2) +#define CE1_CONTROL_EXTENDED BIT(1)#define CE0_CONTROL_EXTENDED BIT(0)/* CE0 Control Register (depends on the controller type) */
@@ -287,8 +307,8 @@ struct aspeed_smc_controller {#define CONTROL_SPI_DUMMY_CYCLE_COMMAND_OUTPUT BIT(15)#define CONTROL_SPI_IO_DUMMY_CYCLES_HI BIT(14)#define CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT (14 - 2) -#define CONTROL_SPI_IO_ADDRESS_4B BIT(13)/* 2400-smc */ -#define CONTROL_SPI_CLK_DIV4 BIT(13)/* FMC, 2500 */ +#define CONTROL_SPI_IO_ADDRESS_4B BIT(13)/* AST2400 SPI */ +#define CONTROL_SPI_CLK_DIV4 BIT(13)/* others */ #define CONTROL_SPI_RW_MERGE BIT(12)#define CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT 6#define CONTROL_SPI_IO_DUMMY_CYCLES_LO GENMASK(7, \
Signature · 1 line
2.7.4
PATCH v2 5/7 mtd: spi-nor: aspeed: use smc_read mode when doing DMAs
In reply to Cédric Le Goatersmc_base is to send commands. smc_read is for flash content accesses.
--- drivers/mtd/spi-nor/aspeed-smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +2 -2
@@ -405,7 +405,7 @@ static int aspeed_smc_dma_start(struct aspeed_smc_chip *chip,int ret;aspeed_smc_chip_configure (chip, is_write ? chip->ctl_val[smc_write] : - chip->ctl_val[smc_base]); + chip->ctl_val[smc_read]);dev_dbg (chip->nor.dev,"DMA %s to=0x%08x len=0x%08x\n" , is_write ?"write" :"read" , offset, length);
@@ -446,7 +446,7 @@ static int aspeed_smc_dma_start(struct aspeed_smc_chip *chip, controller->dma_addr, controller->dma_length, (is_write ? DMA_TO_DEVICE : DMA_FROM_DEVICE)); out: -aspeed_smc_chip_configure (chip, chip->ctl_val[smc_base]); +aspeed_smc_chip_configure (chip, chip->ctl_val[smc_read]);return ret; }
Signature · 1 line
2.7.4
PATCH v2 4/7 mtd: spi-nor: aspeed: add some logging
In reply to Cédric Le Goater--- drivers/mtd/spi-nor/aspeed-smc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +5 -4
@@ -759,8 +759,6 @@ static void aspeed_smc_chip_enable_write(struct aspeed_smc_chip *chip)u32 reg; reg =readl (controller->regs +CONFIG_REG ); -dev_dbg (controller->dev,"config reg @%p: 0x%08x\n" , - controller->regs +CONFIG_REG , reg); reg |=aspeed_smc_chip_write_bit (chip);writel (reg, controller->regs +CONFIG_REG );
@@ -772,8 +770,6 @@ static void aspeed_smc_chip_set_type(struct aspeed_smc_chip *chip, int type)u32 reg; reg =readl (controller->regs +CONFIG_REG ); -dev_dbg (controller->dev,"config reg @%p: 0x%08x\n" , - controller->regs +CONFIG_REG , reg); chip->type = type;
@@ -868,6 +864,8 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip, chip->ctl_val[smc_read] = chip->ctl_val[smc_base] |CONTROL_SPI_COMMAND_MODE_NORMAL ; +dev_dbg (controller->dev,"default control register: %08x\n" , + chip->ctl_val[smc_read]);return 0 ; }
@@ -883,6 +881,9 @@ static void aspeed_smc_chip_setup_finish(struct aspeed_smc_chip *chip)spi_control_fill_opcode (chip->nor.program_opcode) |CONTROL_SPI_COMMAND_MODE_WRITE ; +dev_dbg (controller->dev,"write control register: %08x\n" , + chip->ctl_val[smc_write]); +/* * XXX TODO * Enable fast read mode as required here.
Signature · 1 line
2.7.4
PATCH v2 2/7 mtd: spi-nor: aspeed: improve 4 bytes mode
In reply to Cédric Le GoaterThe AST2400 SPI flash uses the CE0 control register to set 4Byte mode and the AST2500 FMC and AST2400 FMC flash controllers use the CE Control register for this purpose or they are strapped by hardware.
Currently, the setting of the CE0 control register is done for all, which is incorrect, so fix that to keep only the AST2400 SPI. Luckily, the bogus setting has no impact on operations as bit 13 defines a SPI clock divisor.
---
Changes since v1 :
- added a set_4b() ops
- removed the use of SZ_16M
drivers/mtd/spi-nor/aspeed-smc.c | 62 +++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 20 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +42 -20
@@ -151,6 +151,8 @@ enum smc_flash_type { smc_type_spi = 2, /* controller connected to spi flash */ }; +struct aspeed_smc_chip ; +struct aspeed_smc_info {u32 maxsize;/* maximum size of 1 chip window */ u8 nce;/* number of chip enables */
@@ -160,8 +162,13 @@ struct aspeed_smc_info {u8 ctl0;/* offset in regs of ctl for ce 0 */ u8 time;/* offset in regs of timing */ u8 misc;/* offset in regs of misc settings */ + +void (*set_4b)(struct aspeed_smc_chip *chip); }; +static void aspeed_smc_chip_set_4b_smc_2400 (struct aspeed_smc_chip *chip); +static void aspeed_smc_chip_set_4b (struct aspeed_smc_chip *chip); +static const struct aspeed_smc_info fmc_2400_info = { .maxsize =64 *1024 *1024 , .nce =5 ,
@@ -171,6 +178,7 @@ static const struct aspeed_smc_info fmc_2400_info = { .ctl0 = 0x10, .time = 0x94, .misc = 0x54, + .set_4b = aspeed_smc_chip_set_4b, };static const struct aspeed_smc_info smc_2400_info = {
@@ -182,6 +190,7 @@ static const struct aspeed_smc_info smc_2400_info = { .ctl0 = 0x04, .time = 0x14, .misc = 0x10, + .set_4b = aspeed_smc_chip_set_4b_smc_2400, };static const struct aspeed_smc_info fmc_2500_info = {
@@ -193,6 +202,7 @@ static const struct aspeed_smc_info fmc_2500_info = { .ctl0 = 0x10, .time = 0x94, .misc = 0x54, + .set_4b = aspeed_smc_chip_set_4b, };static const struct aspeed_smc_info smc_2500_info = {
@@ -204,6 +214,7 @@ static const struct aspeed_smc_info smc_2500_info = { .ctl0 = 0x10, .time = 0x94, .misc = 0x54, + .set_4b = aspeed_smc_chip_set_4b, };enum smc_ctl_reg_value {
@@ -751,6 +762,34 @@ static void aspeed_smc_chip_set_type(struct aspeed_smc_chip *chip, int type)writel (reg, controller->regs +CONFIG_REG ); } +/* +* The AST2500 FMC and AST2400 FMC flash controllers should be +* strapped by hardware, or autodetected, but the AST2500 SPI flash +* needs to be set. +*/ +static void aspeed_smc_chip_set_4b (struct aspeed_smc_chip *chip) +{ +struct aspeed_smc_controller *controller = chip->controller; +u32 reg; + +if (chip->controller->info == &smc_2500_info) { + reg =readl (controller->regs +CE_CONTROL_REG ); + reg |=1 << chip->cs; +writel (reg, controller->regs +CE_CONTROL_REG ); + } +} + +/* +* The AST2400 SPI flash controller does not have a CE Control +* register. It uses the CE0 control register to set 4Byte mode at the +* controller level. +*/ +static void aspeed_smc_chip_set_4b_smc_2400 (struct aspeed_smc_chip *chip) +{ + chip->ctl_val[smc_base] |=CONTROL_SPI_IO_ADDRESS_4B ; + chip->ctl_val[smc_read] |=CONTROL_SPI_IO_ADDRESS_4B ; +} +static int aspeed_smc_chip_setup_init (struct aspeed_smc_chip *chip,struct resource *r) {
@@ -815,27 +854,10 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip,static void aspeed_smc_chip_setup_finish (struct aspeed_smc_chip *chip) {struct aspeed_smc_controller *controller = chip->controller; -u32 reg; - -/* -* Set 4 byte mode in the chip controller register and also in -* controller config register. The BMC flash controller is -* strapped by hardware, or autodetected, but the SPI flash -* controller of the AST2500 still needs to be set. -*/ -if (chip->nor.mtd.size >SZ_16M ) { - chip->ctl_val[smc_base] |=CONTROL_SPI_IO_ADDRESS_4B ; +const struct aspeed_smc_info *info = controller->info; -/* -* The SPI flash controller of the AST2400 does not -* have such a setting. -*/ -if (chip->controller->info == &smc_2500_info) { - reg =readl (controller->regs +CE_CONTROL_REG ); - reg |=1 << chip->cs; -writel (reg, controller->regs +CE_CONTROL_REG ); - } - } +if (chip->nor.addr_width ==4 && info->set_4b) + info->set_4b (chip); chip->ctl_val[smc_write] = chip->ctl_val[smc_base] | spi_control_fill_opcode(chip->nor.program_opcode) |
Signature · 1 line
2.7.4
PATCH v2 7/7 mtd: spi-nor: aspeed: rework io routines
In reply to Cédric Le GoaterThe io accessors from pflash are shorter and simpler.
---
Changes since v1:
- renamed the routine
drivers/mtd/spi-nor/aspeed-smc.c | 112 +++++++++++++-------------------------- 1 file changed, 38 insertions(+), 74 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +38 -74
@@ -65,84 +65,48 @@ module_param(dma_timeout, uint, 0644);* the memory buffer pointer and count via explicit code. The final updates * to len are optimistically suppressed. */ - -static void aspeed_smc_from_fifo (void *buf,const void __iomem *iop,size_t len) +static int aspeed_smc_read_from_ahb (void *buf,const void __iomem *src, +size_t len) { -if (!len) -return ; - -/* Expect a 4 byte input port. Otherwise just read bytes. */ -if (unlikely ((unsigned long )iop &3 )) { -while (len--) { - *(u8 *)buf =readb (iop); - buf++; +if ((((unsigned long ) src | (unsigned long ) buf | len) &3 ) ==0 ) { +while (len >3 ) { + *(u32 *) buf =readl (src); + buf +=4 ; + src +=4 ; + len -=4 ; } } -/* Align target to word: first byte then half word */ -if ((unsigned long )buf &1 ) { - *(u8 *)buf =readb (iop); - buf++; - len--; - } -if (((unsigned long )buf &2 ) && (len >=2 )) { - *(u16 *)buf =readw (iop); - buf +=2 ; - len -=2 ; - } - -/* Transfer words, then remaining halfword and remaining byte */ -while (len >=4 ) { - *(u32 *)buf =readl (iop); - buf +=4 ; - len -=4 ; - } -if (len &2 ) { - *(u16 *)buf =readw (iop); - buf +=2 ; +while (len--) { + *(u8 *) buf =readb (src); + buf +=1 ; + src +=1 ; } -if (len &1 ) - *(u8 *)buf =readb (iop); +return 0 ; } -static void aspeed_smc_to_fifo (void __iomem *iop,const void *buf,size_t len) +static int aspeed_smc_write_to_ahb (void __iomem *dst,const void *buf, +size_t len) { -if (!len) -return ; - -/* Expect a 4 byte output port. Otherwise just write bytes. */ -if ((unsigned long )iop &3 ) { -while (len--) { -writeb (*(u8 *)buf, iop); - buf++; +if ((((unsigned long ) dst | (unsigned long ) buf | len) &3 ) ==0 ) { +while (len >3 ) { +u32 val = *(u32 *) buf; + +writel (val, dst); + buf +=4 ; + dst +=4 ; + len -=4 ; } -return ; } -/* Align target to word: first byte then half word */ -if ((unsigned long )buf &1 ) { -writeb (*(u8 *)buf, iop); - buf++; - len--; - } -if (((unsigned long )buf &2 ) && (len >=2 )) { -writew (*(u16 *)buf, iop); - buf +=2 ; - len -=2 ; - } +while (len--) { +u8 val = *(u8 *) buf; -/* Transfer words, then remaining halfword and remaining byte */ -while (len >=4 ) { -writel (*(u32 *)buf, iop); - buf +=4 ; - len -=4 ; +writeb (val, dst); + buf +=1 ; + dst +=1 ; } -if (len &2 ) { -writew (*(u16 *)buf, iop); - buf +=2 ; - } -if (len &1 ) -writeb (*(u8 *)buf, iop); +return 0 ; }enum smc_flash_type {
@@ -518,8 +482,8 @@ static int aspeed_smc_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)mutex_lock (&chip->controller->mutex);aspeed_smc_start_user (nor); -aspeed_smc_to_fifo (chip->base, &opcode,1 ); -aspeed_smc_from_fifo (buf, chip->base, len); +aspeed_smc_write_to_ahb (chip->base, &opcode,1 ); +aspeed_smc_read_from_ahb (buf, chip->base, len);aspeed_smc_stop_user (nor);mutex_unlock (&chip->controller->mutex);
@@ -535,8 +499,8 @@ static int aspeed_smc_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf,mutex_lock (&chip->controller->mutex);aspeed_smc_start_user (nor); -aspeed_smc_to_fifo (chip->base, &opcode,1 ); -aspeed_smc_to_fifo (chip->base, buf, len); +aspeed_smc_write_to_ahb (chip->base, &opcode,1 ); +aspeed_smc_write_to_ahb (chip->base, buf, len);aspeed_smc_stop_user (nor);mutex_unlock (&chip->controller->mutex);
@@ -561,12 +525,12 @@ static void aspeed_smc_send_cmd_addr(struct spi_nor *nor, u8 cmd, u32 addr) cmdaddr |= (u32 )cmd <<24 ; temp =cpu_to_be32 (cmdaddr); -aspeed_smc_to_fifo (chip->base, &temp,4 ); +aspeed_smc_write_to_ahb (chip->base, &temp,4 );break ;case 4 : temp =cpu_to_be32 (addr); -aspeed_smc_to_fifo (chip->base, &cmd,1 ); -aspeed_smc_to_fifo (chip->base, &temp,4 ); +aspeed_smc_write_to_ahb (chip->base, &cmd,1 ); +aspeed_smc_write_to_ahb (chip->base, &temp,4 );break ; } }
@@ -593,7 +557,7 @@ static int aspeed_smc_read_user(struct spi_nor *nor, loff_t from, size_t len,aspeed_smc_start_user (nor);aspeed_smc_send_cmd_addr (nor, nor->read_opcode, from); -aspeed_smc_from_fifo (read_buf, chip->base, len); +aspeed_smc_read_from_ahb (read_buf, chip->base, len);aspeed_smc_stop_user (nor); out:
@@ -626,7 +590,7 @@ static void aspeed_smc_write_user(struct spi_nor *nor, loff_t to, size_t len,aspeed_smc_start_user (nor);aspeed_smc_send_cmd_addr (nor, nor->program_opcode, to); -aspeed_smc_to_fifo (chip->base, write_buf, len); +aspeed_smc_write_to_ahb (chip->base, write_buf, len);aspeed_smc_stop_user (nor); out:
Signature · 1 line
2.7.4
PATCH v2 6/7 mtd: spi-nor: aspeed: prepare for fast read
In reply to Cédric Le GoaterInclude dummy cycle in the control register value which will be required for fast read.
--- drivers/mtd/spi-nor/aspeed-smc.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-)
drivers/mtd/spi-nor/aspeed-smc.c +34 -5
@@ -306,7 +306,7 @@ struct aspeed_smc_controller {#define CONTROL_SPI_COMMAND_SHIFT 16#define CONTROL_SPI_DUMMY_CYCLE_COMMAND_OUTPUT BIT(15)#define CONTROL_SPI_IO_DUMMY_CYCLES_HI BIT(14) -#define CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT (14 - 2) +#define CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT 14#define CONTROL_SPI_IO_ADDRESS_4B BIT(13)/* AST2400 SPI */ #define CONTROL_SPI_CLK_DIV4 BIT(13)/* others */ #define CONTROL_SPI_RW_MERGE BIT(12)
@@ -315,6 +315,10 @@ struct aspeed_smc_controller { CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT)#define CONTROL_SPI_IO_DUMMY_CYCLES_MASK (CONTROL_SPI_IO_DUMMY_CYCLES_HI | \ CONTROL_SPI_IO_DUMMY_CYCLES_LO) +#define CONTROL_SPI_IO_DUMMY_CYCLES_SET (dummy) \ + (((((dummy) >> 2) & 0x1) << CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT) | \ + (((dummy) & 0x3) << CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT)) +#define CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT 8#define CONTROL_SPI_CLOCK_FREQ_SEL_MASK GENMASK(11, \ CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT)
@@ -869,14 +873,18 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip,return 0 ; } -static void aspeed_smc_chip_setup_finish (struct aspeed_smc_chip *chip) +static int aspeed_smc_chip_setup_finish (struct aspeed_smc_chip *chip) {struct aspeed_smc_controller *controller = chip->controller;const struct aspeed_smc_info *info = controller->info; +u32 cmd;if (chip->nor.addr_width ==4 && info->set_4b) info->set_4b (chip); +/* +* base mode has not been optimized yet. use it for writes. +*/ chip->ctl_val[smc_write] = chip->ctl_val[smc_base] |spi_control_fill_opcode (chip->nor.program_opcode) |CONTROL_SPI_COMMAND_MODE_WRITE ;
@@ -886,12 +894,29 @@ static void aspeed_smc_chip_setup_finish(struct aspeed_smc_chip *chip)/* * XXX TODO -* Enable fast read mode as required here. * Adjust clocks if fast read and write are supported. * Interpret spi-nor flags to adjust controller settings. * Check if resource size big enough for detected chip and * add support assisted (normal or fast-) read and dma. */ +switch (chip->nor.flash_read) { +case SPI_NOR_NORMAL : + cmd =CONTROL_SPI_COMMAND_MODE_NORMAL ; +break ; +case SPI_NOR_FAST : + cmd =CONTROL_SPI_COMMAND_MODE_FREAD ; +break ; +default : +dev_err (chip->nor.dev,"unsupported SPI read mode\n" ); +return -EINVAL ; + } + + chip->ctl_val[smc_read] |= cmd | +CONTROL_SPI_IO_DUMMY_CYCLES_SET (chip->nor.read_dummy /8 ); + +dev_dbg (controller->dev,"base control register: %08x\n" , + chip->ctl_val[smc_read]); +return 0 ; }static int aspeed_smc_probe (struct platform_device *pdev)
@@ -987,7 +1012,9 @@ static int aspeed_smc_probe(struct platform_device *pdev) chip->nor.read_reg = aspeed_smc_read_reg; chip->nor.write_reg = aspeed_smc_write_reg; -aspeed_smc_chip_setup_init (chip, r); + err =aspeed_smc_chip_setup_init (chip, r); +if (err) +continue ;/* * XXX Add support for SPI_NOR_QUAD and SPI_NOR_DUAL attach
@@ -997,7 +1024,9 @@ static int aspeed_smc_probe(struct platform_device *pdev)if (err)continue ; -aspeed_smc_chip_setup_finish (chip); + err =aspeed_smc_chip_setup_finish (chip); +if (err) +continue ; err =mtd_device_register (&chip->nor.mtd,NULL ,0 );if (err)
Signature · 1 line
2.7.4
Re: [PATCH v2 linux dev-4.7 1/7] mtd: spi-nor: aspeed: fix setting of the register control value for writes
In reply to Cédric Le GoaterQuoted 7 lines · Cédric Le Goater
The setting of the register control value for writes depends on the base value which was defined only if the mask applied to it changed the register control value.
Fix that.
Signed-off-by Cédric Le Goater <[email protected]>
Quoted 4 lines
---
I kept the info level because nothing wrong is happening. we are just possibly changing an optimized value for a non optimized value
Okay, thanks for the explanation.
Quoted 3 lines
drivers/mtd/spi-nor/aspeed-smc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Joel Stanley
maintainerRe: [PATCH v2 linux dev-4.7 2/7] mtd: spi-nor: aspeed: improve 4 bytes mode
In reply to Cédric Le GoaterQuoted 9 lines · Cédric Le Goater
The AST2400 SPI flash uses the CE0 control register to set 4Byte mode and the AST2500 FMC and AST2400 FMC flash controllers use the CE Control register for this purpose or they are strapped by hardware.
Currently, the setting of the CE0 control register is done for all, which is incorrect, so fix that to keep only the AST2400 SPI. Luckily, the bogus setting has no impact on operations as bit 13 defines a SPI clock divisor.
Quoted 7 lines
Signed-off-by Cédric Le Goater <[email protected]>---
Changes since v1 :
- added a
set_4b()ops
- removed the use ofSZ_16M
Nice. Now even I understand what it's doing.
Reviewed by: Joel Stanley <[email protected]>
Joel Stanley
maintainerQuoted 17 lines · Cédric Le Goater
Hello,
Here is short serie improving the Aspeed SMC driver. There are a couple of fixes and also changes preparing ground for read optimization.
Patch 1 and 2 are fixes for the current driver. When merging all the code before sending a v1 to mainline, a few minor errors slipped through.
Patch 3 and 4 are cleanups.
Patch 5 and 6 should not have any impacts as we are not using DMAs or fast reads, yet.
Patch 7 is more important as the IO routines are completely reworked.
Quoted 7 lines
I dropped the patch activating command mode for read. It is broken on the witherspoon because the size of the flash module is larger than the maximum allowable segment window for a CS. It would nice to activate it when possible but this requires more checks.
I gave the patches a good test on a palmetto, an ast2500 evb and a witherspool and the overall result should be a v2 for upstream.
Thanks for these. I have applied them to dev-4.7.
Cheers,
Joel