board-dsm320.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * arch/arm/mach-ks8695/board-dsm320.c
  3. *
  4. * DSM-320 D-Link Wireless Media Player, board support.
  5. *
  6. * Copyright 2008 Simtec Electronics
  7. * Daniel Silverstone <dsilvers@simtec.co.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/gpio.h>
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/init.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/map.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <linux/mtd/partitions.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/mach/irq.h>
  27. #include "devices.h"
  28. #include <mach/gpio-ks8695.h>
  29. #include "generic.h"
  30. #ifdef CONFIG_PCI
  31. static int dsm320_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  32. {
  33. switch (slot) {
  34. case 0:
  35. /* PCI-AHB bridge? */
  36. return KS8695_IRQ_EXTERN0;
  37. case 18:
  38. /* Mini PCI slot */
  39. return KS8695_IRQ_EXTERN2;
  40. case 20:
  41. /* RealMAGIC chip */
  42. return KS8695_IRQ_EXTERN0;
  43. }
  44. BUG();
  45. }
  46. static struct ks8695_pci_cfg __initdata dsm320_pci = {
  47. .mode = KS8695_MODE_MINIPCI,
  48. .map_irq = dsm320_pci_map_irq,
  49. };
  50. static void __init dsm320_register_pci(void)
  51. {
  52. /* Initialise the GPIO lines for interrupt mode */
  53. /* RealMAGIC */
  54. ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
  55. /* MiniPCI Slot */
  56. ks8695_gpio_interrupt(KS8695_GPIO_2, IRQ_TYPE_LEVEL_LOW);
  57. ks8695_init_pci(&dsm320_pci);
  58. }
  59. #else
  60. static inline void __init dsm320_register_pci(void) { }
  61. #endif
  62. static struct physmap_flash_data dsm320_nor_pdata = {
  63. .width = 4,
  64. .nr_parts = 0,
  65. };
  66. static struct resource dsm320_nor_resource[] = {
  67. [0] = {
  68. .start = SZ_32M, /* We expect the bootloader to map
  69. * the flash here.
  70. */
  71. .end = SZ_32M + SZ_4M - 1,
  72. .flags = IORESOURCE_MEM,
  73. }
  74. };
  75. static struct platform_device dsm320_device_nor = {
  76. .name = "physmap-flash",
  77. .id = -1,
  78. .num_resources = ARRAY_SIZE(dsm320_nor_resource),
  79. .resource = dsm320_nor_resource,
  80. .dev = {
  81. .platform_data = &dsm320_nor_pdata,
  82. },
  83. };
  84. void __init dsm320_register_nor(void)
  85. {
  86. int ret;
  87. ret = platform_device_register(&dsm320_device_nor);
  88. if (ret < 0)
  89. printk(KERN_ERR "failed to register physmap-flash device\n");
  90. }
  91. static void __init dsm320_init(void)
  92. {
  93. /* GPIO registration */
  94. ks8695_register_gpios();
  95. /* PCI registration */
  96. dsm320_register_pci();
  97. /* Network device */
  98. ks8695_add_device_lan(); /* eth0 = LAN */
  99. /* NOR devices */
  100. dsm320_register_nor();
  101. }
  102. MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
  103. /* Maintainer: Simtec Electronics. */
  104. .atag_offset = 0x100,
  105. .map_io = ks8695_map_io,
  106. .init_irq = ks8695_init_irq,
  107. .init_machine = dsm320_init,
  108. .init_time = ks8695_timer_init,
  109. .restart = ks8695_restart,
  110. MACHINE_END