summaryrefslogtreecommitdiffstats
path: root/arch/m68k/mach-mcfv4e
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-10-22 14:23:26 +0200
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-10-22 14:23:26 +0200
commitdaad436bf76ad8acdf66326b1cc3769434cca97f (patch)
treebbcce57e314aacd158b2cec51434a1a859399468 /arch/m68k/mach-mcfv4e
parent139b569c07b45b09d084df6655e39ca233a16635 (diff)
downloadbarebox-daad436bf76ad8acdf66326b1cc3769434cca97f.tar.gz
barebox-daad436bf76ad8acdf66326b1cc3769434cca97f.tar.xz
[M68K] Move include/asm-m68k/{arch,proc}-* to arch/m68k/*/include/{mach,proc}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/m68k/mach-mcfv4e')
-rw-r--r--arch/m68k/mach-mcfv4e/dma_utils.c6
-rw-r--r--arch/m68k/mach-mcfv4e/fec.c12
-rw-r--r--arch/m68k/mach-mcfv4e/fecbd.c12
-rw-r--r--arch/m68k/mach-mcfv4e/include/mach/clocks.h30
-rw-r--r--arch/m68k/mach-mcfv4e/include/mach/debug_ll.h33
-rw-r--r--arch/m68k/mach-mcfv4e/include/mach/hardware.h33
-rw-r--r--arch/m68k/mach-mcfv4e/include/mach/mcf54xx-regs.h30
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/dma_utils.h80
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/fec.h130
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/fecbd.h115
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_dma.h379
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_progCheck.h27
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_tasksInit.h66
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/eth.h70
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h88
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/net.h39
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/queue.h54
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/processor.h33
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/ptrace.h119
-rw-r--r--arch/m68k/mach-mcfv4e/mcdapi/MCD_dmaApi.c6
-rw-r--r--arch/m68k/mach-mcfv4e/mcdapi/MCD_tasks.c2
-rw-r--r--arch/m68k/mach-mcfv4e/mcdapi/MCD_tasksInit.c2
-rw-r--r--arch/m68k/mach-mcfv4e/mcf_clocksource.c6
-rw-r--r--arch/m68k/mach-mcfv4e/mcf_reset_cpu.c2
-rw-r--r--arch/m68k/mach-mcfv4e/multichannel_dma.c6
-rw-r--r--arch/m68k/mach-mcfv4e/net/nbuf.c6
-rw-r--r--arch/m68k/mach-mcfv4e/net/net.c16
-rw-r--r--arch/m68k/mach-mcfv4e/net/queue.c2
28 files changed, 1365 insertions, 39 deletions
diff --git a/arch/m68k/mach-mcfv4e/dma_utils.c b/arch/m68k/mach-mcfv4e/dma_utils.c
index 15b520abc2..adeefea3b1 100644
--- a/arch/m68k/mach-mcfv4e/dma_utils.c
+++ b/arch/m68k/mach-mcfv4e/dma_utils.c
@@ -10,10 +10,10 @@
#include <common.h>
#include <init.h>
#include <linux/types.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
+#include <mach/mcf54xx-regs.h>
+#include <proc/mcdapi/MCD_dma.h>
-#include <asm/proc/dma_utils.h>
+#include <proc/dma_utils.h>
/*
* This global keeps track of which initiators have been
diff --git a/arch/m68k/mach-mcfv4e/fec.c b/arch/m68k/mach-mcfv4e/fec.c
index 551f00f005..7619283f86 100644
--- a/arch/m68k/mach-mcfv4e/fec.c
+++ b/arch/m68k/mach-mcfv4e/fec.c
@@ -7,12 +7,12 @@
#include <common.h>
#include <linux/types.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
-#include <asm/proc/net/net.h>
-#include <asm/proc/fecbd.h>
-#include <asm/proc/fec.h>
-#include <asm/proc/dma_utils.h>
+#include <mach/mcf54xx-regs.h>
+#include <proc/mcdapi/MCD_dma.h>
+#include <proc/net/net.h>
+#include <proc/fecbd.h>
+#include <proc/fec.h>
+#include <proc/dma_utils.h>
#define TRUE 1
diff --git a/arch/m68k/mach-mcfv4e/fecbd.c b/arch/m68k/mach-mcfv4e/fecbd.c
index 26fb16d98d..a8e732b3ac 100644
--- a/arch/m68k/mach-mcfv4e/fecbd.c
+++ b/arch/m68k/mach-mcfv4e/fecbd.c
@@ -7,12 +7,12 @@
#include <common.h>
#include <linux/types.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
-#include <asm/proc/net/net.h>
-#include <asm/proc/fecbd.h>
-#include <asm/proc/fec.h>
-#include <asm/proc/dma_utils.h>
+#include <mach/mcf54xx-regs.h>
+#include <proc/mcdapi/MCD_dma.h>
+#include <proc/net/net.h>
+#include <proc/fecbd.h>
+#include <proc/fec.h>
+#include <proc/dma_utils.h>
#define ASSERT(x) if (!(x)) hang();
diff --git a/arch/m68k/mach-mcfv4e/include/mach/clocks.h b/arch/m68k/mach-mcfv4e/include/mach/clocks.h
new file mode 100644
index 0000000000..50124b1948
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/mach/clocks.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * This File contains functions to query clock settings for the actual
+ * board.
+ */
+#ifndef __ASM_ARCH_CLOCKS_H
+#define __ASM_ARCH_CLOCKS_H
+
+ulong mcfv4e_get_bus_clk(void);
+
+#endif /* __ASM_ARCH_CLOCKS_H */
diff --git a/arch/m68k/mach-mcfv4e/include/mach/debug_ll.h b/arch/m68k/mach-mcfv4e/include/mach/debug_ll.h
new file mode 100644
index 0000000000..064961d925
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/mach/debug_ll.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * This File contains declaration for early output support
+ */
+#ifndef __INCLUDE_ARCH_DEBUG_LL_H__
+#define __INCLUDE_ARCH_DEBUG_LL_H__
+
+extern __inline__ void putc( char ch )
+{
+ //extern int early_console_putc( char ch);
+ early_console_putc(NULL,ch);
+}
+
+#endif /* __INCLUDE_ARCH_DEBUG_LL_H__ */
diff --git a/arch/m68k/mach-mcfv4e/include/mach/hardware.h b/arch/m68k/mach-mcfv4e/include/mach/hardware.h
new file mode 100644
index 0000000000..46dc08897f
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/mach/hardware.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * This File contains declaration for early output support
+ */
+#ifndef __ASM_ARCH_HARDWARE_H__
+#define __ASM_ARCH_HARDWARE_H__
+
+#include <sizes.h>
+
+#ifdef CONFIG_ARCH_MCF54xx
+#include "mcf54xx-regs.h"
+#endif
+
+#endif /* __ASM_ARCH_HARDWARE_H__ */
diff --git a/arch/m68k/mach-mcfv4e/include/mach/mcf54xx-regs.h b/arch/m68k/mach-mcfv4e/include/mach/mcf54xx-regs.h
new file mode 100644
index 0000000000..e1b17d55e4
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/mach/mcf54xx-regs.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * This File contains declaration for early output support
+ */
+#ifndef __MCF54xx_REGS_H__
+#define __MCF54xx_REGS_H__
+
+/* System Registers for V4E cores (MCF547x and MCF548x) */
+#include <asm/coldfire/mcf5xxx.h>
+
+#endif /* __MCF54xx_REGS_H__ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/dma_utils.h b/arch/m68k/mach-mcfv4e/include/proc/dma_utils.h
new file mode 100644
index 0000000000..4ebdd558c1
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/dma_utils.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration of support function used with the MultiChannel DMA
+ */
+#ifndef _DMA_UTILS_H_
+#define _DMA_UTILS_H_
+
+
+void dma_irq_enable(uint8_t, uint8_t);
+void dma_irq_disable(void);
+int dma_set_initiator(int);
+uint32_t dma_get_initiator(int);
+void dma_free_initiator(int);
+int dma_set_channel(int, void (*)(void));
+int dma_get_channel(int);
+void dma_free_channel(int);
+int dma_interrupt_handler(void *, void *);
+
+/*
+ * Create identifiers for each initiator/requestor
+ */
+#define DMA_ALWAYS (0)
+#define DMA_DSPI_RX (1)
+#define DMA_DSPI_TX (2)
+#define DMA_DREQ0 (3)
+#define DMA_PSC0_RX (4)
+#define DMA_PSC0_TX (5)
+#define DMA_USBEP0 (6)
+#define DMA_USBEP1 (7)
+#define DMA_USBEP2 (8)
+#define DMA_USBEP3 (9)
+#define DMA_PCI_TX (10)
+#define DMA_PCI_RX (11)
+#define DMA_PSC1_RX (12)
+#define DMA_PSC1_TX (13)
+#define DMA_I2C_RX (14)
+#define DMA_I2C_TX (15)
+#define DMA_FEC0_RX (16)
+#define DMA_FEC0_TX (17)
+#define DMA_FEC1_RX (18)
+#define DMA_FEC1_TX (19)
+#define DMA_DREQ1 (20)
+#define DMA_CTM0 (21)
+#define DMA_CTM1 (22)
+#define DMA_CTM2 (23)
+#define DMA_CTM3 (24)
+#define DMA_CTM4 (25)
+#define DMA_CTM5 (26)
+#define DMA_CTM6 (27)
+#define DMA_CTM7 (28)
+#define DMA_USBEP4 (29)
+#define DMA_USBEP5 (30)
+#define DMA_USBEP6 (31)
+#define DMA_PSC2_RX (32)
+#define DMA_PSC2_TX (33)
+#define DMA_PSC3_RX (34)
+#define DMA_PSC3_TX (35)
+#define DMA_FEC_RX(x) ((x == 0) ? DMA_FEC0_RX : DMA_FEC1_RX)
+#define DMA_FEC_TX(x) ((x == 0) ? DMA_FEC0_TX : DMA_FEC1_TX)
+
+#endif /* _DMA_UTILS_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/fec.h b/arch/m68k/mach-mcfv4e/include/proc/fec.h
new file mode 100644
index 0000000000..4c94774381
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/fec.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration for the Fast Ethernet Controller (FEC)
+ */
+#ifndef _FEC_H_
+#define _FEC_H_
+
+// FIXME
+#define NIF void
+
+/********************************************************************/
+/* MII Speed Settings */
+#define FEC_MII_10BASE_T 0
+#define FEC_MII_100BASE_TX 1
+
+/* MII Duplex Settings */
+#define FEC_MII_HALF_DUPLEX 0
+#define FEC_MII_FULL_DUPLEX 1
+
+/* Timeout for MII communications */
+#define FEC_MII_TIMEOUT 0x10000
+
+/* External Interface Modes */
+#define FEC_MODE_7WIRE 0
+#define FEC_MODE_MII 1
+#define FEC_MODE_LOOPBACK 2 /* Internal Loopback */
+
+/*
+ * FEC Event Log
+ */
+typedef struct {
+ int total; /* total count of errors */
+ int hberr; /* heartbeat error */
+ int babr; /* babbling receiver */
+ int babt; /* babbling transmitter */
+ int gra; /* graceful stop complete */
+ int txf; /* transmit frame */
+ int mii; /* MII */
+ int lc; /* late collision */
+ int rl; /* collision retry limit */
+ int xfun; /* transmit FIFO underrrun */
+ int xferr; /* transmit FIFO error */
+ int rferr; /* receive FIFO error */
+ int dtxf; /* DMA transmit frame */
+ int drxf; /* DMA receive frame */
+ int rfsw_inv; /* Invalid bit in RFSW */
+ int rfsw_l; /* RFSW Last in Frame */
+ int rfsw_m; /* RFSW Miss */
+ int rfsw_bc; /* RFSW Broadcast */
+ int rfsw_mc; /* RFSW Multicast */
+ int rfsw_lg; /* RFSW Length Violation */
+ int rfsw_no; /* RFSW Non-octet */
+ int rfsw_cr; /* RFSW Bad CRC */
+ int rfsw_ov; /* RFSW Overflow */
+ int rfsw_tr; /* RFSW Truncated */
+} FEC_EVENT_LOG;
+
+
+int fec_mii_write(uint8_t , uint8_t , uint8_t , uint16_t );
+int fec_mii_read(uint8_t , uint8_t , uint8_t , uint16_t *x);
+void fec_mii_init(uint8_t, uint32_t);
+
+void fec_mib_init(uint8_t);
+void fec_mib_dump(uint8_t);
+
+void fec_log_init(uint8_t);
+void fec_log_dump(uint8_t);
+
+void fec_debug_dump(uint8_t);
+void fec_duplex (uint8_t, uint8_t);
+
+uint8_t fec_hash_address(const uint8_t *);
+void fec_set_address (uint8_t ch, const uint8_t *);
+
+void fec_reset (uint8_t);
+void fec_init (uint8_t, uint8_t, const uint8_t *);
+
+void fec_rx_start(uint8_t, int8_t *);
+void fec_rx_restart(uint8_t);
+void fec_rx_stop (uint8_t);
+
+NBUF * fec_rx_frame(uint8_t ch, NIF *nif);
+
+void fec0_rx_frame(void);
+void fec1_rx_frame(void);
+
+void fec_tx_start(uint8_t, int8_t *);
+void fec_tx_restart(uint8_t);
+void fec_tx_stop (uint8_t);
+
+void fec0_tx_frame(void);
+void fec1_tx_frame(void);
+
+int fec_send(uint8_t, NIF *, uint8_t *, uint8_t *, uint16_t , NBUF *);
+int fec0_send(NIF *, uint8_t *, uint8_t *, uint16_t , NBUF *);
+int fec1_send(NIF *, uint8_t *, uint8_t *, uint16_t , NBUF *);
+
+void fec_irq_enable(uint8_t, uint8_t, uint8_t);
+void fec_irq_disable(uint8_t);
+
+void fec_interrupt_handler(uint8_t);
+int fec0_interrupt_handler(void *, void *);
+int fec1_interrupt_handler(void *, void *);
+
+void fec_eth_setup(uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t *);
+
+void fec_eth_reset(uint8_t);
+
+void fec_eth_stop(uint8_t);
+
+#endif /* _FEC_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/fecbd.h b/arch/m68k/mach-mcfv4e/include/proc/fecbd.h
new file mode 100644
index 0000000000..92195490c8
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/fecbd.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Provide a simple buffer management driver
+ */
+
+#ifndef _FECBD_H_
+#define _FECBD_H_
+
+/********************************************************************/
+
+#define Rx 1
+#define Tx 0
+
+/*
+ * Buffer sizes in bytes
+ */
+#ifndef RX_BUF_SZ
+#define RX_BUF_SZ NBUF_SZ
+#endif
+#ifndef TX_BUF_SZ
+#define TX_BUF_SZ NBUF_SZ
+#endif
+
+/*
+ * Number of Rx and Tx Buffers and Buffer Descriptors
+ */
+#ifndef NRXBD
+#define NRXBD 10
+#endif
+#ifndef NTXBD
+#define NTXBD 4
+#endif
+
+/*
+ * Buffer Descriptor Format
+ */
+typedef struct
+{
+ uint16_t status; /* control and status */
+ uint16_t length; /* transfer length */
+ uint8_t *data; /* buffer address */
+} FECBD;
+
+/*
+ * Bit level definitions for status field of buffer descriptors
+ */
+#define TX_BD_R 0x8000
+#define TX_BD_TO1 0x4000
+#define TX_BD_W 0x2000
+#define TX_BD_TO2 0x1000
+#define TX_BD_INTERRUPT 0x1000 /* MCF547x/8x Only */
+#define TX_BD_L 0x0800
+#define TX_BD_TC 0x0400
+#define TX_BD_DEF 0x0200 /* MCF5272 Only */
+#define TX_BD_ABC 0x0200
+#define TX_BD_HB 0x0100 /* MCF5272 Only */
+#define TX_BD_LC 0x0080 /* MCF5272 Only */
+#define TX_BD_RL 0x0040 /* MCF5272 Only */
+#define TX_BD_UN 0x0002 /* MCF5272 Only */
+#define TX_BD_CSL 0x0001 /* MCF5272 Only */
+
+#define RX_BD_E 0x8000
+#define RX_BD_R01 0x4000
+#define RX_BD_W 0x2000
+#define RX_BD_R02 0x1000
+#define RX_BD_INTERRUPT 0x1000 /* MCF547x/8x Only */
+#define RX_BD_L 0x0800
+#define RX_BD_M 0x0100
+#define RX_BD_BC 0x0080
+#define RX_BD_MC 0x0040
+#define RX_BD_LG 0x0020
+#define RX_BD_NO 0x0010
+#define RX_BD_CR 0x0004
+#define RX_BD_OV 0x0002
+#define RX_BD_TR 0x0001
+#define RX_BD_ERROR (RX_BD_NO | RX_BD_CR | RX_BD_OV | RX_BD_TR)
+
+/*
+ * Functions provided in fec_bd.c
+ */
+void
+fecbd_init(uint8_t);
+
+uint32_t
+fecbd_get_start(uint8_t, uint8_t);
+
+FECBD *
+fecbd_rx_alloc(uint8_t);
+
+FECBD *
+fecbd_tx_alloc(uint8_t);
+
+FECBD *
+fecbd_tx_free(uint8_t);
+
+#endif /* _FECBD_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_dma.h b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_dma.h
new file mode 100644
index 0000000000..09adf8272a
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_dma.h
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Main header file for multi-channel DMA API.
+ */
+#ifndef _MCD_API_H
+#define _MCD_API_H
+
+/*
+ * Turn Execution Unit tasks ON (#define) or OFF (#undef)
+ */
+#undef MCD_INCLUDE_EU
+
+/*
+ * Number of DMA channels
+ */
+#define NCHANNELS 16
+
+/*
+ * Total number of variants
+ */
+#ifdef MCD_INCLUDE_EU
+#define NUMOFVARIANTS 6
+#else
+#define NUMOFVARIANTS 4
+#endif
+
+/*
+ * Define sizes of the various tables
+ */
+#define TASK_TABLE_SIZE (NCHANNELS*32)
+#define VAR_TAB_SIZE (128)
+#define CONTEXT_SAVE_SIZE (128)
+#define FUNCDESC_TAB_SIZE (256)
+
+#ifdef MCD_INCLUDE_EU
+#define FUNCDESC_TAB_NUM 16
+#else
+#define FUNCDESC_TAB_NUM 1
+#endif
+
+
+#ifndef DEFINESONLY
+
+/*
+ * Portability typedefs
+ */
+//typedef signed int s32;
+//typedef unsigned int u32;
+//typedef signed short s16;
+//typedef unsigned short u16;
+//typedef signed char s8;
+//typedef unsigned char u8;
+//
+/*
+ * These structures represent the internal registers of the
+ * multi-channel DMA
+ */
+struct dmaRegs_s {
+ u32 taskbar; /* task table base address register */
+ u32 currPtr;
+ u32 endPtr;
+ u32 varTablePtr;
+ u16 dma_rsvd0;
+ u16 ptdControl; /* ptd control */
+ u32 intPending; /* interrupt pending register */
+ u32 intMask; /* interrupt mask register */
+ u16 taskControl[16]; /* task control registers */
+ u8 priority[32]; /* priority registers */
+ u32 initiatorMux; /* initiator mux control */
+ u32 taskSize0; /* task size control register 0. */
+ u32 taskSize1; /* task size control register 1. */
+ u32 dma_rsvd1; /* reserved */
+ u32 dma_rsvd2; /* reserved */
+ u32 debugComp1; /* debug comparator 1 */
+ u32 debugComp2; /* debug comparator 2 */
+ u32 debugControl; /* debug control */
+ u32 debugStatus; /* debug status */
+ u32 ptdDebug; /* priority task decode debug */
+ u32 dma_rsvd3[31]; /* reserved */
+};
+typedef volatile struct dmaRegs_s dmaRegs;
+
+#endif
+
+/*
+ * PTD contrl reg bits
+ */
+#define PTD_CTL_TSK_PRI 0x8000
+#define PTD_CTL_COMM_PREFETCH 0x0001
+
+/*
+ * Task Control reg bits and field masks
+ */
+#define TASK_CTL_EN 0x8000
+#define TASK_CTL_VALID 0x4000
+#define TASK_CTL_ALWAYS 0x2000
+#define TASK_CTL_INIT_MASK 0x1f00
+#define TASK_CTL_ASTRT 0x0080
+#define TASK_CTL_HIPRITSKEN 0x0040
+#define TASK_CTL_HLDINITNUM 0x0020
+#define TASK_CTL_ASTSKNUM_MASK 0x000f
+
+/*
+ * Priority reg bits and field masks
+ */
+#define PRIORITY_HLD 0x80
+#define PRIORITY_PRI_MASK 0x07
+
+/*
+ * Debug Control reg bits and field masks
+ */
+#define DBG_CTL_BLOCK_TASKS_MASK 0xffff0000
+#define DBG_CTL_AUTO_ARM 0x00008000
+#define DBG_CTL_BREAK 0x00004000
+#define DBG_CTL_COMP1_TYP_MASK 0x00003800
+#define DBG_CTL_COMP2_TYP_MASK 0x00000070
+#define DBG_CTL_EXT_BREAK 0x00000004
+#define DBG_CTL_INT_BREAK 0x00000002
+
+/*
+ * PTD Debug reg selector addresses
+ * This reg must be written with a value to show the contents of
+ * one of the desired internal register.
+ */
+#define PTD_DBG_REQ 0x00 /* shows the state of 31 initiators */
+#define PTD_DBG_TSK_VLD_INIT 0x01 /* shows which 16 tasks are valid and
+ have initiators asserted */
+
+
+/*
+ * General return values
+ */
+#define MCD_OK 0
+#define MCD_ERROR -1
+#define MCD_TABLE_UNALIGNED -2
+#define MCD_CHANNEL_INVALID -3
+
+/*
+ * MCD_initDma input flags
+ */
+#define MCD_RELOC_TASKS 0x00000001
+#define MCD_NO_RELOC_TASKS 0x00000000
+#define MCD_COMM_PREFETCH_EN 0x00000002 /* Commbus Prefetching - MCF547x/548x ONLY */
+
+/*
+ * MCD_dmaStatus Status Values for each channel
+ */
+#define MCD_NO_DMA 1 /* No DMA has been requested since reset */
+#define MCD_IDLE 2 /* DMA active, but the initiator is currently inactive */
+#define MCD_RUNNING 3 /* DMA active, and the initiator is currently active */
+#define MCD_PAUSED 4 /* DMA active but it is currently paused */
+#define MCD_HALTED 5 /* the most recent DMA has been killed with MCD_killTask() */
+#define MCD_DONE 6 /* the most recent DMA has completed. */
+
+
+/*
+ * MCD_startDma parameter defines
+ */
+
+/*
+ * Constants for the funcDesc parameter
+ */
+/* Byte swapping: */
+#define MCD_NO_BYTE_SWAP 0x00045670 /* to disable byte swapping. */
+#define MCD_BYTE_REVERSE 0x00076540 /* to reverse the bytes of each u32 of the DMAed data. */
+#define MCD_U16_REVERSE 0x00067450 /* to reverse the 16-bit halves of
+ each 32-bit data value being DMAed.*/
+#define MCD_U16_BYTE_REVERSE 0x00054760 /* to reverse the byte halves of each
+ 16-bit half of each 32-bit data value DMAed */
+#define MCD_NO_BIT_REV 0x00000000 /* do not reverse the bits of each byte DMAed. */
+#define MCD_BIT_REV 0x00088880 /* reverse the bits of each byte DMAed */
+/* CRCing: */
+#define MCD_CRC16 0xc0100000 /* to perform CRC-16 on DMAed data. */
+#define MCD_CRCCCITT 0xc0200000 /* to perform CRC-CCITT on DMAed data. */
+#define MCD_CRC32 0xc0300000 /* to perform CRC-32 on DMAed data. */
+#define MCD_CSUMINET 0xc0400000 /* to perform internet checksums on DMAed data.*/
+#define MCD_NO_CSUM 0xa0000000 /* to perform no checksumming. */
+
+#define MCD_FUNC_NOEU1 (MCD_NO_BYTE_SWAP | MCD_NO_BIT_REV | MCD_NO_CSUM)
+#define MCD_FUNC_NOEU2 (MCD_NO_BYTE_SWAP | MCD_NO_CSUM)
+
+/*
+ * Constants for the flags parameter
+ */
+#define MCD_TT_FLAGS_RL 0x00000001 /* Read line */
+#define MCD_TT_FLAGS_CW 0x00000002 /* Combine Writes */
+#define MCD_TT_FLAGS_SP 0x00000004 /* Speculative prefetch(XLB) MCF547x/548x ONLY */
+#define MCD_TT_FLAGS_MASK 0x000000ff
+#define MCD_TT_FLAGS_DEF (MCD_TT_FLAGS_RL | MCD_TT_FLAGS_CW)
+
+#define MCD_SINGLE_DMA 0x00000100 /* Unchained DMA */
+#define MCD_CHAIN_DMA /* TBD */
+#define MCD_EU_DMA /* TBD */
+#define MCD_FECTX_DMA 0x00001000 /* FEC TX ring DMA */
+#define MCD_FECRX_DMA 0x00002000 /* FEC RX ring DMA */
+
+
+/* these flags are valid for MCD_startDma and the chained buffer descriptors */
+#define MCD_BUF_READY 0x80000000 /* indicates that this buffer is now under the DMA's control */
+#define MCD_WRAP 0x20000000 /* to tell the FEC Dmas to wrap to the first BD */
+#define MCD_INTERRUPT 0x10000000 /* to generate an interrupt after completion of the DMA. */
+#define MCD_END_FRAME 0x08000000 /* tell the DMA to end the frame when transferring
+ last byte of data in buffer */
+#define MCD_CRC_RESTART 0x40000000 /* to empty out the accumulated checksum
+ prior to performing the DMA. */
+
+/* Defines for the FEC buffer descriptor control/status word*/
+#define MCD_FEC_BUF_READY 0x8000
+#define MCD_FEC_WRAP 0x2000
+#define MCD_FEC_INTERRUPT 0x1000
+#define MCD_FEC_END_FRAME 0x0800
+
+
+/*
+ * Defines for general intuitiveness
+ */
+
+#define MCD_TRUE 1
+#define MCD_FALSE 0
+
+/*
+ * Three different cases for destination and source.
+ */
+#define MINUS1 -1
+#define ZERO 0
+#define PLUS1 1
+
+#ifndef DEFINESONLY
+
+/* Task Table Entry struct*/
+typedef struct {
+ u32 TDTstart; /* task descriptor table start */
+ u32 TDTend; /* task descriptor table end */
+ u32 varTab; /* variable table start */
+ u32 FDTandFlags; /* function descriptor table start and flags */
+ volatile u32 descAddrAndStatus;
+ volatile u32 modifiedVarTab;
+ u32 contextSaveSpace; /* context save space start */
+ u32 literalBases;
+} TaskTableEntry;
+
+
+/* Chained buffer descriptor */
+typedef volatile struct MCD_bufDesc_struct MCD_bufDesc;
+struct MCD_bufDesc_struct {
+ u32 flags; /* flags describing the DMA */
+ u32 csumResult; /* checksum from checksumming performed since last checksum reset */
+ s8 *srcAddr; /* the address to move data from */
+ s8 *destAddr; /* the address to move data to */
+ s8 *lastDestAddr; /* the last address written to */
+ u32 dmaSize; /* the number of bytes to transfer independent of the transfer size */
+ MCD_bufDesc *next; /* next buffer descriptor in chain */
+ u32 info; /* private information about this descriptor; DMA does not affect it */
+};
+
+/* Progress Query struct */
+typedef volatile struct MCD_XferProg_struct {
+ s8 *lastSrcAddr; /* the most-recent or last, post-increment source address */
+ s8 *lastDestAddr; /* the most-recent or last, post-increment destination address */
+ u32 dmaSize; /* the amount of data transferred for the current buffer */
+ MCD_bufDesc *currBufDesc;/* pointer to the current buffer descriptor being DMAed */
+} MCD_XferProg;
+
+
+/* FEC buffer descriptor */
+typedef volatile struct MCD_bufDescFec_struct {
+ u16 statCtrl;
+ u16 length;
+ u32 dataPointer;
+} MCD_bufDescFec;
+
+
+/*************************************************************************/
+/*
+ * API function Prototypes - see MCD_dmaApi.c for further notes
+ */
+
+/*
+ * MCD_startDma starts a particular kind of DMA .
+ */
+int MCD_startDma (
+ int channel, /* the channel on which to run the DMA */
+ s8 *srcAddr, /* the address to move data from, or buffer-descriptor address */
+ s16 srcIncr, /* the amount to increment the source address per transfer */
+ s8 *destAddr, /* the address to move data to */
+ s16 destIncr, /* the amount to increment the destination address per transfer */
+ u32 dmaSize, /* the number of bytes to transfer independent of the transfer size */
+ u32 xferSize, /* the number bytes in of each data movement (1, 2, or 4) */
+ u32 initiator, /* what device initiates the DMA */
+ int priority, /* priority of the DMA */
+ u32 flags, /* flags describing the DMA */
+ u32 funcDesc /* a description of byte swapping, bit swapping, and CRC actions */
+);
+
+/*
+ * MCD_initDma() initializes the DMA API by setting up a pointer to the DMA
+ * registers, relocating and creating the appropriate task structures, and
+ * setting up some global settings
+ */
+int MCD_initDma (dmaRegs *sDmaBarAddr, void *taskTableDest, u32 flags);
+
+/*
+ * MCD_dmaStatus() returns the status of the DMA on the requested channel.
+ */
+int MCD_dmaStatus (int channel);
+
+/*
+ * MCD_XferProgrQuery() returns progress of DMA on requested channel
+ */
+int MCD_XferProgrQuery (int channel, MCD_XferProg *progRep);
+
+/*
+ * MCD_killDma() halts the DMA on the requested channel, without any
+ * intention of resuming the DMA.
+ */
+int MCD_killDma (int channel);
+
+/*
+ * MCD_continDma() continues a DMA which as stopped due to encountering an
+ * unready buffer descriptor.
+ */
+int MCD_continDma (int channel);
+
+/*
+ * MCD_pauseDma() pauses the DMA on the given channel ( if any DMA is
+ * running on that channel).
+ */
+int MCD_pauseDma (int channel);
+
+/*
+ * MCD_resumeDma() resumes the DMA on a given channel (if any DMA is
+ * running on that channel).
+ */
+int MCD_resumeDma (int channel);
+
+/*
+ * MCD_csumQuery provides the checksum/CRC after performing a non-chained DMA
+ */
+int MCD_csumQuery (int channel, u32 *csum);
+
+/*
+ * MCD_getCodeSize provides the packed size required by the microcoded task
+ * and structures.
+ */
+int MCD_getCodeSize(void);
+
+/*
+ * MCD_getVersion provides a pointer to a version string and returns a
+ * version number.
+ */
+int MCD_getVersion(char **longVersion);
+
+/* macro for setting a location in the variable table */
+#define MCD_SET_VAR(taskTab,idx,value) ((u32 *)(taskTab)->varTab)[idx] = value
+ /* Note that MCD_SET_VAR() is invoked many times in firing up a DMA function,
+ so I'm avoiding surrounding it with "do {} while(0)" */
+
+#endif /* DEFINESONLY */
+
+#endif /* _MCD_API_H */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_progCheck.h b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_progCheck.h
new file mode 100644
index 0000000000..f90600c7cd
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_progCheck.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * This file is autogenerated. Do not change .
+ */
+#define CURRBD 4
+#define DCOUNT 6
+#define DESTPTR 5
+#define SRCPTR 7
diff --git a/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_tasksInit.h b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_tasksInit.h
new file mode 100644
index 0000000000..bc6ec91f98
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/mcdapi/MCD_tasksInit.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration for the MCD tasks. Do not edit.
+ */
+#ifndef MCD_TSK_INIT_H
+#define MCD_TSK_INIT_H 1
+
+/*
+ * Do not edit!
+ */
+
+/*
+ * Task 0
+ */
+void MCD_startDmaChainNoEu(int *currBD, short srcIncr, short destIncr, int xferSize, short xferSizeIncr, int *cSave, volatile TaskTableEntry *taskTable, int channel);
+
+
+/*
+ * Task 1
+ */
+void MCD_startDmaSingleNoEu(char *srcAddr, short srcIncr, char *destAddr, short destIncr, int dmaSize, short xferSizeIncr, int flags, int *currBD, int *cSave, volatile TaskTableEntry *taskTable, int channel);
+
+
+/*
+ * Task 2
+ */
+void MCD_startDmaChainEu(int *currBD, short srcIncr, short destIncr, int xferSize, short xferSizeIncr, int *cSave, volatile TaskTableEntry *taskTable, int channel);
+
+
+/*
+ * Task 3
+ */
+void MCD_startDmaSingleEu(char *srcAddr, short srcIncr, char *destAddr, short destIncr, int dmaSize, short xferSizeIncr, int flags, int *currBD, int *cSave, volatile TaskTableEntry *taskTable, int channel);
+
+
+/*
+ * Task 4
+ */
+void MCD_startDmaENetRcv(char *bDBase, char *currBD, char *rcvFifoPtr, volatile TaskTableEntry *taskTable, int channel);
+
+
+/*
+ * Task 5
+ */
+void MCD_startDmaENetXmit(char *bDBase, char *currBD, char *xmitFifoPtr, volatile TaskTableEntry *taskTable, int channel);
+
+#endif /* MCD_TSK_INIT_H */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/eth.h b/arch/m68k/mach-mcfv4e/include/proc/net/eth.h
new file mode 100644
index 0000000000..5240c0c945
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/eth.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration for for Ethernet Frames.
+ */
+
+#ifndef _ETH_H
+#define _ETH_H
+
+
+/* Ethernet standard lengths in bytes*/
+#define ETH_ADDR_LEN (6)
+#define ETH_TYPE_LEN (2)
+#define ETH_CRC_LEN (4)
+#define ETH_MAX_DATA (1500)
+#define ETH_MIN_DATA (46)
+#define ETH_HDR_LEN (ETH_ADDR_LEN * 2 + ETH_TYPE_LEN)
+
+/* Defined Ethernet Frame Types */
+#define ETH_FRM_IP (0x0800)
+#define ETH_FRM_ARP (0x0806)
+#define ETH_FRM_RARP (0x8035)
+#define ETH_FRM_TEST (0xA5A5)
+
+/* Maximum and Minimum Ethernet Frame Sizes */
+#define ETH_MAX_FRM (ETH_HDR_LEN + ETH_MAX_DATA + ETH_CRC_LEN)
+#define ETH_MIN_FRM (ETH_HDR_LEN + ETH_MIN_DATA + ETH_CRC_LEN)
+#define ETH_MTU (ETH_HDR_LEN + ETH_MAX_DATA)
+
+/* Ethernet Addresses */
+typedef uint8_t ETH_ADDR[ETH_ADDR_LEN];
+
+/* 16-bit Ethernet Frame Type, ie. Protocol */
+typedef uint16_t ETH_FRM_TYPE;
+
+/* Ethernet Frame Header definition */
+typedef struct
+{
+ ETH_ADDR dest;
+ ETH_ADDR src;
+ ETH_FRM_TYPE type;
+} ETH_HDR;
+
+/* Ethernet Frame definition */
+typedef struct
+{
+ ETH_HDR head;
+ uint8_t* data;
+} ETH_FRAME;
+
+
+#endif /* _ETH_H */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h b/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h
new file mode 100644
index 0000000000..bc3a7a6924
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Definitions for network buffer management
+ */
+
+#ifndef _MCFV4E_NBUF_H_
+#define _MCFV4E_NBUF_H_
+
+/*
+ * Include the Queue structure definitions
+ */
+#include "queue.h"
+
+/*
+ * Number of network buffers to use
+ */
+#define NBUF_MAX 30
+
+/*
+ * Size of each buffer in bytes
+ */
+#ifndef NBUF_SZ
+#define NBUF_SZ 1520
+#endif
+
+/*
+ * Defines to identify all the buffer queues
+ * - FREE must always be defined as 0
+ */
+#define NBUF_FREE 0 /* available buffers */
+#define NBUF_TX_RING 1 /* buffers in the Tx BD ring */
+#define NBUF_RX_RING 2 /* buffers in the Rx BD ring */
+#define NBUF_SCRATCH 3 /* misc */
+#define NBUF_MAXQ 4 /* total number of queueus */
+
+/*
+ * Buffer Descriptor Format
+ *
+ * Fields:
+ * next Pointer to next node in the queue
+ * data Pointer to the data buffer
+ * offset Index into buffer
+ * length Remaining bytes in buffer from (data + offset)
+ */
+typedef struct
+{
+ QNODE node;
+ uint8_t *data;
+ uint16_t offset;
+ uint16_t length;
+} NBUF;
+
+/*
+ * Functions to manipulate the network buffers.
+ */
+int nbuf_init(void);
+void nbuf_flush(void);
+
+NBUF * nbuf_alloc (void);
+void nbuf_free(NBUF *);
+
+NBUF *nbuf_remove(int);
+void nbuf_add(int, NBUF *);
+
+void nbuf_reset(void);
+void nbuf_debug_dump(void);
+
+
+#endif /* _MCFV4E_NBUF_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/net.h b/arch/m68k/mach-mcfv4e/include/proc/net/net.h
new file mode 100644
index 0000000000..a2ccd76510
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/net.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Network definitions and prototypes for dBUG.
+ */
+
+#ifndef _MCFV4E_NET_H
+#define _MCFV4E_NET_H
+
+/*
+ * Include information and prototypes for all protocols
+ */
+#include "eth.h"
+#include "nbuf.h"
+
+int netif_init(int channel);
+int netif_setup(int channel);
+int netif_done(int channel);
+
+#endif /* _MCFV4E_NET_H */
+
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/queue.h b/arch/m68k/mach-mcfv4e/include/proc/net/queue.h
new file mode 100644
index 0000000000..c9da1c83a5
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/queue.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Implement a first in, first out linked list
+ */
+#ifndef _QUEUE_H_
+#define _QUEUE_H_
+
+/*
+ * Individual queue node
+ */
+typedef struct NODE
+{
+ struct NODE *next;
+} QNODE;
+
+/*
+ * Queue Struture - linked list of qentry items
+ */
+typedef struct
+{
+ QNODE *head;
+ QNODE *tail;
+} QUEUE;
+
+/*
+ * Functions provided by queue.c
+ */
+void queue_init(QUEUE *);
+int queue_isempty(QUEUE *);
+void queue_add(QUEUE *, QNODE *);
+QNODE* queue_remove(QUEUE *);
+QNODE* queue_peek(QUEUE *);
+void queue_move(QUEUE *, QUEUE *);
+
+#endif /* _QUEUE_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/processor.h b/arch/m68k/mach-mcfv4e/include/proc/processor.h
new file mode 100644
index 0000000000..f49b65d97b
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/processor.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Coldfire V4e processor specific defines
+ */
+
+/* Empty dummy FIXME */
+
+/* interrupt management */
+
+void mcf_interrupts_initialize (void);
+int mcf_interrupts_register_handler (int vector, int (*handler)(void *, void *), void *hdev, void *harg);
+void mcf_interrupts_remove_handler (int (*handler)(void *, void *));
+int mcf_execute_irq_handler (struct pt_regs *pt_regs,int);
+
diff --git a/arch/m68k/mach-mcfv4e/include/proc/ptrace.h b/arch/m68k/mach-mcfv4e/include/proc/ptrace.h
new file mode 100644
index 0000000000..dd124291d6
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/ptrace.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration and defines for M68k register frames
+ */
+#ifndef __ASM_PROC_PTRACE_H
+#define __ASM_PROC_PTRACE_H
+
+#define TRACE_FLAG 0x8000
+#define SVR_MODE 0x2000
+#define MODE_MASK 0x2000
+#define MASTER_FLAG 0x1000
+#define IRQ_MASK 0x0700
+#define CC_MASK 0x00FF
+
+#define CC_X_BIT 0x0010
+#define CC_N_BIT 0x0008
+#define CC_Z_BIT 0x0004
+#define CC_V_BIT 0x0002
+#define CC_C_BIT 0x0001
+
+#define PCMASK 0x0
+
+#ifndef __ASSEMBLY__
+
+/* this struct defines the way the registers are stored on the
+ stack during a system call. */
+
+struct pt_regs {
+ long uregs[37];
+};
+#define M68K_sp uregs[37]
+#define M68K_sr uregs[36]
+#define M68K_pc uregs[35]
+#define M68K_fpiar uregs[34]
+#define M68K_fpsr uregs[33]
+#define M68K_fpcr uregs[32]
+
+#define M68K_fp7 uregs[30]
+#define M68K_fp6 uregs[28]
+#define M68K_fp5 uregs[26]
+#define M68K_fp4 uregs[24]
+#define M68K_fp3 uregs[22]
+#define M68K_fp2 uregs[20]
+#define M68K_fp1 uregs[18]
+#define M68K_fp0 uregs[16]
+
+#define M68K_a7 uregs[15]
+#define M68K_a6 uregs[14]
+#define M68K_a5 uregs[13]
+#define M68K_a4 uregs[12]
+#define M68K_a3 uregs[11]
+#define M68K_a2 uregs[10]
+#define M68K_a1 uregs[ 9]
+#define M68K_a0 uregs[ 8]
+#define M68K_d7 uregs[ 7]
+#define M68K_d6 uregs[ 6]
+#define M68K_d5 uregs[ 5]
+#define M68K_d4 uregs[ 4]
+#define M68K_d3 uregs[ 3]
+#define M68K_d2 uregs[ 2]
+#define M68K_d1 uregs[ 1]
+#define M68K_d0 uregs[ 0]
+
+
+#ifdef __KERNEL__
+
+#define user_mode(regs) \
+ (((regs)->M68K_sr & SVR_MODE) == 0)
+
+#define processor_mode(regs) \
+ ((regs)->M68K_sr & SVR_MODE)
+
+#define interrupts_enabled(regs) \
+ (!((regs)->M68K_sr & IRQ_MASK))
+
+#define condition_codes(regs) \
+ ((regs)->M68K_sr & CC_MASK)
+
+/* Are the current registers suitable for user mode?
+ * (used to maintain security in signal handlers)
+ */
+static inline int valid_user_regs(struct pt_regs *regs)
+{
+ if ((regs->M68K_sr & SVR_MODE) == 0 &&
+ (regs->M68K_sr & IRQ_MASK) == 7)
+ return 1;
+
+ /*
+ * Force SR to something logical...
+ */
+ regs->M68K_sr &= ~(CC_MASK);
+
+ return 0;
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASSEMBLY__ */
+
+#endif
diff --git a/arch/m68k/mach-mcfv4e/mcdapi/MCD_dmaApi.c b/arch/m68k/mach-mcfv4e/mcdapi/MCD_dmaApi.c
index b4d7f28470..60e2b6dd76 100644
--- a/arch/m68k/mach-mcfv4e/mcdapi/MCD_dmaApi.c
+++ b/arch/m68k/mach-mcfv4e/mcdapi/MCD_dmaApi.c
@@ -6,9 +6,9 @@
*/
#include <asm/types.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
-#include <asm/proc/mcdapi/MCD_tasksInit.h>
-#include <asm/proc/mcdapi/MCD_progCheck.h>
+#include <proc/mcdapi/MCD_dma.h>
+#include <proc/mcdapi/MCD_tasksInit.h>
+#include <proc/mcdapi/MCD_progCheck.h>
/*
* This is an API-internal pointer to the DMA's registers
diff --git a/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasks.c b/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasks.c
index 3bfed232d7..812120dd7a 100644
--- a/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasks.c
+++ b/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasks.c
@@ -5,7 +5,7 @@
* Notes:
*/
#include <asm/types.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
+#include <proc/mcdapi/MCD_dma.h>
u32 MCD_varTab0[];
u32 MCD_varTab1[];
diff --git a/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasksInit.c b/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasksInit.c
index 14104f7185..8d82b471f9 100644
--- a/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasksInit.c
+++ b/arch/m68k/mach-mcfv4e/mcdapi/MCD_tasksInit.c
@@ -11,7 +11,7 @@
*/
#include <asm/types.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
+#include <proc/mcdapi/MCD_dma.h>
extern dmaRegs *MCD_dmaBar;
diff --git a/arch/m68k/mach-mcfv4e/mcf_clocksource.c b/arch/m68k/mach-mcfv4e/mcf_clocksource.c
index 1278bf83ec..926a592158 100644
--- a/arch/m68k/mach-mcfv4e/mcf_clocksource.c
+++ b/arch/m68k/mach-mcfv4e/mcf_clocksource.c
@@ -24,9 +24,9 @@
#include <common.h>
#include <init.h>
#include <clock.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/arch/clocks.h>
-#include <asm/proc/processor.h> //FIXME - move to other file
+#include <mach/mcf54xx-regs.h>
+#include <mach/clocks.h>
+#include <proc/processor.h> //FIXME - move to other file
#ifdef CONFIG_USE_IRQ
diff --git a/arch/m68k/mach-mcfv4e/mcf_reset_cpu.c b/arch/m68k/mach-mcfv4e/mcf_reset_cpu.c
index 5a3368f901..dc04a270d1 100644
--- a/arch/m68k/mach-mcfv4e/mcf_reset_cpu.c
+++ b/arch/m68k/mach-mcfv4e/mcf_reset_cpu.c
@@ -22,7 +22,7 @@
* Implements a watchdog triggered reset for V4e Coldfire cores
*/
#include <common.h>
-#include <asm/arch/mcf54xx-regs.h>
+#include <mach/mcf54xx-regs.h>
/**
* Reset the cpu by setting up the watchdog timer and let it time out
diff --git a/arch/m68k/mach-mcfv4e/multichannel_dma.c b/arch/m68k/mach-mcfv4e/multichannel_dma.c
index 11aceeb9b9..494fc68bde 100644
--- a/arch/m68k/mach-mcfv4e/multichannel_dma.c
+++ b/arch/m68k/mach-mcfv4e/multichannel_dma.c
@@ -25,9 +25,9 @@
*/
#include <common.h>
#include <init.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
-#include <asm/proc/dma_utils.h>
+#include <mach/mcf54xx-regs.h>
+#include <proc/mcdapi/MCD_dma.h>
+#include <proc/dma_utils.h>
static int mcdapi_init(void)
diff --git a/arch/m68k/mach-mcfv4e/net/nbuf.c b/arch/m68k/mach-mcfv4e/net/nbuf.c
index d7ae921bed..5dc6027e0e 100644
--- a/arch/m68k/mach-mcfv4e/net/nbuf.c
+++ b/arch/m68k/mach-mcfv4e/net/nbuf.c
@@ -26,10 +26,10 @@
#include <malloc.h>
#include <linux/types.h>
-#include <asm/proc/net/queue.h>
-#include <asm/proc/net/net.h>
+#include <proc/net/queue.h>
+#include <proc/net/net.h>
-#include <asm/arch/mcf54xx-regs.h>
+#include <mach/mcf54xx-regs.h>
#define ASSERT(x)
diff --git a/arch/m68k/mach-mcfv4e/net/net.c b/arch/m68k/mach-mcfv4e/net/net.c
index 76e28531b6..1bc089bdd3 100644
--- a/arch/m68k/mach-mcfv4e/net/net.c
+++ b/arch/m68k/mach-mcfv4e/net/net.c
@@ -26,14 +26,14 @@
#include <malloc.h>
#include <linux/types.h>
-#include <asm/arch/mcf54xx-regs.h>
-#include <asm/proc/mcdapi/MCD_dma.h>
-#include <asm/proc/net/net.h>
-#include <asm/proc/fecbd.h>
-#include <asm/proc/fec.h>
-#include <asm/proc/dma_utils.h>
-
-#include <asm/proc/processor.h> //FIXME - move to other file
+#include <mach/mcf54xx-regs.h>
+#include <proc/mcdapi/MCD_dma.h>
+#include <proc/net/net.h>
+#include <proc/fecbd.h>
+#include <proc/fec.h>
+#include <proc/dma_utils.h>
+
+#include <proc/processor.h> //FIXME - move to other file
int netif_init(int channel)
{
diff --git a/arch/m68k/mach-mcfv4e/net/queue.c b/arch/m68k/mach-mcfv4e/net/queue.c
index 55f938af3e..e573fcfd58 100644
--- a/arch/m68k/mach-mcfv4e/net/queue.c
+++ b/arch/m68k/mach-mcfv4e/net/queue.c
@@ -25,7 +25,7 @@
* @todo Replace by u-boot standard list functions
*/
#include <linux/types.h>
-#include <asm/proc/net/queue.h>
+#include <proc/net/queue.h>
/** Initialize the specified queue to an empty state
*