public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: nsekhar@ti•com (Sekhar Nori)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3 1/6] ARM: davinci: sram: ioremap the davinci_soc_info specified sram regions
Date: Thu, 4 Oct 2012 17:18:41 +0530	[thread overview]
Message-ID: <506D7799.2090307@ti.com> (raw)
In-Reply-To: <1349276133-26408-2-git-send-email-mporter@ti.com>

On 10/3/2012 8:25 PM, Matt Porter wrote:
> From: Ben Gardiner <bengardiner@nanometrics•ca>
> 
> The current davinci init sets up SRAM in iotables. There has been an observed
> failure to boot a da850 with 128K specified in the iotable.
> 
> Make the davinci sram allocator -- now based on RMK's consolidated SRAM
> support -- do an ioremap of the region specified by the entries in

The part about being based on RMK's consolidated SRAM support should be
dropped.

> davinci_soc_info before registering with gen_pool_add_virt().
> 
> This commit breaks runtime of davinci boards since the regions that
> the sram init is now trying to ioremap have been iomapped by their
> iotable entries. The iotable entries will be removed in the patches
> to come.

I would prefer merging 2/6 into this for this reason.

> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics•ca>
> [rebased to mainline as the consolidated SRAM support was dropped]
> Signed-off-by: Matt Porter <mporter@ti•com>
> ---
>  arch/arm/mach-davinci/sram.c |   17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
> index db0f778..0e8ca4f 100644
> --- a/arch/arm/mach-davinci/sram.c
> +++ b/arch/arm/mach-davinci/sram.c
> @@ -10,6 +10,7 @@
>   */
>  #include <linux/module.h>
>  #include <linux/init.h>
> +#include <linux/io.h>
>  #include <linux/genalloc.h>
>  
>  #include <mach/common.h>
> @@ -32,7 +33,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
>  		return NULL;
>  
>  	if (dma)
> -		*dma = dma_base + (vaddr - SRAM_VIRT);
> +		*dma = gen_pool_virt_to_phys(sram_pool, vaddr);
>  	return (void *)vaddr;
>  
>  }
> @@ -53,8 +54,10 @@ EXPORT_SYMBOL(sram_free);
>   */
>  static int __init sram_init(void)
>  {
> +	phys_addr_t phys = davinci_soc_info.sram_dma;
>  	unsigned len = davinci_soc_info.sram_len;
>  	int status = 0;
> +	void *addr;
>  
>  	if (len) {
>  		len = min_t(unsigned, len, SRAM_SIZE);
> @@ -62,8 +65,16 @@ static int __init sram_init(void)
>  		if (!sram_pool)
>  			status = -ENOMEM;
>  	}
> -	if (sram_pool)
> -		status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1);
> +
> +	if (sram_pool) {
> +		addr = ioremap(phys, len);
> +		if (!addr)
> +			return -ENOMEM;
> +		if((status = gen_pool_add_virt(sram_pool, (unsigned)addr,
> +					       phys, len, -1)))

Nit: prefer to set status outside of if().

Looks good otherwise. Thanks for reviving this.

Thanks,
Sekhar

  reply	other threads:[~2012-10-04 11:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03 14:55 [PATCH v3 0/6] uio_pruss cleanup and platform support Matt Porter
2012-10-03 14:55 ` [PATCH v3 1/6] ARM: davinci: sram: ioremap the davinci_soc_info specified sram regions Matt Porter
2012-10-04 11:48   ` Sekhar Nori [this message]
2012-10-04 12:49     ` Matt Porter
2012-10-03 14:55 ` [PATCH v3 2/6] ARM: davinci: da850-dm646x: remove the SRAM_VIRT iotable entry Matt Porter
2012-10-04 11:53   ` Sekhar Nori
2012-10-04 12:54     ` Matt Porter
2012-10-03 14:55 ` [PATCH v3 3/6] ARM: davinci: da850: changed SRAM allocator to shared ram Matt Porter
2012-10-04 11:57   ` Sekhar Nori
2012-10-04 12:56     ` Matt Porter
2012-10-04 20:39     ` Matt Porter
2012-10-03 14:55 ` [PATCH v3 4/6] ARM: davinci: add platform hook to fetch the SRAM pool Matt Porter
2012-10-03 14:55 ` [PATCH v3 5/6] ARM: davinci: Add support for PRUSS on DA850 Matt Porter
2012-10-04 12:22   ` Sekhar Nori
2012-10-04 13:08     ` Matt Porter
2012-10-04 16:35     ` Matt Porter
2012-10-05 10:30       ` Sekhar Nori
2012-10-03 14:55 ` [PATCH v3 6/6] uio: uio_pruss: replace private SRAM API with genalloc Matt Porter
2012-10-04  9:11 ` [PATCH v3 0/6] uio_pruss cleanup and platform support Philipp Zabel
2012-10-04 12:42   ` Matt Porter
2012-10-04 12:54     ` Sekhar Nori
2012-10-04 13:10       ` Matt Porter
2012-10-04 13:35     ` Philipp Zabel
2012-10-04 13:54       ` Matt Porter
2012-10-04 14:06         ` Philipp Zabel

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=506D7799.2090307@ti.com \
    --to=nsekhar@ti$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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