linux/arch/arm/mach-ks8695/board-dsm320.c

131 lines
2.8 KiB
C
Raw Normal View History

/*
* arch/arm/mach-ks8695/board-dsm320.c
*
* DSM-320 D-Link Wireless Media Player, board support.
*
* Copyright 2008 Simtec Electronics
* Daniel Silverstone <dsilvers@simtec.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/partitions.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <mach/devices.h>
#include <mach/gpio-ks8695.h>
#include "generic.h"
#ifdef CONFIG_PCI
PCI: Make the struct pci_dev * argument of pci_fixup_irqs const. Aside of the usual motivation for constification, this function has a history of being abused a hook for interrupt and other fixups so I turned this function const ages ago in the MIPS code but it should be done treewide. Due to function pointer passing in varous places a few other functions had to be constified as well. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> To: Anton Vorontsov <avorontsov@mvista.com> To: Chris Metcalf <cmetcalf@tilera.com> To: Colin Cross <ccross@android.com> Acked-by: "David S. Miller" <davem@davemloft.net> To: Eric Miao <eric.y.miao@gmail.com> To: Erik Gilling <konkers@android.com> Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> To: "H. Peter Anvin" <hpa@zytor.com> To: Imre Kaloz <kaloz@openwrt.org> To: Ingo Molnar <mingo@redhat.com> To: Ivan Kokshaysky <ink@jurassic.park.msu.ru> To: Jesse Barnes <jbarnes@virtuousgeek.org> To: Krzysztof Halasa <khc@pm.waw.pl> To: Lennert Buytenhek <kernel@wantstofly.org> To: Matt Turner <mattst88@gmail.com> To: Nicolas Pitre <nico@fluxnic.net> To: Olof Johansson <olof@lixom.net> Acked-by: Paul Mundt <lethal@linux-sh.org> To: Richard Henderson <rth@twiddle.net> To: Russell King <linux@arm.linux.org.uk> To: Thomas Gleixner <tglx@linutronix.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: linux-alpha@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-pci@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: linux-tegra@vger.kernel.org Cc: sparclinux@vger.kernel.org Cc: x86@kernel.org Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-06-10 22:30:21 +08:00
static int dsm320_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
switch (slot) {
case 0:
/* PCI-AHB bridge? */
return KS8695_IRQ_EXTERN0;
case 18:
/* Mini PCI slot */
return KS8695_IRQ_EXTERN2;
case 20:
/* RealMAGIC chip */
return KS8695_IRQ_EXTERN0;
}
BUG();
}
static struct ks8695_pci_cfg __initdata dsm320_pci = {
.mode = KS8695_MODE_MINIPCI,
.map_irq = dsm320_pci_map_irq,
};
static void __init dsm320_register_pci(void)
{
/* Initialise the GPIO lines for interrupt mode */
/* RealMAGIC */
ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
/* MiniPCI Slot */
ks8695_gpio_interrupt(KS8695_GPIO_2, IRQ_TYPE_LEVEL_LOW);
ks8695_init_pci(&dsm320_pci);
}
#else
static inline void __init dsm320_register_pci(void) { }
#endif
static struct physmap_flash_data dsm320_nor_pdata = {
.width = 4,
.nr_parts = 0,
};
static struct resource dsm320_nor_resource[] = {
[0] = {
.start = SZ_32M, /* We expect the bootloader to map
* the flash here.
*/
.end = SZ_32M + SZ_4M - 1,
.flags = IORESOURCE_MEM,
}
};
static struct platform_device dsm320_device_nor = {
.name = "physmap-flash",
.id = -1,
.num_resources = ARRAY_SIZE(dsm320_nor_resource),
.resource = dsm320_nor_resource,
.dev = {
.platform_data = &dsm320_nor_pdata,
},
};
void __init dsm320_register_nor(void)
{
int ret;
ret = platform_device_register(&dsm320_device_nor);
if (ret < 0)
printk(KERN_ERR "failed to register physmap-flash device\n");
}
static void __init dsm320_init(void)
{
/* GPIO registration */
ks8695_register_gpios();
/* PCI registration */
dsm320_register_pci();
/* Network device */
ks8695_add_device_lan(); /* eth0 = LAN */
/* NOR devices */
dsm320_register_nor();
}
MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
/* Maintainer: Simtec Electronics. */
.atag_offset = 0x100,
.map_io = ks8695_map_io,
.init_irq = ks8695_init_irq,
.init_machine = dsm320_init,
.timer = &ks8695_timer,
.restart = ks8695_restart,
MACHINE_END