~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to arch/arm/mach-ux500/board-mop500.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <linux/mfd/ab8500/gpio.h>
27
27
#include <linux/leds-lp5521.h>
28
28
#include <linux/input.h>
29
 
#include <linux/smsc911x.h>
30
29
#include <linux/gpio_keys.h>
 
30
#include <linux/delay.h>
31
31
 
32
 
#include <linux/leds.h>
33
32
#include <asm/mach-types.h>
34
33
#include <asm/mach/arch.h>
35
34
 
36
35
#include <plat/i2c.h>
37
36
#include <plat/ste_dma40.h>
 
37
#include <plat/pincfg.h>
38
38
 
39
39
#include <mach/hardware.h>
40
40
#include <mach/setup.h>
41
41
#include <mach/devices.h>
42
42
#include <mach/irqs.h>
43
43
 
 
44
#include "pins-db8500.h"
44
45
#include "ste-dma40-db8500.h"
45
46
#include "devices-db8500.h"
46
47
#include "board-mop500.h"
47
48
#include "board-mop500-regulators.h"
48
49
 
49
 
static struct gpio_led snowball_led_array[] = {
50
 
        {
51
 
                .name = "user_led",
52
 
                .default_trigger = "none",
53
 
                .gpio = 142,
54
 
        },
55
 
};
56
 
 
57
 
static struct gpio_led_platform_data snowball_led_data = {
58
 
        .leds = snowball_led_array,
59
 
        .num_leds = ARRAY_SIZE(snowball_led_array),
60
 
};
61
 
 
62
 
static struct platform_device snowball_led_dev = {
63
 
        .name = "leds-gpio",
64
 
        .dev = {
65
 
                .platform_data = &snowball_led_data,
66
 
        },
67
 
};
68
 
 
69
50
static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
70
51
        .gpio_base              = MOP500_AB8500_GPIO(0),
71
52
        .irq_base               = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
88
69
                                        0x7A, 0x00, 0x00},
89
70
};
90
71
 
91
 
static struct gpio_keys_button snowball_key_array[] = {
92
 
        {
93
 
                .gpio           = 32,
94
 
                .type           = EV_KEY,
95
 
                .code           = KEY_1,
96
 
                .desc           = "userpb",
97
 
                .active_low     = 1,
98
 
                .debounce_interval = 50,
99
 
                .wakeup         = 1,
100
 
        },
101
 
        {
102
 
                .gpio           = 151,
103
 
                .type           = EV_KEY,
104
 
                .code           = KEY_2,
105
 
                .desc           = "extkb1",
106
 
                .active_low     = 1,
107
 
                .debounce_interval = 50,
108
 
                .wakeup         = 1,
109
 
        },
110
 
        {
111
 
                .gpio           = 152,
112
 
                .type           = EV_KEY,
113
 
                .code           = KEY_3,
114
 
                .desc           = "extkb2",
115
 
                .active_low     = 1,
116
 
                .debounce_interval = 50,
117
 
                .wakeup         = 1,
118
 
        },
119
 
        {
120
 
                .gpio           = 161,
121
 
                .type           = EV_KEY,
122
 
                .code           = KEY_4,
123
 
                .desc           = "extkb3",
124
 
                .active_low     = 1,
125
 
                .debounce_interval = 50,
126
 
                .wakeup         = 1,
127
 
        },
128
 
        {
129
 
                .gpio           = 162,
130
 
                .type           = EV_KEY,
131
 
                .code           = KEY_5,
132
 
                .desc           = "extkb4",
133
 
                .active_low     = 1,
134
 
                .debounce_interval = 50,
135
 
                .wakeup         = 1,
136
 
        },
137
 
};
138
 
 
139
 
static struct gpio_keys_platform_data snowball_key_data = {
140
 
        .buttons        = snowball_key_array,
141
 
        .nbuttons       = ARRAY_SIZE(snowball_key_array),
142
 
};
143
 
 
144
 
static struct platform_device snowball_key_dev = {
145
 
        .name           = "gpio-keys",
146
 
        .id             = -1,
147
 
        .dev            = {
148
 
                .platform_data  = &snowball_key_data,
149
 
        }
150
 
};
151
 
 
152
 
static struct smsc911x_platform_config snowball_sbnet_cfg = {
153
 
        .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
154
 
        .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
155
 
        .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
156
 
        .shift = 1,
157
 
};
158
 
 
159
 
static struct resource sbnet_res[] = {
160
 
        {
161
 
                .name = "smsc911x-memory",
162
 
                .start = (0x5000 << 16),
163
 
                .end  =  (0x5000 << 16) + 0xffff,
164
 
                .flags = IORESOURCE_MEM,
165
 
        },
166
 
        {
167
 
                .start = NOMADIK_GPIO_TO_IRQ(140),
168
 
                .end = NOMADIK_GPIO_TO_IRQ(140),
169
 
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
170
 
        },
171
 
};
172
 
 
173
 
static struct platform_device snowball_sbnet_dev = {
174
 
        .name           = "smsc911x",
175
 
        .num_resources  = ARRAY_SIZE(sbnet_res),
176
 
        .resource       = sbnet_res,
177
 
        .dev            = {
178
 
                .platform_data = &snowball_sbnet_cfg,
179
 
        },
180
 
};
181
 
 
182
72
static struct ab8500_platform_data ab8500_platdata = {
183
73
        .irq_base       = MOP500_AB8500_IRQ_BASE,
184
74
        .regulator_reg_init = ab8500_regulator_reg_init,
405
295
}
406
296
 
