blob: f62b68d926f4237bf70911ba43487d27c98d4e97 [file] [log] [blame]
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +05301/*
2 * linux/arch/arm/mach-mmp/gplugd.c
3 *
4 * Support for the Marvell PXA168-based GuruPlug Display (gplugD) 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>
Haojian Zhuange71dc5f72013-03-15 16:27:53 +080012#include <linux/platform_device.h>
Linus Walleijf55be1b2011-09-28 09:11:30 +010013#include <linux/gpio.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053014
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17
Haojian Zhuangbac6f612012-07-30 22:20:34 +080018#include <mach/irqs.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053019#include <mach/pxa168.h>
20#include <mach/mfp-pxa168.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053021
22#include "common.h"
23
24static unsigned long gplugd_pin_config[] __initdata = {
25 /* UART3 */
Tanmay Upadhyay3647a402011-07-14 15:07:15 +053026 GPIO8_UART3_TXD,
27 GPIO9_UART3_RXD,
28 GPIO1O_UART3_CTS,
29 GPIO11_UART3_RTS,
30
31 /* USB OTG PEN */
32 GPIO18_GPIO,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053033
34 /* MMC2 */
35 GPIO28_MMC2_CMD,
36 GPIO29_MMC2_CLK,
37 GPIO30_MMC2_DAT0,
38 GPIO31_MMC2_DAT1,
39 GPIO32_MMC2_DAT2,
40 GPIO33_MMC2_DAT3,
41
42 /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
43 GPIO35_GPIO,
44 GPIO36_GPIO, /* CEC Interrupt */
45
46 /* MMC1 */
47 GPIO43_MMC1_CLK,
48 GPIO49_MMC1_CMD,
49 GPIO41_MMC1_DAT0,
50 GPIO40_MMC1_DAT1,
51 GPIO52_MMC1_DAT2,
52 GPIO51_MMC1_DAT3,
53 GPIO53_MMC1_CD,
54
55 /* LCD */
56 GPIO56_LCD_FCLK_RD,
57 GPIO57_LCD_LCLK_A0,
58 GPIO58_LCD_PCLK_WR,
59 GPIO59_LCD_DENA_BIAS,
60 GPIO60_LCD_DD0,
61 GPIO61_LCD_DD1,
62 GPIO62_LCD_DD2,
63 GPIO63_LCD_DD3,
64 GPIO64_LCD_DD4,
65 GPIO65_LCD_DD5,
66 GPIO66_LCD_DD6,
67 GPIO67_LCD_DD7,
68 GPIO68_LCD_DD8,
69 GPIO69_LCD_DD9,
70 GPIO70_LCD_DD10,
71 GPIO71_LCD_DD11,
72 GPIO72_LCD_DD12,
73 GPIO73_LCD_DD13,
74 GPIO74_LCD_DD14,
75 GPIO75_LCD_DD15,
76 GPIO76_LCD_DD16,
77 GPIO77_LCD_DD17,
78 GPIO78_LCD_DD18,
79 GPIO79_LCD_DD19,
80 GPIO80_LCD_DD20,
81 GPIO81_LCD_DD21,
82 GPIO82_LCD_DD22,
83 GPIO83_LCD_DD23,
84
85 /* GPIO */
86 GPIO84_GPIO,
87 GPIO85_GPIO,
88
89 /* Fast-Ethernet*/
90 GPIO86_TX_CLK,
91 GPIO87_TX_EN,
92 GPIO88_TX_DQ3,
93 GPIO89_TX_DQ2,
94 GPIO90_TX_DQ1,
95 GPIO91_TX_DQ0,
96 GPIO92_MII_CRS,
97 GPIO93_MII_COL,
98 GPIO94_RX_CLK,
99 GPIO95_RX_ER,
100 GPIO96_RX_DQ3,
101 GPIO97_RX_DQ2,
102 GPIO98_RX_DQ1,
103 GPIO99_RX_DQ0,
104 GPIO100_MII_MDC,
105 GPIO101_MII_MDIO,
106 GPIO103_RX_DV,
107 GPIO104_GPIO, /* Reset PHY */
108
109 /* RTC interrupt */
110 GPIO102_GPIO,
111
112 /* I2C */
113 GPIO105_CI2C_SDA,
114 GPIO106_CI2C_SCL,
115
Tanmay Upadhyay3647a402011-07-14 15:07:15 +0530116 /* SPI NOR Flash on SSP2 */
117 GPIO107_SSP2_RXD,
118 GPIO108_SSP2_TXD,
119 GPIO110_GPIO, /* SPI_CSn */
120 GPIO111_SSP2_CLK,
121
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530122 /* Select JTAG */
123 GPIO109_GPIO,
124
125 /* I2S */
126 GPIO114_I2S_FRM,
127 GPIO115_I2S_BCLK,
128 GPIO116_I2S_TXD
129};
130
131static struct i2c_board_info gplugd_i2c_board_info[] = {
132 {
133 .type = "isl1208",
134 .addr = 0x6F,
135 }
136};
137
138/* Bring PHY out of reset by setting GPIO 104 */
139static int gplugd_eth_init(void)
140{
141 if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
142 printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
143 "PHY out of reset\n");
144 return -EIO;
145 }
146
147 gpio_direction_output(104, 1);
148 gpio_free(104);
149 return 0;
150}
151
152struct pxa168_eth_platform_data gplugd_eth_platform_data = {
153 .port_number = 0,
154 .phy_addr = 0,
155 .speed = 0, /* Autonagotiation */
156 .init = gplugd_eth_init,
157};
158
159static void __init select_disp_freq(void)
160{
161 /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
162 if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
163 printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
164 "frequency\n");
165 } else {
166 gpio_direction_output(35, 1);
Tanmay Upadhyay4c22ea82011-07-14 15:07:16 +0530167 gpio_free(35);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530168 }
169
170 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
171 printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
172 "frequency\n");
173 } else {
174 gpio_direction_output(85, 0);
Tanmay Upadhyay4c22ea82011-07-14 15:07:16 +0530175 gpio_free(85);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530176 }
177}
178
179static void __init gplugd_init(void)
180{
181 mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
182
183 select_disp_freq();
184
185 /* on-chip devices */
186 pxa168_add_uart(3);
Eric Miaoe4b3bbe2011-11-11 20:11:14 +0800187 pxa168_add_ssp(1);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530188 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
Haojian Zhuang157d2642011-10-17 20:37:52 +0800189 platform_device_register(&pxa168_device_gpio);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530190
191 pxa168_add_eth(&gplugd_eth_platform_data);
192}
193
Eric Miaoc149f6c2011-08-16 12:28:57 +0800194MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530195 .map_io = mmp_map_io,
Rob Herring8661fb92012-01-03 16:50:40 -0600196 .nr_irqs = MMP_NR_IRQS,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530197 .init_irq = pxa168_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700198 .init_time = pxa168_timer_init,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530199 .init_machine = gplugd_init,
Russell King9854a382011-11-05 15:40:09 +0000200 .restart = pxa168_restart,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530201MACHINE_END