Random Fixes for the CHIP Pro
Subsystems (6)
cover Random Fixes for the CHIP Pro
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(-)
Signature · 1 line
2.31.1
PATCH 1/12 Revert "sunxi: spl: remove DMA related settings of the NAND controller"
This reverts commit 136e32593335e031558a573158b6180fc80b551f.
--- board/sunxi/board.c | 5 +++++ 1 file changed, 5 insertions(+)
board/sunxi/board.c +5 -0
@@ -395,6 +395,11 @@ static void nand_clock_setup(void)#if definedCONFIG_MACH_SUN6I || definedCONFIG_MACH_SUN8I || \ definedCONFIG_MACH_SUN9I || definedCONFIG_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 ); }
Signature · 1 line
2.31.1
PATCH 2/12 Revert "spl: nand: sunxi: use PIO instead of DMA"
In reply to Maxime RipardThis reverts commit 6ddbb1e936c78cdef1e7395039fa7020c5c75326.
--- drivers/mtd/nand/raw/sunxi_nand_spl.c | 141 ++++++++++++++++---------- 1 file changed, 85 insertions(+), 56 deletions(-)
drivers/mtd/nand/raw/sunxi_nand_spl.c +85 -56
@@ -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)
Signature · 1 line
2.31.1
PATCH 3/12 Revert "usb: gadget: fastboot: use correct max packet size"
In reply to Maxime RipardThis reverts commit 27c9141b1114fd5721437abbb1c694e45e765f19.
--- drivers/usb/gadget/f_fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_fastboot.c +1 -1
@@ -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 ;
Signature · 1 line
2.31.1
Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
Quoted 1 line · Maxime Ripard
This reverts commit
27c9141b1114fd5721437abbb1c694e45e765f19.
Why does this need to be reverted?
--Sean
Quoted 18 lines
--- drivers/usb/gadget/f_fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/gadget/f_fastboot.c +1
-1@@ -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 ;
Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
Hi Sean,
Quoted 4 lines · Sean Anderson
Quoted 1 line · Maxime Ripard
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
Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
In reply to Maxime RipardMaxime
Quoted 10 lines · Maxime Ripard
This reverts commit
27c9141b1114fd5721437abbb1c694e45e765f19.--- drivers/usb/gadget/f_fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/gadget/f_fastboot.c +0
-0
drivers/usb/gadget/f_fastboot.c static unsigned int rx_bytes_expected(struct usb_ep *ep) · line 430
Quoted 5 lines
drivers/usb/gadget/f_fastboot.c +1
-1@@ -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.
Quoted 4 lines
drivers/usb/gadget/f_fastboot.c +0
-0if (rx_remain <=0 )return 0 ;
Re: [PATCH 03/12] Revert "usb: gadget: fastboot: use correct max packet size"
Hi Peng,
Quoted 8 lines · Peng Fan (OSS)
Maxime
Quoted 5 lines · Maxime Ripard
This reverts commit
27c9141b1114fd5721437abbb1c694e45e765f19.--- drivers/usb/gadget/f_fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/usb/gadget/f_fastboot.c static unsigned int rx_bytes_expected(struct usb_ep *ep) · line 430
Quoted 10 lines
drivers/usb/gadget/f_fastboot.c +1
-1@@ -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->maxpacketandusb_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
PATCH 4/12 Kconfig: Migrate SPL_PANIC_ON_RAW_IMAGE
In reply to Maxime RipardThe 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.
--- README | 10 ---------- common/spl/Kconfig | 14 ++++++++++++++ scripts/config_whitelist.txt | 1 - 3 files changed, 14 insertions(+), 11 deletions(-)
README +0 -10
@@ -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
common/spl/Kconfig +14 -0
@@ -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
scripts/config_whitelist.txt +0 -1
@@ -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
Signature · 1 line
2.31.1
PATCH 5/12 mtd: Allow for a longer mtdparts table
In reply to Maxime Ripard20 characters is fairly short for a partition table, let's increase it a bit.
--- drivers/mtd/mtd_uboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtd_uboot.c +1 -1
@@ -15,7 +15,7 @@#include <asm/global_data.h> #include <mtd.h> -#define MTD_NAME_MAX_LEN 20 +#define MTD_NAME_MAX_LEN 64void board_mtdparts_default (const char **mtdids,const char **mtdparts);
Signature · 1 line
2.31.1
PATCH 6/12 fastboot: Add missing newlines
In reply to Maxime RipardMost of the error messages in the NAND fastboot support are missing a \n at the end, add it where relevant.
--- drivers/fastboot/fb_nand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/fastboot/fb_nand.c +5 -5
@@ -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 ; }
Signature · 1 line
2.31.1
Re: [PATCH 06/12] fastboot: Add missing newlines
Quoted 4 lines · On Fri, 25 Jun 2021 15:05:41 +0200 Maxime Ripard <[email protected]> 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 <[email protected]>
Thanks!
Andre
Quoted 51 lines
--- drivers/fastboot/fb_nand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/fastboot/fb_nand.c +5
-5@@ -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 ; }
PATCH 7/12 configs: chip pro: Disable video output
In reply to Maxime RipardThe 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.
--- configs/CHIP_pro_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/CHIP_pro_defconfig +1 -0
@@ -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
Signature · 1 line
2.31.1
Re: [PATCH 07/12] configs: chip pro: Disable video output
Quoted 8 lines · On Fri, 25 Jun 2021 15:05:42 +0200 Maxime Ripard <[email protected]> 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 <[email protected]>
Cheers,
Andre
Quoted 16 lines
--- configs/CHIP_pro_defconfig | 1 + 1 file changed, 1 insertion(+)configs/CHIP_pro_defconfig +1
-0@@ -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
PATCH 8/12 clk: sunxi: Add missing clock compatible
In reply to Maxime RipardThe 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.
--- drivers/clk/sunxi/clk_a10s.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/sunxi/clk_a10s.c +2 -0
@@ -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 }, { } };
Signature · 1 line
2.31.1
Re: [PATCH 08/12] clk: sunxi: Add missing clock compatible
Quoted 7 lines · On Fri, 25 Jun 2021 15:05:43 +0200 Maxime Ripard <[email protected]> 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 <[email protected]>
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:
Cheers,
Andre
Quoted 17 lines
--- drivers/clk/sunxi/clk_a10s.c | 2 ++ 1 file changed, 2 insertions(+)drivers/clk/sunxi/clk_a10s.c +2
-0@@ -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 }, { } };
PATCH 9/12 fastboot: nand: Fix return error code
In reply to Maxime RipardBoth 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.
--- drivers/fastboot/fb_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fastboot/fb_nand.c +2 -2
@@ -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 ) {
Signature · 1 line
2.31.1
Re: [PATCH 09/12] fastboot: nand: Fix return error code
Quoted 7 lines · On Fri, 25 Jun 2021 15:05:44 +0200 Maxime Ripard <[email protected]> wrote:
Both
mtdparts_init()andfind_dev_and_part()will return 0 on success but 1 on failure.Since the calling functions of
fb_nand_lookupexpects a negative error code on failure, we can't just return the returned value of these functions.
Quoted 5 lines
This fixes an issue with the logic that detects whether we support fastboot slots or not by calling
fb_nand_lookupand assuming that anything >= 0 means the partition is there.Signed-off-by Maxime Ripard <[email protected]>
Yes indeed, good catch!
Cheers,
Andre
Quoted 25 lines
--- drivers/fastboot/fb_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/fastboot/fb_nand.c +2
-2@@ -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 ) {
PATCH 10/12 configs: chip pro: Disable UMS
In reply to Maxime RipardThe CHIP Pro doesn't have any block storage device, so enabling UMS makes little sense.
--- configs/CHIP_pro_defconfig | 1 - 1 file changed, 1 deletion(-)
configs/CHIP_pro_defconfig +0 -1
@@ -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
Signature · 1 line
2.31.1
PATCH 11/12 configs: chip pro: fix the offsets
In reply to Maxime RipardThe 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.
--- configs/CHIP_pro_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/CHIP_pro_defconfig +2 -0
@@ -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
Signature · 1 line
2.31.1
PATCH 12/12 configs: chip pro: Fix NAND Controller name
In reply to Maxime RipardThe 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.
--- configs/CHIP_pro_defconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
configs/CHIP_pro_defconfig +2 -2
@@ -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"
Signature · 1 line
2.31.1