/arch/arm/mach-s3c2410/mach-n30.c

https://bitbucket.org/evzijst/gittest · C · 155 lines · 102 code · 25 blank · 28 comment · 0 complexity · c91496d5b9b9fb95859847454c250219 MD5 · raw file

  1. /* linux/arch/arm/mach-s3c2410/mach-n30.c
  2. *
  3. * Copyright (c) 2003-2005 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Copyright (c) 2005 Christer Weinigel <christer@weinigel.se>
  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. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/timer.h>
  20. #include <linux/init.h>
  21. #include <linux/delay.h>
  22. #include <linux/device.h>
  23. #include <linux/kthread.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/mach/irq.h>
  27. #include <asm/hardware.h>
  28. #include <asm/hardware/iomd.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/arch/regs-serial.h>
  33. #include <asm/arch/regs-gpio.h>
  34. #include <asm/arch/iic.h>
  35. #include <linux/serial_core.h>
  36. #include "s3c2410.h"
  37. #include "clock.h"
  38. #include "devs.h"
  39. #include "cpu.h"
  40. static struct map_desc n30_iodesc[] __initdata = {
  41. /* nothing here yet */
  42. };
  43. static struct s3c2410_uartcfg n30_uartcfgs[] = {
  44. /* Normal serial port */
  45. [0] = {
  46. .hwport = 0,
  47. .flags = 0,
  48. .ucon = 0x2c5,
  49. .ulcon = 0x03,
  50. .ufcon = 0x51,
  51. },
  52. /* IR port */
  53. [1] = {
  54. .hwport = 1,
  55. .flags = 0,
  56. .uart_flags = UPF_CONS_FLOW,
  57. .ucon = 0x2c5,
  58. .ulcon = 0x43,
  59. .ufcon = 0x51,
  60. },
  61. /* The BlueTooth controller is connected to port 2 */
  62. [2] = {
  63. .hwport = 2,
  64. .flags = 0,
  65. .ucon = 0x2c5,
  66. .ulcon = 0x03,
  67. .ufcon = 0x51,
  68. },
  69. };
  70. static struct platform_device *n30_devices[] __initdata = {
  71. &s3c_device_usb,
  72. &s3c_device_lcd,
  73. &s3c_device_wdt,
  74. &s3c_device_i2c,
  75. &s3c_device_iis,
  76. &s3c_device_usbgadget,
  77. };
  78. static struct s3c2410_platform_i2c n30_i2ccfg = {
  79. .flags = 0,
  80. .slave_addr = 0x10,
  81. .bus_freq = 10*1000,
  82. .max_freq = 10*1000,
  83. };
  84. static struct s3c24xx_board n30_board __initdata = {
  85. .devices = n30_devices,
  86. .devices_count = ARRAY_SIZE(n30_devices)
  87. };
  88. void __init n30_map_io(void)
  89. {
  90. s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
  91. s3c24xx_init_clocks(0);
  92. s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
  93. s3c24xx_set_board(&n30_board);
  94. }
  95. void __init n30_init_irq(void)
  96. {
  97. s3c24xx_init_irq();
  98. }
  99. static int n30_usbstart_thread(void *unused)
  100. {
  101. /* Turn off suspend on both USB ports, and switch the
  102. * selectable USB port to USB device mode. */
  103. writel(readl(S3C2410_MISCCR) & ~0x00003008, S3C2410_MISCCR);
  104. /* Turn off the D+ pull up for 3 seconds so that the USB host
  105. * at the other end will do a rescan of the USB bus. */
  106. s3c2410_gpio_setpin(S3C2410_GPB3, 0);
  107. msleep_interruptible(3*HZ);
  108. s3c2410_gpio_setpin(S3C2410_GPB3, 1);
  109. return 0;
  110. }
  111. void __init n30_init(void)
  112. {
  113. s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
  114. kthread_run(n30_usbstart_thread, NULL, "n30_usbstart");
  115. }
  116. MACHINE_START(N30, "Acer-N30")
  117. MAINTAINER("Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org>")
  118. BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART)
  119. BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
  120. .timer = &s3c24xx_timer,
  121. .init_machine = n30_init,
  122. .init_irq = n30_init_irq,
  123. .map_io = n30_map_io,
  124. MACHINE_END
  125. /*
  126. Local variables:
  127. compile-command: "make ARCH=arm CROSS_COMPILE=/usr/local/arm/3.3.2/bin/arm-linux- -k -C ../../.."
  128. c-basic-offset: 8
  129. End:
  130. */