blackfin architecture
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / blackfin / mach-bf561 / boards / ezkit.c
1 /*
2 * File: arch/blackfin/mach-bf561/ezkit.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/spi/spi.h>
33 #include <asm/irq.h>
34 #include <asm/bfin5xx_spi.h>
35
36 /*
37 * Name the Board for the /proc/cpuinfo
38 */
39 char *bfin_board_name = "ADDS-BF561-EZKIT";
40
41 /*
42 * USB-LAN EzExtender board
43 * Driver needs to know address, irq and flag pin.
44 */
45 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
46 static struct resource smc91x_resources[] = {
47 {
48 .name = "smc91x-regs",
49 .start = 0x2C010300,
50 .end = 0x2C010300 + 16,
51 .flags = IORESOURCE_MEM,
52 },{
53
54 .start = IRQ_PF9,
55 .end = IRQ_PF9,
56 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
57 },
58 };
59
60 static struct platform_device smc91x_device = {
61 .name = "smc91x",
62 .id = 0,
63 .num_resources = ARRAY_SIZE(smc91x_resources),
64 .resource = smc91x_resources,
65 };
66 #endif
67
68 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
69 static struct resource bfin_uart_resources[] = {
70 {
71 .start = 0xFFC00400,
72 .end = 0xFFC004FF,
73 .flags = IORESOURCE_MEM,
74 },
75 };
76
77 static struct platform_device bfin_uart_device = {
78 .name = "bfin-uart",
79 .id = 1,
80 .num_resources = ARRAY_SIZE(bfin_uart_resources),
81 .resource = bfin_uart_resources,
82 };
83 #endif
84
85 #ifdef CONFIG_SPI_BFIN
86 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
87 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
88 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
89 .enable_dma = 0,
90 .bits_per_word = 16,
91 };
92 #endif
93 #endif
94
95 /* SPI controller data */
96 static struct bfin5xx_spi_master spi_bfin_master_info = {
97 .num_chipselect = 8,
98 .enable_dma = 1, /* master has the ability to do dma transfer */
99 };
100
101 static struct platform_device spi_bfin_master_device = {
102 .name = "bfin-spi-master",
103 .id = 1, /* Bus number */
104 .dev = {
105 .platform_data = &spi_bfin_master_info, /* Passed to driver */
106 },
107 };
108
109 static struct spi_board_info bfin_spi_board_info[] __initdata = {
110 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
111 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
112 {
113 .modalias = "ad1836-spi",
114 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
115 .bus_num = 1,
116 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
117 .controller_data = &ad1836_spi_chip_info,
118 },
119 #endif
120 };
121
122 static struct platform_device *ezkit_devices[] __initdata = {
123 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
124 &smc91x_device,
125 #endif
126 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
127 &spi_bfin_master_device,
128 #endif
129 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
130 &bfin_uart_device,
131 #endif
132 };
133
134 static int __init ezkit_init(void)
135 {
136 int ret;
137
138 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
139 ret = platform_add_devices(ezkit_devices,
140 ARRAY_SIZE(ezkit_devices));
141 if (ret < 0)
142 return ret;
143 return spi_register_board_info(bfin_spi_board_info,
144 ARRAY_SIZE(bfin_spi_board_info));
145 }
146
147 arch_initcall(ezkit_init);