Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 1 | /* Machine specific code for the Acer n30 PDA. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright (c) 2003-2005 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
| 5 | * |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 6 | * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
| 8 | * There is a wiki with more information about the n30 port at |
| 9 | * http://handhelds.org/moin/moin.cgi/AcerN30Documentation . |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 19 | #include <linux/delay.h> |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/platform_device.h> |
| 23 | #include <linux/serial_core.h> |
| 24 | #include <linux/timer.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | #include <asm/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <asm/io.h> |
| 28 | #include <asm/irq.h> |
| 29 | #include <asm/mach-types.h> |
| 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <asm/arch/regs-gpio.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 33 | #include <asm/mach/arch.h> |
| 34 | #include <asm/mach/irq.h> |
| 35 | #include <asm/mach/map.h> |
| 36 | |
| 37 | #include <asm/plat-s3c/iic.h> |
| 38 | #include <asm/plat-s3c/regs-serial.h> |
| 39 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 40 | #include <asm/plat-s3c24xx/clock.h> |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 41 | #include <asm/plat-s3c24xx/cpu.h> |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 42 | #include <asm/plat-s3c24xx/devs.h> |
| 43 | #include <asm/plat-s3c24xx/s3c2410.h> |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame^] | 44 | #include <asm/plat-s3c24xx/udc.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
| 46 | static struct map_desc n30_iodesc[] __initdata = { |
| 47 | /* nothing here yet */ |
| 48 | }; |
| 49 | |
| 50 | static struct s3c2410_uartcfg n30_uartcfgs[] = { |
| 51 | /* Normal serial port */ |
| 52 | [0] = { |
| 53 | .hwport = 0, |
| 54 | .flags = 0, |
| 55 | .ucon = 0x2c5, |
| 56 | .ulcon = 0x03, |
| 57 | .ufcon = 0x51, |
| 58 | }, |
| 59 | /* IR port */ |
| 60 | [1] = { |
| 61 | .hwport = 1, |
| 62 | .flags = 0, |
| 63 | .uart_flags = UPF_CONS_FLOW, |
| 64 | .ucon = 0x2c5, |
| 65 | .ulcon = 0x43, |
| 66 | .ufcon = 0x51, |
| 67 | }, |
| 68 | /* The BlueTooth controller is connected to port 2 */ |
| 69 | [2] = { |
| 70 | .hwport = 2, |
| 71 | .flags = 0, |
| 72 | .ucon = 0x2c5, |
| 73 | .ulcon = 0x03, |
| 74 | .ufcon = 0x51, |
| 75 | }, |
| 76 | }; |
| 77 | |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame^] | 78 | static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd) |
| 79 | { |
| 80 | switch (cmd) |
| 81 | { |
| 82 | case S3C2410_UDC_P_ENABLE : |
| 83 | s3c2410_gpio_setpin(S3C2410_GPB3, 1); |
| 84 | break; |
| 85 | case S3C2410_UDC_P_DISABLE : |
| 86 | s3c2410_gpio_setpin(S3C2410_GPB3, 0); |
| 87 | break; |
| 88 | case S3C2410_UDC_P_RESET : |
| 89 | break; |
| 90 | default: |
| 91 | break; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { |
| 96 | .udc_command = n30_udc_pullup, |
| 97 | .vbus_pin = S3C2410_GPG1, |
| 98 | .vbus_pin_inverted = 0, |
| 99 | }; |
| 100 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | static struct platform_device *n30_devices[] __initdata = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | &s3c_device_lcd, |
| 103 | &s3c_device_wdt, |
| 104 | &s3c_device_i2c, |
| 105 | &s3c_device_iis, |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 106 | &s3c_device_usb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | &s3c_device_usbgadget, |
| 108 | }; |
| 109 | |
| 110 | static struct s3c2410_platform_i2c n30_i2ccfg = { |
| 111 | .flags = 0, |
| 112 | .slave_addr = 0x10, |
| 113 | .bus_freq = 10*1000, |
| 114 | .max_freq = 10*1000, |
| 115 | }; |
| 116 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 117 | static void __init n30_map_io(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | { |
| 119 | s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); |
| 120 | s3c24xx_init_clocks(0); |
| 121 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 124 | static void __init n30_init_irq(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | { |
| 126 | s3c24xx_init_irq(); |
| 127 | } |
| 128 | |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 129 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 131 | static void __init n30_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | { |
| 133 | s3c_device_i2c.dev.platform_data = &n30_i2ccfg; |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame^] | 134 | s3c24xx_udc_set_platdata(&n30_udc_cfg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 136 | /* Turn off suspend on both USB ports, and switch the |
| 137 | * selectable USB port to USB device mode. */ |
| 138 | |
| 139 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
| 140 | S3C2410_MISCCR_USBSUSPND0 | |
| 141 | S3C2410_MISCCR_USBSUSPND1, 0x0); |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 142 | |
| 143 | platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | MACHINE_START(N30, "Acer-N30") |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 147 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, |
| 148 | Ben Dooks <ben-linux@fluff.org> |
| 149 | */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 150 | .phys_io = S3C2410_PA_UART, |
| 151 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
| 152 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | .timer = &s3c24xx_timer, |
| 154 | .init_machine = n30_init, |
| 155 | .init_irq = n30_init_irq, |
| 156 | .map_io = n30_map_io, |
| 157 | MACHINE_END |