Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * linux/arch/m68knommu/platform/5249/config.c |
| 5 | * |
| 6 | * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com) |
| 7 | */ |
| 8 | |
| 9 | /***************************************************************************/ |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/param.h> |
| 13 | #include <linux/init.h> |
Greg Ungerer | 5f84bd5 | 2008-02-01 17:34:30 +1000 | [diff] [blame] | 14 | #include <linux/io.h> |
Greg Ungerer | fa1fc24 | 2011-12-24 12:56:10 +1000 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/machdep.h> |
| 17 | #include <asm/coldfire.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/mcfsim.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | /***************************************************************************/ |
| 21 | |
Greg Ungerer | 4a1479b | 2009-06-12 16:17:20 +1000 | [diff] [blame] | 22 | #ifdef CONFIG_M5249C3 |
| 23 | |
| 24 | static struct resource m5249_smc91x_resources[] = { |
| 25 | { |
| 26 | .start = 0xe0000300, |
| 27 | .end = 0xe0000300 + 0x100, |
| 28 | .flags = IORESOURCE_MEM, |
| 29 | }, |
| 30 | { |
| 31 | .start = MCFINTC2_GPIOIRQ6, |
| 32 | .end = MCFINTC2_GPIOIRQ6, |
| 33 | .flags = IORESOURCE_IRQ, |
| 34 | }, |
| 35 | }; |
| 36 | |
| 37 | static struct platform_device m5249_smc91x = { |
| 38 | .name = "smc91x", |
| 39 | .id = 0, |
| 40 | .num_resources = ARRAY_SIZE(m5249_smc91x_resources), |
| 41 | .resource = m5249_smc91x_resources, |
| 42 | }; |
| 43 | |
| 44 | #endif /* CONFIG_M5249C3 */ |
| 45 | |
Greg Ungerer | fa1fc24 | 2011-12-24 12:56:10 +1000 | [diff] [blame] | 46 | static struct platform_device *m5249_devices[] __initdata = { |
| 47 | #ifdef CONFIG_M5249C3 |
| 48 | &m5249_smc91x, |
| 49 | #endif |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 50 | }; |
| 51 | |
Greg Ungerer | fa1fc24 | 2011-12-24 12:56:10 +1000 | [diff] [blame] | 52 | /***************************************************************************/ |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 53 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 54 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 55 | |
| 56 | static void __init m5249_qspi_init(void) |
| 57 | { |
| 58 | /* QSPI irq setup */ |
| 59 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0, |
| 60 | MCF_MBAR + MCFSIM_QSPIICR); |
| 61 | mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); |
| 62 | } |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 63 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 64 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
Greg Ungerer | 5f84bd5 | 2008-02-01 17:34:30 +1000 | [diff] [blame] | 65 | |
| 66 | /***************************************************************************/ |
| 67 | |
Greg Ungerer | 4a1479b | 2009-06-12 16:17:20 +1000 | [diff] [blame] | 68 | #ifdef CONFIG_M5249C3 |
| 69 | |
| 70 | static void __init m5249_smc91x_init(void) |
| 71 | { |
| 72 | u32 gpio; |
| 73 | |
| 74 | /* Set the GPIO line as interrupt source for smc91x device */ |
| 75 | gpio = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); |
| 76 | writel(gpio | 0x40, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); |
| 77 | |
| 78 | gpio = readl(MCF_MBAR2 + MCFSIM2_INTLEVEL5); |
| 79 | writel(gpio | 0x04000000, MCF_MBAR2 + MCFSIM2_INTLEVEL5); |
| 80 | } |
| 81 | |
| 82 | #endif /* CONFIG_M5249C3 */ |
| 83 | |
| 84 | /***************************************************************************/ |
| 85 | |
Greg Ungerer | 5f84bd5 | 2008-02-01 17:34:30 +1000 | [diff] [blame] | 86 | void __init config_BSP(char *commandp, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | { |
Greg Ungerer | 35aefb2 | 2012-01-23 15:34:58 +1000 | [diff] [blame] | 88 | mach_sched_init = hw_timer_init; |
Greg Ungerer | d894b89 | 2012-02-19 16:16:58 +1000 | [diff] [blame] | 89 | |
Greg Ungerer | 4a1479b | 2009-06-12 16:17:20 +1000 | [diff] [blame] | 90 | #ifdef CONFIG_M5249C3 |
| 91 | m5249_smc91x_init(); |
| 92 | #endif |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 93 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 94 | m5249_qspi_init(); |
| 95 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | /***************************************************************************/ |
Greg Ungerer | 5f84bd5 | 2008-02-01 17:34:30 +1000 | [diff] [blame] | 99 | |
| 100 | static int __init init_BSP(void) |
| 101 | { |
Greg Ungerer | 5f84bd5 | 2008-02-01 17:34:30 +1000 | [diff] [blame] | 102 | platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices)); |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | arch_initcall(init_BSP); |
| 107 | |
| 108 | /***************************************************************************/ |