aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMichal Simek2018-07-13 08:26:28 +0200
committerMichal Simek2018-07-19 10:49:55 +0200
commit4a693669670fffd9a614c8c5c9f5ba027fd0185e (patch)
tree1196bc82934666aae328518b95cb508ba3ed2dba /board
parentc7e794892489316c035e6a0c9e3753306f79d4c0 (diff)
microblaze: Convert generic platform to DM gpio
Converting GPIO to DM requires to do changes in reset subsystem that's why support for Microblaze soft reset via sysreset and GPIO sysreset support was added. These two patches enables enabling GPIO DM. Microblaze soft reset is bind at last reset method. GPIO reset is handled via sysreset with adding this fragment to DT. gpio-restart { compatible = "gpio-restart"; gpios = <&reset_gpio 0 0 0>; /* 3rd cell ACTIVE_HIGH = 0, ACTIVE_LOW = 1 */ }; hard-reset-gpio property is not documented and also handled. Conversion is required. Unfortunately do_reset is required for SPL that's why use only soft microblaze reset for now. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board')
-rw-r--r--board/xilinx/microblaze-generic/microblaze-generic.c46
-rw-r--r--board/xilinx/microblaze-generic/xparameters.h3
2 files changed, 11 insertions, 38 deletions
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 556d0de7f14..44fb48b347a 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * (C) Copyright 2007 Michal Simek
+ * (C) Copyright 2007-2018 Michal Simek
*
- * Michal SIMEK <monstr@monstr.eu>
+ * Michal SIMEK <monstr@monstr.eu>
*/
/*
@@ -12,6 +12,8 @@
#include <common.h>
#include <config.h>
+#include <dm.h>
+#include <dm/lists.h>
#include <fdtdec.h>
#include <asm/processor.h>
#include <asm/microblaze_intc.h>
@@ -22,10 +24,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_XILINX_GPIO
-static int reset_pin = -1;
-#endif
-
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
static struct udevice *watchdog_dev;
#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
@@ -66,33 +64,6 @@ int dram_init(void)
return 0;
};
-#if !defined(CONFIG_SYSRESET) || defined(CONFIG_SPL_BUILD)
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-#ifndef CONFIG_SPL_BUILD
-#ifdef CONFIG_XILINX_GPIO
- if (reset_pin != -1)
- gpio_direction_output(reset_pin, 1);
-#endif
-#endif
- puts("Resetting board\n");
- __asm__ __volatile__ (" mts rmsr, r0;" \
- "bra r0");
-
- return 0;
-}
-#endif
-
-static int gpio_init(void)
-{
-#ifdef CONFIG_XILINX_GPIO
- reset_pin = gpio_alloc(CONFIG_SYS_GPIO_0_ADDR, "reset", 1);
- if (reset_pin != -1)
- gpio_request(reset_pin, "reset_pin");
-#endif
- return 0;
-}
-
#ifdef CONFIG_WDT
/* Called by macro WATCHDOG_RESET */
void watchdog_reset(void)
@@ -117,8 +88,6 @@ void watchdog_reset(void)
int board_late_init(void)
{
- gpio_init();
-
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
watchdog_dev = NULL;
@@ -133,6 +102,13 @@ int board_late_init(void)
wdt_start(watchdog_dev, 0, 0);
puts("Watchdog: Started\n");
#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
+ int ret;
+ ret = device_bind_driver(gd->dm_root, "mb_soft_reset",
+ "reset_soft", NULL);
+ if (ret)
+ printf("Warning: No reset driver: ret=%d\n", ret);
+#endif
return 0;
}
diff --git a/board/xilinx/microblaze-generic/xparameters.h b/board/xilinx/microblaze-generic/xparameters.h
index 01116d827c6..5e0911faf63 100644
--- a/board/xilinx/microblaze-generic/xparameters.h
+++ b/board/xilinx/microblaze-generic/xparameters.h
@@ -13,9 +13,6 @@
/* Microblaze is microblaze_0 */
#define XILINX_FSL_NUMBER 3
-/* GPIO is LEDs_4Bit*/
-#define XILINX_GPIO_BASEADDR 0x40000000
-
/* Flash Memory is FLASH_2Mx32 */
#define XILINX_FLASH_START 0x2c000000
#define XILINX_FLASH_SIZE 0x00800000