etrax: Allocate DMA connections at board level.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
This commit is contained in:
parent
bbea04df98
commit
1da005b374
@ -255,7 +255,7 @@ void axisdev88_init (ram_addr_t ram_size,
|
||||
DriveInfo *nand;
|
||||
qemu_irq irq[30], nmi[2], *cpu_irq;
|
||||
void *etraxfs_dmac;
|
||||
struct etraxfs_dma_client *eth[2] = {NULL, NULL};
|
||||
struct etraxfs_dma_client *dma_eth;
|
||||
int i;
|
||||
int nand_regs;
|
||||
int gpio_regs;
|
||||
@ -315,16 +315,18 @@ void axisdev88_init (ram_addr_t ram_size,
|
||||
}
|
||||
|
||||
/* Add the two ethernet blocks. */
|
||||
eth[0] = etraxfs_eth_init(&nd_table[0], 0x30034000, 1);
|
||||
if (nb_nics > 1)
|
||||
eth[1] = etraxfs_eth_init(&nd_table[1], 0x30036000, 2);
|
||||
dma_eth = qemu_mallocz(sizeof dma_eth[0] * 4); /* Allocate 4 channels. */
|
||||
etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &dma_eth[0], &dma_eth[1]);
|
||||
if (nb_nics > 1) {
|
||||
etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &dma_eth[2], &dma_eth[3]);
|
||||
}
|
||||
|
||||
/* The DMA Connector block is missing, hardwire things for now. */
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth[0]);
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth[0] + 1);
|
||||
if (eth[1]) {
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 6, eth[1]);
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 7, eth[1] + 1);
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 0, &dma_eth[0]);
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 1, &dma_eth[1]);
|
||||
if (nb_nics > 1) {
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 6, &dma_eth[2]);
|
||||
etraxfs_dmac_connect_client(etraxfs_dmac, 7, &dma_eth[3]);
|
||||
}
|
||||
|
||||
/* 2 timers. */
|
||||
|
@ -25,4 +25,6 @@
|
||||
#include "etraxfs_dma.h"
|
||||
|
||||
qemu_irq *cris_pic_init_cpu(CPUState *env);
|
||||
void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr);
|
||||
void etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr,
|
||||
struct etraxfs_dma_client *dma_out,
|
||||
struct etraxfs_dma_client *dma_in);
|
||||
|
@ -562,7 +562,11 @@ static void eth_cleanup(VLANClientState *nc)
|
||||
|
||||
cpu_unregister_io_memory(eth->ethregs);
|
||||
|
||||
qemu_free(eth->dma_out);
|
||||
/* Disconnect the client. */
|
||||
eth->dma_out->client.push = NULL;
|
||||
eth->dma_out->client.opaque = NULL;
|
||||
eth->dma_in->client.opaque = NULL;
|
||||
eth->dma_in->client.pull = NULL;
|
||||
qemu_free(eth);
|
||||
}
|
||||
|
||||
@ -575,23 +579,23 @@ static NetClientInfo net_etraxfs_info = {
|
||||
.link_status_changed = eth_set_link,
|
||||
};
|
||||
|
||||
void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr)
|
||||
void etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr,
|
||||
struct etraxfs_dma_client *dma_out,
|
||||
struct etraxfs_dma_client *dma_in)
|
||||
{
|
||||
struct etraxfs_dma_client *dma = NULL;
|
||||
struct fs_eth *eth = NULL;
|
||||
|
||||
qemu_check_nic_model(nd, "fseth");
|
||||
|
||||
dma = qemu_mallocz(sizeof *dma * 2);
|
||||
eth = qemu_mallocz(sizeof *eth);
|
||||
|
||||
dma[0].client.push = eth_tx_push;
|
||||
dma[0].client.opaque = eth;
|
||||
dma[1].client.opaque = eth;
|
||||
dma[1].client.pull = NULL;
|
||||
dma_out->client.push = eth_tx_push;
|
||||
dma_out->client.opaque = eth;
|
||||
dma_in->client.opaque = eth;
|
||||
dma_in->client.pull = NULL;
|
||||
|
||||
eth->dma_out = dma;
|
||||
eth->dma_in = dma + 1;
|
||||
eth->dma_out = dma_out;
|
||||
eth->dma_in = dma_in;
|
||||
|
||||
/* Connect the phy. */
|
||||
eth->phyaddr = phyaddr & 0x1f;
|
||||
@ -608,6 +612,4 @@ void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr)
|
||||
|
||||
eth->nic = qemu_new_nic(&net_etraxfs_info, ð->conf,
|
||||
nd->model, nd->name, eth);
|
||||
|
||||
return dma;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user