summaryrefslogtreecommitdiffstats
path: root/qemu/roms/u-boot/board/cm-bf537e
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/u-boot/board/cm-bf537e')
-rw-r--r--qemu/roms/u-boot/board/cm-bf537e/Makefile12
-rw-r--r--qemu/roms/u-boot/board/cm-bf537e/cm-bf537e.c59
-rw-r--r--qemu/roms/u-boot/board/cm-bf537e/config.mk11
-rw-r--r--qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.c81
-rw-r--r--qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.h10
5 files changed, 173 insertions, 0 deletions
diff --git a/qemu/roms/u-boot/board/cm-bf537e/Makefile b/qemu/roms/u-boot/board/cm-bf537e/Makefile
new file mode 100644
index 000000000..be8056f4b
--- /dev/null
+++ b/qemu/roms/u-boot/board/cm-bf537e/Makefile
@@ -0,0 +1,12 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y := cm-bf537e.o gpio_cfi_flash.o
diff --git a/qemu/roms/u-boot/board/cm-bf537e/cm-bf537e.c b/qemu/roms/u-boot/board/cm-bf537e/cm-bf537e.c
new file mode 100644
index 000000000..e79f90f95
--- /dev/null
+++ b/qemu/roms/u-boot/board/cm-bf537e/cm-bf537e.c
@@ -0,0 +1,59 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) 2005-2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <config.h>
+#include <command.h>
+#include <net.h>
+#include <netdev.h>
+#include <asm/blackfin.h>
+#include "gpio_cfi_flash.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int checkboard(void)
+{
+ printf("Board: Bluetechnix CM-BF537E board\n");
+ printf(" Support: http://www.bluetechnix.at/\n");
+ return 0;
+}
+
+static void board_init_enetaddr(char *var)
+{
+ uchar enetaddr[6];
+
+ if (eth_getenv_enetaddr(var, enetaddr))
+ return;
+
+ printf("Warning: %s: generating 'random' MAC address\n", var);
+ eth_random_addr(enetaddr);
+ eth_setenv_enetaddr(var, enetaddr);
+}
+
+#ifndef CONFIG_BFIN_MAC
+# define bfin_EMAC_initialize(x) 1
+#endif
+#ifndef CONFIG_SMC911X
+# define smc911x_initialize(n, x) 1
+#endif
+int board_eth_init(bd_t *bis)
+{
+ /* return ok if at least 1 eth device works */
+ return bfin_EMAC_initialize(bis) &
+ smc911x_initialize(0, CONFIG_SMC911X_BASE);
+}
+
+int misc_init_r(void)
+{
+ board_init_enetaddr("ethaddr");
+ board_init_enetaddr("eth1addr");
+
+ gpio_cfi_flash_init();
+
+ return 0;
+}
diff --git a/qemu/roms/u-boot/board/cm-bf537e/config.mk b/qemu/roms/u-boot/board/cm-bf537e/config.mk
new file mode 100644
index 000000000..7f9138b09
--- /dev/null
+++ b/qemu/roms/u-boot/board/cm-bf537e/config.mk
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+# Set some default LDR flags based on boot mode.
+LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.c b/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.c
new file mode 100644
index 000000000..1075cc411
--- /dev/null
+++ b/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.c
@@ -0,0 +1,81 @@
+/*
+ * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
+ *
+ * Copyright (c) 2009-2010 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <asm/blackfin.h>
+#include <asm/gpio.h>
+#include <asm/io.h>
+#include "gpio_cfi_flash.h"
+
+/* Allow this driver to be shared among boards */
+#ifndef GPIO_PIN_1
+#define GPIO_PIN_1 GPIO_PF4
+#endif
+#define GPIO_MASK_1 (1 << 21)
+#ifndef GPIO_PIN_2
+#define GPIO_MASK_2 (0)
+#else
+#define GPIO_MASK_2 (1 << 22)
+#endif
+#ifndef GPIO_PIN_3
+#define GPIO_MASK_3 (0)
+#else
+#define GPIO_MASK_3 (1 << 23)
+#endif
+#define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2 | GPIO_MASK_3)
+
+void *gpio_cfi_flash_swizzle(void *vaddr)
+{
+ unsigned long addr = (unsigned long)vaddr;
+
+ gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
+
+#ifdef GPIO_PIN_2
+ gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
+#endif
+
+#ifdef GPIO_PIN_3
+ gpio_set_value(GPIO_PIN_3, addr & GPIO_MASK_3);
+#endif
+
+ SSYNC();
+ udelay(1);
+
+ return (void *)(addr & ~GPIO_MASK);
+}
+
+#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
+#define __raw_readq(addr) *(volatile u64 *)addr
+
+#define MAKE_FLASH(size, sfx) \
+void flash_write##size(u##size value, void *addr) \
+{ \
+ __raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
+} \
+u##size flash_read##size(void *addr) \
+{ \
+ return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
+}
+MAKE_FLASH(8, b) /* flash_write8() flash_read8() */
+MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
+MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
+MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
+
+void gpio_cfi_flash_init(void)
+{
+ gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
+ gpio_direction_output(GPIO_PIN_1, 0);
+#ifdef GPIO_PIN_2
+ gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+ gpio_direction_output(GPIO_PIN_2, 0);
+#endif
+#ifdef GPIO_PIN_3
+ gpio_request(GPIO_PIN_3, "gpio_cfi_flash");
+ gpio_direction_output(GPIO_PIN_3, 0);
+#endif
+}
diff --git a/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.h b/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.h
new file mode 100644
index 000000000..5211e972a
--- /dev/null
+++ b/qemu/roms/u-boot/board/cm-bf537e/gpio_cfi_flash.h
@@ -0,0 +1,10 @@
+/*
+ * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
+ *
+ * Copyright (c) 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+void *gpio_cfi_flash_swizzle(void *vaddr);
+void gpio_cfi_flash_init(void);