summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/sunxi/clk_v3s.c6
-rw-r--r--drivers/net/sun8i_emac.c7
-rw-r--r--drivers/power/Kconfig17
-rw-r--r--drivers/power/Makefile9
-rw-r--r--drivers/power/axp305.c82
-rw-r--r--drivers/power/axp313.c133
-rw-r--r--drivers/power/axp_spl.c173
-rw-r--r--drivers/power/pmic/axp.c1
-rw-r--r--drivers/power/regulator/axp_regulator.c28
-rw-r--r--drivers/spi/spi-sunxi.c21
10 files changed, 243 insertions, 234 deletions
diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c
index 85410e282e8..292c8c44f97 100644
--- a/drivers/clk/sunxi/clk_v3s.c
+++ b/drivers/clk/sunxi/clk_v3s.c
@@ -16,6 +16,7 @@ static struct ccu_clk_gate v3s_gates[] = {
[CLK_BUS_MMC0] = GATE(0x060, BIT(8)),
[CLK_BUS_MMC1] = GATE(0x060, BIT(9)),
[CLK_BUS_MMC2] = GATE(0x060, BIT(10)),
+ [CLK_BUS_EMAC] = GATE(0x060, BIT(17)),
[CLK_BUS_SPI0] = GATE(0x060, BIT(20)),
[CLK_BUS_OTG] = GATE(0x060, BIT(24)),
@@ -30,6 +31,8 @@ static struct ccu_clk_gate v3s_gates[] = {
[CLK_BUS_UART1] = GATE(0x06c, BIT(17)),
[CLK_BUS_UART2] = GATE(0x06c, BIT(18)),
+ [CLK_BUS_EPHY] = GATE(0x070, BIT(0)),
+
[CLK_SPI0] = GATE(0x0a0, BIT(31)),
[CLK_USB_PHY0] = GATE(0x0cc, BIT(8)),
@@ -44,12 +47,15 @@ static struct ccu_reset v3s_resets[] = {
[RST_BUS_MMC0] = RESET(0x2c0, BIT(8)),
[RST_BUS_MMC1] = RESET(0x2c0, BIT(9)),
[RST_BUS_MMC2] = RESET(0x2c0, BIT(10)),
+ [RST_BUS_EMAC] = RESET(0x2c0, BIT(17)),
[RST_BUS_SPI0] = RESET(0x2c0, BIT(20)),
[RST_BUS_OTG] = RESET(0x2c0, BIT(24)),
[RST_BUS_TCON0] = RESET(0x2c4, BIT(4)),
[RST_BUS_DE] = RESET(0x2c4, BIT(12)),
+ [RST_BUS_EPHY] = RESET(0x2c8, BIT(2)),
+
[RST_BUS_I2C0] = RESET(0x2d8, BIT(0)),
[RST_BUS_I2C1] = RESET(0x2d8, BIT(1)),
[RST_BUS_UART0] = RESET(0x2d8, BIT(16)),
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index f4b97798d2d..6fab34715de 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -892,6 +892,11 @@ static const struct emac_variant emac_variant_r40 = {
.syscon_offset = 0x164,
};
+static const struct emac_variant emac_variant_v3s = {
+ .syscon_offset = 0x30,
+ .soc_has_internal_phy = true,
+};
+
static const struct emac_variant emac_variant_a64 = {
.syscon_offset = 0x30,
.support_rmii = true,
@@ -909,6 +914,8 @@ static const struct udevice_id sun8i_emac_eth_ids[] = {
.data = (ulong)&emac_variant_h3 },
{ .compatible = "allwinner,sun8i-r40-gmac",
.data = (ulong)&emac_variant_r40 },
+ { .compatible = "allwinner,sun8i-v3s-emac",
+ .data = (ulong)&emac_variant_v3s },
{ .compatible = "allwinner,sun50i-a64-emac",
.data = (ulong)&emac_variant_a64 },
{ .compatible = "allwinner,sun50i-h6-emac",
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 33b8bc1214d..5556a22cf69 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -109,6 +109,13 @@ config AXP313_POWER
Select this to enable support for the AXP313 PMIC found on some
H616 boards.
+config AXP717_POWER
+ bool "axp717 pmic support"
+ select AXP_PMIC_BUS
+ select CMD_POWEROFF
+ ---help---
+ Select this to enable support for the AXP717 PMIC found on some boards.
+
config AXP809_POWER
bool "axp809 pmic support"
depends on MACH_SUN9I
@@ -151,10 +158,11 @@ config AXP_DCDC1_VOLT
config AXP_DCDC2_VOLT
int "axp pmic dcdc2 voltage"
- depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER
+ depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER
default 900 if AXP818_POWER
default 1400 if AXP152_POWER || AXP209_POWER
default 1000 if AXP313_POWER
+ default 1000 if AXP717_POWER
default 1200 if MACH_SUN6I
default 1100 if MACH_SUN8I
default 0 if MACH_SUN9I
@@ -167,11 +175,11 @@ config AXP_DCDC2_VOLT
On A80 boards dcdc2 powers the GPU and can be left off.
On A83T boards dcdc2 is used for VDD-CPUA(cluster 0) and should be 0.9V.
On R40 boards dcdc2 is VDD-CPU and should be 1.1V
- On boards using the AXP313 it's often VDD-CPU.
+ On boards using the AXP313 or AXP717 it's often VDD-CPU.
config AXP_DCDC3_VOLT
int "axp pmic dcdc3 voltage"
- depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER
+ depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER
default 900 if AXP809_POWER || AXP818_POWER
default 1500 if AXP152_POWER
default 1250 if AXP209_POWER
@@ -188,7 +196,8 @@ config AXP_DCDC3_VOLT
On A80 boards dcdc3 is used for VDD-CPUA(cluster 0) and should be 0.9V.
On A83T boards dcdc3 is used for VDD-CPUB(cluster 1) and should be 0.9V.
On R40 boards dcdc3 is VDD-SYS and VDD-GPU and should be 1.1V.
- On boards using the AXP313 it's often VDD-DRAM and should be 1.1V for LPDDR4.
+ On boards using the AXP313 or AXP717 it's often VDD-DRAM and should
+ be 1.1V for LPDDR4.
config AXP_DCDC4_VOLT
int "axp pmic dcdc4 voltage"
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index c7ee4595fc8..9f94df8d641 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -8,13 +8,16 @@ obj-$(CONFIG_$(SPL_TPL_)POWER_DOMAIN) += domain/
obj-y += pmic/
obj-y += regulator/
+obj-$(CONFIG_AXP221_POWER) += axp221.o
+ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_AXP152_POWER) += axp152.o
obj-$(CONFIG_AXP209_POWER) += axp209.o
-obj-$(CONFIG_AXP221_POWER) += axp221.o
-obj-$(CONFIG_AXP305_POWER) += axp305.o
-obj-$(CONFIG_AXP313_POWER) += axp313.o
+obj-$(CONFIG_AXP305_POWER) += axp_spl.o
+obj-$(CONFIG_AXP313_POWER) += axp_spl.o
+obj-$(CONFIG_AXP717_POWER) += axp_spl.o
obj-$(CONFIG_AXP809_POWER) += axp809.o
obj-$(CONFIG_AXP818_POWER) += axp818.o
+endif
obj-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o
obj-$(CONFIG_SY8106A_POWER) += sy8106a.o
obj-$(CONFIG_TPS6586X_POWER) += tps6586x.o
diff --git a/drivers/power/axp305.c b/drivers/power/axp305.c
deleted file mode 100644
index 0312ad9af76..00000000000
--- a/drivers/power/axp305.c
+++ /dev/null
@@ -1,82 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * AXP305 driver
- *
- * (C) Copyright 2020 Jernej Skrabec <jernej.skrabec@siol.net>
- *
- * Based on axp221.c
- * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
- * (C) Copyright 2013 Oliver Schinagl <oliver@schinagl.nl>
- */
-
-#include <command.h>
-#include <errno.h>
-#include <asm/arch/pmic_bus.h>
-#include <axp_pmic.h>
-
-#define AXP305_DCDC4_1600MV_OFFSET 46
-
-static u8 axp305_mvolt_to_cfg(int mvolt, int min, int max, int div)
-{
- if (mvolt < min)
- mvolt = min;
- else if (mvolt > max)
- mvolt = max;
-
- return (mvolt - min) / div;
-}
-
-int axp_set_dcdc4(unsigned int mvolt)
-{
- int ret;
- u8 cfg;
-
- if (mvolt >= 1600)
- cfg = AXP305_DCDC4_1600MV_OFFSET +
- axp305_mvolt_to_cfg(mvolt, 1600, 3300, 100);
- else
- cfg = axp305_mvolt_to_cfg(mvolt, 600, 1500, 20);
-
- if (mvolt == 0)
- return pmic_bus_clrbits(AXP305_OUTPUT_CTRL1,
- AXP305_OUTPUT_CTRL1_DCDCD_EN);
-
- ret = pmic_bus_write(AXP305_DCDCD_VOLTAGE, cfg);
- if (ret)
- return ret;
-
- return pmic_bus_setbits(AXP305_OUTPUT_CTRL1,
- AXP305_OUTPUT_CTRL1_DCDCD_EN);
-}
-
-int axp_init(void)
-{
- u8 axp_chip_id;
- int ret;
-
- ret = pmic_bus_init();
- if (ret)
- return ret;
-
- ret = pmic_bus_read(AXP305_CHIP_VERSION, &axp_chip_id);
- if (ret)
- return ret;
-
- if ((axp_chip_id & AXP305_CHIP_VERSION_MASK) != 0x40)
- return -ENODEV;
-
- return ret;
-}
-
-#if !CONFIG_IS_ENABLED(ARM_PSCI_FW) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
-int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- pmic_bus_write(AXP305_SHUTDOWN, AXP305_POWEROFF);
-
- /* infinite loop during shutdown */
- while (1) {}
-
- /* not reached */
- return 0;
-}
-#endif
diff --git a/drivers/power/axp313.c b/drivers/power/axp313.c
deleted file mode 100644
index 09ecb5b1ec2..00000000000
--- a/drivers/power/axp313.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * AXP313(a) driver
- *
- * (C) Copyright 2023 Arm Ltd.
- *
- * Based on axp305.c
- * (C) Copyright 2020 Jernej Skrabec <jernej.skrabec@siol.net>
- * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
- * (C) Copyright 2013 Oliver Schinagl <oliver@schinagl.nl>
- */
-
-#include <command.h>
-#include <errno.h>
-#include <asm/arch/pmic_bus.h>
-#include <axp_pmic.h>
-
-enum axp313_reg {
- AXP313_CHIP_VERSION = 0x03,
- AXP313_OUTPUT_CTRL = 0x10,
- AXP313_DCDC1_CTRL = 0x13,
- AXP313_SHUTDOWN = 0x1a,
-};
-
-#define AXP313_CHIP_VERSION_MASK 0xcf
-#define AXP313_CHIP_VERSION_AXP1530 0x48
-#define AXP313_CHIP_VERSION_AXP313A 0x4b
-#define AXP313_CHIP_VERSION_AXP313B 0x4c
-
-#define AXP313_DCDC_SPLIT_OFFSET 71
-#define AXP313_DCDC_SPLIT_MVOLT 1200
-
-#define AXP313_POWEROFF BIT(7)
-
-static u8 mvolt_to_cfg(int mvolt, int min, int max, int div)
-{
- if (mvolt < min)
- mvolt = min;
- else if (mvolt > max)
- mvolt = max;
-
- return (mvolt - min) / div;
-}
-
-static int axp_set_dcdc(int dcdc_num, unsigned int mvolt)
-{
- int ret;
- u8 cfg, enable_mask = 1U << (dcdc_num - 1);
- int volt_reg = AXP313_DCDC1_CTRL + dcdc_num - 1;
- int max_mV;
-
- switch (dcdc_num) {
- case 1:
- case 2:
- max_mV = 1540;
- break;
- case 3:
- /*
- * The manual defines a different split point, but tests
- * show that it's the same 1200mV as for DCDC1/2.
- */
- max_mV = 1840;
- break;
- default:
- return -EINVAL;
- }
-
- if (mvolt > AXP313_DCDC_SPLIT_MVOLT)
- cfg = AXP313_DCDC_SPLIT_OFFSET + mvolt_to_cfg(mvolt,
- AXP313_DCDC_SPLIT_MVOLT + 20, max_mV, 20);
- else
- cfg = mvolt_to_cfg(mvolt, 500, AXP313_DCDC_SPLIT_MVOLT, 10);
-
- if (mvolt == 0)
- return pmic_bus_clrbits(AXP313_OUTPUT_CTRL, enable_mask);
-
- debug("DCDC%d: writing 0x%x to reg 0x%x\n", dcdc_num, cfg, volt_reg);
- ret = pmic_bus_write(volt_reg, cfg);
- if (ret)
- return ret;
-
- return pmic_bus_setbits(AXP313_OUTPUT_CTRL, enable_mask);
-}
-
-int axp_set_dcdc2(unsigned int mvolt)
-{
- return axp_set_dcdc(2, mvolt);
-}
-
-int axp_set_dcdc3(unsigned int mvolt)
-{
- return axp_set_dcdc(3, mvolt);
-}
-
-int axp_init(void)
-{
- u8 axp_chip_id;
- int ret;
-
- ret = pmic_bus_init();
- if (ret)
- return ret;
-
- ret = pmic_bus_read(AXP313_CHIP_VERSION, &axp_chip_id);
- if (ret)
- return ret;
-
- axp_chip_id &= AXP313_CHIP_VERSION_MASK;
- switch (axp_chip_id) {
- case AXP313_CHIP_VERSION_AXP1530:
- case AXP313_CHIP_VERSION_AXP313A:
- case AXP313_CHIP_VERSION_AXP313B:
- break;
- default:
- debug("unknown PMIC: 0x%x\n", axp_chip_id);
- return -EINVAL;
- }
-
- return ret;
-}
-
-#if !CONFIG_IS_ENABLED(ARM_PSCI_FW) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
-int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- pmic_bus_write(AXP313_SHUTDOWN, AXP313_POWEROFF);
-
- /* infinite loop during shutdown */
- while (1) {}
-
- /* not reached */
- return 0;
-}
-#endif
diff --git a/drivers/power/axp_spl.c b/drivers/power/axp_spl.c
new file mode 100644
index 00000000000..3c86eb20ab4
--- /dev/null
+++ b/drivers/power/axp_spl.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AXP PMIC SPL driver
+ * (C) Copyright 2024 Arm Ltd.
+ */
+
+#include <errno.h>
+#include <linux/types.h>
+#include <asm/arch/pmic_bus.h>
+#include <axp_pmic.h>
+
+struct axp_reg_desc_spl {
+ u8 enable_reg;
+ u8 enable_mask;
+ u8 volt_reg;
+ u8 volt_mask;
+ u16 min_mV;
+ u16 max_mV;
+ u8 step_mV;
+ u8 split;
+};
+
+#define NA 0xff
+
+#if defined(CONFIG_AXP717_POWER) /* AXP717 */
+
+static const struct axp_reg_desc_spl axp_spl_dcdc_regulators[] = {
+ { 0x80, BIT(0), 0x83, 0x7f, 500, 1540, 10, 70 },
+ { 0x80, BIT(1), 0x84, 0x7f, 500, 1540, 10, 70 },
+ { 0x80, BIT(2), 0x85, 0x7f, 500, 1840, 10, 70 },
+};
+
+#define AXP_CHIP_VERSION 0x0
+#define AXP_CHIP_VERSION_MASK 0x0
+#define AXP_CHIP_ID 0x0
+#define AXP_SHUTDOWN_REG 0x27
+#define AXP_SHUTDOWN_MASK BIT(0)
+
+#elif defined(CONFIG_AXP313_POWER) /* AXP313 */
+
+static const struct axp_reg_desc_spl axp_spl_dcdc_regulators[] = {
+ { 0x10, BIT(0), 0x13, 0x7f, 500, 1540, 10, 70 },
+ { 0x10, BIT(1), 0x14, 0x7f, 500, 1540, 10, 70 },
+ { 0x10, BIT(2), 0x15, 0x7f, 500, 1840, 10, 70 },
+};
+
+#define AXP_CHIP_VERSION 0x3
+#define AXP_CHIP_VERSION_MASK 0xc8
+#define AXP_CHIP_ID 0x48
+#define AXP_SHUTDOWN_REG 0x1a
+#define AXP_SHUTDOWN_MASK BIT(7)
+
+#elif defined(CONFIG_AXP305_POWER) /* AXP305 */
+
+static const struct axp_reg_desc_spl axp_spl_dcdc_regulators[] = {
+ { 0x10, BIT(0), 0x12, 0x7f, 600, 1520, 10, 50 },
+ { 0x10, BIT(1), 0x13, 0x1f, 1000, 2550, 50, NA },
+ { 0x10, BIT(2), 0x14, 0x7f, 600, 1520, 10, 50 },
+ { 0x10, BIT(3), 0x15, 0x3f, 600, 1500, 20, NA },
+ { 0x10, BIT(4), 0x16, 0x1f, 1100, 3400, 100, NA },
+};
+
+#define AXP_CHIP_VERSION 0x3
+#define AXP_CHIP_VERSION_MASK 0xcf
+#define AXP_CHIP_ID 0x40
+#define AXP_SHUTDOWN_REG 0x32
+#define AXP_SHUTDOWN_MASK BIT(7)
+
+#else
+
+ #error "Please define the regulator registers in axp_spl_regulators[]."
+
+#endif
+
+static u8 axp_mvolt_to_cfg(int mvolt, const struct axp_reg_desc_spl *reg)
+{
+ if (mvolt < reg->min_mV)
+ mvolt = reg->min_mV;
+ else if (mvolt > reg->max_mV)
+ mvolt = reg->max_mV;
+
+ mvolt -= reg->min_mV;
+
+ /* voltage in the first range ? */
+ if (mvolt <= reg->split * reg->step_mV)
+ return mvolt / reg->step_mV;
+
+ mvolt -= reg->split * reg->step_mV;
+
+ return reg->split + mvolt / (reg->step_mV * 2);
+}
+
+static int axp_set_dcdc(int dcdc_num, unsigned int mvolt)
+{
+ const struct axp_reg_desc_spl *reg;
+ int ret;
+
+ if (dcdc_num < 1 || dcdc_num > ARRAY_SIZE(axp_spl_dcdc_regulators))
+ return -EINVAL;
+
+ reg = &axp_spl_dcdc_regulators[dcdc_num - 1];
+
+ if (mvolt == 0)
+ return pmic_bus_clrbits(reg->enable_reg, reg->enable_mask);
+
+ ret = pmic_bus_write(reg->volt_reg, axp_mvolt_to_cfg(mvolt, reg));
+ if (ret)
+ return ret;
+
+ return pmic_bus_setbits(reg->enable_reg, reg->enable_mask);
+}
+
+int axp_set_dcdc1(unsigned int mvolt)
+{
+ return axp_set_dcdc(1, mvolt);
+}
+
+int axp_set_dcdc2(unsigned int mvolt)
+{
+ return axp_set_dcdc(2, mvolt);
+}
+
+int axp_set_dcdc3(unsigned int mvolt)
+{
+ return axp_set_dcdc(3, mvolt);
+}
+
+int axp_set_dcdc4(unsigned int mvolt)
+{
+ return axp_set_dcdc(4, mvolt);
+}
+
+int axp_set_dcdc5(unsigned int mvolt)
+{
+ return axp_set_dcdc(5, mvolt);
+}
+
+int axp_init(void)
+{
+ int ret = pmic_bus_init();
+
+ if (ret)
+ return ret;
+
+ if (AXP_CHIP_VERSION_MASK) {
+ u8 axp_chip_id;
+
+ ret = pmic_bus_read(AXP_CHIP_VERSION, &axp_chip_id);
+ if (ret)
+ return ret;
+
+ if ((axp_chip_id & AXP_CHIP_VERSION_MASK) != AXP_CHIP_ID) {
+ debug("unknown PMIC: 0x%x\n", axp_chip_id);
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+#if !CONFIG_IS_ENABLED(ARM_PSCI_FW) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+ pmic_bus_setbits(AXP_SHUTDOWN_REG, AXP_SHUTDOWN_MASK);
+
+ /* infinite loop during shutdown */
+ while (1)
+ ;
+
+ /* not reached */
+ return 0;
+}
+#endif
diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c
index 0e1e45fba74..521a39dd566 100644
--- a/drivers/power/pmic/axp.c
+++ b/drivers/power/pmic/axp.c
@@ -88,6 +88,7 @@ static const struct udevice_id axp_pmic_ids[] = {
{ .compatible = "x-powers,axp221", .data = AXP221_ID },
{ .compatible = "x-powers,axp223", .data = AXP223_ID },
{ .compatible = "x-powers,axp313a", .data = AXP313_ID },
+ { .compatible = "x-powers,axp717", .data = AXP717_ID },
{ .compatible = "x-powers,axp803", .data = AXP803_ID },
{ .compatible = "x-powers,axp806", .data = AXP806_ID },
{ .compatible = "x-powers,axp809", .data = AXP809_ID },
diff --git a/drivers/power/regulator/axp_regulator.c b/drivers/power/regulator/axp_regulator.c
index d27e09538e0..75cdbca30f6 100644
--- a/drivers/power/regulator/axp_regulator.c
+++ b/drivers/power/regulator/axp_regulator.c
@@ -189,6 +189,33 @@ static const struct axp_regulator_plat axp313_regulators[] = {
{ }
};
+/*
+ * The "dcdc2" regulator has another range, beyond 1.54V up to 3.4V, in
+ * steps of 100mV. We cannot model this easily, but also don't need that,
+ * since it's typically only used for lower voltages anyway, so just ignore it.
+ */
+static const struct axp_regulator_plat axp717_regulators[] = {
+ { "dcdc1", 0x80, BIT(0), 0x83, 0x7f, 500, 1540, 10, 70 },
+ { "dcdc2", 0x80, BIT(1), 0x84, 0x7f, 500, 1540, 10, 70 },
+ { "dcdc3", 0x80, BIT(2), 0x85, 0x7f, 500, 1840, 10, 70 },
+ { "dcdc4", 0x80, BIT(3), 0x86, 0x7f, 1000, 3700, 100, NA },
+ { "aldo1", 0x90, BIT(0), 0x93, 0x1f, 500, 3500, 100, NA },
+ { "aldo2", 0x90, BIT(1), 0x94, 0x1f, 500, 3500, 100, NA },
+ { "aldo3", 0x90, BIT(2), 0x95, 0x1f, 500, 3500, 100, NA },
+ { "aldo4", 0x90, BIT(3), 0x96, 0x1f, 500, 3500, 100, NA },
+ { "bldo1", 0x90, BIT(4), 0x97, 0x1f, 500, 3500, 100, NA },
+ { "bldo2", 0x90, BIT(5), 0x98, 0x1f, 500, 3500, 100, NA },
+ { "bldo3", 0x90, BIT(6), 0x99, 0x1f, 500, 3500, 100, NA },
+ { "bldo4", 0x90, BIT(7), 0x9a, 0x1f, 500, 3500, 100, NA },
+ { "cldo1", 0x91, BIT(0), 0x9b, 0x1f, 500, 3500, 100, NA },
+ { "cldo2", 0x91, BIT(1), 0x9c, 0x1f, 500, 3500, 100, NA },
+ { "cldo3", 0x91, BIT(2), 0x9d, 0x1f, 500, 3500, 100, NA },
+ { "cldo4", 0x91, BIT(3), 0x9e, 0x1f, 500, 3500, 100, NA },
+ {"cpusldo",0x91, BIT(4), 0x9f, 0x1f, 500, 1400, 50, NA },
+ {" boost", 0x19, BIT(4), 0x1e, 0xf0, 4550, 5510, 64, NA },
+ { }
+};
+
static const struct axp_regulator_plat axp803_regulators[] = {
{ "dcdc1", 0x10, BIT(0), 0x20, 0x1f, 1600, 3400, 100, NA },
{ "dcdc2", 0x10, BIT(1), 0x21, 0x7f, 500, 1300, 10, 70 },
@@ -291,6 +318,7 @@ static const struct axp_regulator_plat *const axp_regulators[] = {
[AXP221_ID] = axp22x_regulators,
[AXP223_ID] = axp22x_regulators,
[AXP313_ID] = axp313_regulators,
+ [AXP717_ID] = axp717_regulators,
[AXP803_ID] = axp803_regulators,
[AXP806_ID] = axp806_regulators,
[AXP809_ID] = axp809_regulators,
diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c
index 13725ee7a2d..a7333d8d9c0 100644
--- a/drivers/spi/spi-sunxi.c
+++ b/drivers/spi/spi-sunxi.c
@@ -135,7 +135,6 @@ struct sun4i_spi_variant {
struct sun4i_spi_plat {
struct sun4i_spi_variant *variant;
u32 base;
- u32 max_hz;
};
struct sun4i_spi_priv {
@@ -238,6 +237,13 @@ static void sun4i_spi_set_speed_mode(struct udevice *dev)
u32 reg;
/*
+ * The uclass should take care that this won't happen. But anyway,
+ * avoid a div-by-zero exception.
+ */
+ if (!priv->freq)
+ return;
+
+ /*
* Setup clock divider.
*
* We have two choices there. Either we can use the clock
@@ -401,11 +407,10 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int sun4i_spi_set_speed(struct udevice *dev, uint speed)
{
- struct sun4i_spi_plat *plat = dev_get_plat(dev);
struct sun4i_spi_priv *priv = dev_get_priv(dev);
- if (speed > plat->max_hz)
- speed = plat->max_hz;
+ if (speed > SUN4I_SPI_MAX_RATE)
+ speed = SUN4I_SPI_MAX_RATE;
if (speed < SUN4I_SPI_MIN_RATE)
speed = SUN4I_SPI_MIN_RATE;
@@ -458,7 +463,6 @@ static int sun4i_spi_probe(struct udevice *bus)
priv->variant = plat->variant;
priv->base = plat->base;
- priv->freq = plat->max_hz;
return 0;
}
@@ -466,16 +470,9 @@ static int sun4i_spi_probe(struct udevice *bus)
static int sun4i_spi_of_to_plat(struct udevice *bus)
{
struct sun4i_spi_plat *plat = dev_get_plat(bus);
- int node = dev_of_offset(bus);
plat->base = dev_read_addr(bus);
plat->variant = (struct sun4i_spi_variant *)dev_get_driver_data(bus);
- plat->max_hz = fdtdec_get_int(gd->fdt_blob, node,
- "spi-max-frequency",
- SUN4I_SPI_DEFAULT_RATE);
-
- if (plat->max_hz > SUN4I_SPI_MAX_RATE)
- plat->max_hz = SUN4I_SPI_MAX_RATE;
return 0;
}