Commit c0e109f2 authored by Samuel Holland's avatar Samuel Holland
Browse files

allwinner: Synchronize PMIC enumerations



Ensure that the default (zero) value represents the case where we take
no action. Previously, if a PLAT=sun50i_a64 build was booted on an
unknown SoC ID, it would be treated as an H5 at shutdown.

This removes some duplicate code and fixes error propagation on H6.
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Change-Id: I4e51d8a43a56eccb0d8088593cb9908e52e782bc
parent eb75518d
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2018, Icenowy Zheng <icenowy@aosc.io> * Copyright (c) 2018, Icenowy Zheng <icenowy@aosc.io>
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <sunxi_private.h> #include <sunxi_private.h>
static enum pmic_type { static enum pmic_type {
UNKNOWN,
GENERIC_H5, GENERIC_H5,
GENERIC_A64, GENERIC_A64,
REF_DESIGN_H5, /* regulators controlled by GPIO pins on port L */ REF_DESIGN_H5, /* regulators controlled by GPIO pins on port L */
......
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2018, Icenowy Zheng <icenowy@aosc.io> * Copyright (c) 2018, Icenowy Zheng <icenowy@aosc.io>
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
#define AXP805_ADDR 0x36 #define AXP805_ADDR 0x36
#define AXP805_ID 0x03 #define AXP805_ID 0x03
enum pmic_type { static enum pmic_type {
NO_PMIC, UNKNOWN,
AXP805, AXP805,
}; } pmic;
enum pmic_type pmic;
int axp_i2c_read(uint8_t chip, uint8_t reg, uint8_t *val) int axp_i2c_read(uint8_t chip, uint8_t reg, uint8_t *val)
{ {
...@@ -79,12 +77,11 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt) ...@@ -79,12 +77,11 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
i2c_init((void *)SUNXI_R_I2C_BASE); i2c_init((void *)SUNXI_R_I2C_BASE);
NOTICE("PMIC: Probing AXP805\n"); NOTICE("PMIC: Probing AXP805\n");
pmic = AXP805;
ret = axp805_probe(); ret = axp805_probe();
if (ret) if (ret)
pmic = NO_PMIC; return ret;
else
pmic = AXP805; pmic = AXP805;
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment