summaryrefslogtreecommitdiff
path: root/board/st/stm32mp1/stm32mp1.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-07 14:00:44 -0400
committerTom Rini <trini@konsulko.com>2020-07-07 14:00:44 -0400
commit1e88e78177da80fa8e9fa9fc7613657478d61d1e (patch)
tree9b713c7aab282891762ed8cdd6c1fffa195bd1ac /board/st/stm32mp1/stm32mp1.c
parentc4df37bfa916d6516d67dde6ef9d1b18b36041d3 (diff)
parent6c393e8c0fae98a3a6e2909fc79697075552a152 (diff)
Merge tag 'u-boot-stm32-20200707' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
- arch and board update for stm32mp15: - use OPP information in device tree for 800MHz/650MHz support - ram: inprovments of test command - solve boot on closed chip when access to DBGMCU_IDC is protected - stm32prog command: Add "device anme" during USB enumeration - update configs: activate WATCHDOG and 'env erase' command, increase teed partition, support SD card after NOR boot by default and use env info in env_check - some sboard cleanups: gpio hog in dh board, specific driver for type-c stusb1600 controller code in a driver move part of code in spl.c and in common directory - fix STM32 compatible for dwc_eth_qos driver - support of new pinctrl ops get_dir_flags/set_dir_flags in stm32 and stmfx drivers - vrefbuf: fix a possible overshoot when re-enabling
Diffstat (limited to 'board/st/stm32mp1/stm32mp1.c')
-rw-r--r--board/st/stm32mp1/stm32mp1.c74
1 files changed, 14 insertions, 60 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 4553329b250..71daf180347 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -41,6 +41,8 @@
#include <power/regulator.h>
#include <usb/dwc2_udc.h>
+#include "../../st/common/stusb160x.h"
+
/* SYSCFG registers */
#define SYSCFG_BOOTR 0x00
#define SYSCFG_PMCSETR 0x04
@@ -84,6 +86,12 @@ DECLARE_GLOBAL_DATA_PTR;
#define USB_START_LOW_THRESHOLD_UV 1230000
#define USB_START_HIGH_THRESHOLD_UV 2150000
+int board_early_init_f(void)
+{
+ /* nothing to do, only used in SPL */
+ return 0;
+}
+
int checkboard(void)
{
int ret;
@@ -175,64 +183,16 @@ static void board_key_check(void)
}
#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-
-/* STMicroelectronics STUSB1600 Type-C controller */
-#define STUSB1600_CC_CONNECTION_STATUS 0x0E
-
-/* STUSB1600_CC_CONNECTION_STATUS bitfields */
-#define STUSB1600_CC_ATTACH BIT(0)
-
-static int stusb1600_init(struct udevice **dev_stusb1600)
-{
- ofnode node;
- struct udevice *dev, *bus;
- int ret;
- u32 chip_addr;
-
- *dev_stusb1600 = NULL;
-
- /* if node stusb1600 is present, means DK1 or DK2 board */
- node = ofnode_by_compatible(ofnode_null(), "st,stusb1600");
- if (!ofnode_valid(node))
- return -ENODEV;
-
- ret = ofnode_read_u32(node, "reg", &chip_addr);
- if (ret)
- return -EINVAL;
-
- ret = uclass_get_device_by_ofnode(UCLASS_I2C, ofnode_get_parent(node),
- &bus);
- if (ret) {
- printf("bus for stusb1600 not found\n");
- return -ENODEV;
- }
-
- ret = dm_i2c_probe(bus, chip_addr, 0, &dev);
- if (!ret)
- *dev_stusb1600 = dev;
-
- return ret;
-}
-
-static int stusb1600_cable_connected(struct udevice *dev)
-{
- u8 status;
-
- if (dm_i2c_read(dev, STUSB1600_CC_CONNECTION_STATUS, &status, 1))
- return 0;
-
- return status & STUSB1600_CC_ATTACH;
-}
-
#include <usb/dwc2_udc.h>
int g_dnl_board_usb_cable_connected(void)
{
- struct udevice *stusb1600;
struct udevice *dwc2_udc_otg;
int ret;
- if (!stusb1600_init(&stusb1600))
- return stusb1600_cable_connected(stusb1600);
+ /* if typec stusb160x is present, means DK1 or DK2 board */
+ ret = stusb160x_cable_connected();
+ if (ret >= 0)
+ return ret;
ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
DM_GET_DRIVER(dwc2_udc_otg),
@@ -664,17 +624,11 @@ static void board_ev1_init(void)
/* board dependent setup after realloc */
int board_init(void)
{
- struct udevice *dev;
-
/* address of boot parameters */
gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
- /* probe all PINCTRL for hog */
- for (uclass_first_device(UCLASS_PINCTRL, &dev);
- dev;
- uclass_next_device(&dev)) {
- pr_debug("probe pincontrol = %s\n", dev->name);
- }
+ if (CONFIG_IS_ENABLED(DM_GPIO_HOG))
+ gpio_hog_probe_all();
board_key_check();