All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] Random Fixes for the CHIP Pro
@ 2021-06-25 13:05 Maxime Ripard
  2021-06-25 13:05 ` [PATCH 01/12] Revert "sunxi: spl: remove DMA related settings of the NAND controller" Maxime Ripard
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

Hi,

These patches fix the NextThingCo CHIP Pro support in upstream U-Boot.

The three reverts are not supposed to be merged at this point: the first two
will break the NAND support on newer Allwinner SoCs, and it's not clear what
the fastboot one does exactly, so I'm a bit concerned about the side effects.

The following patches fixes a couple of things around the GR8, CHIP Pro, and
fastboot support in general.

Let me know what you think,
Maxime

Maxime Ripard (12):
  Revert "sunxi: spl: remove DMA related settings of the NAND
    controller"
  Revert "spl: nand: sunxi: use PIO instead of DMA"
  Revert "usb: gadget: fastboot: use correct max packet size"
  Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE
  mtd: Allow for a longer mtdparts table
  fastboot: Add missing newlines
  configs: chip pro: Disable video output
  clk: sunxi: Add missing clock compatible
  fastboot: nand: Fix return error code
  configs: chip pro: Disable UMS
  configs: chip pro: fix the offsets
  configs: chip pro: Fix NAND Controller name

 README                                |  10 --
 board/sunxi/board.c                   |   5 +
 common/spl/Kconfig                    |  14 +++
 configs/CHIP_pro_defconfig            |   8 +-
 drivers/clk/sunxi/clk_a10s.c          |   2 +
 drivers/fastboot/fb_nand.c            |  14 +--
 drivers/mtd/mtd_uboot.c               |   2 +-
 drivers/mtd/nand/raw/sunxi_nand_spl.c | 141 ++++++++++++++++----------
 drivers/usb/gadget/f_fastboot.c       |   2 +-
 scripts/config_whitelist.txt          |   1 -
 10 files changed, 120 insertions(+), 79 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/12] Revert "sunxi: spl: remove DMA related settings of the NAND controller"
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 02/12] Revert "spl: nand: sunxi: use PIO instead of DMA" Maxime Ripard
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

This reverts commit 136e32593335e031558a573158b6180fc80b551f.
---
 board/sunxi/board.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 21651a1bfca4..80c222114f9a 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -395,6 +395,11 @@ static void nand_clock_setup(void)
 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I || \
     defined CONFIG_MACH_SUN9I || defined CONFIG_MACH_SUN50I
 	setbits_le32(&ccm->ahb_reset0_cfg, (1 << AHB_GATE_OFFSET_NAND0));
+#endif
+#ifdef CONFIG_MACH_SUN9I
+	setbits_le32(&ccm->ahb_gate1, (1 << AHB_GATE_OFFSET_DMA));
+#else
+	setbits_le32(&ccm->ahb_gate0, (1 << AHB_GATE_OFFSET_DMA));
 #endif
 	setbits_le32(&ccm->nand0_clk_cfg, CCM_NAND_CTRL_ENABLE | AHB_DIV_1);
 }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/12] Revert "spl: nand: sunxi: use PIO instead of DMA"
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
  2021-06-25 13:05 ` [PATCH 01/12] Revert "sunxi: spl: remove DMA related settings of the NAND controller" Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size" Maxime Ripard
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

This reverts commit 6ddbb1e936c78cdef1e7395039fa7020c5c75326.
---
 drivers/mtd/nand/raw/sunxi_nand_spl.c | 141 ++++++++++++++++----------
 1 file changed, 85 insertions(+), 56 deletions(-)

diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/raw/sunxi_nand_spl.c
index 85d8013b1a6b..c097a2b8b94d 100644
--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
@@ -8,10 +8,12 @@
 #include <asm/io.h>
 #include <common.h>
 #include <config.h>
+#include <cpu_func.h>
 #include <nand.h>
 #include <linux/bitops.h>
 #include <linux/ctype.h>
 #include <linux/delay.h>
+#include <linux/ctype.h>
 
 /* registers */
 #define NFC_CTL                    0x00000000
@@ -69,7 +71,6 @@
 #define NFC_SEND_CMD3              (1 << 28)
 #define NFC_SEND_CMD4              (1 << 29)
 #define NFC_RAW_CMD                (0 << 30)
-#define NFC_ECC_CMD                (1 << 30)
 #define NFC_PAGE_CMD               (2 << 30)
 
 #define NFC_ST_CMD_INT_FLAG        (1 << 1)
@@ -84,6 +85,22 @@
 #define NFC_CMD_RNDOUT             0x05
 #define NFC_CMD_READSTART          0x30
 
