aboutsummaryrefslogtreecommitdiffstats
path: root/hw/etraxfs.c
diff options
context:
space:
mode:
authoredgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-11 15:07:19 +0000
committeredgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-11 15:07:19 +0000
commit48318011da95864717cd0d1d9c2877e7c66fac0d (patch)
treeaf66f94943ec724feceae46c0fad049c1a667014 /hw/etraxfs.c
parenta3ea5df58845aac6e49ee36d4bef654e67b78c8a (diff)
Update the etrax machine.
* Use CFI-0002 flashes. * Connect one of the ethernet blocks. * Simplified irq numbering. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4430 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/etraxfs.c')
-rw-r--r--hw/etraxfs.c61
1 files changed, 42 insertions, 19 deletions
diff --git a/hw/etraxfs.c b/hw/etraxfs.c
index a95115da1..19ec21c37 100644
--- a/hw/etraxfs.c
+++ b/hw/etraxfs.c
@@ -24,10 +24,14 @@
#include <time.h>
#include <sys/time.h>
#include "hw.h"
-#include "sysemu.h"
+#include "net.h"
#include "flash.h"
+#include "sysemu.h"
+#include "devices.h"
#include "boards.h"
+#include "etraxfs_dma.h"
+
static void main_cpu_reset(void *opaque)
{
CPUState *env = opaque;
@@ -36,14 +40,18 @@ static void main_cpu_reset(void *opaque)
/* Init functions for different blocks. */
extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base);
-void etraxfs_timer_init(CPUState *env, qemu_irq *irqs,
+void etraxfs_timer_init(CPUState *env, qemu_irq *irqs,
target_phys_addr_t base);
+void *etraxfs_eth_init(NICInfo *nd, CPUState *env,
+ qemu_irq *irq, target_phys_addr_t base);
void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr,
target_phys_addr_t base);
#define FLASH_SIZE 0x2000000
#define INTMEM_SIZE (128 * 1024)
+static void *etraxfs_dmac;
+
static
void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
@@ -52,8 +60,9 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
{
CPUState *env;
qemu_irq *pic;
+ struct etraxfs_dma_client *eth0;
int kernel_size;
- int index;
+ int i;
ram_addr_t phys_ram;
ram_addr_t phys_intmem;
@@ -84,23 +93,36 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM);
cpu_register_physical_memory(0x84000000, FLASH_SIZE,
0x04000000 | IO_MEM_ROM);
- index = drive_get_index(IF_PFLASH, 0, 0);
- pflash_cfi01_register(0x80000000, FLASH_SIZE,
- drives_table[index].bdrv, 65536, FLASH_SIZE >> 16,
- 4, 0x0000, 0x0000, 0x0000, 0x0000);
+ i = drive_get_index(IF_PFLASH, 0, 0);
+ pflash_cfi02_register(0x80000000, qemu_ram_alloc(FLASH_SIZE),
+ drives_table[i].bdrv, (64 * 1024),
+ FLASH_SIZE >> 16,
+ 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa);
pic = etraxfs_pic_init(env, 0xb001c000);
+ etraxfs_dmac = etraxfs_dmac_init(env, 0xb0000000, 10);
+ for (i = 0; i < 10; i++) {
+ /* On ETRAX, odd numbered channels are inputs. */
+ etraxfs_dmac_connect(etraxfs_dmac, i, pic + 7 + i, i & 1);
+ }
+
+ /* It has 2, but let's start with one ethernet block. */
+ eth0 = etraxfs_eth_init(&nd_table[0], env, pic + 25, 0xb0034000);
+
+ /* The DMA Connector block is missing, hardwire things for now. */
+ etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth0);
+ etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth0 + 1);
+
/* 2 timers. */
- etraxfs_timer_init(env, pic + 26, 0xb001e000);
- etraxfs_timer_init(env, pic + 26, 0xb005e000);
- /* 4 serial ports. */
- etraxfs_ser_init(env, pic + 19, serial_hds[0], 0xb0026000);
- if (serial_hds[1])
- etraxfs_ser_init(env, pic + 20, serial_hds[1], 0xb0028000);
- if (serial_hds[2])
- etraxfs_ser_init(env, pic + 21, serial_hds[2], 0xb002a000);
- if (serial_hds[3])
- etraxfs_ser_init(env, pic + 22, serial_hds[3], 0xb002c000);
+ etraxfs_timer_init(env, pic + 0x1b, 0xb001e000);
+ etraxfs_timer_init(env, pic + 0x1b, 0xb005e000);
+
+ for (i = 0; i < 4; i++) {
+ if (serial_hds[i]) {
+ etraxfs_ser_init(env, pic + 0x14 + i,
+ serial_hds[i], 0xb0026000 + i * 0x2000);
+ }
+ }
#if 1
/* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard
@@ -126,7 +148,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
}
printf ("pc =%x\n", env->pc);
- printf ("ram size =%d\n", ram_size);
+ printf ("ram size =%ld\n", ram_size);
printf ("kernel name =%s\n", kernel_filename);
printf ("kernel size =%d\n", kernel_size);
printf ("cpu haltd =%d\n", env->halted);
@@ -134,11 +156,12 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
void DMA_run(void)
{
+ etraxfs_dmac_run(etraxfs_dmac);
}
QEMUMachine bareetraxfs_machine = {
"bareetraxfs",
"Bare ETRAX FS board",
bareetraxfs_init,
- 0x800000,
+ 0x4000000,
};