From d0847ecc9f969e6ac089e505d5c1ddedddedfcd4 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Fri, 1 May 2020 22:04:50 +0530 Subject: [PATCH 01/10] spi: Zap lpc32xx_ssp driver-related code lpc32xx_ssp driver is deprecated, no active updates and no board user, hence dropped the same. Cc: Vladimir Zapolskiy Cc: Albert ARIBAUD Cc: Tom Rini Signed-off-by: Jagan Teki --- drivers/spi/Kconfig | 6 -- drivers/spi/Makefile | 1 - drivers/spi/lpc32xx_ssp.c | 134 ----------------------------------- include/configs/devkit3250.h | 5 -- include/configs/work_92105.h | 5 -- scripts/config_whitelist.txt | 1 - 6 files changed, 152 deletions(-) delete mode 100644 drivers/spi/lpc32xx_ssp.c diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 4166c6104e..dccd5ea0d9 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -431,12 +431,6 @@ config KIRKWOOD_SPI Enable support for SPI on various Marvell SoCs, such as Kirkwood and Armada 375. -config LPC32XX_SSP - bool "LPC32XX SPI Driver" - depends on DEPRECATED - help - Enable support for SPI on LPC32xx - config MXC_SPI bool "MXC SPI Driver" help diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 52462e19a3..6441694c8d 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -33,7 +33,6 @@ obj-$(CONFIG_FSL_ESPI) += fsl_espi.o obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o -obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o obj-$(CONFIG_MESON_SPIFC) += meson_spifc.o obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o diff --git a/drivers/spi/lpc32xx_ssp.c b/drivers/spi/lpc32xx_ssp.c deleted file mode 100644 index 4b09366317..0000000000 --- a/drivers/spi/lpc32xx_ssp.c +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * LPC32xx SSP interface (SPI mode) - * - * (C) Copyright 2014 DENX Software Engineering GmbH - * Written-by: Albert ARIBAUD - */ - -#include -#include -#include -#include -#include -#include - -/* SSP chip registers */ -struct ssp_regs { - u32 cr0; - u32 cr1; - u32 data; - u32 sr; - u32 cpsr; - u32 imsc; - u32 ris; - u32 mis; - u32 icr; - u32 dmacr; -}; - -/* CR1 register defines */ -#define SSP_CR1_SSP_ENABLE 0x0002 - -/* SR register defines */ -#define SSP_SR_TNF 0x0002 -/* SSP status RX FIFO not empty bit */ -#define SSP_SR_RNE 0x0004 - -/* lpc32xx spi slave */ -struct lpc32xx_spi_slave { - struct spi_slave slave; - struct ssp_regs *regs; -}; - -static inline struct lpc32xx_spi_slave *to_lpc32xx_spi_slave( - struct spi_slave *slave) -{ - return container_of(slave, struct lpc32xx_spi_slave, slave); -} - -/* the following is called in sequence by do_spi_xfer() */ - -struct spi_slave *spi_setup_slave(uint bus, uint cs, uint max_hz, uint mode) -{ - struct lpc32xx_spi_slave *lslave; - - /* we only set up SSP0 for now, so ignore bus */ - - if (mode & SPI_3WIRE) { - pr_err("3-wire mode not supported"); - return NULL; - } - - if (mode & SPI_SLAVE) { - pr_err("slave mode not supported\n"); - return NULL; - } - - if (mode & SPI_PREAMBLE) { - pr_err("preamble byte skipping not supported\n"); - return NULL; - } - - lslave = spi_alloc_slave(struct lpc32xx_spi_slave, bus, cs); - if (!lslave) { - printf("SPI_error: Fail to allocate lpc32xx_spi_slave\n"); - return NULL; - } - - lslave->regs = (struct ssp_regs *)SSP0_BASE; - - /* - * 8 bit frame, SPI fmt, 500kbps -> clock divider is 26. - * Set SCR to 0 and CPSDVSR to 26. - */ - - writel(0x7, &lslave->regs->cr0); /* 8-bit chunks, SPI, 1 clk/bit */ - writel(26, &lslave->regs->cpsr); /* SSP clock = HCLK/26 = 500kbps */ - writel(0, &lslave->regs->imsc); /* do not raise any interrupts */ - writel(0, &lslave->regs->icr); /* clear any pending interrupt */ - writel(0, &lslave->regs->dmacr); /* do not do DMAs */ - writel(SSP_CR1_SSP_ENABLE, &lslave->regs->cr1); /* enable SSP0 */ - return &lslave->slave; -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct lpc32xx_spi_slave *lslave = to_lpc32xx_spi_slave(slave); - - debug("(lpc32xx) spi_free_slave: 0x%08x\n", (u32)lslave); - free(lslave); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - /* only one bus and slave so far, always available */ - return 0; -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, - const void *dout, void *din, unsigned long flags) -{ - struct lpc32xx_spi_slave *lslave = to_lpc32xx_spi_slave(slave); - int bytelen = bitlen >> 3; - int idx_out = 0; - int idx_in = 0; - int start_time; - - start_time = get_timer(0); - while ((idx_out < bytelen) || (idx_in < bytelen)) { - int status = readl(&lslave->regs->sr); - if ((idx_out < bytelen) && (status & SSP_SR_TNF)) - writel(((u8 *)dout)[idx_out++], &lslave->regs->data); - if ((idx_in < bytelen) && (status & SSP_SR_RNE)) - ((u8 *)din)[idx_in++] = readl(&lslave->regs->data); - if (get_timer(start_time) >= CONFIG_LPC32XX_SSP_TIMEOUT) - return -1; - } - return 0; -} - -void spi_release_bus(struct spi_slave *slave) -{ - /* do nothing */ -} diff --git a/include/configs/devkit3250.h b/include/configs/devkit3250.h index f1f2be0797..4471a12f34 100644 --- a/include/configs/devkit3250.h +++ b/include/configs/devkit3250.h @@ -54,11 +54,6 @@ */ #define CONFIG_LPC32XX_GPIO -/* - * SSP/SPI - */ -#define CONFIG_LPC32XX_SSP_TIMEOUT 100000 - /* * Ethernet */ diff --git a/include/configs/work_92105.h b/include/configs/work_92105.h index 421384d9ba..93c8d64b14 100644 --- a/include/configs/work_92105.h +++ b/include/configs/work_92105.h @@ -104,11 +104,6 @@ #define CONFIG_LPC32XX_GPIO -/* - * SSP/SPI/DISPLAY - */ - -#define CONFIG_LPC32XX_SSP_TIMEOUT 100000 /* * Environment */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 741e9545e9..253c46159b 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1034,7 +1034,6 @@ CONFIG_LPC32XX_NAND_SLC_WDR_CLKS CONFIG_LPC32XX_NAND_SLC_WHOLD CONFIG_LPC32XX_NAND_SLC_WSETUP CONFIG_LPC32XX_NAND_SLC_WWIDTH -CONFIG_LPC32XX_SSP_TIMEOUT CONFIG_LPC_BASE CONFIG_LPC_IO_BASE CONFIG_LPUART From cd3e01b14f34bcfb69927dc246c1de792c784468 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Fri, 1 May 2020 23:44:17 +0530 Subject: [PATCH 02/10] phy: Fix node description of phy_get_by_node node is most of device related API's are termed as device node and without device related API's are termed as ofnode. generic_phy_get_by_node API is without device API, so fixed the node description as ofnode. Cc: Neil Armstrong Cc: Tom Rini Signed-off-by: Jagan Teki --- include/generic-phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/generic-phy.h b/include/generic-phy.h index 55629ae0b4..6d7cf5303b 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -215,7 +215,7 @@ int generic_phy_get_by_index(struct udevice *user, int index, /** * generic_phy_get_by_node() - Get a PHY device by integer index on ofnode * - * @node: the device node + * @node: The client ofnode. * @index: The index in the list of available PHYs * @phy: A pointer to the PHY port * From 5a2b6778fac98f2cb9ee1e7e6b98cd88d18dcbb9 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Fri, 1 May 2020 23:44:18 +0530 Subject: [PATCH 03/10] phy: Use _nodev naming convention if non-device clients Clients that are requesting some of uclass API's without a device (with ofnode) usually have _nodev naming convention. - clk_get_by_index_nodev - clk_get_by_name_nodev - reset_get_by_index_nodev - gpio_request_by_name_nodev So, update the same naming convention PHY framework. This doesn't change the existing functionality. Cc: Neil Armstrong Cc: Tom Rini Signed-off-by: Jagan Teki --- arch/arm/mach-meson/board-gx.c | 3 ++- drivers/phy/phy-uclass.c | 4 ++-- include/generic-phy.h | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c index 3da99017a5..b591c924ea 100644 --- a/arch/arm/mach-meson/board-gx.c +++ b/arch/arm/mach-meson/board-gx.c @@ -183,7 +183,8 @@ int board_usb_init(int index, enum usb_init_type init) /* get the PHYs */ for (i = 0; i < 2; i++) { - ret = generic_phy_get_by_node(dwc2_node, i, &usb_phys[i]); + ret = generic_phy_get_by_index_nodev(dwc2_node, i, + &usb_phys[i]); if (ret && ret != -ENOENT) { pr_err("Failed to get USB PHY%d for %s\n", i, ofnode_get_name(dwc2_node)); diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 6ab78448af..1fded5ebf4 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -32,7 +32,7 @@ static int generic_phy_xlate_offs_flags(struct phy *phy, return 0; } -int generic_phy_get_by_node(ofnode node, int index, struct phy *phy) +int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy) { struct ofnode_phandle_args args; struct phy_ops *ops; @@ -94,7 +94,7 @@ err: int generic_phy_get_by_index(struct udevice *dev, int index, struct phy *phy) { - return generic_phy_get_by_node(dev_ofnode(dev), index, phy); + return generic_phy_get_by_index_nodev(dev_ofnode(dev), index, phy); } int generic_phy_get_by_name(struct udevice *dev, const char *phy_name, diff --git a/include/generic-phy.h b/include/generic-phy.h index 6d7cf5303b..5ab34cda03 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -213,12 +213,15 @@ int generic_phy_get_by_index(struct udevice *user, int index, struct phy *phy); /** - * generic_phy_get_by_node() - Get a PHY device by integer index on ofnode + * generic_phy_get_by_index_nodev() - Get a PHY device by integer index + * without a device * * @node: The client ofnode. * @index: The index in the list of available PHYs * @phy: A pointer to the PHY port * + * This is a version of generic_phy_get_by_index() that does not use a device. + * * This looks up a PHY device for a client device based on its ofnode and on * its position in the list of the possible PHYs. * @@ -237,7 +240,7 @@ int generic_phy_get_by_index(struct udevice *user, int index, * * @return 0 if OK, or a negative error code */ -int generic_phy_get_by_node(ofnode node, int index, struct phy *phy); +int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy); /** * generic_phy_get_by_name() - Get a PHY device by its name. From d7c56616dcc8cac6f5de8e605fd00486a59fef50 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Fri, 1 May 2020 23:45:08 +0530 Subject: [PATCH 04/10] clk: Fix clk func names in comments clk function names in comments should be prefix with clk instead of clock. Fix it. Cc: Simon Glass Cc: Tom Rini Signed-off-by: Jagan Teki Reviewed-by: Simon Glass --- include/clk.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/clk.h b/include/clk.h index 60c4b7d075..c6a2713f62 100644 --- a/include/clk.h +++ b/include/clk.h @@ -93,7 +93,7 @@ int clk_get_by_index_platdata(struct udevice *dev, int index, struct phandle_1_arg *cells, struct clk *clk); /** - * clock_get_by_index - Get/request a clock by integer index. + * clk_get_by_index - Get/request a clock by integer index. * * This looks up and requests a clock. The index is relative to the client * device; each device is assumed to have n clocks associated with it somehow, @@ -110,7 +110,7 @@ int clk_get_by_index_platdata(struct udevice *dev, int index, int clk_get_by_index(struct udevice *dev, int index, struct clk *clk); /** - * clock_get_by_index_nodev - Get/request a clock by integer index + * clk_get_by_index_nodev - Get/request a clock by integer index * without a device. * * This is a version of clk_get_by_index() that does not use a device. @@ -124,7 +124,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk); int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk); /** - * clock_get_bulk - Get/request all clocks of a device. + * clk_get_bulk - Get/request all clocks of a device. * * This looks up and requests all clocks of the client device; each device is * assumed to have n clocks associated with it somehow, and this function finds @@ -139,7 +139,7 @@ int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk); int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk); /** - * clock_get_by_name - Get/request a clock by name. + * clk_get_by_name - Get/request a clock by name. * * This looks up and requests a clock. The name is relative to the client * device; each device is assumed to have n clocks associated with it somehow, @@ -169,7 +169,7 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk); int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk); /** - * clock_get_optional_nodev - Get/request an optinonal clock by name + * clk_get_optional_nodev - Get/request an optinonal clock by name * without a device. * @node: The client ofnode. * @name: The name of the clock to request. @@ -331,7 +331,7 @@ static inline int clk_release_bulk(struct clk_bulk *bulk) int clk_request(struct udevice *dev, struct clk *clk); /** - * clock_free - Free a previously requested clock. + * clk_free - Free a previously requested clock. * * @clock: A clock struct that was previously successfully requested by * clk_request/get_by_*(). From 54232474d6fe9214942b79fa2608c3ad1d9f07d0 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Sat, 2 May 2020 12:45:01 +0530 Subject: [PATCH 05/10] iopoll: Add read_poll_timeout common API Add read_poll_timeout common API similar to Linux iopoll. readx_poll_timeout will trigger read_poll_timeout with proper op. This will help to extend the functionalities like sleep_us to poll timeout in future. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki --- include/linux/iopoll.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index ab0ae1969a..51966d83da 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -11,7 +11,7 @@ #include /** - * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs + * read_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs * @op: accessor function (takes @addr as its only argument) * @addr: Address to poll * @val: Variable to read the value into @@ -24,7 +24,7 @@ * When available, you'll probably want to use one of the specialized * macros defined below rather than this macro directly. */ -#define readx_poll_timeout(op, addr, val, cond, timeout_us) \ +#define read_poll_timeout(op, addr, val, cond, timeout_us) \ ({ \ unsigned long timeout = timer_get_us() + timeout_us; \ for (;;) { \ @@ -39,6 +39,8 @@ (cond) ? 0 : -ETIMEDOUT; \ }) +#define readx_poll_timeout(op, addr, val, cond, timeout_us) \ + read_poll_timeout(op, addr, val, cond, timeout_us) #define readb_poll_timeout(addr, val, cond, timeout_us) \ readx_poll_timeout(readb, addr, val, cond, timeout_us) From c094e219a8614b3da275ad696cdfefbb9f2c453d Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Sat, 2 May 2020 12:45:02 +0530 Subject: [PATCH 06/10] iopoll: Add dealy to read poll Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction. This patch add that requirement by adding sleep_us variable so-that read_poll_timeout now support delay as well. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki --- include/linux/iopoll.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index 51966d83da..76d2f951c1 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -6,6 +6,7 @@ #ifndef _LINUX_IOPOLL_H #define _LINUX_IOPOLL_H +#include #include #include #include @@ -16,6 +17,7 @@ * @addr: Address to poll * @val: Variable to read the value into * @cond: Break condition (usually involving @val) + * @sleep_us: Maximum time to sleep in us * @timeout_us: Timeout in us, 0 means never timeout * * Returns 0 on success and -ETIMEDOUT upon a timeout. In either @@ -24,7 +26,7 @@ * When available, you'll probably want to use one of the specialized * macros defined below rather than this macro directly. */ -#define read_poll_timeout(op, addr, val, cond, timeout_us) \ +#define read_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ ({ \ unsigned long timeout = timer_get_us() + timeout_us; \ for (;;) { \ @@ -35,12 +37,14 @@ (val) = op(addr); \ break; \ } \ + if (sleep_us) \ + udelay(sleep_us); \ } \ (cond) ? 0 : -ETIMEDOUT; \ }) #define readx_poll_timeout(op, addr, val, cond, timeout_us) \ - read_poll_timeout(op, addr, val, cond, timeout_us) + read_poll_timeout(op, addr, val, cond, false, timeout_us) #define readb_poll_timeout(addr, val, cond, timeout_us) \ readx_poll_timeout(readb, addr, val, cond, timeout_us) From ce786ae3913f3a006ec959cc9538d6c4d4114345 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Sat, 2 May 2020 12:45:03 +0530 Subject: [PATCH 07/10] iopoll: Add readl_poll_sleep_timeout Add readl poll API with sleep and timeout support. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki --- include/linux/iopoll.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index 76d2f951c1..30cdea0cdc 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -43,6 +43,12 @@ (cond) ? 0 : -ETIMEDOUT; \ }) +#define readx_poll_sleep_timeout(op, addr, val, cond, sleep_us, timeout_us) \ + read_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) + +#define readl_poll_sleep_timeout(addr, val, cond, sleep_us, timeout_us) \ + readx_poll_sleep_timeout(readl, addr, val, cond, sleep_us, timeout_us) + #define readx_poll_timeout(op, addr, val, cond, timeout_us) \ read_poll_timeout(op, addr, val, cond, false, timeout_us) From 28029c768c4761d10815f94cafbbdc86272f1d8d Mon Sep 17 00:00:00 2001 From: Kuldeep Singh Date: Mon, 27 Apr 2020 12:38:51 +0530 Subject: [PATCH 08/10] spi: nxp-fspi: Use new readl_poll_sleep_timeout API Board gets reset when performing burst read/write operations. On the other hand, no such behaviour is observed on small size operations. In Linux, readl_poll_timeout API already adds delay of 1us which is further skipped in U-boot. Hence, use new "readl_poll_sleep_timeout" API which adds delay alongwith timeout functionality. Signed-off-by: Kuldeep Singh --- drivers/spi/nxp_fspi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c index 0e6c7be785..22a5c0e3c7 100644 --- a/drivers/spi/nxp_fspi.c +++ b/drivers/spi/nxp_fspi.c @@ -421,7 +421,7 @@ static bool nxp_fspi_supports_op(struct spi_slave *slave, return true; } -/* Instead of busy looping invoke readl_poll_timeout functionality. */ +/* Instead of busy looping invoke readl_poll_sleep_timeout functionality. */ static int fspi_readl_poll_tout(struct nxp_fspi *f, void __iomem *base, u32 mask, u32 delay_us, u32 timeout_us, bool c) @@ -432,11 +432,11 @@ static int fspi_readl_poll_tout(struct nxp_fspi *f, void __iomem *base, mask = (u32)cpu_to_be32(mask); if (c) - return readl_poll_timeout(base, reg, (reg & mask), - timeout_us); + return readl_poll_sleep_timeout(base, reg, (reg & mask), + delay_us, timeout_us); else - return readl_poll_timeout(base, reg, !(reg & mask), - timeout_us); + return readl_poll_sleep_timeout(base, reg, !(reg & mask), + delay_us, timeout_us); } /* From 1fbfe58df62276910bb5624aa107415fd069f824 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 2 May 2020 17:45:50 +0200 Subject: [PATCH 09/10] spi: fix dev parameter in dev_* calls Probably the non-use of the device parameter by the print routines did not generate compilation errors. Signed-off-by: Dario Binacchi --- drivers/mtd/spi/spi-nor-core.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index e840c60f27..3d4361493e 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -56,8 +56,7 @@ static int spi_nor_read_reg(struct spi_nor *nor, u8 code, u8 *val, int len) ret = spi_nor_read_write_reg(nor, &op, val); if (ret < 0) - dev_dbg(&flash->spimem->spi->dev, "error %d reading %x\n", ret, - code); + dev_dbg(nor->dev, "error %d reading %x\n", ret, code); return ret; } @@ -1374,7 +1373,8 @@ static int spansion_read_cr_quad_enable(struct spi_nor *nor) /* Check current Quad Enable bit value. */ ret = read_cr(nor); if (ret < 0) { - dev_dbg(dev, "error while reading configuration register\n"); + dev_dbg(nor->dev, + "error while reading configuration register\n"); return -EINVAL; } @@ -1386,7 +1386,7 @@ static int spansion_read_cr_quad_enable(struct spi_nor *nor) /* Keep the current value of the Status Register. */ ret = read_sr(nor); if (ret < 0) { - dev_dbg(dev, "error while reading status register\n"); + dev_dbg(nor->dev, "error while reading status register\n"); return -EINVAL; } sr_cr[0] = ret; @@ -2069,7 +2069,8 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, err = spi_nor_read_sfdp(nor, sizeof(header), psize, param_headers); if (err < 0) { - dev_err(dev, "failed to read SFDP parameter headers\n"); + dev_err(nor->dev, + "failed to read SFDP parameter headers\n"); goto exit; } } @@ -2099,7 +2100,8 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, switch (SFDP_PARAM_HEADER_ID(param_header)) { case SFDP_SECTOR_MAP_ID: - dev_info(dev, "non-uniform erase sector maps are not supported yet.\n"); + dev_info(nor->dev, + "non-uniform erase sector maps are not supported yet.\n"); break; case SFDP_SST_ID: @@ -2111,7 +2113,8 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, } if (err) { - dev_warn(dev, "Failed to parse optional parameter table: %04x\n", + dev_warn(nor->dev, + "Failed to parse optional parameter table: %04x\n", SFDP_PARAM_HEADER_ID(param_header)); /* * Let's not drop all information we extracted so far @@ -2609,7 +2612,7 @@ int spi_nor_scan(struct spi_nor *nor) } if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { - dev_dbg(dev, "address width is too large: %u\n", + dev_dbg(nor->dev, "address width is too large: %u\n", nor->addr_width); return -EINVAL; } From 8af1caa23728ef689d095eec1ec4e6f1d46f50e4 Mon Sep 17 00:00:00 2001 From: Ye Li Date: Sun, 3 May 2020 21:02:56 +0800 Subject: [PATCH 10/10] sf: Add Macronix MX25R6435F SPI NOR flash to flash parameters array On i.mx7ulp EVK board, we use MX25R6435F NOR flash, add its parameters and IDs to flash parameter array. Otherwise, the flash probe will fails. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/mtd/spi/spi-nor-ids.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index e5e7102923..114ebacde1 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -160,6 +160,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("mx66u2g45g", 0xc2253c, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("mx66l1g45g", 0xc2201b, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("mx25l1633e", 0xc22415, 0, 64 * 1024, 32, SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES | SECT_4K) }, + { INFO("mx25r6435f", 0xc22817, 0, 64 * 1024, 128, SECT_4K) }, #endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */