summaryrefslogtreecommitdiff
path: root/src/mainboard/google/gale/mmu.c
diff options
context:
space:
mode:
authorVaradarajan Narayanan <varada@codeaurora.org>2016-03-02 13:15:47 +0530
committerPatrick Georgi <pgeorgi@google.com>2016-05-10 21:36:49 +0200
commit3bbd90173a9486b057aeb484ad5538b6e6cf42c7 (patch)
tree128ba6c8b2999294980b623a24870234bb77afa1 /src/mainboard/google/gale/mmu.c
parentdc17d2de346008aa648aab626dd2a8593b082685 (diff)
google/gale: Initial commit for Gale board support
Copy 'storm' files as a template BUG=chrome-os-partner:49249 TEST=None. Initial code. Not sure if it will even compile BRANCH=none Original-Commit-Id: 4bfabf22cb33ac2aacff0ebeed54655664505148 Original-Change-Id: I94e361911b89c5159b99f3d00efbcda94f763e71 Original-Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org> Original-Signed-off-by: Kan Yan <kyan@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/333177 Original-Commit-Ready: David Hendricks <dhendrix@chromium.org> Original-Tested-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> squashed: google/gale: Remove unwanted config option 2016.02 doesn't seem to like CONSOLE_CBMEM_DUMP_TO_UART BUG=chrome-os-partner:49249 TEST=None. Initial code not sure if it will even compile BRANCH=none Original-Commit-Id: 44b91a8f83515936156206f9f273e0e5c62c3f17 Original-Change-Id: I9294ff602a05e4c9573fee3b9b51f9cc5305e192 Original-Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org> Original-Reviewed-on: https://chromium-review.googlesource.com/333302 Original-Commit-Ready: David Hendricks <dhendrix@chromium.org> Original-Tested-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> google/gale: Update ipq806x/storm references Since the files were taken from ipq806x/storm as template. Update those references to reflect ipq40xx/gale. BUG=chrome-os-partner:49249 TEST=None. Initial code not sure if it will even compile BRANCH=none Original-Commit-Id: fa5962b757dbb6cc9e1e6d1e33e1e09ec6cb4cd2 Original-Change-Id: Ia330367a0547ac4306ef2514dc1305e2d65f80e4 Original-Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org> Original-Reviewed-on: https://chromium-review.googlesource.com/333292 Original-Commit-Ready: David Hendricks <dhendrix@chromium.org> Original-Tested-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> google/gale: Update fill_lb_gpios for new scheme This updates fill_lb_gpios to follow the new scheme introduced in CL:337176. BUG=none BRANCH=none TEST=chromeos.c compiles successfully for gale Original-Commit-Id: 635d7fd71d91552bd7470faeb5637ba1a727f940 Original-Change-Id: I6f98325918b350645b9c19b71125bc12a54953ab Original-Signed-off-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/338651 google/gale: Add '.fmd' file BUG=chrome-os-partner:49249 TEST=None. Initial code. Not sure if it will even compile BRANCH=none Original-Commit-Id: 474de31f7ed0adbe54251ca363e685019091b4e7 Original-Change-Id: I4019b110af676090e8751b315dadc5b601a56178 Original-Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org> Original-Reviewed-on: https://chromium-review.googlesource.com/333291 Original-Commit-Ready: David Hendricks <dhendrix@chromium.org> Original-Tested-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Change-Id: Iad8e010371f3b9b92ab26eee4ba35c4f16d3732c Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/14642 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/mainboard/google/gale/mmu.c')
-rw-r--r--src/mainboard/google/gale/mmu.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/mainboard/google/gale/mmu.c b/src/mainboard/google/gale/mmu.c
new file mode 100644
index 0000000000..4d2e9a0123
--- /dev/null
+++ b/src/mainboard/google/gale/mmu.c
@@ -0,0 +1,68 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include <arch/cache.h>
+#include <symbols.h>
+#include "mmu.h"
+
+/* convenient shorthand (in MB) */
+#define RPM_START ((uintptr_t)_rpm / KiB)
+#define RPM_END ((uintptr_t)_erpm / KiB)
+#define RPM_SIZE (RPM_END - RPM_START)
+#define SRAM_START ((uintptr_t)_sram / KiB)
+#define SRAM_END ((uintptr_t)_esram / KiB)
+#define DRAM_START ((uintptr_t)_dram / MiB)
+#define DRAM_SIZE (CONFIG_DRAM_SIZE_MB)
+#define DRAM_END (DRAM_START + DRAM_SIZE)
+
+/* DMA memory for drivers */
+#define DMA_START ((uintptr_t)_dma_coherent / MiB)
+#define DMA_SIZE (_dma_coherent_size / MiB)
+
+void setup_dram_mappings(enum dram_state dram)
+{
+ if (dram == DRAM_INITIALIZED) {
+ mmu_config_range(DRAM_START, DRAM_SIZE, DCACHE_WRITEBACK);
+ /* Map DMA memory */
+ mmu_config_range(DMA_START, DMA_SIZE, DCACHE_OFF);
+ } else {
+ mmu_disable_range(DRAM_START, DRAM_SIZE);
+ /* Map DMA memory */
+ mmu_disable_range(DMA_START, DMA_SIZE);
+ }
+}
+
+void setup_mmu(enum dram_state dram)
+{
+ dcache_mmu_disable();
+
+ /* start with mapping everything as strongly ordered. */
+ mmu_config_range(0, 4096, DCACHE_OFF);
+
+ /* Map Device memory. */
+ mmu_config_range_kb(RPM_START, RPM_SIZE, DCACHE_OFF);
+
+ mmu_config_range_kb(SRAM_START, SRAM_END - SRAM_START,
+ DCACHE_WRITEBACK);
+
+ /* Map DRAM memory */
+ setup_dram_mappings(dram);
+
+ mmu_disable_range(DRAM_END, 4096 - DRAM_END);
+
+ /* disable Page 0 for trapping NULL pointer references. */
+ mmu_disable_range_kb(0, 1);
+
+ mmu_init();
+
+ dcache_mmu_enable();
+}