device.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * s6105 platform devices
  3. *
  4. * Copyright (c) 2009 emlix GmbH
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/init.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/serial.h>
  10. #include <linux/serial_8250.h>
  11. #include <variant/hardware.h>
  12. #define UART_INTNUM 4
  13. static const signed char uart_irq_mappings[] = {
  14. S6_INTC_UART(0),
  15. S6_INTC_UART(1),
  16. -1,
  17. };
  18. const signed char *platform_irq_mappings[NR_IRQS] = {
  19. [UART_INTNUM] = uart_irq_mappings,
  20. };
  21. static struct plat_serial8250_port serial_platform_data[] = {
  22. {
  23. .membase = (void *)S6_REG_UART + 0x0000,
  24. .mapbase = S6_REG_UART + 0x0000,
  25. .irq = UART_INTNUM,
  26. .uartclk = S6_SCLK,
  27. .regshift = 2,
  28. .iotype = SERIAL_IO_MEM,
  29. .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
  30. },
  31. {
  32. .membase = (void *)S6_REG_UART + 0x1000,
  33. .mapbase = S6_REG_UART + 0x1000,
  34. .irq = UART_INTNUM,
  35. .uartclk = S6_SCLK,
  36. .regshift = 2,
  37. .iotype = SERIAL_IO_MEM,
  38. .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
  39. },
  40. { },
  41. };
  42. static struct platform_device platform_devices[] = {
  43. {
  44. .name = "serial8250",
  45. .id = PLAT8250_DEV_PLATFORM,
  46. .dev = {
  47. .platform_data = serial_platform_data,
  48. },
  49. },
  50. };
  51. static int __init device_init(void)
  52. {
  53. int i;
  54. for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
  55. platform_device_register(&platform_devices[i]);
  56. return 0;
  57. }
  58. arch_initcall_sync(device_init);