summaryrefslogtreecommitdiff
path: root/board/gateworks
diff options
context:
space:
mode:
authorTim Harvey <tharvey@gateworks.com>2021-07-01 02:50:02 +0300
committerStefano Babic <sbabic@denx.de>2021-07-10 19:12:41 +0300
commitc9f7ef37f97a38494ac757dc735b42ab00aba0c0 (patch)
tree115ca8261e67ce196227bc5d3c8616b293c94ec3 /board/gateworks
parent6b86554865ad271a71e93c125594335721b615c9 (diff)
downloadu-boot-c9f7ef37f97a38494ac757dc735b42ab00aba0c0.tar.xz
board: gateworks: venice: add imx8mm-gw7901 support
The Gateworks GW7901 is an ARM based single board computer (SBC) featuring: - i.MX8M Mini SoC - LPDDR4 DRAM - eMMC FLASH - SPI FRAM - Gateworks System Controller (GSC) - Atmel ATECC Crypto Authentication - USB 2.0 - Microchip GbE Switch - Multiple multi-protocol RS232/RS485/RS422 Serial ports - onboard 802.11ac WiFi / BT - microSD socket - miniPCIe socket with PCIe, USB 2.0 and dual SIM sockets - Wide range DC power input - 802.3at PoE To add support for this board: - add dts from Linux (accepted for v5.14) - add SPL PMIC config Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Diffstat (limited to 'board/gateworks')
-rw-r--r--board/gateworks/venice/spl.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c
index ea500d4f81..8c357757c1 100644
--- a/board/gateworks/venice/spl.c
+++ b/board/gateworks/venice/spl.c
@@ -26,6 +26,7 @@
#include <dm/uclass-internal.h>
#include <dm/device-internal.h>
+#include <power/bd71837.h>
#include <power/mp5416.h>
#include "gsc.h"
@@ -88,8 +89,23 @@ int board_early_init_f(void)
* Note that we can not use pmic dm drivers here as we have a generic
* venice dt that does not have board-specific pmic's defined.
*
- * Instead we must use dm_i2c.
+ * Instead we must use dm_i2c so we a helpers to give us
+ * clrsetbit functions we would otherwise have if we could use PMIC dm
+ * drivers.
*/
+static int dm_i2c_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
+{
+ int ret;
+ u8 val;
+
+ ret = dm_i2c_read(dev, reg, &val, 1);
+ if (ret)
+ return ret;
+ val = (val & ~clr) | set;
+
+ return dm_i2c_write(dev, reg, &val, 1);
+}
+
static int power_init_board(void)
{
const char *model = gsc_get_model();
@@ -117,6 +133,43 @@ static int power_init_board(void)
BIT(7) | MP5416_VSET_SW3_SVAL(920000));
}
+ else if (!strncmp(model, "GW7901", 6)) {
+ ret = uclass_get_device_by_name(UCLASS_I2C, "i2c@30a30000", &bus);
+ if (ret) {
+ printf("PMIC : failed I2C2 probe: %d\n", ret);
+ return ret;
+ }
+ ret = dm_i2c_probe(bus, 0x4b, 0, &dev);
+ if (ret) {
+ printf("PMIC : failed probe: %d\n", ret);
+ return ret;
+ }
+ puts("PMIC : BD71847\n");
+
+ /* unlock the PMIC regs */
+ dm_i2c_reg_write(dev, BD718XX_REGLOCK, 0x1);
+
+ /* set switchers to forced PWM mode */
+ dm_i2c_clrsetbits(dev, BD718XX_BUCK1_CTRL, 0, 0x8);
+ dm_i2c_clrsetbits(dev, BD718XX_BUCK2_CTRL, 0, 0x8);
+ dm_i2c_clrsetbits(dev, BD718XX_1ST_NODVS_BUCK_CTRL, 0, 0x8);
+ dm_i2c_clrsetbits(dev, BD718XX_2ND_NODVS_BUCK_CTRL, 0, 0x8);
+ dm_i2c_clrsetbits(dev, BD718XX_3RD_NODVS_BUCK_CTRL, 0, 0x8);
+ dm_i2c_clrsetbits(dev, BD718XX_4TH_NODVS_BUCK_CTRL, 0, 0x8);
+
+ /* increase VDD_0P95 (VDD_GPU/VPU/DRAM) to 0.975v for 1.5Ghz DDR */
+ dm_i2c_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
+
+ /* increase VDD_SOC to 0.85v before first DRAM access */
+ dm_i2c_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
+
+ /* increase VDD_ARM to 0.92v for 800 and 1600Mhz */
+ dm_i2c_reg_write(dev, BD718XX_BUCK2_VOLT_RUN, 0x16);
+
+ /* Lock the PMIC regs */
+ dm_i2c_reg_write(dev, BD718XX_REGLOCK, 0x11);
+ }
+
return 0;
}