Skip to contentSkip to conversation

include/linux/stat.h: make struct stat unified

PATCH In review Antony Pavlov 4 participants 13 messages Jun 27, 2011 – Jun 28, 2011

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 2/2 Add MIPS arch support to barebox

In reply to Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

---
 arch/architecture.dox                       |    1 +
 arch/mips/Kconfig                           |   55 ++
 arch/mips/Makefile                          |   51 ++
 arch/mips/boards/malta/Makefile             |    1 +
 arch/mips/boards/malta/config.h             |   19 +
 arch/mips/boards/malta/serial.c             |   64 ++
 arch/mips/boot/Makefile                     |    4 +
 arch/mips/boot/entry.c                      |   80 +++
 arch/mips/boot/head.S                       |  233 +++++++
 arch/mips/configs/malta_defconfig           |  219 ++++++
 arch/mips/include/asm/barebox.h             |   24 +
 arch/mips/include/asm/bitops.h              |   32 +
 arch/mips/include/asm/byteorder.h           |   30 +
 arch/mips/include/asm/common.h              |   29 +
 arch/mips/include/asm/elf.h                 |   30 +
 arch/mips/include/asm/io.h                  |   73 ++
 arch/mips/include/asm/mipsregs.h            |  988 +++++++++++++++++++++++++++
 arch/mips/include/asm/module.h              |   36 +
 arch/mips/include/asm/posix_types.h         |   48 ++
 arch/mips/include/asm/regdef.h              |  100 +++
 arch/mips/include/asm/sections.h            |    1 +
 arch/mips/include/asm/sgidefs.h             |   44 ++
 arch/mips/include/asm/string.h              |   31 +
 arch/mips/include/asm/swab.h                |   59 ++
 arch/mips/include/asm/types.h               |   44 ++
 arch/mips/include/mach/debug_ll.h           |   35 +
 arch/mips/lib/.gitignore                    |    1 +
 arch/mips/lib/Makefile                      |    5 +
 arch/mips/lib/ashldi3.c                     |   27 +
 arch/mips/lib/ashrdi3.c                     |   29 +
 arch/mips/lib/barebox.lds.S                 |   76 ++
 arch/mips/lib/libgcc.h                      |   25 +
 arch/mips/lib/lshrdi3.c                     |   27 +
 arch/mips/lib/memory.c                      |   34 +
 arch/mips/mach-mips.dox                     |    9 +
 arch/mips/mach-qemu/Kconfig                 |   12 +
 arch/mips/mach-qemu/Makefile                |    4 +
 arch/mips/mach-qemu/csrc-r4k.c              |   50 ++
 arch/mips/mach-qemu/include/mach/hardware.h |   28 +
 arch/mips/mach-qemu/reset.c                 |   34 +
 40 files changed, 2692 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/Kconfig
 create mode 100644 arch/mips/Makefile
 create mode 100644 arch/mips/boards/malta/Makefile
 create mode 100644 arch/mips/boards/malta/config.h
 create mode 100644 arch/mips/boards/malta/serial.c
 create mode 100644 arch/mips/boot/Kconfig
 create mode 100644 arch/mips/boot/Makefile
 create mode 100644 arch/mips/boot/entry.c
 create mode 100644 arch/mips/boot/head.S
 create mode 100644 arch/mips/configs/malta_defconfig
 create mode 100644 arch/mips/include/asm/barebox.h
 create mode 100644 arch/mips/include/asm/bitops.h
 create mode 100644 arch/mips/include/asm/byteorder.h
 create mode 100644 arch/mips/include/asm/common.h
 create mode 100644 arch/mips/include/asm/elf.h
 create mode 100644 arch/mips/include/asm/io.h
 create mode 100644 arch/mips/include/asm/mipsregs.h
 create mode 100644 arch/mips/include/asm/module.h
 create mode 100644 arch/mips/include/asm/posix_types.h
 create mode 100644 arch/mips/include/asm/regdef.h
 create mode 100644 arch/mips/include/asm/sections.h
 create mode 100644 arch/mips/include/asm/sgidefs.h
 create mode 100644 arch/mips/include/asm/string.h
 create mode 100644 arch/mips/include/asm/swab.h
 create mode 100644 arch/mips/include/asm/types.h
 create mode 100644 arch/mips/include/mach/debug_ll.h
 create mode 100644 arch/mips/lib/.gitignore
 create mode 100644 arch/mips/lib/Makefile
 create mode 100644 arch/mips/lib/ashldi3.c
 create mode 100644 arch/mips/lib/ashrdi3.c
 create mode 100644 arch/mips/lib/barebox.lds.S
 create mode 100644 arch/mips/lib/libgcc.h
 create mode 100644 arch/mips/lib/lshrdi3.c
 create mode 100644 arch/mips/lib/memory.c
 create mode 100644 arch/mips/mach-mips.dox
 create mode 100644 arch/mips/mach-qemu/Kconfig
 create mode 100644 arch/mips/mach-qemu/Makefile
 create mode 100644 arch/mips/mach-qemu/csrc-r4k.c
 create mode 100644 arch/mips/mach-qemu/include/mach/hardware.h
 create mode 100644 arch/mips/mach-qemu/reset.c
arch/architecture.dox +1 -0
index 67e2c38..2d2cf05 100644
@@ -86,6 +86,7 @@ TODO
 
 @li @subpage dev_arm_mach
 @li @subpage dev_bf_mach
+@li @subpage dev_mips_mach
 @li @subpage dev_ppc_mach
 @li @subpage dev_x86_mach
 
arch/mips/Kconfig new file +55 -0

55 lines not on this page · raw message

arch/mips/Makefile new file +51 -0

51 lines not on this page · raw message

arch/mips/boards/malta/Makefile new file +1 -0
new file mode 100644
index 0000000..31c0629
@@ -0,0 +1 @@
+obj-y += serial.o
arch/mips/boards/malta/config.h new file +19 -0
new file mode 100644
index 0000000..eb4ab08
@@ -0,0 +1,19 @@
+/*
+ * 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
+ *
+ */
+
+/* nothing special yet */
arch/mips/boards/malta/serial.c new file +64 -0

