rockchip: advance tinkerboard u-boot to v2021.01
This commit is contained in:
parent
d81155f331
commit
c674bac80c
@ -9,7 +9,7 @@ BOOTBRANCH='tag:v2017.11'
|
||||
elif [[ $BOARD == xt-q8l-v10 ]]; then
|
||||
BOOTBRANCH='tag:v2021.01'
|
||||
else
|
||||
BOOTBRANCH='tag:v2018.11'
|
||||
BOOTBRANCH='tag:v2021.01'
|
||||
fi
|
||||
|
||||
SERIALCON=ttyS2
|
||||
@ -61,8 +61,9 @@ uboot_custom_postprocess()
|
||||
cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
|
||||
dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
|
||||
else
|
||||
tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin u-boot-rockchip-with-spl.bin
|
||||
cat u-boot-dtb.bin >> u-boot-rockchip-with-spl.bin
|
||||
tools/mkimage -n rk3288 -T rksd -d tpl/u-boot-tpl.bin u-boot-rockchip-with-spl.bin
|
||||
cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
|
||||
dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From 55c00b50794b6cb5c47489b1526d971619d75355 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Mon, 8 Mar 2021 17:05:15 +0000
|
||||
Subject: [PATCH] Patching something
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
scripts/dtc/dtc-lexer.l | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
|
||||
index fd825eb..f57c9a7 100644
|
||||
--- a/scripts/dtc/dtc-lexer.l
|
||||
+++ b/scripts/dtc/dtc-lexer.l
|
||||
@@ -38,7 +38,7 @@ LINECOMMENT "//".*\n
|
||||
#include "srcpos.h"
|
||||
#include "dtc-parser.tab.h"
|
||||
|
||||
-YYLTYPE yylloc;
|
||||
+extern YYLTYPE yylloc;
|
||||
extern bool treesource_error;
|
||||
|
||||
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
|
||||
index 8686a66d1..be2cbf06f 100644
|
||||
--- a/configs/tinker-rk3288_defconfig
|
||||
+++ b/configs/tinker-rk3288_defconfig
|
||||
@@ -19,6 +19,7 @@ CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_SPL_STACK_R=y
|
||||
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
|
||||
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
|
||||
CONFIG_SPL_I2C_SUPPORT=y
|
||||
CONFIG_SPL_POWER_SUPPORT=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
@@ -78,6 +79,9 @@ CONFIG_USB_DWC2=y
|
||||
CONFIG_ROCKCHIP_USB2_PHY=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_MANUFACTURER="ASUS"
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x0b05
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0x7820
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
@ -0,0 +1,48 @@
|
||||
From b89be51a2e80e7a56ddd444cc57b042594016218 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 21:37:32 +0000
|
||||
Subject: [PATCH] rk3288: add emmc to tinkerboard dts
|
||||
|
||||
---
|
||||
arch/arm/dts/rk3288-tinker-u-boot.dtsi | 4 ++++
|
||||
arch/arm/dts/rk3288-tinker.dts | 12 ++++++++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3288-tinker-u-boot.dtsi b/arch/arm/dts/rk3288-tinker-u-boot.dtsi
|
||||
index 56d10c82e..164c72eb7 100644
|
||||
--- a/arch/arm/dts/rk3288-tinker-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/rk3288-tinker-u-boot.dtsi
|
||||
@@ -36,6 +36,10 @@
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
+&emmc {
|
||||
+ u-boot,dm-spl;
|
||||
+};
|
||||
+
|
||||
&sdmmc {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
diff --git a/arch/arm/dts/rk3288-tinker.dts b/arch/arm/dts/rk3288-tinker.dts
|
||||
index 8b1848c31..8db248412 100644
|
||||
--- a/arch/arm/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/dts/rk3288-tinker.dts
|
||||
@@ -31,3 +31,15 @@
|
||||
vbus-supply = <&vcc5v0_host>;
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&emmc {
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ non-removable;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
|
||||
+ max-frequency = <150000000>;
|
||||
+ mmc-hs200-1_8v;
|
||||
+ mmc-ddr-1_8v;
|
||||
+ status = "okay";
|
||||
+};
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -0,0 +1,399 @@
|
||||
From 2636bc3f11c953c24b3af7334082811737bf475b Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 21:41:38 +0000
|
||||
Subject: [PATCH] rk3288: tinkerboard: add UMS mode when USB host is connected
|
||||
to OTG port during boot
|
||||
|
||||
---
|
||||
arch/arm/include/asm/arch-rockchip/gpio.h | 22 ++++
|
||||
arch/arm/mach-rockchip/board.c | 115 +++++++++++++++++++++
|
||||
arch/arm/mach-rockchip/spl.c | 23 ++++-
|
||||
cmd/usb_mass_storage.c | 9 +-
|
||||
common/autoboot.c | 22 ++++
|
||||
common/board_r.c | 1 +
|
||||
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 1 +
|
||||
drivers/usb/gadget/f_mass_storage.c | 10 +-
|
||||
include/init.h | 1 +
|
||||
include/linux/usb/gadget.h | 3 +
|
||||
10 files changed, 203 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/include/asm/arch-rockchip/gpio.h b/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
index 1aaec5fae..135688d3b 100644
|
||||
--- a/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
+++ b/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
@@ -24,6 +24,28 @@ struct rockchip_gpio_regs {
|
||||
};
|
||||
check_member(rockchip_gpio_regs, ls_sync, 0x60);
|
||||
|
||||
+/*
|
||||
+ * RK3288 IO memory map:
|
||||
+ *
|
||||
+ */
|
||||
+#define RKIO_GPIO0_PHYS 0xFF750000
|
||||
+#define RKIO_GRF_PHYS 0xFF770000
|
||||
+#define RKIO_GPIO1_PHYS 0xFF780000
|
||||
+#define RKIO_GPIO2_PHYS 0xFF790000
|
||||
+#define RKIO_GPIO3_PHYS 0xFF7A0000
|
||||
+#define RKIO_GPIO4_PHYS 0xFF7B0000
|
||||
+#define RKIO_GPIO5_PHYS 0xFF7C0000
|
||||
+#define RKIO_GPIO6_PHYS 0xFF7D0000
|
||||
+
|
||||
+/* gpio power down/up control */
|
||||
+#define GRF_GPIO2A_P 0x150
|
||||
+#define GRF_GPIO6A_P 0x190
|
||||
+
|
||||
+/* gpio input/output control */
|
||||
+#define GPIO_SWPORT_DR 0x00
|
||||
+#define GPIO_SWPORT_DDR 0x04
|
||||
+#define GPIO_EXT_PORT 0x50
|
||||
+
|
||||
enum gpio_pu_pd {
|
||||
GPIO_PULL_NORMAL = 0,
|
||||
GPIO_PULL_UP,
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index ba4da72b3..5ae2c7f8f 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -17,10 +17,26 @@
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/periph.h>
|
||||
#include <asm/arch-rockchip/misc.h>
|
||||
+#include <asm/arch-rockchip/gpio.h>
|
||||
+#include <linux/delay.h>
|
||||
#include <power/regulator.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
+enum project_id {
|
||||
+ TinkerBoardS = 0,
|
||||
+ TinkerBoard = 7,
|
||||
+};
|
||||
+
|
||||
+enum pcb_id {
|
||||
+ SR,
|
||||
+ ER,
|
||||
+ PR,
|
||||
+};
|
||||
+
|
||||
+extern bool force_ums;
|
||||
+
|
||||
+
|
||||
__weak int rk_board_late_init(void)
|
||||
{
|
||||
return 0;
|
||||
@@ -33,6 +49,105 @@ int board_late_init(void)
|
||||
return rk_board_late_init();
|
||||
}
|
||||
|
||||
+/*
|
||||
+*
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
+*
|
||||
+*/
|
||||
+void usb_current_limit_ctrl(bool unlock_current)
|
||||
+{
|
||||
+ int tmp;
|
||||
+
|
||||
+ printf("%s: unlock_current = %d\n", __func__, unlock_current);
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ if(unlock_current == true)
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ else
|
||||
+ writel(tmp & ~0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+*
|
||||
+* eMMC maskrom mode : GPIO6_A7 (H:disable maskrom, L:enable maskrom)
|
||||
+*
|
||||
+*/
|
||||
+void rk3288_maskrom_ctrl(bool enable_emmc)
|
||||
+{
|
||||
+ int tmp;
|
||||
+
|
||||
+ printf("%s: enable_emmc = %d\n", __func__, enable_emmc);
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ if(enable_emmc == true)
|
||||
+ writel(tmp | 0x80, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ else
|
||||
+ writel(tmp & ~0x80, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0x80, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ mdelay(10);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+*
|
||||
+* project id : GPIO2_A3 GPIO2_A2 GPIO2_A1
|
||||
+* pcb id : GPIO2_B2 GPIO2_B1 GPIO2_B0
|
||||
+* SDP/CDP : GPIO6_A5 (H:SDP, L:CDP)
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
+* eMMC maskrom mode : GPIO6_A7 (H:disable maskrom, L:enable maskrom)
|
||||
+*
|
||||
+* Please check TRM V1.2 part1 page 152 for the following register settings
|
||||
+*
|
||||
+*/
|
||||
+int check_force_enter_ums_mode(void)
|
||||
+{
|
||||
+ int tmp;
|
||||
+ enum pcb_id pcbid;
|
||||
+ enum project_id projectid;
|
||||
+
|
||||
+ // GPIO2_A3/GPIO2_A2/GPIO2_A1 pull up enable
|
||||
+ tmp = readl(RKIO_GRF_PHYS + GRF_GPIO2A_P);
|
||||
+ writel((tmp&~(0x03F<<2)) | 0x3F<<(16 + 2) | 0x15<<2, RKIO_GRF_PHYS + GRF_GPIO2A_P);
|
||||
+
|
||||
+ // GPIO2_A3/GPIO2_A2/GPIO2_A1/GPIO2_B2/GPIO2_B1/GPIO2_B0 set to input
|
||||
+ tmp = readl(RKIO_GPIO2_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp & ~(0x70E), RKIO_GPIO2_PHYS + GPIO_SWPORT_DDR);
|
||||
+
|
||||
+ // GPIO6_A5 pull up/down disable
|
||||
+ tmp = readl(RKIO_GRF_PHYS + GRF_GPIO6A_P);
|
||||
+ writel((tmp&~(0x03<<10)) | 0x03<<(16 + 10), RKIO_GRF_PHYS + GRF_GPIO6A_P);
|
||||
+
|
||||
+ // GPIO6_A5 set to input
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp & ~(0x20), RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ // read GPIO2_A3/GPIO2_A2/GPIO2_A1 value
|
||||
+ projectid = (readl(RKIO_GPIO2_PHYS + GPIO_EXT_PORT) & 0x0E) >>1;
|
||||
+
|
||||
+ // read GPIO2_B2/GPIO2_B1/GPIO2_B0 value
|
||||
+ pcbid = (readl(RKIO_GPIO2_PHYS + GPIO_EXT_PORT) & 0x700) >> 8;
|
||||
+
|
||||
+ // only Tinker Board S and the PR stage PCB has this function
|
||||
+ if(projectid!=TinkerBoard && pcbid >= ER){
|
||||
+ printf("PC event = 0x%x\n", readl(RKIO_GPIO6_PHYS + GPIO_EXT_PORT)&0x20);
|
||||
+ if((readl(RKIO_GPIO6_PHYS + GPIO_EXT_PORT)&0x20)==0x20) {
|
||||
+ // SDP detected, enable EMMC and unlock usb current limit
|
||||
+ printf("usb connected to SDP, force enter ums mode\n");
|
||||
+ force_ums = true;
|
||||
+ rk3288_maskrom_ctrl(true);
|
||||
+ usb_current_limit_ctrl(true);
|
||||
+ } else {
|
||||
+ usb_current_limit_ctrl(false);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
int ret;
|
||||
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
|
||||
index f148d48b6..59daff438 100644
|
||||
--- a/arch/arm/mach-rockchip/spl.c
|
||||
+++ b/arch/arm/mach-rockchip/spl.c
|
||||
@@ -106,6 +106,27 @@ __weak int arch_cpu_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+*
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
+*
|
||||
+*/
|
||||
+void usb_current_limit_ctrl(bool unlock_current)
|
||||
+{
|
||||
+ int tmp;
|
||||
+
|
||||
+#include <asm/arch/gpio.h>
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ if(unlock_current == true)
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ else
|
||||
+ writel(tmp & ~0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+}
|
||||
+
|
||||
void board_init_f(ulong dummy)
|
||||
{
|
||||
int ret;
|
||||
@@ -122,7 +143,7 @@ void board_init_f(ulong dummy)
|
||||
debug_uart_init();
|
||||
debug("\nspl:debug uart enabled in %s\n", __func__);
|
||||
#endif
|
||||
-
|
||||
+ usb_current_limit_ctrl(true);
|
||||
board_early_init_f();
|
||||
|
||||
ret = spl_early_init();
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index cf2f55994..d406ea453 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -111,7 +111,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
|
||||
name = malloc(UMS_NAME_LEN);
|
||||
if (!name)
|
||||
goto cleanup;
|
||||
- snprintf(name, UMS_NAME_LEN, "UMS disk %d", ums_count);
|
||||
+ snprintf(name, UMS_NAME_LEN, "Armbian UMS disk %d", ums_count);
|
||||
ums[ums_count].name = name;
|
||||
ums[ums_count].block_dev = *block_dev;
|
||||
|
||||
@@ -136,7 +136,7 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
+int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
int argc, char *const argv[])
|
||||
{
|
||||
const char *usb_controller;
|
||||
@@ -218,6 +218,11 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
usb_gadget_handle_interrupts(controller_index);
|
||||
|
||||
rc = fsg_main_thread(NULL);
|
||||
+
|
||||
+ if (rc == -ETIMEDOUT) {
|
||||
+ goto cleanup_register;
|
||||
+ }
|
||||
+
|
||||
if (rc) {
|
||||
/* Check I/O error */
|
||||
if (rc == -EIO)
|
||||
diff --git a/common/autoboot.c b/common/autoboot.c
|
||||
index e628baffb..eefaa28d4 100644
|
||||
--- a/common/autoboot.c
|
||||
+++ b/common/autoboot.c
|
||||
@@ -37,6 +37,9 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
static int stored_bootdelay;
|
||||
static int menukey;
|
||||
|
||||
+bool force_ums = false;
|
||||
+bool getdescriptor = false;
|
||||
+
|
||||
#ifdef CONFIG_AUTOBOOT_ENCRYPTION
|
||||
#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
|
||||
#else
|
||||
@@ -49,6 +52,10 @@ static int menukey;
|
||||
#define AUTOBOOT_MENUKEY 0
|
||||
#endif
|
||||
|
||||
+extern int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
|
||||
+void usb_current_limit_ctrl(bool unlock_current);
|
||||
+void rk3288_maskrom_ctrl(bool enable_emmc);
|
||||
+
|
||||
/*
|
||||
* Use a "constant-length" time compare function for this
|
||||
* hash compare:
|
||||
@@ -363,6 +370,21 @@ void autoboot_command(const char *s)
|
||||
{
|
||||
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
|
||||
|
||||
+ if (force_ums) {
|
||||
+ // force to enter ums mode
|
||||
+ char *local_args[4];
|
||||
+ char str1[]="ums", str2[]="1", str3[]="mmc", str4[]="0";
|
||||
+
|
||||
+ local_args[0]=str1;
|
||||
+ local_args[1]=str2;
|
||||
+ local_args[2]=str3;
|
||||
+ local_args[3]=str4;
|
||||
+ if (do_usb_mass_storage(NULL, 0, 4, local_args) == -ETIMEDOUT) {
|
||||
+ rk3288_maskrom_ctrl(false);
|
||||
+ usb_current_limit_ctrl(false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (s && (stored_bootdelay == -2 ||
|
||||
(stored_bootdelay != -1 && !abortboot(stored_bootdelay)))) {
|
||||
bool lock;
|
||||
diff --git a/common/board_r.c b/common/board_r.c
|
||||
index 29dd7d26d..5b952d00c 100644
|
||||
--- a/common/board_r.c
|
||||
+++ b/common/board_r.c
|
||||
@@ -797,6 +797,7 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_MMC
|
||||
initr_mmc,
|
||||
#endif
|
||||
+ check_force_enter_ums_mode,
|
||||
#ifdef CONFIG_XEN
|
||||
initr_xen,
|
||||
#endif
|
||||
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
index f17009a29..b85b3f825 100644
|
||||
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
@@ -1393,6 +1393,7 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
|
||||
debug_cond(DEBUG_SETUP != 0,
|
||||
"%s: *** USB_REQ_GET_DESCRIPTOR\n",
|
||||
__func__);
|
||||
+ getdescriptor = true;
|
||||
break;
|
||||
|
||||
case USB_REQ_SET_INTERFACE:
|
||||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
|
||||
index 45f0504b6..80706d41b 100644
|
||||
--- a/drivers/usb/gadget/f_mass_storage.c
|
||||
+++ b/drivers/usb/gadget/f_mass_storage.c
|
||||
@@ -655,7 +655,7 @@ static void busy_indicator(void)
|
||||
static int sleep_thread(struct fsg_common *common)
|
||||
{
|
||||
int rc = 0;
|
||||
- int i = 0, k = 0;
|
||||
+ int i = 0, k = 0, j = 0;
|
||||
|
||||
/* Wait until a signal arrives or we are woken up */
|
||||
for (;;) {
|
||||
@@ -666,6 +666,7 @@ static int sleep_thread(struct fsg_common *common)
|
||||
busy_indicator();
|
||||
i = 0;
|
||||
k++;
|
||||
+ j++;
|
||||
}
|
||||
|
||||
if (k == 10) {
|
||||
@@ -680,6 +681,13 @@ static int sleep_thread(struct fsg_common *common)
|
||||
k = 0;
|
||||
}
|
||||
|
||||
+ if (j == 300) { //about 3 seconds
|
||||
+ if(force_ums && !getdescriptor) {
|
||||
+ printf("wait for usb get descriptor cmd timeout\n");
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
usb_gadget_handle_interrupts(controller_index);
|
||||
}
|
||||
common->thread_wakeup_needed = 0;
|
||||
diff --git a/include/init.h b/include/init.h
|
||||
index 0f48ccb57..bae1cb88e 100644
|
||||
--- a/include/init.h
|
||||
+++ b/include/init.h
|
||||
@@ -261,6 +261,7 @@ int board_early_init_f(void);
|
||||
/* manipulate the U-Boot fdt before its relocation */
|
||||
int board_fix_fdt(void *rw_fdt_blob);
|
||||
int board_late_init(void);
|
||||
+int check_force_enter_ums_mode (void);
|
||||
int board_postclk_init(void); /* after clocks/timebase, before env/serial */
|
||||
int board_early_init_r(void);
|
||||
|
||||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
|
||||
index 06292ddeb..48709f3b0 100644
|
||||
--- a/include/linux/usb/gadget.h
|
||||
+++ b/include/linux/usb/gadget.h
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
struct usb_ep;
|
||||
|
||||
+extern bool force_ums;
|
||||
+extern bool getdescriptor;
|
||||
+
|
||||
/**
|
||||
* struct usb_request - describes one i/o request
|
||||
* @buf: Buffer used for data. Always provide this; some controllers
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From e8926f5e4dd307c01b59883db7ae76e67bb47894 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 12:58:06 +0000
|
||||
Subject: [PATCH] rk3288: tinkerboard-s emmc boot
|
||||
|
||||
---
|
||||
include/configs/tinker_rk3288.h | 9 +--------
|
||||
1 file changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/include/configs/tinker_rk3288.h b/include/configs/tinker_rk3288.h
|
||||
index 269ec529..e19fa902 100644
|
||||
--- a/include/configs/tinker_rk3288.h
|
||||
+++ b/include/configs/tinker_rk3288.h
|
||||
@@ -13,13 +13,6 @@
|
||||
|
||||
#include <configs/rk3288_common.h>
|
||||
|
||||
-#undef BOOT_TARGET_DEVICES
|
||||
-
|
||||
-#define BOOT_TARGET_DEVICES(func) \
|
||||
- func(MMC, mmc, 0) \
|
||||
- func(MMC, mmc, 1) \
|
||||
- func(USB, usb, 0) \
|
||||
- func(PXE, pxe, na) \
|
||||
- func(DHCP, dchp, na)
|
||||
+#define CONFIG_SYS_MMC_ENV_DEV 0
|
||||
|
||||
#endif
|
||||
|
||||
From b8a75200b11fc0005a8e12192473159e51abd29c Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 13:05:33 +0000
|
||||
Subject: [PATCH] rk3288: fix redefined symbol
|
||||
|
||||
---
|
||||
include/configs/tinker_rk3288.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/configs/tinker_rk3288.h b/include/configs/tinker_rk3288.h
|
||||
index e19fa9021..bde7d72e6 100644
|
||||
--- a/include/configs/tinker_rk3288.h
|
||||
+++ b/include/configs/tinker_rk3288.h
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <configs/rk3288_common.h>
|
||||
|
||||
+#undef CONFIG_SYS_MMC_ENV_DEV
|
||||
#define CONFIG_SYS_MMC_ENV_DEV 0
|
||||
|
||||
#endif
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From d0d5938a3f8a524a884c460c5870c0c966daf152 Mon Sep 17 00:00:00 2001
|
||||
From: jamess_huang <Jamess_Huang@asus.com>
|
||||
Date: Fri, 11 Aug 2017 18:10:22 +0800
|
||||
Subject: [PATCH 18/50] pmic: enable LDO2 vcc33_mipi at bootup
|
||||
|
||||
power up camera module to prevent i2c-2 SDA pulled low
|
||||
|
||||
Change-Id: I199bef9c8aa4385dbda33117e2ca0c64dc7a13d4
|
||||
---
|
||||
board/rockchip/tinker_rk3288/tinker-rk3288.c | 38 ++++++++++++++++++++
|
||||
1 file changed, 38 insertions(+)
|
||||
mode change 100644 => 100755 board/rockchip/tinker_rk3288/tinker-rk3288.c
|
||||
|
||||
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
|
||||
index c2872e7330..5618bd9923 100644
|
||||
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
|
||||
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <dm.h>
|
||||
#include <i2c_eeprom.h>
|
||||
#include <netdev.h>
|
||||
+#include <power/regulator.h>
|
||||
+
|
||||
|
||||
static int get_ethaddr_from_eeprom(u8 *addr)
|
||||
{
|
||||
@@ -33,3 +35,39 @@ int rk_board_late_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+
|
||||
+#ifdef CONFIG_DM_PMIC
|
||||
+static int rockchip_set_regulator_on(const char *name, uint uv)
|
||||
+{
|
||||
+ struct udevice *dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = regulator_get_by_platname(name, &dev);
|
||||
+ if (ret) {
|
||||
+ debug("%s: Cannot find regulator %s\n", __func__, name);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ ret = regulator_set_value(dev, uv);
|
||||
+ if (ret) {
|
||||
+ debug("%s: Cannot set regulator %s\n", __func__, name);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ ret = regulator_set_enable(dev, 1);
|
||||
+ if (ret) {
|
||||
+ debug("%s: Cannot enable regulator %s\n", __func__, name);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int power_init_board(void)
|
||||
+{
|
||||
+ int ret = rockchip_set_regulator_on("vcc33_mipi", 3300000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -1,24 +1,22 @@
|
||||
From 11b9e1141895e719e2ad4421f746c4b5359c671b Mon Sep 17 00:00:00 2001
|
||||
From: jamess_huang <Jamess_Huang@asus.com>
|
||||
Date: Thu, 12 Oct 2017 11:47:27 +0800
|
||||
Subject: [PATCH 36/50] auto enable ums mode when TinkerBoard is connected to
|
||||
PC
|
||||
From 5ede1fabf35a0a4f041d619e69d07c4fa60ca155 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 11:50:17 +0000
|
||||
Subject: [PATCH] rk3288: autoenable UMS mode if OTG port is connected to PC
|
||||
|
||||
Change-Id: Ice3f37906ab1ae0428c1d23867a58c5c720aa8ab
|
||||
---
|
||||
arch/arm/include/asm/arch-rockchip/gpio.h | 22 ++++++++
|
||||
arch/arm/mach-rockchip/rk3288-board.c | 62 +++++++++++++++++++++++
|
||||
arch/arm/mach-rockchip/board.c | 65 +++++++++++++++++++++++
|
||||
cmd/usb_mass_storage.c | 2 +-
|
||||
common/autoboot.c | 17 +++++++
|
||||
common/autoboot.c | 17 ++++++
|
||||
common/board_r.c | 1 +
|
||||
include/common.h | 1 +
|
||||
6 files changed, 104 insertions(+), 1 deletion(-)
|
||||
include/init.h | 1 +
|
||||
6 files changed, 107 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/include/asm/arch-rockchip/gpio.h b/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
index e39218d0a9..10f4f41e67 100644
|
||||
index 1aaec5fa..135688d3 100644
|
||||
--- a/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
+++ b/arch/arm/include/asm/arch-rockchip/gpio.h
|
||||
@@ -25,4 +25,26 @@ struct rockchip_gpio_regs {
|
||||
@@ -24,6 +24,28 @@ struct rockchip_gpio_regs {
|
||||
};
|
||||
check_member(rockchip_gpio_regs, ls_sync, 0x60);
|
||||
|
||||
@ -44,12 +42,14 @@ index e39218d0a9..10f4f41e67 100644
|
||||
+#define GPIO_SWPORT_DDR 0x04
|
||||
+#define GPIO_EXT_PORT 0x50
|
||||
+
|
||||
#endif
|
||||
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
index f1569e62b6..32f70a5920 100644
|
||||
--- a/arch/arm/mach-rockchip/rk3288-board.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
@@ -22,6 +22,19 @@
|
||||
enum gpio_pu_pd {
|
||||
GPIO_PULL_NORMAL = 0,
|
||||
GPIO_PULL_UP,
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index ba4da72b..fc53f2e8 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -21,6 +21,20 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@ -65,11 +65,12 @@ index f1569e62b6..32f70a5920 100644
|
||||
+};
|
||||
+
|
||||
+extern bool force_ums;
|
||||
+
|
||||
+
|
||||
__weak int rk_board_late_init(void)
|
||||
{
|
||||
return 0;
|
||||
@@ -91,6 +104,55 @@ int board_late_init(void)
|
||||
@@ -33,6 +47,57 @@ int board_late_init(void)
|
||||
return rk_board_late_init();
|
||||
}
|
||||
|
||||
@ -117,47 +118,52 @@ index f1569e62b6..32f70a5920 100644
|
||||
+ writel(tmp | 0xc0, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0xc0, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ mdelay(10);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
#if !CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
|
||||
static int veyron_init(void)
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
int ret;
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index 3353f95c74..cb5260b558 100644
|
||||
index cf2f5599..ee8a2802 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -133,7 +133,7 @@ cleanup:
|
||||
@@ -136,7 +136,7 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
|
||||
+int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
|
||||
int argc, char * const argv[])
|
||||
-static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
+int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
int argc, char *const argv[])
|
||||
{
|
||||
const char *usb_controller;
|
||||
diff --git a/common/autoboot.c b/common/autoboot.c
|
||||
index c52bad84a4..d63a4d7e79 100644
|
||||
index e628baff..ea282664 100644
|
||||
--- a/common/autoboot.c
|
||||
+++ b/common/autoboot.c
|
||||
@@ -28,6 +28,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
/* Stored value of bootdelay, used by autoboot_command() */
|
||||
@@ -37,6 +37,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
static int stored_bootdelay;
|
||||
static int menukey;
|
||||
|
||||
+bool force_ums = false;
|
||||
+
|
||||
#if defined(CONFIG_AUTOBOOT_KEYED)
|
||||
#if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)
|
||||
#ifdef CONFIG_AUTOBOOT_ENCRYPTION
|
||||
#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
|
||||
#else
|
||||
@@ -49,6 +51,8 @@ static int menukey;
|
||||
#define AUTOBOOT_MENUKEY 0
|
||||
#endif
|
||||
|
||||
@@ -339,10 +341,25 @@ const char *bootdelay_process(void)
|
||||
return s;
|
||||
}
|
||||
|
||||
+extern int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
+extern int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
|
||||
+
|
||||
void autoboot_command(const char *s)
|
||||
/*
|
||||
* Use a "constant-length" time compare function for this
|
||||
* hash compare:
|
||||
@@ -363,6 +367,19 @@ void autoboot_command(const char *s)
|
||||
{
|
||||
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
|
||||
|
||||
@ -174,33 +180,32 @@ index c52bad84a4..d63a4d7e79 100644
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
|
||||
#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
|
||||
int prev = disable_ctrlc(1); /* disable Control C checking */
|
||||
if (s && (stored_bootdelay == -2 ||
|
||||
(stored_bootdelay != -1 && !abortboot(stored_bootdelay)))) {
|
||||
bool lock;
|
||||
diff --git a/common/board_r.c b/common/board_r.c
|
||||
index ecca1edb04..77b3a05693 100644
|
||||
index 29dd7d26..5b952d00 100644
|
||||
--- a/common/board_r.c
|
||||
+++ b/common/board_r.c
|
||||
@@ -800,6 +800,7 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_CMD_ONENAND
|
||||
initr_onenand,
|
||||
#endif
|
||||
+ check_force_enter_ums_mode,
|
||||
@@ -797,6 +797,7 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_MMC
|
||||
initr_mmc,
|
||||
#endif
|
||||
diff --git a/include/common.h b/include/common.h
|
||||
index 751665f8a4..13a6e563c3 100644
|
||||
--- a/include/common.h
|
||||
+++ b/include/common.h
|
||||
@@ -418,6 +418,7 @@ extern ssize_t spi_write (uchar *, int, uchar *, int);
|
||||
int board_early_init_f (void);
|
||||
int board_fix_fdt (void *rw_fdt_blob); /* manipulate the U-Boot fdt before its relocation */
|
||||
int board_late_init (void);
|
||||
+ check_force_enter_ums_mode,
|
||||
#ifdef CONFIG_XEN
|
||||
initr_xen,
|
||||
#endif
|
||||
diff --git a/include/init.h b/include/init.h
|
||||
index 0f48ccb5..bae1cb88 100644
|
||||
--- a/include/init.h
|
||||
+++ b/include/init.h
|
||||
@@ -261,6 +261,7 @@ int board_early_init_f(void);
|
||||
/* manipulate the U-Boot fdt before its relocation */
|
||||
int board_fix_fdt(void *rw_fdt_blob);
|
||||
int board_late_init(void);
|
||||
+int check_force_enter_ums_mode (void);
|
||||
int board_postclk_init (void); /* after clocks/timebase, before env/serial */
|
||||
int board_early_init_r (void);
|
||||
void board_poweroff (void);
|
||||
--
|
||||
2.17.1
|
||||
int board_postclk_init(void); /* after clocks/timebase, before env/serial */
|
||||
int board_early_init_r(void);
|
||||
|
||||
--
|
||||
2.30.2
|
||||
@ -1,25 +0,0 @@
|
||||
From b41031b54e5d4355d2f27f7297b72c030f435167 Mon Sep 17 00:00:00 2001
|
||||
From: jamess_huang <Jamess_Huang@asus.com>
|
||||
Date: Tue, 17 Oct 2017 14:38:28 +0800
|
||||
Subject: [PATCH 37/50] add 10ms delay after re-enable EMMC
|
||||
|
||||
Change-Id: I022d050be22c5436822cb2057e70b17d88e65d7a
|
||||
---
|
||||
arch/arm/mach-rockchip/rk3288-board.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
index 32f70a5920..07f4125780 100644
|
||||
--- a/arch/arm/mach-rockchip/rk3288-board.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
@@ -136,6 +136,7 @@ int check_force_enter_ums_mode(void)
|
||||
writel(tmp | 0xc0, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
writel(tmp | 0xc0, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ mdelay(10);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -1,62 +1,21 @@
|
||||
From eff570086cca1c909725dc71b26b84f5bfd2b7a9 Mon Sep 17 00:00:00 2001
|
||||
From: jamess_huang <Jamess_Huang@asus.com>
|
||||
Date: Fri, 27 Oct 2017 16:09:06 +0800
|
||||
Subject: [PATCH 39/50] fixed enter ums mode fail sometimes
|
||||
From c793281fb8fb1d6a4c8573f2e7497cf07344dea6 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 11:58:43 +0000
|
||||
Subject: [PATCH] rk3288: fix UMS mode fail sometimes
|
||||
|
||||
Change-Id: I9e40cb0d8d5873588f7bf9b844e036071d13ff16
|
||||
---
|
||||
arch/arm/mach-rockchip/rk3288-board-spl.c | 22 +++++++
|
||||
arch/arm/mach-rockchip/rk3288-board.c | 70 +++++++++++++++++++----
|
||||
2 files changed, 80 insertions(+), 12 deletions(-)
|
||||
arch/arm/mach-rockchip/board.c | 70 ++++++++++++++++++++++++++++------
|
||||
arch/arm/mach-rockchip/spl.c | 23 ++++++++++-
|
||||
2 files changed, 80 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
|
||||
index a0d0ce2ff4..5f7ff2dc49 100644
|
||||
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
|
||||
@@ -185,6 +185,27 @@ static int phycore_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+*
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
+*
|
||||
+*/
|
||||
+void usb_current_limit_ctrl(bool unlock_current)
|
||||
+{
|
||||
+ int tmp;
|
||||
+
|
||||
+#include <asm/arch/gpio.h>
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ if(unlock_current == true)
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ else
|
||||
+ writel(tmp & ~0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+}
|
||||
+
|
||||
void board_init_f(ulong dummy)
|
||||
{
|
||||
struct udevice *pinctrl;
|
||||
@@ -213,6 +234,7 @@ void board_init_f(ulong dummy)
|
||||
*/
|
||||
debug_uart_init();
|
||||
debug("\nspl:debug uart enabled in %s\n", __func__);
|
||||
+ usb_current_limit_ctrl(true);
|
||||
ret = spl_early_init();
|
||||
if (ret) {
|
||||
debug("spl_early_init() failed: %d\n", ret);
|
||||
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
index 07f4125780..f73520925b 100644
|
||||
--- a/arch/arm/mach-rockchip/rk3288-board.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
@@ -92,18 +92,67 @@ int board_late_init(void)
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index fc53f2e8..e7a14973 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -47,18 +47,67 @@ int board_late_init(void)
|
||||
return rk_board_late_init();
|
||||
}
|
||||
|
||||
|
||||
+/*
|
||||
+*
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
@ -112,32 +71,32 @@ index 07f4125780..f73520925b 100644
|
||||
int tmp;
|
||||
enum pcb_id pcbid;
|
||||
enum project_id projectid;
|
||||
|
||||
|
||||
- // GPIO2_A1/GPIO2_A2/GPIO2_A3 pull up enable
|
||||
- // please check TRM V1.2 part1 page 152
|
||||
+ // GPIO2_A3/GPIO2_A2/GPIO2_A1 pull up enable
|
||||
tmp = readl(RKIO_GRF_PHYS + GRF_GPIO2A_P);
|
||||
writel((tmp&~(0x03F<<2)) | 0x3F<<(16 + 2) | 0x15<<2, RKIO_GRF_PHYS + GRF_GPIO2A_P);
|
||||
|
||||
|
||||
- // GPIO2_A1/GPIO2_A2/GPIO2_A3/GPIO2_B0/GPIO2_B1/GPIO2_B2 set to input
|
||||
+ // GPIO2_A3/GPIO2_A2/GPIO2_A1/GPIO2_B2/GPIO2_B1/GPIO2_B0 set to input
|
||||
tmp = readl(RKIO_GPIO2_PHYS + GPIO_SWPORT_DDR);
|
||||
writel(tmp & ~(0x70E), RKIO_GPIO2_PHYS + GPIO_SWPORT_DDR);
|
||||
|
||||
@@ -117,10 +166,10 @@ int check_force_enter_ums_mode(void)
|
||||
|
||||
|
||||
@@ -72,10 +121,10 @@ int check_force_enter_ums_mode(void)
|
||||
|
||||
mdelay(10);
|
||||
|
||||
|
||||
- // read GPIO2_A1/GPIO2_A2/GPIO2_A3 value
|
||||
+ // read GPIO2_A3/GPIO2_A2/GPIO2_A1 value
|
||||
projectid = (readl(RKIO_GPIO2_PHYS + GPIO_EXT_PORT) & 0x0E) >>1;
|
||||
|
||||
|
||||
- // read GPIO2_B0/GPIO2_B1/GPIO2_B2 value
|
||||
+ // read GPIO2_B2/GPIO2_B1/GPIO2_B0 value
|
||||
pcbid = (readl(RKIO_GPIO2_PHYS + GPIO_EXT_PORT) & 0x700) >> 8;
|
||||
|
||||
|
||||
// only Tinker Board S and the PR stage PCB has this function
|
||||
@@ -130,13 +179,10 @@ int check_force_enter_ums_mode(void)
|
||||
@@ -85,13 +134,10 @@ int check_force_enter_ums_mode(void)
|
||||
// SDP detected, enable EMMC and unlock usb current limit
|
||||
printf("usb connected to SDP, force enter ums mode\n");
|
||||
force_ums = true;
|
||||
@ -155,6 +114,47 @@ index 07f4125780..f73520925b 100644
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
--
|
||||
2.17.1
|
||||
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
|
||||
index f148d48b..59daff43 100644
|
||||
--- a/arch/arm/mach-rockchip/spl.c
|
||||
+++ b/arch/arm/mach-rockchip/spl.c
|
||||
@@ -106,6 +106,27 @@ __weak int arch_cpu_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+*
|
||||
+* usb current limit : GPIO6_A6 (H:unlock, L:lock)
|
||||
+*
|
||||
+*/
|
||||
+void usb_current_limit_ctrl(bool unlock_current)
|
||||
+{
|
||||
+ int tmp;
|
||||
+
|
||||
+#include <asm/arch/gpio.h>
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ if(unlock_current == true)
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+ else
|
||||
+ writel(tmp & ~0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
+
|
||||
+ tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+ writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DDR);
|
||||
+}
|
||||
+
|
||||
void board_init_f(ulong dummy)
|
||||
{
|
||||
int ret;
|
||||
@@ -122,7 +143,7 @@ void board_init_f(ulong dummy)
|
||||
debug_uart_init();
|
||||
debug("\nspl:debug uart enabled in %s\n", __func__);
|
||||
#endif
|
||||
-
|
||||
+ usb_current_limit_ctrl(true);
|
||||
board_early_init_f();
|
||||
|
||||
ret = spl_early_init();
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From f5ada57f6298f3485e1fc6250ca2ab3be28862bb Mon Sep 17 00:00:00 2001
|
||||
From: scorpio_chang <Scorpio_Chang@asus.com>
|
||||
Date: Thu, 1 Feb 2018 09:46:47 +0800
|
||||
Subject: [PATCH 45/50] modify UMS name of uboot
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Change-Id: Ibab54e15374db3c3c88460d2c3180e9787e4c426
|
||||
Reviewed-on: https://tp-biosrd-v02/gerrit/82114
|
||||
Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
||||
Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
||||
---
|
||||
cmd/usb_mass_storage.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index cb5260b558..4c3da13115 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -108,7 +108,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
|
||||
name = malloc(UMS_NAME_LEN);
|
||||
if (!name)
|
||||
goto cleanup;
|
||||
- snprintf(name, UMS_NAME_LEN, "UMS disk %d", ums_count);
|
||||
+ snprintf(name, UMS_NAME_LEN, "Armbian UMS disk %d", ums_count);
|
||||
ums[ums_count].name = name;
|
||||
ums[ums_count].block_dev = *block_dev;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
From d00bb7fac4dd22f286db069f1f344686251fa0a0 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 12:00:45 +0000
|
||||
Subject: [PATCH 1/2] rk3288: change UMS mode name
|
||||
|
||||
---
|
||||
cmd/usb_mass_storage.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index ee8a2802..7f4623b7 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -111,7 +111,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
|
||||
name = malloc(UMS_NAME_LEN);
|
||||
if (!name)
|
||||
goto cleanup;
|
||||
- snprintf(name, UMS_NAME_LEN, "UMS disk %d", ums_count);
|
||||
+ snprintf(name, UMS_NAME_LEN, "Armbian UMS disk %d", ums_count);
|
||||
ums[ums_count].name = name;
|
||||
ums[ums_count].block_dev = *block_dev;
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,146 +0,0 @@
|
||||
From 7ffd3d083ac59f2b40ebea5b10334c541a5c6311 Mon Sep 17 00:00:00 2001
|
||||
From: jamess_huang <Jamess_Huang@asus.com>
|
||||
Date: Thu, 22 Feb 2018 15:28:45 +0800
|
||||
Subject: [PATCH 49/50] added timeout when force entering UMS mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Change-Id: I971d105a86628fa4282d1d801e05fabebf0b6569
|
||||
Reviewed-on: https://tp-biosrd-v02/gerrit/82232
|
||||
Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
||||
Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
||||
---
|
||||
arch/arm/mach-rockchip/rk3288-board.c | 4 +++-
|
||||
cmd/usb_mass_storage.c | 4 ++++
|
||||
common/autoboot.c | 8 ++++++--
|
||||
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 1 +
|
||||
drivers/usb/gadget/f_mass_storage.c | 10 +++++++++-
|
||||
include/linux/usb/gadget.h | 3 +++
|
||||
6 files changed, 26 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
index f73520925b..1e40429af9 100644
|
||||
--- a/arch/arm/mach-rockchip/rk3288-board.c
|
||||
+++ b/arch/arm/mach-rockchip/rk3288-board.c
|
||||
@@ -101,6 +101,7 @@ void usb_current_limit_ctrl(bool unlock_current)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
+ printf("%s: unlock_current = %d\n", __func__, unlock_current);
|
||||
tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
if(unlock_current == true)
|
||||
writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
@@ -120,6 +121,7 @@ void rk3288_maskrom_ctrl(bool enable_emmc)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
+ printf("%s: enable_emmc = %d\n", __func__, enable_emmc);
|
||||
tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
if(enable_emmc == true)
|
||||
writel(tmp | 0x80, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index 4c3da13115..806b2e3dc0 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -215,6 +215,10 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
|
||||
usb_gadget_handle_interrupts(controller_index);
|
||||
|
||||
rc = fsg_main_thread(NULL);
|
||||
+
|
||||
+ if (rc == -ETIMEDOUT) {
|
||||
+ goto cleanup_register;
|
||||
+ }
|
||||
if (rc) {
|
||||
/* Check I/O error */
|
||||
if (rc == -EIO)
|
||||
diff --git a/common/autoboot.c b/common/autoboot.c
|
||||
index d63a4d7e79..81b6579f7c 100644
|
||||
--- a/common/autoboot.c
|
||||
+++ b/common/autoboot.c
|
||||
@@ -29,6 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
static int stored_bootdelay;
|
||||
|
||||
bool force_ums = false;
|
||||
+bool getdescriptor = false;
|
||||
|
||||
#if defined(CONFIG_AUTOBOOT_KEYED)
|
||||
#if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)
|
||||
@@ -356,8 +357,11 @@ void autoboot_command(const char *s)
|
||||
local_args[1]=str2;
|
||||
local_args[2]=str3;
|
||||
local_args[3]=str4;
|
||||
- do_usb_mass_storage(NULL, 0, 4, local_args);
|
||||
- return;
|
||||
+
|
||||
+ if (do_usb_mass_storage(NULL, 0, 4, local_args) == -ETIMEDOUT) {
|
||||
+ rk3288_maskrom_ctrl(false);
|
||||
+ usb_current_limit_ctrl(false);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
|
||||
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
index 0d6d2fba8a..b9277b8b0a 100644
|
||||
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
@@ -1368,6 +1368,7 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
|
||||
debug_cond(DEBUG_SETUP != 0,
|
||||
"%s: *** USB_REQ_GET_DESCRIPTOR\n",
|
||||
__func__);
|
||||
+ getdescriptor = true;
|
||||
break;
|
||||
|
||||
case USB_REQ_SET_INTERFACE:
|
||||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
|
||||
index 1ecb92ac6b..aad8fa4951 100644
|
||||
--- a/drivers/usb/gadget/f_mass_storage.c
|
||||
+++ b/drivers/usb/gadget/f_mass_storage.c
|
||||
@@ -666,7 +666,7 @@ static void busy_indicator(void)
|
||||
static int sleep_thread(struct fsg_common *common)
|
||||
{
|
||||
int rc = 0;
|
||||
- int i = 0, k = 0;
|
||||
+ int i = 0, k = 0, j = 0;
|
||||
|
||||
/* Wait until a signal arrives or we are woken up */
|
||||
for (;;) {
|
||||
@@ -677,6 +677,7 @@ static int sleep_thread(struct fsg_common *common)
|
||||
busy_indicator();
|
||||
i = 0;
|
||||
k++;
|
||||
+ j++;
|
||||
}
|
||||
|
||||
if (k == 10) {
|
||||
@@ -691,6 +692,13 @@ static int sleep_thread(struct fsg_common *common)
|
||||
k = 0;
|
||||
}
|
||||
|
||||
+ if (j == 300) { //about 3 seconds
|
||||
+ if(force_ums && !getdescriptor) {
|
||||
+ printf("wait for usb get descriptor cmd timeout\n");
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
usb_gadget_handle_interrupts(0);
|
||||
}
|
||||
common->thread_wakeup_needed = 0;
|
||||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
|
||||
index b824f13477..305cc56b04 100644
|
||||
--- a/include/linux/usb/gadget.h
|
||||
+++ b/include/linux/usb/gadget.h
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
struct usb_ep;
|
||||
|
||||
+extern bool force_ums;
|
||||
+extern bool getdescriptor;
|
||||
+
|
||||
/**
|
||||
* struct usb_request - describes one i/o request
|
||||
* @buf: Buffer used for data. Always provide this; some controllers
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
From a33812fc37a6f1ca23c02e785fdb7d405e12b769 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 12:06:20 +0000
|
||||
Subject: [PATCH 2/2] rk3288: add timeout when forcing UMS mode
|
||||
|
||||
---
|
||||
arch/arm/mach-rockchip/board.c | 2 ++
|
||||
cmd/usb_mass_storage.c | 5 +++++
|
||||
common/autoboot.c | 7 +++++--
|
||||
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 1 +
|
||||
drivers/usb/gadget/f_mass_storage.c | 10 +++++++++-
|
||||
include/linux/usb/gadget.h | 3 +++
|
||||
6 files changed, 25 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index e7a14973..b31823d3 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -56,6 +56,7 @@ void usb_current_limit_ctrl(bool unlock_current)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
+ printf("%s: unlock_current = %d\n", __func__, unlock_current);
|
||||
tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
if(unlock_current == true)
|
||||
writel(tmp | 0x40, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
@@ -75,6 +76,7 @@ void rk3288_maskrom_ctrl(bool enable_emmc)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
+ printf("%s: enable_emmc = %d\n", __func__, enable_emmc);
|
||||
tmp = readl(RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
if(enable_emmc == true)
|
||||
writel(tmp | 0x80, RKIO_GPIO6_PHYS + GPIO_SWPORT_DR);
|
||||
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
|
||||
index 7f4623b7..d406ea45 100644
|
||||
--- a/cmd/usb_mass_storage.c
|
||||
+++ b/cmd/usb_mass_storage.c
|
||||
@@ -218,6 +218,11 @@ int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
|
||||
usb_gadget_handle_interrupts(controller_index);
|
||||
|
||||
rc = fsg_main_thread(NULL);
|
||||
+
|
||||
+ if (rc == -ETIMEDOUT) {
|
||||
+ goto cleanup_register;
|
||||
+ }
|
||||
+
|
||||
if (rc) {
|
||||
/* Check I/O error */
|
||||
if (rc == -EIO)
|
||||
diff --git a/common/autoboot.c b/common/autoboot.c
|
||||
index ea282664..86f1c6e0 100644
|
||||
--- a/common/autoboot.c
|
||||
+++ b/common/autoboot.c
|
||||
@@ -38,6 +38,7 @@ static int stored_bootdelay;
|
||||
static int menukey;
|
||||
|
||||
bool force_ums = false;
|
||||
+bool getdescriptor = false;
|
||||
|
||||
#ifdef CONFIG_AUTOBOOT_ENCRYPTION
|
||||
#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
|
||||
@@ -376,8 +377,10 @@ void autoboot_command(const char *s)
|
||||
local_args[1]=str2;
|
||||
local_args[2]=str3;
|
||||
local_args[3]=str4;
|
||||
- do_usb_mass_storage(NULL, 0, 4, local_args);
|
||||
- return;
|
||||
+ if (do_usb_mass_storage(NULL, 0, 4, local_args) == -ETIMEDOUT) {
|
||||
+ rk3288_maskrom_ctrl(false);
|
||||
+ usb_current_limit_ctrl(false);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (s && (stored_bootdelay == -2 ||
|
||||
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
index f17009a2..b85b3f82 100644
|
||||
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
|
||||
@@ -1393,6 +1393,7 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
|
||||
debug_cond(DEBUG_SETUP != 0,
|
||||
"%s: *** USB_REQ_GET_DESCRIPTOR\n",
|
||||
__func__);
|
||||
+ getdescriptor = true;
|
||||
break;
|
||||
|
||||
case USB_REQ_SET_INTERFACE:
|
||||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
|
||||
index 45f0504b..80706d41 100644
|
||||
--- a/drivers/usb/gadget/f_mass_storage.c
|
||||
+++ b/drivers/usb/gadget/f_mass_storage.c
|
||||
@@ -655,7 +655,7 @@ static void busy_indicator(void)
|
||||
static int sleep_thread(struct fsg_common *common)
|
||||
{
|
||||
int rc = 0;
|
||||
- int i = 0, k = 0;
|
||||
+ int i = 0, k = 0, j = 0;
|
||||
|
||||
/* Wait until a signal arrives or we are woken up */
|
||||
for (;;) {
|
||||
@@ -666,6 +666,7 @@ static int sleep_thread(struct fsg_common *common)
|
||||
busy_indicator();
|
||||
i = 0;
|
||||
k++;
|
||||
+ j++;
|
||||
}
|
||||
|
||||
if (k == 10) {
|
||||
@@ -680,6 +681,13 @@ static int sleep_thread(struct fsg_common *common)
|
||||
k = 0;
|
||||
}
|
||||
|
||||
+ if (j == 300) { //about 3 seconds
|
||||
+ if(force_ums && !getdescriptor) {
|
||||
+ printf("wait for usb get descriptor cmd timeout\n");
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
usb_gadget_handle_interrupts(controller_index);
|
||||
}
|
||||
common->thread_wakeup_needed = 0;
|
||||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
|
||||
index 06292dde..48709f3b 100644
|
||||
--- a/include/linux/usb/gadget.h
|
||||
+++ b/include/linux/usb/gadget.h
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
struct usb_ep;
|
||||
|
||||
+extern bool force_ums;
|
||||
+extern bool getdescriptor;
|
||||
+
|
||||
/**
|
||||
* struct usb_request - describes one i/o request
|
||||
* @buf: Buffer used for data. Always provide this; some controllers
|
||||
|
||||
From 6152cefbf39df4c3023acaa48caa71be33a3f629 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 13:18:17 +0000
|
||||
Subject: [PATCH] rk3288: fix some errors
|
||||
|
||||
---
|
||||
arch/arm/mach-rockchip/board.c | 9 +++++----
|
||||
common/autoboot.c | 4 +++-
|
||||
2 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index b31823d38..0932482ce 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/periph.h>
|
||||
#include <asm/arch-rockchip/misc.h>
|
||||
+#include <linux/delay.h>
|
||||
#include <power/regulator.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
diff --git a/common/autoboot.c b/common/autoboot.c
|
||||
index 86f1c6e02..eefaa28d4 100644
|
||||
--- a/common/autoboot.c
|
||||
+++ b/common/autoboot.c
|
||||
@@ -52,7 +52,9 @@ bool getdescriptor = false;
|
||||
#define AUTOBOOT_MENUKEY 0
|
||||
#endif
|
||||
|
||||
-extern int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
|
||||
+extern int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
|
||||
+void usb_current_limit_ctrl(bool unlock_current);
|
||||
+void rk3288_maskrom_ctrl(bool enable_emmc);
|
||||
|
||||
/*
|
||||
* Use a "constant-length" time compare function for this
|
||||
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
|
||||
index 0932482ce..5ae2c7f8f 100644
|
||||
--- a/arch/arm/mach-rockchip/board.c
|
||||
+++ b/arch/arm/mach-rockchip/board.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/periph.h>
|
||||
#include <asm/arch-rockchip/misc.h>
|
||||
+#include <asm/arch-rockchip/gpio.h>
|
||||
#include <linux/delay.h>
|
||||
#include <power/regulator.h>
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
|
||||
index ac878c71..e2bed4e0 100644
|
||||
--- a/configs/tinker-rk3288_defconfig
|
||||
+++ b/configs/tinker-rk3288_defconfig
|
||||
@@ -72,9 +72,9 @@ CONFIG_USB_DWC2=y
|
||||
CONFIG_ROCKCHIP_USB2_PHY=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_GADGET=y
|
||||
-CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
|
||||
-CONFIG_USB_GADGET_VENDOR_NUM=0x2207
|
||||
-CONFIG_USB_GADGET_PRODUCT_NUM=0x320a
|
||||
+CONFIG_USB_GADGET_MANUFACTURER="ASUS"
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x0b05
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0x7820
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_FUNCTION_MASS_STORAGE=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
@ -0,0 +1,35 @@
|
||||
From 765addf2084584dd589f97ad7b6d2d0b6e94c2bd Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 19 Mar 2022 12:09:56 +0000
|
||||
Subject: [PATCH] rk3288: add tinkerboard USB gadget VID and PID
|
||||
|
||||
---
|
||||
configs/tinker-rk3288_defconfig | 3 +++
|
||||
configs/tinker-s-rk3288_defconfig | 3 +++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
|
||||
index 8686a66d..3fa25b1a 100644
|
||||
--- a/configs/tinker-rk3288_defconfig
|
||||
+++ b/configs/tinker-rk3288_defconfig
|
||||
@@ -88,3 +88,6 @@ CONFIG_VIDEO_ROCKCHIP=y
|
||||
CONFIG_DISPLAY_ROCKCHIP_HDMI=y
|
||||
CONFIG_CMD_DHRYSTONE=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
+CONFIG_USB_GADGET_MANUFACTURER="ASUS"
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x0b05
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0x7820
|
||||
diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig
|
||||
index 22714833..93b8c858 100644
|
||||
--- a/configs/tinker-s-rk3288_defconfig
|
||||
+++ b/configs/tinker-s-rk3288_defconfig
|
||||
@@ -90,3 +90,6 @@ CONFIG_DISPLAY_ROCKCHIP_HDMI=y
|
||||
CONFIG_CONSOLE_SCROLL_LINES=10
|
||||
CONFIG_CMD_DHRYSTONE=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
+CONFIG_USB_GADGET_MANUFACTURER="ASUS"
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x0b05
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0x7820
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
|
||||
--- a/configs/tinker-rk3288_defconfig
|
||||
+++ b/configs/tinker-rk3288_defconfig
|
||||
@@ -13,7 +13,7 @@
|
||||
# CONFIG_ANDROID_BOOT_IMAGE is not set
|
||||
CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_CONSOLE_MUX=y
|
||||
-CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb"
|
||||
+CONFIG_DEFAULT_FDT_FILE="rk3288-tinker-s.dtb"
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_SPL_STACK_R=y
|
||||
diff --git a/arch/arm/dts/rk3288-tinker.dtsi b/arch/arm/dts/rk3288-tinker.dtsi
|
||||
index a752458..14cca73 100644
|
||||
--- a/arch/arm/dts/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/dts/rk3288-tinker.dtsi
|
||||
@@ -143,6 +143,21 @@
|
||||
vqmmc-supply = <&vccio_sd>;
|
||||
};
|
||||
|
||||
+&emmc {
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ disable-wp;
|
||||
+ non-removable;
|
||||
+ num-slots = <1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
|
||||
+ max-frequency = <150000000>;
|
||||
+ mmc-hs200-1_8v;
|
||||
+ mmc-ddr-1_8v;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+
|
||||
&gpu {
|
||||
mali-supply = <&vdd_gpu>;
|
||||
status = "okay";
|
||||
diff --git a/include/configs/tinker_rk3288.h b/include/configs/tinker_rk3288.h
|
||||
index 58eea3c..cc585dc 100644
|
||||
--- a/include/configs/tinker_rk3288.h
|
||||
+++ b/include/configs/tinker_rk3288.h
|
||||
@@ -7,17 +7,14 @@
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
-#define ROCKCHIP_DEVICE_SETTINGS
|
||||
-#include <configs/rk3288_common.h>
|
||||
+#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
+ "stdin=serial,cros-ec-keyb\0"\
|
||||
+ "stdout=serial,vidconsole\0"\
|
||||
+ "stderr=serial,vidconsole\0"
|
||||
|
||||
-#undef BOOT_TARGET_DEVICES
|
||||
|
||||
-#define BOOT_TARGET_DEVICES(func) \
|
||||
- func(MMC, mmc, 1) \
|
||||
- func(USB, usb, 0) \
|
||||
- func(PXE, pxe, na) \
|
||||
- func(DHCP, dchp, na)
|
||||
+#include <configs/rk3288_common.h>
|
||||
|
||||
-#define CONFIG_SYS_MMC_ENV_DEV 1
|
||||
+#define CONFIG_SYS_MMC_ENV_DEV 0
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user