mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [RFC, EXPERIMENTAL] MIPS: add initial cache support
Date: Tue, 28 May 2013 08:15:06 +0200	[thread overview]
Message-ID: <20130528061506.GR32299@pengutronix.de> (raw)
In-Reply-To: <1369392445-30230-1-git-send-email-antonynpavlov@gmail.com>

Hi Antony,

On Fri, May 24, 2013 at 02:47:25PM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  arch/mips/include/asm/cache.h    |    8 +
>  arch/mips/include/asm/cacheops.h |   78 +++++++
>  arch/mips/include/asm/cpu-info.h |    1 +
>  arch/mips/include/asm/io.h       |   66 ++++++
>  arch/mips/include/asm/r4kcache.h |  443 ++++++++++++++++++++++++++++++++++++++
>  arch/mips/lib/Makefile           |    1 +
>  arch/mips/lib/c-r4k.c            |   97 +++++++++
>  arch/mips/lib/dma.c              |   27 +++
>  include/linux/const.h            |   24 +++
>  9 files changed, 745 insertions(+)
>  create mode 100644 arch/mips/include/asm/cache.h
>  create mode 100644 arch/mips/include/asm/cacheops.h
>  create mode 100644 arch/mips/include/asm/r4kcache.h
>  create mode 100644 arch/mips/lib/dma.c
>  create mode 100644 include/linux/const.h
> 
> diff --git a/arch/mips/lib/dma.c b/arch/mips/lib/dma.c
> new file mode 100644
> index 0000000..0ca53f1
> --- /dev/null
> +++ b/arch/mips/lib/dma.c
> @@ -0,0 +1,27 @@
> +#include <common.h>
> +#include <asm/io.h>
> +#include <asm/mipsregs.h>
> +#include <malloc.h>
> +
> +static inline void __iomem *ioremap_nocache(phys_t offset, unsigned long size)
> +{
> +	return (void __iomem *) (unsigned long)CKSEG1ADDR(offset);
> +}
> +
> +void *dma_alloc_coherent(size_t size)
> +{
> +	void *ret;
> +
> +	ret = xmemalign(4096, size);
> +
> +	dma_inv_range((unsigned long)ret, (unsigned long)ret + size);

Is this needed? I mean you return the corresponding CKSEG1ADDR anyway
which should be coherent memory.

> +
> +	ret = ioremap_nocache((phys_t)ret, size);
> +
> +	return ret;
> +}
> +
> +void dma_free_coherent(void *mem, size_t size)
> +{
> +	free(mem);
> +}

I would expect to invalidate the cache here instead.

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-05-28  6:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 10:47 Antony Pavlov
2013-05-28  6:15 ` Sascha Hauer [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=20130528061506.GR32299@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.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