64 lines not on this page · raw message

arch/mips/boot/Kconfig new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/mips/boot/Makefile new file +4 -0
new file mode 100644
index 0000000..fd7a745
@@ -0,0 +1,4 @@
+CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -g -O0 -march=mips64
+
+obj-y += head.o
+obj-y += entry.o
arch/mips/boot/entry.c new file +80 -0

80 lines not on this page · raw message

arch/mips/boot/head.S new file +233 -0

233 lines not on this page · raw message

arch/mips/configs/malta_defconfig new file +219 -0

219 lines not on this page · raw message

arch/mips/include/asm/barebox.h new file +24 -0
new file mode 100644
index 0000000..b42c9ff
@@ -0,0 +1,24 @@
+/*
+ * 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_MIPS_BAREBOX_H_
+#define _ASM_MIPS_BAREBOX_H_
+
+/* nothing special yet */
+
+#endif /* _ASM_MIPS_BAREBOX_H_ */
arch/mips/include/asm/bitops.h new file +32 -0
new file mode 100644
index 0000000..36d34b6
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips bit operations
+ *
+ * This file is required only to make all sources happy including
+ * 'linux/bitops.h'
+ */
+
+#ifndef _ASM_MIPS_BITOPS_H_
+#define _ASM_MIPS_BITOPS_H_
+
+/* nothing special yet */
+
+#endif /* _ASM_MIPS_BITOPS_H_ */
arch/mips/include/asm/byteorder.h new file +30 -0
new file mode 100644
index 0000000..5fcdd9f
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips endianess declaration
+ */
+
+#ifndef __ASM_MIPS_BYTEORDER_H
+#define __ASM_MIPS_BYTEORDER_H
+
+#include <asm/types.h>
+#include <linux/byteorder/big_endian.h>
+
+#endif
arch/mips/include/asm/common.h new file +29 -0
new file mode 100644
index 0000000..8b21157
@@ -0,0 +1,29 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips common declarations
+ */
+
+#ifndef _ASM_MIPS_COMMON_H_
+#define _ASM_MIPS_COMMON_H_
+
+/* Nothing exiting yet */
+
+#endif /* _ASM_MIPS_COMMON_H_ */
arch/mips/include/asm/elf.h new file +30 -0
new file mode 100644
index 0000000..d88863d
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips specific elf information
+ *
+ */
+
+#ifndef _ASM_MIPS_ELF_H
+#define _ASM_MIPS_ELF_H
+
+#define ELF_CLASS ELFCLASS32
+
+#endif /* _ASM_MIPS_ELF_H */
arch/mips/include/asm/io.h new file +73 -0

73 lines not on this page · raw message

arch/mips/include/asm/mipsregs.h new file +988 -0

988 lines not on this page · raw message

arch/mips/include/asm/module.h new file +36 -0
new file mode 100644
index 0000000..0463565
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips module support
+ *
+ */
+
+#ifndef _ASM_MIPS_MODULE_H_
+#define _ASM_MIPS_MODULE_H_
+
+struct mod_arch_specific
+{
+        int foo;
+};
+
+#define Elf_Shdr        Elf32_Shdr
+#define Elf_Ehdr        Elf32_Ehdr
+
+#endif /* _ASM_MIPS_MODULE_H_ */
arch/mips/include/asm/posix_types.h new file +48 -0

48 lines not on this page · raw message

arch/mips/include/asm/regdef.h new file +100 -0

100 lines not on this page · raw message

arch/mips/include/asm/sections.h new file +1 -0
new file mode 100644
index 0000000..2b8c516
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
arch/mips/include/asm/sgidefs.h new file +44 -0

44 lines not on this page · raw message

arch/mips/include/asm/string.h new file +31 -0
new file mode 100644
index 0000000..9e334a2
@@ -0,0 +1,31 @@
+/*
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief mips specific string optimizations
+ *
+ * Thanks to the Linux kernel here we can add many micro optimized string
+ * functions. But currently it makes no sense, to do so.
+ */
+#ifndef __ASM_MIPS_STRING_H
+#define __ASM_MIPS_STRING_H
+
+/* nothing special yet */
+
+#endif
arch/mips/include/asm/swab.h new file +59 -0

59 lines not on this page · raw message

arch/mips/include/asm/types.h new file +44 -0

44 lines not on this page · raw message

arch/mips/include/mach/debug_ll.h new file +35 -0
new file mode 100644
index 0000000..9fff7be
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <[email protected]>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of barebox.
+ *
+ * barebox 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.
+ *
+ * barebox 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 barebox.  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__
+
+#include <asm/io.h>
+#include <mach/hardware.h>
+
+extern __inline__ void putc( char ch )
+{
+	writeb(ch, DEBUG_LL_UART_ADDR);
+}
+
+#endif  /* __INCLUDE_ARCH_DEBUG_LL_H__ */
arch/mips/lib/.gitignore new file +1 -0
new file mode 100644
index 0000000..d116578
@@ -0,0 +1 @@
+barebox.lds
arch/mips/lib/Makefile new file +5 -0
new file mode 100644
index 0000000..27cd97f
@@ -0,0 +1,5 @@
+extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
+obj-y += lshrdi3.o
+obj-y += ashldi3.o
+obj-y += ashrdi3.o
+obj-y += memory.o
arch/mips/lib/ashldi3.c new file +27 -0
new file mode 100644
index 0000000..461450a
@@ -0,0 +1,27 @@
+#include "libgcc.h"
+
+long long __ashldi3(long long u, word_type b)
+{
+	DWunion uu, w;
+	word_type bm;
+
+	if (b == 0)
+		return u;
+
+	uu.ll = u;
+	bm = 32 - b;
+
+	if (bm <= 0) {
+		w.s.low = 0;
+		w.s.high = (unsigned int) uu.s.low << -bm;
+	} else {
+		const unsigned int carries = (unsigned int) uu.s.low >> bm;
+
+		w.s.low = (unsigned int) uu.s.low << b;
+		w.s.high = ((unsigned int) uu.s.high << b) | carries;
+	}
+
+	return w.ll;
+}
+
+EXPORT_SYMBOL(__ashldi3);
arch/mips/lib/ashrdi3.c new file +29 -0
new file mode 100644
index 0000000..a0d005b
@@ -0,0 +1,29 @@
+#include "libgcc.h"
+
+long long __ashrdi3(long long u, word_type b)
+{
+	DWunion uu, w;
+	word_type bm;
+
+	if (b == 0)
+		return u;
+
+	uu.ll = u;
+	bm = 32 - b;
+
+	if (bm <= 0) {
+		/* w.s.high = 1..1 or 0..0 */
+		w.s.high =
+		    uu.s.high >> 31;
+		w.s.low = uu.s.high >> -bm;
+	} else {
+		const unsigned int carries = (unsigned int) uu.s.high << bm;
+
+		w.s.high = uu.s.high >> b;
+		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
+	}
+
+	return w.ll;
+}
+
+EXPORT_SYMBOL(__ashrdi3);
arch/mips/lib/barebox.lds.S new file +76 -0

