board-dsm320.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/init.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/mtd/mtd.h>
  19. #include <linux/mtd/map.h>
  20. #include <linux/mtd/physmap.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/mach/irq.h>
  26. #include <mach/devices.h>
  27. #include <mach/gpio.h>
  28. #include "generic.h"
  29. #ifdef CONFIG_PCI
  30. static int dsm320_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  31. {
  32. switch (slot) {
  33. case 0:
  34. /* PCI-AHB bridge? */
  35. return KS8695_IRQ_EXTERN0;
  36. case 18:
  37. /* Mini PCI slot */
  38. return KS8695_IRQ_EXTERN2;
  39. case 20:
  40. /* RealMAGIC chip */
  41. return KS8695_IRQ_EXTERN0;
  42. }
  43. BUG();
  44. }
  45. static struct ks8695_pci_cfg __initdata dsm320_pci = {
  46. .mode = KS8695_MODE_MINIPCI,
  47. .map_irq = dsm320_pci_map_irq,
  48. };
  49. static void __init dsm320_register_pci(void)
  50. {
  51. /* Initialise the GPIO lines for interrupt mode */
  52. /* RealMAGIC */
  53. ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
  54. /* MiniPCI Slot */
  55. ks8695_gpio_interrupt(KS8695_GPIO_2, IRQ_TYPE_LEVEL_LOW);
  56. ks8695_init_pci(&dsm320_pci);
  57. }
  58. #else
  59. static inline void __init dsm320_register_pci(void) { }
  60. #endif
  61. static struct physmap_flash_data dsm320_nor_pdata = {
  62. .width = 4,
  63. .nr_parts = 0,
  64. };
  65. static struct resource dsm320_nor_resource[] = {
  66. [0] = {
  67. .start = SZ_32M, /* We expect the bootloader to map
  68. * the flash here.
  69. */
  70. .end = SZ_32M + SZ_4M - 1,
  71. .flags = IORESOURCE_MEM,
  72. }
  73. };
  74. static struct platform_device dsm320_device_nor = {
  75. .name = "physmap-flash",
  76. .id = -1,
  77. .num_resources = ARRAY_SIZE(dsm320_nor_resource),
  78. .resource = dsm320_nor_resource,
  79. .dev = {
  80. .platform_data = &dsm320_nor_pdata,
  81. },
  82. };
  83. void __init dsm320_register_nor(void)
  84. {
  85. int ret;
  86. ret = platform_device_register(&dsm320_device_nor);
  87. if (ret < 0)
  88. printk(KERN_ERR "failed to register physmap-flash device\n");
  89. }
  90. static void __init dsm320_init(void)
  91. {
  92. /* GPIO registration */
  93. ks8695_register_gpios();
  94. /* PCI registration */
  95. dsm320_register_pci();
  96. /* Network device */
  97. ks8695_add_device_lan(); /* eth0 = LAN */
  98. /* NOR devices */
  99. dsm320_register_nor();
  100. }
  101. MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
  102. /* Maintainer: Simtec Electronics. */
  103. .boot_params = KS8695_SDRAM_PA + 0x100,
  104. .map_io = ks8695_map_io,
  105. .init_irq = ks8695_init_irq,
  106. .init_machine = dsm320_init,
  107. .timer = &ks8695_timer,
  108. MACHINE_END