blob: dfce7d5b659e64a19ee22736c8a0cb38364b1196 [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
Ian Molton28365482008-08-09 21:48:45 +010023#include <mach/mfp-pxa25x.h>
24#include <mach/hardware.h>
Ian Moltonebcce7b2008-08-19 13:34:56 +010025#include <mach/eseries-gpio.h>
26#include <mach/udc.h>
Ian Molton36033422008-08-24 19:21:26 +010027#include <mach/irda.h>
Ian Molton28365482008-08-09 21:48:45 +010028
Ian Molton877e03d2008-06-25 22:22:49 +010029#include "generic.h"
Ian Moltonb1ae1b72008-09-26 13:38:59 +010030#include "clock.h"
Ian Molton3abcd192007-11-19 13:16:56 +010031
32/* Only e800 has 128MB RAM */
Ian Molton7dc96412008-08-19 12:14:21 +010033void __init eseries_fixup(struct machine_desc *desc,
Ian Molton67a6e802008-07-26 00:51:12 +010034 struct tag *tags, char **cmdline, struct meminfo *mi)
Ian Molton3abcd192007-11-19 13:16:56 +010035{
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);
43}
44
Ian Moltonebcce7b2008-08-19 13:34:56 +010045struct 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
49};
50
Ian Molton36033422008-08-24 19:21:26 +010051static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
52{
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);
59 }
60}
61
62int e7xx_irda_init(void)
63{
64 int ret;
65
66 ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
67 if (ret)
68 goto out;
69
70 ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
71 if (ret)
72 goto out;
73
74 e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
75out:
76 return ret;
77}
78
79static void e7xx_irda_shutdown(struct device *dev)
80{
81 e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
82 gpio_free(GPIO_E7XX_IR_OFF);
83}
84
85struct 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,
89};
90
Ian Moltonb1ae1b72008-09-26 13:38:59 +010091int eseries_tmio_enable(struct platform_device *dev)
92{
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;
102}
103
104int eseries_tmio_disable(struct platform_device *dev)
105{
106 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
107 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
108 return 0;
109}
110
111int eseries_tmio_suspend(struct platform_device *dev)
112{
113 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
114 return 0;
115}
116
117int eseries_tmio_resume(struct platform_device *dev)
118{
119 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
120 msleep(1);
121 return 0;
122}
123
124void eseries_get_tmio_gpios(void)
125{
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);
130}
131
132/* TMIO controller uses the same resources on all e-series machines. */
133struct resource eseries_tmio_resources[] = {
134 [0] = {
135 .start = PXA_CS4_PHYS,
136 .end = PXA_CS4_PHYS + 0x1fffff,
137 .flags = IORESOURCE_MEM,
138 },
139 [1] = {
140 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
141 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146/* Some e-series hardware cannot control the 32K clock */
147static void clk_32k_dummy(struct clk *clk)
148{
149}
150
151static const struct clkops clk_32k_dummy_ops = {
152 .enable = clk_32k_dummy,
153 .disable = clk_32k_dummy,
154};
155
156static struct clk tmio_dummy_clk = {
157 .ops = &clk_32k_dummy_ops,
158 .rate = 32768,
159};
160
161static struct clk_lookup eseries_clkregs[] = {
162 INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
163};
164
165void eseries_register_clks(void)
166{
167 clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
168}
169