Merge "ipq6018: Enable PMIC reset during abnormal reset"

This commit is contained in:
Linux Build Service Account 2019-05-02 12:04:56 -07:00 committed by Gerrit - the friendly Code Review server
commit 8e311f259f
7 changed files with 96 additions and 1 deletions

View file

@ -249,6 +249,30 @@
};
};
i2c1: i2c@78b7000 {
compatible = "qcom,qup-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x78b7000 0x600>;
clock-frequency = <400000>;
i2c_gpio {
gpio1 {
gpio = <46>;
func = <1>;
pull = <GPIO_PULL_UP>;
drvstr = <GPIO_2MA>;
oe = <GPIO_OE_ENABLE>;
};
gpio2 {
gpio = <47>;
func = <1>;
pull = <GPIO_PULL_UP>;
drvstr = <GPIO_2MA>;
oe = <GPIO_OE_ENABLE>;
};
};
};
};

View file

@ -493,7 +493,7 @@ void dump_func(unsigned int dump_level)
* when crashmagic is found
*/
reset:
run_command("reset", 0);
reset_board();
}
/*

View file

@ -146,6 +146,11 @@ void reset_cpu(ulong addr)
while (1);
}
void reset_board(void)
{
run_command("reset", 0);
}
void board_nand_init(void)
{
int gpio_node;

View file

@ -25,6 +25,9 @@
#include <mmc.h>
#include <sdhci.h>
#include <usb.h>
#include <i2c.h>
#include <dm.h>
#include <command.h>
#define DLOAD_MAGIC_COOKIE 0x10
DECLARE_GLOBAL_DATA_PTR;
@ -70,6 +73,8 @@ struct dumpinfo_t dumpinfo_s[] = {
{ "UTCM.BIN", 0x08600658, 0x00030000, 0, 1, 0x2000 },
};
int dump_entries_s = ARRAY_SIZE(dumpinfo_s);
u32 *tz_wonce = (u32 *)CONFIG_IPQ6018_TZ_WONCE_3_ADDR;
void uart2_configure_mux(void)
{
@ -165,6 +170,40 @@ void qca_serial_init(struct ipq_serial_platdata *plat)
qca_gpio_init(node);
}
int do_pmic_reset()
{
struct udevice *bus, *dev;
int bus_no=0;
int ret;
uchar byte = CONFIG_IPQ6018_PMIC_RESET_VAL;
ret = uclass_get_device_by_seq(UCLASS_I2C, bus_no, &bus);
if (ret) {
debug("%s: No bus %d\n", __func__, bus_no);
return -1;
}
ret = dm_i2c_probe(bus, CONFIG_IPQ6018_PMIC_CHIP_ADDR, 0, &dev);
if (ret) {
printf("Probe failed\n");
return -1;
}
ret = i2c_get_chip(bus, CONFIG_IPQ6018_PMIC_CHIP_ADDR, 1, &dev);
if (ret) {
printf("Error 'i2c_get_chip': %d\n",ret);
return CMD_RET_FAILURE;
}
ret = dm_i2c_write(dev, CONFIG_IPQ6018_PMIC_OFFSET, &byte, 1);
if (ret) {
printf("Error writing the chip: %d\n", ret);
return CMD_RET_FAILURE;
}
return 0;
}
void reset_crashdump(void)
{
unsigned int ret = 0;
@ -986,6 +1025,18 @@ void reset_cpu(unsigned long a)
while(1);
}
void reset_board(void)
{
if(*tz_wonce == 0) { /*COLD REBOOT*/
if(do_pmic_reset())
printf("PMIC Reset failed, please do power cycle\n");
}
else { /*WARM REBOOT*/
psci_sys_reset();
}
while(1); /*loop here inorder to avoid returning to console*/
}
void ipq_fdt_fixup_socinfo(void *blob)
{
return;

View file

@ -188,6 +188,11 @@ void reset_cpu(unsigned long a)
while(1);
}
void reset_board(void)
{
run_command("reset", 0);
}
void ipq_uboot_fdt_fixup(void)
{
int ret, len;

View file

@ -243,6 +243,11 @@ void reset_cpu(unsigned long a)
while(1);
}
void reset_board(void)
{
run_command("reset", 0);
}
void emmc_clock_config(int mode)
{
/* Enable root clock generator */

View file

@ -290,6 +290,11 @@ extern loff_t board_env_size;
#define RPM_VERSION 3
#endif
#define CONFIG_IPQ6018_PMIC_CHIP_ADDR 0x69
#define CONFIG_IPQ6018_PMIC_OFFSET 0x0
#define CONFIG_IPQ6018_PMIC_RESET_VAL 0x40
#define CONFIG_IPQ6018_TZ_WONCE_3_ADDR 0x193d00C
#define CONFIG_IPQ6018_EDMA 1
#define CONFIG_IPQ6018_BRIDGED_MODE 1
#define CONFIG_NET_RETRY_COUNT 5