linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yannick GICQUEL <yannick.gicquel@open.eurogiciel.org>
To: linux-m68k@vger.kernel.org
Subject: [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
Date: Wed,  8 Jul 2015 11:51:28 +0200	[thread overview]
Message-ID: <1436349092-2214-5-git-send-email-yannick.gicquel@gmail.com> (raw)
In-Reply-To: <1436349092-2214-1-git-send-email-yannick.gicquel@gmail.com>

This is same code as currently present in m54xx.c file which
was initially integrated in 88be3515.
This is not very elegant because of source code duplication
but this do the job.

Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
 arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c
index 98a13cc..5924a21 100644
--- a/arch/m68k/coldfire/m5441x.c
+++ b/arch/m68k/coldfire/m5441x.c
@@ -16,6 +16,13 @@
 #include <asm/mcfdma.h>
 #include <asm/mcfclk.h>
 
+#ifdef CONFIG_MMU
+#include <linux/mm.h>
+#include <linux/bootmem.h>
+#include <asm/pgalloc.h>
+#include <asm/mmu_context.h>
+#endif
+
 DEFINE_CLK(0, "flexbus", 2, MCF_CLK);
 DEFINE_CLK(0, "mcfcan.0", 8, MCF_CLK);
 DEFINE_CLK(0, "mcfcan.1", 9, MCF_CLK);
@@ -215,8 +222,48 @@ static void __init m5441x_fec_init(void)
 	__raw_writeb(0x03, MCFGPIO_PAR_FEC);
 }
 
+
+#ifdef CONFIG_MMU
+
+unsigned long num_pages;
+
+static void __init mcf54xx_bootmem_alloc(void)
+{
+	unsigned long start_pfn;
+	unsigned long memstart;
+
+	/* _rambase and _ramend will be naturally page aligned */
+	m68k_memory[0].addr = _rambase;
+	m68k_memory[0].size = _ramend - _rambase;
+
+	/* compute total pages in system */
+	num_pages = (_ramend - _rambase) >> PAGE_SHIFT;
+
+	/* page numbers */
+	memstart = PAGE_ALIGN(_ramstart);
+	min_low_pfn = _rambase >> PAGE_SHIFT;
+	start_pfn = memstart >> PAGE_SHIFT;
+	max_low_pfn = _ramend >> PAGE_SHIFT;
+	high_memory = (void *)_ramend;
+
+	m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
+	module_fixup(NULL, __start_fixup, __stop_fixup);
+
+	/* setup bootmem data */
+	m68k_setup_node(0);
+	memstart += init_bootmem_node(NODE_DATA(0), start_pfn,
+		min_low_pfn, max_low_pfn);
+	free_bootmem_node(NODE_DATA(0), memstart, _ramend - memstart);
+}
+#endif /* CONFIG_MMU */
+
+
 void __init config_BSP(char *commandp, int size)
 {
+#ifdef CONFIG_MMU
+	mcf54xx_bootmem_alloc();
+	mmu_context_init();
+#endif
 	m5441x_clk_init();
 	mach_sched_init = hw_timer_init;
 	m5441x_uarts_init();
-- 
1.9.1.286.g5172cb3

  parent reply	other threads:[~2015-07-08  9:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08  9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
2015-07-08  9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
2015-07-08 13:36   ` Greg Ungerer
2015-07-17 10:46     ` Yannick GICQUEL
2015-07-08 14:03   ` Geert Uytterhoeven
2015-07-08 14:12     ` Greg Ungerer
2015-07-08 14:20       ` Geert Uytterhoeven
2015-07-08  9:51 ` [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU Yannick GICQUEL
2015-07-08 14:04   ` Geert Uytterhoeven
2015-07-08  9:51 ` [RFC 3/8] m68k: add dummy dump_fpu() when FPU is not present Yannick GICQUEL
2015-07-08  9:51 ` Yannick GICQUEL [this message]
2015-07-08 13:45   ` [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code Greg Ungerer
2015-07-08  9:51 ` [RFC 5/8] m68k: m5441x: fix ACR0 base address when MBAR is not present Yannick GICQUEL
2015-07-08  9:51 ` [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space Yannick GICQUEL
2015-07-08 13:53   ` Greg Ungerer
2015-07-17 10:47     ` Yannick GICQUEL
2015-07-08  9:51 ` [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch() Yannick GICQUEL
2015-07-08 14:03   ` Greg Ungerer
2015-07-08  9:51 ` [RFC 8/8] m68k: uImage generation support Yannick GICQUEL
2015-07-08 14:07 ` [RFC 0/8] m5441x: mmu support patchset Greg Ungerer
2015-07-17 10:30   ` Yannick GICQUEL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436349092-2214-5-git-send-email-yannick.gicquel@gmail.com \
    --to=yannick.gicquel@open.eurogiciel.org \
    --cc=linux-m68k@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).