From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/10] arm: zynq: Load scu baseaddress at run time
Date: Tue, 26 Mar 2013 07:28:09 -0500 [thread overview]
Message-ID: <51519459.5090005@gmail.com> (raw)
In-Reply-To: <51517C43.20303@monstr.eu>
On 03/26/2013 05:45 AM, Michal Simek wrote:
> On 03/25/2013 11:34 PM, Rob Herring wrote:
>> On 03/25/2013 11:07 AM, Michal Simek wrote:
>>> 2013/3/25 Rob Herring <robherring2@gmail.com>:
>>>> On 03/25/2013 09:51 AM, Michal Simek wrote:
>>>>> Hi Rob,
>>>>>
>>>>> 2013/3/25 Rob Herring <robherring2@gmail.com>:
>>>>>> On 03/25/2013 08:53 AM, Michal Simek wrote:
>>>>>>> Use Cortex a9 cp15 to read scu baseaddress.
>>>>
>>>> [...]
>>>>
>>>>>>> +static void __init scu_init(void)
>>>>>>> +{
>>>>>>> + unsigned long base;
>>>>>>> +
>>>>>>> + base = scu_a9_get_base();
>>>>>>> + zynq_cortex_a9_scu_map.pfn = __phys_to_pfn(base);
>>>>>>> + zynq_cortex_a9_scu_map.virtual = base;
>>>>>>
>>>>>> You are setting the virtual address to the physical base?
>>>>>>
>>>>>>> + iotable_init(&zynq_cortex_a9_scu_map, 1);
>>>>>>
>>>>>> Then creating a static mapping...
>>>>>>
>>>>>>> + scu_base = ioremap(base, zynq_cortex_a9_scu_map.length);
>>>>>>
>>>>>> And also a dynamic mapping?
>>>>>
>>>>> Yes - exactly.
>>>>
>>>> You are simply getting lucky that it works. If the physical address did
>>>> not happen to be in the vmalloc address region, it would not work. You
>>>> should not do this because you have an implicit requirement and the
>>>> code
>>>> will look broken to anyone that reads it.
>>>
>>> yeah correct. I will add there a comment to mentioned that.
>>
>> I think leaving the define would be better, but either way is fine.
>
> ok. From my point of view is better to keep scu where it is and any
> early vmalloc
> allocator will be really helpful. Because there is also early map
> for early console where virtual addresses are hardcoded.
> It will be just easier to ask generic code to return base if if you request
> for size.
>
> static unsigned long iomapstart = VMALLOC_END;
>
> unsigned long get_iomap_virtbase(unsigned long size)
> {
> iomapstart -= size;
> return iomapstart;
> }
It wouldn't be so simple with page/section alignment requirements and such.
> Something like this will be helpful and then instead of setup virtual
> addresses for every static io mapping just to call this function
> and you will get mapping correct all the time.
If you use DT for core count, then you don't need the static mapping and
can use ioremap (or of_iomap).
Rob
next prev parent reply other threads:[~2013-03-26 12:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 13:53 [PATCH 01/10] arm: zynq: Use standard timer binding Michal Simek
2013-03-25 13:53 ` [PATCH 02/10] arm: zynq: Move timer to clocksource interface Michal Simek
2013-03-25 13:53 ` [PATCH 03/10] arm: zynq: Move timer to generic location Michal Simek
2013-03-25 16:01 ` Steffen Trumtrar
2013-03-25 16:24 ` Michal Simek
2013-03-25 13:53 ` [PATCH 04/10] arm: zynq: Load scu baseaddress at run time Michal Simek
2013-03-25 14:06 ` Rob Herring
2013-03-25 14:51 ` Michal Simek
2013-03-25 15:37 ` Rob Herring
2013-03-25 16:07 ` Michal Simek
2013-03-25 22:34 ` Rob Herring
2013-03-26 10:45 ` Michal Simek
2013-03-26 12:28 ` Rob Herring [this message]
2013-03-26 12:33 ` Michal Simek
2013-04-02 16:40 ` Pawel Moll
[not found] ` <CAHTX3dKD4G0E8qoxTR2HnJVdagoeOerM+TiZzkJUPjcGwYdX_Q@mail.gmail.com>
2013-04-03 7:25 ` Steffen Trumtrar
2013-04-03 16:06 ` Pawel Moll
[not found] ` <CAHTX3dJMpp+E2u-cAeYbqtxC1WAYWpCeRx6W7G=dWDcgzUz5DA@mail.gmail.com>
2013-04-03 17:11 ` Pawel Moll
2013-03-25 13:53 ` [PATCH 05/10] arm: zynq: Move slcr initialization to separate file Michal Simek
2013-03-25 16:19 ` Steffen Trumtrar
2013-03-25 16:37 ` Michal Simek
2013-03-25 13:53 ` [PATCH 06/10] arm: zynq: Add support for system reset Michal Simek
2013-03-25 13:53 ` [PATCH 07/10] arm: zynq: Add support for pmu Michal Simek
2013-03-25 13:53 ` [PATCH 08/10] arm: zynq: Add smp support Michal Simek
2013-03-25 14:16 ` Rob Herring
2013-03-25 16:31 ` Michal Simek
2013-03-25 22:10 ` Rob Herring
2013-03-26 7:42 ` Michal Simek
2013-04-01 22:40 ` Rob Herring
2013-04-03 6:44 ` Michal Simek
2013-03-25 13:53 ` [PATCH 09/10] arm: zynq: Add hotplug support Michal Simek
2013-03-25 13:53 ` [PATCH 10/10] arm: zynq: Add cpuidle support Michal Simek
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=51519459.5090005@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).