blob: c60dadf847a624da6cc34da40bb61c61654e947e [file] [log] [blame]
Ian Molton3abcd192007-11-19 13:16:56 +01001/*
2 * Hardware definitions for the Toshiba eseries PDAs
3 *
4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5 *
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.
10 *
11 */
12
Ian Molton28365482008-08-09 21:48:45 +010013#include <linux/kernel.h>
Ian Molton3abcd192007-11-19 13:16:56 +010014#include <linux/init.h>
Ian Molton36033422008-08-24 19:21:26 +010015#include <linux/gpio.h>
Ian Moltonb1ae1b72008-09-26 13:38:59 +010016#include <linux/delay.h>
Ian Molton36033422008-08-24 19:21:26 +010017#include <linux/platform_device.h>
Ian Molton3abcd192007-11-19 13:16:56 +010018
19#include <asm/setup.h>
20#include <asm/mach/arch.h>
Ian Molton3abcd192007-11-19 13:16:56 +010021#include <asm/mach-types.h>
22
Eric Miao51c62982009-01-02 23:17:22 +080023#include <mach/pxa25x.h>
Ian Moltonebcce7b2008-08-19 13:34:56 +010024#include <mach/eseries-gpio.h>
25#include <mach/udc.h>
Ian Molton36033422008-08-24 19:21:26 +010026#include <mach/irda.h>
Ian Molton28365482008-08-09 21:48:45 +010027
Ian Molton877e03d2008-06-25 22:22:49 +010028#include "generic.h"
Ian Moltonb1ae1b72008-09-26 13:38:59 +010029#include "clock.h"
Ian Molton3abcd192007-11-19 13:16:56 +010030
31/* Only e800 has 128MB RAM */
Ian Molton7dc96412008-08-19 12:14:21 +010032void __init eseries_fixup(struct machine_desc *desc,
Ian Molton67a6e802008-07-26 00:51:12 +010033 struct tag *tags, char **cmdline, struct meminfo *mi)
Ian Molton3abcd192007-11-19 13:16:56 +010034{
35 mi->nr_banks=1;
36 mi->bank[0].start = 0xa0000000;
37 mi->bank[0].node = 0;
38 if (machine_is_e800())
39 mi->bank[0].size = (128*1024*1024);
40 else
41 mi->bank[0].size = (64*1024*1024);
42}
43
Ian Moltonebcce7b2008-08-19 13:34:56 +010044struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
45 .gpio_vbus = GPIO_E7XX_USB_DISC,
46 .gpio_pullup = GPIO_E7XX_USB_PULLUP,
47 .gpio_pullup_inverted = 1
48};
49
Ian Molton36033422008-08-24 19:21:26 +010050static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
51{
52 if (mode & IR_OFF) {
53 gpio_set_value(GPIO_E7XX_IR_OFF, 1);
54 pxa2xx_transceiver_mode(dev, mode);
55 } else {
56 pxa2xx_transceiver_mode(dev, mode);
57 gpio_set_value(GPIO_E7XX_IR_OFF, 0);
58 }
59}
60
61int e7xx_irda_init(void)
62{
63 int ret;
64
65 ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
66 if (ret)
67 goto out;
68
69 ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
70 if (ret)
71 goto out;
72
73 e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
74out:
75 return ret;
76}
77
78static void e7xx_irda_shutdown(struct device *dev)
79{
80 e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
81 gpio_free(GPIO_E7XX_IR_OFF);
82}
83
84struct pxaficp_platform_data e7xx_ficp_platform_data = {
85 .transceiver_cap = IR_SIRMODE | IR_OFF,
86 .transceiver_mode = e7xx_irda_transceiver_mode,
87 .shutdown = e7xx_irda_shutdown,
88};
89
Ian Moltonb1ae1b72008-09-26 13:38:59 +010090int eseries_tmio_enable(struct platform_device *dev)
91{
92 /* Reset - bring SUSPEND high before PCLR */
93 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
94 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
95 msleep(1);
96 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
97 msleep(1);
98 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
99 msleep(1);
100 return 0;
101}
102
103int eseries_tmio_disable(struct platform_device *dev)
104{
105 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
106 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
107 return 0;
108}
109
110int eseries_tmio_suspend(struct platform_device *dev)
111{
112 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
113 return 0;
114}
115
116int eseries_tmio_resume(struct platform_device *dev)
117{
118 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
119 msleep(1);
120 return 0;
121}
122
123void eseries_get_tmio_gpios(void)
124{
125 gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
126 gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
127 gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
128 gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
129}
130
131/* TMIO controller uses the same resources on all e-series machines. */
132struct resource eseries_tmio_resources[] = {
133 [0] = {
134 .start = PXA_CS4_PHYS,
135 .end = PXA_CS4_PHYS + 0x1fffff,
136 .flags = IORESOURCE_MEM,
137 },
138 [1] = {
139 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
140 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
141 .flags = IORESOURCE_IRQ,
142 },
143};
144
145/* Some e-series hardware cannot control the 32K clock */
146static void clk_32k_dummy(struct clk *clk)
147{
148}
149
150static const struct clkops clk_32k_dummy_ops = {
151 .enable = clk_32k_dummy,
152 .disable = clk_32k_dummy,
153};
154
155static struct clk tmio_dummy_clk = {
156 .ops = &clk_32k_dummy_ops,
157 .rate = 32768,
158};
159
160static struct clk_lookup eseries_clkregs[] = {
161 INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
162};
163
164void eseries_register_clks(void)
165{
166 clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
167}
168