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