2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Hardware definitions for Compaq iPAQ H3xxx Handheld Computers
|
|
|
|
*
|
|
|
|
* Copyright 2000,1 Compaq Computer Corporation.
|
|
|
|
*
|
|
|
|
* Use consistent with the GNU GPL is permitted,
|
|
|
|
* provided that this copyright notice is
|
|
|
|
* preserved in its entirety in all copies and derived works.
|
|
|
|
*
|
|
|
|
* COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
|
|
|
|
* AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
|
|
|
|
* FITNESS FOR ANY PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* Author: Jamey Hicks.
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
*
|
|
|
|
* 2001-10-?? Andrew Christian Added support for iPAQ H3800
|
|
|
|
* and abstracted EGPIO interface.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/tty.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
#include <linux/serial_core.h>
|
2009-10-06 21:35:16 +08:00
|
|
|
#include <linux/gpio.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/irq.h>
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/hardware.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/setup.h>
|
|
|
|
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
#include <asm/mach/irda.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/serial_sa1100.h>
|
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/h3600.h>
|
|
|
|
#include <mach/h3600_gpio.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
|
2009-03-16 02:14:27 +08:00
|
|
|
void (*assign_h3600_egpio)(enum ipaq_egpio_type x, int level);
|
|
|
|
EXPORT_SYMBOL(assign_h3600_egpio);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-10-06 21:35:16 +08:00
|
|
|
struct gpio_default_state {
|
|
|
|
int gpio;
|
|
|
|
int mode;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GPIO_MODE_IN -1
|
|
|
|
#define GPIO_MODE_OUT0 0
|
|
|
|
#define GPIO_MODE_OUT1 1
|
|
|
|
|
|
|
|
static void h3xxx_init_gpio(struct gpio_default_state *s, size_t n)
|
|
|
|
{
|
|
|
|
while (n--) {
|
|
|
|
const char *name = s->name;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
name = "[init]";
|
|
|
|
err = gpio_request(s->gpio, name);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "gpio%u: unable to request: %d\n",
|
|
|
|
s->gpio, err);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (s->mode >= 0) {
|
|
|
|
err = gpio_direction_output(s->gpio, s->mode);
|
|
|
|
} else {
|
|
|
|
err = gpio_direction_input(s->gpio);
|
|
|
|
}
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "gpio%u: unable to set direction: %d\n",
|
|
|
|
s->gpio, err);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!s->name)
|
|
|
|
gpio_free(s->gpio);
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
/*
|
|
|
|
* H3xxx flash support
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct mtd_partition h3xxx_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "H3XXX boot firmware",
|
|
|
|
.size = 0x00040000,
|
|
|
|
.offset = 0,
|
|
|
|
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
|
|
|
}, {
|
2009-03-16 02:09:50 +08:00
|
|
|
.name = "H3XXX rootfs",
|
2005-04-17 06:20:36 +08:00
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
.offset = 0x00040000,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static void h3xxx_set_vpp(int vpp)
|
|
|
|
{
|
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct flash_platform_data h3xxx_flash_data = {
|
|
|
|
.map_name = "cfi_probe",
|
|
|
|
.set_vpp = h3xxx_set_vpp,
|
|
|
|
.parts = h3xxx_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(h3xxx_partitions),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource h3xxx_flash_resource = {
|
|
|
|
.start = SA1100_CS0_PHYS,
|
|
|
|
.end = SA1100_CS0_PHYS + SZ_32M - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-10-06 22:16:27 +08:00
|
|
|
* H3xxx uart support
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2009-10-06 22:16:27 +08:00
|
|
|
static void h3xxx_uart_set_mctrl(struct uart_port *port, u_int mctrl)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
if (port->mapbase == _Ser3UTCR0) {
|
2009-10-06 22:16:27 +08:00
|
|
|
gpio_set_value(H3XXX_GPIO_COM_RTS, !(mctrl & TIOCM_RTS));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
static u_int h3xxx_uart_get_mctrl(struct uart_port *port)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
|
|
|
|
|
|
|
|
if (port->mapbase == _Ser3UTCR0) {
|
2009-10-06 22:16:27 +08:00
|
|
|
/*
|
|
|
|
* DCD and CTS bits are inverted in GPLR by RS232 transceiver
|
|
|
|
*/
|
|
|
|
if (gpio_get_value(H3XXX_GPIO_COM_DCD))
|
2005-04-17 06:20:36 +08:00
|
|
|
ret &= ~TIOCM_CD;
|
2009-10-06 22:16:27 +08:00
|
|
|
if (gpio_get_value(H3XXX_GPIO_COM_CTS))
|
2005-04-17 06:20:36 +08:00
|
|
|
ret &= ~TIOCM_CTS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-11-27 18:10:58 +08:00
|
|
|
if (port->mapbase == _Ser3UTCR0)
|
2005-04-17 06:20:36 +08:00
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_RS232_ON, !state);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable/Disable wake up events for this serial port.
|
|
|
|
* Obviously, we only support this on the normal COM port.
|
|
|
|
*/
|
2009-10-06 22:16:27 +08:00
|
|
|
static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int err = -EINVAL;
|
|
|
|
|
|
|
|
if (port->mapbase == _Ser3UTCR0) {
|
|
|
|
if (enable)
|
|
|
|
PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */
|
|
|
|
else
|
|
|
|
PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */
|
|
|
|
err = 0;
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
static struct sa1100_port_fns h3xxx_port_fns __initdata = {
|
|
|
|
.set_mctrl = h3xxx_uart_set_mctrl,
|
|
|
|
.get_mctrl = h3xxx_uart_get_mctrl,
|
|
|
|
.pm = h3xxx_uart_pm,
|
|
|
|
.set_wake = h3xxx_uart_set_wake,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
|
2009-11-27 18:06:46 +08:00
|
|
|
static void __init h3xxx_mach_init(void)
|
2009-10-06 22:16:27 +08:00
|
|
|
{
|
|
|
|
sa1100_register_uart_fns(&h3xxx_port_fns);
|
|
|
|
sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct map_desc h3600_io_desc[] __initdata = {
|
2005-10-28 22:19:04 +08:00
|
|
|
{ /* static memory bank 2 CS#2 */
|
|
|
|
.virtual = H3600_BANK_2_VIRT,
|
|
|
|
.pfn = __phys_to_pfn(SA1100_CS2_PHYS),
|
|
|
|
.length = 0x02800000,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
}, { /* static memory bank 4 CS#4 */
|
|
|
|
.virtual = H3600_BANK_4_VIRT,
|
|
|
|
.pfn = __phys_to_pfn(SA1100_CS4_PHYS),
|
|
|
|
.length = 0x00800000,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
}, { /* EGPIO 0 CS#5 */
|
|
|
|
.virtual = H3600_EGPIO_VIRT,
|
|
|
|
.pfn = __phys_to_pfn(H3600_EGPIO_PHYS),
|
|
|
|
.length = 0x01000000,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Common map_io initialization
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void __init h3xxx_map_io(void)
|
|
|
|
{
|
|
|
|
sa1100_map_io();
|
|
|
|
iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc));
|
|
|
|
|
|
|
|
sa1100_register_uart(0, 3); /* Common serial port */
|
|
|
|
// sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
|
|
|
|
|
|
|
|
/* Ensure those pins are outputs and driving low */
|
|
|
|
PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
|
|
|
|
PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
|
|
|
|
|
|
|
|
/* Configure suspend conditions */
|
|
|
|
PGSR = 0;
|
2009-10-06 23:40:24 +08:00
|
|
|
PWER = PWER_GPIO0;
|
2005-04-17 06:20:36 +08:00
|
|
|
PCFR = PCFR_OPDE;
|
|
|
|
PSDR = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************* H3100 *************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_SA1100_H3100
|
|
|
|
|
|
|
|
#define H3100_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
|
|
|
|
static unsigned int h3100_egpio = 0;
|
|
|
|
|
|
|
|
static void h3100_control_egpio(enum ipaq_egpio_type x, int setp)
|
|
|
|
{
|
|
|
|
unsigned int egpio = 0;
|
|
|
|
long gpio = 0;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
switch (x) {
|
|
|
|
case IPAQ_EGPIO_LCD_POWER:
|
|
|
|
egpio |= EGPIO_H3600_LCD_ON;
|
|
|
|
gpio |= GPIO_H3100_LCD_3V_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_LCD_ENABLE:
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_CODEC_NRESET:
|
|
|
|
egpio |= EGPIO_H3600_CODEC_NRESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_AUDIO_ON:
|
|
|
|
gpio |= GPIO_H3100_AUD_PWR_ON
|
|
|
|
| GPIO_H3100_AUD_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_QMUTE:
|
|
|
|
gpio |= GPIO_H3100_QMUTE;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_NVRAM_ON:
|
|
|
|
egpio |= EGPIO_H3600_OPT_NVRAM_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_ON:
|
|
|
|
egpio |= EGPIO_H3600_OPT_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_CARD_RESET:
|
|
|
|
egpio |= EGPIO_H3600_CARD_RESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_RESET:
|
|
|
|
egpio |= EGPIO_H3600_OPT_RESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_IR_ON:
|
|
|
|
gpio |= GPIO_H3100_IR_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_IR_FSEL:
|
|
|
|
gpio |= GPIO_H3100_IR_FSEL;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_RS232_ON:
|
|
|
|
egpio |= EGPIO_H3600_RS232_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_VPP_ON:
|
|
|
|
egpio |= EGPIO_H3600_VPP_ON;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (egpio || gpio) {
|
|
|
|
local_irq_save(flags);
|
|
|
|
if (setp) {
|
|
|
|
h3100_egpio |= egpio;
|
|
|
|
GPSR = gpio;
|
|
|
|
} else {
|
|
|
|
h3100_egpio &= ~egpio;
|
|
|
|
GPCR = gpio;
|
|
|
|
}
|
|
|
|
H3100_EGPIO = h3100_egpio;
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \
|
|
|
|
| GPIO_H3100_GPIO3 \
|
|
|
|
| GPIO_H3100_QMUTE \
|
|
|
|
| GPIO_H3100_LCD_3V_ON \
|
|
|
|
| GPIO_H3100_AUD_ON \
|
|
|
|
| GPIO_H3100_AUD_PWR_ON \
|
|
|
|
| GPIO_H3100_IR_ON \
|
|
|
|
| GPIO_H3100_IR_FSEL)
|
2009-11-27 18:58:35 +08:00
|
|
|
/*
|
|
|
|
* helper for sa1100fb
|
|
|
|
*/
|
|
|
|
static void h3100_lcd_power(int enable)
|
|
|
|
{
|
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static void __init h3100_map_io(void)
|
|
|
|
{
|
|
|
|
h3xxx_map_io();
|
|
|
|
|
2009-11-27 18:58:35 +08:00
|
|
|
sa1100fb_lcd_power = h3100_lcd_power;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Initialize h3100-specific values here */
|
|
|
|
GPCR = 0x0fffffff; /* All outputs are set low by default */
|
2009-10-06 22:16:27 +08:00
|
|
|
GPDR = GPIO_H3600_L3_CLOCK |
|
2005-04-17 06:20:36 +08:00
|
|
|
GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
|
|
|
|
GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
|
|
|
|
H3100_DIRECT_EGPIO;
|
|
|
|
|
|
|
|
/* Older bootldrs put GPIO2-9 in alternate mode on the
|
|
|
|
assumption that they are used for video */
|
|
|
|
GAFR &= ~H3100_DIRECT_EGPIO;
|
|
|
|
|
|
|
|
H3100_EGPIO = h3100_egpio;
|
2009-03-16 02:14:27 +08:00
|
|
|
assign_h3600_egpio = h3100_control_egpio;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-10-06 21:22:23 +08:00
|
|
|
/*
|
|
|
|
* This turns the IRDA power on or off on the Compaq H3100
|
|
|
|
*/
|
|
|
|
static int h3100_irda_set_power(struct device *dev, unsigned int state)
|
|
|
|
{
|
2009-10-06 21:36:05 +08:00
|
|
|
gpio_set_value(H3100_GPIO_IR_ON, state);
|
2009-10-06 21:22:23 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
|
|
|
|
{
|
2009-10-06 21:36:05 +08:00
|
|
|
gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
|
2009-10-06 21:22:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct irda_platform_data h3100_irda_data = {
|
|
|
|
.set_power = h3100_irda_set_power,
|
|
|
|
.set_speed = h3100_irda_set_speed,
|
|
|
|
};
|
|
|
|
|
2009-10-06 21:36:05 +08:00
|
|
|
static struct gpio_default_state h3100_default_gpio[] = {
|
|
|
|
{ H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
|
|
|
|
{ H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
|
2009-10-06 22:16:27 +08:00
|
|
|
{ H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
|
|
|
|
{ H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
|
|
|
|
{ H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
|
2009-10-06 21:36:05 +08:00
|
|
|
};
|
|
|
|
|
2009-11-27 18:06:46 +08:00
|
|
|
static void __init h3100_mach_init(void)
|
2009-10-06 21:19:44 +08:00
|
|
|
{
|
2009-10-06 21:36:05 +08:00
|
|
|
h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
|
2009-10-06 21:19:44 +08:00
|
|
|
h3xxx_mach_init();
|
2009-10-06 21:22:23 +08:00
|
|
|
sa11x0_register_irda(&h3100_irda_data);
|
2009-10-06 21:19:44 +08:00
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_START(H3100, "Compaq iPAQ H3100")
|
2005-07-04 00:38:58 +08:00
|
|
|
.phys_io = 0x80000000,
|
|
|
|
.io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
|
|
|
|
.boot_params = 0xc0000100,
|
|
|
|
.map_io = h3100_map_io,
|
|
|
|
.init_irq = sa1100_init_irq,
|
2005-04-17 06:20:36 +08:00
|
|
|
.timer = &sa1100_timer,
|
2009-10-06 21:19:44 +08:00
|
|
|
.init_machine = h3100_mach_init,
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_END
|
|
|
|
|
|
|
|
#endif /* CONFIG_SA1100_H3100 */
|
|
|
|
|
|
|
|
/************************* H3600 *************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_SA1100_H3600
|
|
|
|
|
|
|
|
#define H3600_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
|
|
|
|
static unsigned int h3600_egpio = EGPIO_H3600_RS232_ON;
|
|
|
|
|
|
|
|
static void h3600_control_egpio(enum ipaq_egpio_type x, int setp)
|
|
|
|
{
|
|
|
|
unsigned int egpio = 0;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
switch (x) {
|
|
|
|
case IPAQ_EGPIO_LCD_POWER:
|
|
|
|
egpio |= EGPIO_H3600_LCD_ON |
|
|
|
|
EGPIO_H3600_LCD_PCI |
|
|
|
|
EGPIO_H3600_LCD_5V_ON |
|
|
|
|
EGPIO_H3600_LVDD_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_LCD_ENABLE:
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_CODEC_NRESET:
|
|
|
|
egpio |= EGPIO_H3600_CODEC_NRESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_AUDIO_ON:
|
|
|
|
egpio |= EGPIO_H3600_AUD_AMP_ON |
|
|
|
|
EGPIO_H3600_AUD_PWR_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_QMUTE:
|
|
|
|
egpio |= EGPIO_H3600_QMUTE;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_NVRAM_ON:
|
|
|
|
egpio |= EGPIO_H3600_OPT_NVRAM_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_ON:
|
|
|
|
egpio |= EGPIO_H3600_OPT_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_CARD_RESET:
|
|
|
|
egpio |= EGPIO_H3600_CARD_RESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_OPT_RESET:
|
|
|
|
egpio |= EGPIO_H3600_OPT_RESET;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_IR_ON:
|
|
|
|
egpio |= EGPIO_H3600_IR_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_IR_FSEL:
|
|
|
|
egpio |= EGPIO_H3600_IR_FSEL;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_RS232_ON:
|
|
|
|
egpio |= EGPIO_H3600_RS232_ON;
|
|
|
|
break;
|
|
|
|
case IPAQ_EGPIO_VPP_ON:
|
|
|
|
egpio |= EGPIO_H3600_VPP_ON;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (egpio) {
|
|
|
|
local_irq_save(flags);
|
|
|
|
if (setp)
|
|
|
|
h3600_egpio |= egpio;
|
|
|
|
else
|
|
|
|
h3600_egpio &= ~egpio;
|
|
|
|
H3600_EGPIO = h3600_egpio;
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-27 18:58:35 +08:00
|
|
|
/*
|
|
|
|
* helper for sa1100fb
|
|
|
|
*/
|
|
|
|
static void h3600_lcd_power(int enable)
|
|
|
|
{
|
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static void __init h3600_map_io(void)
|
|
|
|
{
|
|
|
|
h3xxx_map_io();
|
|
|
|
|
2009-11-27 18:58:35 +08:00
|
|
|
sa1100fb_lcd_power = h3600_lcd_power;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Initialize h3600-specific values here */
|
|
|
|
|
|
|
|
GPCR = 0x0fffffff; /* All outputs are set low by default */
|
2009-10-06 22:16:27 +08:00
|
|
|
GPDR = GPIO_H3600_L3_CLOCK |
|
2005-04-17 06:20:36 +08:00
|
|
|
GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
|
2009-11-27 18:11:00 +08:00
|
|
|
GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
H3600_EGPIO = h3600_egpio; /* Maintains across sleep? */
|
2009-03-16 02:14:27 +08:00
|
|
|
assign_h3600_egpio = h3600_control_egpio;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-10-06 21:22:23 +08:00
|
|
|
/*
|
|
|
|
* This turns the IRDA power on or off on the Compaq H3600
|
|
|
|
*/
|
|
|
|
static int h3600_irda_set_power(struct device *dev, unsigned int state)
|
|
|
|
{
|
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_IR_ON, state);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
|
|
|
|
{
|
|
|
|
assign_h3600_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000));
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irda_platform_data h3600_irda_data = {
|
|
|
|
.set_power = h3600_irda_set_power,
|
|
|
|
.set_speed = h3600_irda_set_speed,
|
|
|
|
};
|
|
|
|
|
2009-10-06 22:16:27 +08:00
|
|
|
static struct gpio_default_state h3600_default_gpio[] = {
|
|
|
|
{ H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
|
|
|
|
{ H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
|
|
|
|
{ H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
|
|
|
|
};
|
|
|
|
|
2009-11-27 18:06:46 +08:00
|
|
|
static void __init h3600_mach_init(void)
|
2009-10-06 21:19:44 +08:00
|
|
|
{
|
2009-10-06 22:16:27 +08:00
|
|
|
h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio));
|
2009-10-06 21:19:44 +08:00
|
|
|
h3xxx_mach_init();
|
2009-10-06 21:22:23 +08:00
|
|
|
sa11x0_register_irda(&h3600_irda_data);
|
2009-10-06 21:19:44 +08:00
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_START(H3600, "Compaq iPAQ H3600")
|
2005-07-04 00:38:58 +08:00
|
|
|
.phys_io = 0x80000000,
|
|
|
|
.io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
|
|
|
|
.boot_params = 0xc0000100,
|
|
|
|
.map_io = h3600_map_io,
|
|
|
|
.init_irq = sa1100_init_irq,
|
2005-04-17 06:20:36 +08:00
|
|
|
.timer = &sa1100_timer,
|
2009-10-06 21:19:44 +08:00
|
|
|
.init_machine = h3600_mach_init,
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_END
|
|
|
|
|
|
|
|
#endif /* CONFIG_SA1100_H3600 */
|
|
|
|
|