blob: e3ccf1a5e0d81cb73c0d6248be0dc867c04d9e0a [file] [log] [blame]
Daniel Silverstone6174dee2008-12-13 20:44:15 +00001/*
2 * arch/arm/mach-ks8695/board-dsm320.c
3 *
4 * DSM-320 D-Link Wireless Media Player, board support.
5 *
6 * Copyright 2008 Simtec Electronics
7 * Daniel Silverstone <dsilvers@simtec.co.uk>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
Russell King2f8163b2011-07-26 10:53:52 +010013#include <linux/gpio.h>
Daniel Silverstone6174dee2008-12-13 20:44:15 +000014#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/physmap.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/mach-types.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30
31#include <mach/devices.h>
Daniel Silverstone6174dee2008-12-13 20:44:15 +000032
33#include "generic.h"
34
35#ifdef CONFIG_PCI
Ralf Baechled5341942011-06-10 15:30:21 +010036static int dsm320_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Daniel Silverstone6174dee2008-12-13 20:44:15 +000037{
38 switch (slot) {
39 case 0:
40 /* PCI-AHB bridge? */
41 return KS8695_IRQ_EXTERN0;
42 case 18:
43 /* Mini PCI slot */
44 return KS8695_IRQ_EXTERN2;
45 case 20:
46 /* RealMAGIC chip */
47 return KS8695_IRQ_EXTERN0;
48 }
49 BUG();
50}
51
52static struct ks8695_pci_cfg __initdata dsm320_pci = {
53 .mode = KS8695_MODE_MINIPCI,
54 .map_irq = dsm320_pci_map_irq,
55};
56
57static void __init dsm320_register_pci(void)
58{
59 /* Initialise the GPIO lines for interrupt mode */
60 /* RealMAGIC */
61 ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
62 /* MiniPCI Slot */
63 ks8695_gpio_interrupt(KS8695_GPIO_2, IRQ_TYPE_LEVEL_LOW);
64
65 ks8695_init_pci(&dsm320_pci);
66}
67
68#else
69static inline void __init dsm320_register_pci(void) { }
70#endif
71
72static struct physmap_flash_data dsm320_nor_pdata = {
73 .width = 4,
74 .nr_parts = 0,
75};
76
77static struct resource dsm320_nor_resource[] = {
78 [0] = {
79 .start = SZ_32M, /* We expect the bootloader to map
80 * the flash here.
81 */
82 .end = SZ_32M + SZ_4M - 1,
83 .flags = IORESOURCE_MEM,
84 }
85};
86
87static struct platform_device dsm320_device_nor = {
88 .name = "physmap-flash",
89 .id = -1,
90 .num_resources = ARRAY_SIZE(dsm320_nor_resource),
91 .resource = dsm320_nor_resource,
92 .dev = {
93 .platform_data = &dsm320_nor_pdata,
94 },
95};
96
97void __init dsm320_register_nor(void)
98{
99 int ret;
100
101 ret = platform_device_register(&dsm320_device_nor);
102 if (ret < 0)
103 printk(KERN_ERR "failed to register physmap-flash device\n");
104}
105
106static void __init dsm320_init(void)
107{
108 /* GPIO registration */
109 ks8695_register_gpios();
110
111 /* PCI registration */
112 dsm320_register_pci();
113
114 /* Network device */
115 ks8695_add_device_lan(); /* eth0 = LAN */
116
117 /* NOR devices */
118 dsm320_register_nor();
119}
120
121MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
122 /* Maintainer: Simtec Electronics. */
Daniel Silverstone6174dee2008-12-13 20:44:15 +0000123 .boot_params = KS8695_SDRAM_PA + 0x100,
124 .map_io = ks8695_map_io,
125 .init_irq = ks8695_init_irq,
126 .init_machine = dsm320_init,
127 .timer = &ks8695_timer,
128MACHINE_END