mach-snapdragon: generalise board support
Historically, Qualcomm boards have relied on heavy hardcoding in U-Boot, in many cases to the specific SoC but also to the board itself (e.g. memory map). This has been largely resolved by modernising the Qualcomm drivers in U-Boot, however the board code still largely follows this model. This patch removes the board specific memory maps and duplicated board init code, replacing it with generic init code. The memory map is now built at runtime based on data read from DT, this allows for the memory map to be provided without having to recompile U-Boot. Support is also added for booting with appended DTBs, so that the first-stage bootloader can populate the memory map for us. The sdm845 specific init code is dropped entirely, it set an environment variable depending on if a button was pressed, but this variable wasn't used in U-Boot, and could be written to use the button command instead. The KASLR detection is also dropped as with appended dtb, the kaslr seed can be read directly from the DTB passed to U-Boot. A new qcom_defconfig is added, with the aim of providing a generic U-Boot configuration that will work on as many Qualcomm boards as possible. It replaces the defconfig files for the Dragonboard 845c, Galaxy S9, and QCS404 EVB. For now the db410c and 820c are excluded as they still have some board code left. Similarly, the config headers for db845c, starqltechn, and qcs404-evb are replaced by a single qcom header. The previously db410c-specific board_usb_init() function is made to be generic and is added to mach-snapdragon. While we lack proper modelling for USB configuration, using a well-known named pinctrl state is a reasonably generic middleground, and works using upstream DT. This function will do nothing unless the USB node has a pinctrl state named "device", in which case it will be set when entering USB peripheral mode. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404 Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
if TARGET_DRAGONBOARD410C
|
||||
|
||||
config SYS_BOARD
|
||||
default "dragonboard410c"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "qualcomm"
|
||||
|
||||
config SYS_SOC
|
||||
default "apq8016"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "dragonboard410c"
|
||||
|
||||
endif
|
||||
@@ -23,37 +23,6 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define USB_HUB_RESET_GPIO 2
|
||||
#define USB_SW_SELECT_GPIO 3
|
||||
|
||||
int board_usb_init(int index, enum usb_init_type init)
|
||||
{
|
||||
struct udevice *usb;
|
||||
int ret = 0;
|
||||
|
||||
/* USB device */
|
||||
ret = device_find_global_by_ofnode(ofnode_path("/soc/usb"), &usb);
|
||||
if (ret) {
|
||||
printf("Cannot find USB device\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Select "default" or "device" pinctrl */
|
||||
switch (init) {
|
||||
case USB_INIT_HOST:
|
||||
pinctrl_select_state(usb, "default");
|
||||
break;
|
||||
case USB_INIT_DEVICE:
|
||||
pinctrl_select_state(usb, "device");
|
||||
break;
|
||||
default:
|
||||
debug("Unknown usb_init_type %d\n", init);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* UNSTUFF_BITS macro taken from Linux Kernel: drivers/mmc/core/sd.c */
|
||||
#define UNSTUFF_BITS(resp, start, size) \
|
||||
({ \
|
||||
@@ -119,11 +88,6 @@ int misc_init_r(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
char serial[16];
|
||||
@@ -166,8 +130,3 @@ int ft_board_setup(void *blob, struct bd_info *bd)
|
||||
"local-bd-address", mac, ARP_HLEN, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_cpu(void)
|
||||
{
|
||||
psci_system_reset();
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
if TARGET_DRAGONBOARD820C
|
||||
|
||||
config SYS_BOARD
|
||||
default "dragonboard820c"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "qualcomm"
|
||||
|
||||
config SYS_SOC
|
||||
default "apq8096"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "dragonboard820c"
|
||||
|
||||
endif
|
||||
@@ -27,24 +27,6 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = PHYS_SDRAM_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init_banksize(void)
|
||||
{
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sdhci_power_init(void)
|
||||
{
|
||||
const u32 TLMM_PULL_MASK = 0x3;
|
||||
@@ -113,28 +95,9 @@ static void sdhci_power_init(void)
|
||||
rclk[i].val << rclk[i].bit);
|
||||
}
|
||||
|
||||
static void show_psci_version(void)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
|
||||
|
||||
printf("PSCI: v%ld.%ld\n",
|
||||
PSCI_VERSION_MAJOR(res.a0),
|
||||
PSCI_VERSION_MINOR(res.a0));
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
void qcom_board_init(void)
|
||||
{
|
||||
sdhci_power_init();
|
||||
show_psci_version();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_cpu(void)
|
||||
{
|
||||
psci_system_reset();
|
||||
}
|
||||
|
||||
/* Check for vol- button - if pressed - stop autoboot */
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
if TARGET_DRAGONBOARD845C
|
||||
|
||||
config SYS_BOARD
|
||||
default "dragonboard845c"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "dragonboard845c"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "qualcomm"
|
||||
|
||||
endif
|
||||
@@ -1,15 +0,0 @@
|
||||
if TARGET_QCS404EVB
|
||||
|
||||
config SYS_BOARD
|
||||
default "qcs404-evb"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "qualcomm"
|
||||
|
||||
config SYS_SOC
|
||||
default "qcs404"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "qcs404-evb"
|
||||
|
||||
endif
|
||||
@@ -14,16 +14,10 @@
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <fdt_support.h>
|
||||
#include <asm/arch/dram.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
return fdtdec_setup_mem_size_base();
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
void qcom_board_init(void)
|
||||
{
|
||||
struct udevice *pmic_gpio;
|
||||
struct gpio_desc usb_vbus_boost_pin;
|
||||
@@ -34,29 +28,22 @@ int board_init(void)
|
||||
&pmic_gpio);
|
||||
if (ret < 0) {
|
||||
printf("Failed to find pms405_gpios@c000 node.\n");
|
||||
return ret;
|
||||
return;
|
||||
}
|
||||
|
||||
node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pmic_gpio),
|
||||
"usb_vbus_boost_pin");
|
||||
if (node < 0) {
|
||||
printf("Failed to find usb_hub_reset_pm dt node.\n");
|
||||
return node;
|
||||
return;
|
||||
}
|
||||
ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
|
||||
&usb_vbus_boost_pin, 0);
|
||||
if (ret < 0) {
|
||||
printf("Failed to request usb_hub_reset_pm gpio.\n");
|
||||
return ret;
|
||||
return;
|
||||
}
|
||||
|
||||
dm_gpio_set_dir_flags(&usb_vbus_boost_pin,
|
||||
GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_cpu(void)
|
||||
{
|
||||
psci_system_reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user