Skip to contentSkip to conversation

MIPS: unify CPU code in arch/mips/cpu/

PATCH Superseded Daniel Schwierzeck 1 participant 2 messages Jan 29, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: unify CPU code in arch/mips/cpu/

Unify and move code in arch/mips/cpu/mips[32|64]/ to arch/mips/cpu/. The CPU specific config.mk files need to remain until CONFIG_STANDALONE_LOAD_ADDR is converted to a global Kconfig symbol.

---
 arch/mips/Makefile                |   6 +-
 arch/mips/cpu/Makefile            |   9 ++
 arch/mips/cpu/cpu.c               |  38 +++++
 arch/mips/cpu/interrupts.c        |  22 +++
 arch/mips/cpu/mips32/Makefile     |   9 --
 arch/mips/cpu/mips32/cpu.c        |  34 ----
 arch/mips/cpu/mips32/interrupts.c |  22 ---
 arch/mips/cpu/mips32/start.S      | 320 --------------------------------------
 arch/mips/cpu/mips32/time.c       |  19 ---
 arch/mips/cpu/mips64/Makefile     |   9 --
 arch/mips/cpu/mips64/cpu.c        |  37 -----
 arch/mips/cpu/mips64/interrupts.c |  22 ---
 arch/mips/cpu/mips64/start.S      | 291 ----------------------------------
 arch/mips/cpu/mips64/time.c       |  19 ---
 arch/mips/cpu/start.S             | 320 ++++++++++++++++++++++++++++++++++++++
 arch/mips/cpu/time.c              |  19 +++
 16 files changed, 410 insertions(+), 786 deletions(-)
 create mode 100644 arch/mips/cpu/Makefile
 create mode 100644 arch/mips/cpu/cpu.c
 create mode 100644 arch/mips/cpu/interrupts.c
 delete mode 100644 arch/mips/cpu/mips32/Makefile
 delete mode 100644 arch/mips/cpu/mips32/cpu.c
 delete mode 100644 arch/mips/cpu/mips32/interrupts.c
 delete mode 100644 arch/mips/cpu/mips32/start.S
 delete mode 100644 arch/mips/cpu/mips32/time.c
 delete mode 100644 arch/mips/cpu/mips64/Makefile
 delete mode 100644 arch/mips/cpu/mips64/cpu.c
 delete mode 100644 arch/mips/cpu/mips64/interrupts.c
 delete mode 100644 arch/mips/cpu/mips64/start.S
 delete mode 100644 arch/mips/cpu/mips64/time.c
 create mode 100644 arch/mips/cpu/start.S
 create mode 100644 arch/mips/cpu/time.c
arch/mips/Makefile +2 -4
index ff01bfe..43f0f5c 100644
@@ -2,11 +2,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-head-$(CONFIG_CPU_MIPS32) := arch/mips/cpu/mips32/start.o
-head-$(CONFIG_CPU_MIPS64) := arch/mips/cpu/mips64/start.o
+head-y := arch/mips/cpu/start.o
 
-libs-$(CONFIG_CPU_MIPS32) += arch/mips/cpu/mips32/
-libs-$(CONFIG_CPU_MIPS64) += arch/mips/cpu/mips64/
+libs-y += arch/mips/cpu/
 libs-y += arch/mips/lib/
 
 libs-$(CONFIG_SOC_AU1X00) += arch/mips/mach-au1x00/
arch/mips/cpu/Makefile new file +9 -0
new file mode 100644
index 0000000..fc6b455
@@ -0,0 +1,9 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y	= start.o
+
+obj-y += time.o
+obj-y += interrupts.o
+obj-y += cpu.o
arch/mips/cpu/cpu.c new file +38 -0
new file mode 100644
index 0000000..8d3b2f5
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <netdev.h>
+#include <linux/compiler.h>
+#include <asm/mipsregs.h>
+#include <asm/reboot.h>
+
+void __weak _machine_restart(void)
+{
+	fprintf(stderr, "*** reset failed ***\n");
+
+	while (1)
+		/* NOP */;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	_machine_restart();
+
+	return 0;
+}
+
+void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
+{
+	write_c0_entrylo0(low0);
+	write_c0_pagemask(pagemask);
+	write_c0_entrylo1(low1);
+	write_c0_entryhi(hi);
+	write_c0_index(index);
+	tlb_write_indexed();
+}
arch/mips/cpu/interrupts.c new file +22 -0
new file mode 100644
index 0000000..275fcf5
@@ -0,0 +1,22 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+int interrupt_init(void)
+{
+	return 0;
+}
+
+void enable_interrupts(void)
+{
+}
+
+int disable_interrupts(void)
+{
+	return 0;
+}
arch/mips/cpu/mips32/Makefile deleted +0 -9
deleted file mode 100644
index cb4db9c..0000000
@@ -1,9 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-extra-y	= start.o
-obj-y	= cpu.o interrupts.o time.o
arch/mips/cpu/mips32/cpu.c deleted +0 -34
deleted file mode 100644
index 07deca8..0000000
@@ -1,34 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <netdev.h>
-#include <asm/mipsregs.h>
-#include <asm/reboot.h>
-
-void __attribute__((weak)) _machine_restart(void)
-{
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	_machine_restart();
-
-	fprintf(stderr, "*** reset failed ***\n");
-	return 0;
-}
-
-void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
-{
-	write_c0_entrylo0(low0);
-	write_c0_pagemask(pagemask);
-	write_c0_entrylo1(low1);
-	write_c0_entryhi(hi);
-	write_c0_index(index);
-	tlb_write_indexed();
-}
arch/mips/cpu/mips32/interrupts.c deleted +0 -22
deleted file mode 100644
index 275fcf5..0000000
@@ -1,22 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-
-int interrupt_init(void)
-{
-	return 0;
-}
-
-void enable_interrupts(void)
-{
-}
-
-int disable_interrupts(void)
-{
-	return 0;
-}
arch/mips/cpu/mips32/start.S deleted +0 -320