76 lines not on this page · raw message

arch/mips/lib/libgcc.h new file +25 -0
new file mode 100644
index 0000000..05909d5
@@ -0,0 +1,25 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#include <asm/byteorder.h>
+
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#ifdef __BIG_ENDIAN
+struct DWstruct {
+	int high, low;
+};
+#elif defined(__LITTLE_ENDIAN)
+struct DWstruct {
+	int low, high;
+};
+#else
+#error I feel sick.
+#endif
+
+typedef union {
+	struct DWstruct s;
+	long long ll;
+} DWunion;
+
+#endif /* __ASM_LIBGCC_H */
arch/mips/lib/lshrdi3.c new file +27 -0
new file mode 100644
index 0000000..154757c
@@ -0,0 +1,27 @@
+#include "libgcc.h"
+
+long long __lshrdi3(long long u, word_type b)
+{
+	DWunion uu, w;
+	word_type bm;
+
+	if (b == 0)
+		return u;
+
+	uu.ll = u;
+	bm = 32 - b;
+
+	if (bm <= 0) {
+		w.s.high = 0;
+		w.s.low = (unsigned int) uu.s.high >> -bm;
+	} else {
+		const unsigned int carries = (unsigned int) uu.s.high << bm;
+
+		w.s.high = (unsigned int) uu.s.high >> b;
+		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
+	}
+
+	return w.ll;
+}
+
+EXPORT_SYMBOL(__lshrdi3);
arch/mips/lib/memory.c new file +34 -0
new file mode 100644
index 0000000..e5fabb9
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011 Antony Pavlov <[email protected]>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of barebox.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mem_malloc.h>
+#include <mach/hardware.h>
+
+static int mips_mem_malloc_init(void)
+{
+	mem_malloc_init((void *)MALLOC_BASE,
+			(void *)(MALLOC_BASE + MALLOC_SIZE));
+	return 0;
+}
+core_initcall(mips_mem_malloc_init);
arch/mips/mach-mips.dox new file +9 -0
new file mode 100644
index 0000000..023a829
@@ -0,0 +1,9 @@
+/* This document is intended to provide the developer with information
+ * how to integrate a new CPU (MACH) into this part of the barebox tree
+ */
+
+/** @page dev_arm_mach MIPS based CPU (MACH) into the tree
+
+FIXME
+
+*/
arch/mips/mach-qemu/Kconfig new file +12 -0
new file mode 100644
index 0000000..9ed4153
@@ -0,0 +1,12 @@
+if MACH_MIPS_MALTA
+menu "Board specific settings       "
+
+config BOARDINFO
+	default "qemu malta"
+
+config DEBUG_LL
+	bool "DEBUG_LL"
+	default y
+
+endmenu
+endif
arch/mips/mach-qemu/Makefile new file +4 -0
new file mode 100644
index 0000000..f9f2953
@@ -0,0 +1,4 @@
+obj-y += reset.o
+
+# reference clocksource
+obj-y += csrc-r4k.o
arch/mips/mach-qemu/csrc-r4k.c new file +50 -0

50 lines not on this page · raw message

arch/mips/mach-qemu/include/mach/hardware.h new file +28 -0
new file mode 100644
index 0000000..62e828f
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Antony Pavlov <[email protected]>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of barebox.
+ *
+ * barebox 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.
+ *
+ * barebox 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 barebox.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __INCLUDE_ARCH_HARDWARE_H__
+#define   __INCLUDE_ARCH_HARDWARE_H__
+
+#define DEBUG_LL_UART_ADDR	0xb00003f8
+#define MALLOC_BASE 0xa0800000
+#define MALLOC_SIZE   0x100000
+
+#endif  /* __INCLUDE_ARCH_HARDWARE_H__ */
arch/mips/mach-qemu/reset.c new file +34 -0
new file mode 100644
index 0000000..c5a2537
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009 Juergen Beisert, Pengutronix
+ *
+ * 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
+ *
+ */
+
+/**
+ * @file
+ * @brief Resetting an CPU
+ */
+
+#include <common.h>
+
+void reset_cpu(ulong addr)
+{
+	/** How to reset the machine? */
+	while(1)
+		;
+}
+EXPORT_SYMBOL(reset_cpu);
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#0 lore raw

PATCH 1/2 include/linux/stat.h: make struct stat unified

This unification make MIPS arch possible.

---
 include/linux/stat.h |   58 --------------------------------------------------
 1 files changed, 0 insertions(+), 58 deletions(-)
