Commit 2c536200 authored by David Brownell's avatar David Brownell Committed by Linus Torvalds

Fix AT91RM9200 build breakage

The at91_cf driver got out of sync with certain changes in the PCMCIA
layer, notably getting rid of some duplication of data ... causing the
version merged to kernel.org to fail compiling.

This patch gives the at91_cf platform device a new iomem resource, using
it so this new pcmcia scheme works.  It also cleans up some whitepsace
bugs that have accumulated over time (mostly too-long lines).
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 64541d19
...@@ -194,13 +194,23 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {} ...@@ -194,13 +194,23 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
static struct at91_cf_data cf_data; static struct at91_cf_data cf_data;
static struct resource at91_cf_resources[] = {
[0] = {
.start = AT91_CF_BASE,
/* ties up CS4, CS5, and CS6 */
.end = AT91_CF_BASE + (0x30000000 - 1),
.flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
},
};
static struct platform_device at91rm9200_cf_device = { static struct platform_device at91rm9200_cf_device = {
.name = "at91_cf", .name = "at91_cf",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &cf_data, .platform_data = &cf_data,
}, },
.num_resources = 0, .resource = at91_cf_resources,
.num_resources = ARRAY_SIZE(at91_cf_resources),
}; };
void __init at91_add_device_cf(struct at91_cf_data *data) void __init at91_add_device_cf(struct at91_cf_data *data)
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#define CF_SIZE 0x30000000 /* CS5+CS6: unavailable */
/* /*
* A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW;
* some other bit in {A24,A22..A11} is nREG to flag memory access * some other bit in {A24,A22..A11} is nREG to flag memory access
...@@ -76,7 +74,8 @@ static irqreturn_t at91_cf_irq(int irq, void *_cf, struct pt_regs *r) ...@@ -76,7 +74,8 @@ static irqreturn_t at91_cf_irq(int irq, void *_cf, struct pt_regs *r)
/* kick pccard as needed */ /* kick pccard as needed */
if (present != cf->present) { if (present != cf->present) {
cf->present = present; cf->present = present;
pr_debug("%s: card %s\n", driver_name, present ? "present" : "gone"); pr_debug("%s: card %s\n", driver_name,
present ? "present" : "gone");
pcmcia_parse_events(&cf->socket, SS_DETECT); pcmcia_parse_events(&cf->socket, SS_DETECT);
} }
} }
...@@ -93,7 +92,7 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp) ...@@ -93,7 +92,7 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
cf = container_of(s, struct at91_cf_socket, socket); cf = container_of(s, struct at91_cf_socket, socket);
/* NOTE: we assume 3VCARD, not XVCARD... */ /* NOTE: CF is always 3VCARD */
if (at91_cf_present(cf)) { if (at91_cf_present(cf)) {
int rdy = cf->board->irq_pin; /* RDY/nIRQ */ int rdy = cf->board->irq_pin; /* RDY/nIRQ */
int vcc = cf->board->vcc_pin; int vcc = cf->board->vcc_pin;
...@@ -109,7 +108,8 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp) ...@@ -109,7 +108,8 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
return 0; return 0;
} }
static int at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) static int
at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s)
{ {
struct at91_cf_socket *cf; struct at91_cf_socket *cf;
...@@ -184,7 +184,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) ...@@ -184,7 +184,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
} }
/* pcmcia layer maps/unmaps mem regions */ /* pcmcia layer maps/unmaps mem regions */
static int at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) static int
at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map)
{ {
struct at91_cf_socket *cf; struct at91_cf_socket *cf;
...@@ -218,12 +219,17 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -218,12 +219,17 @@ static int __init at91_cf_probe(struct device *dev)
struct at91_cf_socket *cf; struct at91_cf_socket *cf;
struct at91_cf_data *board = dev->platform_data; struct at91_cf_data *board = dev->platform_data;
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct resource *io;
unsigned int csa; unsigned int csa;
int status; int status;
if (!board || !board->det_pin || !board->rst_pin) if (!board || !board->det_pin || !board->rst_pin)
return -ENODEV; return -ENODEV;
io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io)
return -ENODEV;
cf = kcalloc(1, sizeof *cf, GFP_KERNEL); cf = kcalloc(1, sizeof *cf, GFP_KERNEL);
if (!cf) if (!cf)
return -ENOMEM; return -ENOMEM;
...@@ -250,10 +256,14 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -250,10 +256,14 @@ static int __init at91_cf_probe(struct device *dev)
* REVISIT: these timings are in terms of MCK cycles, so * REVISIT: these timings are in terms of MCK cycles, so
* when MCK changes (cpufreq etc) so must these values... * when MCK changes (cpufreq etc) so must these values...
*/ */
at91_sys_write(AT91_SMC_CSR(4), AT91_SMC_ACSS_STD | AT91_SMC_DBW_16 | AT91_SMC_BAT | AT91_SMC_WSEN at91_sys_write(AT91_SMC_CSR(4),
| AT91_SMC_NWS_(32) /* wait states */ AT91_SMC_ACSS_STD
| AT91_SMC_RWSETUP_(6) /* setup time */ | AT91_SMC_DBW_16
| AT91_SMC_RWHOLD_(4) /* hold time */ | AT91_SMC_BAT
| AT91_SMC_WSEN
| AT91_SMC_NWS_(32) /* wait states */
| AT91_SMC_RWSETUP_(6) /* setup time */
| AT91_SMC_RWHOLD_(4) /* hold time */
); );
/* must be a GPIO; ergo must trigger on both edges */ /* must be a GPIO; ergo must trigger on both edges */
...@@ -274,8 +284,7 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -274,8 +284,7 @@ static int __init at91_cf_probe(struct device *dev)
if (status < 0) if (status < 0)
goto fail0a; goto fail0a;
cf->socket.pci_irq = board->irq_pin; cf->socket.pci_irq = board->irq_pin;
} } else
else
cf->socket.pci_irq = NR_IRQS + 1; cf->socket.pci_irq = NR_IRQS + 1;
/* pcmcia layer only remaps "real" memory not iospace */ /* pcmcia layer only remaps "real" memory not iospace */
...@@ -284,7 +293,8 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -284,7 +293,8 @@ static int __init at91_cf_probe(struct device *dev)
goto fail1; goto fail1;
/* reserve CS4, CS5, and CS6 regions; but use just CS4 */ /* reserve CS4, CS5, and CS6 regions; but use just CS4 */
if (!request_mem_region(AT91_CF_BASE, CF_SIZE, driver_name)) if (!request_mem_region(io->start, io->end + 1 - io->start,
driver_name))
goto fail1; goto fail1;
pr_info("%s: irqs det #%d, io #%d\n", driver_name, pr_info("%s: irqs det #%d, io #%d\n", driver_name,
...@@ -297,7 +307,7 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -297,7 +307,7 @@ static int __init at91_cf_probe(struct device *dev)
cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
| SS_CAP_MEM_ALIGN; | SS_CAP_MEM_ALIGN;
cf->socket.map_size = SZ_2K; cf->socket.map_size = SZ_2K;
cf->socket.io[0].NumPorts = SZ_2K; cf->socket.io[0].res = io;
status = pcmcia_register_socket(&cf->socket); status = pcmcia_register_socket(&cf->socket);
if (status < 0) if (status < 0)
...@@ -307,7 +317,7 @@ static int __init at91_cf_probe(struct device *dev) ...@@ -307,7 +317,7 @@ static int __init at91_cf_probe(struct device *dev)
fail2: fail2:
iounmap((void __iomem *) cf->socket.io_offset); iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(AT91_CF_BASE, CF_SIZE); release_mem_region(io->start, io->end + 1 - io->start);
fail1: fail1:
if (board->irq_pin) if (board->irq_pin)
free_irq(board->irq_pin, cf); free_irq(board->irq_pin, cf);
...@@ -321,14 +331,15 @@ fail0: ...@@ -321,14 +331,15 @@ fail0:
static int __exit at91_cf_remove(struct device *dev) static int __exit at91_cf_remove(struct device *dev)
{ {
struct at91_cf_socket *cf = dev_get_drvdata(dev); struct at91_cf_socket *cf = dev_get_drvdata(dev);
unsigned int csa; struct resource *io = cf->socket.io[0].res;
unsigned int csa;
pcmcia_unregister_socket(&cf->socket); pcmcia_unregister_socket(&cf->socket);
free_irq(cf->board->irq_pin, cf); free_irq(cf->board->irq_pin, cf);
free_irq(cf->board->det_pin, cf); free_irq(cf->board->det_pin, cf);
iounmap((void __iomem *) cf->socket.io_offset); iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(AT91_CF_BASE, CF_SIZE); release_mem_region(io->start, io->end + 1 - io->start);
csa = at91_sys_read(AT91_EBI_CSA); csa = at91_sys_read(AT91_EBI_CSA);
at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A);
...@@ -342,8 +353,8 @@ static struct device_driver at91_cf_driver = { ...@@ -342,8 +353,8 @@ static struct device_driver at91_cf_driver = {
.bus = &platform_bus_type, .bus = &platform_bus_type,
.probe = at91_cf_probe, .probe = at91_cf_probe,
.remove = __exit_p(at91_cf_remove), .remove = __exit_p(at91_cf_remove),
.suspend = pcmcia_socket_dev_suspend, .suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume, .resume = pcmcia_socket_dev_resume,
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment