blob: a0ab3082a0009d31b3837f1234f6f4175cde6a8b [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;
Ian Molton3abcd192007-11-19 13:16:56 +010037 if (machine_is_e800())
38 mi->bank[0].size = (128*1024*1024);
39 else
40 mi->bank[0].size = (64*1024*1024);
41}
42
Ian Moltonebcce7b2008-08-19 13:34:56 +010043struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
44 .gpio_vbus = GPIO_E7XX_USB_DISC,
45 .gpio_pullup = GPIO_E7XX_USB_PULLUP,
46 .gpio_pullup_inverted = 1
47};
48
Ian Molton36033422008-08-24 19:21:26 +010049struct pxaficp_platform_data e7xx_ficp_platform_data = {
Marek Vasutc4bd0172009-07-17 12:50:43 +020050 .gpio_pwdown = GPIO_E7XX_IR_OFF,
51 .transceiver_cap = IR_SIRMODE | IR_OFF,
Ian Molton36033422008-08-24 19:21:26 +010052};
53
Ian Moltonb1ae1b72008-09-26 13:38:59 +010054int eseries_tmio_enable(struct platform_device *dev)
55{
56 /* Reset - bring SUSPEND high before PCLR */
57 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
58 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
59 msleep(1);
60 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
61 msleep(1);
62 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
63 msleep(1);
64 return 0;
65}
66
67int eseries_tmio_disable(struct platform_device *dev)
68{
69 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
70 gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
71 return 0;
72}
73
74int eseries_tmio_suspend(struct platform_device *dev)
75{
76 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
77 return 0;
78}
79
80int eseries_tmio_resume(struct platform_device *dev)
81{
82 gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
83 msleep(1);
84 return 0;
85}
86
87void eseries_get_tmio_gpios(void)
88{
89 gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
90 gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
91 gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
92 gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
93}
94
95/* TMIO controller uses the same resources on all e-series machines. */
96struct resource eseries_tmio_resources[] = {
97 [0] = {
98 .start = PXA_CS4_PHYS,
99 .end = PXA_CS4_PHYS + 0x1fffff,
100 .flags = IORESOURCE_MEM,
101 },
102 [1] = {
103 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
104 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
105 .flags = IORESOURCE_IRQ,
106 },
107};
108
109/* Some e-series hardware cannot control the 32K clock */
110static void clk_32k_dummy(struct clk *clk)
111{
112}
113
114static const struct clkops clk_32k_dummy_ops = {
115 .enable = clk_32k_dummy,
116 .disable = clk_32k_dummy,
117};
118
119static struct clk tmio_dummy_clk = {
120 .ops = &clk_32k_dummy_ops,
121 .rate = 32768,
122};
123
124static struct clk_lookup eseries_clkregs[] = {
125 INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
126};
127
128void eseries_register_clks(void)
129{
Russell King0a0300d2010-01-12 12:28:00 +0000130 clkdev_add_table(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
Ian Moltonb1ae1b72008-09-26 13:38:59 +0100131}
132