include/linux/stat.h +0 -58
index 10103d4..bc7dce4 100644
@@ -42,31 +42,6 @@ extern "C" {
 #define S_IWOTH 00002		/* read permission for other */
 #define S_IXOTH 00001		/* execute/search permission for other */
 
-#ifdef	__PPC__
-
-struct stat {
-	dev_t		st_dev;		/* file system id */
-	ino_t		st_ino;		/* file id */
-	mode_t		st_mode;	/* ownership/protection */
-	nlink_t		st_nlink;	/* number of links */
-	uid_t 		st_uid;		/* user id */
-	gid_t 		st_gid;		/* group id */
-	dev_t		st_rdev;
-	off_t		st_size;	/* file size in # of bytes */
-	unsigned long  	st_blksize;	/* block size */
-	unsigned long  	st_blocks;	/* file size in # of blocks */
-	unsigned long  	st_atime;	/* time file was last accessed */
-	unsigned long  	__unused1;
-	unsigned long  	st_mtime;	/* time file was last modified */
-	unsigned long  	__unused2;
-	unsigned long  	st_ctime;	/* time file status was last changed */
-	unsigned long  	__unused3;
-	unsigned long  	__unused4;
-	unsigned long  	__unused5;
-};
-
-#else
-
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -90,39 +65,6 @@ struct stat {
 	unsigned long  __unused5;
 };
 
-#endif	/* __ARM__ */
-
-#if defined (__MIPS__)
-
-struct stat {
-	dev_t           st_dev;
-	long            st_pad1[3];
-	ino_t           st_ino;
-	mode_t          st_mode;
-	nlink_t         st_nlink;
-	uid_t           st_uid;
-	gid_t           st_gid;
-	dev_t           st_rdev;
-	long            st_pad2[2];
-	off_t           st_size;
-	long            st_pad3;
-	/*
-	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
-	 * but we don't have it under Linux.
-	 */
-	time_t          st_atime;
-	long            reserved0;
-	time_t          st_mtime;
-	long            reserved1;
-	time_t          st_ctime;
-	long            reserved2;
-	long            st_blksize;
-	long            st_blocks;
-	long            st_pad4[14];
-};
-
-#endif	/* __MIPS__ */
-
 #ifdef __cplusplus
 }
 #endif
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Antony Pavlov
Quoted 3 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Hi

I try to compile but does not work on mipsel toolchains

please take a look on here
http://git.jcrosoft.org/git?p=barebox.git;a=shortlog;h=refs/heads/mips

the work start by Shinya Kuribayashi to support mips and barebox

maybe you can merge both

# make O=build/malta -j9 -s
  GEN     /opt/work/barebox/build/malta/Makefile
common/Kconfig:91:warning: 'TEXT_BASE': number is invalid
  GEN     /opt/work/barebox/build/malta/Makefile
  CHK     include/generated/version.h
  UPD     include/generated/version.h
  CHK     include/generated/utsrelease.h
  SYMLINK include/config.h -> arch/mips/boards/malta//config.h
  SYMLINK include/asm -> include/asm-mips
  UPD     include/generated/utsrelease.h
  Using /opt/work/barebox as source for kernel
/opt/work/barebox/common/memory.c:33: warning: no previous prototype for 'mem_malloc_start'
/opt/work/barebox/common/memory.c:38: warning: no previous prototype for 'mem_malloc_end'
/opt/work/barebox/common/memory.c:43: warning: no previous prototype for 'mem_malloc_init'
/opt/work/barebox/common/memory.c:63: warning: no previous prototype for 'sbrk'
/opt/work/barebox/lib/string.c:437: warning: no previous prototype for 'bcopy'
mipsel-unknown-linux-gnu-ld: drivers/serial/serial_ns16550.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: drivers/serial/serial_ns16550.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file drivers/serial/serial_ns16550.o
make[3]: *** [drivers/serial/built-in.o] Error 1
make[2]: *** [drivers/serial] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers] Error 2
make[1]: *** Waiting for unfinished jobs....
mipsel-unknown-linux-gnu-ld: net/dhcp.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/dhcp.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/dhcp.o
mipsel-unknown-linux-gnu-ld: net/eth.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/eth.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/eth.o
mipsel-unknown-linux-gnu-ld: net/net.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/net.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/net.o
mipsel-unknown-linux-gnu-ld: net/tftp.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/tftp.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/tftp.o
mipsel-unknown-linux-gnu-ld: net/ping.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/ping.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/ping.o
mipsel-unknown-linux-gnu-ld: net/netconsole.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: net/netconsole.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file net/netconsole.o
make[2]: *** [net/built-in.o] Error 1
make[1]: *** [net] Error 2
mipsel-unknown-linux-gnu-ld: common/hush.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/hush.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/hush.o
mipsel-unknown-linux-gnu-ld: common/date.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/date.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/date.o
mipsel-unknown-linux-gnu-ld: common/environment.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/environment.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/environment.o
mipsel-unknown-linux-gnu-ld: common/complete.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/complete.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/complete.o
mipsel-unknown-linux-gnu-ld: common/poller.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/poller.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/poller.o
mipsel-unknown-linux-gnu-ld: common/memory.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/memory.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/memory.o
mipsel-unknown-linux-gnu-ld: common/dlmalloc.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/dlmalloc.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/dlmalloc.o
mipsel-unknown-linux-gnu-ld: common/clock.o: compiled for a big endian system and target is little endian
mipsel-unknown-linux-gnu-ld: common/clock.o: endianness incompatible with that of the selected emulation
mipsel-unknown-linux-gnu-ld: failed to merge target specific data of file common/clock.o

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

I try to compile but does not work on mipsel toolchains

I forgot to add :))):

Only supported board is qemu malta:
...
* only big-endian mode.

I have flag '-EB' in a makefile.

I will try to use mipsel cross-compiler (i have never use it before!).

Quoted 5 lines

please take a look on here
http://git.jcrosoft.org/git?p=barebox.git;a=shortlog;h=refs/heads/mips

the work start by Shinya Kuribayashi to support mips and barebox. maybe you can merge both

I will look on this git brunch.

But I have found no discussion on mips in maillist archives.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw
In reply to Antony Pavlov
Quoted 1 line · Antony Pavlov

