2 * Texas Instruments TNETV107X EVM Board Support
4 * Copyright (C) 2010 Texas Instruments
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/console.h>
18 #include <linux/dma-mapping.h>
19 #include <linux/interrupt.h>
20 #include <linux/gpio.h>
21 #include <linux/delay.h>
22 #include <linux/platform_device.h>
23 #include <linux/ratelimit.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/partitions.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach-types.h>
29 #include <mach/irqs.h>
30 #include <mach/edma.h>
32 #include <mach/cp_intc.h>
33 #include <mach/tnetv107x.h>
35 #define EVM_MMC_WP_GPIO 21
36 #define EVM_MMC_CD_GPIO 24
38 static int initialize_gpio(int gpio
, char *desc
)
42 ret
= gpio_request(gpio
, desc
);
44 pr_err_ratelimited("cannot open %s gpio\n", desc
);
47 gpio_direction_input(gpio
);
51 static int mmc_get_cd(int index
)
56 gpio
= initialize_gpio(EVM_MMC_CD_GPIO
, "mmc card detect");
61 return gpio_get_value(gpio
) ? 0 : 1;
64 static int mmc_get_ro(int index
)
69 gpio
= initialize_gpio(EVM_MMC_WP_GPIO
, "mmc write protect");
74 return gpio_get_value(gpio
) ? 1 : 0;
77 static struct davinci_mmc_config mmc_config
= {
82 .caps
= MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
,
83 .version
= MMC_CTLR_VERSION_1
,
86 static const short sdio1_pins
[] __initdata
= {
87 TNETV107X_SDIO1_CLK_1
, TNETV107X_SDIO1_CMD_1
,
88 TNETV107X_SDIO1_DATA0_1
, TNETV107X_SDIO1_DATA1_1
,
89 TNETV107X_SDIO1_DATA2_1
, TNETV107X_SDIO1_DATA3_1
,
90 TNETV107X_GPIO21
, TNETV107X_GPIO24
,
94 static const short uart1_pins
[] __initdata
= {
95 TNETV107X_UART1_RD
, TNETV107X_UART1_TD
,
99 static struct mtd_partition nand_partitions
[] = {
100 /* bootloader (U-Boot, etc) in first 12 sectors */
102 .name
= "bootloader",
104 .size
= (12*SZ_128K
),
105 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
107 /* bootloader params in the next sector */
110 .offset
= MTDPART_OFS_NXTBLK
,
112 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
117 .offset
= MTDPART_OFS_NXTBLK
,
123 .name
= "filesystem",
124 .offset
= MTDPART_OFS_NXTBLK
,
125 .size
= MTDPART_SIZ_FULL
,
130 static struct davinci_nand_pdata nand_config
= {
133 .parts
= nand_partitions
,
134 .nr_parts
= ARRAY_SIZE(nand_partitions
),
135 .ecc_mode
= NAND_ECC_HW
,
136 .options
= NAND_USE_FLASH_BBT
,
140 static struct davinci_uart_config serial_config __initconst
= {
141 .enabled_uarts
= BIT(1),
144 static struct tnetv107x_device_info evm_device_info __initconst
= {
145 .serial_config
= &serial_config
,
146 .mmc_config
[1] = &mmc_config
, /* controller 1 */
147 .nand_config
[0] = &nand_config
, /* chip select 0 */
150 static __init
void tnetv107x_evm_board_init(void)
152 davinci_cfg_reg_list(sdio1_pins
);
153 davinci_cfg_reg_list(uart1_pins
);
155 tnetv107x_devices_init(&evm_device_info
);
158 #ifdef CONFIG_SERIAL_8250_CONSOLE
159 static int __init
tnetv107x_evm_console_init(void)
161 return add_preferred_console("ttyS", 0, "115200");
163 console_initcall(tnetv107x_evm_console_init
);
166 MACHINE_START(TNETV107X
, "TNETV107X EVM")
167 .phys_io
= TNETV107X_IO_BASE
,
168 .io_pg_offst
= (TNETV107X_IO_VIRT
>> 18) & 0xfffc,
169 .boot_params
= (TNETV107X_DDR_BASE
+ 0x100),
170 .map_io
= tnetv107x_init
,
171 .init_irq
= cp_intc_init
,
172 .timer
= &davinci_timer
,
173 .init_machine
= tnetv107x_evm_board_init
,