mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Chris Zankel <chris@zankel.net>
Cc: "Piet Delaney" <piet@tensilica.com>,
	linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	"Daniel Glöckner" <dg@emlix.com>
Subject: [patch 2/2] xtensa: support dma_alloc_coherent on s6000
Date: Thu, 26 Mar 2009 14:14:06 +0100	[thread overview]
Message-ID: <1238073246-23753-2-git-send-email-dg@emlix.com> (raw)
In-Reply-To: <1238073246-23753-1-git-send-email-dg@emlix.com>

The s6000 core is a nommu variant but there is additional hardware that
mirrors the first 512MB of RAM at another address, which is made uncached
by the boot loader.

This patch uses that RAM mirror to provide support for dma_alloc_coherent.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 arch/xtensa/variants/s6000/Makefile           |    2 +-
 arch/xtensa/variants/s6000/uncached-mapping.c |   46 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletions(-)
 create mode 100644 arch/xtensa/variants/s6000/uncached-mapping.c

diff --git a/arch/xtensa/variants/s6000/Makefile b/arch/xtensa/variants/s6000/Makefile
index 5f1429d..408c4fe 100644
--- a/arch/xtensa/variants/s6000/Makefile
+++ b/arch/xtensa/variants/s6000/Makefile
@@ -1,3 +1,3 @@
 # s6000 Makefile
 
-obj-y		+= irq.o gpio.o dmac.o isef.o
+obj-y		+= irq.o gpio.o dmac.o isef.o uncached-mapping.o
diff --git a/arch/xtensa/variants/s6000/uncached-mapping.c b/arch/xtensa/variants/s6000/uncached-mapping.c
new file mode 100644
index 0000000..10dfdf1
--- /dev/null
+++ b/arch/xtensa/variants/s6000/uncached-mapping.c
@@ -0,0 +1,46 @@
+/*
+ * arch/xtensa/variant/s6000/uncached-mapping.c
+ *
+ * address translation between cached and uncached regions
+ *
+ * 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.
+ *
+ * Copyright (C) 2009 emlix GmbH
+ *
+ * Daniel Gloeckner <dg@emlix.com>
+ */
+
+#include <asm/page.h>
+#include <asm/uncached-mapping.h>
+
+#define AREA_START_C	0x40000000
+#define AREA_START_UC	0x00000000
+#define AREA_SIZE	0x20000000
+
+unsigned long variant_uncacheable_pages(unsigned long page)
+{
+	const unsigned long start_page = AREA_START_C >> PAGE_SHIFT;
+	const unsigned long end_page = (AREA_START_C + AREA_SIZE) >> PAGE_SHIFT;
+	if (page < start_page || page > end_page)
+		return 0;
+	return end_page - page;
+}
+
+void *variant_map_uncached(void *addr, unsigned long size)
+{
+	if ((unsigned long)addr < AREA_START_C ||
+	    (unsigned long)addr > AREA_START_C + AREA_SIZE)
+		return 0;
+	return addr - AREA_START_C + AREA_START_UC;
+}
+
+void *variant_unmap_uncached(void *addr, unsigned long size)
+{
+	if ((unsigned long)addr < AREA_START_UC ||
+	    (unsigned long)addr > AREA_START_UC + AREA_SIZE)
+		return 0;
+	return addr - AREA_START_UC + AREA_START_C;
+}
-- 
1.6.2.107.ge47ee


      reply	other threads:[~2009-03-26 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 13:14 [patch 1/2] xtensa: use DMA zone to manage coherent dma memory Daniel Glöckner
2009-03-26 13:14 ` Daniel Glöckner [this message]

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=1238073246-23753-2-git-send-email-dg@emlix.com \
    --to=dg@emlix.com \
    --cc=chris@zankel.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=piet@tensilica.com \
    /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

all inboxes | Powered by JetHome®