redwood5.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Support for the IBM redwood5 eval board file
  3. *
  4. * Author: Armin Kuster <akuster@mvista.com>
  5. *
  6. * 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/pagemap.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/ioport.h>
  15. #include <asm/io.h>
  16. #include <asm/machdep.h>
  17. #include <asm/ppc4xx_pic.h>
  18. /*
  19. * Define external IRQ senses and polarities.
  20. */
  21. unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
  22. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */
  23. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */
  24. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */
  25. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */
  26. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */
  27. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */
  28. };
  29. static struct resource smc91x_resources[] = {
  30. [0] = {
  31. .start = SMC91111_BASE_ADDR,
  32. .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. [1] = {
  36. .start = SMC91111_IRQ,
  37. .end = SMC91111_IRQ,
  38. .flags = IORESOURCE_IRQ,
  39. },
  40. };
  41. static struct platform_device smc91x_device = {
  42. .name = "smc91x",
  43. .id = 0,
  44. .num_resources = ARRAY_SIZE(smc91x_resources),
  45. .resource = smc91x_resources,
  46. };
  47. static struct platform_device *redwood5_devs[] __initdata = {
  48. &smc91x_device,
  49. };
  50. static int __init
  51. redwood5_platform_add_devices(void)
  52. {
  53. return platform_add_devices(redwood5_devs, ARRAY_SIZE(redwood5_devs));
  54. }
  55. void __init
  56. redwood5_setup_arch(void)
  57. {
  58. ppc4xx_setup_arch();
  59. #ifdef CONFIG_DEBUG_BRINGUP
  60. printk("\n");
  61. printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
  62. printk("\n");
  63. printk("bi_s_version\t %s\n", bip->bi_s_version);
  64. printk("bi_r_version\t %s\n", bip->bi_r_version);
  65. printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,bip->bi_memsize/(1024*1000));
  66. printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
  67. bip->bi_enetaddr[0], bip->bi_enetaddr[1],
  68. bip->bi_enetaddr[2], bip->bi_enetaddr[3],
  69. bip->bi_enetaddr[4], bip->bi_enetaddr[5]);
  70. printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
  71. bip->bi_intfreq, bip->bi_intfreq/ 1000000);
  72. printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
  73. bip->bi_busfreq, bip->bi_busfreq / 1000000 );
  74. printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
  75. bip->bi_tbfreq, bip->bi_tbfreq/1000000);
  76. printk("\n");
  77. #endif
  78. device_initcall(redwood5_platform_add_devices);
  79. }
  80. void __init
  81. redwood5_map_io(void)
  82. {
  83. int i;
  84. ppc4xx_map_io();
  85. for (i = 0; i < 16; i++) {
  86. unsigned long v, p;
  87. /* 0x400x0000 -> 0xe00x0000 */
  88. p = 0x40000000 | (i << 16);
  89. v = STB04xxx_IO_BASE | (i << 16);
  90. io_block_mapping(v, p, PAGE_SIZE,
  91. _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) | _PAGE_GUARDED);
  92. }
  93. }
  94. void __init
  95. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  96. unsigned long r6, unsigned long r7)
  97. {
  98. ppc4xx_init(r3, r4, r5, r6, r7);
  99. ppc_md.setup_arch = redwood5_setup_arch;
  100. ppc_md.setup_io_mappings = redwood5_map_io;
  101. }