mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-05 19:10:13 +00:00
4cbc16ceb2
Hi-end qualcomm chip, introduced in late 2017. Mostly used in flagship phones and tablets of 2018. Features: - arm64 arch - total of 8 Kryo 385 Gold / Silver cores - Hexagon 685 DSP - Adreno 630 GPU Tested only as second-stage bootloader. Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Tom Rini <trini@konsulko.com> Cc: Stephan Gerhold <stephan@gerhold.net>
82 lines
1.7 KiB
C
82 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Common init part for boards based on SDM845
|
|
*
|
|
* (C) Copyright 2021 Dzmitry Sankouski <dsankouski@gmail.com>
|
|
*/
|
|
|
|
#include <init.h>
|
|
#include <env.h>
|
|
#include <common.h>
|
|
#include <asm/system.h>
|
|
#include <asm/gpio.h>
|
|
#include <dm.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
int dram_init(void)
|
|
{
|
|
return fdtdec_setup_mem_size_base();
|
|
}
|
|
|
|
void reset_cpu(void)
|
|
{
|
|
psci_system_reset();
|
|
}
|
|
|
|
__weak int board_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/* Check for vol- and power buttons */
|
|
__weak int misc_init_r(void)
|
|
{
|
|
struct udevice *pon;
|
|
struct gpio_desc resin;
|
|
int node, ret;
|
|
|
|
ret = uclass_get_device_by_name(UCLASS_GPIO, "pm8998_pon@800", &pon);
|
|
if (ret < 0) {
|
|
printf("Failed to find PMIC pon node. Check device tree\n");
|
|
return 0;
|
|
}
|
|
|
|
node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
|
|
"key_vol_down");
|
|
if (node < 0) {
|
|
printf("Failed to find key_vol_down node. Check device tree\n");
|
|
return 0;
|
|
}
|
|
if (gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
|
|
&resin, 0)) {
|
|
printf("Failed to request key_vol_down button.\n");
|
|
return 0;
|
|
}
|
|
if (dm_gpio_get_value(&resin)) {
|
|
env_set("key_vol_down", "1");
|
|
printf("Volume down button pressed\n");
|
|
} else {
|
|
env_set("key_vol_down", "0");
|
|
}
|
|
|
|
node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
|
|
"key_power");
|
|
if (node < 0) {
|
|
printf("Failed to find key_power node. Check device tree\n");
|
|
return 0;
|
|
}
|
|
if (gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
|
|
&resin, 0)) {
|
|
printf("Failed to request key_power button.\n");
|
|
return 0;
|
|
}
|
|
if (dm_gpio_get_value(&resin)) {
|
|
env_set("key_power", "1");
|
|
printf("Power button pressed\n");
|
|
} else {
|
|
env_set("key_power", "0");
|
|
}
|
|
|
|
return 0;
|
|
}
|