+#define SUNXI_DMA_CFG_REG0              0x300
+#define SUNXI_DMA_SRC_START_ADDR_REG0   0x304
+#define SUNXI_DMA_DEST_START_ADDRR_REG0 0x308
+#define SUNXI_DMA_DDMA_BC_REG0          0x30C
+#define SUNXI_DMA_DDMA_PARA_REG0        0x318
+
+#define SUNXI_DMA_DDMA_CFG_REG_LOADING  (1 << 31)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_DEST_DATA_WIDTH_32 (2 << 25)
+#define SUNXI_DMA_DDMA_CFG_REG_DDMA_DST_DRQ_TYPE_DRAM (1 << 16)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_DATA_WIDTH_32 (2 << 9)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_ADDR_MODE_IO (1 << 5)
+#define SUNXI_DMA_DDMA_CFG_REG_DDMA_SRC_DRQ_TYPE_NFC (3 << 0)
+
+#define SUNXI_DMA_DDMA_PARA_REG_SRC_WAIT_CYC (0x0F << 0)
+#define SUNXI_DMA_DDMA_PARA_REG_SRC_BLK_SIZE (0x7F << 8)
+
 struct nfc_config {
 	int page_size;
 	int ecc_strength;
@@ -256,74 +273,86 @@ static const int ecc_bytes[] = {32, 46, 54, 60, 74, 88, 102, 110, 116};
 static int nand_read_page(const struct nfc_config *conf, u32 offs,
 			  void *dest, int len)
 {
+	dma_addr_t dst = (dma_addr_t)dest;
 	int nsectors = len / conf->ecc_size;
 	u16 rand_seed = 0;
-	int oob_chunk_sz = ecc_bytes[conf->ecc_strength];
-	int page = offs / conf->page_size;
-	u32 ecc_st;
-	int i;
+	u32 val;
+	int page;
+
+	page = offs / conf->page_size;
 
 	if (offs % conf->page_size || len % conf->ecc_size ||
 	    len > conf->page_size || len < 0)
 		return -EINVAL;
 
+	/* clear ecc status */
+	writel(0, SUNXI_NFC_BASE + NFC_ECC_ST);
+
 	/* Choose correct seed if randomized */
 	if (conf->randomize)
 		rand_seed = random_seed[page % conf->nseeds];
 
-	/* Retrieve data from SRAM (PIO) */
-	for (i = 0; i < nsectors; i++) {
-		int data_off = i * conf->ecc_size;
-		int oob_off = conf->page_size + (i * oob_chunk_sz);
-		u8 *data = dest + data_off;
-
-		/* Clear ECC status and restart ECC engine */
-		writel(0, SUNXI_NFC_BASE + NFC_ECC_ST);
-		writel((rand_seed << 16) | (conf->ecc_strength << 12) |
-		       (conf->randomize ? NFC_ECC_RANDOM_EN : 0) |
-		       (conf->ecc_size == 512 ? NFC_ECC_BLOCK_SIZE : 0) |
-		       NFC_ECC_EN | NFC_ECC_EXCEPTION,
-		       SUNXI_NFC_BASE + NFC_ECC_CTL);
-
-		/* Move the data in SRAM */
-		nand_change_column(data_off);
-		writel(conf->ecc_size, SUNXI_NFC_BASE + NFC_CNT);
-		nand_exec_cmd(NFC_DATA_TRANS);
-
-		/*
-		 * Let the ECC engine consume the ECC bytes and possibly correct
-		 * the data.
-		 */
-		nand_change_column(oob_off);
-		nand_exec_cmd(NFC_DATA_TRANS | NFC_ECC_CMD);
-
-		/* Get the ECC status */
-		ecc_st = readl(SUNXI_NFC_BASE + NFC_ECC_ST);
-
-		/* ECC error detected. */
-		if (ecc_st & 0xffff)
-			return -EIO;
-
-		/*
-		 * Return 1 if the first chunk is empty (needed for
-		 * configuration detection).
-		 */
-		if (!i && (ecc_st & 0x10000))
-			return 1;
-
-		/* Retrieve the data from SRAM */
-		memcpy_fromio(data, SUNXI_NFC_BASE + NFC_RAM0_BASE,
-			      conf->ecc_size);
-
-		/* Stop the ECC engine */
-		writel(readl(SUNXI_NFC_BASE + NFC_ECC_CTL) & ~NFC_ECC_EN,
-		       SUNXI_NFC_BASE + NFC_ECC_CTL);
-
-		if (data_off + conf->ecc_size >= len)
-			break;
+	writel((rand_seed << 16) | (conf->ecc_strength << 12) |
+		(conf->randomize ? NFC_ECC_RANDOM_EN : 0) |
+		(conf->ecc_size == 512 ? NFC_ECC_BLOCK_SIZE : 0) |
+		NFC_ECC_EN | NFC_ECC_PIPELINE | NFC_ECC_EXCEPTION,
+		SUNXI_NFC_BASE + NFC_ECC_CTL);
+
+	flush_dcache_range(dst, ALIGN(dst + conf->ecc_size, ARCH_DMA_MINALIGN));
+
+	/* SUNXI_DMA */
+	writel(0x0, SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0); /* clr dma cmd */
+	/* read from REG_IO_DATA */
+	writel(SUNXI_NFC_BASE + NFC_IO_DATA,
+	       SUNXI_DMA_BASE + SUNXI_DMA_SRC_START_ADDR_REG0);
+	/* read to RAM */
+	writel(dst, SUNXI_DMA_BASE + SUNXI_DMA_DEST_START_ADDRR_REG0);
+	writel(SUNXI_DMA_DDMA_PARA_REG_SRC_WAIT_CYC |
+	       SUNXI_DMA_DDMA_PARA_REG_SRC_BLK_SIZE,
+	       SUNXI_DMA_BASE + SUNXI_DMA_DDMA_PARA_REG0);
+	writel(len, SUNXI_DMA_BASE + SUNXI_DMA_DDMA_BC_REG0);
+	writel(SUNXI_DMA_DDMA_CFG_REG_LOADING |
+	       SUNXI_DMA_DDMA_CFG_REG_DMA_DEST_DATA_WIDTH_32 |
+	       SUNXI_DMA_DDMA_CFG_REG_DDMA_DST_DRQ_TYPE_DRAM |
+	       SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_DATA_WIDTH_32 |
+	       SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_ADDR_MODE_IO |
+	       SUNXI_DMA_DDMA_CFG_REG_DDMA_SRC_DRQ_TYPE_NFC,
+	       SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0);
+
+	writel(nsectors, SUNXI_NFC_BASE + NFC_SECTOR_NUM);
+	writel(NFC_ST_DMA_INT_FLAG, SUNXI_NFC_BASE + NFC_ST);
+	writel(NFC_DATA_TRANS |	NFC_PAGE_CMD | NFC_DATA_SWAP_METHOD,
+	       SUNXI_NFC_BASE + NFC_CMD);
+
+	if (!check_value(SUNXI_NFC_BASE + NFC_ST, NFC_ST_DMA_INT_FLAG,
+			 DEFAULT_TIMEOUT_US)) {
+		printf("Error while initializing dma interrupt\n");
+		return -EIO;
 	}
+	writel(NFC_ST_DMA_INT_FLAG, SUNXI_NFC_BASE + NFC_ST);
 
-	return 0;
+	if (!check_value_negated(SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0,
+				 SUNXI_DMA_DDMA_CFG_REG_LOADING,
+				 DEFAULT_TIMEOUT_US)) {
+		printf("Error while waiting for dma transfer to finish\n");
+		return -EIO;
+	}
+
+	invalidate_dcache_range(dst,
+				ALIGN(dst + conf->ecc_size, ARCH_DMA_MINALIGN));
+
+	val = readl(SUNXI_NFC_BASE + NFC_ECC_ST);
+
+	/* ECC error detected. */
+	if (val & 0xffff)
+		return -EIO;
+
+	/*
+	 * Return 1 if the page is empty.
+	 * We consider the page as empty if the first ECC block is marked
+	 * empty.
+	 */
+	return (val & 0x10000) ? 1 : 0;
 }
 
 static int nand_max_ecc_strength(struct nfc_config *conf)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
  2021-06-25 13:05 ` [PATCH 01/12] Revert "sunxi: spl: remove DMA related settings of the NAND controller" Maxime Ripard
  2021-06-25 13:05 ` [PATCH 02/12] Revert "spl: nand: sunxi: use PIO instead of DMA" Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:47   ` Sean Anderson
  2021-06-29  2:27   ` Peng Fan (OSS)
  2021-06-25 13:05 ` [PATCH 04/12] Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE Maxime Ripard
                   ` (8 subsequent siblings)
  11 siblings, 2 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

This reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.
---
 drivers/usb/gadget/f_fastboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 8ba55aab9f8f..1fcffaf9dd26 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
 {
 	int rx_remain = fastboot_data_remaining();
 	unsigned int rem;
-	unsigned int maxpacket = usb_endpoint_maxp(ep->desc);
+	unsigned int maxpacket = ep->maxpacket;
 
 	if (rx_remain <= 0)
 		return 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/12] Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (2 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size" Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 05/12] mtd: Allow for a longer mtdparts table Maxime Ripard
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The SPL_PANIC_ON_RAW_IMAGE can be fairly useful to avoid the SPL getting
stuck without a message when the image retrieved isn't a valid image.

Let's convert it to Kconfig.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 README                       | 10 ----------
 common/spl/Kconfig           | 14 ++++++++++++++
 scripts/config_whitelist.txt |  1 -
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/README b/README
index ad13092bbb7a..7e4b6d3e723b 100644
--- a/README
+++ b/README
@@ -2145,16 +2145,6 @@ The following options need to be configured:
 		CONFIG_SPL_STACK
 		Adress of the start of the stack SPL will use
 
-		CONFIG_SPL_PANIC_ON_RAW_IMAGE
-		When defined, SPL will panic() if the image it has
-		loaded does not have a signature.
-		Defining this is useful when code which loads images
-		in SPL cannot guarantee that absolutely all read errors
-		will be caught.
-		An example is the LPC32XX MLC NAND driver, which will
-		consider that a completely unreadable NAND block is bad,
-		and thus should be skipped silently.
-
 		CONFIG_SPL_RELOC_STACK
 		Adress of the start of the stack SPL will use after
 		relocation.  If unspecified, this is equal to
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index fa80524cfb2c..e3541bd252d2 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -201,6 +201,20 @@ config SPL_LEGACY_IMAGE_SUPPORT
 	  is y. If this is not set, SPL will move on to other available
 	  boot media to find a suitable image.
 
+config SPL_PANIC_ON_RAW_IMAGE
+	bool "Panic if the image loaded doesn't have a header"
+	default y
+	help
+	  When defined, SPL will panic() if the image it has loaded does not
+	  have a signature.
+
+	  Defining this is useful when code which loads images in SPL cannot
+	  guarantee that absolutely all read errors will be caught.
+
+	  An example is the LPC32XX MLC NAND driver, which will consider that a
+	  completely unreadable NAND block is bad, and thus should be skipped
+	  silently.
+
 config SPL_LEGACY_IMAGE_CRC_CHECK
 	bool "Check CRC of Legacy images"
 	depends on SPL_LEGACY_IMAGE_SUPPORT
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 8f92b82719a2..90054af20fb7 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1515,7 +1515,6 @@ CONFIG_SPL_NAND_RAW_ONLY
 CONFIG_SPL_NAND_SOFTECC
 CONFIG_SPL_NAND_WORKSPACE
 CONFIG_SPL_PAD_TO
-CONFIG_SPL_PANIC_ON_RAW_IMAGE
 CONFIG_SPL_PBL_PAD
 CONFIG_SPL_PPAACT_ADDR
 CONFIG_SPL_RELOC_MALLOC_ADDR
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/12] mtd: Allow for a longer mtdparts table
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (3 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 04/12] Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 06/12] fastboot: Add missing newlines Maxime Ripard
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

20 characters is fairly short for a partition table, let's increase it a
bit.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/mtd/mtd_uboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index c53ec657a34d..3b54d0ba6e95 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -15,7 +15,7 @@
 #include <asm/global_data.h>
 #include <mtd.h>
 
-#define MTD_NAME_MAX_LEN 20
+#define MTD_NAME_MAX_LEN 64
 
 void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/12] fastboot: Add missing newlines
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (4 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 05/12] mtd: Allow for a longer mtdparts table Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:40   ` Andre Przywara
  2021-06-25 13:05 ` [PATCH 07/12] configs: chip pro: Disable video output Maxime Ripard
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

