Blame view

arch/arm/mach-mmp/ttc_dkb.c 3.72 KB
01215e35c   Eric Miao   [ARM] pxa: add ba...
1
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   *  linux/arch/arm/mach-mmp/ttc_dkb.c
   *
   *  Support for the Marvell PXA910-based TTC_DKB Development Platform.
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License version 2 as
   *  publishhed by the Free Software Foundation.
   */
  
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/platform_device.h>
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
14
15
16
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
  #include <linux/mtd/onenand.h>
0bd869611   Haojian Zhuang   ARM: mmp: support...
17
  #include <linux/interrupt.h>
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
18
19
  #include <linux/i2c/pca953x.h>
  #include <linux/gpio.h>
01215e35c   Eric Miao   [ARM] pxa: add ba...
20
21
22
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
23
  #include <asm/mach/flash.h>
01215e35c   Eric Miao   [ARM] pxa: add ba...
24
25
26
  #include <mach/addr-map.h>
  #include <mach/mfp-pxa910.h>
  #include <mach/pxa910.h>
1a8d5fab1   Haojian Zhuang   ARM: pxa: rename ...
27
  #include <mach/irqs.h>
01215e35c   Eric Miao   [ARM] pxa: add ba...
28
29
  
  #include "common.h"
1a8d5fab1   Haojian Zhuang   ARM: pxa: rename ...
30
  #define TTCDKB_GPIO_EXT0(x)	(MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 :	\
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
31
  				((x < 16) ? x : 15)))
1a8d5fab1   Haojian Zhuang   ARM: pxa: rename ...
32
  #define TTCDKB_GPIO_EXT1(x)	(MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
33
34
35
36
37
38
39
40
  				((x < 16) ? x : 15)))
  
  /*
   * 16 board interrupts -- MAX7312 GPIO expander
   * 16 board interrupts -- PCA9575 GPIO expander
   * 24 board interrupts -- 88PM860x PMIC
   */
  #define TTCDKB_NR_IRQS		(IRQ_BOARD_START + 16 + 16 + 24)
0bd869611   Haojian Zhuang   ARM: mmp: support...
41

01215e35c   Eric Miao   [ARM] pxa: add ba...
42
43
44
45
  static unsigned long ttc_dkb_pin_config[] __initdata = {
  	/* UART2 */
  	GPIO47_UART2_RXD,
  	GPIO48_UART2_TXD,
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  
  	/* DFI */
  	DF_IO0_ND_IO0,
  	DF_IO1_ND_IO1,
  	DF_IO2_ND_IO2,
  	DF_IO3_ND_IO3,
  	DF_IO4_ND_IO4,
  	DF_IO5_ND_IO5,
  	DF_IO6_ND_IO6,
  	DF_IO7_ND_IO7,
  	DF_IO8_ND_IO8,
  	DF_IO9_ND_IO9,
  	DF_IO10_ND_IO10,
  	DF_IO11_ND_IO11,
  	DF_IO12_ND_IO12,
  	DF_IO13_ND_IO13,
  	DF_IO14_ND_IO14,
  	DF_IO15_ND_IO15,
  	DF_nCS0_SM_nCS2_nCS0,
  	DF_ALE_SM_WEn_ND_ALE,
  	DF_CLE_SM_OEn_ND_CLE,
  	DF_WEn_DF_WEn,
  	DF_REn_DF_REn,
  	DF_RDY0_DF_RDY0,
  };
  
  static struct mtd_partition ttc_dkb_onenand_partitions[] = {
  	{
  		.name		= "bootloader",
  		.offset		= 0,
  		.size		= SZ_1M,
  		.mask_flags	= MTD_WRITEABLE,
  	}, {
  		.name		= "reserved",
  		.offset		= MTDPART_OFS_APPEND,
  		.size		= SZ_128K,
  		.mask_flags	= MTD_WRITEABLE,
  	}, {
  		.name		= "reserved",
  		.offset		= MTDPART_OFS_APPEND,
  		.size		= SZ_8M,
  		.mask_flags	= MTD_WRITEABLE,
  	}, {
  		.name		= "kernel",
  		.offset		= MTDPART_OFS_APPEND,
  		.size		= (SZ_2M + SZ_1M),
  		.mask_flags	= 0,
  	}, {
  		.name		= "filesystem",
  		.offset		= MTDPART_OFS_APPEND,
3f8e28803   Stephen Boyd   ARM: 7006/1: Migr...
96
  		.size		= SZ_32M + SZ_16M,
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
97
98
99
  		.mask_flags	= 0,
  	}
  };
