arm: tegra: fuse: replace globals with functions
[linux-3.10.git] / arch / arm / mach-shmobile / board-bockw.c
1 /*
2  * Bock-W board support
3  *
4  * Copyright (C) 2013  Renesas Solutions Corp.
5  * Copyright (C) 2013  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include <linux/platform_device.h>
22 #include <linux/smsc911x.h>
23 #include <mach/common.h>
24 #include <mach/irqs.h>
25 #include <mach/r8a7778.h>
26 #include <asm/mach/arch.h>
27
28 static struct smsc911x_platform_config smsc911x_data = {
29         .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
30         .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
31         .flags          = SMSC911X_USE_32BIT,
32         .phy_interface  = PHY_INTERFACE_MODE_MII,
33 };
34
35 static struct resource smsc911x_resources[] = {
36         DEFINE_RES_MEM(0x18300000, 0x1000),
37         DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
38 };
39
40 #define IRQ0MR  0x30
41 static void __init bockw_init(void)
42 {
43         void __iomem *fpga;
44
45         r8a7778_clock_init();
46         r8a7778_init_irq_extpin(1);
47         r8a7778_add_standard_devices();
48
49         fpga = ioremap_nocache(0x18200000, SZ_1M);
50         if (fpga) {
51                 /*
52                  * CAUTION
53                  *
54                  * IRQ0/1 is cascaded interrupt from FPGA.
55                  * it should be cared in the future
56                  * Now, it is assuming IRQ0 was used only from SMSC.
57                  */
58                 u16 val = ioread16(fpga + IRQ0MR);
59                 val &= ~(1 << 4); /* enable SMSC911x */
60                 iowrite16(val, fpga + IRQ0MR);
61                 iounmap(fpga);
62
63                 platform_device_register_resndata(
64                         &platform_bus, "smsc911x", -1,
65                         smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
66                         &smsc911x_data, sizeof(smsc911x_data));
67         }
68 }
69
70 static const char *bockw_boards_compat_dt[] __initdata = {
71         "renesas,bockw",
72         NULL,
73 };
74
75 DT_MACHINE_START(BOCKW_DT, "bockw")
76         .init_early     = r8a7778_init_delay,
77         .init_irq       = r8a7778_init_irq_dt,
78         .init_machine   = bockw_init,
79         .init_time      = shmobile_timer_init,
80         .dt_compat      = bockw_boards_compat_dt,
81 MACHINE_END