1817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*
29dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek * arch/arm/mach-orion5x/rd88f5182-setup.c
3817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit *
4817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * Marvell Orion-NAS Reference Design Setup
5817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit *
6817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * Maintainer: Ronen Shitrit <rshitrit@marvell.com>
7817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit *
8159ffb3a04f6bc619643af680df406faafd0199dLennert Buytenhek * This file is licensed under the terms of the GNU General Public
9159ffb3a04f6bc619643af680df406faafd0199dLennert Buytenhek * License version 2.  This program is licensed "as is" without any
10817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * warranty of any kind, whether express or implied.
11817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit */
122f8163baada3dbd0ce891c35bc59ae46e773487aRussell King#include <linux/gpio.h>
13817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/kernel.h>
14817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/init.h>
15817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/platform_device.h>
16817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/pci.h>
17817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/irq.h>
18817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/mtd/physmap.h>
19817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/mv643xx_eth.h>
20f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara#include <linux/ata_platform.h>
21817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <linux/i2c.h>
2277a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu#include <linux/leds.h>
23817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <asm/mach-types.h>
24817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <asm/mach/arch.h>
25817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include <asm/mach/pci.h>
26a09e64fbc0094e3073dbb09c3b4bfe4ab669244bRussell King#include <mach/orion5x.h>
27817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#include "common.h"
2819cfd5c09f780ac870fd9d89201c4ebc0b22be81Lennert Buytenhek#include "mpp.h"
29817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
30817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
31817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * RD-88F5182 Info
32817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
33817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
34817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*
35817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * 512K NOR flash Device bus boot chip select
36817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit */
37817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
38817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_NOR_BOOT_BASE		0xf4000000
39817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_NOR_BOOT_SIZE		SZ_512K
40817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
41817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*
42817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * 16M NOR flash on Device bus chip select 1
43817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit */
44817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
45817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_NOR_BASE		0xfc000000
46817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_NOR_SIZE		SZ_16M
47817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
48817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*
49817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * PCI
50817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit */
51817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
52817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_PCI_SLOT0_OFFS	7
53817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_PCI_SLOT0_IRQ_A_PIN	7
54817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit#define RD88F5182_PCI_SLOT0_IRQ_B_PIN	6
55817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
56817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
57817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * 16M NOR Flash on Device bus CS1
58817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
59817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
60817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct physmap_flash_data rd88f5182_nor_flash_data = {
61817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.width		= 1,
62817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
63817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
64817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct resource rd88f5182_nor_flash_resource = {
65817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.flags			= IORESOURCE_MEM,
66817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.start			= RD88F5182_NOR_BASE,
67817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.end			= RD88F5182_NOR_BASE + RD88F5182_NOR_SIZE - 1,
68817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
69817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
70817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct platform_device rd88f5182_nor_flash = {
71817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.name			= "physmap-flash",
72817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.id			= 0,
73817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.dev		= {
74817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		.platform_data	= &rd88f5182_nor_flash_data,
75817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	},
76817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.num_resources		= 1,
77817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.resource		= &rd88f5182_nor_flash_resource,
78817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
79817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
80817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
8177a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu * Use GPIO LED as CPU active indication
82817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
83817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
8477a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu#define RD88F5182_GPIO_LED		0
85817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
8677a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wustatic struct gpio_led rd88f5182_gpio_led_pins[] = {
8777a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	{
8877a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu		.name		= "rd88f5182:cpu",
8977a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu		.default_trigger = "cpu0",
9077a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu		.gpio		= RD88F5182_GPIO_LED,
9177a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	},
9277a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu};
93817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
9477a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wustatic struct gpio_led_platform_data rd88f5182_gpio_led_data = {
9577a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	.leds		= rd88f5182_gpio_led_pins,
9677a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	.num_leds	= ARRAY_SIZE(rd88f5182_gpio_led_pins),
9777a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu};
98817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
9977a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wustatic struct platform_device rd88f5182_gpio_leds = {
10077a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	.name	= "leds-gpio",
10177a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	.id	= -1,
10277a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	.dev	= {
10377a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu		.platform_data = &rd88f5182_gpio_led_data,
10477a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	},
10577a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu};
106817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
107817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
108817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * PCI
109817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
110817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
1114236666688e9dbc38d0c7a98b7cfa16c8961f752Andrew Lunnstatic void __init rd88f5182_pci_preinit(void)
112817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit{
113817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	int pin;
114817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
115817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/*
116817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * Configure PCI GPIO IRQ pins
117817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 */
118817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	pin = RD88F5182_PCI_SLOT0_IRQ_A_PIN;
119817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	if (gpio_request(pin, "PCI IntA") == 0) {
120817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		if (gpio_direction_input(pin) == 0) {
1216845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner			irq_set_irq_type(gpio_to_irq(pin), IRQ_TYPE_LEVEL_LOW);
122817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		} else {
123f8fcf53b958d54918cc50146ec97b3a37b3d5743Masanari Iida			printk(KERN_ERR "rd88f5182_pci_preinit failed to "
124817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit					"set_irq_type pin %d\n", pin);
125817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit			gpio_free(pin);
126817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		}
127817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	} else {
128817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		printk(KERN_ERR "rd88f5182_pci_preinit failed to request gpio %d\n", pin);
129817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	}
130817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
131817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	pin = RD88F5182_PCI_SLOT0_IRQ_B_PIN;
132817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	if (gpio_request(pin, "PCI IntB") == 0) {
133817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		if (gpio_direction_input(pin) == 0) {
1346845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner			irq_set_irq_type(gpio_to_irq(pin), IRQ_TYPE_LEVEL_LOW);
135817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		} else {
136f8fcf53b958d54918cc50146ec97b3a37b3d5743Masanari Iida			printk(KERN_ERR "rd88f5182_pci_preinit failed to "
137817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit					"set_irq_type pin %d\n", pin);
138817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit			gpio_free(pin);
139817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		}
140817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	} else {
141817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		printk(KERN_ERR "rd88f5182_pci_preinit failed to gpio_request %d\n", pin);
142817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	}
143817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit}
144817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
145d5341942d784134f2997b3ff82cd63cf71d1f932Ralf Baechlestatic int __init rd88f5182_pci_map_irq(const struct pci_dev *dev, u8 slot,
146d5341942d784134f2997b3ff82cd63cf71d1f932Ralf Baechle	u8 pin)
147817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit{
14892b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek	int irq;
14992b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek
150817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/*
15192b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek	 * Check for devices with hard-wired IRQs.
152817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 */
15392b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek	irq = orion5x_pci_map_irq(dev, slot, pin);
15492b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek	if (irq != -1)
15592b913b08b18faa487b0c744282fafd944446adeLennert Buytenhek		return irq;
156817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
157817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/*
158817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * PCI IRQs are connected via GPIOs
159817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 */
160817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	switch (slot - RD88F5182_PCI_SLOT0_OFFS) {
161817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	case 0:
162817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		if (pin == 1)
163817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit			return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_A_PIN);
164817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		else
165817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit			return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_B_PIN);
166817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	default:
167817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		return -1;
168817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	}
169817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit}
170817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
171817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct hw_pci rd88f5182_pci __initdata = {
172817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.nr_controllers	= 2,
173817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.preinit	= rd88f5182_pci_preinit,
1749dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	.setup		= orion5x_pci_sys_setup,
1759dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	.scan		= orion5x_pci_sys_scan_bus,
176817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.map_irq	= rd88f5182_pci_map_irq,
177817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
178817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
179817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic int __init rd88f5182_pci_init(void)
180817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit{
181817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	if (machine_is_rd88f5182())
182817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit		pci_common_init(&rd88f5182_pci);
183817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
184817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	return 0;
185817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit}
186817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
187817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritsubsys_initcall(rd88f5182_pci_init);
188817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
189817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
190817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * Ethernet
191817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
192817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
193817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct mv643xx_eth_platform_data rd88f5182_eth_data = {
194ac840605f3b1d9b99e1e6629a54994f8e003ff91Lennert Buytenhek	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
195817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
196817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
197817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
198817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * RTC DS1338 on I2C bus
199817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
200817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic struct i2c_board_info __initdata rd88f5182_i2c_rtc = {
2013760f736716f74bdc62a4ba5406934338da93eb2Jean Delvare	I2C_BOARD_INFO("ds1338", 0x68),
202817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit};
203817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
204817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit/*****************************************************************************
205f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara * Sata
206f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara ****************************************************************************/
207f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bisharastatic struct mv_sata_platform_data rd88f5182_sata_data = {
208e7068ad337a991fba627148a4a57939fdc1e6a2dLennert Buytenhek	.n_ports	= 2,
209f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara};
210f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara
211f244baa3cafb4a49934d1fd944e29885a0fdbc3eSaeed Bishara/*****************************************************************************
212817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit * General Setup
213817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit ****************************************************************************/
214554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunnstatic unsigned int rd88f5182_mpp_modes[] __initdata = {
215554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP0_GPIO,		/* Debug Led */
216554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP1_GPIO,		/* Reset Switch */
217554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP2_UNUSED,
218554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP3_GPIO,		/* RTC Int */
219554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP4_GPIO,
220554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP5_GPIO,
221554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP6_GPIO,		/* PCI_intA */
222554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP7_GPIO,		/* PCI_intB */
223554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP8_UNUSED,
224554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP9_UNUSED,
225554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP10_UNUSED,
226554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP11_UNUSED,
227554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP12_SATA_LED,		/* SATA 0 presence */
228554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP13_SATA_LED,		/* SATA 1 presence */
229554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP14_SATA_LED,		/* SATA 0 active */
230554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP15_SATA_LED,		/* SATA 1 active */
231554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP16_UNUSED,
232554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP17_UNUSED,
233554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP18_UNUSED,
234554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	MPP19_UNUSED,
235554cdaefd1cf7bb54b209c4e68c7cec87ce442a9Andrew Lunn	0,
23619cfd5c09f780ac870fd9d89201c4ebc0b22be81Lennert Buytenhek};
23719cfd5c09f780ac870fd9d89201c4ebc0b22be81Lennert Buytenhek
238817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitritstatic void __init rd88f5182_init(void)
239817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit{
240817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/*
241817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * Setup basic Orion functions. Need to be called early.
242817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 */
2439dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	orion5x_init();
244817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
24519cfd5c09f780ac870fd9d89201c4ebc0b22be81Lennert Buytenhek	orion5x_mpp_conf(rd88f5182_mpp_modes);
24619cfd5c09f780ac870fd9d89201c4ebc0b22be81Lennert Buytenhek
247817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/*
248817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[20] PCI Clock to MV88F5182
249817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[21] PCI Clock to mini PCI CON11
250817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[22] USB 0 over current indication
251817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[23] USB 1 over current indication
252817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[24] USB 1 over current enable
253817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 * MPP[25] USB 0 over current enable
254817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	 */
255817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
256044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	/*
257044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	 * Configure peripherals.
258044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	 */
259044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	orion5x_ehci0_init();
260044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	orion5x_ehci1_init();
2619dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	orion5x_eth_init(&rd88f5182_eth_data);
262044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	orion5x_i2c_init();
2639dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	orion5x_sata_init(&rd88f5182_sata_data);
264044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	orion5x_uart0_init();
2651d5a1a6e92abb1ecb011a673e637146c4e232f1eSaeed Bishara	orion5x_xor_init();
266044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek
2674ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni	mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
2684ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    ORION_MBUS_DEVBUS_BOOT_ATTR,
2694ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    RD88F5182_NOR_BOOT_BASE,
2704ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    RD88F5182_NOR_BOOT_SIZE);
2714ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni	mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_TARGET(1),
2724ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    ORION_MBUS_DEVBUS_ATTR(1),
2734ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    RD88F5182_NOR_BASE,
2744ca2c04085a1caa903e92a5fc0da25362150aac2Thomas Petazzoni				    RD88F5182_NOR_SIZE);
275044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	platform_device_register(&rd88f5182_nor_flash);
27677a4949436452e3ec1b03badb93e5b2dd40b59a2Bryan Wu	platform_device_register(&rd88f5182_gpio_leds);
277044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek
278044f6c7c449ae8ba0353b032706b098a7ad5e304Lennert Buytenhek	i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
279817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit}
280817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit
281817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen ShitritMACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
282817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	/* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
28365aa1b1ea499a75c9920c1ebadacec0a0b8a79a6Nicolas Pitre	.atag_offset	= 0x100,
284817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen Shitrit	.init_machine	= rd88f5182_init,
2859dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	.map_io		= orion5x_map_io,
2864ee1f6b574765a6c97f945e6b0277e5ccac38cb5Lennert Buytenhek	.init_early	= orion5x_init_early,
2879dd0b194bf6804b1998f0fe261b2606ec7b58d72Lennert Buytenhek	.init_irq	= orion5x_init_irq,
2886bb27d7349db51b50c40534710fe164ca0d58902Stephen Warren	.init_time	= orion5x_timer_init,
289764cbcc2e3fa444c205b20b3d7908b06b60716abRussell King	.restart	= orion5x_restart,
290817eb2109d28fcac8f4fd84a9ef3a761de4f8b50Ronen ShitritMACHINE_END
291