1/*
2 * Author: Armin Kuster <akuster@mvista.com>
3 *
4 * 2000-2001 (c) MontaVista, Software, Inc.  This file is licensed under
5 * the terms of the GNU General Public License version 2.  This program
6 * is licensed "as is" without any warranty of any kind, whether express
7 * or implied.
8 */
9
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <asm/ocp.h>
13#include <asm/ppc4xx_pic.h>
14#include <platforms/4xx/ibmstb4.h>
15
16static struct ocp_func_iic_data ibmstb4_iic0_def = {
17	.fast_mode	= 0,		/* Use standad mode (100Khz) */
18};
19
20static struct ocp_func_iic_data ibmstb4_iic1_def = {
21	.fast_mode	= 0,		/* Use standad mode (100Khz) */
22};
23OCP_SYSFS_IIC_DATA()
24
25struct ocp_def core_ocp[] __initdata = {
26	{ .vendor	= OCP_VENDOR_IBM,
27	  .function	= OCP_FUNC_16550,
28	  .index	= 0,
29	  .paddr	= UART0_IO_BASE,
30	  .irq		= UART0_INT,
31	  .pm		= IBM_CPM_UART0,
32	},
33	{ .vendor	= OCP_VENDOR_IBM,
34	  .function	= OCP_FUNC_16550,
35	  .index	= 1,
36	  .paddr	= UART1_IO_BASE,
37	  .irq		= UART1_INT,
38	  .pm		= IBM_CPM_UART1,
39	},
40	{ .vendor	= OCP_VENDOR_IBM,
41	  .function	= OCP_FUNC_16550,
42	  .index	= 2,
43	  .paddr	= UART2_IO_BASE,
44	  .irq		= UART2_INT,
45	  .pm		= IBM_CPM_UART2,
46	},
47	{ .vendor	= OCP_VENDOR_IBM,
48	  .function	= OCP_FUNC_IIC,
49	  .paddr	= IIC0_BASE,
50	  .irq		= IIC0_IRQ,
51	  .pm		= IBM_CPM_IIC0,
52	  .additions	= &ibmstb4_iic0_def,
53	  .show		= &ocp_show_iic_data
54	},
55	{ .vendor	= OCP_VENDOR_IBM,
56	  .function	= OCP_FUNC_IIC,
57	  .paddr	= IIC1_BASE,
58	  .irq		= IIC1_IRQ,
59	  .pm		= IBM_CPM_IIC1,
60	  .additions	= &ibmstb4_iic1_def,
61	  .show		= &ocp_show_iic_data
62	},
63	{ .vendor	= OCP_VENDOR_IBM,
64	  .function	= OCP_FUNC_GPIO,
65	  .paddr	= GPIO0_BASE,
66	  .irq		= OCP_IRQ_NA,
67	  .pm		= IBM_CPM_GPIO0,
68	},
69	{ .vendor	= OCP_VENDOR_IBM,
70	  .function	= OCP_FUNC_IDE,
71	  .paddr	= IDE0_BASE,
72	  .irq		= IDE0_IRQ,
73	  .pm		= OCP_CPM_NA,
74	},
75	{ .vendor	= OCP_VENDOR_INVALID,
76	}
77};
78
79/* Polarity and triggering settings for internal interrupt sources */
80struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
81	{ .polarity 	= 0x7fffff01,
82	  .triggering	= 0x00000000,
83	  .ext_irq_mask	= 0x0000007e,	/* IRQ0 - IRQ5 */
84	}
85};
86
87static struct resource ohci_usb_resources[] = {
88	[0] = {
89		.start	= USB0_BASE,
90		.end	= USB0_BASE + USB0_SIZE - 1,
91		.flags	= IORESOURCE_MEM,
92	},
93	[1] = {
94		.start	= USB0_IRQ,
95		.end	= USB0_IRQ,
96		.flags	= IORESOURCE_IRQ,
97	},
98};
99
100static u64 dma_mask = 0xffffffffULL;
101
102static struct platform_device ohci_usb_device = {
103	.name		= "ppc-soc-ohci",
104	.id		= 0,
105	.num_resources	= ARRAY_SIZE(ohci_usb_resources),
106	.resource	= ohci_usb_resources,
107	.dev		= {
108		.dma_mask = &dma_mask,
109		.coherent_dma_mask = 0xffffffffULL,
110	}
111};
112
113static struct platform_device *ibmstb4_devs[] __initdata = {
114	&ohci_usb_device,
115};
116
117static int __init
118ibmstb4_platform_add_devices(void)
119{
120	return platform_add_devices(ibmstb4_devs, ARRAY_SIZE(ibmstb4_devs));
121}
122arch_initcall(ibmstb4_platform_add_devices);
123