d62238711   Haojian Zhuang   [ARM] pxa: update...
100
  static struct onenand_platform_data ttc_dkb_onenand_info = {
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  	.parts		= ttc_dkb_onenand_partitions,
  	.nr_parts	= ARRAY_SIZE(ttc_dkb_onenand_partitions),
  };
  
  static struct resource ttc_dkb_resource_onenand[] = {
  	[0] = {
  		.start	= SMC_CS0_PHYS_BASE,
  		.end	= SMC_CS0_PHYS_BASE + SZ_1M,
  		.flags	= IORESOURCE_MEM,
  	},
  };
  
  static struct platform_device ttc_dkb_device_onenand = {
  	.name		= "onenand-flash",
  	.id		= -1,
  	.resource	= ttc_dkb_resource_onenand,
  	.num_resources	= ARRAY_SIZE(ttc_dkb_resource_onenand),
  	.dev		= {
  		.platform_data	= &ttc_dkb_onenand_info,
  	},
  };
  
  static struct platform_device *ttc_dkb_devices[] = {
157d2644c   Haojian Zhuang   ARM: pxa: change ...
124
  	&pxa910_device_gpio,
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
125
  	&ttc_dkb_device_onenand,
01215e35c   Eric Miao   [ARM] pxa: add ba...
126
  };
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
127
128
129
130
131
132
133
134
135
136
137
  static struct pca953x_platform_data max7312_data[] = {
  	{
  		.gpio_base	= TTCDKB_GPIO_EXT0(0),
  		.irq_base	= IRQ_BOARD_START,
  	},
  };
  
  static struct i2c_board_info ttc_dkb_i2c_info[] = {
  	{
  		.type		= "max7312",
  		.addr		= 0x23,
1a8d5fab1   Haojian Zhuang   ARM: pxa: rename ...
138
  		.irq		= MMP_GPIO_TO_IRQ(80),
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
139
140
141
  		.platform_data	= &max7312_data,
  	},
  };
01215e35c   Eric Miao   [ARM] pxa: add ba...
142
143
144
145
146
147
  static void __init ttc_dkb_init(void)
  {
  	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
  
  	/* on-chip devices */
  	pxa910_add_uart(1);
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
148
149
  
  	/* off-chip devices */
e04eb14fd   Haojian Zhuang   ARM: mmp/dkb: ena...
150
  	pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
d6587c34a   Haojian Zhuang   [ARM] pxa: add on...
151
  	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
01215e35c   Eric Miao   [ARM] pxa: add ba...
152
153
154
  }
  
  MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
8022887cd   Eric Miao   [ARM] mmp: rename...
155
  	.map_io		= mmp_map_io,
0bd869611   Haojian Zhuang   ARM: mmp: support...
156
  	.nr_irqs	= TTCDKB_NR_IRQS,
01215e35c   Eric Miao   [ARM] pxa: add ba...
157
158
159
  	.init_irq       = pxa910_init_irq,
  	.timer          = &pxa910_timer,
  	.init_machine   = ttc_dkb_init,
9854a38e3   Russell King   ARM: restart: mmp...
160
  	.restart	= mmp_restart,
01215e35c   Eric Miao   [ARM] pxa: add ba...
161
  MACHINE_END