This unification make MIPS arch possible.

The Mips patch probably takes a bit of discussion. In the meantime I applied this patch with a bit more detailed commit log:

include/linux/stat.h: make struct stat unified

The current version of struct stat has been taken from an ancient Linux Kernel. It looks different on different architectures to support different userspace formats of struct stat. As we do not have a userspace on barebox there is no need to keep different versions.

Also, this unification make MIPS arch possible.

Sascha

Quoted 91 lines
---
 include/linux/stat.h |   58 --------------------------------------------------
 1 files changed, 0 insertions(+), 58 deletions(-)
include/linux/stat.h +0 -58
index 10103d4..bc7dce4 100644
@@ -42,31 +42,6 @@ extern "C" {
 #define S_IWOTH 00002		/* read permission for other */
 #define S_IXOTH 00001		/* execute/search permission for other */
 
-#ifdef	__PPC__
-
-struct stat {
-	dev_t		st_dev;		/* file system id */
-	ino_t		st_ino;		/* file id */
-	mode_t		st_mode;	/* ownership/protection */
-	nlink_t		st_nlink;	/* number of links */
-	uid_t 		st_uid;		/* user id */
-	gid_t 		st_gid;		/* group id */
-	dev_t		st_rdev;
-	off_t		st_size;	/* file size in # of bytes */
-	unsigned long  	st_blksize;	/* block size */
-	unsigned long  	st_blocks;	/* file size in # of blocks */
-	unsigned long  	st_atime;	/* time file was last accessed */
-	unsigned long  	__unused1;
-	unsigned long  	st_mtime;	/* time file was last modified */
-	unsigned long  	__unused2;
-	unsigned long  	st_ctime;	/* time file status was last changed */
-	unsigned long  	__unused3;
-	unsigned long  	__unused4;
-	unsigned long  	__unused5;
-};
-
-#else
-
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -90,39 +65,6 @@ struct stat {
 	unsigned long  __unused5;
 };
 
-#endif	/* __ARM__ */
-
-#if defined (__MIPS__)
-
-struct stat {
-	dev_t           st_dev;
-	long            st_pad1[3];
-	ino_t           st_ino;
-	mode_t          st_mode;
-	nlink_t         st_nlink;
-	uid_t           st_uid;
-	gid_t           st_gid;
-	dev_t           st_rdev;
-	long            st_pad2[2];
-	off_t           st_size;
-	long            st_pad3;
-	/*
-	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
-	 * but we don't have it under Linux.
-	 */
-	time_t          st_atime;
-	long            reserved0;
-	time_t          st_mtime;
-	long            reserved1;
-	time_t          st_ctime;
-	long            reserved2;
-	long            st_blksize;
-	long            st_blocks;
-	long            st_pad4[14];
-};
-
-#endif	/* __MIPS__ */
-
 #ifdef __cplusplus
 }
 #endif
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Antony Pavlov
Quoted 5 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Looks mostly good, some comments inline.

Quoted 143 lines
---
 arch/architecture.dox                       |    1 +
 arch/mips/Kconfig                           |   55 ++
 arch/mips/Makefile                          |   51 ++
 arch/mips/boards/malta/Makefile             |    1 +
 arch/mips/boards/malta/config.h             |   19 +
 arch/mips/boards/malta/serial.c             |   64 ++
 arch/mips/boot/Makefile                     |    4 +
 arch/mips/boot/entry.c                      |   80 +++
 arch/mips/boot/head.S                       |  233 +++++++
 arch/mips/configs/malta_defconfig           |  219 ++++++
 arch/mips/include/asm/barebox.h             |   24 +
 arch/mips/include/asm/bitops.h              |   32 +
 arch/mips/include/asm/byteorder.h           |   30 +
 arch/mips/include/asm/common.h              |   29 +
 arch/mips/include/asm/elf.h                 |   30 +
 arch/mips/include/asm/io.h                  |   73 ++
 arch/mips/include/asm/mipsregs.h            |  988 +++++++++++++++++++++++++++
 arch/mips/include/asm/module.h              |   36 +
 arch/mips/include/asm/posix_types.h         |   48 ++
 arch/mips/include/asm/regdef.h              |  100 +++
 arch/mips/include/asm/sections.h            |    1 +
 arch/mips/include/asm/sgidefs.h             |   44 ++
 arch/mips/include/asm/string.h              |   31 +
 arch/mips/include/asm/swab.h                |   59 ++
 arch/mips/include/asm/types.h               |   44 ++
 arch/mips/include/mach/debug_ll.h           |   35 +
 arch/mips/lib/.gitignore                    |    1 +
 arch/mips/lib/Makefile                      |    5 +
 arch/mips/lib/ashldi3.c                     |   27 +
 arch/mips/lib/ashrdi3.c                     |   29 +
 arch/mips/lib/barebox.lds.S                 |   76 ++
 arch/mips/lib/libgcc.h                      |   25 +
 arch/mips/lib/lshrdi3.c                     |   27 +
 arch/mips/lib/memory.c                      |   34 +
 arch/mips/mach-mips.dox                     |    9 +
 arch/mips/mach-qemu/Kconfig                 |   12 +
 arch/mips/mach-qemu/Makefile                |    4 +
 arch/mips/mach-qemu/csrc-r4k.c              |   50 ++
 arch/mips/mach-qemu/include/mach/hardware.h |   28 +
 arch/mips/mach-qemu/reset.c                 |   34 +
 40 files changed, 2692 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/Kconfig
 create mode 100644 arch/mips/Makefile
 create mode 100644 arch/mips/boards/malta/Makefile
 create mode 100644 arch/mips/boards/malta/config.h
 create mode 100644 arch/mips/boards/malta/serial.c
 create mode 100644 arch/mips/boot/Kconfig
 create mode 100644 arch/mips/boot/Makefile
 create mode 100644 arch/mips/boot/entry.c
 create mode 100644 arch/mips/boot/head.S
 create mode 100644 arch/mips/configs/malta_defconfig
 create mode 100644 arch/mips/include/asm/barebox.h
 create mode 100644 arch/mips/include/asm/bitops.h
 create mode 100644 arch/mips/include/asm/byteorder.h
 create mode 100644 arch/mips/include/asm/common.h
 create mode 100644 arch/mips/include/asm/elf.h
 create mode 100644 arch/mips/include/asm/io.h
 create mode 100644 arch/mips/include/asm/mipsregs.h
 create mode 100644 arch/mips/include/asm/module.h
 create mode 100644 arch/mips/include/asm/posix_types.h
 create mode 100644 arch/mips/include/asm/regdef.h
 create mode 100644 arch/mips/include/asm/sections.h
 create mode 100644 arch/mips/include/asm/sgidefs.h
 create mode 100644 arch/mips/include/asm/string.h
 create mode 100644 arch/mips/include/asm/swab.h
 create mode 100644 arch/mips/include/asm/types.h
 create mode 100644 arch/mips/include/mach/debug_ll.h
 create mode 100644 arch/mips/lib/.gitignore
 create mode 100644 arch/mips/lib/Makefile
 create mode 100644 arch/mips/lib/ashldi3.c
 create mode 100644 arch/mips/lib/ashrdi3.c
 create mode 100644 arch/mips/lib/barebox.lds.S
 create mode 100644 arch/mips/lib/libgcc.h
 create mode 100644 arch/mips/lib/lshrdi3.c
 create mode 100644 arch/mips/lib/memory.c
 create mode 100644 arch/mips/mach-mips.dox
 create mode 100644 arch/mips/mach-qemu/Kconfig
 create mode 100644 arch/mips/mach-qemu/Makefile
 create mode 100644 arch/mips/mach-qemu/csrc-r4k.c
 create mode 100644 arch/mips/mach-qemu/include/mach/hardware.h
 create mode 100644 arch/mips/mach-qemu/reset.c
