]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mach-k3: am642_init: Add support for USB boot mode
authorAswath Govindraju <a-govindraju@ti.com>
Fri, 4 Jun 2021 16:30:32 +0000 (22:00 +0530)
committerLokesh Vutla <lokeshvutla@ti.com>
Wed, 9 Jun 2021 16:53:44 +0000 (22:23 +0530)
Add support for identifying USB host and device boot modes

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210604163043.12811-3-a-govindraju@ti.com
arch/arm/mach-k3/am642_init.c
arch/arm/mach-k3/include/mach/am64_hardware.h
arch/arm/mach-k3/include/mach/am64_spl.h

index a433702b4e3031e3902b76b69573be861a4d62ba..1a2bc4bb9048ddd5a62c3fd43ce01e6663d2712a 100644 (file)
@@ -192,8 +192,11 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
        case BACKUP_BOOT_DEVICE_UART:
                return BOOT_DEVICE_UART;
 
-       case BACKUP_BOOT_DEVICE_USB:
-               return BOOT_DEVICE_USB;
+       case BACKUP_BOOT_DEVICE_DFU:
+               if (bkup_bootmode_cfg & MAIN_DEVSTAT_BACKUP_USB_MODE_MASK)
+                       return BOOT_DEVICE_USB;
+               return BOOT_DEVICE_DFU;
+
 
        case BACKUP_BOOT_DEVICE_ETHERNET:
                return BOOT_DEVICE_ETHERNET;
@@ -245,6 +248,12 @@ static u32 __get_primary_bootmedia(u32 main_devstat)
                        return BOOT_DEVICE_MMC2;
                return BOOT_DEVICE_MMC1;
 
+       case BOOT_DEVICE_DFU:
+               if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_USB_MODE_MASK) >>
+                   MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT)
+                       return BOOT_DEVICE_USB;
+               return BOOT_DEVICE_DFU;
+
        case BOOT_DEVICE_NOBOOT:
                return BOOT_DEVICE_RAM;
        }
index c368aa7e6bf1bb7e8e08879761685a68433a833a..4ee41ad762ba00e925bf8bf725646ea36510be15 100644 (file)
 #define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT            2
 #define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK             0x04
 
+#define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT            1
+#define MAIN_DEVSTAT_PRIMARY_USB_MODE_MASK             0x02
+
+#define MAIN_DEVSTAT_BACKUP_USB_MODE_MASK              0x01
+
 /*
  * The CTRL_MMR and PADCFG_MMR memory space is divided into several
  * equally-spaced partitions, so defining the partition size allows us to
index 36826cfc4ed0e68e45728e54d95574b232f080a6..607b09c2e5dc2979cda090690d9dbe15321721a4 100644 (file)
@@ -19,7 +19,8 @@
 #define BOOT_DEVICE_MMC                        0x08
 #define BOOT_DEVICE_EMMC               0x09
 
-#define BOOT_DEVICE_USB                        0x0A
+#define BOOT_DEVICE_USB                        0x2A
+#define BOOT_DEVICE_DFU                        0x0A
 #define BOOT_DEVICE_GPMC_NOR           0x0C
 #define BOOT_DEVICE_PCIE               0x0D
 #define BOOT_DEVICE_XSPI               0x0E
 #define BOOT_DEVICE_MMC2_2             0x1F
 
 /* Backup BootMode devices */
-#define BACKUP_BOOT_DEVICE_USB         0x01
+#define BACKUP_BOOT_DEVICE_DFU         0x01
 #define BACKUP_BOOT_DEVICE_UART                0x03
 #define BACKUP_BOOT_DEVICE_ETHERNET    0x04
 #define BACKUP_BOOT_DEVICE_MMC         0x05
 #define BACKUP_BOOT_DEVICE_SPI         0x06
 #define BACKUP_BOOT_DEVICE_I2C         0x07
+#define BACKUP_BOOT_DEVICE_USB         0x09
 
 #define K3_PRIMARY_BOOTMODE            0x0