320 lines not on this page · raw message

arch/mips/cpu/mips32/time.c deleted +0 -19
deleted file mode 100644
index 553da5f..0000000
@@ -1,19 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, [email protected].
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/mipsregs.h>
-
-unsigned long notrace timer_read_counter(void)
-{
-	return read_c0_count();
-}
-
-ulong notrace get_tbclk(void)
-{
-	return CONFIG_SYS_MIPS_TIMER_FREQ;
-}
arch/mips/cpu/mips64/Makefile deleted +0 -9
deleted file mode 100644
index cb4db9c..0000000
@@ -1,9 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-extra-y	= start.o
-obj-y	= cpu.o interrupts.o time.o
arch/mips/cpu/mips64/cpu.c deleted +0 -37
deleted file mode 100644
index 1d32705..0000000
@@ -1,37 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <netdev.h>
-#include <asm/mipsregs.h>
-#include <asm/reboot.h>
-
-void __attribute__((weak)) _machine_restart(void)
-{
-	fprintf(stderr, "*** reset failed ***\n");
-
-	while (1)
-		/* NOP */;
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	_machine_restart();
-
-	return 0;
-}
-
-void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
-{
-	write_c0_entrylo0(low0);
-	write_c0_pagemask(pagemask);
-	write_c0_entrylo1(low1);
-	write_c0_entryhi(hi);
-	write_c0_index(index);
-	tlb_write_indexed();
-}
arch/mips/cpu/mips64/interrupts.c deleted +0 -22
deleted file mode 100644
index 275fcf5..0000000
@@ -1,22 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-
-int interrupt_init(void)
-{
-	return 0;
-}
-
-void enable_interrupts(void)
-{
-}
-
-int disable_interrupts(void)
-{
-	return 0;
-}
arch/mips/cpu/mips64/start.S deleted +0 -291

291 lines not on this page · raw message

arch/mips/cpu/mips64/time.c deleted +0 -19
deleted file mode 100644
index 553da5f..0000000
@@ -1,19 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, [email protected].
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/mipsregs.h>
-
-unsigned long notrace timer_read_counter(void)
-{
-	return read_c0_count();
-}
-
-ulong notrace get_tbclk(void)
-{
-	return CONFIG_SYS_MIPS_TIMER_FREQ;
-}
arch/mips/cpu/start.S new file +320 -0

320 lines not on this page · raw message

arch/mips/cpu/time.c new file +19 -0
new file mode 100644
index 0000000..553da5f
@@ -0,0 +1,19 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, [email protected].
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/mipsregs.h>
+
+unsigned long notrace timer_read_counter(void)
+{
+	return read_c0_count();
+}
+
+ulong notrace get_tbclk(void)
+{
+	return CONFIG_SYS_MIPS_TIMER_FREQ;
+}
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 MIPS: unify CPU code in arch/mips/cpu/

Unify and move code in arch/mips/cpu/mips[32|64]/ to arch/mips/cpu/. The CPU specific config.mk files need to remain until CONFIG_STANDALONE_LOAD_ADDR is converted to a global Kconfig symbol.

---
Changes for v2:
- resend with git rename detection enabled

---
 arch/mips/Makefile                      |   6 +-
 arch/mips/cpu/Makefile                  |   9 +
 arch/mips/cpu/{mips64 => }/cpu.c        |   3 +-
 arch/mips/cpu/{mips32 => }/interrupts.c |   0
 arch/mips/cpu/mips32/Makefile           |   9 -
 arch/mips/cpu/mips32/cpu.c              |  34 ----
 arch/mips/cpu/mips64/Makefile           |   9 -
 arch/mips/cpu/mips64/interrupts.c       |  22 ---
 arch/mips/cpu/mips64/start.S            | 291 --------------------------------
 arch/mips/cpu/mips64/time.c             |  19 ---
 arch/mips/cpu/{mips32 => }/start.S      |   0
 arch/mips/cpu/{mips32 => }/time.c       |   0
 12 files changed, 13 insertions(+), 389 deletions(-)
 create mode 100644 arch/mips/cpu/Makefile
 rename arch/mips/cpu/{mips64 => }/cpu.c (91%)
 rename arch/mips/cpu/{mips32 => }/interrupts.c (100%)
 delete mode 100644 arch/mips/cpu/mips32/Makefile
 delete mode 100644 arch/mips/cpu/mips32/cpu.c
 delete mode 100644 arch/mips/cpu/mips64/Makefile
 delete mode 100644 arch/mips/cpu/mips64/interrupts.c
 delete mode 100644 arch/mips/cpu/mips64/start.S
 delete mode 100644 arch/mips/cpu/mips64/time.c
 rename arch/mips/cpu/{mips32 => }/start.S (100%)
 rename arch/mips/cpu/{mips32 => }/time.c (100%)
