xref: /openbmc/linux/arch/sh/boards/mach-se/7780/setup.c (revision aaf9128a)
1aaf9128aSKuninori Morimoto // SPDX-License-Identifier: GPL-2.0
2da2014a2SPaul Mundt /*
3da2014a2SPaul Mundt  * linux/arch/sh/boards/se/7780/setup.c
4da2014a2SPaul Mundt  *
5da2014a2SPaul Mundt  * Copyright (C) 2006,2007  Nobuhiro Iwamatsu
6da2014a2SPaul Mundt  *
7da2014a2SPaul Mundt  * Hitachi UL SolutionEngine 7780 Support.
8da2014a2SPaul Mundt  */
9da2014a2SPaul Mundt #include <linux/init.h>
10da2014a2SPaul Mundt #include <linux/platform_device.h>
11da2014a2SPaul Mundt #include <asm/machvec.h>
12939a24a6SPaul Mundt #include <mach-se/mach/se7780.h>
13da2014a2SPaul Mundt #include <asm/io.h>
14da2014a2SPaul Mundt #include <asm/heartbeat.h>
15da2014a2SPaul Mundt 
16da2014a2SPaul Mundt /* Heartbeat */
17a09d2831SPaul Mundt static struct resource heartbeat_resource = {
18da2014a2SPaul Mundt 	.start  = PA_LED,
19da2014a2SPaul Mundt 	.end    = PA_LED,
20a09d2831SPaul Mundt 	.flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
21da2014a2SPaul Mundt };
22da2014a2SPaul Mundt 
23da2014a2SPaul Mundt static struct platform_device heartbeat_device = {
24da2014a2SPaul Mundt 	.name           = "heartbeat",
25da2014a2SPaul Mundt 	.id             = -1,
26a09d2831SPaul Mundt 	.num_resources  = 1,
27a09d2831SPaul Mundt 	.resource       = &heartbeat_resource,
28da2014a2SPaul Mundt };
29da2014a2SPaul Mundt 
30da2014a2SPaul Mundt /* SMC91x */
31da2014a2SPaul Mundt static struct resource smc91x_eth_resources[] = {
32da2014a2SPaul Mundt 	[0] = {
33da2014a2SPaul Mundt 		.name   = "smc91x-regs" ,
34da2014a2SPaul Mundt 		.start  = PA_LAN + 0x300,
35da2014a2SPaul Mundt 		.end    = PA_LAN + 0x300 + 0x10 ,
36da2014a2SPaul Mundt 		.flags  = IORESOURCE_MEM,
37da2014a2SPaul Mundt 	},
38da2014a2SPaul Mundt 	[1] = {
39da2014a2SPaul Mundt 		.start  = SMC_IRQ,
40da2014a2SPaul Mundt 		.end    = SMC_IRQ,
41da2014a2SPaul Mundt 		.flags  = IORESOURCE_IRQ,
42da2014a2SPaul Mundt 	},
43da2014a2SPaul Mundt };
44da2014a2SPaul Mundt 
45da2014a2SPaul Mundt static struct platform_device smc91x_eth_device = {
46da2014a2SPaul Mundt 	.name           = "smc91x",
47da2014a2SPaul Mundt 	.id             = 0,
48da2014a2SPaul Mundt 	.dev = {
49da2014a2SPaul Mundt 		.dma_mask               = NULL,         /* don't use dma */
50da2014a2SPaul Mundt 		.coherent_dma_mask      = 0xffffffff,
51da2014a2SPaul Mundt 	},
52da2014a2SPaul Mundt 	.num_resources  = ARRAY_SIZE(smc91x_eth_resources),
53da2014a2SPaul Mundt 	.resource       = smc91x_eth_resources,
54da2014a2SPaul Mundt };
55da2014a2SPaul Mundt 
56da2014a2SPaul Mundt static struct platform_device *se7780_devices[] __initdata = {
57da2014a2SPaul Mundt 	&heartbeat_device,
58da2014a2SPaul Mundt 	&smc91x_eth_device,
59da2014a2SPaul Mundt };
60da2014a2SPaul Mundt 
se7780_devices_setup(void)61da2014a2SPaul Mundt static int __init se7780_devices_setup(void)
62da2014a2SPaul Mundt {
63da2014a2SPaul Mundt 	return platform_add_devices(se7780_devices,
64da2014a2SPaul Mundt 		ARRAY_SIZE(se7780_devices));
65da2014a2SPaul Mundt }
66da2014a2SPaul Mundt device_initcall(se7780_devices_setup);
67da2014a2SPaul Mundt 
68da2014a2SPaul Mundt #define GPIO_PHCR        0xFFEA000E
69da2014a2SPaul Mundt #define GPIO_PMSELR      0xFFEA0080
70da2014a2SPaul Mundt #define GPIO_PECR        0xFFEA0008
71da2014a2SPaul Mundt 
se7780_setup(char ** cmdline_p)72da2014a2SPaul Mundt static void __init se7780_setup(char **cmdline_p)
73da2014a2SPaul Mundt {
74da2014a2SPaul Mundt 	/* "SH-Linux" on LED Display */
759d56dd3bSPaul Mundt 	__raw_writew( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
769d56dd3bSPaul Mundt 	__raw_writew( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
779d56dd3bSPaul Mundt 	__raw_writew( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
789d56dd3bSPaul Mundt 	__raw_writew( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
799d56dd3bSPaul Mundt 	__raw_writew( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
809d56dd3bSPaul Mundt 	__raw_writew( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
819d56dd3bSPaul Mundt 	__raw_writew( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
829d56dd3bSPaul Mundt 	__raw_writew( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
83da2014a2SPaul Mundt 
84da2014a2SPaul Mundt 	printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
85da2014a2SPaul Mundt 
86da2014a2SPaul Mundt 	/*
87da2014a2SPaul Mundt 	 * PCI REQ/GNT setting
88da2014a2SPaul Mundt 	 *   REQ0/GNT0 -> USB
89da2014a2SPaul Mundt 	 *   REQ1/GNT1 -> PC Card
90da2014a2SPaul Mundt 	 *   REQ2/GNT2 -> Serial ATA
91da2014a2SPaul Mundt 	 *   REQ3/GNT3 -> PCI slot
92da2014a2SPaul Mundt 	 */
939d56dd3bSPaul Mundt 	__raw_writew(0x0213, FPGA_REQSEL);
94da2014a2SPaul Mundt 
95da2014a2SPaul Mundt 	/* GPIO setting */
969d56dd3bSPaul Mundt 	__raw_writew(0x0000, GPIO_PECR);
979d56dd3bSPaul Mundt 	__raw_writew(__raw_readw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
989d56dd3bSPaul Mundt 	__raw_writew(0x0c00, GPIO_PMSELR);
99da2014a2SPaul Mundt 
100da2014a2SPaul Mundt 	/* iVDR Power ON */
1019d56dd3bSPaul Mundt 	__raw_writew(0x0001, FPGA_IVDRPW);
102da2014a2SPaul Mundt }
103da2014a2SPaul Mundt 
104da2014a2SPaul Mundt /*
105da2014a2SPaul Mundt  * The Machine Vector
106da2014a2SPaul Mundt  */
107da2014a2SPaul Mundt static struct sh_machine_vector mv_se7780 __initmv = {
108da2014a2SPaul Mundt 	.mv_name                = "Solution Engine 7780" ,
109da2014a2SPaul Mundt 	.mv_setup               = se7780_setup ,
110da2014a2SPaul Mundt 	.mv_init_irq		= init_se7780_IRQ,
111da2014a2SPaul Mundt };
112