Merge branch 'qcom-main' of https://source.denx.de/u-boot/custodians/u-boot-snapdragon
We have been getting a lot more patches from Qualcomm engineers, largely focusing on IoT, router, and automotive platforms (those with QCS, IPQ, and SA prefixes specifically). Quite a variety of changes here: - Watchdog overflow fix - Hardcoded fastboot buffer addresses for a few board (hoppefully temporary until fastboot is updated to read $fastboot_addr_r) - Enable memory protection (MMU_MGPROT) for ARCH_SNAPDRAGON - pinctrl support for the QCS615 soc - various USB/phy fixes including phy config for msm8996/qcs615 - mmc and i2c clock configuration fixes - significant fixes for rpmh and regulator drivers - added config fragment for pixel devices - sa8775p clock fixes - support for "flattened" dwc3 DT that recently landed upstream for sc7280 (qcs6490) and a few other platforms
This commit is contained in:
@@ -1143,6 +1143,7 @@ config ARCH_SNAPDRAGON
|
||||
select SYSRESET
|
||||
select SYSRESET_PSCI
|
||||
select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
|
||||
select MMU_PGPROT
|
||||
imply OF_UPSTREAM
|
||||
imply CMD_DM
|
||||
imply DM_USB_GADGET
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <efi.h>
|
||||
#include <efi_loader.h>
|
||||
#include <malloc.h>
|
||||
#include <mmc.h>
|
||||
#include <scsi.h>
|
||||
#include <part.h>
|
||||
#include <linux/err.h>
|
||||
@@ -80,6 +81,23 @@ static enum ab_slot get_part_slot(const char *partname)
|
||||
return SLOT_NONE;
|
||||
}
|
||||
|
||||
/* Shamelessly copied from lib/efi_loader/efi_device_path.c @ 33 */
|
||||
/*
|
||||
* Determine if an MMC device is an SD card.
|
||||
*
|
||||
* @desc block device descriptor
|
||||
* Return: true if the device is an SD card
|
||||
*/
|
||||
static bool is_sd(struct blk_desc *desc)
|
||||
{
|
||||
struct mmc *mmc = find_mmc_device(desc->devnum);
|
||||
|
||||
if (!mmc)
|
||||
return false;
|
||||
|
||||
return IS_SD(mmc) != 0U;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine which partition U-Boot is flashed to based on the boot source (ABL/XBL),
|
||||
* the slot status, and prioritizing the uefi partition over xbl if found.
|
||||
@@ -109,19 +127,21 @@ static int find_target_partition(int *devnum, enum uclass_id *uclass,
|
||||
if (device_get_uclass_id(dev) != UCLASS_BLK)
|
||||
continue;
|
||||
|
||||
desc = dev_get_uclass_plat(dev);
|
||||
|
||||
/* If we have a UFS then don't look at any other block devices */
|
||||
if (have_ufs) {
|
||||
if (device_get_uclass_id(dev->parent->parent) != UCLASS_UFS)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* If we don't have UFS, then U-Boot must be on the eMMC which is always the first
|
||||
* MMC device.
|
||||
* If we don't have UFS, then U-Boot must be on the eMMC
|
||||
*/
|
||||
} else if (dev->parent->seq_ > 0) {
|
||||
else if (IS_ENABLED(CONFIG_MMC) && is_sd(desc)) {
|
||||
log_debug("skipped SD-Card (devnum %d)\n", desc->devnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
desc = dev_get_uclass_plat(dev);
|
||||
if (!desc || desc->part_type == PART_TYPE_UNKNOWN)
|
||||
continue;
|
||||
for (partnum = 1;; partnum++) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* DT here. This improves compatibility with upstream DT and simplifies the
|
||||
* porting process for new devices.
|
||||
*/
|
||||
static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np)
|
||||
static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np, bool flat)
|
||||
{
|
||||
struct device_node *dwc3;
|
||||
int ret, len, hsphy_idx = 1;
|
||||
@@ -41,6 +41,19 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
|
||||
|
||||
debug("Fixing up %s\n", glue_np->name);
|
||||
|
||||
/* New DT flattens the glue and controller into a single node. */
|
||||
if (flat) {
|
||||
dwc3 = glue_np;
|
||||
debug("%s uses flat DT\n", glue_np->name);
|
||||
} else {
|
||||
/* Find the DWC3 node itself */
|
||||
dwc3 = of_find_compatible_node(glue_np, NULL, "snps,dwc3");
|
||||
if (!dwc3) {
|
||||
log_err("Failed to find dwc3 node\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell the glue driver to configure the wrapper for high-speed only operation */
|
||||
ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL);
|
||||
if (ret) {
|
||||
@@ -48,13 +61,6 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Find the DWC3 node itself */
|
||||
dwc3 = of_find_compatible_node(glue_np, NULL, "snps,dwc3");
|
||||
if (!dwc3) {
|
||||
log_err("Failed to find dwc3 node\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
phandles = of_get_property(dwc3, "phys", &len);
|
||||
len /= sizeof(*phandles);
|
||||
if (len == 1) {
|
||||
@@ -104,13 +110,25 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
|
||||
|
||||
static void fixup_usb_nodes(struct device_node *root)
|
||||
{
|
||||
struct device_node *glue_np = root;
|
||||
struct device_node *glue_np = root, *tmp;
|
||||
int ret;
|
||||
bool flat;
|
||||
|
||||
while (true) {
|
||||
flat = false;
|
||||
/* First check for the old DT format with glue node then the new flattened format */
|
||||
tmp = of_find_compatible_node(glue_np, NULL, "qcom,dwc3");
|
||||
if (!tmp) {
|
||||
tmp = of_find_compatible_node(glue_np, NULL, "qcom,snps-dwc3");
|
||||
flat = !!tmp;
|
||||
}
|
||||
if (!tmp)
|
||||
break;
|
||||
glue_np = tmp;
|
||||
|
||||
while ((glue_np = of_find_compatible_node(glue_np, NULL, "qcom,dwc3"))) {
|
||||
if (!of_device_is_available(glue_np))
|
||||
continue;
|
||||
ret = fixup_qcom_dwc3(root, glue_np);
|
||||
ret = fixup_qcom_dwc3(root, glue_np, flat);
|
||||
if (ret)
|
||||
log_warning("Failed to fixup node %s: %d\n", glue_np->name, ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user