arch/mips/Makefile +2 -4
index ff01bfe..43f0f5c 100644
@@ -2,11 +2,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-head-$(CONFIG_CPU_MIPS32) := arch/mips/cpu/mips32/start.o
-head-$(CONFIG_CPU_MIPS64) := arch/mips/cpu/mips64/start.o
+head-y := arch/mips/cpu/start.o
 
-libs-$(CONFIG_CPU_MIPS32) += arch/mips/cpu/mips32/
-libs-$(CONFIG_CPU_MIPS64) += arch/mips/cpu/mips64/
+libs-y += arch/mips/cpu/
 libs-y += arch/mips/lib/
 
 libs-$(CONFIG_SOC_AU1X00) += arch/mips/mach-au1x00/
arch/mips/cpu/Makefile new file +9 -0
new file mode 100644
index 0000000..fc6b455
@@ -0,0 +1,9 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y	= start.o
+
+obj-y += time.o
+obj-y += interrupts.o
+obj-y += cpu.o
arch/mips/cpu/cpu.c renamed from arch/mips/cpu/mips64/cpu.c +2 -1
similarity index 91%
rename from arch/mips/cpu/mips64/cpu.c
rename to arch/mips/cpu/cpu.c
index 1d32705..8d3b2f5 100644
@@ -8,10 +8,11 @@
 #include <common.h>
 #include <command.h>
 #include <netdev.h>
+#include <linux/compiler.h>
 #include <asm/mipsregs.h>
 #include <asm/reboot.h>
 
-void __attribute__((weak)) _machine_restart(void)
+void __weak _machine_restart(void)
 {
 	fprintf(stderr, "*** reset failed ***\n");
 
arch/mips/cpu/interrupts.c renamed from arch/mips/cpu/mips32/interrupts.c +0 -0
similarity index 100%
rename from arch/mips/cpu/mips32/interrupts.c
rename to arch/mips/cpu/interrupts.c
arch/mips/cpu/mips32/Makefile deleted +0 -9
deleted file mode 100644
index cb4db9c..0000000
@@ -1,9 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-extra-y	= start.o
-obj-y	= cpu.o interrupts.o time.o
arch/mips/cpu/mips32/cpu.c deleted +0 -34
deleted file mode 100644
index 07deca8..0000000
@@ -1,34 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <netdev.h>
-#include <asm/mipsregs.h>
-#include <asm/reboot.h>
-
-void __attribute__((weak)) _machine_restart(void)
-{
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	_machine_restart();
-
-	fprintf(stderr, "*** reset failed ***\n");
-	return 0;
-}
-
-void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
-{
-	write_c0_entrylo0(low0);
-	write_c0_pagemask(pagemask);
-	write_c0_entrylo1(low1);
-	write_c0_entryhi(hi);
-	write_c0_index(index);
-	tlb_write_indexed();
-}
arch/mips/cpu/mips64/Makefile deleted +0 -9
deleted file mode 100644
index cb4db9c..0000000
@@ -1,9 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-extra-y	= start.o
-obj-y	= cpu.o interrupts.o time.o
arch/mips/cpu/mips64/interrupts.c deleted +0 -22
deleted file mode 100644
index 275fcf5..0000000
@@ -1,22 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-
-int interrupt_init(void)
-{
-	return 0;
-}
-
-void enable_interrupts(void)
-{
-}
-
-int disable_interrupts(void)
-{
-	return 0;
-}
arch/mips/cpu/mips64/start.S deleted +0 -291

291 lines not on this page · raw message

arch/mips/cpu/mips64/time.c deleted +0 -19
deleted file mode 100644
index 553da5f..0000000
@@ -1,19 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, [email protected].
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/mipsregs.h>
-
-unsigned long notrace timer_read_counter(void)
-{
-	return read_c0_count();
-}
-
-ulong notrace get_tbclk(void)
-{
-	return CONFIG_SYS_MIPS_TIMER_FREQ;
-}
arch/mips/cpu/start.S renamed from arch/mips/cpu/mips32/start.S +0 -0
similarity index 100%
rename from arch/mips/cpu/mips32/start.S
rename to arch/mips/cpu/start.S
arch/mips/cpu/time.c renamed from arch/mips/cpu/mips32/time.c +0 -0
similarity index 100%
rename from arch/mips/cpu/mips32/time.c
rename to arch/mips/cpu/time.c
Signature · 1 line
1.9.1