^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Support for Compaq iPAQ H3100 and H3600 handheld computers (common code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/platform_data/gpio-htc-egpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/platform_data/sa11x0-serial.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/mach/flash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <mach/h3xxx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * H3xxx flash support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static struct mtd_partition h3xxx_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .name = "H3XXX boot firmware",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .size = 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .offset = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .mask_flags = MTD_WRITEABLE, /* force read-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .name = "H3XXX rootfs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .size = MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .offset = 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static void h3xxx_set_vpp(int vpp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) gpio_set_value(H3XXX_EGPIO_VPP_ON, vpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static int h3xxx_flash_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int err = gpio_request(H3XXX_EGPIO_VPP_ON, "Flash Vpp");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) pr_err("%s: can't request H3XXX_EGPIO_VPP_ON\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) err = gpio_direction_output(H3XXX_EGPIO_VPP_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) gpio_free(H3XXX_EGPIO_VPP_ON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static void h3xxx_flash_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) gpio_free(H3XXX_EGPIO_VPP_ON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static struct flash_platform_data h3xxx_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .map_name = "cfi_probe",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .set_vpp = h3xxx_set_vpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .init = h3xxx_flash_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .exit = h3xxx_flash_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .parts = h3xxx_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .nr_parts = ARRAY_SIZE(h3xxx_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static struct resource h3xxx_flash_resource =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * H3xxx uart support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (port->mapbase == _Ser3UTCR0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) if (!gpio_request(H3XXX_EGPIO_RS232_ON, "RS232 transceiver")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) gpio_direction_output(H3XXX_EGPIO_RS232_ON, !state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) gpio_free(H3XXX_EGPIO_RS232_ON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) pr_err("%s: can't request H3XXX_EGPIO_RS232_ON\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * Enable/Disable wake up events for this serial port.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * Obviously, we only support this on the normal COM port.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int err = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if (port->mapbase == _Ser3UTCR0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) if (enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static struct sa1100_port_fns h3xxx_port_fns __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) .pm = h3xxx_uart_pm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) .set_wake = h3xxx_uart_set_wake,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static struct gpiod_lookup_table h3xxx_uart3_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) .dev_id = "sa11x0-uart.3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) GPIO_LOOKUP("gpio", H3XXX_GPIO_COM_DCD, "dcd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) GPIO_LOOKUP("gpio", H3XXX_GPIO_COM_CTS, "cts", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) GPIO_LOOKUP("gpio", H3XXX_GPIO_COM_RTS, "rts", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * EGPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static struct resource egpio_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) [0] = DEFINE_RES_MEM(H3600_EGPIO_PHYS, 0x4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) static struct htc_egpio_chip egpio_chips[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) .reg_start = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) .gpio_base = H3XXX_EGPIO_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) .num_gpios = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) .direction = HTC_EGPIO_OUTPUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) .initial_values = 0x0080, /* H3XXX_EGPIO_RS232_ON */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static struct htc_egpio_platform_data egpio_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .reg_width = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) .bus_width = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) .chip = egpio_chips,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) .num_chips = ARRAY_SIZE(egpio_chips),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static struct platform_device h3xxx_egpio = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) .name = "htc-egpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) .resource = egpio_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .num_resources = ARRAY_SIZE(egpio_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) .platform_data = &egpio_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * GPIO keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static struct gpio_keys_button h3xxx_button_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) .code = KEY_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) .gpio = H3XXX_GPIO_PWR_BUTTON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) .desc = "Power Button",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .wakeup = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) .code = KEY_ENTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) .gpio = H3XXX_GPIO_ACTION_BUTTON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) .desc = "Action button",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .wakeup = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) static struct gpio_keys_platform_data h3xxx_keys_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .buttons = h3xxx_button_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .nbuttons = ARRAY_SIZE(h3xxx_button_table),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static struct platform_device h3xxx_keys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) .name = "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) .platform_data = &h3xxx_keys_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static struct resource h3xxx_micro_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) DEFINE_RES_MEM(0x80010000, SZ_4K),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) DEFINE_RES_MEM(0x80020000, SZ_4K),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) DEFINE_RES_IRQ(IRQ_Ser1UART),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct platform_device h3xxx_micro_asic = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .name = "ipaq-h3xxx-micro",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) .resource = h3xxx_micro_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .num_resources = ARRAY_SIZE(h3xxx_micro_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) static struct platform_device *h3xxx_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) &h3xxx_egpio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) &h3xxx_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) &h3xxx_micro_asic,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct gpiod_lookup_table h3xxx_pcmcia_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) .dev_id = "sa11x0-pcmcia",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) "pcmcia0-detect", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) "pcmcia0-ready", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) "pcmcia1-detect", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) "pcmcia1-ready", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) void __init h3xxx_mach_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) gpiod_add_lookup_table(&h3xxx_pcmcia_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) gpiod_add_lookup_table(&h3xxx_uart3_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) sa1100_register_uart_fns(&h3xxx_port_fns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static struct map_desc h3600_io_desc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) { /* static memory bank 2 CS#2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .virtual = H3600_BANK_2_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .pfn = __phys_to_pfn(SA1100_CS2_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .length = 0x02800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .type = MT_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }, { /* static memory bank 4 CS#4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .virtual = H3600_BANK_4_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .pfn = __phys_to_pfn(SA1100_CS4_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .length = 0x00800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) .type = MT_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }, { /* EGPIO 0 CS#5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .virtual = H3600_EGPIO_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) .pfn = __phys_to_pfn(H3600_EGPIO_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) .length = 0x01000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) .type = MT_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * Common map_io initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) void __init h3xxx_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) sa1100_map_io();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) sa1100_register_uart(0, 3); /* Common serial port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) // sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) /* Ensure those pins are outputs and driving low */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* Configure suspend conditions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) PGSR = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) PCFR = PCFR_OPDE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) PSDR = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) GPCR = 0x0fffffff; /* All outputs are set low by default */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) GPDR = 0; /* Configure all GPIOs as input */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)