uboot-mediatek: update to version 2023.07.02
Release 2023.07 got tagged wrongly and replaced by follow-up release 2023.07.02. Now using upstream DTS for BPi-R3. Removed two patches which made it upstream, refreshed the rest. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_VERSION:=2023.04 | ||||
| PKG_HASH:=e31cac91545ff41b71cec5d8c22afd695645cd6e2a442ccdacacd60534069341 | ||||
| PKG_VERSION:=2023.07.02 | ||||
| PKG_HASH:=6b6a48581c14abb0f95bd87c1af4d740922406d7b801002a9f94727fdde021d5 | ||||
| PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host | ||||
|  | ||||
| include $(INCLUDE_DIR)/u-boot.mk | ||||
|   | ||||
| @@ -21,7 +21,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  CONFIG_SYS_PROMPT="MT7622> " | ||||
|  CONFIG_DEBUG_UART_BASE=0x11002000 | ||||
|  CONFIG_DEBUG_UART_CLOCK=25000000 | ||||
| @@ -24,6 +26,9 @@ CONFIG_CMD_SF_TEST=y | ||||
| @@ -25,6 +27,9 @@ CONFIG_CMD_SF_TEST=y | ||||
|  CONFIG_CMD_PING=y | ||||
|  CONFIG_CMD_SMC=y | ||||
|  CONFIG_ENV_OVERWRITE=y | ||||
|   | ||||
| @@ -1,88 +0,0 @@ | ||||
| From patchwork Wed Apr 12 20:36:43 2023 | ||||
| Content-Type: text/plain; charset="utf-8" | ||||
| MIME-Version: 1.0 | ||||
| Content-Transfer-Encoding: 7bit | ||||
| X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org> | ||||
| X-Patchwork-Id: 1768270 | ||||
| Return-Path: <u-boot-bounces@lists.denx.de> | ||||
| X-Original-To: incoming@patchwork.ozlabs.org | ||||
| Delivered-To: patchwork-incoming@legolas.ozlabs.org | ||||
| Date: Wed, 12 Apr 2023 21:36:43 +0100 | ||||
| From: Daniel Golle <daniel@makrotopia.org> | ||||
| To: u-boot@lists.denx.de, Sam Shih <sam.shih@mediatek.com>, | ||||
|  GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>, | ||||
|  Chunfeng Yun <chunfeng.yun@mediatek.com>, | ||||
|  Weijie Gao <weijie.gao@mediatek.com>, Ryder Lee <ryder.lee@mediatek.com>, | ||||
|  Frank Wunderlich <frank-w@public-files.de> | ||||
| Cc: Steven Liu =?utf-8?b?KOWKieS6uuixqik=?= <steven.liu@mediatek.com>, | ||||
|  John Crispin <john@phrozen.org> | ||||
| Subject: [PATCH] pinctrl: mediatek: set R1/R0 in case pullen/pullsel succeeded | ||||
| Message-ID: <ZDcWW7kLSLn1GMZ1@makrotopia.org> | ||||
| MIME-Version: 1.0 | ||||
| Content-Disposition: inline | ||||
| X-BeenThere: u-boot@lists.denx.de | ||||
| X-Mailman-Version: 2.1.39 | ||||
| Precedence: list | ||||
| List-Id: U-Boot discussion <u-boot.lists.denx.de> | ||||
| Sender: "U-Boot" <u-boot-bounces@lists.denx.de> | ||||
|  | ||||
| Commit dafe0fbfb0f3 ("pinctrl: mediatek: rewrite mtk_pinconf_set and | ||||
| related functions") changed the logic deciding to set R0 and R1 | ||||
| registers for V1 devices. | ||||
|  | ||||
| Before: | ||||
| 	/* Also set PUPD/R0/R1 if the pin has them */ | ||||
| 	err = mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_PUPD, !pullup); | ||||
| 	if (err != -EINVAL) { | ||||
| 		mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R0, r0); | ||||
| 		mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R1, r1); | ||||
| 	} | ||||
|  | ||||
| After: | ||||
| 	/* try pupd_r1_r0 if pullen_pullsel return error */ | ||||
| 	err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup, | ||||
| 						  val); | ||||
| 	if (err) | ||||
| 		return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable, | ||||
| 						       pullup, val); | ||||
|  | ||||
| Tracing mtk_pinconf_bias_set_pullen_pullsel shows that the function | ||||
| always either returns 0 in case of success or -EINVAL in case any error | ||||
| has occurred. Hence the logic responsible of the decision to program R0 | ||||
| and R1 has been inverted. | ||||
|  | ||||
| This leads to problems on BananaPi R2 (MT7623N) when booting from | ||||
| SDMMC, it turns out accessing eMMC no longer works since | ||||
| U-Boot 2022.07: | ||||
|  | ||||
| MT7623> mmc dev 0 | ||||
| Card did not respond to voltage select! : -110 | ||||
|  | ||||
| The problem wasn't detected for a long time as both eMMC and SDMMC work | ||||
| fine if they are used to boot from, and hence R0 and R1 were already | ||||
| setup by the bootrom and/or preloader. | ||||
|  | ||||
| Fix the logic to restore the originally intended and correct behavior | ||||
| and also change the descriptive comment accordingly. | ||||
|  | ||||
| Fixes: dafe0fbfb0f3 ("pinctrl: mediatek: rewrite mtk_pinconf_set and related functions") | ||||
| Signed-off-by: Daniel Golle <daniel@makrotopia.org> | ||||
| --- | ||||
|  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
|  | ||||
| --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c | ||||
| +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c | ||||
| @@ -349,10 +349,10 @@ int mtk_pinconf_bias_set_v1(struct udevi | ||||
|  { | ||||
|  	int err; | ||||
|   | ||||
| -	/* try pupd_r1_r0 if pullen_pullsel return error */ | ||||
| +	/* set pupd_r1_r0 if pullen_pullsel succeeded */ | ||||
|  	err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup, | ||||
|  						  val); | ||||
| -	if (err) | ||||
| +	if (!err) | ||||
|  		return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable, | ||||
|  						       pullup, val); | ||||
|   | ||||
| @@ -49,7 +49,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  config SYS_NAND_MAX_OOBFREE | ||||
| --- a/drivers/mtd/Makefile | ||||
| +++ b/drivers/mtd/Makefile | ||||
| @@ -38,3 +38,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR | ||||
| @@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR | ||||
|  obj-$(CONFIG_SPL_UBI) += ubispl/ | ||||
|   | ||||
|  endif | ||||
|   | ||||
| @@ -31,16 +31,16 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mtd/Kconfig | ||||
| +++ b/drivers/mtd/Kconfig | ||||
| @@ -272,4 +272,6 @@ source "drivers/mtd/spi/Kconfig" | ||||
| @@ -274,4 +274,6 @@ source "drivers/mtd/ubi/Kconfig" | ||||
|   | ||||
|  source "drivers/mtd/ubi/Kconfig" | ||||
|  source "drivers/mtd/nvmxip/Kconfig" | ||||
|   | ||||
| +source "drivers/mtd/nmbm/Kconfig" | ||||
| + | ||||
|  endmenu | ||||
| --- a/drivers/mtd/Makefile | ||||
| +++ b/drivers/mtd/Makefile | ||||
| @@ -40,3 +40,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ | ||||
| @@ -41,3 +41,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ | ||||
|  endif | ||||
|   | ||||
|  obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/ | ||||
|   | ||||
| @@ -34,7 +34,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  #if defined(CONFIG_CMD_ONENAND) | ||||
|  /* go init the NAND */ | ||||
|  static int initr_onenand(void) | ||||
| @@ -703,6 +717,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
| @@ -696,6 +710,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_CMD_ONENAND | ||||
|  	initr_onenand, | ||||
|  #endif | ||||
|   | ||||
| @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -1352,6 +1352,12 @@ config CMD_NAND_TORTURE | ||||
| @@ -1353,6 +1353,12 @@ config CMD_NAND_TORTURE | ||||
|   | ||||
|  endif # CMD_NAND | ||||
|   | ||||
| @@ -30,7 +30,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	depends on NVME | ||||
| --- a/cmd/Makefile | ||||
| +++ b/cmd/Makefile | ||||
| @@ -123,6 +123,7 @@ obj-y += legacy-mtd-utils.o | ||||
| @@ -125,6 +125,7 @@ obj-y += legacy-mtd-utils.o | ||||
|  endif | ||||
|  obj-$(CONFIG_CMD_MUX) += mux.o | ||||
|  obj-$(CONFIG_CMD_NAND) += nand.o | ||||
|   | ||||
| @@ -26,7 +26,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -1352,6 +1352,14 @@ config CMD_NAND_TORTURE | ||||
| @@ -1353,6 +1353,14 @@ config CMD_NAND_TORTURE | ||||
|   | ||||
|  endif # CMD_NAND | ||||
|   | ||||
| @@ -43,7 +43,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	bool "nmbm" | ||||
| --- a/cmd/Makefile | ||||
| +++ b/cmd/Makefile | ||||
| @@ -123,6 +123,7 @@ obj-y += legacy-mtd-utils.o | ||||
| @@ -125,6 +125,7 @@ obj-y += legacy-mtd-utils.o | ||||
|  endif | ||||
|  obj-$(CONFIG_CMD_MUX) += mux.o | ||||
|  obj-$(CONFIG_CMD_NAND) += nand.o | ||||
|   | ||||
| @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mtd/spi/spi-nor-core.c | ||||
| +++ b/drivers/mtd/spi/spi-nor-core.c | ||||
| @@ -2818,6 +2818,100 @@ static int spi_nor_init_params(struct sp | ||||
| @@ -2848,6 +2848,100 @@ static int spi_nor_init_params(struct sp | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| @@ -114,7 +114,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size) | ||||
|  { | ||||
|  	size_t i; | ||||
| @@ -3930,6 +4024,7 @@ int spi_nor_scan(struct spi_nor *nor) | ||||
| @@ -4045,6 +4139,7 @@ int spi_nor_scan(struct spi_nor *nor) | ||||
|  	nor->write = spi_nor_write_data; | ||||
|  	nor->read_reg = spi_nor_read_reg; | ||||
|  	nor->write_reg = spi_nor_write_reg; | ||||
|   | ||||
| @@ -23,7 +23,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
| +++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi | ||||
| @@ -40,3 +40,11 @@ | ||||
|  &snfi { | ||||
|  	u-boot,dm-pre-reloc; | ||||
|  	bootph-all; | ||||
|  }; | ||||
| + | ||||
| +&pinctrl { | ||||
|   | ||||
| @@ -55,7 +55,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  		reg = <0x11014000 0x1000>; | ||||
| --- a/configs/mt7622_rfb_defconfig | ||||
| +++ b/configs/mt7622_rfb_defconfig | ||||
| @@ -21,6 +21,7 @@ CONFIG_SYS_MAXARGS=8 | ||||
| @@ -22,6 +22,7 @@ CONFIG_SYS_MAXARGS=8 | ||||
|  CONFIG_SYS_PBSIZE=1049 | ||||
|  CONFIG_CMD_BOOTMENU=y | ||||
|  CONFIG_CMD_MMC=y | ||||
| @@ -63,7 +63,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  CONFIG_CMD_PCI=y | ||||
|  CONFIG_CMD_SF_TEST=y | ||||
|  CONFIG_CMD_PING=y | ||||
| @@ -40,6 +41,10 @@ CONFIG_SYSCON=y | ||||
| @@ -41,6 +42,10 @@ CONFIG_SYSCON=y | ||||
|  CONFIG_CLK=y | ||||
|  CONFIG_MMC_HS200_SUPPORT=y | ||||
|  CONFIG_MMC_MTK=y | ||||
|   | ||||
| @@ -18,14 +18,14 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1288,6 +1288,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1308,6 +1308,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7623n-bananapi-bpi-r2.dtb \ | ||||
|  	mt7629-rfb.dtb \ | ||||
|  	mt7981-rfb.dtb \ | ||||
| +	mt7981-snfi-nand-rfb.dtb \ | ||||
|  	mt7981-emmc-rfb.dtb \ | ||||
|  	mt7981-sd-rfb.dtb \ | ||||
|  	mt7986a-rfb.dtb \ | ||||
|  	mt7986a-bpi-r3-sd.dtb \ | ||||
| --- /dev/null | ||||
| +++ b/arch/arm/dts/mt7981-snfi-nand-rfb.dts | ||||
| @@ -0,0 +1,132 @@ | ||||
|   | ||||
| @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mtd/spi/spi-nor-core.c | ||||
| +++ b/drivers/mtd/spi/spi-nor-core.c | ||||
| @@ -672,6 +672,7 @@ static int set_4byte(struct spi_nor *nor | ||||
| @@ -673,6 +673,7 @@ static int set_4byte(struct spi_nor *nor | ||||
|  	case SNOR_MFR_ISSI: | ||||
|  	case SNOR_MFR_MACRONIX: | ||||
|  	case SNOR_MFR_WINBOND: | ||||
|   | ||||
| @@ -207,8 +207,8 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
| -	ret = spinand_manufacturer_detect(spinand); | ||||
| +	ret = spinand_id_detect(spinand); | ||||
|  	if (ret) { | ||||
|  		dev_err(spinand->slave->dev, "unknown raw ID %*phN\n", | ||||
|  			SPINAND_MAX_ID_LEN, spinand->id.data); | ||||
|  		dev_err(spinand->slave->dev, "unknown raw ID %02x %02x %02x %02x\n", | ||||
|  			spinand->id.data[0], spinand->id.data[1], | ||||
| --- a/drivers/mtd/nand/spi/gigadevice.c | ||||
| +++ b/drivers/mtd/nand/spi/gigadevice.c | ||||
| @@ -22,8 +22,13 @@ | ||||
|   | ||||
| @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mmc/Kconfig | ||||
| +++ b/drivers/mmc/Kconfig | ||||
| @@ -823,6 +823,14 @@ config MMC_MTK | ||||
| @@ -820,6 +820,14 @@ config MMC_MTK | ||||
|  	  This is needed if support for any SD/SDIO/MMC devices is required. | ||||
|  	  If unsure, say N. | ||||
|   | ||||
| @@ -32,7 +32,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  config FSL_SDHC_V2_3 | ||||
| --- a/drivers/mmc/Makefile | ||||
| +++ b/drivers/mmc/Makefile | ||||
| @@ -84,3 +84,7 @@ obj-$(CONFIG_RENESAS_SDHI)		+= tmio-comm | ||||
| @@ -83,3 +83,7 @@ obj-$(CONFIG_RENESAS_SDHI)		+= tmio-comm | ||||
|  obj-$(CONFIG_MMC_BCM2835)		+= bcm2835_sdhost.o | ||||
|  obj-$(CONFIG_MMC_MTK)			+= mtk-sd.o | ||||
|  obj-$(CONFIG_MMC_SDHCI_F_SDH30)		+= f_sdh30.o | ||||
|   | ||||
| @@ -0,0 +1,33 @@ | ||||
| --- a/arch/arm/dts/mt7988.dtsi | ||||
| +++ b/arch/arm/dts/mt7988.dtsi | ||||
| @@ -61,6 +61,30 @@ | ||||
|  		#clock-cells = <0>; | ||||
|  	}; | ||||
|   | ||||
| +	psci { | ||||
| +		compatible  = "arm,psci-0.2"; | ||||
| +		method      = "smc"; | ||||
| +	}; | ||||
| + | ||||
| +	reserved-memory { | ||||
| +		#address-cells = <2>; | ||||
| +		#size-cells = <2>; | ||||
| +		ranges; | ||||
| + | ||||
| +		/* 64 KiB reserved for ramoops/pstore */ | ||||
| +		ramoops@42ff0000 { | ||||
| +			compatible = "ramoops"; | ||||
| +			reg = <0 0x42ff0000 0 0x10000>; | ||||
| +			record-size = <0x1000>; | ||||
| +		}; | ||||
| + | ||||
| +		/* 320 KiB reserved for ARM Trusted Firmware (BL31+BL32) */ | ||||
| +		secmon_reserved: secmon@43000000 { | ||||
| +			reg = <0 0x43000000 0 0x50000>; | ||||
| +			no-map; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
|  	hwver: hwver { | ||||
|  		compatible = "mediatek,hwver", "syscon"; | ||||
|  		reg = <0 0x8000000 0 0x1000>; | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/tools/Makefile | ||||
| +++ b/tools/Makefile | ||||
| @@ -115,7 +115,6 @@ dumpimage-mkimage-objs := aisimage.o \ | ||||
| @@ -116,7 +116,6 @@ dumpimage-mkimage-objs := aisimage.o \ | ||||
|  			imximage.o \ | ||||
|  			imx8image.o \ | ||||
|  			imx8mimage.o \ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -1067,7 +1067,7 @@ quiet_cmd_pad_cat = CAT     $@ | ||||
| @@ -1070,7 +1070,7 @@ quiet_cmd_pad_cat = CAT     $@ | ||||
|  cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; } | ||||
|   | ||||
|  quiet_cmd_lzma = LZMA    $@ | ||||
|   | ||||
| @@ -122,7 +122,7 @@ | ||||
|  		   int arch, int ph_type, int bootstage_id, | ||||
| --- a/include/image.h | ||||
| +++ b/include/image.h | ||||
| @@ -1046,6 +1046,7 @@ int fit_parse_subimage(const char *spec, | ||||
| @@ -1047,6 +1047,7 @@ int fit_parse_subimage(const char *spec, | ||||
|  		ulong *addr, const char **image_name); | ||||
|   | ||||
|  int fit_get_subimage_count(const void *fit, int images_noffset); | ||||
|   | ||||
| @@ -1,11 +0,0 @@ | ||||
| --- a/common/menu.c | ||||
| +++ b/common/menu.c | ||||
| @@ -15,7 +15,7 @@ | ||||
|   | ||||
|  #include "menu.h" | ||||
|   | ||||
| -#define ansi 0 | ||||
| +#define ansi 1 | ||||
|   | ||||
|  /* | ||||
|   * Internally, each item in a menu is represented by a struct menu_item. | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -601,6 +601,12 @@ config CMD_ENV_EXISTS | ||||
| @@ -602,6 +602,12 @@ config CMD_ENV_EXISTS | ||||
|  	  Check if a variable is defined in the environment for use in | ||||
|  	  shell scripting. | ||||
|   | ||||
| @@ -76,7 +76,7 @@ | ||||
|  #if defined(CONFIG_CMD_ENV_CALLBACK) | ||||
|  static int print_static_binding(const char *var_name, const char *callback_name, | ||||
|  				void *priv) | ||||
| @@ -1231,6 +1285,9 @@ static struct cmd_tbl cmd_env_sub[] = { | ||||
| @@ -1228,6 +1282,9 @@ static struct cmd_tbl cmd_env_sub[] = { | ||||
|  	U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""), | ||||
|  #endif | ||||
|  	U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""), | ||||
| @@ -86,7 +86,7 @@ | ||||
|  #if defined(CONFIG_CMD_RUN) | ||||
|  	U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""), | ||||
|  #endif | ||||
| @@ -1322,6 +1379,9 @@ static char env_help_text[] = | ||||
| @@ -1319,6 +1376,9 @@ static char env_help_text[] = | ||||
|  #if defined(CONFIG_CMD_NVEDIT_EFI) | ||||
|  	"env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n" | ||||
|  #endif | ||||
| @@ -96,7 +96,7 @@ | ||||
|  #if defined(CONFIG_CMD_RUN) | ||||
|  	"env run var [...] - run commands in an environment variable\n" | ||||
|  #endif | ||||
| @@ -1431,6 +1491,17 @@ U_BOOT_CMD( | ||||
| @@ -1428,6 +1488,17 @@ U_BOOT_CMD( | ||||
|  ); | ||||
|  #endif | ||||
|   | ||||
|   | ||||
| @@ -16,7 +16,7 @@ Reviewed-by: Tom Rini <trini@konsulko.com> | ||||
|  | ||||
| --- a/boot/image-fdt.c | ||||
| +++ b/boot/image-fdt.c | ||||
| @@ -636,6 +636,12 @@ int image_setup_libfdt(struct bootm_head | ||||
| @@ -637,6 +637,12 @@ int image_setup_libfdt(struct bootm_head | ||||
|  					images->fit_uname_cfg, | ||||
|  					strlen(images->fit_uname_cfg) + 1, 1); | ||||
|   | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -2000,26 +2000,7 @@ endif | ||||
| @@ -2006,26 +2006,7 @@ endif | ||||
|  # Check dtc and pylibfdt, if DTC is provided, else build them | ||||
|  PHONY += scripts_dtc | ||||
|  scripts_dtc: scripts_basic | ||||
|   | ||||
| @@ -0,0 +1,46 @@ | ||||
| --- a/board/mediatek/mt7988/mt7988_rfb.c | ||||
| +++ b/board/mediatek/mt7988/mt7988_rfb.c | ||||
| @@ -4,7 +4,43 @@ | ||||
|   * Author: Sam Shih <sam.shih@mediatek.com> | ||||
|   */ | ||||
|   | ||||
| +#include <common.h> | ||||
| +#include <config.h> | ||||
| +#include <dm.h> | ||||
| +#include <button.h> | ||||
| +#include <env.h> | ||||
| +#include <init.h> | ||||
| +#include <asm/global_data.h> | ||||
| +#include <linux/delay.h> | ||||
| + | ||||
| +#ifndef CONFIG_RESET_BUTTON_LABEL | ||||
| +#define CONFIG_RESET_BUTTON_LABEL "reset" | ||||
| +#endif | ||||
| + | ||||
|  int board_init(void) | ||||
|  { | ||||
|  	return 0; | ||||
|  } | ||||
| + | ||||
| +int board_late_init(void) | ||||
| +{ | ||||
| +	gd->env_valid = 1; //to load environment variable from persistent store | ||||
| +	struct udevice *dev; | ||||
| + | ||||
| +	gd->env_valid = ENV_VALID; | ||||
| +	if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) { | ||||
| +		puts("reset button found\n"); | ||||
| +#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY | ||||
| +		if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) { | ||||
| +			button_get_state(dev); | ||||
| +			mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY); | ||||
| +		} | ||||
| +#endif | ||||
| +		if (button_get_state(dev) == BUTTON_ON) { | ||||
| +			puts("button pushed, resetting environment\n"); | ||||
| +			gd->env_valid = ENV_INVALID; | ||||
| +		} | ||||
| +	} | ||||
| +	env_relocate(); | ||||
| +	return 0; | ||||
| +} | ||||
| @@ -20,14 +20,14 @@ | ||||
| +&snand { | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&snfi_pins>; | ||||
| +	quad-spi; | ||||
|  	status = "okay"; | ||||
| - | ||||
| -	spi-flash@0{ | ||||
| -		compatible = "jedec,spi-nor"; | ||||
| -		reg = <0>; | ||||
| -		u-boot,dm-pre-reloc; | ||||
| -		bootph-all; | ||||
| -	}; | ||||
| +	quad-spi; | ||||
|  }; | ||||
|   | ||||
|  &uart0 { | ||||
|   | ||||
| @@ -344,7 +344,7 @@ | ||||
| +}; | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1285,6 +1285,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1305,6 +1305,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7622-rfb.dtb \ | ||||
|  	mt7623a-unielec-u7623-02-emmc.dtb \ | ||||
|  	mt7622-bananapi-bpi-r64.dtb \ | ||||
|   | ||||
| @@ -341,7 +341,7 @@ | ||||
| +}; | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1286,6 +1286,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1306,6 +1306,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7623a-unielec-u7623-02-emmc.dtb \ | ||||
|  	mt7622-bananapi-bpi-r64.dtb \ | ||||
|  	mt7622-linksys-e8450-ubi.dtb \ | ||||
| @@ -433,7 +433,7 @@ | ||||
|  #ifdef CONFIG_MMC | ||||
|  static int initr_mmc(void) | ||||
|  { | ||||
| @@ -720,6 +735,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
| @@ -713,6 +728,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_NMBM_MTD | ||||
|  	initr_nmbm, | ||||
|  #endif | ||||
|   | ||||
| @@ -1,14 +1,3 @@ | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1293,6 +1293,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7981-snfi-nand-rfb.dtb \ | ||||
|  	mt7981-emmc-rfb.dtb \ | ||||
|  	mt7981-sd-rfb.dtb \ | ||||
| +	mt7986a-bpi-r3-sd.dtb \ | ||||
| +	mt7986a-bpi-r3-emmc.dtb \ | ||||
|  	mt7986a-rfb.dtb \ | ||||
|  	mt7986b-rfb.dtb \ | ||||
|  	mt7986a-sd-rfb.dtb \ | ||||
| --- /dev/null | ||||
| +++ b/configs/mt7986a_bpi-r3-emmc_defconfig | ||||
| @@ -0,0 +1,196 @@ | ||||
| @@ -806,317 +795,6 @@ | ||||
| +CONFIG_USE_SERVERIP=y | ||||
| +CONFIG_SERVERIP="192.168.1.254" | ||||
| --- /dev/null | ||||
| +++ b/arch/arm/dts/mt7986a-bpi-r3-emmc.dts | ||||
| @@ -0,0 +1,33 @@ | ||||
| +// SPDX-License-Identifier: GPL-2.0 | ||||
| +/* | ||||
| + * Copyright (c) 2021 MediaTek Inc. | ||||
| + * Author: Sam Shih <sam.shih@mediatek.com> | ||||
| + */ | ||||
| + | ||||
| +/dts-v1/; | ||||
| +#include "mt7986a-bpi-r3-sd.dts" | ||||
| +#include <dt-bindings/gpio/gpio.h> | ||||
| +/ { | ||||
| +	reg_1p8v: regulator-1p8v { | ||||
| +		compatible = "regulator-fixed"; | ||||
| +		regulator-name = "fixed-1.8V"; | ||||
| +		regulator-min-microvolt = <1800000>; | ||||
| +		regulator-max-microvolt = <1800000>; | ||||
| +		regulator-boot-on; | ||||
| +		regulator-always-on; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&mmc0 { | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&mmc0_pins_default>; | ||||
| +	bus-width = <8>; | ||||
| +	max-frequency = <200000000>; | ||||
| +	cap-mmc-highspeed; | ||||
| +	cap-mmc-hw-reset; | ||||
| +	vmmc-supply = <®_3p3v>; | ||||
| +	vqmmc-supply = <®_1p8v>; | ||||
| +	non-removable; | ||||
| +	status = "okay"; | ||||
| +}; | ||||
| + | ||||
| --- /dev/null | ||||
| +++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts | ||||
| @@ -0,0 +1,272 @@ | ||||
| +// SPDX-License-Identifier: GPL-2.0 | ||||
| +/* | ||||
| + * Copyright (c) 2021 MediaTek Inc. | ||||
| + * Author: Sam Shih <sam.shih@mediatek.com> | ||||
| + */ | ||||
| + | ||||
| +/dts-v1/; | ||||
| +#include <dt-bindings/input/linux-event-codes.h> | ||||
| +#include "mt7986.dtsi" | ||||
| +#include <dt-bindings/gpio/gpio.h> | ||||
| + | ||||
| +/ { | ||||
| +	#address-cells = <1>; | ||||
| +	#size-cells = <1>; | ||||
| +	model = "BananaPi BPi-R3"; | ||||
| +	compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb"; | ||||
| + | ||||
| +	chosen { | ||||
| +		stdout-path = &uart0; | ||||
| +		tick-timer = &timer0; | ||||
| +	}; | ||||
| + | ||||
| +	reg_3p3v: regulator-3p3v { | ||||
| +		compatible = "regulator-fixed"; | ||||
| +		regulator-name = "fixed-3.3V"; | ||||
| +		regulator-min-microvolt = <3300000>; | ||||
| +		regulator-max-microvolt = <3300000>; | ||||
| +		regulator-boot-on; | ||||
| +		regulator-always-on; | ||||
| +	}; | ||||
| + | ||||
| +	keys { | ||||
| +		compatible = "gpio-keys"; | ||||
| +/* | ||||
| +		factory { | ||||
| +			label = "reset"; | ||||
| +			gpios = <&gpio 9 GPIO_ACTIVE_LOW>; | ||||
| +		}; | ||||
| +*/ | ||||
| +		wps { | ||||
| +			label = "reset"; | ||||
| +			gpios = <&gpio 10 GPIO_ACTIVE_LOW>; | ||||
| +			linux,code = <KEY_RESTART>; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	leds { | ||||
| +		compatible = "gpio-leds"; | ||||
| + | ||||
| +		led_status_green: green { | ||||
| +			label = "green:status"; | ||||
| +			gpios = <&gpio 69 GPIO_ACTIVE_HIGH>; | ||||
| +		}; | ||||
| + | ||||
| +		led_status_blue: blue { | ||||
| +			label = "blue:status"; | ||||
| +			gpios = <&gpio 86 GPIO_ACTIVE_HIGH>; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +}; | ||||
| + | ||||
| +&uart0 { | ||||
| +	mediatek,force-highspeed; | ||||
| +	status = "okay"; | ||||
| +}; | ||||
| + | ||||
| +&uart1 { | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&uart1_pins>; | ||||
| +	status = "disabled"; | ||||
| +}; | ||||
| + | ||||
| +ð { | ||||
| +	status = "okay"; | ||||
| +	mediatek,gmac-id = <0>; | ||||
| +	phy-mode = "sgmii"; | ||||
| +	mediatek,switch = "mt7531"; | ||||
| +	reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; | ||||
| + | ||||
| +	fixed-link { | ||||
| +		speed = <1000>; | ||||
| +		full-duplex; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&pinctrl { | ||||
| +	spic_pins: spi1-pins-func-1 { | ||||
| +		mux { | ||||
| +			function = "spi"; | ||||
| +			groups = "spi1_2"; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	uart1_pins: spi1-pins-func-3 { | ||||
| +		mux { | ||||
| +			function = "uart"; | ||||
| +			groups = "uart1_2"; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	pwm_pins: pwm0-pins-func-1 { | ||||
| +		mux { | ||||
| +			function = "pwm"; | ||||
| +			groups = "pwm0"; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	mmc0_pins_default: mmc0default { | ||||
| +		mux { | ||||
| +			function = "flash"; | ||||
| +			groups =  "emmc_51"; | ||||
| +		}; | ||||
| + | ||||
| +		conf-cmd-dat { | ||||
| +			pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", | ||||
| +			       "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", | ||||
| +			       "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; | ||||
| +			input-enable; | ||||
| +			drive-strength = <MTK_DRIVE_4mA>; | ||||
| +			bias-pull-up = <MTK_PUPD_SET_R1R0_01>; | ||||
| +		}; | ||||
| + | ||||
| +		conf-clk { | ||||
| +			pins = "EMMC_CK"; | ||||
| +			drive-strength = <MTK_DRIVE_6mA>; | ||||
| +			bias-pull-down = <MTK_PUPD_SET_R1R0_10>; | ||||
| +		}; | ||||
| + | ||||
| +		conf-dsl { | ||||
| +			pins = "EMMC_DSL"; | ||||
| +			bias-pull-down = <MTK_PUPD_SET_R1R0_10>; | ||||
| +		}; | ||||
| + | ||||
| +		conf-rst { | ||||
| +			pins = "EMMC_RSTB"; | ||||
| +			drive-strength = <MTK_DRIVE_4mA>; | ||||
| +			bias-pull-up = <MTK_PUPD_SET_R1R0_01>; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	spi_flash_pins: spi0-pins-func-1 { | ||||
| +		mux { | ||||
| +			function = "flash"; | ||||
| +			groups = "spi0", "spi0_wp_hold"; | ||||
| +		}; | ||||
| + | ||||
| +		conf-pu { | ||||
| +			pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; | ||||
| +			drive-strength = <MTK_DRIVE_8mA>; | ||||
| +			bias-pull-up = <MTK_PUPD_SET_R1R0_00>; | ||||
| +		}; | ||||
| + | ||||
| +		conf-pd { | ||||
| +			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; | ||||
| +			drive-strength = <MTK_DRIVE_8mA>; | ||||
| +			bias-pull-down = <MTK_PUPD_SET_R1R0_00>; | ||||
| +		}; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&pwm { | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&pwm_pins>; | ||||
| +	status = "okay"; | ||||
| +}; | ||||
| + | ||||
| +&spi0 { | ||||
| +	#address-cells = <1>; | ||||
| +	#size-cells = <0>; | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&spi_flash_pins>; | ||||
| +	status = "okay"; | ||||
| +	must_tx; | ||||
| +	enhance_timing; | ||||
| +	dma_ext; | ||||
| +	ipm_design; | ||||
| +	support_quad; | ||||
| +	tick_dly = <1>; | ||||
| +	sample_sel = <0>; | ||||
| + | ||||
| +	spi_nor@0 { | ||||
| +		compatible = "jedec,spi-nor"; | ||||
| +		reg = <0>; | ||||
| +		spi-max-frequency = <52000000>; | ||||
| + | ||||
| +		partitions { | ||||
| +			compatible = "fixed-partitions"; | ||||
| +			#address-cells = <1>; | ||||
| +			#size-cells = <1>; | ||||
| + | ||||
| +			partition@0 { | ||||
| +				label = "bl2"; | ||||
| +				reg = <0x0 0x40000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@40000 { | ||||
| +				label = "u-boot-env"; | ||||
| +				reg = <0x40000 0x40000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@80000 { | ||||
| +				label = "reserved"; | ||||
| +				reg = <0x80000 0x80000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@100000 { | ||||
| +				label = "fip"; | ||||
| +				reg = <0x100000 0x80000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@180000 { | ||||
| +				label = "recovery"; | ||||
| +				reg = <0x180000 0xa80000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@c00000 { | ||||
| +				label = "fit"; | ||||
| +				reg = <0xc00000 0x1400000>; | ||||
| +			}; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	spi_nand@1 { | ||||
| +		compatible = "spi-nand"; | ||||
| +		reg = <1>; | ||||
| +		spi-max-frequency = <52000000>; | ||||
| + | ||||
| +		partitions { | ||||
| +			compatible = "fixed-partitions"; | ||||
| +			#address-cells = <1>; | ||||
| +			#size-cells = <1>; | ||||
| + | ||||
| +			partition@0 { | ||||
| +				label = "bl2"; | ||||
| +				reg = <0x0 0x80000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@80000 { | ||||
| +				label = "factory"; | ||||
| +				reg = <0x80000 0x300000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@380000 { | ||||
| +				label = "fip"; | ||||
| +				reg = <0x380000 0x200000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@580000 { | ||||
| +				label = "ubi"; | ||||
| +				reg = <0x580000 0x7a80000>; | ||||
| +			}; | ||||
| +		}; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&watchdog { | ||||
| +	status = "disabled"; | ||||
| +}; | ||||
| + | ||||
| +&mmc0 { | ||||
| +	pinctrl-names = "default"; | ||||
| +	pinctrl-0 = <&mmc0_pins_default>; | ||||
| +	bus-width = <4>; | ||||
| +	max-frequency = <52000000>; | ||||
| +	cap-sd-highspeed; | ||||
| +	r_smpl = <1>; | ||||
| +	vmmc-supply = <®_3p3v>; | ||||
| +	vqmmc-supply = <®_3p3v>; | ||||
| +	status = "okay"; | ||||
| +}; | ||||
| + | ||||
| --- /dev/null | ||||
| +++ b/bananapi_bpi-r3_sdmmc_env | ||||
| @@ -0,0 +1,80 @@ | ||||
| +ipaddr=192.168.1.1 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Golle
					Daniel Golle