md/RAID1: Add missing case for attempting to repair known bad blocks.
[firefly-linux-kernel-4.4.55.git] / arch / m68k / platform / coldfire / m5249.c
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
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/init.h>
14 #include <linux/io.h>
15 #include <linux/platform_device.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfgpio.h>
20
21 /***************************************************************************/
22
23 struct mcf_gpio_chip mcf_gpio_chips[] = {
24         MCFGPS(GPIO0, 0, 32, MCFSIM2_GPIOENABLE, MCFSIM2_GPIOWRITE, MCFSIM2_GPIOREAD),
25         MCFGPS(GPIO1, 32, 32, MCFSIM2_GPIO1ENABLE, MCFSIM2_GPIO1WRITE, MCFSIM2_GPIO1READ),
26 };
27
28 unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
29
30 /***************************************************************************/
31
32 #ifdef CONFIG_M5249C3
33
34 static struct resource m5249_smc91x_resources[] = {
35         {
36                 .start          = 0xe0000300,
37                 .end            = 0xe0000300 + 0x100,
38                 .flags          = IORESOURCE_MEM,
39         },
40         {
41                 .start          = MCFINTC2_GPIOIRQ6,
42                 .end            = MCFINTC2_GPIOIRQ6,
43                 .flags          = IORESOURCE_IRQ,
44         },
45 };
46
47 static struct platform_device m5249_smc91x = {
48         .name                   = "smc91x",
49         .id                     = 0,
50         .num_resources          = ARRAY_SIZE(m5249_smc91x_resources),
51         .resource               = m5249_smc91x_resources,
52 };
53
54 #endif /* CONFIG_M5249C3 */
55
56 static struct platform_device *m5249_devices[] __initdata = {
57 #ifdef CONFIG_M5249C3
58         &m5249_smc91x,
59 #endif
60 };
61
62 /***************************************************************************/
63
64 #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
65
66 static void __init m5249_qspi_init(void)
67 {
68         /* QSPI irq setup */
69         writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0,
70                MCF_MBAR + MCFSIM_QSPIICR);
71         mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
72 }
73
74 #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
75
76 /***************************************************************************/
77
78 #ifdef CONFIG_M5249C3
79
80 static void __init m5249_smc91x_init(void)
81 {
82         u32  gpio;
83
84         /* Set the GPIO line as interrupt source for smc91x device */
85         gpio = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE);
86         writel(gpio | 0x40, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE);
87
88         gpio = readl(MCF_MBAR2 + MCFSIM2_INTLEVEL5);
89         writel(gpio | 0x04000000, MCF_MBAR2 + MCFSIM2_INTLEVEL5);
90 }
91
92 #endif /* CONFIG_M5249C3 */
93
94 /***************************************************************************/
95
96 void __init config_BSP(char *commandp, int size)
97 {
98         mach_sched_init = hw_timer_init;
99
100 #ifdef CONFIG_M5249C3
101         m5249_smc91x_init();
102 #endif
103 #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
104         m5249_qspi_init();
105 #endif
106 }
107
108 /***************************************************************************/
109
110 static int __init init_BSP(void)
111 {
112         platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices));
113         return 0;
114 }
115
116 arch_initcall(init_BSP);
117
118 /***************************************************************************/