Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gplugd.c
Go to the documentation of this file.
1 /*
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>
12 #include <linux/gpio.h>
13 
14 #include <asm/mach/arch.h>
15 #include <asm/mach-types.h>
16 
17 #include <mach/irqs.h>
18 #include <mach/pxa168.h>
19 #include <mach/mfp-pxa168.h>
20 
21 #include "common.h"
22 
23 static unsigned long gplugd_pin_config[] __initdata = {
24  /* UART3 */
29 
30  /* USB OTG PEN */
32 
33  /* MMC2 */
40 
41  /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
43  GPIO36_GPIO, /* CEC Interrupt */
44 
45  /* MMC1 */
53 
54  /* LCD */
83 
84  /* GPIO */
87 
88  /* Fast-Ethernet*/
106  GPIO104_GPIO, /* Reset PHY */
107 
108  /* RTC interrupt */
109  GPIO102_GPIO,
110 
111  /* I2C */
114 
115  /* SPI NOR Flash on SSP2 */
118  GPIO110_GPIO, /* SPI_CSn */
120 
121  /* Select JTAG */
122  GPIO109_GPIO,
123 
124  /* I2S */
128 };
129 
130 static struct i2c_board_info gplugd_i2c_board_info[] = {
131  {
132  .type = "isl1208",
133  .addr = 0x6F,
134  }
135 };
136 
137 /* Bring PHY out of reset by setting GPIO 104 */
138 static int gplugd_eth_init(void)
139 {
140  if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
141  printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
142  "PHY out of reset\n");
143  return -EIO;
144  }
145 
146  gpio_direction_output(104, 1);
147  gpio_free(104);
148  return 0;
149 }
150 
152  .port_number = 0,
153  .phy_addr = 0,
154  .speed = 0, /* Autonagotiation */
155  .init = gplugd_eth_init,
156 };
157 
158 static void __init select_disp_freq(void)
159 {
160  /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
161  if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
162  printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
163  "frequency\n");
164  } else {
165  gpio_direction_output(35, 1);
166  gpio_free(35);
167  }
168 
169  if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
170  printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
171  "frequency\n");
172  } else {
173  gpio_direction_output(85, 0);
174  gpio_free(85);
175  }
176 }
177 
178 static void __init gplugd_init(void)
179 {
180  mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
181 
182  select_disp_freq();
183 
184  /* on-chip devices */
185  pxa168_add_uart(3);
186  pxa168_add_ssp(1);
187  pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
189 
190  pxa168_add_eth(&gplugd_eth_platform_data);
191 }
192 
193 MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
194  .map_io = mmp_map_io,
195  .nr_irqs = MMP_NR_IRQS,
196  .init_irq = pxa168_init_irq,
197  .timer = &pxa168_timer,
198  .init_machine = gplugd_init,
199  .restart = pxa168_restart,