Most of the error messages in the NAND fastboot support are missing a \n
at the end, add it where relevant.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/fastboot/fb_nand.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index eb8a36f29222..e07df33d3665 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -49,13 +49,13 @@ static int fb_nand_lookup(const char *partname,
 
 	ret = find_dev_and_part(partname, &dev, &pnum, part);
 	if (ret) {
-		pr_err("cannot find partition: '%s'", partname);
+		pr_err("cannot find partition: '%s'\n", partname);
 		fastboot_fail("cannot find partition", response);
 		return ret;
 	}
 
 	if (dev->id->type != MTD_DEV_TYPE_NAND) {
-		pr_err("partition '%s' is not stored on a NAND device",
+		pr_err("partition '%s' is not stored on a NAND device\n",
 		      partname);
 		fastboot_fail("not a NAND device", response);
 		return -EINVAL;
@@ -179,7 +179,7 @@ void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
 
 	ret = fb_nand_lookup(cmd, &mtd, &part, response);
 	if (ret) {
-		pr_err("invalid NAND device");
+		pr_err("invalid NAND device\n");
 		fastboot_fail("invalid NAND device", response);
 		return;
 	}
@@ -243,7 +243,7 @@ void fastboot_nand_erase(const char *cmd, char *response)
 
 	ret = fb_nand_lookup(cmd, &mtd, &part, response);
 	if (ret) {
-		pr_err("invalid NAND device");
+		pr_err("invalid NAND device\n");
 		fastboot_fail("invalid NAND device", response);
 		return;
 	}
@@ -254,7 +254,7 @@ void fastboot_nand_erase(const char *cmd, char *response)
 
 	ret = _fb_nand_erase(mtd, part);
 	if (ret) {
-		pr_err("failed erasing from device %s", mtd->name);
+		pr_err("failed erasing from device %s\n", mtd->name);
 		fastboot_fail("failed erasing from device", response);
 		return;
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/12] configs: chip pro: Disable video output
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (5 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 06/12] fastboot: Add missing newlines Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:38   ` Andre Przywara
  2021-06-25 13:05 ` [PATCH 08/12] clk: sunxi: Add missing clock compatible Maxime Ripard
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The CHIP Pro doesn't have a video output, so it doesn't make sense to
have the video support enabled.

A side effect is that it prevents the messages from the HDMI controller
about a missing DDC controller to retrieve the EDID, which doesn't make
much sense since the GR8 doesn't have an HDMI controller to begin with.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 configs/CHIP_pro_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
index 7f10fd2b886e..d2eddc7e9ff0 100644
--- a/configs/CHIP_pro_defconfig
+++ b/configs/CHIP_pro_defconfig
@@ -4,6 +4,7 @@ CONFIG_SPL=y
 CONFIG_MACH_SUN5I=y
 CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J=y
 CONFIG_USB0_VBUS_PIN="PB10"
+# CONFIG_VIDEO_SUNXI is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-gr8-chip-pro"
 CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_CMD_FLASH is not set
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/12] clk: sunxi: Add missing clock compatible
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (6 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 07/12] configs: chip pro: Disable video output Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:38   ` Andre Przywara
  2021-06-25 13:05 ` [PATCH 09/12] fastboot: nand: Fix return error code Maxime Ripard
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The NextThingCo GR8 is a derivative of the sun5i family, and thus should
be considered similar to the A10s and A13 as far as clocks go.

The compatible was missing from the clock driver so far, leading to all
the drivers depending on it being non-functional.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/sunxi/clk_a10s.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
index 184f61ab234c..99d8a8ab1b2e 100644
--- a/drivers/clk/sunxi/clk_a10s.c
+++ b/drivers/clk/sunxi/clk_a10s.c
@@ -59,6 +59,8 @@ static const struct udevice_id a10s_ccu_ids[] = {
 	  .data = (ulong)&a10s_ccu_desc },
 	{ .compatible = "allwinner,sun5i-a13-ccu",
 	  .data = (ulong)&a10s_ccu_desc },
+	{ .compatible = "nextthing,gr8-ccu",
+	  .data = (ulong)&a10s_ccu_desc },
 	{ }
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/12] fastboot: nand: Fix return error code
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (7 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 08/12] clk: sunxi: Add missing clock compatible Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 14:08   ` Andre Przywara
  2021-06-25 13:05 ` [PATCH 10/12] configs: chip pro: Disable UMS Maxime Ripard
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

Both mtdparts_init() and find_dev_and_part() will return 0 on success
but 1 on failure.

Since the calling functions of fb_nand_lookup expects a negative error
code on failure, we can't just return the returned value of these
functions.

This fixes an issue with the logic that detects whether we support
fastboot slots or not by calling fb_nand_lookup and assuming that
anything >= 0 means the partition is there.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/fastboot/fb_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index e07df33d3665..9d832fd8ca9a 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -44,14 +44,14 @@ static int fb_nand_lookup(const char *partname,
 	if (ret) {
 		pr_err("Cannot initialize MTD partitions\n");
 		fastboot_fail("cannot init mtdparts", response);
-		return ret;
+		return -EINVAL;
 	}
 
 	ret = find_dev_and_part(partname, &dev, &pnum, part);
 	if (ret) {
 		pr_err("cannot find partition: '%s'\n", partname);
 		fastboot_fail("cannot find partition", response);
-		return ret;
+		return -ENODEV;
 	}
 
 	if (dev->id->type != MTD_DEV_TYPE_NAND) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/12] configs: chip pro: Disable UMS
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (8 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 09/12] fastboot: nand: Fix return error code Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 11/12] configs: chip pro: fix the offsets Maxime Ripard
  2021-06-25 13:05 ` [PATCH 12/12] configs: chip pro: Fix NAND Controller name Maxime Ripard
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The CHIP Pro doesn't have any block storage device, so enabling UMS
makes little sense.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 configs/CHIP_pro_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
index d2eddc7e9ff0..c8e2e2ae2ca3 100644
--- a/configs/CHIP_pro_defconfig
+++ b/configs/CHIP_pro_defconfig
@@ -26,4 +26,3 @@ CONFIG_CONS_INDEX=2
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
-CONFIG_USB_FUNCTION_MASS_STORAGE=y
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/12] configs: chip pro: fix the offsets
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (9 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 10/12] configs: chip pro: Disable UMS Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  2021-06-25 13:05 ` [PATCH 12/12] configs: chip pro: Fix NAND Controller name Maxime Ripard
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The CHIP Pro MTD partition table sets the U-Boot offset at
512kB (0x80000), and its backup at 2.5MB (0x280000).