arch/mips/boards/malta/serial.c new file +54 -0
new file mode 100644
index 0000000..b3ade0c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 Antony Pavlov <[email protected]>
+ *
+ * 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
+ *
+ */
+
+#include <common.h>
+#include <types.h>
+#include <driver.h>
+#include <init.h>
+#include <ns16550.h>
+#include <mach/hardware.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_DRIVER_SERIAL_NS16550
+/** to work with the 8250 UART driver implementation we need this function */
+unsigned int malta_uart_read(unsigned long base, unsigned char reg_idx)
+{
+	return readb(base + reg_idx);
+}
+
+/** to work with the 8250 UART driver implementation we need this function */
+void malta_uart_write(unsigned int val, unsigned long base, unsigned char reg_idx)
+{
+	writeb(val, base + reg_idx);
+}
+
+static struct NS16550_plat serial_plat = {
+       .clock = 1843200, /* no matter */
+       .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
+       .reg_read = malta_uart_read,
+       .reg_write = malta_uart_write,
+};
+
+/* we are expecting always one serial interface */
+static struct device_d generic_malta_serial_device = {
+       .name = "serial_ns16550",
+       .map_base = DEBUG_LL_UART_ADDR,
+       .size = 8,
+       .platform_data = (void *)&serial_plat,

arch/mips/boards/malta/serial.c line 64

Quoted 10 lines
arch/mips/boards/malta/serial.c new file +10 -0
+};
+
+static int malta_console_init(void)
+{
+       /* Register the serial port */
+       return register_device(&generic_malta_serial_device);
+}
+console_initcall(malta_console_init);
+
+#endif

The whole file is inside CONFIG_DRIVER_SERIAL_NS16550, so you can do a obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o in the Makefile instead.

arch/mips/configs/malta_defconfig

Quoted 15 lines
arch/mips/boot/Kconfig new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/mips/boot/Makefile new file +4 -0
new file mode 100644
index 0000000..fd7a745
@@ -0,0 +1,4 @@
+CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -g -O0 -march=mips64
+
+obj-y += head.o
+obj-y += entry.o
arch/mips/configs/malta_defconfig +0 -0

Please generate your defconfig file with make savedefconfig

Quoted 19 lines
arch/mips/include/asm/posix_types.h new file +13 -0
new file mode 100644
index 0000000..a7d0c25
@@ -0,0 +1,48 @@
+/*
+ * 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

arch/mips/include/asm/posix_types.h line 23

Quoted 10 lines
arch/mips/include/asm/posix_types.h new file +10 -0
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/**
+ * @file
+ * @brief mips posix types
+ *
+ * Minimal set to make all the other header files copied from the Linxu kernel happy

s/Linxu/Linux/

Quoted 55 lines
arch/mips/include/asm/posix_types.h new file +25 -0
+ */
+
+#ifndef _ASM_MIPS_POSIX_TYPES_H
+#define _ASM_MIPS_POSIX_TYPES_H
+
+typedef unsigned long	__kernel_ino_t;
+typedef unsigned short	__kernel_mode_t;
+typedef unsigned short	__kernel_nlink_t;
+typedef long		__kernel_off_t;
+typedef int		__kernel_pid_t;
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
+typedef int		__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 unsigned short	__kernel_uid16_t;
+typedef unsigned short	__kernel_gid16_t;
+typedef unsigned int	__kernel_uid32_t;
+typedef unsigned int	__kernel_gid32_t;
+typedef long long	__kernel_loff_t;
+
+#endif /* _ASM_MIPS_POSIX_TYPES_H */
arch/mips/mach-qemu/csrc-r4k.c new file +0 -1
new file mode 100644
index 0000000..bb54700
--- /dev/null
arch/mips/mach-qemu/reset.c new file +20 -0
new file mode 100644
index 0000000..c5a2537
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009 Juergen Beisert, Pengutronix
+ *
+ * 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
+ *
+ */
+

arch/mips/mach-qemu/reset.c line 30

