From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: CSR: Adding CSR SiRFprimaII board support
Date: Fri, 1 Jul 2011 18:19:43 +0200 [thread overview]
Message-ID: <201107011819.43316.arnd@arndb.de> (raw)
In-Reply-To: <BANLkTikoMu3ccUxj5KRmKzdReQcBqK4Y9Q@mail.gmail.com>
On Friday 01 July 2011, Barry Song wrote:
> It looks like we can new a common function named as of_io_earlymap()
> or something in drivers/of/address.c. of_iomap() does ioremap,
> of_io_earlymap() does early static mapping?
> Then all SoCs can call this function to do early static mapping. if
> so, some lines can be deleted in sirfsoc_of_clk_init(). How do you
> think about newing the function in drivers/of/address.c?
I think that's a good idea, but the ARM specific implementation cannot
be in common code. Other architectures have stuff similar to iotable_init
in asm/fixmap.h. If we decide on a function prototype for this, the
implementation can be arch/*/.
How about this:
extern void of_set_fixmap(struct device_node *np, int index,
unsigned long of_fixmap_offset, pgprot_t flags);
> For DEBUG_LL uart, i have moved the static mapping to a new file named
> lluart.c too:
> +#include <linux/kernel.h>
> +#include <asm/page.h>
> +#include <asm/mach/map.h>
> +#include <mach/map.h>
> +#include <mach/uart.h>
> +
> +void __init sirfsoc_map_lluart(void)
> +{
> + struct map_desc sirfsoc_lluart_map = {
> + .virtual = SIRFSOC_UART1_VA_BASE,
> + .pfn = __phys_to_pfn(SIRFSOC_UART1_PA_BASE),
> + .length = SIRFSOC_UART1_SIZE,
> + .type = MT_DEVICE,
> + };
> +
> + iotable_init(&sirfsoc_lluart_map, 1);
> +}
> +
>
> only when DEBUG_LL is selected, this file will be compiled. Otherwise,
> an empty sirfsoc_map_lluart is used:
Ok, sounds good.
> +/* TODO:
> + * add APIs to control reset of every module
> + */
Hmm, how about this: You enumerate every bit in the reset registers, and
then add a device tree property to the devices where this is needed containing
the number. Then you just need a simple interface like
void sirfsoc_reset_device(struct device *dev)
{
int len, i;
unsigned int *reset_bits = of_get_property(dev->of_node, "reset-bit", &len);
for (i = 0; i<len/4; i++)
sirfsoc_reset_line(reset_bits[i]);
}
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include "common.h"
> +
> +static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
> + { .compatible = "simple-bus", },
> + {},
> +};
> +
> +void __init sirfsoc_mach_init(void)
> +{
> + of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
> +}
> +
> +static const char *prima2cb_dt_match[] __initdata = {
> + "sirf,prima2-cb",
> + NULL
> +};
> +
> +MACHINE_START(PRIMA2_EVB, "prima2cb")
> + .boot_params = 0x00000100,
> + .init_early = sirfsoc_of_clk_init,
> + .map_io = sirfsoc_map_lluart,
> + .init_irq = sirfsoc_of_irq_init,
> + .timer = &sirfsoc_timer,
> + .init_machine = sirfsoc_mach_init,
> + .dt_compat = prima2cb_dt_match,
> +MACHINE_END
Very nice!
Arnd
next prev parent reply other threads:[~2011-07-01 16:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-28 3:32 [PATCH v2] ARM: CSR: Adding CSR SiRFprimaII board support Barry Song
2011-06-29 21:29 ` Arnd Bergmann
2011-06-30 3:39 ` Barry Song
2011-06-30 7:19 ` Barry Song
2011-06-30 10:36 ` Arnd Bergmann
2011-06-30 15:03 ` Rob Herring
2011-07-01 0:04 ` Barry Song
2011-07-01 16:26 ` Arnd Bergmann
2011-07-04 14:59 ` Grant Likely
2011-07-01 6:20 ` Barry Song
2011-07-01 16:19 ` Arnd Bergmann [this message]
2011-07-02 12:25 ` Russell King - ARM Linux
2011-07-02 19:34 ` Arnd Bergmann
2011-07-04 2:55 ` Barry Song
2011-07-04 14:53 ` Arnd Bergmann
2011-07-05 1:32 ` Barry Song
2011-07-05 11:10 ` Arnd Bergmann
2011-07-05 8:34 ` Barry Song
2011-07-06 2:10 ` Barry Song
2011-07-06 5:30 ` Grant Likely
2011-07-06 5:58 ` Barry Song
2011-07-06 6:01 ` Barry Song
2011-07-06 6:28 ` Grant Likely
2011-07-06 7:03 ` Barry Song
2011-07-06 7:40 ` Arnd Bergmann
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=201107011819.43316.arnd@arndb.de \
--to=arnd@arndb.de \
--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).