From 4e5ca3eb670460cd5ad9b07fa4aafc0dee6178be Mon Sep 17 00:00:00 2001 From: wdenk Date: Mon, 8 Dec 2003 01:34:36 +0000 Subject: * Patch by Bernhard Kuhn, 28 Nov 2003: add support for Coldfire CPU add support for Motorola M5272C3 and M5282EVB boards --- include/asm-m68k/global_data.h | 62 +++++++++++++++++++++++ include/asm-m68k/io.h | 1 + include/asm-m68k/posix_types.h | 109 +++++++++++++++++++++++++++++++++++++++++ include/asm-m68k/ptrace.h | 108 ++++++++++++++++++++++++++++++++++++++++ include/asm-m68k/string.h | 31 ++++++++++++ include/asm-m68k/types.h | 50 +++++++++++++++++++ include/asm-m68k/u-boot.h | 69 ++++++++++++++++++++++++++ include/configs/M5272C3.h | 40 +++++++++++++++ include/configs/M5282EVB.h | 40 +++++++++++++++ include/flash.h | 2 + 10 files changed, 512 insertions(+) create mode 100644 include/asm-m68k/global_data.h create mode 100644 include/asm-m68k/io.h create mode 100644 include/asm-m68k/posix_types.h create mode 100644 include/asm-m68k/ptrace.h create mode 100644 include/asm-m68k/string.h create mode 100644 include/asm-m68k/types.h create mode 100644 include/asm-m68k/u-boot.h create mode 100644 include/configs/M5272C3.h create mode 100644 include/configs/M5282EVB.h (limited to 'include') diff --git a/include/asm-m68k/global_data.h b/include/asm-m68k/global_data.h new file mode 100644 index 0000000..89bc0ad --- /dev/null +++ b/include/asm-m68k/global_data.h @@ -0,0 +1,62 @@ +/* + * (C) Copyright 2002-2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program 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 2 of + * the License, or (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __ASM_GBL_DATA_H +#define __ASM_GBL_DATA_H +/* + * The following data structure is placed in some memory wich is + * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or + * some locked parts of the data cache) to allow for a minimum set of + * global variables during system initialization (until we have set + * up the memory controller so that we can use RAM). + * + * Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t) + */ + +typedef struct global_data { + bd_t *bd; + unsigned long flags; + unsigned long baudrate; + unsigned long cpu_clk; /* CPU clock in Hz! */ + unsigned long bus_clk; + unsigned long ram_size; /* RAM size */ + unsigned long reloc_off; /* Relocation Offset */ + unsigned long reset_status; /* reset status register at boot */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid? */ + unsigned long have_console; /* serial_init() was called */ +#ifdef CONFIG_BOARD_TYPES + unsigned long board_type; +#endif +} gd_t; + +/* + * Global Data Flags + */ +#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ +#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ + +extern gd_t *global_data; +#define DECLARE_GLOBAL_DATA_PTR gd_t *gd = global_data + +#endif /* __ASM_GBL_DATA_H */ diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h new file mode 100644 index 0000000..79a9626 --- /dev/null +++ b/include/asm-m68k/io.h @@ -0,0 +1 @@ +/* */ diff --git a/include/asm-m68k/posix_types.h b/include/asm-m68k/posix_types.h new file mode 100644 index 0000000..4fbc040 --- /dev/null +++ b/include/asm-m68k/posix_types.h @@ -0,0 +1,109 @@ +#ifndef _M68K_POSIX_TYPES_H +#define _M68K_POSIX_TYPES_H + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned int __kernel_dev_t; +typedef unsigned int __kernel_ino_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +typedef unsigned int __kernel_old_uid_t; +typedef unsigned int __kernel_old_gid_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif + +typedef struct { + int val[2]; +} __kernel_fsid_t; + +#ifndef __GNUC__ + +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) +#define __FD_ZERO(set) \ + ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set))) + +#else /* __GNUC__ */ + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ + || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) +/* With GNU C, use inline functions instead so args are evaluated only once: */ + +#undef __FD_SET +static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) +{ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + fdsetp->fds_bits[_tmp] |= (1UL<<_rem); +} + +#undef __FD_CLR +static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) +{ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); +} + +#undef __FD_ISSET +static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) +{ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; +} + +/* + * This will unroll the loop for the normal constant case (8 ints, + * for a 256-bit fd_set) + */ +#undef __FD_ZERO +static __inline__ void __FD_ZERO(__kernel_fd_set *p) +{ + unsigned int *tmp = (unsigned int *)p->fds_bits; + int i; + + if (__builtin_constant_p(__FDSET_LONGS)) { + switch (__FDSET_LONGS) { + case 8: + tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; + tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; + return; + } + } + i = __FDSET_LONGS; + while (i) { + i--; + *tmp = 0; + tmp++; + } +} + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ +#endif /* __GNUC__ */ +#endif /* _M68K_POSIX_TYPES_H */ diff --git a/include/asm-m68k/ptrace.h b/include/asm-m68k/ptrace.h new file mode 100644 index 0000000..343a9f4 --- /dev/null +++ b/include/asm-m68k/ptrace.h @@ -0,0 +1,108 @@ +#ifndef _M68K_PTRACE_H +#define _M68K_PTRACE_H + +/* + * This struct defines the way the registers are stored on the + * kernel stack during a system call or other kernel entry. + * + * this should only contain volatile regs + * since we can keep non-volatile in the thread_struct + * should set this up when only volatiles are saved + * by intr code. + * + * Since this is going on the stack, *CARE MUST BE TAKEN* to insure + * that the overall structure is a multiple of 16 bytes in length. + * + * Note that the offsets of the fields in this struct correspond with + * the PT_* values below. This simplifies arch/ppc/kernel/ptrace.c. + */ + +#include + +#ifndef __ASSEMBLY__ +#ifdef CONFIG_M68K64BRIDGE +#define M68K_REG unsigned long /*long*/ +#else +#define M68K_REG unsigned long +#endif +struct pt_regs { + M68K_REG gpr[32]; + M68K_REG nip; + M68K_REG msr; + M68K_REG orig_gpr3; /* Used for restarting system calls */ + M68K_REG ctr; + M68K_REG link; + M68K_REG xer; + M68K_REG ccr; + M68K_REG mq; /* 601 only (not used at present) */ + /* Used on APUS to hold IPL value. */ + M68K_REG trap; /* Reason for being here */ + M68K_REG dar; /* Fault registers */ + M68K_REG dsisr; + M68K_REG result; /* Result of a system call */ +}; +#endif + +#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ + +/* Size of stack frame allocated when calling signal handler. */ +#define __SIGNAL_FRAMESIZE 64 + +#define instruction_pointer(regs) ((regs)->nip) +#define user_mode(regs) (((regs)->msr & MSR_PR) != 0) + +/* + * Offsets used by 'ptrace' system call interface. + * These can't be changed without breaking binary compatibility + * with MkLinux, etc. + */ +#define PT_R0 0 +#define PT_R1 1 +#define PT_R2 2 +#define PT_R3 3 +#define PT_R4 4 +#define PT_R5 5 +#define PT_R6 6 +#define PT_R7 7 +#define PT_R8 8 +#define PT_R9 9 +#define PT_R10 10 +#define PT_R11 11 +#define PT_R12 12 +#define PT_R13 13 +#define PT_R14 14 +#define PT_R15 15 +#define PT_R16 16 +#define PT_R17 17 +#define PT_R18 18 +#define PT_R19 19 +#define PT_R20 20 +#define PT_R21 21 +#define PT_R22 22 +#define PT_R23 23 +#define PT_R24 24 +#define PT_R25 25 +#define PT_R26 26 +#define PT_R27 27 +#define PT_R28 28 +#define PT_R29 29 +#define PT_R30 30 +#define PT_R31 31 + +#define PT_NIP 32 +#define PT_MSR 33 +#ifdef __KERNEL__ +#define PT_ORIG_R3 34 +#endif +#define PT_CTR 35 +#define PT_LNK 36 +#define PT_XER 37 +#define PT_CCR 38 +#define PT_MQ 39 + +#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ +#define PT_FPR31 (PT_FPR0 + 2*31) +#define PT_FPSCR (PT_FPR0 + 2*32 + 1) + +#endif + diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h new file mode 100644 index 0000000..e0773a8 --- /dev/null +++ b/include/asm-m68k/string.h @@ -0,0 +1,31 @@ +#ifndef _M68K_STRING_H_ +#define _M68K_STRING_H_ + +#if 0 +#define __HAVE_ARCH_STRCPY +#define __HAVE_ARCH_STRNCPY +#define __HAVE_ARCH_STRLEN +#define __HAVE_ARCH_STRCMP +#define __HAVE_ARCH_STRCAT +#define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_BCOPY +#define __HAVE_ARCH_MEMCPY +#define __HAVE_ARCH_MEMMOVE +#define __HAVE_ARCH_MEMCMP +#define __HAVE_ARCH_MEMCHR +#endif + +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, int); +extern char * strcpy(char *,const char *); +extern char * strncpy(char *,const char *, __kernel_size_t); +extern __kernel_size_t strlen(const char *); +extern int strcmp(const char *,const char *); +extern char * strcat(char *, const char *); +extern void * memset(void *,int,__kernel_size_t); +extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memmove(void *,const void *,__kernel_size_t); +extern int memcmp(const void *,const void *,__kernel_size_t); +extern void * memchr(const void *,int,__kernel_size_t); + +#endif diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h new file mode 100644 index 0000000..e673cb0 --- /dev/null +++ b/include/asm-m68k/types.h @@ -0,0 +1,50 @@ +#ifndef _M68K_TYPES_H +#define _M68K_TYPES_H + +#ifndef __ASSEMBLY__ + +typedef unsigned short umode_t; + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +typedef struct { + __u32 u[4]; +} __attribute((aligned(16))) vector128; + +#ifdef __KERNEL__ +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#define BITS_PER_LONG 32 + +/* DMA addresses are 32-bits wide */ +typedef u32 dma_addr_t; + +#endif /* __KERNEL__ */ +#endif /* __ASSEMBLY__ */ + +#endif diff --git a/include/asm-m68k/u-boot.h b/include/asm-m68k/u-boot.h new file mode 100644 index 0000000..eaf1de7 --- /dev/null +++ b/include/asm-m68k/u-boot.h @@ -0,0 +1,69 @@ +/* + * (C) Copyright 2000 - 2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * This program 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 2 of + * the License, or (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __U_BOOT_H__ +#define __U_BOOT_H__ + +/* + * Board information passed to Linux kernel from U-Boot + * + * include/asm-ppc/u-boot.h + */ + +#ifndef __ASSEMBLY__ +#include + +typedef struct bd_info { + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */ + unsigned long bi_flashstart; /* start of FLASH memory */ + unsigned long bi_flashsize; /* size of FLASH memory */ + unsigned long bi_flashoffset; /* reserved area for startup monitor */ + unsigned long bi_sramstart; /* start of SRAM memory */ + unsigned long bi_sramsize; /* size of SRAM memory */ + unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ + unsigned long bi_boot_params; /* where this board expects params */ + unsigned long bi_ip_addr; /* IP Address */ + unsigned char bi_enetaddr[6]; /* Ethernet adress */ + unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ + unsigned long bi_intfreq; /* Internal Freq, in MHz */ + unsigned long bi_busfreq; /* Bus Freq, in MHz */ + unsigned long bi_baudrate; /* Console Baudrate */ +} bd_t; + +#endif /* __ASSEMBLY__ */ +/* The following data structure is placed in DPRAM to allow for a + * minimum set of global variables during system initialization + * (until we have set up the memory controller so that we can use + * RAM). + * + * Keep it *SMALL* and remember to set CFG_INIT_DATA_SIZE > sizeof(init_data_t) + */ +typedef struct init_data { + unsigned long cpu_clk; /* VCOOUT = CPU clock in Hz! */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid? */ + unsigned long relocated; /* Relocat. offset when running in RAM */ + unsigned long have_console; /* serial_init() was called */ +#ifdef CONFIG_LCD + unsigned long lcd_base; /* Base address of LCD frambuffer mem */ +#endif +} init_data_t; +#endif /* __U_BOOT_H__ */ diff --git a/include/configs/M5272C3.h b/include/configs/M5272C3.h new file mode 100644 index 0000000..8d200f3 --- /dev/null +++ b/include/configs/M5272C3.h @@ -0,0 +1,40 @@ +#ifndef _CONFIG_M5272C3_H +#define _CONFIG_M5272C3_H + +#define CONFIG_COMMANDS ( CONFIG_CMD_DFL & ~(CFG_CMD_LOADS | CFG_CMD_LOADB) ) +#include +#define CONFIG_BOOTDELAY 5 + +#define CFG_MAX_FLASH_SECT 11 +#define CFG_CACHELINE_SIZE 16 +#define CFG_MALLOC_LEN (256 << 10) +#define CFG_INIT_RAM_ADDR 0x20000000 +#define CFG_INIT_RAM_SIZE 0x1000 +#define CFG_INIT_DATA_OFFSET 0 +#define CONFIG_BAUDRATE 19200 +#define CFG_MONITOR_BASE 0x3e0000 +#define CFG_MONITOR_LEN 0x20000 +#define CFG_SDRAM_BASE 0 +#define CFG_FLASH_BASE 0xffe00000 +#define CFG_PROMPT "MCF5272C3> " +#define CFG_CBSIZE 1024 +#define CFG_MAXARGS 64 +#define CFG_LOAD_ADDR 0x20000 +#define CFG_BOOTMAPSZ 0 +#define CFG_BARGSIZE CFG_CBSIZE +#define CFG_BAUDRATE_TABLE { 9600 , 19200 , 38400 , 57600, 115200 } +#define CFG_ENV_ADDR 0xffe04000 +#define CFG_ENV_SIZE 0x2000 +#define CFG_ENV_IS_IN_FLASH 1 +#define CFG_PBSIZE 1024 +#define CFG_MAX_FLASH_BANKS 1 +#define CFG_MEMTEST_START 0x400 +#define CFG_MEMTEST_END 0x380000 +#define CFG_HZ 1000000 +#define CFG_FLASH_ERASE_TOUT 10000000 + +#define FEC_ENET + +#define CONFIG_M5272 + +#endif /* _CONFIG_M5272C3_H */ diff --git a/include/configs/M5282EVB.h b/include/configs/M5282EVB.h new file mode 100644 index 0000000..bbac7d1 --- /dev/null +++ b/include/configs/M5282EVB.h @@ -0,0 +1,40 @@ +#ifndef _CONFIG_M5282EVB_H +#define _CONFIG_M5282EVB_H + +#define CONFIG_COMMANDS ( CONFIG_CMD_DFL & ~(CFG_CMD_LOADS | CFG_CMD_LOADB) ) +#include +#define CONFIG_BOOTDELAY 5 + +#define CFG_MAX_FLASH_SECT 35 +#define CFG_CACHELINE_SIZE 16 +#define CFG_MALLOC_LEN (256 << 10) +#define CFG_INIT_RAM_ADDR 0x20000000 +#define CFG_INIT_RAM_SIZE 0x1000 +#define CFG_INIT_DATA_OFFSET 0 +#define CONFIG_BAUDRATE 19200 +#define CFG_MONITOR_BASE 0x3e0000 +#define CFG_MONITOR_LEN 0x20000 +#define CFG_SDRAM_BASE 0 +#define CFG_FLASH_BASE 0xffe00000 +#define CFG_PROMPT "M5282EVB> " +#define CFG_CBSIZE 1024 +#define CFG_MAXARGS 64 +#define CFG_LOAD_ADDR 0x20000 +#define CFG_BOOTMAPSZ 0 +#define CFG_BARGSIZE CFG_CBSIZE +#define CFG_BAUDRATE_TABLE { 9600 , 19200 , 38400 , 57600, 115200 } +#define CFG_ENV_ADDR 0xffe04000 +#define CFG_ENV_SIZE 0x2000 +#define CFG_ENV_IS_IN_FLASH 1 +#define CFG_PBSIZE 1024 +#define CFG_MAX_FLASH_BANKS 1 +#define CFG_MEMTEST_START 0x400 +#define CFG_MEMTEST_END 0x380000 +#define CFG_HZ 1000000 +#define CFG_FLASH_ERASE_TOUT 10000000 + +#define FEC_ENET + +#define CONFIG_M5282 + +#endif /* _CONFIG_M5282EVB_H */ diff --git a/include/flash.h b/include/flash.h index 32f4f4a..800fb4d 100644 --- a/include/flash.h +++ b/include/flash.h @@ -136,6 +136,8 @@ extern int flash_real_protect(flash_info_t *info, long sector, int prot); #define AMD_ID_LV116DT 0xC7 /* 29LV116DT ( 2 M x 8, top boot sect) */ #define AMD_ID_LV016B 0xc8 /* 29LV016 ID ( 2 M x 8) */ +#define AMD_ID_PL160CB 0x22452245 /* 29PL160CB ID (16 M, bottom boot sect */ + #define AMD_ID_LV400T 0x22B922B9 /* 29LV400T ID ( 4 M, top boot sector) */ #define AMD_ID_LV400B 0x22BA22BA /* 29LV400B ID ( 4 M, bottom boot sect) */ -- cgit v1.1