However, the default value for both of these on sunxi is 8MB (0x800000),
which doesn't work in our case.

Fix this.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 configs/CHIP_pro_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
index c8e2e2ae2ca3..d8b8f477772d 100644
--- a/configs/CHIP_pro_defconfig
+++ b/configs/CHIP_pro_defconfig
@@ -20,6 +20,8 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
 CONFIG_SYS_NAND_PAGE_SIZE=0x1000
 CONFIG_SYS_NAND_OOBSIZE=0x100
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
+CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND=0x280000
 CONFIG_AXP_ALDO3_VOLT=3300
 CONFIG_AXP_ALDO4_VOLT=3300
 CONFIG_CONS_INDEX=2
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/12] configs: chip pro: Fix NAND Controller name
  2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
                   ` (10 preceding siblings ...)
  2021-06-25 13:05 ` [PATCH 11/12] configs: chip pro: fix the offsets Maxime Ripard
@ 2021-06-25 13:05 ` Maxime Ripard
  11 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 13:05 UTC (permalink / raw)
  To: u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki, Maxime Ripard

The controller name in Linux isn't sunxi_nand.0 but
1c03000.nand-controller, preventing us from passing the mtdparts
variable directly on the kernel command line.

Let's adjust our value to match what Linux expects.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 configs/CHIP_pro_defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
index d8b8f477772d..b9e72ddefde5 100644
--- a/configs/CHIP_pro_defconfig
+++ b/configs/CHIP_pro_defconfig
@@ -9,8 +9,8 @@ CONFIG_DEFAULT_DEVICE_TREE="sun5i-gr8-chip-pro"
 CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MTDPARTS=y
-CONFIG_MTDIDS_DEFAULT="nand0=sunxi-nand.0"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=sunxi-nand.0:256k(spl),256k(spl-backup),2m(uboot),2m(uboot-backup),-(UBI)"
+CONFIG_MTDIDS_DEFAULT="nand0=1c03000.nand-controller"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=1c03000.nand-controller:256k(spl),256k(spl-backup),2m(uboot),2m(uboot-backup),-(UBI)"
 CONFIG_ENV_IS_IN_UBI=y
 CONFIG_ENV_UBI_PART="UBI"
 CONFIG_ENV_UBI_VOLUME="uboot-env"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 08/12] clk: sunxi: Add missing clock compatible
  2021-06-25 13:05 ` [PATCH 08/12] clk: sunxi: Add missing clock compatible Maxime Ripard
