[SCSI] net: add FCoE offload support through net_device
[linux-2.6/mini2440.git] / arch / arm / mach-pxa / eseries.c
blobdfce7d5b659e64a19ee22736c8a0cb38364b1196
1 /*
2 * Hardware definitions for the Toshiba eseries PDAs
4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
6 * This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/gpio.h>
16 #include <linux/delay.h>
17 #include <linux/platform_device.h>
19 #include <asm/setup.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach-types.h>
23 #include <mach/mfp-pxa25x.h>
24 #include <mach/hardware.h>
25 #include <mach/eseries-gpio.h>
26 #include <mach/udc.h>
27 #include <mach/irda.h>
29 #include "generic.h"
30 #include "clock.h"
32 /* Only e800 has 128MB RAM */
33 void __init eseries_fixup(struct machine_desc *desc,
34 struct tag *tags, char **cmdline, struct meminfo *mi)
36 mi->nr_banks=1;
37 mi->bank[0].start = 0xa0000000;
38 mi->bank[0].node = 0;
39 if (machine_is_e800())
40 mi->bank[0].size = (128*1024*1024);
41 else
42 mi->bank[0].size = (64*1024*1024);
45 struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
46 .gpio_vbus = GPIO_E7XX_USB_DISC,
47 .gpio_pullup = GPIO_E7XX_USB_PULLUP,
48 .gpio_pullup_inverted = 1
51 static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
53 if (mode & IR_OFF) {
54 gpio_set_value(GPIO_E7XX_IR_OFF, 1);
55 pxa2xx_transceiver_mode(dev, mode);
56 } else {
57 pxa2xx_transceiver_mode(dev, mode);
58 gpio_set_value(GPIO_E7XX_IR_OFF, 0);
62 int e7xx_irda_init(void)
64 int ret;
66 ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
67 if (ret)
68 goto out;
70 ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
71 if (ret)
72 goto out;
74 e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
75 out:
76 return ret;
79 static void e7xx_irda_shutdown(struct device *dev)
81 e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
82 gpio_free(GPIO_E7XX_IR_OFF);
85 struct pxaficp_platform_data e7xx_ficp_platform_data = {
86 .transceiver_cap = IR_SIRMODE | IR_OFF,
87 .transceiver_mode = e7xx_irda_transceiver_mode,
88 .shutdown = e7xx_irda_shutdown,
91 int eseries_tmio_enable(struct platform_device *dev)
93 /* Reset - bring SUSPEND high before PCLR */
94 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
95 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
96 msleep(1);
97 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
98 msleep(1);
99 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
100 msleep(1);
101 return 0;
104 int eseries_tmio_disable(struct platform_device *dev)
106 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
107 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
108 return 0;
111 int eseries_tmio_suspend(struct platform_device *dev)
113 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
114 return 0;
117 int eseries_tmio_resume(struct platform_device *dev)
119 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
120 msleep(1);
121 return 0;
124 void eseries_get_tmio_gpios(void)
126 gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
127 gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
128 gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
129 gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
132 /* TMIO controller uses the same resources on all e-series machines. */
133 struct resource eseries_tmio_resources[] = {
134 [0] = {
135 .start = PXA_CS4_PHYS,
136 .end = PXA_CS4_PHYS + 0x1fffff,
137 .flags = IORESOURCE_MEM,
139 [1] = {
140 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
141 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
142 .flags = IORESOURCE_IRQ,
146 /* Some e-series hardware cannot control the 32K clock */
147 static void clk_32k_dummy(struct clk *clk)
151 static const struct clkops clk_32k_dummy_ops = {
152 .enable = clk_32k_dummy,
153 .disable = clk_32k_dummy,
156 static struct clk tmio_dummy_clk = {
157 .ops = &clk_32k_dummy_ops,
158 .rate = 32768,
161 static struct clk_lookup eseries_clkregs[] = {
162 INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
165 void eseries_register_clks(void)
167 clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));