mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
e7b3dc7ef1
smc91x is shared between many different platforms. Each platform needs to specify the interrupt type, and in some cases the irq type depends on more than just the build configuration - it depends on runtime checks. Rather than throwing this code into the SMC_IRQ_FLAGS definition, provide a way for these flags to be passed via the IRQ resource itself. Note that IRQF_TRIGGER_* constants are intentionally defined to correspond with the IORESOURCE_IRQ_* interrupt type flags, in much the same way that the low bits of PCI iomem resources correspond with the BAR flag bits. Also provide a way to configure smc91x to read the IRQ flags from the resource. Once all platforms have been converted over (signified by all definitions of SMC_IRQ_FLAGS being -1) SMC_IRQ_FLAGS should be removed. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Nicolas Pitre <nico@cam.org> Acked-by: Jeff Garzik <jgarzik@redhat.com>
87 lines
1.9 KiB
C
87 lines
1.9 KiB
C
/*
|
|
* linux/arch/arm/plat-omap/debug-devices.c
|
|
*
|
|
* Copyright (C) 2005 Nokia Corporation
|
|
* Modified from mach-omap2/board-h4.c
|
|
*
|
|
* 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/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <asm/hardware.h>
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/board.h>
|
|
#include <asm/arch/gpio.h>
|
|
|
|
|
|
/* Many OMAP development platforms reuse the same "debug board"; these
|
|
* platforms include H2, H3, H4, and Perseus2.
|
|
*/
|
|
|
|
static struct resource smc91x_resources[] = {
|
|
[0] = {
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
|
|
},
|
|
};
|
|
|
|
static struct platform_device smc91x_device = {
|
|
.name = "smc91x",
|
|
.id = -1,
|
|
.num_resources = ARRAY_SIZE(smc91x_resources),
|
|
.resource = smc91x_resources,
|
|
};
|
|
|
|
static struct resource led_resources[] = {
|
|
[0] = {
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
};
|
|
|
|
static struct platform_device led_device = {
|
|
.name = "omap_dbg_led",
|
|
.id = -1,
|
|
.num_resources = ARRAY_SIZE(led_resources),
|
|
.resource = led_resources,
|
|
};
|
|
|
|
static struct platform_device *debug_devices[] __initdata = {
|
|
&smc91x_device,
|
|
&led_device,
|
|
/* ps2 kbd + mouse ports */
|
|
/* 4 extra uarts */
|
|
/* 6 input dip switches */
|
|
/* 8 output pins */
|
|
};
|
|
|
|
int __init debug_card_init(u32 addr, unsigned gpio)
|
|
{
|
|
int status;
|
|
|
|
smc91x_resources[0].start = addr + 0x300;
|
|
smc91x_resources[0].end = addr + 0x30f;
|
|
|
|
smc91x_resources[1].start = OMAP_GPIO_IRQ(gpio);
|
|
smc91x_resources[1].end = OMAP_GPIO_IRQ(gpio);
|
|
|
|
status = omap_request_gpio(gpio);
|
|
if (status < 0) {
|
|
printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
|
|
return status;
|
|
}
|
|
omap_set_gpio_direction(gpio, 1);
|
|
|
|
led_resources[0].start = addr;
|
|
led_resources[0].end = addr + SZ_4K - 1;
|
|
|
|
return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));
|
|
}
|