@ 2021-06-25 13:38   ` Andre Przywara
  0 siblings, 0 replies; 21+ messages in thread
From: Andre Przywara @ 2021-06-25 13:38 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: u-boot, Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki

On Fri, 25 Jun 2021 15:05:43 +0200
Maxime Ripard <maxime@cerno.tech> wrote:

> The NextThingCo GR8 is a derivative of the sun5i family, and thus should
> be considered similar to the A10s and A13 as far as clocks go.
> 
> The compatible was missing from the clock driver so far, leading to all
> the drivers depending on it being non-functional.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Compared the Linux clock drivers between the two compatibles, and the
GR8 has just a few clocks more, mostly audio related, so they are
indeed compatible as far as U-Boot is concerned:

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/clk/sunxi/clk_a10s.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
> index 184f61ab234c..99d8a8ab1b2e 100644
> --- a/drivers/clk/sunxi/clk_a10s.c
> +++ b/drivers/clk/sunxi/clk_a10s.c
> @@ -59,6 +59,8 @@ static const struct udevice_id a10s_ccu_ids[] = {
>  	  .data = (ulong)&a10s_ccu_desc },
>  	{ .compatible = "allwinner,sun5i-a13-ccu",
>  	  .data = (ulong)&a10s_ccu_desc },
> +	{ .compatible = "nextthing,gr8-ccu",
> +	  .data = (ulong)&a10s_ccu_desc },
>  	{ }
>  };
>  


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/12] configs: chip pro: Disable video output
  2021-06-25 13:05 ` [PATCH 07/12] configs: chip pro: Disable video output Maxime Ripard
