Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 1 | /* |
| 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 Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 14 | #include <linux/mtd/mtd.h> |
| 15 | #include <linux/mtd/partitions.h> |
| 16 | #include <linux/mtd/onenand.h> |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 18 | #include <linux/i2c/pca953x.h> |
| 19 | #include <linux/gpio.h> |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 20 | |
| 21 | #include <asm/mach-types.h> |
| 22 | #include <asm/mach/arch.h> |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 23 | #include <asm/mach/flash.h> |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 24 | #include <mach/addr-map.h> |
| 25 | #include <mach/mfp-pxa910.h> |
| 26 | #include <mach/pxa910.h> |
Haojian Zhuang | 1a8d5fa | 2011-11-08 14:15:59 +0800 | [diff] [blame] | 27 | #include <mach/irqs.h> |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 28 | |
| 29 | #include "common.h" |
| 30 | |
Haojian Zhuang | 1a8d5fa | 2011-11-08 14:15:59 +0800 | [diff] [blame] | 31 | #define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \ |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 32 | ((x < 16) ? x : 15))) |
Haojian Zhuang | 1a8d5fa | 2011-11-08 14:15:59 +0800 | [diff] [blame] | 33 | #define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \ |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 34 | ((x < 16) ? x : 15))) |
| 35 | |
| 36 | /* |
| 37 | * 16 board interrupts -- MAX7312 GPIO expander |
| 38 | * 16 board interrupts -- PCA9575 GPIO expander |
| 39 | * 24 board interrupts -- 88PM860x PMIC |
| 40 | */ |
| 41 | #define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24) |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 42 | |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 43 | static unsigned long ttc_dkb_pin_config[] __initdata = { |
| 44 | /* UART2 */ |
| 45 | GPIO47_UART2_RXD, |
| 46 | GPIO48_UART2_TXD, |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 47 | |
| 48 | /* DFI */ |
| 49 | DF_IO0_ND_IO0, |
| 50 | DF_IO1_ND_IO1, |
| 51 | DF_IO2_ND_IO2, |
| 52 | DF_IO3_ND_IO3, |
| 53 | DF_IO4_ND_IO4, |
| 54 | DF_IO5_ND_IO5, |
| 55 | DF_IO6_ND_IO6, |
| 56 | DF_IO7_ND_IO7, |
| 57 | DF_IO8_ND_IO8, |
| 58 | DF_IO9_ND_IO9, |
| 59 | DF_IO10_ND_IO10, |
| 60 | DF_IO11_ND_IO11, |
| 61 | DF_IO12_ND_IO12, |
| 62 | DF_IO13_ND_IO13, |
| 63 | DF_IO14_ND_IO14, |
| 64 | DF_IO15_ND_IO15, |
| 65 | DF_nCS0_SM_nCS2_nCS0, |
| 66 | DF_ALE_SM_WEn_ND_ALE, |
| 67 | DF_CLE_SM_OEn_ND_CLE, |
| 68 | DF_WEn_DF_WEn, |
| 69 | DF_REn_DF_REn, |
| 70 | DF_RDY0_DF_RDY0, |
| 71 | }; |
| 72 | |
| 73 | static struct mtd_partition ttc_dkb_onenand_partitions[] = { |
| 74 | { |
| 75 | .name = "bootloader", |
| 76 | .offset = 0, |
| 77 | .size = SZ_1M, |
| 78 | .mask_flags = MTD_WRITEABLE, |
| 79 | }, { |
| 80 | .name = "reserved", |
| 81 | .offset = MTDPART_OFS_APPEND, |
| 82 | .size = SZ_128K, |
| 83 | .mask_flags = MTD_WRITEABLE, |
| 84 | }, { |
| 85 | .name = "reserved", |
| 86 | .offset = MTDPART_OFS_APPEND, |
| 87 | .size = SZ_8M, |
| 88 | .mask_flags = MTD_WRITEABLE, |
| 89 | }, { |
| 90 | .name = "kernel", |
| 91 | .offset = MTDPART_OFS_APPEND, |
| 92 | .size = (SZ_2M + SZ_1M), |
| 93 | .mask_flags = 0, |
| 94 | }, { |
| 95 | .name = "filesystem", |
| 96 | .offset = MTDPART_OFS_APPEND, |
Stephen Boyd | 3f8e288 | 2011-07-26 18:45:54 +0100 | [diff] [blame] | 97 | .size = SZ_32M + SZ_16M, |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 98 | .mask_flags = 0, |
| 99 | } |
| 100 | }; |
| 101 | |
Haojian Zhuang | d622387 | 2009-11-20 10:57:16 -0500 | [diff] [blame] | 102 | static struct onenand_platform_data ttc_dkb_onenand_info = { |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 103 | .parts = ttc_dkb_onenand_partitions, |
| 104 | .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions), |
| 105 | }; |
| 106 | |
| 107 | static struct resource ttc_dkb_resource_onenand[] = { |
| 108 | [0] = { |
| 109 | .start = SMC_CS0_PHYS_BASE, |
| 110 | .end = SMC_CS0_PHYS_BASE + SZ_1M, |
| 111 | .flags = IORESOURCE_MEM, |
| 112 | }, |
| 113 | }; |
| 114 | |
| 115 | static struct platform_device ttc_dkb_device_onenand = { |
| 116 | .name = "onenand-flash", |
| 117 | .id = -1, |
| 118 | .resource = ttc_dkb_resource_onenand, |
| 119 | .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand), |
| 120 | .dev = { |
| 121 | .platform_data = &ttc_dkb_onenand_info, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct platform_device *ttc_dkb_devices[] = { |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 126 | &pxa910_device_gpio, |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 127 | &ttc_dkb_device_onenand, |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 128 | }; |
| 129 | |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 130 | static struct pca953x_platform_data max7312_data[] = { |
| 131 | { |
| 132 | .gpio_base = TTCDKB_GPIO_EXT0(0), |
| 133 | .irq_base = IRQ_BOARD_START, |
| 134 | }, |
| 135 | }; |
| 136 | |
| 137 | static struct i2c_board_info ttc_dkb_i2c_info[] = { |
| 138 | { |
| 139 | .type = "max7312", |
| 140 | .addr = 0x23, |
Haojian Zhuang | 1a8d5fa | 2011-11-08 14:15:59 +0800 | [diff] [blame] | 141 | .irq = MMP_GPIO_TO_IRQ(80), |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 142 | .platform_data = &max7312_data, |
| 143 | }, |
| 144 | }; |
| 145 | |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 146 | static void __init ttc_dkb_init(void) |
| 147 | { |
| 148 | mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); |
| 149 | |
| 150 | /* on-chip devices */ |
| 151 | pxa910_add_uart(1); |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 152 | |
| 153 | /* off-chip devices */ |
Haojian Zhuang | e04eb14 | 2011-04-01 10:39:28 +0800 | [diff] [blame] | 154 | pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); |
Haojian Zhuang | d6587c3 | 2009-09-23 01:57:35 +0800 | [diff] [blame] | 155 | platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform") |
Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 159 | .map_io = mmp_map_io, |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 160 | .nr_irqs = TTCDKB_NR_IRQS, |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 161 | .init_irq = pxa910_init_irq, |
| 162 | .timer = &pxa910_timer, |
| 163 | .init_machine = ttc_dkb_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 164 | .restart = mmp_restart, |
Eric Miao | 01215e3 | 2009-03-20 13:33:49 +0800 | [diff] [blame] | 165 | MACHINE_END |