blob: e8cf5ea1526309760a91ef3b23f4a7722d6b6b02 [file] [log] [blame]
Eric Miao01215e32009-03-20 13:33:49 +08001/*
2 * linux/arch/arm/mach-mmp/ttc_dkb.c
3 *
4 * Support for the Marvell PXA910-based TTC_DKB Development Platform.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * publishhed by the Free Software Foundation.
9 */
10
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/platform_device.h>
Haojian Zhuangd6587c32009-09-23 01:57:35 +080014#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/onenand.h>
Haojian Zhuang0bd86962010-09-08 09:42:42 -040017#include <linux/interrupt.h>
Haojian Zhuange04eb142011-04-01 10:39:28 +080018#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h>
Chao Xief4466942012-05-07 11:24:00 +080020#include <linux/mfd/88pm860x.h>
Eric Miao01215e32009-03-20 13:33:49 +080021
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
Haojian Zhuangd6587c32009-09-23 01:57:35 +080024#include <asm/mach/flash.h>
Eric Miao01215e32009-03-20 13:33:49 +080025#include <mach/addr-map.h>
26#include <mach/mfp-pxa910.h>
27#include <mach/pxa910.h>
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080028#include <mach/irqs.h>
Eric Miao01215e32009-03-20 13:33:49 +080029
30#include "common.h"
31
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080032#define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080033 ((x < 16) ? x : 15)))
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080034#define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080035 ((x < 16) ? x : 15)))
36
37/*
38 * 16 board interrupts -- MAX7312 GPIO expander
39 * 16 board interrupts -- PCA9575 GPIO expander
40 * 24 board interrupts -- 88PM860x PMIC
41 */
Rob Herring8661fb92012-01-03 16:50:40 -060042#define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
Haojian Zhuang0bd86962010-09-08 09:42:42 -040043
Eric Miao01215e32009-03-20 13:33:49 +080044static unsigned long ttc_dkb_pin_config[] __initdata = {
45 /* UART2 */
46 GPIO47_UART2_RXD,
47 GPIO48_UART2_TXD,
Haojian Zhuangd6587c32009-09-23 01:57:35 +080048
49 /* DFI */
50 DF_IO0_ND_IO0,
51 DF_IO1_ND_IO1,
52 DF_IO2_ND_IO2,
53 DF_IO3_ND_IO3,
54 DF_IO4_ND_IO4,
55 DF_IO5_ND_IO5,
56 DF_IO6_ND_IO6,
57 DF_IO7_ND_IO7,
58 DF_IO8_ND_IO8,
59 DF_IO9_ND_IO9,
60 DF_IO10_ND_IO10,
61 DF_IO11_ND_IO11,
62 DF_IO12_ND_IO12,
63 DF_IO13_ND_IO13,
64 DF_IO14_ND_IO14,
65 DF_IO15_ND_IO15,
66 DF_nCS0_SM_nCS2_nCS0,
67 DF_ALE_SM_WEn_ND_ALE,
68 DF_CLE_SM_OEn_ND_CLE,
69 DF_WEn_DF_WEn,
70 DF_REn_DF_REn,
71 DF_RDY0_DF_RDY0,
72};
73
74static struct mtd_partition ttc_dkb_onenand_partitions[] = {
75 {
76 .name = "bootloader",
77 .offset = 0,
78 .size = SZ_1M,
79 .mask_flags = MTD_WRITEABLE,
80 }, {
81 .name = "reserved",
82 .offset = MTDPART_OFS_APPEND,
83 .size = SZ_128K,
84 .mask_flags = MTD_WRITEABLE,
85 }, {
86 .name = "reserved",
87 .offset = MTDPART_OFS_APPEND,
88 .size = SZ_8M,
89 .mask_flags = MTD_WRITEABLE,
90 }, {
91 .name = "kernel",
92 .offset = MTDPART_OFS_APPEND,
93 .size = (SZ_2M + SZ_1M),
94 .mask_flags = 0,
95 }, {
96 .name = "filesystem",
97 .offset = MTDPART_OFS_APPEND,
Stephen Boyd3f8e2882011-07-26 18:45:54 +010098 .size = SZ_32M + SZ_16M,
Haojian Zhuangd6587c32009-09-23 01:57:35 +080099 .mask_flags = 0,
100 }
101};
102
Haojian Zhuangd6223872009-11-20 10:57:16 -0500103static struct onenand_platform_data ttc_dkb_onenand_info = {
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800104 .parts = ttc_dkb_onenand_partitions,
105 .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
106};
107
108static struct resource ttc_dkb_resource_onenand[] = {
109 [0] = {
110 .start = SMC_CS0_PHYS_BASE,
111 .end = SMC_CS0_PHYS_BASE + SZ_1M,
112 .flags = IORESOURCE_MEM,
113 },
114};
115
116static struct platform_device ttc_dkb_device_onenand = {
117 .name = "onenand-flash",
118 .id = -1,
119 .resource = ttc_dkb_resource_onenand,
120 .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
121 .dev = {
122 .platform_data = &ttc_dkb_onenand_info,
123 },
124};
125
126static struct platform_device *ttc_dkb_devices[] = {
Haojian Zhuang157d2642011-10-17 20:37:52 +0800127 &pxa910_device_gpio,
Haojian Zhuang4128e272012-02-23 23:37:33 +0800128 &pxa910_device_rtc,
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800129 &ttc_dkb_device_onenand,
Eric Miao01215e32009-03-20 13:33:49 +0800130};
131
Haojian Zhuange04eb142011-04-01 10:39:28 +0800132static struct pca953x_platform_data max7312_data[] = {
133 {
134 .gpio_base = TTCDKB_GPIO_EXT0(0),
Rob Herring8661fb92012-01-03 16:50:40 -0600135 .irq_base = MMP_NR_IRQS,
Haojian Zhuange04eb142011-04-01 10:39:28 +0800136 },
137};
138
Chao Xief4466942012-05-07 11:24:00 +0800139static struct pm860x_platform_data ttc_dkb_pm8607_info = {
140 .irq_base = IRQ_BOARD_START,
141};
142
Haojian Zhuange04eb142011-04-01 10:39:28 +0800143static struct i2c_board_info ttc_dkb_i2c_info[] = {
144 {
Chao Xief4466942012-05-07 11:24:00 +0800145 .type = "88PM860x",
146 .addr = 0x34,
147 .platform_data = &ttc_dkb_pm8607_info,
148 .irq = IRQ_PXA910_PMIC_INT,
149 },
150 {
Haojian Zhuange04eb142011-04-01 10:39:28 +0800151 .type = "max7312",
152 .addr = 0x23,
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +0800153 .irq = MMP_GPIO_TO_IRQ(80),
Haojian Zhuange04eb142011-04-01 10:39:28 +0800154 .platform_data = &max7312_data,
155 },
156};
157
Eric Miao01215e32009-03-20 13:33:49 +0800158static void __init ttc_dkb_init(void)
159{
160 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
161
162 /* on-chip devices */
163 pxa910_add_uart(1);
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800164
165 /* off-chip devices */
Haojian Zhuange04eb142011-04-01 10:39:28 +0800166 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800167 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
Eric Miao01215e32009-03-20 13:33:49 +0800168}
169
170MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800171 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400172 .nr_irqs = TTCDKB_NR_IRQS,
Eric Miao01215e32009-03-20 13:33:49 +0800173 .init_irq = pxa910_init_irq,
174 .timer = &pxa910_timer,
175 .init_machine = ttc_dkb_init,
Russell King9854a382011-11-05 15:40:09 +0000176 .restart = mmp_restart,
Eric Miao01215e32009-03-20 13:33:49 +0800177MACHINE_END