From cbba0de2f8e4d9bef521d092711a3c8625f7791b Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Wed, 13 Dec 2006 15:40:18 +0900 Subject: pcmcia: Update email address for m8xx driver author Update the m8xx driver's author email address. Signed-off-by: Magnus Damm Signed-off-by: Dominik Brodowski --- drivers/pcmcia/m8xx_pcmcia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index ac70d2cb7dd4..a7de1615ed50 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -1,7 +1,7 @@ /* * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. * - * (C) 1999-2000 Magnus Damm + * (C) 1999-2000 Magnus Damm * (C) 2001-2002 Montavista Software, Inc. * * -- cgit v1.2.3 From 14540c6dfd8d342a5e897da8763a77a145e40acd Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Wed, 30 Jan 2008 15:28:16 +0100 Subject: pcmcia: yenta-cardbus: ENE_TEST_C9_PFENABLE duplicate *_F0 The test only makes sense if we check for _F0 and _F1. Signed-off-by: Roel Kluin <12o3l@tiscali.nl> CC: Daniel Ritz Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ti113x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index d29657bf1b40..87a5fd5c2127 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h @@ -155,7 +155,7 @@ #define ENE_TEST_C9_TLTENABLE 0x02 #define ENE_TEST_C9_PFENABLE_F0 0x04 #define ENE_TEST_C9_PFENABLE_F1 0x08 -#define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F0) +#define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F1) #define ENE_TEST_C9_WPDISALBLE_F0 0x40 #define ENE_TEST_C9_WPDISALBLE_F1 0x80 #define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | ENE_TEST_C9_WPDISALBLE_F1) -- cgit v1.2.3 From f36fe2b90fe93e2f586b24f42413bf8cfad8f626 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 20 May 2008 01:02:40 +0300 Subject: pcmcia: remove CVS keywords This patch removes CVS keywords that weren't updated for a long time from comments. Signed-off-by: Adrian Bunk Signed-off-by: Dominik Brodowski --- drivers/pcmcia/hd64465_ss.c | 2 -- drivers/pcmcia/i82092.c | 2 -- drivers/pcmcia/i82092aa.h | 2 -- 3 files changed, 6 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c index f2e810f53c81..6045e4b69531 100644 --- a/drivers/pcmcia/hd64465_ss.c +++ b/drivers/pcmcia/hd64465_ss.c @@ -1,6 +1,4 @@ /* - * $Id: hd64465_ss.c,v 1.7 2003/07/06 14:42:50 lethal Exp $ - * * Device driver for the PCMCIA controller module of the * Hitachi HD64465 handheld companion chip. * diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index e13618656ff7..46561face128 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -5,8 +5,6 @@ * * Author: Arjan Van De Ven * Loosly based on i82365.c from the pcmcia-cs package - * - * $Id: i82092aa.c,v 1.2 2001/10/23 14:43:34 arjanv Exp $ */ #include diff --git a/drivers/pcmcia/i82092aa.h b/drivers/pcmcia/i82092aa.h index b0d453303c5d..8836d393ad02 100644 --- a/drivers/pcmcia/i82092aa.h +++ b/drivers/pcmcia/i82092aa.h @@ -3,8 +3,6 @@ #include -/* $Id: i82092aa.h,v 1.1.1.1 2001/09/19 14:53:15 dwmw2 Exp $ */ - /* Debuging defines */ #ifdef NOTRACE #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) -- cgit v1.2.3 From b3363997a62d67f76f388c629673094935209d16 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Mon, 14 Apr 2008 17:27:30 +0400 Subject: pcmcia: fix Alchemy warnings Fix the following warnings: drivers/pcmcia/au1000_generic.c: In function `au1x00_pcmcia_socket_probe': drivers/pcmcia/au1000_generic.c:405: warning: integer constant is too large for "long" type drivers/pcmcia/au1000_generic.c:413: warning: integer constant is too large for "long" type by properly postfixing the socket constants. While at it, fix the lines over 80 characters long in the vicinity... Signed-off-by: Sergei Shtylyov Acked-by: Ralf Baechle Signed-off-by: Dominik Brodowski --- drivers/pcmcia/au1000_generic.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index 1e467bb54077..c62437df175e 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h @@ -34,9 +34,9 @@ #define AU1000_PCMCIA_IO_SPEED (255) #define AU1000_PCMCIA_MEM_SPEED (300) -#define AU1X_SOCK0_IO 0xF00000000 -#define AU1X_SOCK0_PHYS_ATTR 0xF40000000 -#define AU1X_SOCK0_PHYS_MEM 0xF80000000 +#define AU1X_SOCK0_IO 0xF00000000ULL +#define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL +#define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL /* pseudo 32 bit phys addresses, which get fixed up to the * real 36 bit address in fixup_bigphys_addr() */ #define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000 @@ -45,16 +45,20 @@ /* pcmcia socket 1 needs external glue logic so the memory map * differs from board to board. */ -#if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_PB1200) -#define AU1X_SOCK1_IO 0xF08000000 -#define AU1X_SOCK1_PHYS_ATTR 0xF48000000 -#define AU1X_SOCK1_PHYS_MEM 0xF88000000 +#if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || \ + defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || \ + defined(CONFIG_MIPS_PB1200) +#define AU1X_SOCK1_IO 0xF08000000ULL +#define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL +#define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000 #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8800000 -#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || defined(CONFIG_MIPS_DB1200) -#define AU1X_SOCK1_IO 0xF04000000 -#define AU1X_SOCK1_PHYS_ATTR 0xF44000000 -#define AU1X_SOCK1_PHYS_MEM 0xF84000000 +#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \ + defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || \ + defined(CONFIG_MIPS_DB1200) +#define AU1X_SOCK1_IO 0xF04000000ULL +#define AU1X_SOCK1_PHYS_ATTR 0xF44000000ULL +#define AU1X_SOCK1_PHYS_MEM 0xF84000000ULL #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4400000 #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8400000 #endif -- cgit v1.2.3 From 2df697036ba69ea99b73a2dbf82dcc8fec62d4ab Mon Sep 17 00:00:00 2001 From: Leonardo Potenza Date: Tue, 1 Apr 2008 23:47:09 +0200 Subject: pcmcia: i82365.c: check request_irq return value Add a check for the request_irq() return value. Signed-off-by: Leonardo Potenza Signed-off-by: Dominik Brodowski --- drivers/pcmcia/i82365.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 32a2ab119798..68f6b2702bc4 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -1263,7 +1263,7 @@ static int __init init_i82365(void) ret = driver_register(&i82365_driver); if (ret) - return ret; + goto err_out; i82365_device = platform_device_alloc("i82365", 0); if (i82365_device) { @@ -1273,10 +1273,8 @@ static int __init init_i82365(void) } else ret = -ENOMEM; - if (ret) { - driver_unregister(&i82365_driver); - return ret; - } + if (ret) + goto err_driver_unregister; printk(KERN_INFO "Intel ISA PCIC probe: "); sockets = 0; @@ -1285,16 +1283,17 @@ static int __init init_i82365(void) if (sockets == 0) { printk("not found.\n"); - platform_device_unregister(i82365_device); - release_region(i365_base, 2); - driver_unregister(&i82365_driver); - return -ENODEV; + ret = -ENODEV; + goto err_dev_unregister; } /* Set up interrupt handler(s) */ if (grab_irq != 0) - request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); - + ret = request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); + + if (ret) + goto err_socket_release; + /* register sockets with the pcmcia core */ for (i = 0; i < sockets; i++) { socket[i].socket.dev.parent = &i82365_device->dev; @@ -1324,7 +1323,23 @@ static int __init init_i82365(void) } return 0; - +err_socket_release: + for (i = 0; i < sockets; i++) { + /* Turn off all interrupt sources! */ + i365_set(i, I365_CSCINT, 0); + release_region(socket[i].ioaddr, 2); + } +err_dev_unregister: + platform_device_unregister(i82365_device); + release_region(i365_base, 2); +#ifdef CONFIG_PNP + if (i82365_pnpdev) + pnp_disable_dev(i82365_pnpdev); +#endif +err_driver_unregister: + driver_unregister(&i82365_driver); +err_out: + return ret; } /* init_i82365 */ static void __exit exit_i82365(void) -- cgit v1.2.3 From 0b402094199762dde81bee8c32d323cf52f2c6e7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 22 Apr 2007 13:55:36 +0100 Subject: pcmcia: cs: kill thread_wait There is not reason to have a waitqueue if it's always the same thread that is waiting for it. Just use wake_up_process instead. Signed-off-by: Christoph Hellwig Small modification: Also remove unused variable. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs.c | 12 +++--------- include/pcmcia/ss.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 29276bd28295..6bb1bb5db9c4 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -238,7 +238,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) init_completion(&socket->socket_released); init_completion(&socket->thread_done); - init_waitqueue_head(&socket->thread_wait); mutex_init(&socket->skt_mutex); spin_lock_init(&socket->thread_lock); @@ -278,10 +277,9 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); - if (socket->thread) { - wake_up(&socket->thread_wait); + if (socket->thread) kthread_stop(socket->thread); - } + release_cis_mem(socket); /* remove from our own list */ @@ -635,7 +633,6 @@ static void socket_detect_change(struct pcmcia_socket *skt) static int pccardd(void *__skt) { struct pcmcia_socket *skt = __skt; - DECLARE_WAITQUEUE(wait, current); int ret; skt->thread = current; @@ -656,7 +653,6 @@ static int pccardd(void *__skt) if (ret) dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); - add_wait_queue(&skt->thread_wait, &wait); complete(&skt->thread_done); set_freezable(); @@ -694,8 +690,6 @@ static int pccardd(void *__skt) /* make sure we are running before we exit */ set_current_state(TASK_RUNNING); - remove_wait_queue(&skt->thread_wait, &wait); - /* remove from the device core */ pccard_sysfs_remove_socket(&skt->dev); device_unregister(&skt->dev); @@ -716,7 +710,7 @@ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) s->thread_events |= events; spin_unlock_irqrestore(&s->thread_lock, flags); - wake_up(&s->thread_wait); + wake_up_process(s->thread); } } /* pcmcia_parse_events */ EXPORT_SYMBOL(pcmcia_parse_events); diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index f95dca077c1c..2edc7fa3bab3 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -245,7 +245,6 @@ struct pcmcia_socket { struct task_struct *thread; struct completion thread_done; - wait_queue_head_t thread_wait; spinlock_t thread_lock; /* protects thread_events */ unsigned int thread_events; -- cgit v1.2.3 From 0478cf269974e0c7d98f5c5eed815ffb958ddee6 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 29 May 2008 10:42:16 +0200 Subject: pcmcia: remove version.h pcmcia/version.h is empty and its existence is not even needed by deprecated userspace tools. CC: David Sterba Signed-off-by: Jiri Kosina Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/ipwireless/main.c | 1 - drivers/pcmcia/m8xx_pcmcia.c | 1 - include/pcmcia/version.h | 3 --- 3 files changed, 5 deletions(-) delete mode 100644 include/pcmcia/version.h (limited to 'drivers/pcmcia') diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 00c7f8407e3e..cc7dcea2d283 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index a7de1615ed50..13a5fbd50a07 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -60,7 +60,6 @@ #include #include -#include #include #include #include diff --git a/include/pcmcia/version.h b/include/pcmcia/version.h deleted file mode 100644 index 5ad9c5e198b6..000000000000 --- a/include/pcmcia/version.h +++ /dev/null @@ -1,3 +0,0 @@ -/* version.h 1.94 2000/10/03 17:55:48 (David Hinds) */ - -/* This file will be removed, please don't include it */ -- cgit v1.2.3 From 785e821eb679c171f453722f15c6791de0c1abe1 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 11 Jun 2008 09:06:16 +0200 Subject: pcmcia: add support CompactFlash PCMCIA support for Blackfin. A new host driver to add CompactFlash PCMCIA support for Blackfin. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Michael Hennerich Signed-off-by: Bryan Wu Cc: Mike Frysinger Signed-off-by: Andrew Morton Signed-off-by: Dominik Brodowski --- drivers/pcmcia/Kconfig | 7 + drivers/pcmcia/Makefile | 1 + drivers/pcmcia/bfin_cf_pcmcia.c | 339 ++++++++++++++++++++++++++++++++++++++++ include/pcmcia/cs_types.h | 3 +- 4 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 drivers/pcmcia/bfin_cf_pcmcia.c (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 1b0eb5aaf650..e45402adac3f 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig @@ -263,6 +263,13 @@ config OMAP_CF Say Y here to support the CompactFlash controller on OMAP. Note that this doesn't support "True IDE" mode. +config BFIN_CFPCMCIA + tristate "Blackfin CompactFlash PCMCIA Driver" + depends on PCMCIA && BLACKFIN + help + Say Y here to support the CompactFlash PCMCIA driver for Blackfin. + + config AT91_CF tristate "AT91 CompactFlash Controller" depends on PCMCIA && ARCH_AT91RM9200 diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 6f6478ba7174..85c6cc931f97 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o obj-$(CONFIG_OMAP_CF) += omap_cf.o +obj-$(CONFIG_BFIN_CFPCMCIA) += bfin_cf_pcmcia.o obj-$(CONFIG_AT91_CF) += at91_cf.o obj-$(CONFIG_ELECTRA_CF) += electra_cf.o diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c new file mode 100644 index 000000000000..bb7338863fb9 --- /dev/null +++ b/drivers/pcmcia/bfin_cf_pcmcia.c @@ -0,0 +1,339 @@ +/* + * file: drivers/pcmcia/bfin_cf.c + * + * based on: drivers/pcmcia/omap_cf.c + * omap_cf.c -- OMAP 16xx CompactFlash controller driver + * + * Copyright (c) 2005 David Brownell + * Copyright (c) 2006-2008 Michael Hennerich Analog Devices Inc. + * + * bugs: enter bugs at http://blackfin.uclinux.org/ + * + * this program is free software; you can redistribute it and/or modify + * it under the terms of the gnu general public license as published by + * the free software foundation; either version 2, or (at your option) + * any later version. + * + * this program is distributed in the hope that it will be useful, + * but without any warranty; without even the implied warranty of + * merchantability or fitness for a particular purpose. see the + * gnu general public license for more details. + * + * you should have received a copy of the gnu general public license + * along with this program; see the file copying. + * if not, write to the free software foundation, + * 59 temple place - suite 330, boston, ma 02111-1307, usa. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define SZ_1K 0x00000400 +#define SZ_8K 0x00002000 +#define SZ_2K (2 * SZ_1K) + +#define POLL_INTERVAL (2 * HZ) + +#define CF_ATASEL_ENA 0x20311802 /* Inverts RESET */ +#define CF_ATASEL_DIS 0x20311800 + +#define bfin_cf_present(pfx) (gpio_get_value(pfx)) + +/*--------------------------------------------------------------------------*/ + +static const char driver_name[] = "bfin_cf_pcmcia"; + +struct bfin_cf_socket { + struct pcmcia_socket socket; + + struct timer_list timer; + unsigned present:1; + unsigned active:1; + + struct platform_device *pdev; + unsigned long phys_cf_io; + unsigned long phys_cf_attr; + u_int irq; + u_short cd_pfx; +}; + +/*--------------------------------------------------------------------------*/ +static int bfin_cf_reset(void) +{ + outw(0, CF_ATASEL_ENA); + mdelay(200); + outw(0, CF_ATASEL_DIS); + + return 0; +} + +static int bfin_cf_ss_init(struct pcmcia_socket *s) +{ + return 0; +} + +/* the timer is primarily to kick this socket's pccardd */ +static void bfin_cf_timer(unsigned long _cf) +{ + struct bfin_cf_socket *cf = (void *)_cf; + unsigned short present = bfin_cf_present(cf->cd_pfx); + + if (present != cf->present) { + cf->present = present; + dev_dbg(&cf->pdev->dev, ": card %s\n", + present ? "present" : "gone"); + pcmcia_parse_events(&cf->socket, SS_DETECT); + } + + if (cf->active) + mod_timer(&cf->timer, jiffies + POLL_INTERVAL); +} + +static int bfin_cf_get_status(struct pcmcia_socket *s, u_int *sp) +{ + struct bfin_cf_socket *cf; + + if (!sp) + return -EINVAL; + + cf = container_of(s, struct bfin_cf_socket, socket); + + if (bfin_cf_present(cf->cd_pfx)) { + *sp = SS_READY | SS_DETECT | SS_POWERON | SS_3VCARD; + s->irq.AssignedIRQ = 0; + s->pci_irq = cf->irq; + + } else + *sp = 0; + return 0; +} + +static int +bfin_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) +{ + + struct bfin_cf_socket *cf; + cf = container_of(sock, struct bfin_cf_socket, socket); + + switch (s->Vcc) { + case 0: + case 33: + break; + case 50: + break; + default: + return -EINVAL; + } + + if (s->flags & SS_RESET) { + disable_irq(cf->irq); + bfin_cf_reset(); + enable_irq(cf->irq); + } + + dev_dbg(&cf->pdev->dev, ": Vcc %d, io_irq %d, flags %04x csc %04x\n", + s->Vcc, s->io_irq, s->flags, s->csc_mask); + + return 0; +} + +static int bfin_cf_ss_suspend(struct pcmcia_socket *s) +{ + return bfin_cf_set_socket(s, &dead_socket); +} + +/* regions are 2K each: mem, attrib, io (and reserved-for-ide) */ + +static int bfin_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) +{ + struct bfin_cf_socket *cf; + + cf = container_of(s, struct bfin_cf_socket, socket); + io->flags &= MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT; + io->start = cf->phys_cf_io; + io->stop = io->start + SZ_2K - 1; + return 0; +} + +static int +bfin_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) +{ + struct bfin_cf_socket *cf; + + if (map->card_start) + return -EINVAL; + cf = container_of(s, struct bfin_cf_socket, socket); + map->static_start = cf->phys_cf_io; + map->flags &= MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT; + if (map->flags & MAP_ATTRIB) + map->static_start = cf->phys_cf_attr; + + return 0; +} + +static struct pccard_operations bfin_cf_ops = { + .init = bfin_cf_ss_init, + .suspend = bfin_cf_ss_suspend, + .get_status = bfin_cf_get_status, + .set_socket = bfin_cf_set_socket, + .set_io_map = bfin_cf_set_io_map, + .set_mem_map = bfin_cf_set_mem_map, +}; + +/*--------------------------------------------------------------------------*/ + +static int __devinit bfin_cf_probe(struct platform_device *pdev) +{ + struct bfin_cf_socket *cf; + struct resource *io_mem, *attr_mem; + int irq; + unsigned short cd_pfx; + int status = 0; + + dev_info(&pdev->dev, "Blackfin CompactFlash/PCMCIA Socket Driver\n"); + + irq = platform_get_irq(pdev, 0); + if (!irq) + return -EINVAL; + + cd_pfx = platform_get_irq(pdev, 1); /*Card Detect GPIO PIN */ + + if (gpio_request(cd_pfx, "pcmcia: CD")) { + dev_err(&pdev->dev, + "Failed ro request Card Detect GPIO_%d\n", + cd_pfx); + return -EBUSY; + } + gpio_direction_input(cd_pfx); + + cf = kzalloc(sizeof *cf, GFP_KERNEL); + if (!cf) { + gpio_free(cd_pfx); + return -ENOMEM; + } + + cf->cd_pfx = cd_pfx; + + setup_timer(&cf->timer, bfin_cf_timer, (unsigned long)cf); + + cf->pdev = pdev; + platform_set_drvdata(pdev, cf); + + cf->irq = irq; + cf->socket.pci_irq = irq; + + set_irq_type(irq, IRQF_TRIGGER_LOW); + + io_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + attr_mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); + + if (!io_mem || !attr_mem) + goto fail0; + + cf->phys_cf_io = io_mem->start; + cf->phys_cf_attr = attr_mem->start; + + /* pcmcia layer only remaps "real" memory */ + cf->socket.io_offset = (unsigned long) + ioremap(cf->phys_cf_io, SZ_2K); + + if (!cf->socket.io_offset) + goto fail0; + + dev_err(&pdev->dev, ": on irq %d\n", irq); + + dev_dbg(&pdev->dev, ": %s\n", + bfin_cf_present(cf->cd_pfx) ? "present" : "(not present)"); + + cf->socket.owner = THIS_MODULE; + cf->socket.dev.parent = &pdev->dev; + cf->socket.ops = &bfin_cf_ops; + cf->socket.resource_ops = &pccard_static_ops; + cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP + | SS_CAP_MEM_ALIGN; + cf->socket.map_size = SZ_2K; + + status = pcmcia_register_socket(&cf->socket); + if (status < 0) + goto fail2; + + cf->active = 1; + mod_timer(&cf->timer, jiffies + POLL_INTERVAL); + return 0; + +fail2: + iounmap((void __iomem *)cf->socket.io_offset); + release_mem_region(cf->phys_cf_io, SZ_8K); + +fail0: + gpio_free(cf->cd_pfx); + kfree(cf); + platform_set_drvdata(pdev, NULL); + + return status; +} + +static int __devexit bfin_cf_remove(struct platform_device *pdev) +{ + struct bfin_cf_socket *cf = platform_get_drvdata(pdev); + + gpio_free(cf->cd_pfx); + cf->active = 0; + pcmcia_unregister_socket(&cf->socket); + del_timer_sync(&cf->timer); + iounmap((void __iomem *)cf->socket.io_offset); + release_mem_region(cf->phys_cf_io, SZ_8K); + platform_set_drvdata(pdev, NULL); + kfree(cf); + return 0; +} + +static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg) +{ + return pcmcia_socket_dev_suspend(&pdev->dev, mesg); +} + +static int bfin_cf_resume(struct platform_device *pdev) +{ + return pcmcia_socket_dev_resume(&pdev->dev); +} + +static struct platform_driver bfin_cf_driver = { + .driver = { + .name = (char *)driver_name, + .owner = THIS_MODULE, + }, + .probe = bfin_cf_probe, + .remove = __devexit_p(bfin_cf_remove), + .suspend = bfin_cf_suspend, + .resume = bfin_cf_resume, +}; + +static int __init bfin_cf_init(void) +{ + return platform_driver_register(&bfin_cf_driver); +} + +static void __exit bfin_cf_exit(void) +{ + platform_driver_unregister(&bfin_cf_driver); +} + +module_init(bfin_cf_init); +module_exit(bfin_cf_exit); + +MODULE_AUTHOR("Michael Hennerich ") +MODULE_DESCRIPTION("BFIN CF/PCMCIA Driver"); +MODULE_LICENSE("GPL"); diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h index 9a6bcc4952f0..6f80b35a863e 100644 --- a/include/pcmcia/cs_types.h +++ b/include/pcmcia/cs_types.h @@ -21,7 +21,8 @@ #include #endif -#if defined(__arm__) || defined(__mips__) || defined(__avr32__) +#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \ + defined(__bfin__) /* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */ typedef u_int ioaddr_t; #else -- cgit v1.2.3 From 7d5789616dd3090fe8486fbb849da3e9d9f36bb9 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 12 Jun 2008 12:13:55 -0700 Subject: pcmcia: simplify rsrc_nonstatic attributes Simplify sysfs attribute registration for sockets without static resource mappings by using an attribute_group. This shrinks object size a bit: use loops in sysfs code, but have more data. Signed-off-by: David Brownell Signed-off-by: Dominik Brodowski --- drivers/pcmcia/rsrc_nonstatic.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 0fcf763b9175..4123155e2f7a 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -1008,41 +1008,34 @@ static ssize_t store_mem_db(struct device *dev, } static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); -static struct device_attribute *pccard_rsrc_attributes[] = { - &dev_attr_available_resources_io, - &dev_attr_available_resources_mem, +static struct attribute *pccard_rsrc_attributes[] = { + &dev_attr_available_resources_io.attr, + &dev_attr_available_resources_mem.attr, NULL, }; +static const struct attribute_group rsrc_attributes = { + .attrs = pccard_rsrc_attributes, +}; + static int __devinit pccard_sysfs_add_rsrc(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *s = dev_get_drvdata(dev); - struct device_attribute **attr; - int ret = 0; + if (s->resource_ops != &pccard_nonstatic_ops) return 0; - - for (attr = pccard_rsrc_attributes; *attr; attr++) { - ret = device_create_file(dev, *attr); - if (ret) - break; - } - - return ret; + return sysfs_create_group(&dev->kobj, &rsrc_attributes); } static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *s = dev_get_drvdata(dev); - struct device_attribute **attr; if (s->resource_ops != &pccard_nonstatic_ops) return; - - for (attr = pccard_rsrc_attributes; *attr; attr++) - device_remove_file(dev, *attr); + sysfs_remove_group(&dev->kobj, &rsrc_attributes); } static struct class_interface pccard_rsrc_interface __refdata = { -- cgit v1.2.3 From c1ac02280d76de7aba8a9d43638d0f7d1fd0f820 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 14 Jun 2008 18:51:06 +0200 Subject: pcmcia: check for pointer instead of pointer address Bug noted by Michael Buesch: checking for the pointer address is always true. This didn't matter much, for the very first check in pcmcia_release_window() was for the pointer pointing to something, and the return value is ignored here. Nonetheless, fix it. CC: Michael Buesch Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pcmcia_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 1d128fbd1a92..c8f77b889d42 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -966,7 +966,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { pcmcia_release_configuration(p_dev); pcmcia_release_io(p_dev, &p_dev->io); pcmcia_release_irq(p_dev, &p_dev->irq); - if (&p_dev->win) + if (p_dev->win) pcmcia_release_window(p_dev->win); } EXPORT_SYMBOL(pcmcia_disable_device); -- cgit v1.2.3 From 05f43d48ddbda0ce74941aff4711a1829116cc4f Mon Sep 17 00:00:00 2001 From: Alex Harford Date: Sun, 15 Jun 2008 10:34:25 -0700 Subject: pcmcia: Fix ti12xx_2nd_slot_empty always failing For TI 1520 and others, ti12xx_2nd_slot_empty was reading card detect from the wrong slot, and always failing. Signed-off-by: Alex Harford Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ti113x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index 87a5fd5c2127..129db7bd06c3 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h @@ -692,7 +692,7 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) goto out; /* check state */ - yenta_get_status(&socket->socket, &state); + yenta_get_status(&slot2->socket, &state); if (state & SS_DETECT) { ret = 0; goto out; -- cgit v1.2.3 From 635416ef393e8cec5a89fc6c1de710ee9596a51e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 16 Jun 2008 14:35:15 +0200 Subject: pcmcia: irq probe can be done without risking an IRQ storm Nowdays you can ask for an IRQ to be allocated but not enabled, when PCMCIA was written this was not true and this feature is thus not used [linux@dominikbrodowski.net: add comment and ifdef to avoid compilation breakage at least on alpha] Signed-off-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pcmcia_resource.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index c8f77b889d42..78af59415930 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -812,6 +812,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) type = IRQF_SHARED; #ifdef CONFIG_PCMCIA_PROBE + +#ifdef IRQ_NOAUTOEN + /* if the underlying IRQ infrastructure allows for it, only allocate + * the IRQ, but do not enable it + */ + if (!(req->Attributes & IRQ_HANDLE_PRESENT)) + type |= IRQ_NOAUTOEN; +#endif /* IRQ_NOAUTOEN */ + if (s->irq.AssignedIRQ != 0) { /* If the interrupt is already assigned, it must be the same */ irq = s->irq.AssignedIRQ; -- cgit v1.2.3 From c502380170ee93fd1f4028cc1f32efc87fde7376 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 19 Jun 2008 19:02:52 +0200 Subject: pcmcia: carve out ioctl adjust function to pcmcia_ioctl Let pcmcia_ioctl interact with rsrc_nonstatic using functions which rsrc_nonstatic.c has to use anyway. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pcmcia_ioctl.c | 90 ++++++++++++++++++++++++++++++++++++++++- drivers/pcmcia/rsrc_mgr.c | 86 ++------------------------------------- drivers/pcmcia/rsrc_nonstatic.c | 18 +-------- include/pcmcia/ss.h | 10 ++++- 4 files changed, 102 insertions(+), 102 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 5f186abca108..758ece8dc362 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -138,6 +138,94 @@ static int proc_read_drivers(char *buf, char **start, off_t pos, } #endif + +#ifdef CONFIG_PCMCIA_PROBE + +static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) +{ + int irq; + u32 mask; + + irq = adj->resource.irq.IRQ; + if ((irq < 0) || (irq > 15)) + return CS_BAD_IRQ; + + if (adj->Action != REMOVE_MANAGED_RESOURCE) + return 0; + + mask = 1 << irq; + + if (!(s->irq_mask & mask)) + return 0; + + s->irq_mask &= ~mask; + + return 0; +} + +#else + +static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { + return CS_SUCCESS; +} + +#endif + +static int pcmcia_adjust_resource_info(adjust_t *adj) +{ + struct pcmcia_socket *s; + int ret = CS_UNSUPPORTED_FUNCTION; + unsigned long flags; + + down_read(&pcmcia_socket_list_rwsem); + list_for_each_entry(s, &pcmcia_socket_list, socket_list) { + + if (adj->Resource == RES_IRQ) + ret = adjust_irq(s, adj); + + else if (s->resource_ops->add_io) { + unsigned long begin, end; + + /* you can't use the old interface if the new + * one was used before */ + spin_lock_irqsave(&s->lock, flags); + if ((s->resource_setup_new) && + !(s->resource_setup_old)) { + spin_unlock_irqrestore(&s->lock, flags); + continue; + } else if (!(s->resource_setup_old)) + s->resource_setup_old = 1; + spin_unlock_irqrestore(&s->lock, flags); + + switch (adj->Resource) { + case RES_MEMORY_RANGE: + begin = adj->resource.memory.Base; + end = adj->resource.memory.Base + adj->resource.memory.Size - 1; + if (s->resource_ops->add_mem) + ret =s->resource_ops->add_mem(s, adj->Action, begin, end); + case RES_IO_RANGE: + begin = adj->resource.io.BasePort; + end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; + if (s->resource_ops->add_io) + ret = s->resource_ops->add_io(s, adj->Action, begin, end); + } + if (!ret) { + /* as there's no way we know this is the + * last call to adjust_resource_info, we + * always need to assume this is the latest + * one... */ + spin_lock_irqsave(&s->lock, flags); + s->resource_setup_done = 1; + spin_unlock_irqrestore(&s->lock, flags); + } + } + } + up_read(&pcmcia_socket_list_rwsem); + + return (ret); +} + + /*====================================================================== These manage a ring buffer of events pending for one user process @@ -546,8 +634,6 @@ static u_int ds_poll(struct file *file, poll_table *wait) /*====================================================================*/ -extern int pcmcia_adjust_resource_info(adjust_t *adj); - static int ds_ioctl(struct inode * inode, struct file * file, u_int cmd, u_long arg) { diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index ce2226273aaa..c0e2afc79e3e 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c @@ -21,86 +21,6 @@ #include "cs_internal.h" -#ifdef CONFIG_PCMCIA_IOCTL - -#ifdef CONFIG_PCMCIA_PROBE - -static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) -{ - int irq; - u32 mask; - - irq = adj->resource.irq.IRQ; - if ((irq < 0) || (irq > 15)) - return CS_BAD_IRQ; - - if (adj->Action != REMOVE_MANAGED_RESOURCE) - return 0; - - mask = 1 << irq; - - if (!(s->irq_mask & mask)) - return 0; - - s->irq_mask &= ~mask; - - return 0; -} - -#else - -static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { - return CS_SUCCESS; -} - -#endif - - -int pcmcia_adjust_resource_info(adjust_t *adj) -{ - struct pcmcia_socket *s; - int ret = CS_UNSUPPORTED_FUNCTION; - unsigned long flags; - - down_read(&pcmcia_socket_list_rwsem); - list_for_each_entry(s, &pcmcia_socket_list, socket_list) { - - if (adj->Resource == RES_IRQ) - ret = adjust_irq(s, adj); - - else if (s->resource_ops->adjust_resource) { - - /* you can't use the old interface if the new - * one was used before */ - spin_lock_irqsave(&s->lock, flags); - if ((s->resource_setup_new) && - !(s->resource_setup_old)) { - spin_unlock_irqrestore(&s->lock, flags); - continue; - } else if (!(s->resource_setup_old)) - s->resource_setup_old = 1; - spin_unlock_irqrestore(&s->lock, flags); - - ret = s->resource_ops->adjust_resource(s, adj); - if (!ret) { - /* as there's no way we know this is the - * last call to adjust_resource_info, we - * always need to assume this is the latest - * one... */ - spin_lock_irqsave(&s->lock, flags); - s->resource_setup_done = 1; - spin_unlock_irqrestore(&s->lock, flags); - } - } - } - up_read(&pcmcia_socket_list_rwsem); - - return (ret); -} -EXPORT_SYMBOL(pcmcia_adjust_resource_info); - -#endif - int pcmcia_validate_mem(struct pcmcia_socket *s) { if (s->resource_ops->validate_mem) @@ -164,7 +84,8 @@ struct pccard_resource_ops pccard_static_ops = { .adjust_io_region = NULL, .find_io = NULL, .find_mem = NULL, - .adjust_resource = NULL, + .add_io = NULL, + .add_mem = NULL, .init = static_init, .exit = NULL, }; @@ -264,7 +185,8 @@ struct pccard_resource_ops pccard_iodyn_ops = { .adjust_io_region = iodyn_adjust_io_region, .find_io = iodyn_find_io_region, .find_mem = NULL, - .adjust_resource = NULL, + .add_io = NULL, + .add_mem = NULL, .init = static_init, .exit = NULL, }; diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 4123155e2f7a..162693480ed0 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -766,21 +766,6 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long } -static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj) -{ - unsigned long end; - - switch (adj->Resource) { - case RES_MEMORY_RANGE: - end = adj->resource.memory.Base + adj->resource.memory.Size - 1; - return adjust_memory(s, adj->Action, adj->resource.memory.Base, end); - case RES_IO_RANGE: - end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; - return adjust_io(s, adj->Action, adj->resource.io.BasePort, end); - } - return CS_UNSUPPORTED_FUNCTION; -} - #ifdef CONFIG_PCI static int nonstatic_autoadd_resources(struct pcmcia_socket *s) { @@ -889,7 +874,8 @@ struct pccard_resource_ops pccard_nonstatic_ops = { .adjust_io_region = nonstatic_adjust_io_region, .find_io = nonstatic_find_io_region, .find_mem = nonstatic_find_mem_region, - .adjust_resource = nonstatic_adjust_resource_info, + .add_io = adjust_io, + .add_mem = adjust_memory, .init = nonstatic_init, .exit = nonstatic_release_resource_db, }; diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 2edc7fa3bab3..e6a2338b370f 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -136,8 +136,14 @@ struct pccard_resource_ops { struct resource* (*find_mem) (unsigned long base, unsigned long num, unsigned long align, int low, struct pcmcia_socket *s); - int (*adjust_resource) (struct pcmcia_socket *s, - adjust_t *adj); + int (*add_io) (struct pcmcia_socket *s, + unsigned int action, + unsigned long r_start, + unsigned long r_end); + int (*add_mem) (struct pcmcia_socket *s, + unsigned int action, + unsigned long r_start, + unsigned long r_end); int (*init) (struct pcmcia_socket *s); void (*exit) (struct pcmcia_socket *s); }; -- cgit v1.2.3 From c5081d5f4775b2a3f858f91151bbf9163e473075 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 19 Jun 2008 20:12:34 +0200 Subject: pcmcia: simplify pccard_validate_cis As cisinfo_t only contains one unsigned_int, pccard_validate_cis can be simplified by passing that around directly. Signed-off-by: Dominik Brodowski --- drivers/mtd/maps/pcmciamtd.c | 5 +---- drivers/pcmcia/cistpl.c | 15 +++++++++------ drivers/pcmcia/ds.c | 7 +++---- drivers/pcmcia/pcmcia_ioctl.c | 2 +- drivers/pcmcia/rsrc_nonstatic.c | 11 ++++++----- drivers/pcmcia/socket_sysfs.c | 6 +++--- include/pcmcia/cistpl.h | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 1912d968718b..00530f9bf4a7 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -498,17 +498,14 @@ static int pcmciamtd_config(struct pcmcia_device *link) int i; config_info_t t; static char *probes[] = { "jedec_probe", "cfi_probe" }; - cisinfo_t cisinfo; int new_name = 0; DEBUG(3, "link=0x%p", link); DEBUG(2, "Validating CIS"); - ret = pcmcia_validate_cis(link, &cisinfo); + ret = pcmcia_validate_cis(link, NULL); if(ret != CS_SUCCESS) { cs_error(link, GetTupleData, ret); - } else { - DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); } card_settings(dev, link, &new_name); diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 36379535f9da..0996ca253f28 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1439,10 +1439,11 @@ EXPORT_SYMBOL(pccard_read_tuple); ======================================================================*/ -int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info) +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) { tuple_t *tuple; cisparse_t *p; + unsigned int count = 0; int ret, reserved, dev_ok = 0, ident_ok = 0; if (!s) @@ -1457,7 +1458,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ return CS_OUT_OF_RESOURCE; } - info->Chains = reserved = 0; + count = reserved = 0; tuple->DesiredTuple = RETURN_FIRST_TUPLE; tuple->Attributes = TUPLE_RETURN_COMMON; ret = pccard_get_first_tuple(s, function, tuple); @@ -1482,7 +1483,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ if (!dev_ok && !ident_ok) goto done; - for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) { + for (count = 1; count < MAX_TUPLES; count++) { ret = pccard_get_next_tuple(s, function, tuple); if (ret != CS_SUCCESS) break; if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || @@ -1490,11 +1491,13 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) reserved++; } - if ((info->Chains == MAX_TUPLES) || (reserved > 5) || - ((!dev_ok || !ident_ok) && (info->Chains > 10))) - info->Chains = 0; + if ((count) || (reserved > 5) || + ((!dev_ok || !ident_ok) && (count > 10))) + count = 0; done: + if (info) + *info = count; kfree(tuple); kfree(p); return CS_SUCCESS; diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index e40775443d04..0f56cb5a30be 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -741,9 +741,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f static int pcmcia_card_add(struct pcmcia_socket *s) { - cisinfo_t cisinfo; cistpl_longlink_mfc_t mfc; - unsigned int no_funcs, i; + unsigned int no_funcs, i, no_chains; int ret = 0; if (!(s->resource_setup_done)) { @@ -757,8 +756,8 @@ static int pcmcia_card_add(struct pcmcia_socket *s) return -EAGAIN; /* try again, but later... */ } - ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); - if (ret || !cisinfo.Chains) { + ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); + if (ret || !no_chains) { ds_dbg(0, "invalid CIS or invalid resources\n"); return -ENODEV; } diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 758ece8dc362..1efc74fef148 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -735,7 +735,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, mutex_lock(&s->skt_mutex); pcmcia_validate_mem(s); mutex_unlock(&s->skt_mutex); - ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); + ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains); break; case DS_SUSPEND_CARD: ret = pcmcia_suspend_card(s); diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 162693480ed0..70d2e010e654 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -261,21 +261,22 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, ======================================================================*/ /* Validation function for cards with a valid CIS */ -static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *info) +static int readable(struct pcmcia_socket *s, struct resource *res, + unsigned int *count) { int ret = -1; s->cis_mem.res = res; s->cis_virt = ioremap(res->start, s->map_size); if (s->cis_virt) { - ret = pccard_validate_cis(s, BIND_FN_ALL, info); + ret = pccard_validate_cis(s, BIND_FN_ALL, count); /* invalidate mapping and CIS cache */ iounmap(s->cis_virt); s->cis_virt = NULL; destroy_cis_cache(s); } s->cis_mem.res = NULL; - if ((ret != 0) || (info->Chains == 0)) + if ((ret != 0) || (count == 0)) return 0; return 1; } @@ -316,7 +317,7 @@ static int cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) { struct resource *res1, *res2; - cisinfo_t info1, info2; + unsigned int info1, info2; int ret = 0; res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); @@ -330,7 +331,7 @@ cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) free_region(res2); free_region(res1); - return (ret == 2) && (info1.Chains == info2.Chains); + return (ret == 2) && (info1 == info2); } static int diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 562384d6f321..ff079987db1d 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -293,7 +293,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, count = 0; else { struct pcmcia_socket *s; - cisinfo_t cisinfo; + unsigned int chains; if (off + count > size) count = size - off; @@ -302,9 +302,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj, if (!(s->state & SOCKET_PRESENT)) return -ENODEV; - if (pccard_validate_cis(s, BIND_FN_ALL, &cisinfo)) + if (pccard_validate_cis(s, BIND_FN_ALL, &chains)) return -EIO; - if (!cisinfo.Chains) + if (!chains) return -ENODATA; count = pccard_extract_cis(s, buf, off, count); diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index d3bbb19caf81..e2e10c1e9a06 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -595,7 +595,7 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse); -int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info); +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *count); /* ... but use these wrappers instead */ #define pcmcia_get_first_tuple(p_dev, tuple) \ -- cgit v1.2.3 From ae49ec9258b1ba0456f5d2e9024d0e4742a0188b Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Thu, 19 Jun 2008 20:49:41 +0200 Subject: pcmcia: remove unused bulkmem.h The code in include/pcmcia/bulkmem.h was only kept for compatibility reasons. Therefore, move the remaining region_info_t definition to ds.h [linux@dominikbrodowski.net: do not modify the IOCTL, move definition to ds.h, and update changelog] Signed-off-by: Magnus Damm Signed-off-by: Dominik Brodowski --- drivers/mtd/ftl.c | 4 ---- drivers/pcmcia/au1000_generic.h | 1 - drivers/pcmcia/au1000_pb1x00.c | 1 - drivers/pcmcia/au1000_xxs1500.c | 1 - drivers/pcmcia/cardbus.c | 1 - drivers/pcmcia/cistpl.c | 1 - drivers/pcmcia/cs.c | 1 - drivers/pcmcia/cs_internal.h | 12 ------------ drivers/pcmcia/hd64465_ss.c | 1 - drivers/pcmcia/pcmcia_resource.c | 1 - drivers/pcmcia/pxa2xx_base.c | 1 - drivers/pcmcia/rsrc_nonstatic.c | 1 - drivers/pcmcia/soc_common.h | 1 - drivers/pcmcia/socket_sysfs.c | 1 - include/pcmcia/bulkmem.h | 41 ---------------------------------------- include/pcmcia/ds.h | 19 ++++++++++++++++++- include/pcmcia/ss.h | 1 - 17 files changed, 18 insertions(+), 71 deletions(-) delete mode 100644 include/pcmcia/bulkmem.h (limited to 'drivers/pcmcia') diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 4a79b187b568..5c29872184e6 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -130,10 +130,6 @@ typedef struct partition_t { u_int16_t DataUnits; u_int32_t BlocksPerUnit; erase_unit_header_t header; -#if 0 - region_info_t region; - memory_handle_t handle; -#endif } partition_t; /* Partition state flags */ diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index c62437df175e..a53ef5902518 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 157e41423a0a..aa1cd4d3aa29 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index c78ed5347510..8a9b18cee847 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index fb2f38dc92c5..1c104a7b29c7 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 0996ca253f28..9fcff0c33619 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 6bb1bb5db9c4..b6cd7c9a92bb 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index e7d5d141f24d..0a9e420defda 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -26,18 +26,6 @@ #define CLIENT_WIN_REQ(i) (0x1<<(i)) #define CLIENT_CARDBUS 0x8000 -#define REGION_MAGIC 0xE3C9 -typedef struct region_t { - u_short region_magic; - u_short state; - dev_info_t dev_info; - struct pcmcia_device *mtd; - u_int MediaID; - region_info_t info; -} region_t; - -#define REGION_STALE 0x01 - /* Each card function gets one of these guys */ typedef struct config_t { struct kref ref; diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c index 6045e4b69531..fb2bc1fb015d 100644 --- a/drivers/pcmcia/hd64465_ss.c +++ b/drivers/pcmcia/hd64465_ss.c @@ -46,7 +46,6 @@ #include #include #include -#include #include "cs_internal.h" #define MODNAME "hd64465_ss" diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 78af59415930..2d3e3fe66ee7 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 9414163c78e7..ccfdf1969a7f 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -33,7 +33,6 @@ #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 70d2e010e654..d0c1d63d1891 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 1edc1da9d353..91ef6a0da3ab 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index ff079987db1d..bb1653f2ed82 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/include/pcmcia/bulkmem.h b/include/pcmcia/bulkmem.h deleted file mode 100644 index 6bc7472293b2..000000000000 --- a/include/pcmcia/bulkmem.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * bulkmem.h -- Definitions for bulk memory services - * - * 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. - * - * The initial developer of the original code is David A. Hinds - * . Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * (C) 1999 David A. Hinds - */ - -#ifndef _LINUX_BULKMEM_H -#define _LINUX_BULKMEM_H - -/* For GetFirstRegion and GetNextRegion */ -typedef struct region_info_t { - u_int Attributes; - u_int CardOffset; - u_int RegionSize; - u_int AccessSpeed; - u_int BlockSize; - u_int PartMultiple; - u_char JedecMfr, JedecInfo; - memory_handle_t next; -} region_info_t; - -#define REGION_TYPE 0x0001 -#define REGION_TYPE_CM 0x0000 -#define REGION_TYPE_AM 0x0001 -#define REGION_PREFETCH 0x0008 -#define REGION_CACHEABLE 0x0010 -#define REGION_BAR_MASK 0xe000 -#define REGION_BAR_SHIFT 13 - -int pcmcia_get_first_region(struct pcmcia_device *handle, region_info_t *rgn); -int pcmcia_get_next_region(struct pcmcia_device *handle, region_info_t *rgn); - -#endif /* _LINUX_BULKMEM_H */ diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index f047a1fd64f8..b316027c853d 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -20,7 +20,6 @@ #include #endif -#include #include #include @@ -51,6 +50,24 @@ typedef struct mtd_info_t { u_int CardOffset; } mtd_info_t; +typedef struct region_info_t { + u_int Attributes; + u_int CardOffset; + u_int RegionSize; + u_int AccessSpeed; + u_int BlockSize; + u_int PartMultiple; + u_char JedecMfr, JedecInfo; + memory_handle_t next; +} region_info_t; +#define REGION_TYPE 0x0001 +#define REGION_TYPE_CM 0x0000 +#define REGION_TYPE_AM 0x0001 +#define REGION_PREFETCH 0x0008 +#define REGION_CACHEABLE 0x0010 +#define REGION_BAR_MASK 0xe000 +#define REGION_BAR_SHIFT 13 + typedef union ds_ioctl_arg_t { adjust_t adjust; config_info_t config; diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index e6a2338b370f..ed919dd9bb5c 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -21,7 +21,6 @@ #include #include -#include #ifdef CONFIG_CARDBUS #include #endif -- cgit v1.2.3 From 6351a71cfae2839cf6e63329d3d85eb46a4bc2c7 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 17 Apr 2008 12:36:54 +0300 Subject: pcmcia: kill IN_CARD_SERVICES IN_CARD_SERVICES was #define'd but not used, so let's remove it. Signed-off-by: Adrian Bunk Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cardbus.c | 1 - drivers/pcmcia/cs.c | 1 - drivers/pcmcia/ds.c | 1 - drivers/pcmcia/pcmcia_ioctl.c | 1 - drivers/pcmcia/pcmcia_resource.c | 1 - drivers/pcmcia/socket_sysfs.c | 1 - 6 files changed, 6 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 1c104a7b29c7..911ca0e8dfc2 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c @@ -30,7 +30,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index b6cd7c9a92bb..d1207393fc3e 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -32,7 +32,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 0f56cb5a30be..461b8a9a9f38 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -25,7 +25,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 1efc74fef148..2d0521019536 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -29,7 +29,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 2d3e3fe66ee7..cb6b5da3f29a 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -21,7 +21,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index bb1653f2ed82..006a29e91d83 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -27,7 +27,6 @@ #include #include -#define IN_CARD_SERVICES #include #include #include -- cgit v1.2.3 From 4aeba0134f1e54cfd881e118b039ab6ed8b99126 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Fri, 20 Jun 2008 13:24:31 +0200 Subject: pcmcia: (re)move {pcmcia,pccard}_get_status Except for one debug message in a driver marked BROKEN, pcmcia_get_status is only used by the ioctl. Therefore, move it to pcmcia_ioctl.c and unexport it. Signed-off-by: Dominik Brodowski --- drivers/mtd/maps/pcmciamtd.c | 4 +-- drivers/pcmcia/cs_internal.h | 1 - drivers/pcmcia/pcmcia_ioctl.c | 61 +++++++++++++++++++++++++++++++++++ drivers/pcmcia/pcmcia_resource.c | 68 ---------------------------------------- include/pcmcia/cs.h | 1 - 5 files changed, 62 insertions(+), 73 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 00530f9bf4a7..0cc31675aeb9 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -560,9 +560,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); /* Get write protect status */ - CS_CHECK(GetStatus, pcmcia_get_status(link, &status)); - DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", - status.CardState, (unsigned long)link->win); + DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); dev->win_base = ioremap(req.Base, req.Size); if(!dev->win_base) { err("ioremap(%lu, %u) failed", req.Base, req.Size); diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 0a9e420defda..63dc1a28bda2 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -118,7 +118,6 @@ extern struct list_head pcmcia_socket_list; int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); int pccard_reset_card(struct pcmcia_socket *skt); -int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_status_t *status); struct pcmcia_callback{ diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 2d0521019536..afd00e7bbbef 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -224,6 +225,66 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) return (ret); } +/** pccard_get_status + * + * Get the current socket state bits. We don't support the latched + * SocketState yet: I haven't seen any point for it. + */ + +static int pccard_get_status(struct pcmcia_socket *s, + struct pcmcia_device *p_dev, + cs_status_t *status) +{ + config_t *c; + int val; + + s->ops->get_status(s, &val); + status->CardState = status->SocketState = 0; + status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; + status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; + status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; + status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; + if (s->state & SOCKET_SUSPEND) + status->CardState |= CS_EVENT_PM_SUSPEND; + if (!(s->state & SOCKET_PRESENT)) + return CS_NO_CARD; + + c = (p_dev) ? p_dev->function_config : NULL; + + if ((c != NULL) && (c->state & CONFIG_LOCKED) && + (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { + u_char reg; + if (c->CardValues & PRESENT_PIN_REPLACE) { + pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); + status->CardState |= + (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; + status->CardState |= + (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; + status->CardState |= + (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; + status->CardState |= + (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; + } else { + /* No PRR? Then assume we're always ready */ + status->CardState |= CS_EVENT_READY_CHANGE; + } + if (c->CardValues & PRESENT_EXT_STATUS) { + pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); + status->CardState |= + (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; + } + return CS_SUCCESS; + } + status->CardState |= + (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; + status->CardState |= + (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; + status->CardState |= + (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; + status->CardState |= + (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; + return CS_SUCCESS; +} /* pccard_get_status */ /*====================================================================== diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index cb6b5da3f29a..4884a18cf9e6 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -309,74 +309,6 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, EXPORT_SYMBOL(pcmcia_get_window); -/** pccard_get_status - * - * Get the current socket state bits. We don't support the latched - * SocketState yet: I haven't seen any point for it. - */ - -int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, - cs_status_t *status) -{ - config_t *c; - int val; - - s->ops->get_status(s, &val); - status->CardState = status->SocketState = 0; - status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; - status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; - status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; - status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; - if (s->state & SOCKET_SUSPEND) - status->CardState |= CS_EVENT_PM_SUSPEND; - if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; - - c = (p_dev) ? p_dev->function_config : NULL; - - if ((c != NULL) && (c->state & CONFIG_LOCKED) && - (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { - u_char reg; - if (c->CardValues & PRESENT_PIN_REPLACE) { - pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); - status->CardState |= - (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; - status->CardState |= - (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; - status->CardState |= - (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; - status->CardState |= - (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; - } else { - /* No PRR? Then assume we're always ready */ - status->CardState |= CS_EVENT_READY_CHANGE; - } - if (c->CardValues & PRESENT_EXT_STATUS) { - pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); - status->CardState |= - (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; - } - return CS_SUCCESS; - } - status->CardState |= - (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; - status->CardState |= - (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; - status->CardState |= - (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; - status->CardState |= - (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; - return CS_SUCCESS; -} /* pccard_get_status */ - -int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status) -{ - return pccard_get_status(p_dev->socket, p_dev, status); -} -EXPORT_SYMBOL(pcmcia_get_status); - - - /** pcmcia_get_mem_page * * Change the card address of an already open memory window. diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 7b67ca9771ce..45d84b275789 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -373,7 +373,6 @@ struct pcmcia_socket; int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); -int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status); int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); -- cgit v1.2.3 From feda4f2c190f4efc101857935db0917ff3e4e23d Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Tue, 24 Jun 2008 15:45:55 +0200 Subject: pcmcia: allow for longer CIS firmware files Don't be more zealous with memory than the firmware class core. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 461b8a9a9f38..4174d9656e35 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -850,7 +850,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) { struct pcmcia_socket *s = dev->socket; const struct firmware *fw; - char path[20]; + char path[FIRMWARE_NAME_MAX]; int ret = -ENOMEM; int no_funcs; int old_funcs; @@ -862,7 +862,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) ds_dbg(1, "trying to load CIS file %s\n", filename); - if (strlen(filename) > 14) { + if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", filename); return -EINVAL; -- cgit v1.2.3