summaryrefslogtreecommitdiffstats
path: root/qemu/roms/u-boot/board/psyent
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/u-boot/board/psyent
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/u-boot/board/psyent')
-rw-r--r--qemu/roms/u-boot/board/psyent/common/AMDLV065D.c174
-rw-r--r--qemu/roms/u-boot/board/psyent/pci5441/Makefile8
-rw-r--r--qemu/roms/u-boot/board/psyent/pci5441/config.mk14
-rw-r--r--qemu/roms/u-boot/board/psyent/pci5441/pci5441.c24
-rw-r--r--qemu/roms/u-boot/board/psyent/pk1c20/Makefile8
-rw-r--r--qemu/roms/u-boot/board/psyent/pk1c20/config.mk14
-rw-r--r--qemu/roms/u-boot/board/psyent/pk1c20/led.c46
-rw-r--r--qemu/roms/u-boot/board/psyent/pk1c20/pk1c20.c36
8 files changed, 324 insertions, 0 deletions
diff --git a/qemu/roms/u-boot/board/psyent/common/AMDLV065D.c b/qemu/roms/u-boot/board/psyent/common/AMDLV065D.c
new file mode 100644
index 000000000..409a7a82f
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/common/AMDLV065D.c
@@ -0,0 +1,174 @@
+/*
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+
+#include <common.h>
+#if defined(CONFIG_NIOS)
+#include <nios.h>
+#else
+#include <asm/io.h>
+#endif
+
+#define SECTSZ (64 * 1024)
+flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
+
+/*----------------------------------------------------------------------*/
+unsigned long flash_init (void)
+{
+ int i;
+ unsigned long addr;
+ flash_info_t *fli = &flash_info[0];
+
+ fli->size = CONFIG_SYS_FLASH_SIZE;
+ fli->sector_count = CONFIG_SYS_MAX_FLASH_SECT;
+ fli->flash_id = FLASH_MAN_AMD + FLASH_AMDLV065D;
+
+ addr = CONFIG_SYS_FLASH_BASE;
+ for (i = 0; i < fli->sector_count; ++i) {
+ fli->start[i] = addr;
+ addr += SECTSZ;
+ fli->protect[i] = 1;
+ }
+
+ return (CONFIG_SYS_FLASH_SIZE);
+}
+/*--------------------------------------------------------------------*/
+void flash_print_info (flash_info_t * info)
+{
+ int i, k;
+ int erased;
+ unsigned long *addr;
+
+ printf (" Size: %ld KB in %d Sectors\n",
+ info->size >> 10, info->sector_count);
+ printf (" Sector Start Addresses:");
+ for (i = 0; i < info->sector_count; ++i) {
+
+ /* Check if whole sector is erased */
+ erased = 1;
+ addr = (unsigned long *) info->start[i];
+ for (k = 0; k < SECTSZ/sizeof(unsigned long); k++) {
+ if ( readl(addr++) != (unsigned long)-1) {
+ erased = 0;
+ break;
+ }
+ }
+
+ /* Print the info */
+ if ((i % 5) == 0)
+ printf ("\n ");
+ printf (" %08lX%s%s",
+ info->start[i],
+ erased ? " E" : " ",
+ info->protect[i] ? "RO " : " ");
+ }
+ printf ("\n");
+}
+
+/*-------------------------------------------------------------------*/
+
+
+int flash_erase (flash_info_t * info, int s_first, int s_last)
+{
+ unsigned char *addr = (unsigned char *) info->start[0];
+ unsigned char *addr2;
+ int prot, sect;
+ ulong start;
+
+ /* Some sanity checking */
+ if ((s_first < 0) || (s_first > s_last)) {
+ printf ("- no sectors to erase\n");
+ return 1;
+ }
+
+ prot = 0;
+ for (sect = s_first; sect <= s_last; ++sect) {
+ if (info->protect[sect]) {
+ prot++;
+ }
+ }
+ if (prot) {
+ printf ("- Warning: %d protected sectors will not be erased!\n",
+ prot);
+ } else {
+ printf ("\n");
+ }
+
+ /* It's ok to erase multiple sectors provided we don't delay more
+ * than 50 usec between cmds ... at which point the erase time-out
+ * occurs. So don't go and put printf() calls in the loop ... it
+ * won't be very helpful ;-)
+ */
+ for (sect = s_first; sect <= s_last; sect++) {
+ if (info->protect[sect] == 0) { /* not protected */
+ addr2 = (unsigned char *) info->start[sect];
+ writeb (0xaa, addr);
+ writeb (0x55, addr);
+ writeb (0x80, addr);
+ writeb (0xaa, addr);
+ writeb (0x55, addr);
+ writeb (0x30, addr2);
+ /* Now just wait for 0xff & provide some user
+ * feedback while we wait.
+ */
+ start = get_timer (0);
+ while ( readb (addr2) != 0xff) {
+ udelay (1000 * 1000);
+ putc ('.');
+ if (get_timer (start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+ printf ("timeout\n");
+ return 1;
+ }
+ }
+ }
+ }
+ printf ("\n");
+ return 0;
+}
+
+/*-----------------------------------------------------------------------
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ */
+
+int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+{
+
+ vu_char *cmd = (vu_char *) info->start[0];
+ vu_char *dst = (vu_char *) addr;
+ unsigned char b;
+ ulong start;
+
+ while (cnt) {
+ /* Check for sufficient erase */
+ b = *src;
+ if ((readb (dst) & b) != b) {
+ printf ("%02x : %02x\n", readb (dst), b);
+ return (2);
+ }
+
+ writeb (0xaa, cmd);
+ writeb (0x55, cmd);
+ writeb (0xa0, cmd);
+ writeb (dst, b);
+
+ /* Verify write */
+ start = get_timer (0);
+ while (readb (dst) != b) {
+ if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
+ return 1;
+ }
+ }
+ dst++;
+ src++;
+ cnt--;
+ }
+
+ return (0);
+}
diff --git a/qemu/roms/u-boot/board/psyent/pci5441/Makefile b/qemu/roms/u-boot/board/psyent/pci5441/Makefile
new file mode 100644
index 000000000..364f163e4
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pci5441/Makefile
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y := pci5441.o ../common/AMDLV065D.o
diff --git a/qemu/roms/u-boot/board/psyent/pci5441/config.mk b/qemu/roms/u-boot/board/psyent/pci5441/config.mk
new file mode 100644
index 000000000..776fa8ab4
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pci5441/config.mk
@@ -0,0 +1,14 @@
+#
+# (C) Copyright 2004, Psyent Corporation <www.psyent.com>
+# Scott McNutt <smcnutt@psyent.com>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+CONFIG_SYS_TEXT_BASE = 0x018e0000
+
+PLATFORM_CPPFLAGS += -mno-hw-div -mno-hw-mul
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
diff --git a/qemu/roms/u-boot/board/psyent/pci5441/pci5441.c b/qemu/roms/u-boot/board/psyent/pci5441/pci5441.c
new file mode 100644
index 000000000..6d619e512
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pci5441/pci5441.c
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+
+int board_early_init_f (void)
+{
+ return 0;
+}
+
+int checkboard (void)
+{
+ puts ("BOARD : Psyent PCI-5441\n");
+ return 0;
+}
+
+phys_size_t initdram (int board_type)
+{
+ return (0);
+}
diff --git a/qemu/roms/u-boot/board/psyent/pk1c20/Makefile b/qemu/roms/u-boot/board/psyent/pk1c20/Makefile
new file mode 100644
index 000000000..5450f93ac
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pk1c20/Makefile
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y := pk1c20.o led.o ../common/AMDLV065D.o
diff --git a/qemu/roms/u-boot/board/psyent/pk1c20/config.mk b/qemu/roms/u-boot/board/psyent/pk1c20/config.mk
new file mode 100644
index 000000000..83cfadc11
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pk1c20/config.mk
@@ -0,0 +1,14 @@
+#
+# (C) Copyright 2004, Psyent Corporation <www.psyent.com>
+# Scott McNutt <smcnutt@psyent.com>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+CONFIG_SYS_TEXT_BASE = 0x01fc0000
+
+PLATFORM_CPPFLAGS += -mno-hw-div -mno-hw-mul
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
diff --git a/qemu/roms/u-boot/board/psyent/pk1c20/led.c b/qemu/roms/u-boot/board/psyent/pk1c20/led.c
new file mode 100644
index 000000000..580d590f2
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pk1c20/led.c
@@ -0,0 +1,46 @@
+/*
+ * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <nios2-io.h>
+#include <status_led.h>
+
+/* The LED port is configured as output only, so we
+ * must track the state manually.
+ */
+static led_id_t val = 0;
+
+void __led_init (led_id_t mask, int state)
+{
+ nios_pio_t *pio = (nios_pio_t *)CONFIG_SYS_LEDPIO_ADDR;
+
+ if (state == STATUS_LED_ON)
+ val &= ~mask;
+ else
+ val |= mask;
+ writel (val, &pio->data);
+}
+
+void __led_set (led_id_t mask, int state)
+{
+ nios_pio_t *pio = (nios_pio_t *)CONFIG_SYS_LEDPIO_ADDR;
+
+ if (state == STATUS_LED_ON)
+ val &= ~mask;
+ else
+ val |= mask;
+ writel (val, &pio->data);
+}
+
+void __led_toggle (led_id_t mask)
+{
+ nios_pio_t *pio = (nios_pio_t *)CONFIG_SYS_LEDPIO_ADDR;
+
+ val ^= mask;
+ writel (val, &pio->data);
+}
diff --git a/qemu/roms/u-boot/board/psyent/pk1c20/pk1c20.c b/qemu/roms/u-boot/board/psyent/pk1c20/pk1c20.c
new file mode 100644
index 000000000..0b4c9f8ac
--- /dev/null
+++ b/qemu/roms/u-boot/board/psyent/pk1c20/pk1c20.c
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <netdev.h>
+
+int board_early_init_f (void)
+{
+ return 0;
+}
+
+int checkboard (void)
+{
+ puts ("BOARD : Psyent PK-1C20\n");
+ return 0;
+}
+
+phys_size_t initdram (int board_type)
+{
+ return (0);
+}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_SMC91111
+ rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
+#endif
+ return rc;
+}
+#endif