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 12#include <linux/init.h> 13#include <linux/pagemap.h> 14#include <linux/platform_device.h> 15#include <linux/ioport.h> 16#include <asm/io.h> 17#include <asm/machdep.h> 18#include <asm/ppc4xx_pic.h> 19 20/* 21 * Define external IRQ senses and polarities. 22 */ 23unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = { 24 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */ 25 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */ 26 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */ 27 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */ 28 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */ 29 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */ 30}; 31 32static struct resource smc91x_resources[] = { 33 [0] = { 34 .start = SMC91111_BASE_ADDR, 35 .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1, 36 .flags = IORESOURCE_MEM, 37 }, 38 [1] = { 39 .start = SMC91111_IRQ, 40 .end = SMC91111_IRQ, 41 .flags = IORESOURCE_IRQ, 42 }, 43}; 44 45static struct platform_device smc91x_device = { 46 .name = "smc91x", 47 .id = 0, 48 .num_resources = ARRAY_SIZE(smc91x_resources), 49 .resource = smc91x_resources, 50}; 51 52static struct platform_device *redwood5_devs[] __initdata = { 53 &smc91x_device, 54}; 55 56static int __init 57redwood5_platform_add_devices(void) 58{ 59 return platform_add_devices(redwood5_devs, ARRAY_SIZE(redwood5_devs)); 60} 61 62void __init 63redwood5_setup_arch(void) 64{ 65 ppc4xx_setup_arch(); 66 67#ifdef CONFIG_DEBUG_BRINGUP 68 printk("\n"); 69 printk("machine\t: %s\n", PPC4xx_MACHINE_NAME); 70 printk("\n"); 71 printk("bi_s_version\t %s\n", bip->bi_s_version); 72 printk("bi_r_version\t %s\n", bip->bi_r_version); 73 printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,bip->bi_memsize/(1024*1000)); 74 printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0, 75 bip->bi_enetaddr[0], bip->bi_enetaddr[1], 76 bip->bi_enetaddr[2], bip->bi_enetaddr[3], 77 bip->bi_enetaddr[4], bip->bi_enetaddr[5]); 78 79 printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n", 80 bip->bi_intfreq, bip->bi_intfreq/ 1000000); 81 82 printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n", 83 bip->bi_busfreq, bip->bi_busfreq / 1000000 ); 84 printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n", 85 bip->bi_tbfreq, bip->bi_tbfreq/1000000); 86 87 printk("\n"); 88#endif 89 device_initcall(redwood5_platform_add_devices); 90} 91 92void __init 93redwood5_map_io(void) 94{ 95 int i; 96 97 ppc4xx_map_io(); 98 for (i = 0; i < 16; i++) { 99 unsigned long v, p; 100 101 /* 0x400x0000 -> 0xe00x0000 */ 102 p = 0x40000000 | (i << 16); 103 v = STB04xxx_IO_BASE | (i << 16); 104 105 io_block_mapping(v, p, PAGE_SIZE, 106 _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) | _PAGE_GUARDED); 107 } 108 109 110} 111 112void __init 113platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 114 unsigned long r6, unsigned long r7) 115{ 116 ppc4xx_init(r3, r4, r5, r6, r7); 117 118 ppc_md.setup_arch = redwood5_setup_arch; 119 ppc_md.setup_io_mappings = redwood5_map_io; 120} 121