Quoted 10 lines
arch/mips/mach-qemu/reset.c new file +10 -0
+/**
+ * @file
+ * @brief Resetting an CPU
+ */
+
+#include <common.h>
+
+void reset_cpu(ulong addr)
+{
+	/** How to reset the machine? */

I don't know either. We should add some printf here until we know.

Quoted 13 lines
arch/mips/mach-qemu/reset.c new file +4 -0
+	while(1)
+		;
+}
+EXPORT_SYMBOL(reset_cpu);
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

Quoted 8 lines · Sascha Hauer
Quoted 5 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Looks mostly good, some comments inline.

...

Quoted 7 lines
Quoted 7 lines
arch/mips/boards/malta/serial.c new file +0 -0
new file mode 100644
index 0000000..b3ade0c

...

Quoted 4 lines

The whole file is inside CONFIG_DRIVER_SERIAL_NS16550, so you can do a obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o in the Makefile instead.

Ok.

Quoted 4 lines

arch/mips/configs/malta_defconfig

Quoted 2 lines
arch/mips/configs/malta_defconfig +0 -0

Please generate your defconfig file with make savedefconfig

I have know nothing about savedefconfig. I will use it.

Quoted 9 lines
Quoted 6 lines

+/**
+ * @file
+ * @brief mips posix types
+ *
+ * Minimal set to make all the other header files copied from the Linxu kernel happy

s/Linxu/Linux/

I did't used spell checker, but I must do.

:)

...

Quoted 6 lines

arch/mips/configs/malta_defconfig

Quoted 3 lines
arch/mips/configs/malta_defconfig +3 -0
+void reset_cpu(ulong addr)
+{
+	/** How to reset the machine? */

I don't know either. We should add some printf here until we know.

qemu malta board has magic register to reset the machine (see "SOFTRES Register" in qemu.git/hw/mips_malta.c).

For other board we can easily jump to start of bootrom. I think it is possible in th future to introduce option to configure reset_cpu()'s behavior.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Quoted 7 lines

please take a look on here
http://git.jcrosoft.org/git?p=barebox.git;a=shortlog;h=refs/heads/mips

the work start by Shinya Kuribayashi to support mips and barebox

maybe you can merge both

I took a look on it.

I can build 'qemu' target with default config, but I can't see any output in emulator.

I can't even build 'malta' target with default config.

Is it runnable at all?

I think, that Shinya's concepts can be used in the future, but they are very complex for initial mips support.

IMHO, the Shinya's code is redundant (> 200K ) --- initial support must be as small as possible.

The file Kconfig is overcomplicated. Many variables are really unused:
DMA_NONCOHERENT,
SWAP_IO_SPACE
HW_HAS_PCI
SYS_SUPPORTS_{32,64}BIT_KERNEL
SYS_SUPPORTS_ARBIT_HZ
and others

In other hand the options ARCH_TEXT_BASE and CPU_BIG_ENDIAN are useful just now, but I have missed them.

But now I see, that I can make my mips support better --- split big patch and make some parts of code configurable.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

Quoted 21 lines · Antony Pavlov
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Quoted 7 lines

please take a look on here
http://git.jcrosoft.org/git?p=barebox.git;a=shortlog;h=refs/heads/mips

the work start by Shinya Kuribayashi to support mips and barebox

maybe you can merge both

I took a look on it.

I can build 'qemu' target with default config, but I can't see any output in emulator.

I can't even build 'malta' target with default config.

Quoted 7 lines

Is it runnable at all?

I think, that Shinya's concepts can be used in the future, but they are very complex for initial mips support.

IMHO, the Shinya's code is redundant (> 200K ) --- initial support must be as small as possible.

+1 for starting small.

Quoted 9 lines

The file Kconfig is overcomplicated. Many variables are really unused:
DMA_NONCOHERENT,
SWAP_IO_SPACE
HW_HAS_PCI
SYS_SUPPORTS_{32,64}BIT_KERNEL
SYS_SUPPORTS_ARBIT_HZ
and others

Quoted 5 lines

In other hand the options ARCH_TEXT_BASE and CPU_BIG_ENDIAN are useful just now, but I have missed them.

But now I see, that I can make my mips support better --- split big patch and make some parts of code configurable.

I forgot to say, it's good to split the board support and the architecture support.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Antony Pavlov
Quoted 37 lines · Antony Pavlov
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Antony Pavlov

Only supported board is qemu malta:
* barebox works in uncached memory;
* no peripherals support, but serial port.

Quoted 7 lines

please take a look on here
http://git.jcrosoft.org/git?p=barebox.git;a=shortlog;h=refs/heads/mips

the work start by Shinya Kuribayashi to support mips and barebox

maybe you can merge both

I took a look on it.

I can build 'qemu' target with default config, but I can't see any output in emulator.

I can't even build 'malta' target with default config.

Is it runnable at all?

I think, that Shinya's concepts can be used in the future, but they are very complex for initial mips support.

IMHO, the Shinya's code is redundant (> 200K ) --- initial support must be as small as possible.

The file Kconfig is overcomplicated. Many variables are really unused:
DMA_NONCOHERENT,
SWAP_IO_SPACE
HW_HAS_PCI
SYS_SUPPORTS_{32,64}BIT_KERNEL
SYS_SUPPORTS_ARBIT_HZ
and others

Quoted 5 lines

In other hand the options ARCH_TEXT_BASE and CPU_BIG_ENDIAN are useful just now, but I have missed them.

But now I see, that I can make my mips support better --- split big patch and make some parts of code configurable.

in Shinya-san work the init code is really more clean than u-boot and the Makefile too and other part

I think you can merge both o have a good mips implementation

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Antony Pavlov
Quoted 6 lines · Antony Pavlov
arch/mips/Kconfig new file +0 -0
new file mode 100644
index 0000000..10c0fbb
@@ -0,0 +1,55 @@

[...]

arch/mips/Kconfig line 46

Quoted 12 lines
arch/mips/Kconfig new file +12 -0
+source arch/mips/mach-qemu/Kconfig
+
+choice
+	prompt "Bring up type"
+
+	config MIPS_NATIVE_BRINGUP
+		bool "native"
+		help
+		   Barebox will act as a native bootloader. This includes all the
+		   required initialization needed to bring up a piece of hardware.
+
+endchoice

