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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <linux/leds-lp5521.h>
28
28
#include <linux/input.h>
29
29
#include <linux/gpio_keys.h>
 
30
#include <linux/delay.h>
30
31
 
31
32
#include <asm/mach-types.h>
32
33
#include <asm/mach/arch.h>
33
34
 
34
35
#include <plat/i2c.h>
35
36
#include <plat/ste_dma40.h>
 
37
#include <plat/pincfg.h>
36
38
 
37
39
#include <mach/hardware.h>
38
40
#include <mach/setup.h>
39
41
#include <mach/devices.h>
40
42
#include <mach/irqs.h>
41
43
 
 
44
#include "pins-db8500.h"
42
45
#include "ste-dma40-db8500.h"
43
46
#include "devices-db8500.h"
44
47
#include "board-mop500.h"
52
55
         * on value present in GpioSel1 to GpioSel6 and AlternatFunction
53
56
         * register. This is the array of 7 configuration settings.
54
57
         * One has to compile time decide these settings. Below is the
55
 
         * explaination of these setting
 
58
         * explanation of these setting
56
59
         * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
57
60
         * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
58
61
         * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
204
207
        },
205
208
};
206
209
 
207
 
#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
 
210
#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm)    \
208
211
static struct nmk_i2c_controller u8500_i2c##id##_data = { \
209
212
        /*                              \
210
213
         * slave data setup time, which is      \
219
222
        .rft            = _rft,         \
220
223
        /* std. mode operation */       \
221
224
        .clk_freq       = clk,          \
 
225
        /* Slave response timeout(ms) */\
 
226
        .timeout        = t_out,        \
222
227
        .sm             = _sm,          \
223
228
}
224
229
 
225
230
/*
226
231
 * The board uses 4 i2c controllers, initialize all of
227
232
 * them with slave data setup time of 250 ns,
228
 
 * Tx & Rx FIFO threshold values as 1 and standard
 
233
 * Tx & Rx FIFO threshold values as 8 and standard
229
234
 * mode of operation
230
235
 */
231
 
U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
232
 
U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
233
 
U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
234
 
U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
 
236
U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
 
237
U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
 
238
U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
 
239
U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
235
240
 
236
241
static void __init mop500_i2c_init(void)
237
242
{
391
396
};
392
397
#endif
393
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
 
394
447
static struct amba_pl011_data uart0_plat = {
395
448
#ifdef CONFIG_STE_DMA40
396
449
        .dma_filter = stedma40_filter,
397
450
        .dma_rx_param = &uart0_dma_cfg_rx,
398
451
        .dma_tx_param = &uart0_dma_cfg_tx,
399
452
#endif
 
453
        .init = ux500_uart0_init,
 
454
        .exit = ux500_uart0_exit,
 
455
        .reset = ux500_uart0_reset,
400
456
};
401
457
 
402
458
static struct amba_pl011_data uart1_plat = {