blob: 80399b2680524fc5207af297163a8f34cf33cb45 [file] [log] [blame]
Fabio Estevamec9be0d2009-04-16 12:45:01 -07001/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Fabio Estevamec9be0d2009-04-16 12:45:01 -070015 */
16
Uwe Kleine-König8fdca372010-03-08 10:46:11 +010017/*
18 * This machine is known as:
19 * - i.MX27 3-Stack Development System
20 * - i.MX27 Platform Development Kit (i.MX27 PDK)
21 */
22
Fabio Estevamec9be0d2009-04-16 12:45:01 -070023#include <linux/platform_device.h>
24#include <linux/gpio.h>
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -020025#include <linux/irq.h>
Fabio Estevamec9be0d2009-04-16 12:45:01 -070026#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/time.h>
29#include <mach/hardware.h>
30#include <mach/common.h>
Uwe Kleine-Könige835d882010-02-16 11:07:49 +010031#include <mach/iomux-mx27.h>
Fabio Estevamec9be0d2009-04-16 12:45:01 -070032
Uwe Kleine-Königd5dac4a2010-06-23 09:36:01 +020033#include "devices-imx27.h"
Fabio Estevamec9be0d2009-04-16 12:45:01 -070034#include "devices.h"
35
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -020036#define SD1_EN_GPIO (GPIO_PORTB + 25)
37
Uwe Kleine-König6c80ee52010-09-28 21:53:31 +020038static const int mx27pdk_pins[] __initconst = {
Fabio Estevamec9be0d2009-04-16 12:45:01 -070039 /* UART1 */
40 PE12_PF_UART1_TXD,
41 PE13_PF_UART1_RXD,
42 PE14_PF_UART1_CTS,
43 PE15_PF_UART1_RTS,
44 /* FEC */
45 PD0_AIN_FEC_TXD0,
46 PD1_AIN_FEC_TXD1,
47 PD2_AIN_FEC_TXD2,
48 PD3_AIN_FEC_TXD3,
49 PD4_AOUT_FEC_RX_ER,
50 PD5_AOUT_FEC_RXD1,
51 PD6_AOUT_FEC_RXD2,
52 PD7_AOUT_FEC_RXD3,
53 PD8_AF_FEC_MDIO,
54 PD9_AIN_FEC_MDC,
55 PD10_AOUT_FEC_CRS,
56 PD11_AOUT_FEC_TX_CLK,
57 PD12_AOUT_FEC_RXD0,
58 PD13_AOUT_FEC_RX_DV,
59 PD14_AOUT_FEC_RX_CLK,
60 PD15_AOUT_FEC_COL,
61 PD16_AIN_FEC_TX_ER,
62 PF23_AIN_FEC_TX_EN,
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -020063 /* SDHC1 */
64 PE18_PF_SD1_D0,
65 PE19_PF_SD1_D1,
66 PE20_PF_SD1_D2,
67 PE21_PF_SD1_D3,
68 PE22_PF_SD1_CMD,
69 PE23_PF_SD1_CLK,
70 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
Fabio Estevamec9be0d2009-04-16 12:45:01 -070071};
72
Uwe Kleine-Königd5dac4a2010-06-23 09:36:01 +020073static const struct imxuart_platform_data uart_pdata __initconst = {
Fabio Estevamec9be0d2009-04-16 12:45:01 -070074 .flags = IMXUART_HAVE_RTSCTS,
75};
76
Rogerio Pimentel3fac6cf2010-06-25 10:31:33 -030077/*
78 * Matrix keyboard
79 */
80
81static const uint32_t mx27_3ds_keymap[] = {
82 KEY(0, 0, KEY_UP),
83 KEY(0, 1, KEY_DOWN),
84 KEY(1, 0, KEY_RIGHT),
85 KEY(1, 1, KEY_LEFT),
86 KEY(1, 2, KEY_ENTER),
87 KEY(2, 0, KEY_F6),
88 KEY(2, 1, KEY_F8),
89 KEY(2, 2, KEY_F9),
90 KEY(2, 3, KEY_F10),
91};
92
Uwe Kleine-König3f880142010-11-10 09:58:56 +010093static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = {
Rogerio Pimentel3fac6cf2010-06-25 10:31:33 -030094 .keymap = mx27_3ds_keymap,
95 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap),
96};
97
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -020098static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
99 void *data)
100{
101 return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING |
102 IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
103}
104
105static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
106{
107 free_irq(IRQ_GPIOB(26), data);
108}
109
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100110static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -0200111 .init = mx27_3ds_sdhc1_init,
112 .exit = mx27_3ds_sdhc1_exit,
113};
114
115static void mx27_3ds_sdhc1_enable_level_translator(void)
116{
117 /* Turn on TXB0108 OE pin */
118 gpio_request(SD1_EN_GPIO, "sd1_enable");
119 gpio_direction_output(SD1_EN_GPIO, 1);
120}
121
Fabio Estevamec9be0d2009-04-16 12:45:01 -0700122static void __init mx27pdk_init(void)
123{
124 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
125 "mx27pdk");
Rogerio Pimentelb5ec73e2010-10-22 11:03:54 -0200126 mx27_3ds_sdhc1_enable_level_translator();
Uwe Kleine-Königd5dac4a2010-06-23 09:36:01 +0200127 imx27_add_imx_uart0(&uart_pdata);
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200128 imx27_add_fec(NULL);
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100129 imx27_add_imx_keypad(&mx27_3ds_keymap_data);
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100130 imx27_add_mxc_mmc(0, &sdhc1_pdata);
Fabio Estevamec9be0d2009-04-16 12:45:01 -0700131}
132
133static void __init mx27pdk_timer_init(void)
134{
135 mx27_clocks_init(26000000);
136}
137
138static struct sys_timer mx27pdk_timer = {
139 .init = mx27pdk_timer_init,
140};
141
142MACHINE_START(MX27_3DS, "Freescale MX27PDK")
143 /* maintainer: Freescale Semiconductor, Inc. */
Uwe Kleine-König34101232010-01-29 17:36:05 +0100144 .boot_params = MX27_PHYS_OFFSET + 0x100,
Simon POLETTEadd85a42009-06-04 12:09:01 +0200145 .map_io = mx27_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200146 .init_irq = mx27_init_irq,
Fabio Estevamec9be0d2009-04-16 12:45:01 -0700147 .init_machine = mx27pdk_init,
148 .timer = &mx27pdk_timer,
149MACHINE_END