407
297
/* add any platform devices here - TODO */
408
 
static struct platform_device *mop500_platform_devs[] __initdata = {
 
298
static struct platform_device *platform_devs[] __initdata = {
409
299
        &mop500_gpio_keys_device,
410
 
        &ab8500_device,
411
300
};
412
301
 
413
302
#ifdef CONFIG_STE_DMA40
507
396
};
508
397
#endif
509
398
 
 
399
 
 
400
static pin_cfg_t mop500_pins_uart0[] = {
 
401
        GPIO0_U0_CTSn   | PIN_INPUT_PULLUP,
 
402
        GPIO1_U0_RTSn   | PIN_OUTPUT_HIGH,
 
403
        GPIO2_U0_RXD    | PIN_INPUT_PULLUP,
 
404
        GPIO3_U0_TXD    | PIN_OUTPUT_HIGH,
 
405
};
 
406
 
 
407
#define PRCC_K_SOFTRST_SET      0x18
 
408
#define PRCC_K_SOFTRST_CLEAR    0x1C
 
409
static void ux500_uart0_reset(void)
 
410
{
 
411
        void __iomem *prcc_rst_set, *prcc_rst_clr;
 
412
 
 
413
        prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
 
414
                        PRCC_K_SOFTRST_SET);
 
415
        prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
 
416
                        PRCC_K_SOFTRST_CLEAR);
 
417
 
 
418
        /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
 
419
        writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
 
420
        udelay(1);
 
421
 
 
422
        /* Release soft reset PRCC_K_SOFTRST_SET */
 
423
        writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
 
424
        udelay(1);
 
425
}
 
426
 
 
427
static void ux500_uart0_init(void)
 
428
{
 
429
        int ret;
 
430
 
 
431
        ret = nmk_config_pins(mop500_pins_uart0,
 
432
                        ARRAY_SIZE(mop500_pins_uart0));
 
433
        if (ret < 0)
 
434
                pr_err("pl011: uart pins_enable failed\n");
 
435
}
 
436
 
 
437
static void ux500_uart0_exit(void)
 
438
{
 
439
        int ret;
 
440
 
 
441
        ret = nmk_config_pins_sleep(mop500_pins_uart0,
 
442
                        ARRAY_SIZE(mop500_pins_uart0));
 
443
        if (ret < 0)
 
444
                pr_err("pl011: uart pins_disable failed\n");
 
445
}
 
446
 
510
447
static struct amba_pl011_data uart0_plat = {
511
448
#ifdef CONFIG_STE_DMA40
512
449
        .dma_filter = stedma40_filter,
513
450
        .dma_rx_param = &uart0_dma_cfg_rx,
514
451
        .dma_tx_param = &uart0_dma_cfg_tx,
515
452
#endif
 
453
        .init = ux500_uart0_init,
 
454
        .exit = ux500_uart0_exit,
 
455
        .reset = ux500_uart0_reset,
516
456
};
517
457
 
518
458
static struct amba_pl011_data uart1_plat = {
538
478
        db8500_add_uart2(&uart2_plat);
539
479
}
540
480
 
541
 
static struct platform_device *snowball_platform_devs[] __initdata = {
542
 
        &snowball_led_dev,
543
 
        &snowball_key_dev,
544
 
        &snowball_sbnet_dev,
545
 
        &ab8500_device,
546
 
};
547
 
 
548
481
static void __init mop500_init_machine(void)
549
482
{
550
483
        int i2c0_devs;
554
487
         * all these GPIO pins to the internal GPIO controller
555
488
         * instead.
556
489
         */
557
 
        if (!machine_is_snowball()) {
558
 
                if (machine_is_hrefv60())
559
 
                        mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
560
 
                else
561
 
                        mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
562
 
        }
 
490
        if (machine_is_hrefv60())
 
491
                mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
 
492
        else
 
493
                mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
563
494
 
564
495
        u8500_init_devices();
565
496
 
566
497
        mop500_pins_init();
567
498
 
568
 
        if (machine_is_snowball())
569
 
                platform_add_devices(snowball_platform_devs,
570
 
                                        ARRAY_SIZE(snowball_platform_devs));
571
 
        else
572
 
                platform_add_devices(mop500_platform_devs,
573
 
                                        ARRAY_SIZE(mop500_platform_devs));
 
499
        platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
574
500
 
575
501
        mop500_i2c_init();
576
502
        mop500_sdi_init();
577
503
        mop500_spi_init();
578
504
        mop500_uart_init();
579
505
 
 
506
        platform_device_register(&ab8500_device);
 
507
 
580
508
        i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
581
509
        if (machine_is_hrefv60())
582
510
                i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
584
512
        i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
585
513
        i2c_register_board_info(2, mop500_i2c2_devices,
586
514
                                ARRAY_SIZE(mop500_i2c2_devices));
587
 
 
588
 
        /* This board has full regulator constraints */
589
 
        regulator_has_full_constraints();
590
515
}
591
516
 
592
517
MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
606
531
        .timer          = &ux500_timer,
607
532
        .init_machine   = mop500_init_machine,
608
533
MACHINE_END
609
 
 
610
 
MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
611
 
        .boot_params    = 0x100,
612
 
        .map_io         = u8500_map_io,
613
 
        .init_irq       = ux500_init_irq,
614
 
        /* we re-use nomadik timer here */
615
 
        .timer          = &ux500_timer,
616
 
        .init_machine   = mop500_init_machine,
617
 
MACHINE_END