devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: "devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org"
	<devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>,
	spear-devel <spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org>,
	"viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"sr-ynQEQJNshbs@public.gmane.org"
	<sr-ynQEQJNshbs@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH V2 5/7] ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture
Date: Thu, 29 Mar 2012 12:09:02 +0530	[thread overview]
Message-ID: <4F740386.2080509@st.com> (raw)
In-Reply-To: <201203281227.32299.arnd-r2nGTMty4D4@public.gmane.org>

On 3/28/2012 5:57 PM, Arnd Bergmann wrote:

Hi Arnd,

Thanks for reviewing. :)

All comments accepted.

> Does spear310-evb really connect all seven serial ports?

Yes, since it was an evaluation board, it contained all of them.

>> +/* Following will create static virtual/physical mappings */
>> > +struct map_desc spear3xx_io_desc[] __initdata = {
>> > +	{
>> > +		.virtual	= VA_SPEAR3XX_ICM1_UART_BASE,
>> > +		.pfn		= __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
>> > +		.length		= SZ_4K,
>> > +		.type		= MT_DEVICE
>> > +	}, {
>> > +		.virtual	= VA_SPEAR3XX_ML1_VIC_BASE,
>> > +		.pfn		= __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
>> > +		.length		= SZ_4K,
>> > +		.type		= MT_DEVICE
>> > +	}, {
>> > +		.virtual	= VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
>> > +		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
>> > +		.length		= SZ_4K,
>> > +		.type		= MT_DEVICE
>> > +	}, {
>> > +		.virtual	= VA_SPEAR3XX_ICM3_MISC_REG_BASE,
>> > +		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
>> > +		.length		= SZ_4K,
>> > +		.type		= MT_DEVICE
>> > +	},
>> > +};
> Note: there no real reason to just map 4K pages here, or to compute the
> virtual addresses using the IO_ADDRESS macro. Using larger mappings mean
> you have more efficient TLB lookup for any I/O windows that are located
> closely together.

Agreed.

> I would actually write this something like
> struct map_desc spear3xx_io_desc[] __initdata = {
> 	{
> 		.virtual = 0xf0000000,
> 		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
> 		.length	 = SZ_16M,
> 		.type	 = MT_DEVICE,
> 	}, {
> 		.virtual = 0xf1000000,
> 		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM4_BASE),
> 		.length  = 3 * SZ_16M,
> 		.type	 = MT_DEVICE,
> 	}, {
> 		.virtual = 0xf4000000,
> 		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_ML1_2_BASE),
> 		.length  = 2 * SZ_16M,
> 		.type	 = MT_DEVICE,
> 	}, {
> 		.virtual = 0xf6000000,
> 		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
> 		.length  = SZ_16M,
> 		.type	 = MT_DEVICE,
> 	},
> };
> 
> This would cover almost all of your devices with just seven TLB entries,
> and ioremap can now find the right virtual addresses automatically.

But there are few concerns.
Firstly, i wasn't aware that ioremap will reuse these mappings.
I believed that it will create new mappings and this is what i
saw till 2-6.37. What will happen if iounmap is called?

Over that, board would not be using all the devices present in SoC. So,
we don't really need to map everything. And so above wouldn't be valid
there.

To avoid holes, that were created in my original mappings, i can pick your
idea of dropping IO_ADDRESS() in .virtual field and use tightly aligned
virtual address for all peripherals.

Like: UART - 4K - 0xf0000000 - 0xf0001000
      SPI - 4K -  0xf0001000 - 0xf0002000

      ...

-- 
viresh

  parent reply	other threads:[~2012-03-29  6:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28  9:30 [PATCH V2 0/7] SPEAr DT support updates Viresh Kumar
2012-03-28  9:30 ` [PATCH V2 1/7] SPEAr: Use CLKDEV_INIT for defining clk_lookups Viresh Kumar
2012-03-28  9:30 ` [PATCH V2 2/7] SPEAr3xx: Add clock instance of usb hosts - ehci and ohci 0 and 1 Viresh Kumar
2012-03-28  9:30 ` [PATCH V2 3/7] SPEAr6xx: Add compilation support for dtbs using 'make dtbs' Viresh Kumar
2012-03-28  9:41 ` [PATCH V2 4/7] SPEAr3xx: Replace printk() with pr_*() Viresh Kumar
     [not found] ` <cover.1332926608.git.viresh.kumar-qxv4g6HH51o@public.gmane.org>
2012-03-28  9:41   ` [PATCH V2 5/7] ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture Viresh Kumar
     [not found]     ` <f4ad79023c6155d4de7e87c3cd798aadd493454e.1332926608.git.viresh.kumar-qxv4g6HH51o@public.gmane.org>
2012-03-28 12:27       ` Arnd Bergmann
     [not found]         ` <201203281227.32299.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-29  6:39           ` Viresh Kumar [this message]
     [not found]             ` <4F740386.2080509-qxv4g6HH51o@public.gmane.org>
2012-03-29  7:53               ` Arnd Bergmann
     [not found]                 ` <201203290753.04758.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-29 10:44                   ` Viresh Kumar
2012-03-28  9:41 ` [PATCH V2 6/7] SPEAr: Add PL080 DMA support for 3xx and 6xx Viresh Kumar
2012-03-28  9:41 ` [PATCH V2 7/7] SPEAr: Update defconfigs Viresh Kumar

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=4F740386.2080509@st.com \
    --to=viresh.kumar-qxv4g6hh51o@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org \
    --cc=sr-ynQEQJNshbs@public.gmane.org \
    --cc=viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).