Native bringup / native bootloader should be replaced with something more appropriate or descriptive.

Quoted 14 lines
arch/mips/Kconfig new file +8 -0
+source arch/mips/boot/Kconfig
+
+source common/Kconfig
+source commands/Kconfig
+source net/Kconfig
+source drivers/Kconfig
+source fs/Kconfig
+source lib/Kconfig
arch/mips/Makefile new file +0 -0
new file mode 100644
index 0000000..60d88e5

arch/mips/Makefile line 6

Quoted 6 lines
arch/mips/Makefile new file +6 -0
@@ -0,0 +1,51 @@
+CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -fno-merge-constants
+
+CPPFLAGS += -march=mips64 -P -EB -mno-abicalls
+CPPFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
+	    -Wno-uninitialized -Wno-format -Wno-main
+#CPPFLAGS += -save-temps

it's good thing to take 64-bit support into account from the beginning.

arch/mips/boot/entry.c line 3

Quoted 9 lines
arch/mips/boot/entry.c new file +3 -0
new file mode 100644
index 0000000..98d954e
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, [email protected].

Which part in this file belongs to Wolfgang? I don't see any, and recommend you to replace with yours.

Quoted 82 lines
arch/mips/boot/entry.c new file +76 -0
+ * 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
+ */
+
+#include<debug_ll.h>
+#include<common.h>
+#include<init.h>
+#include<asm-generic/memory_layout.h>
+
+#include<asm/io.h>
+
+#include<string.h>
+
+/* These symbols are generated by the linker */
+extern long __bss_start;
+extern long __bss_end;
+
+extern void start_barebox(void);
+
+/************************************************************************
+ *
+ * This is the first part of the initialization sequence: we are now
+ * running from ROM.
+ *
+ ************************************************************************
+ */
+
+void board_init_in_rom(void *rom, void *ram)
+{
+	int i;
+	int * a, *b;
+#define ROM_SIZE	512 * 1024
+
+	a = rom;
+	b = ram;
+
+	for (i = ROM_SIZE; i>  0; i-=sizeof(int)) {
+		*b = *a;
+		a++;
+		b++;
+	}
+}
+
+/************************************************************************
+ *
+ * This is the next part if the initialization sequence: we are now
+ * running from RAM and have a "normal" C environment, i. e. global
+ * data can be written, BSS has been cleared, the stack size in not
+ * that critical any more, etc.
+ *
+ ************************************************************************
+ */
+
+void board_init_in_ram()
+{
+	/* clear the BSS first */
+	memset(&__bss_start, 0x00,&__bss_end -&__bss_start);
+
+	/* Initialization complete - start the monitor */
+	start_barebox();
+}
arch/mips/boot/head.S new file +0 -0
new file mode 100644
index 0000000..f5712b8

arch/mips/boot/head.S line 5

Quoted 5 lines
arch/mips/boot/head.S new file +5 -0
@@ -0,0 +1,233 @@
+/*
+ * Startup Code for MIPS32 CPU-core
+ *
+ * Copyright (c) 2003	Wolfgang Denk<[email protected]>
+ * Further modifications by Antony Pavlov

Hmm, not really, and stopped reviewing here. I might be able to give a thorough review, but don't have any spare time these days.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#11 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

Quoted 20 lines · Shinya Kuribayashi
Quoted 7 lines · Antony Pavlov
arch/mips/Kconfig new file +0 -0
new file mode 100644
index 0000000..10c0fbb
@@ -0,0 +1,55 @@

[...]

Quoted 10 lines
arch/mips/Kconfig new file +9 -0
+source arch/mips/mach-qemu/Kconfig
+
+choice
+       prompt "Bring up type"
+
+       config MIPS_NATIVE_BRINGUP
+               bool "native"
+               help
+                  Barebox will act as a native bootloader. This includes
Quoted 8 lines

arch/mips/Kconfig

Quoted 5 lines

all the
+                  required initialization needed to bring up a piece of hardware.

arch/mips/Kconfig new file +2 -0
+
+endchoice

Native bringup / native bootloader should be replaced with something more appropriate or descriptive.

I think that there is no need of this option in initial mips support.

In my everyday practice with the barebox-like firmware I use two different type of firmware:
* firmware, burned to the ROM (native bringup), this is principal
modus vivendi for firmware;
* RAM-loadable firmware. This type of firmware is usable in case of
board damage or critical error of ROM firmware. Also RAM-loadable firmware usable for testing of new version of firmware.

I think it is desirable to add this parameter in the future.

Quoted 4 lines
Quoted 4 lines
arch/mips/boot/entry.c new file +0 -1
new file mode 100644
index 0000000..98d954e
--- /dev/null
Quoted 9 lines

arch/mips/boot/entry.c line 3

Quoted 5 lines

+++ b/arch/mips/boot/entry.c

arch/mips/boot/entry.c new file +3 -0
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, [email protected].

Which part in this file belongs to Wolfgang?  I don't see any, and recommend you to replace with yours.

Hmm. You are right.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

Re: [PATCH 2/2] Add MIPS arch support to barebox

In reply to Jean-Christophe PLAGNIOL-VILLARD

Thanks Jean for bringing up old stuff :-), and nice to see the first (workable) MIPS port of barebox this time, Antony.

Quoted 1 line
Quoted 1 line

Is it runnable at all?

Not at all, unfortunately.

Quoted 5 lines
Quoted 5 lines

I think, that Shinya's concepts can be used in the future, but they are very complex for initial mips support.

IMHO, the Shinya's code is redundant (> 200K ) --- initial support must be as small as possible.

I didn't care about code size, complexity, workable or not (ok, this is important) when I was working on it. What did care about is its boot design.Having a glance at your head.S, compute_offset part looks good. That's a part of what I have in mind, and implemented as ADR macro in my prototype.

I'll write a lot more some other day.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox