1*aaf9128aSKuninori Morimoto // SPDX-License-Identifier: GPL-2.0
2da2014a2SPaul Mundt /*
3da2014a2SPaul Mundt * arch/sh/boards/renesas/sdk7780/setup.c
4da2014a2SPaul Mundt *
5da2014a2SPaul Mundt * Renesas Solutions SH7780 SDK Support
6da2014a2SPaul Mundt * Copyright (C) 2008 Nicholas Beck <nbeck@mpc-data.co.uk>
7da2014a2SPaul Mundt */
8da2014a2SPaul Mundt #include <linux/init.h>
9da2014a2SPaul Mundt #include <linux/types.h>
10da2014a2SPaul Mundt #include <linux/platform_device.h>
11da2014a2SPaul Mundt #include <linux/ata_platform.h>
12da2014a2SPaul Mundt #include <asm/machvec.h>
137639a454SPaul Mundt #include <mach/sdk7780.h>
14da2014a2SPaul Mundt #include <asm/heartbeat.h>
15da2014a2SPaul Mundt #include <asm/io.h>
16da2014a2SPaul Mundt #include <asm/addrspace.h>
17da2014a2SPaul Mundt
18da2014a2SPaul Mundt #define GPIO_PECR 0xFFEA0008
19da2014a2SPaul Mundt
20a09d2831SPaul Mundt /* Heartbeat */
21a09d2831SPaul Mundt static struct resource heartbeat_resource = {
22da2014a2SPaul Mundt .start = PA_LED,
23da2014a2SPaul Mundt .end = PA_LED,
24a09d2831SPaul Mundt .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
25da2014a2SPaul Mundt };
26da2014a2SPaul Mundt
27da2014a2SPaul Mundt static struct platform_device heartbeat_device = {
28da2014a2SPaul Mundt .name = "heartbeat",
29da2014a2SPaul Mundt .id = -1,
3014965f16SPaul Mundt .num_resources = 1,
31a09d2831SPaul Mundt .resource = &heartbeat_resource,
32da2014a2SPaul Mundt };
33da2014a2SPaul Mundt
34da2014a2SPaul Mundt /* SMC91x */
35da2014a2SPaul Mundt static struct resource smc91x_eth_resources[] = {
36da2014a2SPaul Mundt [0] = {
37da2014a2SPaul Mundt .name = "smc91x-regs" ,
38da2014a2SPaul Mundt .start = PA_LAN + 0x300,
39da2014a2SPaul Mundt .end = PA_LAN + 0x300 + 0x10 ,
40da2014a2SPaul Mundt .flags = IORESOURCE_MEM,
41da2014a2SPaul Mundt },
42da2014a2SPaul Mundt [1] = {
43da2014a2SPaul Mundt .start = IRQ_ETHERNET,
44da2014a2SPaul Mundt .end = IRQ_ETHERNET,
45da2014a2SPaul Mundt .flags = IORESOURCE_IRQ,
46da2014a2SPaul Mundt },
47da2014a2SPaul Mundt };
48da2014a2SPaul Mundt
49da2014a2SPaul Mundt static struct platform_device smc91x_eth_device = {
50da2014a2SPaul Mundt .name = "smc91x",
51da2014a2SPaul Mundt .id = 0,
52da2014a2SPaul Mundt .dev = {
53da2014a2SPaul Mundt .dma_mask = NULL, /* don't use dma */
54da2014a2SPaul Mundt .coherent_dma_mask = 0xffffffff,
55da2014a2SPaul Mundt },
56da2014a2SPaul Mundt .num_resources = ARRAY_SIZE(smc91x_eth_resources),
57da2014a2SPaul Mundt .resource = smc91x_eth_resources,
58da2014a2SPaul Mundt };
59da2014a2SPaul Mundt
60da2014a2SPaul Mundt static struct platform_device *sdk7780_devices[] __initdata = {
61da2014a2SPaul Mundt &heartbeat_device,
62da2014a2SPaul Mundt &smc91x_eth_device,
63da2014a2SPaul Mundt };
64da2014a2SPaul Mundt
sdk7780_devices_setup(void)65da2014a2SPaul Mundt static int __init sdk7780_devices_setup(void)
66da2014a2SPaul Mundt {
67da2014a2SPaul Mundt return platform_add_devices(sdk7780_devices,
68da2014a2SPaul Mundt ARRAY_SIZE(sdk7780_devices));
69da2014a2SPaul Mundt }
70da2014a2SPaul Mundt device_initcall(sdk7780_devices_setup);
71da2014a2SPaul Mundt
sdk7780_setup(char ** cmdline_p)72da2014a2SPaul Mundt static void __init sdk7780_setup(char **cmdline_p)
73da2014a2SPaul Mundt {
749d56dd3bSPaul Mundt u16 ver = __raw_readw(FPGA_FPVERR);
759d56dd3bSPaul Mundt u16 dateStamp = __raw_readw(FPGA_FPDATER);
76da2014a2SPaul Mundt
77da2014a2SPaul Mundt printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
78da2014a2SPaul Mundt printk(KERN_INFO "Board version: %d (revision %d), "
79da2014a2SPaul Mundt "FPGA version: %d (revision %d), datestamp : %d\n",
80da2014a2SPaul Mundt (ver >> 12) & 0xf, (ver >> 8) & 0xf,
81da2014a2SPaul Mundt (ver >> 4) & 0xf, ver & 0xf,
82da2014a2SPaul Mundt dateStamp);
83da2014a2SPaul Mundt
84da2014a2SPaul Mundt /* Setup pin mux'ing for PCIC */
859d56dd3bSPaul Mundt __raw_writew(0x0000, GPIO_PECR);
86da2014a2SPaul Mundt }
87da2014a2SPaul Mundt
88da2014a2SPaul Mundt /*
89da2014a2SPaul Mundt * The Machine Vector
90da2014a2SPaul Mundt */
91da2014a2SPaul Mundt static struct sh_machine_vector mv_se7780 __initmv = {
92da2014a2SPaul Mundt .mv_name = "Renesas SDK7780-R3" ,
93da2014a2SPaul Mundt .mv_setup = sdk7780_setup,
94da2014a2SPaul Mundt .mv_init_irq = init_sdk7780_IRQ,
95da2014a2SPaul Mundt };
96da2014a2SPaul Mundt
97