All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: John Crispin <blogic@openwrt.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH 3/7] MIPS: ralink: add memory definition for RT305x
Date: Mon, 15 Apr 2013 15:29:42 +0400	[thread overview]
Message-ID: <516BE4A6.8010108@cogentembedded.com> (raw)
In-Reply-To: <1366022494-8355-3-git-send-email-blogic@openwrt.org>

Hello.

On 15-04-2013 14:41, John Crispin wrote:

> Populate struct soc_info with the data that describes our RAM window.

> As memory detection fails on RT5350 we read the amount of available memory
> from the system controller.

> Signed-off-by: John Crispin <blogic@openwrt.org>
> ---
>   arch/mips/include/asm/mach-ralink/rt305x.h |    6 ++++
>   arch/mips/ralink/rt305x.c                  |   45 ++++++++++++++++++++++++++++
>   2 files changed, 51 insertions(+)

> diff --git a/arch/mips/include/asm/mach-ralink/rt305x.h b/arch/mips/include/asm/mach-ralink/rt305x.h
> index 80cda8a..e68afef 100644
> --- a/arch/mips/include/asm/mach-ralink/rt305x.h
> +++ b/arch/mips/include/asm/mach-ralink/rt305x.h
> @@ -157,4 +157,10 @@ static inline int soc_is_rt5350(void)
>   #define RT3352_RSTCTRL_UDEV		BIT(25)
>   #define RT3352_SYSCFG1_USB0_HOST_MODE	BIT(10)
>
> +#define RT305X_SDRAM_BASE		0x00000000
> +#define RT305X_MEM_SIZE_MIN		(2 * 1024 * 1024)
> +#define RT305X_MEM_SIZE_MAX		(64 * 1024 * 1024)
> +#define RT3352_MEM_SIZE_MIN		(2 * 1024 * 1024)
> +#define RT3352_MEM_SIZE_MAX		(256 * 1024 * 1024)
> +
>   #endif
> diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
> index e9dbf8c..da85f10 100644
> --- a/arch/mips/ralink/rt305x.c
> +++ b/arch/mips/ralink/rt305x.c
> @@ -122,6 +122,40 @@ struct ralink_pinmux rt_gpio_pinmux = {
>   	.wdt_reset = rt305x_wdt_reset,
>   };
>
> +static unsigned long rt5350_get_mem_size(void)
> +{
> +	void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE);
> +	unsigned long ret;
> +	u32 t;
> +
> +	t = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG);
> +	t = (t >> RT5350_SYSCFG0_DRAM_SIZE_SHIFT) &
> +		RT5350_SYSCFG0_DRAM_SIZE_MASK;
> +
> +	switch (t) {
> +	case RT5350_SYSCFG0_DRAM_SIZE_2M:
> +		ret = 2 * 1024 * 1024;
> +		break;
> +	case RT5350_SYSCFG0_DRAM_SIZE_8M:
> +		ret = 8 * 1024 * 1024;
> +		break;
> +	case RT5350_SYSCFG0_DRAM_SIZE_16M:
> +		ret = 16 * 1024 * 1024;
> +		break;
> +	case RT5350_SYSCFG0_DRAM_SIZE_32M:
> +		ret = 32 * 1024 * 1024;
> +		break;
> +	case RT5350_SYSCFG0_DRAM_SIZE_64M:
> +		ret = 64 * 1024 * 1024;
> +		break;
> +	default:

    Maybe it's worth including <linux/sizes.h> as well?

WBR, Sergei

  reply	other threads:[~2013-04-15 11:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 10:41 [PATCH 1/7] MIPS: add detect_memory_region() John Crispin
2013-04-15 10:41 ` [PATCH 2/7] MIPS: ralink: add memory definition to struct ralink_soc_info John Crispin
2013-04-15 10:41 ` [PATCH 3/7] MIPS: ralink: add memory definition for RT305x John Crispin
2013-04-15 11:29   ` Sergei Shtylyov [this message]
2013-04-15 10:41 ` [PATCH 4/7] MIPS: ralink: add memory definition for RT2880 John Crispin
2013-04-15 10:41 ` [PATCH 5/7] MIPS: ralink: add memory definition for RT3883 John Crispin
2013-04-15 10:41 ` [PATCH 6/7] MIPS: ralink: add memory definition for MT7620 John Crispin
2013-04-15 10:41 ` [PATCH 7/7] MIPS: ralink: make use of the new memory detection code John Crispin
2013-04-15 11:26 ` [PATCH 1/7] MIPS: add detect_memory_region() Sergei Shtylyov

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=516BE4A6.8010108@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=blogic@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.