@ 2021-06-25 13:38   ` Andre Przywara
  0 siblings, 0 replies; 21+ messages in thread
From: Andre Przywara @ 2021-06-25 13:38 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: u-boot, Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki

On Fri, 25 Jun 2021 15:05:42 +0200
Maxime Ripard <maxime@cerno.tech> wrote:

> The CHIP Pro doesn't have a video output, so it doesn't make sense to
> have the video support enabled.
> 
> A side effect is that it prevents the messages from the HDMI controller
> about a missing DDC controller to retrieve the EDID, which doesn't make
> much sense since the GR8 doesn't have an HDMI controller to begin with.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  configs/CHIP_pro_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig
> index 7f10fd2b886e..d2eddc7e9ff0 100644
> --- a/configs/CHIP_pro_defconfig
> +++ b/configs/CHIP_pro_defconfig
> @@ -4,6 +4,7 @@ CONFIG_SPL=y
>  CONFIG_MACH_SUN5I=y
>  CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J=y
>  CONFIG_USB0_VBUS_PIN="PB10"
> +# CONFIG_VIDEO_SUNXI is not set
>  CONFIG_DEFAULT_DEVICE_TREE="sun5i-gr8-chip-pro"
>  CONFIG_SPL_I2C_SUPPORT=y
>  # CONFIG_CMD_FLASH is not set


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/12] fastboot: Add missing newlines
  2021-06-25 13:05 ` [PATCH 06/12] fastboot: Add missing newlines Maxime Ripard
