redwood6.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * arch/ppc/platforms/4xx/redwood6.c
  3. *
  4. * Author: Armin Kuster <akuster@mvista.com>
  5. *
  6. * 2002 (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/config.h>
  12. #include <linux/init.h>
  13. #include <linux/pagemap.h>
  14. #include <linux/device.h>
  15. #include <linux/ioport.h>
  16. #include <asm/io.h>
  17. #include <asm/ppc4xx_pic.h>
  18. #include <linux/delay.h>
  19. #include <asm/machdep.h>
  20. /*
  21. * Define external IRQ senses and polarities.
  22. */
  23. unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
  24. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 7 */
  25. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 8 */
  26. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 9 */
  27. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */
  28. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */
  29. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */
  30. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */
  31. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */
  32. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */
  33. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 6 */
  34. };
  35. static struct resource smc91x_resources[] = {
  36. [0] = {
  37. .start = SMC91111_BASE_ADDR,
  38. .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1,
  39. .flags = IORESOURCE_MEM,
  40. },
  41. [1] = {
  42. .start = SMC91111_IRQ,
  43. .end = SMC91111_IRQ,
  44. .flags = IORESOURCE_IRQ,
  45. },
  46. };
  47. static struct platform_device smc91x_device = {
  48. .name = "smc91x",
  49. .id = 0,
  50. .num_resources = ARRAY_SIZE(smc91x_resources),
  51. .resource = smc91x_resources,
  52. };
  53. static struct platform_device *redwood6_devs[] __initdata = {
  54. &smc91x_device,
  55. };
  56. static int __init
  57. redwood6_platform_add_devices(void)
  58. {
  59. return platform_add_devices(redwood6_devs, ARRAY_SIZE(redwood6_devs));
  60. }
  61. void __init
  62. redwood6_setup_arch(void)
  63. {
  64. #ifdef CONFIG_IDE
  65. void *xilinx, *xilinx_1, *xilinx_2;
  66. unsigned short us_reg5;
  67. #endif
  68. ppc4xx_setup_arch();
  69. #ifdef CONFIG_IDE
  70. xilinx = (unsigned long) ioremap(IDE_XLINUX_MUX_BASE, 0x10);
  71. /* init xilinx control registers - enable ide mux, clear reset bit */
  72. if (!xilinx) {
  73. printk(KERN_CRIT
  74. "redwood6_setup_arch() xilinxi ioremap failed\n");
  75. return;
  76. }
  77. xilinx_1 = xilinx + 0xa;
  78. xilinx_2 = xilinx + 0xe;
  79. us_reg5 = readb(xilinx_1);
  80. writeb(0x01d1, xilinx_1);
  81. writeb(0x0008, xilinx_2);
  82. udelay(10 * 1000);
  83. writeb(0x01d1, xilinx_1);
  84. writeb(0x0008, xilinx_2);
  85. #endif
  86. #ifdef DEBUG_BRINGUP
  87. bd_t *bip = (bd_t *) __res;
  88. printk("\n");
  89. printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
  90. printk("\n");
  91. printk("bi_s_version\t %s\n", bip->bi_s_version);
  92. printk("bi_r_version\t %s\n", bip->bi_r_version);
  93. printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,
  94. bip->bi_memsize / (1024 * 1000));
  95. printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
  96. bip->bi_enetaddr[0], bip->bi_enetaddr[1], bip->bi_enetaddr[2],
  97. bip->bi_enetaddr[3], bip->bi_enetaddr[4], bip->bi_enetaddr[5]);
  98. printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
  99. bip->bi_intfreq, bip->bi_intfreq / 1000000);
  100. printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
  101. bip->bi_busfreq, bip->bi_busfreq / 1000000);
  102. printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
  103. bip->bi_tbfreq, bip->bi_tbfreq / 1000000);
  104. printk("\n");
  105. #endif
  106. /* Identify the system */
  107. printk(KERN_INFO "IBM Redwood6 (STBx25XX) Platform\n");
  108. printk(KERN_INFO
  109. "Port by MontaVista Software, Inc. (source@mvista.com)\n");
  110. device_initcall(redwood6_platform_add_devices);
  111. }
  112. void __init
  113. redwood6_map_io(void)
  114. {
  115. int i;
  116. ppc4xx_map_io();
  117. for (i = 0; i < 16; i++) {
  118. unsigned long v, p;
  119. /* 0x400x0000 -> 0xe00x0000 */
  120. p = 0x40000000 | (i << 16);
  121. v = STBx25xx_IO_BASE | (i << 16);
  122. io_block_mapping(v, p, PAGE_SIZE,
  123. _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) |
  124. _PAGE_GUARDED);
  125. }
  126. }
  127. void __init
  128. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  129. unsigned long r6, unsigned long r7)
  130. {
  131. ppc4xx_init(r3, r4, r5, r6, r7);
  132. ppc_md.setup_arch = redwood6_setup_arch;
  133. ppc_md.setup_io_mappings = redwood6_map_io;
  134. }