~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to arch/arm/mach-at91/at91sam9260.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <asm/mach/arch.h>
18
18
#include <asm/mach/map.h>
19
19
#include <mach/cpu.h>
 
20
#include <mach/at91_dbgu.h>
20
21
#include <mach/at91sam9260.h>
21
22
#include <mach/at91_pmc.h>
22
23
#include <mach/at91_rstc.h>
23
24
#include <mach/at91_shdwc.h>
24
25
 
 
26
#include "soc.h"
25
27
#include "generic.h"
26
28
#include "clock.h"
27
29
 
28
 
static struct map_desc at91sam9260_io_desc[] __initdata = {
29
 
        {
30
 
                .virtual        = AT91_VA_BASE_SYS,
31
 
                .pfn            = __phys_to_pfn(AT91_BASE_SYS),
32
 
                .length         = SZ_16K,
33
 
                .type           = MT_DEVICE,
34
 
        }
35
 
};
36
 
 
37
 
static struct map_desc at91sam9260_sram_desc[] __initdata = {
38
 
        {
39
 
                .virtual        = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE,
40
 
                .pfn            = __phys_to_pfn(AT91SAM9260_SRAM0_BASE),
41
 
                .length         = AT91SAM9260_SRAM0_SIZE,
42
 
                .type           = MT_DEVICE,
43
 
        }, {
44
 
                .virtual        = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE - AT91SAM9260_SRAM1_SIZE,
45
 
                .pfn            = __phys_to_pfn(AT91SAM9260_SRAM1_BASE),
46
 
                .length         = AT91SAM9260_SRAM1_SIZE,
47
 
                .type           = MT_DEVICE,
48
 
        }
49
 
};
50
 
 
51
 
static struct map_desc at91sam9g20_sram_desc[] __initdata = {
52
 
        {
53
 
                .virtual        = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE,
54
 
                .pfn            = __phys_to_pfn(AT91SAM9G20_SRAM0_BASE),
55
 
                .length         = AT91SAM9G20_SRAM0_SIZE,
56
 
                .type           = MT_DEVICE,
57
 
        }, {
58
 
                .virtual        = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE - AT91SAM9G20_SRAM1_SIZE,
59
 
                .pfn            = __phys_to_pfn(AT91SAM9G20_SRAM1_BASE),
60
 
                .length         = AT91SAM9G20_SRAM1_SIZE,
61
 
                .type           = MT_DEVICE,
62
 
        }
63
 
};
64
 
 
65
 
static struct map_desc at91sam9xe_sram_desc[] __initdata = {
66
 
        {
67
 
                .pfn            = __phys_to_pfn(AT91SAM9XE_SRAM_BASE),
68
 
                .type           = MT_DEVICE,
69
 
        }
70
 
};
71
 
 
72
30
/* --------------------------------------------------------------------
73
31
 *  Clocks
74
32
 * -------------------------------------------------------------------- */
241
199
        CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
242
200
        CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
243
201
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
 
202
        /* more usart lookup table for DT entries */
 
203
        CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
 
204
        CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
 
205
        CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk),
 
206
        CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk),
 
207
        CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
 
208
        CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
 
209
        CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
 
210
        /* fake hclk clock */
 
211
        CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
244
212
};
245
213
 
246
214
static struct clk_lookup usart_clocks_lookups[] = {
330
298
 
331
299
static void __init at91sam9xe_map_io(void)
332
300
{
333
 
        unsigned long cidr, sram_size;
334
 
 
335
 
        cidr = at91_sys_read(AT91_DBGU_CIDR);
336
 
 
337
 
        switch (cidr & AT91_CIDR_SRAMSIZ) {
 
301
        unsigned long sram_size;
 
302
 
 
303
        switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) {
338
304
                case AT91_CIDR_SRAMSIZ_32K:
339
305
                        sram_size = 2 * SZ_16K;
340
306
                        break;
343
309
                        sram_size = SZ_16K;
344
310
        }
345
311
 
346
 
        at91sam9xe_sram_desc->virtual = AT91_IO_VIRT_BASE - sram_size;
347
 
        at91sam9xe_sram_desc->length = sram_size;
348
 
 
349
 
        iotable_init(at91sam9xe_sram_desc, ARRAY_SIZE(at91sam9xe_sram_desc));
 
312
        at91_init_sram(0, AT91SAM9XE_SRAM_BASE, sram_size);
350
313
}
351
314
 
352
 
void __init at91sam9260_map_io(void)
 
315
static void __init at91sam9260_map_io(void)
353
316
{
354
 
        /* Map peripherals */
355
 
        iotable_init(at91sam9260_io_desc, ARRAY_SIZE(at91sam9260_io_desc));
356
 
 
357
 
        if (cpu_is_at91sam9xe())
 
317
        if (cpu_is_at91sam9xe()) {
358
318
                at91sam9xe_map_io();
359
 
        else if (cpu_is_at91sam9g20())
360
 
                iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc));
361
 
        else
362
 
                iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
 
319
        } else if (cpu_is_at91sam9g20()) {
 
320
                at91_init_sram(0, AT91SAM9G20_SRAM0_BASE, AT91SAM9G20_SRAM0_SIZE);
 
321
                at91_init_sram(1, AT91SAM9G20_SRAM1_BASE, AT91SAM9G20_SRAM1_SIZE);
 
322
        } else {
 
323
                at91_init_sram(0, AT91SAM9260_SRAM0_BASE, AT91SAM9260_SRAM0_SIZE);
 
324
                at91_init_sram(1, AT91SAM9260_SRAM1_BASE, AT91SAM9260_SRAM1_SIZE);
 
325
        }
363
326
}
364
327
 
365
 
void __init at91sam9260_initialize(unsigned long main_clock)
 
328
static void __init at91sam9260_initialize(void)
366
329
{
367
330
        at91_arch_reset = at91sam9_alt_reset;
368
331
        pm_power_off = at91sam9260_poweroff;
369
332
        at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
370
333
                        | (1 << AT91SAM9260_ID_IRQ2);
371
334
 
372
 
        /* Init clock subsystem */
373
 
        at91_clock_init(main_clock);
374
 
 
375
 
        /* Register the processor-specific clocks */
376
 
        at91sam9260_register_clocks();
377
 
 
378
335
        /* Register GPIO subsystem */
379
336
        at91_gpio_init(at91sam9260_gpio, 3);
380
337
}
421
378
        0,      /* Advanced Interrupt Controller */
422
379
};
423
380
 
424
 
void __init at91sam9260_init_interrupts(unsigned int priority[NR_AIC_IRQS])
425
 
{
426
 
        if (!priority)
427
 
                priority = at91sam9260_default_irq_priority;
428
 
 
429
 
        /* Initialize the AIC interrupt controller */
430
 
        at91_aic_init(priority);
431
 
 
432
 
        /* Enable GPIO interrupts */
433
 
        at91_gpio_irq_setup();
434
 
}
 
381
struct at91_init_soc __initdata at91sam9260_soc = {
 
382
        .map_io = at91sam9260_map_io,
 
383
        .default_irq_priority = at91sam9260_default_irq_priority,
 
384
        .register_clocks = at91sam9260_register_clocks,
 
385
        .init = at91sam9260_initialize,
 
386
};