@ 2021-06-25 13:40   ` Andre Przywara
  0 siblings, 0 replies; 21+ messages in thread
From: Andre Przywara @ 2021-06-25 13:40 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: u-boot, Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki

On Fri, 25 Jun 2021 15:05:41 +0200
Maxime Ripard <maxime@cerno.tech> wrote:

> Most of the error messages in the NAND fastboot support are missing a \n
> at the end, add it where relevant.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks!
Andre

> ---
>  drivers/fastboot/fb_nand.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
> index eb8a36f29222..e07df33d3665 100644
> --- a/drivers/fastboot/fb_nand.c
> +++ b/drivers/fastboot/fb_nand.c
> @@ -49,13 +49,13 @@ static int fb_nand_lookup(const char *partname,
>  
>  	ret = find_dev_and_part(partname, &dev, &pnum, part);
>  	if (ret) {
> -		pr_err("cannot find partition: '%s'", partname);
> +		pr_err("cannot find partition: '%s'\n", partname);
>  		fastboot_fail("cannot find partition", response);
>  		return ret;
>  	}
>  
>  	if (dev->id->type != MTD_DEV_TYPE_NAND) {
> -		pr_err("partition '%s' is not stored on a NAND device",
> +		pr_err("partition '%s' is not stored on a NAND device\n",
>  		      partname);
>  		fastboot_fail("not a NAND device", response);
>  		return -EINVAL;
> @@ -179,7 +179,7 @@ void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
>  
>  	ret = fb_nand_lookup(cmd, &mtd, &part, response);
>  	if (ret) {
> -		pr_err("invalid NAND device");
> +		pr_err("invalid NAND device\n");
>  		fastboot_fail("invalid NAND device", response);
>  		return;
>  	}
> @@ -243,7 +243,7 @@ void fastboot_nand_erase(const char *cmd, char *response)
>  
>  	ret = fb_nand_lookup(cmd, &mtd, &part, response);
>  	if (ret) {
> -		pr_err("invalid NAND device");
> +		pr_err("invalid NAND device\n");
>  		fastboot_fail("invalid NAND device", response);
>  		return;
>  	}
> @@ -254,7 +254,7 @@ void fastboot_nand_erase(const char *cmd, char *response)
>  
>  	ret = _fb_nand_erase(mtd, part);
>  	if (ret) {
> -		pr_err("failed erasing from device %s", mtd->name);
> +		pr_err("failed erasing from device %s\n", mtd->name);
>  		fastboot_fail("failed erasing from device", response);
>  		return;
>  	}


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
  2021-06-25 13:05 ` [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size" Maxime Ripard
@ 2021-06-25 13:47   ` Sean Anderson
  2021-06-25 14:14     ` Maxime Ripard
  2021-06-29  2:27   ` Peng Fan (OSS)
  1 sibling, 1 reply; 21+ messages in thread
From: Sean Anderson @ 2021-06-25 13:47 UTC (permalink / raw)
  To: Maxime Ripard, u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal, Jagan Teki

On 6/25/21 9:05 AM, Maxime Ripard wrote:
> This reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.

Why does this need to be reverted?

--Sean

> ---
>   drivers/usb/gadget/f_fastboot.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 8ba55aab9f8f..1fcffaf9dd26 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
>   {
>   	int rx_remain = fastboot_data_remaining();
>   	unsigned int rem;
> -	unsigned int maxpacket = usb_endpoint_maxp(ep->desc);
> +	unsigned int maxpacket = ep->maxpacket;
>   
>   	if (rx_remain <= 0)
>   		return 0;
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 09/12] fastboot: nand: Fix return error code
  2021-06-25 13:05 ` [PATCH 09/12] fastboot: nand: Fix return error code Maxime Ripard
@ 2021-06-25 14:08   ` Andre Przywara
  0 siblings, 0 replies; 21+ messages in thread
From: Andre Przywara @ 2021-06-25 14:08 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: u-boot, Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal,
	Jagan Teki

On Fri, 25 Jun 2021 15:05:44 +0200
Maxime Ripard <maxime@cerno.tech> wrote:

> Both mtdparts_init() and find_dev_and_part() will return 0 on success
> but 1 on failure.
> 
> Since the calling functions of fb_nand_lookup expects a negative error
> code on failure, we can't just return the returned value of these
> functions.
> 
> This fixes an issue with the logic that detects whether we support
> fastboot slots or not by calling fb_nand_lookup and assuming that
> anything >= 0 means the partition is there.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Yes indeed, good catch!

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/fastboot/fb_nand.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
> index e07df33d3665..9d832fd8ca9a 100644
> --- a/drivers/fastboot/fb_nand.c
> +++ b/drivers/fastboot/fb_nand.c
> @@ -44,14 +44,14 @@ static int fb_nand_lookup(const char *partname,
>  	if (ret) {
>  		pr_err("Cannot initialize MTD partitions\n");
>  		fastboot_fail("cannot init mtdparts", response);
> -		return ret;
> +		return -EINVAL;
>  	}
>  
>  	ret = find_dev_and_part(partname, &dev, &pnum, part);
>  	if (ret) {
>  		pr_err("cannot find partition: '%s'\n", partname);
>  		fastboot_fail("cannot find partition", response);
> -		return ret;
> +		return -ENODEV;
>  	}
>  
>  	if (dev->id->type != MTD_DEV_TYPE_NAND) {


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
  2021-06-25 13:47   ` Sean Anderson
@ 2021-06-25 14:14     ` Maxime Ripard
  0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-06-25 14:14 UTC (permalink / raw)
  To: Sean Anderson
  Cc: u-boot, Andre Przywara, Peng Fan, Li Jun, Marek Vasut, Tom Rini,
	Miquel Raynal, Jagan Teki

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

Hi Sean,

On Fri, Jun 25, 2021 at 09:47:11AM -0400, Sean Anderson wrote:
> On 6/25/21 9:05 AM, Maxime Ripard wrote:
> > This reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.
> 
> Why does this need to be reverted?

As I stated in the cover letter, I don't really know enough about USB to
know if we actually need to revert or not, but this introduces an issue
I reported here:

https://lore.kernel.org/u-boot/20210623101550.ezsc5dkaiqnqifvg@gilmour/T/#u

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
  2021-06-25 13:05 ` [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size" Maxime Ripard
  2021-06-25 13:47   ` Sean Anderson
@ 2021-06-29  2:27   ` Peng Fan (OSS)
  2021-07-03 13:47     ` Maxime Ripard
  1 sibling, 1 reply; 21+ messages in thread
From: Peng Fan (OSS) @ 2021-06-29  2:27 UTC (permalink / raw)
  To: Maxime Ripard, u-boot, Andre Przywara
  Cc: Peng Fan, Li Jun, Marek Vasut, Tom Rini, Miquel Raynal, Jagan Teki

Maxime

On 2021/6/25 21:05, Maxime Ripard wrote:
> This reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.
> ---
>   drivers/usb/gadget/f_fastboot.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 8ba55aab9f8f..1fcffaf9dd26 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
>   {
>   	int rx_remain = fastboot_data_remaining();
>   	unsigned int rem;
> -	unsigned int maxpacket = usb_endpoint_maxp(ep->desc);
> +	unsigned int maxpacket = ep->maxpacket;

Have you ever checked what's the value here of ep->maxpacket and 
usb_endpoint_maxp(ep->desc); in your failure case?

Regards,
Peng.

>   
>   	if (rx_remain <= 0)
>   		return 0;
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
  2021-06-29  2:27   ` Peng Fan (OSS)
@ 2021-07-03 13:47     ` Maxime Ripard
  0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2021-07-03 13:47 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: u-boot, Andre Przywara, Peng Fan, Li Jun, Marek Vasut, Tom Rini,
	Miquel Raynal, Jagan Teki

Hi Peng,

On Tue, Jun 29, 2021 at 10:27:27AM +0800, Peng Fan (OSS) wrote:
> Maxime
> 
> On 2021/6/25 21:05, Maxime Ripard wrote:
> > This reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.
> > ---
> >   drivers/usb/gadget/f_fastboot.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> > index 8ba55aab9f8f..1fcffaf9dd26 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
> >   {
> >   	int rx_remain = fastboot_data_remaining();
> >   	unsigned int rem;
> > -	unsigned int maxpacket = usb_endpoint_maxp(ep->desc);
> > +	unsigned int maxpacket = ep->maxpacket;
> 
> Have you ever checked what's the value here of ep->maxpacket and
> usb_endpoint_maxp(ep->desc); in your failure case?

ep->maxpacket is 512, usb_endpoint_maxp(ep->desc) is 18277.

It might just be that there's a bug somewhere else that is covered by
the fact that we wouldn't get any transfer longer than 512 with
ep->maxpacket.

Is there a way to send USB data of arbitrary size without using
fastboot?

Maxime

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-07-03 13:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 13:05 [PATCH 00/12] Random Fixes for the CHIP Pro Maxime Ripard
2021-06-25 13:05 ` [PATCH 01/12] Revert "sunxi: spl: remove DMA related settings of the NAND controller" Maxime Ripard
2021-06-25 13:05 ` [PATCH 02/12] Revert "spl: nand: sunxi: use PIO instead of DMA" Maxime Ripard
2021-06-25 13:05 ` [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size" Maxime Ripard
2021-06-25 13:47   ` Sean Anderson
2021-06-25 14:14     ` Maxime Ripard
2021-06-29  2:27   ` Peng Fan (OSS)
2021-07-03 13:47     ` Maxime Ripard
2021-06-25 13:05 ` [PATCH 04/12] Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE Maxime Ripard
2021-06-25 13:05 ` [PATCH 05/12] mtd: Allow for a longer mtdparts table Maxime Ripard
2021-06-25 13:05 ` [PATCH 06/12] fastboot: Add missing newlines Maxime Ripard
2021-06-25 13:40   ` Andre Przywara
2021-06-25 13:05 ` [PATCH 07/12] configs: chip pro: Disable video output Maxime Ripard
2021-06-25 13:38   ` Andre Przywara
2021-06-25 13:05 ` [PATCH 08/12] clk: sunxi: Add missing clock compatible Maxime Ripard
2021-06-25 13:38   ` Andre Przywara
2021-06-25 13:05 ` [PATCH 09/12] fastboot: nand: Fix return error code Maxime Ripard
2021-06-25 14:08   ` Andre Przywara
2021-06-25 13:05 ` [PATCH 10/12] configs: chip pro: Disable UMS Maxime Ripard
2021-06-25 13:05 ` [PATCH 11/12] configs: chip pro: fix the offsets Maxime Ripard
2021-06-25 13:05 ` [PATCH 12/12] configs: chip pro: Fix NAND Controller name Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.