pcmcia: separate 16-bit support from cardbus
Subsystems (6)
cover pcmcia: separate 16-bit support from cardbus
From: Arnd Bergmann <[email protected]>
Based on some recent discussions [1][2][3], I experimented wtih what drivers/pcmcia would look like if we completely removed 16-bit support, which was one of the options that Dominik suggested for winding down pcmcia maintenance.
The remaining cardbus/yenta support is essentially a PCI hotplug driver with a slightly unusual sysfs interface, and it would still support all 32-bit cardbus hosts and cards, but no longer work with the even older 16-bit cards that require the pcmcia_driver infrastructure.
I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Support for device drivers is somewhat less clear. Losing support for 16-bit cards in cardbus sockets is obviously a limiting factor for anyone who still has those cards, but there is also a good chance that the only reason to keep the cards around is for using them in pre-cardbus machines that cannot be upgrade to 32-bit devices.
Completely removing the 16-bit PCMCIA support would however break some 20+ year old embedded machines that rely on CompactFlash cards as their mass-storage device (extension), this notably includes early PocketPC models and the reference implementations for OMAP1, StrongARM1100, Alchemy and PA-Semi. All of these are still maintained, though most of the PocketPC machines got removed in the 6.3 merge window and the PA-Semi Electra board is the only one that was introduced after 2003.
The approach that I take in this series is to split drivers/pcmcia into two mutually incompatible parts: the Cardbus support contains all the code that is relevant for post-1997 laptops and gets moved to drivers/pci/hotplug, while the drivers/pcmcia/ subsystem is retained for both the older laptops and the embedded systems but no longer works with the yenta socket host driver. The BCM63xx PCMCIA/Cardbus host driver appears to be unused and conflicts with this series, so it is removed in the process.
My series does not touch any of the pcmcia_driver instances, but if there is consensus about splitting out the cardbus support, a lot of them can probably get removed as a follow-up.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
Arnd Bergmann (6):
pccard: remove bcm63xx socket driver
pccard: split cardbus support from pcmcia
yenta_socket: copy pccard core code into driver
yenta_socket: remove dead code
pccard: drop remnants of cardbus support
pci: hotplug: move cardbus code from drivers/pcmcia
arch/mips/bcm63xx/Makefile | 2 +-
arch/mips/bcm63xx/boards/board_bcm963xx.c | 14 -
arch/mips/bcm63xx/dev-pcmcia.c | 144 -
arch/mips/configs/bcm63xx_defconfig | 1 -
.../asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h | 14 -
arch/mips/pci/ops-bcm63xx.c | 294 --
arch/mips/pci/pci-bcm63xx.c | 44 -
drivers/Makefile | 2 +-
drivers/pci/hotplug/Kconfig | 56 +
drivers/pci/hotplug/Makefile | 1 +
drivers/pci/hotplug/yenta_socket.c | 4056 +++++++++++++++++
drivers/pcmcia/Kconfig | 63 +-
drivers/pcmcia/Makefile | 13 +-
drivers/pcmcia/bcm63xx_pcmcia.c | 538 ---
drivers/pcmcia/bcm63xx_pcmcia.h | 61 -
drivers/pcmcia/cardbus.c | 124 -
drivers/pcmcia/cistpl.c | 10 +-
drivers/pcmcia/cs.c | 103 +-
drivers/pcmcia/cs_internal.h | 10 +-
drivers/pcmcia/ds.c | 14 +-
drivers/pcmcia/i82092.c | 2 +-
drivers/pcmcia/i82365.c | 2 +-
drivers/pcmcia/o2micro.h | 183 -
drivers/pcmcia/pd6729.c | 3 +-
drivers/pcmcia/ricoh.h | 169 -
drivers/pcmcia/socket_sysfs.c | 2 -
drivers/pcmcia/ti113x.h | 978 ----
drivers/pcmcia/topic.h | 168 -
drivers/pcmcia/yenta_socket.c | 1455 ------
drivers/pcmcia/yenta_socket.h | 136 -
{drivers => include}/pcmcia/i82365.h | 0
include/pcmcia/ss.h | 21 -
32 files changed, 4147 insertions(+), 4536 deletions(-)
delete mode 100644 arch/mips/bcm63xx/dev-pcmcia.c
delete mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
create mode 100644 drivers/pci/hotplug/yenta_socket.c
delete mode 100644 drivers/pcmcia/bcm63xx_pcmcia.c
delete mode 100644 drivers/pcmcia/bcm63xx_pcmcia.h
delete mode 100644 drivers/pcmcia/cardbus.c
delete mode 100644 drivers/pcmcia/o2micro.h
delete mode 100644 drivers/pcmcia/ti113x.h
delete mode 100644 drivers/pcmcia/topic.h
delete mode 100644 drivers/pcmcia/yenta_socket.c
delete mode 100644 drivers/pcmcia/yenta_socket.h
rename {drivers => include}/pcmcia/i82365.h (100%)Signature · 1 line
2.39.2
RFC 1/6 pccard: remove bcm63xx socket driver
From: Arnd Bergmann <[email protected]>
The bcm63xx pcmcia driver is the only nonstandard cardbus implementation, everything else is handled by the yenta_socket driver. Upon a closer look, this seems entirely unused, because:
- There are two ports for bcm63xx in arch/mips, both of which support the bcm6358 hardware, but the newer one does not use this driver at all.
- The only distro I could find for bcm63xx is OpenWRT, but they do not enable pcmcia support. However they have 130 patches, a lot of which are likely required to run anything at all.
- The device list at https://deviwiki.com/wiki/Broadcom only lists machines using mini-PCI cards rather than PCMCIA or Cardbus devices.
- The cardbus support is entirely made up to work with the kernel subsystem, but the hardware appears to just be a normal PCI host that should work fine after removing all the cardbus code.
--- arch/mips/bcm63xx/Makefile | 2 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 14 - arch/mips/bcm63xx/dev-pcmcia.c | 144 ----- arch/mips/configs/bcm63xx_defconfig | 1 - .../asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h | 14 - arch/mips/pci/ops-bcm63xx.c | 294 ---------- arch/mips/pci/pci-bcm63xx.c | 44 -- drivers/pcmcia/Kconfig | 4 - drivers/pcmcia/Makefile | 1 - drivers/pcmcia/bcm63xx_pcmcia.c | 538 ------------------ drivers/pcmcia/bcm63xx_pcmcia.h | 61 -- 11 files changed, 1 insertion(+), 1116 deletions(-) delete mode 100644 arch/mips/bcm63xx/dev-pcmcia.c delete mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h delete mode 100644 drivers/pcmcia/bcm63xx_pcmcia.c delete mode 100644 drivers/pcmcia/bcm63xx_pcmcia.h
arch/mips/bcm63xx/Makefile +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ + setup.o timer.o dev-enet.o dev-flash.o \ dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ dev-usb-usbd.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
arch/mips/bcm63xx/boards/board_bcm963xx.c +0 -14
@@ -22,7 +22,6 @@#include <bcm63xx_dev_enet.h> #include <bcm63xx_dev_flash.h> #include <bcm63xx_dev_hsspi.h> -#include <bcm63xx_dev_pcmcia.h> #include <bcm63xx_dev_spi.h> #include <bcm63xx_dev_usb_usbd.h> #include <board_bcm963xx.h>
@@ -266,7 +265,6 @@ static struct board_info __initdata board_96348gw_10 = { .expected_cpu_id = 0x6348, .has_ohci0 = 1, - .has_pccard = 1, .has_pci = 1, .has_uart0 = 1,
@@ -317,7 +315,6 @@ static struct board_info __initdata board_96348gw_11 = { .expected_cpu_id = 0x6348, .has_ohci0 = 1, - .has_pccard = 1, .has_pci = 1, .has_uart0 = 1,
@@ -418,7 +415,6 @@ static struct board_info __initdata board_FAST2404 = { .expected_cpu_id = 0x6348, .has_ohci0 = 1, - .has_pccard = 1, .has_pci = 1, .has_uart0 = 1,
@@ -507,7 +503,6 @@ static struct board_info __initdata board_96358vw = { .has_ehci0 = 1, .has_ohci0 = 1, - .has_pccard = 1, .has_pci = 1, .has_uart0 = 1,
@@ -557,7 +552,6 @@ static struct board_info __initdata board_96358vw2 = { .has_ehci0 = 1, .has_ohci0 = 1, - .has_pccard = 1, .has_pci = 1, .has_uart0 = 1,
@@ -807,11 +801,6 @@ void __init board_prom_init(void) }#endif /* CONFIG_PCI */ -if (board.has_pccard) { -if (BCMCPU_IS_6348 ()) - val |=GPIO_MODE_6348_G1_MII_PCCARD ; - } -if (board.has_enet0 && !board.enet0.use_internal_phy) {if (BCMCPU_IS_6348 ()) val |= GPIO_MODE_6348_G3_EXT_MII |
@@ -861,9 +850,6 @@ int __init board_register_devices(void)if (board.has_uart1)bcm63xx_uart_register (1 ); -if (board.has_pccard) -bcm63xx_pcmcia_register (); -if (board.has_enet0 && !bcm63xx_nvram_get_mac_address (board.enet0.mac_addr))bcm63xx_enet_register (0 , &board.enet0);
arch/mips/bcm63xx/dev-pcmcia.c deleted +0 -144
144 lines not on this page · raw message
arch/mips/configs/bcm63xx_defconfig +0 -1
@@ -19,7 +19,6 @@ CONFIG_BCM63XX_CPU_6358=y # CONFIG_SECCOMP is not set CONFIG_PCI=y CONFIG_PCCARD=y -CONFIG_PCMCIA_BCM63XX=y # CONFIG_BLK_DEV_BSG is not set CONFIG_NET=y CONFIG_UNIX=y
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h deleted +0 -14
@@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef BCM63XX_DEV_PCMCIA_H_ -#define BCM63XX_DEV_PCMCIA_H_ - -/* -* PCMCIA driver platform data -*/ -struct bcm63xx_pcmcia_platform_data { -unsigned int ready_gpio; -}; - -int bcm63xx_pcmcia_register (void ); - -#endif /* BCM63XX_DEV_PCMCIA_H_ */
arch/mips/pci/ops-bcm63xx.c +0 -294
312 lines not on this page · raw message
arch/mips/pci/pci-bcm63xx.c +0 -44
71 lines not on this page · raw message
drivers/pcmcia/Kconfig +0 -4
@@ -168,10 +168,6 @@ config PCMCIA_XXS1500 This driver is also available as a module called xxs1500_ss.ko -config PCMCIA_BCM63XX - tristate "bcm63xx pcmcia support" - depends on BCM63XX && PCMCIA - config PCMCIA_SOC_COMMON tristate
drivers/pcmcia/Makefile +0 -1
@@ -28,7 +28,6 @@ obj-$(CONFIG_PCMCIA_SOC_COMMON) += soc_common.o obj-$(CONFIG_PCMCIA_SA11XX_BASE) += sa11xx_base.o obj-$(CONFIG_PCMCIA_SA1100) += sa1100_cs.o obj-$(CONFIG_PCMCIA_SA1111) += sa1111_cs.o -obj-$(CONFIG_PCMCIA_BCM63XX) += bcm63xx_pcmcia.o obj-$(CONFIG_OMAP_CF) += omap_cf.o obj-$(CONFIG_ELECTRA_CF) += electra_cf.o obj-$(CONFIG_PCMCIA_ALCHEMY_DEVBOARD) += db1xxx_ss.o
drivers/pcmcia/bcm63xx_pcmcia.c deleted +0 -538
538 lines not on this page · raw message
drivers/pcmcia/bcm63xx_pcmcia.h deleted +0 -61
61 lines not on this page · raw message
Signature · 1 line
2.39.2
RFC 2/6 pccard: split cardbus support from pcmcia
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
All pccard related technologies are obsolete, but there are a couple that are still used occasionally. Most importantly this includes 32-bit PCI/Cardbus devices on Laptop PCs built between 1997 and 2006 (Pentium MMX through Core Duo) and embedded systems using 16-bit PCMCIA/Compactflash slots for CF storage with the pata_pcmcia driver, but usually not the combination of the two.
Separate the two configuration options for simplification and build the common code into both the pcmcia and cardbus layers, but only allow one of the two to be enabled in a kernel configuration, in order to allow further cleanups on top.
This breaks the use of any 16-bit PCMCIA cards in a 32-bit capable cardbus slot. If anyone relies on support for this configuration and cannot use a cardbus compatible card instead, this should not be applied. In almost all cases, a cardbus or USB based card is superior and available cheaply compared to the older PCMCIA cards. In particular, CompactFlash cards now require an active card reader instead of a slow PCMCIA passthrough adapter.
The CONFIG_PCMCIA option is now limited to platforms that actually shipped with PCMCIA or CF controllers, which is mostly x86 laptops from the i486 and Pentium eras as well as a couple of embedded systems. The Apple Powerbook is not included here, because all models with PCI support have Cardbus controllers and the earlier ones can not run Linux any more.
--- drivers/pcmcia/Kconfig | 13 +++++++----- drivers/pcmcia/Makefile | 10 ++++----- drivers/pcmcia/cardbus.c | 1 + drivers/pcmcia/cs.c | 25 +++++----------------- drivers/pcmcia/cs_internal.h | 1 + drivers/pcmcia/ds.c | 14 ++++++++++--- drivers/pcmcia/ricoh.h | 2 +- drivers/pcmcia/yenta_socket.c | 39 +++++++++++++++++++++++------------ include/pcmcia/ss.h | 4 ++-- 9 files changed, 60 insertions(+), 49 deletions(-)
drivers/pcmcia/Kconfig +8 -5
@@ -21,6 +21,9 @@ if PCCARD config PCMCIA tristate "16-bit PCMCIA support" select CRC32 + depends on X86_32 || ARCH_PXA || ARCH_SA1100 || ARCH_OMAP1 || \ + MIPS_ALCHEMY || PPC_PASEMI || COMPILE_TEST + depends on CARDBUS=n default y help This option enables support for 16-bit PCMCIA cards. Most older
@@ -51,8 +54,9 @@ config PCMCIA_LOAD_CIS If unsure, say Y. config CARDBUS - bool "32-bit CardBus support" + tristate "32-bit CardBus support" depends on PCI + select YENTA default y help CardBus is a bus mastering architecture for PC-cards, which allows
@@ -71,10 +75,9 @@ config PCMCIA_MAX1600 comment "PC-card bridges" config YENTA - tristate "CardBus yenta-compatible bridge support" - depends on PCI - select CARDBUS if !EXPERT - select PCCARD_NONSTATIC if PCMCIA != n + tristate "CardBus yenta-compatible bridge support" if EXPERT + depends on PCI && CARDBUS + default y help This option enables support for CardBus host bridges. Virtually all modern PCMCIA bridges are CardBus compatible. A "bridge" is
drivers/pcmcia/Makefile +5 -5
@@ -3,17 +3,17 @@ # Makefile for the kernel pcmcia subsystem (c/o David Hinds) # -pcmcia_core-y += cs.o socket_sysfs.o -pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o -obj-$(CONFIG_PCCARD) += pcmcia_core.o +cardbus_core-y += cardbus.o cs.o socket_sysfs.o rsrc_mgr.o +obj-$(CONFIG_CARDBUS) += cardbus_core.o -pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o +pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o \ + cs.o socket_sysfs.o obj-$(CONFIG_PCMCIA) += pcmcia.o pcmcia_rsrc-y += rsrc_mgr.o pcmcia_rsrc-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o pcmcia_rsrc-$(CONFIG_PCCARD_IODYN) += rsrc_iodyn.o -obj-$(CONFIG_PCCARD) += pcmcia_rsrc.o +obj-$(CONFIG_PCMCIA) += pcmcia_rsrc.o # socket drivers
drivers/pcmcia/cardbus.c +1 -0
@@ -121,4 +121,5 @@ void cb_free(struct pcmcia_socket *s)pci_stop_and_remove_bus_device (dev);pci_unlock_rescan_remove (); + }
drivers/pcmcia/cs.c +5 -20
@@ -133,7 +133,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)list_add_tail (&socket->socket_list, &pcmcia_socket_list);up_write (&pcmcia_socket_list_rwsem); -#ifndef CONFIG_CARDBUS +#if !IS_ENABLED (CONFIG_CARDBUS )/* * If we do not support Cardbus, ensure that * the Cardbus socket capability is disabled.
@@ -313,7 +313,7 @@ static void socket_shutdown(struct pcmcia_socket *s)*/ mutex_unlock (&s->ops_mutex); -#ifdef CONFIG_CARDBUS +#if IS_ENABLED (CONFIG_CARDBUS )cb_free (s);#endif
@@ -428,7 +428,7 @@ static int socket_insert(struct pcmcia_socket *skt) (skt->state &SOCKET_CARDBUS ) ?"CardBus" :"PCMCIA" , skt->sock); -#ifdef CONFIG_CARDBUS +#if IS_ENABLED (CONFIG_CARDBUS )if (skt->state &SOCKET_CARDBUS ) {cb_alloc (skt); skt->state |=SOCKET_CARDBUS_CONFIG ;
@@ -522,7 +522,7 @@ static int socket_late_resume(struct pcmcia_socket *skt)static int socket_complete_resume (struct pcmcia_socket *skt) {int ret =0 ; -#ifdef CONFIG_CARDBUS +#if IS_ENABLED (CONFIG_CARDBUS )if (skt->state &SOCKET_CARDBUS ) {/* We can't be sure the CardBus card is the same * as the one previously inserted. Therefore, remove
@@ -822,7 +822,7 @@ static int pcmcia_socket_uevent(const struct device *dev, } -static struct completion pcmcia_unload; +static DECLARE_COMPLETION (pcmcia_unload);static void pcmcia_release_socket_class (struct class *data) {
@@ -901,18 +901,3 @@ struct class pcmcia_socket_class = {EXPORT_SYMBOL (pcmcia_socket_class); -static int __init init_pcmcia_cs (void ) -{ -init_completion (&pcmcia_unload); -return class_register (&pcmcia_socket_class); -} - -static void __exit exit_pcmcia_cs(void) -{ -class_unregister (&pcmcia_socket_class); -wait_for_completion (&pcmcia_unload); -} - -subsys_initcall (init_pcmcia_cs); -module_exit (exit_pcmcia_cs); -
drivers/pcmcia/cs_internal.h +1 -0
@@ -18,6 +18,7 @@#define _LINUX_CS_INTERNAL_H#include <linux/kref.h> +#include <pcmcia/cistpl.h> /* Flags in client state */ #define CLIENT_WIN_REQ (i) (0x1<<(i))
drivers/pcmcia/ds.c +11 -3
@@ -1419,9 +1419,16 @@ static int __init init_pcmcia_bus(void) {int ret; + ret =class_register (&pcmcia_socket_class); +if (ret <0 ) { +printk (KERN_WARNING "pcmcia: class register error %d\n" , ret); +return ret; + } + ret =bus_register (&pcmcia_bus_type);if (ret <0 ) {printk (KERN_WARNING "pcmcia: bus_register error: %d\n" , ret); +class_unregister (&pcmcia_socket_class);return ret; } ret =class_interface_register (&pcmcia_bus_interface);
@@ -1429,20 +1436,21 @@ static int __init init_pcmcia_bus(void)printk (KERN_WARNING "pcmcia: class_interface_register error: %d\n" , ret);bus_unregister (&pcmcia_bus_type); +class_unregister (&pcmcia_socket_class);return ret; }return 0 ; } -fs_initcall (init_pcmcia_bus);/* one level after subsys_initcall so that -* pcmcia_socket_class is already registered */ - +subsys_initcall (init_pcmcia_bus); static void __exit exit_pcmcia_bus(void) {class_interface_unregister (&pcmcia_bus_interface);bus_unregister (&pcmcia_bus_type); + +class_unregister (&pcmcia_socket_class); }module_exit (exit_pcmcia_bus);
drivers/pcmcia/ricoh.h +1 -1
@@ -123,7 +123,7 @@#define RL5C4XX_MISC3 0x00A2/* 16 bit */ #define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1) -#ifdef __YENTA_H +#if IS_ENABLED (CONFIG_CARDBUS )#define rl_misc (socket) ((socket)->private[0])#define rl_ctl (socket) ((socket)->private[1])
drivers/pcmcia/yenta_socket.c +26 -13
@@ -24,6 +24,7 @@#include "yenta_socket.h" #include "i82365.h" +#include "cs_internal.h" static bool disable_clkrun;module_param (disable_clkrun, bool,0444 );
@@ -228,17 +229,8 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value) val |= (state & (CB_CDETECT1 |CB_CDETECT2 )) ?0 :SS_DETECT ; val |= (state &CB_PWRCYCLE ) ?SS_POWERON |SS_READY :0 ; }else if (state &CB_16BITCARD ) { -u8 status =exca_readb (socket,I365_STATUS ); - val |= ((status &I365_CS_DETECT ) ==I365_CS_DETECT ) ?SS_DETECT :0 ; -if (exca_readb (socket,I365_INTCTL ) &I365_PC_IOCARD ) { - val |= (status &I365_CS_STSCHG ) ?0 :SS_STSCHG ; - }else { - val |= (status &I365_CS_BVD1 ) ?0 :SS_BATDEAD ; - val |= (status &I365_CS_BVD2 ) ?0 :SS_BATWARN ; - } - val |= (status &I365_CS_WRPROT ) ?SS_WRPROT :0 ; - val |= (status &I365_CS_READY ) ?SS_READY :0 ; - val |= (status &I365_CS_POWERON ) ?SS_POWERON :0 ; +dev_warn_once (&socket->dev->dev, +"16-bit PCMCIA cards are no longer supported\n" ); } *value = val;
@@ -1176,7 +1168,7 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)/* prepare pcmcia_socket */ socket->socket.ops = ¥ta_socket_operations; - socket->socket.resource_ops = &pccard_nonstatic_ops; + socket->socket.resource_ops = &pccard_static_ops; socket->socket.dev.parent = &dev->dev; socket->socket.driver_data = socket; socket->socket.owner =THIS_MODULE ;
@@ -1450,6 +1442,27 @@ static struct pci_driver yenta_cardbus_driver = { .driver.pm = YENTA_PM_OPS, }; -module_pci_driver (yenta_cardbus_driver); +static int __init yenta_init (void ) +{ +int ret; + + ret =class_register (&pcmcia_socket_class); +if (ret) +return ret; + + ret =pci_register_driver (¥ta_cardbus_driver); +if (ret) +class_unregister (&pcmcia_socket_class); + +return ret; +} +module_init (yenta_init); + +static void __exit yenta_exit(void) +{ +pci_unregister_driver (¥ta_cardbus_driver); +class_unregister (&pcmcia_socket_class); +} +module_exit (yenta_exit);MODULE_LICENSE ("GPL" );
include/pcmcia/ss.h +2 -2
@@ -16,7 +16,7 @@#include <linux/sched.h> /* task_struct, completion */ #include <linux/mutex.h> -#ifdef CONFIG_CARDBUS +#if IS_ENABLED (CONFIG_CARDBUS )#include <linux/pci.h> #endif
@@ -176,7 +176,7 @@ struct pcmcia_socket {int (*power_hook)(struct pcmcia_socket *sock,int operation);/* allows tuning the CB bridge before loading driver for the CB card */ -#ifdef CONFIG_CARDBUS +#if IS_ENABLED (CONFIG_CARDBUS )void (*tune_bridge)(struct pcmcia_socket *sock,struct pci_bus *bus);#endif
Signature · 1 line
2.39.2
RFC 3/6 yenta_socket: copy pccard core code into driver
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
To allow further cleanups, move all pccard specific code that yenta_socket.c depends on into the file itself, making it a concatenation of ss.h, cs_internal.h, cs.c, socket_sysfs.c, cardbus.c, rsrc_mgr.c and the original contents. Only the minimal additonal changes are done to ensure this still compiles.
The files that are not shared with pcmcia drivers can be removed now. Note that ricoh.h contains separate definitions for pcmcia and cardbus, so only the second half is moved.
--- drivers/pcmcia/Makefile | 3 - drivers/pcmcia/cardbus.c | 125 - drivers/pcmcia/o2micro.h | 183 -- drivers/pcmcia/ricoh.h | 169 -- drivers/pcmcia/ti113x.h | 978 ------- drivers/pcmcia/topic.h | 168 -- drivers/pcmcia/yenta_socket.c | 4546 ++++++++++++++++++++++++++++----- drivers/pcmcia/yenta_socket.h | 136 - 8 files changed, 3908 insertions(+), 2400 deletions(-) delete mode 100644 drivers/pcmcia/cardbus.c delete mode 100644 drivers/pcmcia/o2micro.h delete mode 100644 drivers/pcmcia/ti113x.h delete mode 100644 drivers/pcmcia/topic.h delete mode 100644 drivers/pcmcia/yenta_socket.h
drivers/pcmcia/Makefile +0 -3
@@ -3,9 +3,6 @@ # Makefile for the kernel pcmcia subsystem (c/o David Hinds) # -cardbus_core-y += cardbus.o cs.o socket_sysfs.o rsrc_mgr.o -obj-$(CONFIG_CARDBUS) += cardbus_core.o - pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o \ cs.o socket_sysfs.o obj-$(CONFIG_PCMCIA) += pcmcia.o
drivers/pcmcia/cardbus.c deleted +0 -125
125 lines not on this page · raw message
drivers/pcmcia/o2micro.h deleted +0 -183
183 lines not on this page · raw message
drivers/pcmcia/ricoh.h +0 -169
173 lines not on this page · raw message
drivers/pcmcia/ti113x.h deleted +0 -978
978 lines not on this page · raw message
drivers/pcmcia/topic.h deleted +0 -168
168 lines not on this page · raw message
drivers/pcmcia/yenta_socket.c +3908 -638
1,364 lines not on this page · raw message
drivers/pcmcia/yenta_socket.h deleted +0 -136
136 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.39.2
Part of the diff is not shown here. View the raw message.
RFC 4/6 yenta_socket: remove dead code
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
A lot of the now merged pccard layer in the yenta_socket driver is never used on cardbus devices, so it can get removed. All global symbols can be made static and exports removed.
The pccard_operations and pccard_resource_ops only have one valid implementation, so all indirect function pointers become direct calls.
--- drivers/pcmcia/yenta_socket.c | 955 ++++------------------------------ 1 file changed, 91 insertions(+), 864 deletions(-)
drivers/pcmcia/yenta_socket.c +91 -864
@@ -1,24 +1,40 @@// SPDX-License-Identifier: GPL-2.0-only /* -* ss.h +* Regular cardbus driver ("yenta_socket") * * The initial developer of the original code is David A. Hinds * <[email protected]>. Portions created by David A. Hinds * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * (C) 1999 David A. Hinds +* (C) Copyright 1999, 2000 Linus Torvalds +* (C) 2003 - 2010 Dominik Brodowski +* */ - -#ifndef _LINUX_SS_H -#define _LINUX_SS_H - +#include <linux/delay.h> #include <linux/device.h> -#include <linux/sched.h> /* task_struct, completion */ +#include <linux/errno.h> +#include <linux/freezer.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/ioport.h> +#include <linux/kernel.h> +#include <linux/kref.h> +#include <linux/kthread.h> +#include <linux/mm.h> +#include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/mutex.h> - -#if IS_ENABLED (CONFIG_CARDBUS )#include <linux/pci.h> -#endif +#include <linux/pm.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/timer.h> +#include <linux/workqueue.h> +#include <asm/irq.h> +#include "i82365.h" /* Definitions for card status flags for GetStatus */ #define SS_WRPROT 0x0001
@@ -38,14 +54,6 @@#define SS_PENDING 0x4000#define SS_ZVCARD 0x8000 -/* InquireSocket capabilities */ -#define SS_CAP_PAGE_REGS 0x0001 -#define SS_CAP_VIRTUAL_BUS 0x0002 -#define SS_CAP_MEM_ALIGN 0x0004 -#define SS_CAP_STATIC_MAP 0x0008 -#define SS_CAP_PCCARD 0x4000 -#define SS_CAP_CARDBUS 0x8000 -/* for GetSocket, SetSocket */ typedef struct socket_state_t { u_int flags;
@@ -54,8 +62,6 @@ typedef struct socket_state_t {u_char io_irq; } socket_state_t; -extern socket_state_t dead_socket; -/* Socket configuration flags */ #define SS_PWR_AUTO 0x0010#define SS_IOCARD 0x0020
@@ -97,35 +103,12 @@ typedef struct pccard_mem_map {struct resource *res; } pccard_mem_map; -typedef struct io_window_t { -u_int InUse, Config; -struct resource *res; -}io_window_t ; - -/* Maximum number of IO windows per socket */ -#define MAX_IO_WIN 2 - -/* Maximum number of memory windows per socket */ -#define MAX_WIN 4 - - -/* -* Socket operations. -*/ struct pcmcia_socket ; -struct pccard_resource_ops ; -struct config_t ; -struct pcmcia_callback ; -struct user_info_t ; - -struct pccard_operations { -int (*init)(struct pcmcia_socket *s); -int (*suspend)(struct pcmcia_socket *s); -int (*get_status)(struct pcmcia_socket *s,u_int *value); -int (*set_socket)(struct pcmcia_socket *s,socket_state_t *state); -int (*set_io_map)(struct pcmcia_socket *s,struct pccard_io_map *io); -int (*set_mem_map)(struct pcmcia_socket *s,struct pccard_mem_map *mem); -}; + +static int yenta_sock_init (struct pcmcia_socket *sock); +static int yenta_sock_suspend (struct pcmcia_socket *sock); +static int yenta_set_socket (struct pcmcia_socket *sock,socket_state_t *state); +static int yenta_get_status (struct pcmcia_socket *sock,unsigned int *value);struct pcmcia_socket {struct module *owner;
@@ -133,16 +116,10 @@ struct pcmcia_socket {u_int state;u_int suspended_state;/* state before suspend */ u_short functions; -u_short lock_count; -pccard_mem_map cis_mem; -void __iomem *cis_virt; -io_window_t io[MAX_IO_WIN ]; -pccard_mem_map win[MAX_WIN ];struct list_head cis_cache;size_t fake_cis_len;u8 *fake_cis; -struct list_head socket_list;struct completion socket_released;/* deprecated */
@@ -150,10 +127,7 @@ struct pcmcia_socket {/* socket capabilities */ -u_int features;u_int irq_mask; -u_int map_size; -u_int io_offset;u_int pci_irq;struct pci_dev *cb_dev;
@@ -162,11 +136,6 @@ struct pcmcia_socket {* insertio events are actually managed by the PCMCIA layer.*/ u8 resource_setup_done; -/* socket operations */ -struct pccard_operations *ops; -struct pccard_resource_ops *resource_ops; -void *resource_data; -/* Zoom video behaviour is so chip specific its not worth adding this to _ops */ void (*zoom_video)(struct pcmcia_socket *,
@@ -176,9 +145,7 @@ struct pcmcia_socket {int (*power_hook)(struct pcmcia_socket *sock,int operation);/* allows tuning the CB bridge before loading driver for the CB card */ -#if IS_ENABLED (CONFIG_CARDBUS )void (*tune_bridge)(struct pcmcia_socket *sock,struct pci_bus *bus); -#endif /* state thread */ struct task_struct *thread;
@@ -194,73 +161,17 @@ struct pcmcia_socket {/* protects thread_events and sysfs_events */ spinlock_t thread_lock; -/* pcmcia (16-bit) */ -struct pcmcia_callback *callback; - -#if defined(CONFIG_PCMCIA ) || defined(CONFIG_PCMCIA_MODULE ) -/* The following elements refer to 16-bit PCMCIA devices inserted -* into the socket */ -struct list_head devices_list; - -/* the number of devices, used only internally and subject to -* incorrectness and change */ -u8 device_count; - -/* does the PCMCIA card consist of two pseudo devices? */ -u8 pcmcia_pfc; - -/* non-zero if PCMCIA card is present */ -atomic_t present; - -/* IRQ to be used by PCMCIA devices. May not be IRQ 0. */ -unsigned int pcmcia_irq; - -#endif /* CONFIG_PCMCIA */ -/* socket device */ struct device dev; -/* data internal to the socket driver */ -void *driver_data;/* status of the card during resume from a system sleep state */ int resume_status; }; -/* socket drivers must define the resource operations type they use. There -* are three options: -* - pccard_static_ops iomem and ioport areas are assigned statically -* - pccard_iodyn_ops iomem areas is assigned statically, ioport -* areas dynamically -* If this option is selected, use -* "select PCCARD_IODYN" in Kconfig. -* - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. -* If this option is selected, use -* "select PCCARD_NONSTATIC" in Kconfig. -* -*/ -extern struct pccard_resource_ops pccard_static_ops; -#if defined(CONFIG_PCMCIA ) || defined(CONFIG_PCMCIA_MODULE ) -extern struct pccard_resource_ops pccard_iodyn_ops; -extern struct pccard_resource_ops pccard_nonstatic_ops; -#else -/* If PCMCIA is not used, but only CARDBUS, these functions are not used -* at all. Therefore, do not use the large (240K!) rsrc_nonstatic module -*/ -#define pccard_iodyn_ops pccard_static_ops -#define pccard_nonstatic_ops pccard_static_ops -#endif - -/* socket drivers use this callback in their IRQ handler */ -extern void pcmcia_parse_events (struct pcmcia_socket *socket, +static void pcmcia_parse_events (struct pcmcia_socket *socket,unsigned int events); -/* to register and unregister a socket */ -extern int pcmcia_register_socket (struct pcmcia_socket *socket); -extern void pcmcia_unregister_socket (struct pcmcia_socket *socket); - -#endif /* _LINUX_SS_H */ -#define CB_SOCKET_EVENT 0x00#define CB_CSTSEVENT 0x00000001/* Card status event */ #define CB_CD1EVENT 0x00000002/* Card detect 1 change event */
@@ -358,7 +269,6 @@ extern void pcmcia_unregister_socket(struct pcmcia_socket *socket);#define YENTA_16BIT_POWER_EXCA 0x00000001#define YENTA_16BIT_POWER_DF 0x00000002 -struct yenta_socket ;struct cardbus_type {
@@ -389,212 +299,28 @@ struct yenta_socket {u32 saved_state[2 ]; }; -/* -* cs_internal.h -- definitions internal to the PCMCIA core modules -* -* The initial developer of the original code is David A. Hinds -* <[email protected]>. Portions created by David A. Hinds -* are Copyright (C) 1999 David A. Hinds. All Rights Reserved. -* -* (C) 1999 David A. Hinds -* (C) 2003 - 2010 Dominik Brodowski -* -* This file contains definitions _only_ needed by the PCMCIA core modules. -* It must not be included by PCMCIA socket drivers or by PCMCIA device -* drivers. -*/ - -#ifndef _LINUX_CS_INTERNAL_H -#define _LINUX_CS_INTERNAL_H - -#include <linux/kref.h> -#include <pcmcia/cistpl.h> - -/* Flags in client state */ -#define CLIENT_WIN_REQ (i) (0x1<<(i)) - -/* Flag to access all functions */ -#define BIND_FN_ALL 0xff - -/* Each card function gets one of these guys */ -typedef struct config_t { -struct kref ref; -unsigned int state; - -struct resource io[MAX_IO_WIN ];/* io ports */ -struct resource mem[MAX_WIN ];/* mem areas */ -}config_t ; - - -struct cis_cache_entry { -struct list_head node; -unsigned int addr; -unsigned int len; -unsigned int attr; -unsigned char cache[]; -}; - -struct pccard_resource_ops { -int (*validate_mem) (struct pcmcia_socket *s); -int (*find_io) (struct pcmcia_socket *s, -unsigned int attr, -unsigned int *base, -unsigned int num, -unsigned int align, -struct resource **parent); -struct resource * (*find_mem) (unsigned long base,unsigned long num, -unsigned long align,int low, -struct pcmcia_socket *s); -int (*init) (struct pcmcia_socket *s); -void (*exit) (struct pcmcia_socket *s); -}; - -/* Flags in config state */ -#define CONFIG_LOCKED 0x01 -#define CONFIG_IRQ_REQ 0x02 -#define CONFIG_IO_REQ 0x04 +static int static_init (struct pcmcia_socket *s);/* Flags in socket state */ #define SOCKET_PRESENT 0x0008#define SOCKET_INUSE 0x0010#define SOCKET_IN_RESUME 0x0040#define SOCKET_SUSPEND 0x0080 -#define SOCKET_WIN_REQ (i) (0x0100<<(i))#define SOCKET_CARDBUS 0x8000#define SOCKET_CARDBUS_CONFIG 0x10000 +static int pccard_sysfs_add_socket (struct device *dev); +static void pccard_sysfs_remove_socket (struct device *dev); +static int cb_alloc (struct pcmcia_socket *s); +static void cb_free (struct pcmcia_socket *s); +static struct class pcmcia_socket_class; -/* -* Stuff internal to module "pcmcia_rsrc": -*/ -extern int static_init (struct pcmcia_socket *s); -extern struct resource *pcmcia_make_resource (resource_size_t start, -resource_size_t end, -unsigned long flags,const char *name); - -/* -* Stuff internal to module "pcmcia_core": -*/ - -/* socket_sysfs.c */ -extern int pccard_sysfs_add_socket (struct device *dev); -extern void pccard_sysfs_remove_socket (struct device *dev); - -/* cardbus.c */ -int cb_alloc (struct pcmcia_socket *s); -void cb_free (struct pcmcia_socket *s); - - - -/* -* Stuff exported by module "pcmcia_core" to module "pcmcia" -*/ - -struct pcmcia_callback { -struct module *owner; -int (*add) (struct pcmcia_socket *s); -int (*remove) (struct pcmcia_socket *s); -void (*requery) (struct pcmcia_socket *s); -int (*validate) (struct pcmcia_socket *s,unsigned int *i); -int (*suspend) (struct pcmcia_socket *s); -int (*early_resume) (struct pcmcia_socket *s); -int (*resume) (struct pcmcia_socket *s); -}; - -/* cs.c */ -extern struct rw_semaphore pcmcia_socket_list_rwsem; -extern struct list_head pcmcia_socket_list; -extern struct class pcmcia_socket_class; - -int pccard_register_pcmcia (struct pcmcia_socket *s,struct pcmcia_callback *c); -struct pcmcia_socket *pcmcia_get_socket_by_nr (unsigned int nr); - -void pcmcia_parse_uevents (struct pcmcia_socket *socket,unsigned int events);#define PCMCIA_UEVENT_EJECT 0x0001#define PCMCIA_UEVENT_INSERT 0x0002#define PCMCIA_UEVENT_SUSPEND 0x0004#define PCMCIA_UEVENT_RESUME 0x0008#define PCMCIA_UEVENT_REQUERY 0x0010 -struct pcmcia_socket *pcmcia_get_socket (struct pcmcia_socket *skt); -void pcmcia_put_socket (struct pcmcia_socket *skt); - -/* -* Stuff internal to module "pcmcia". -*/ -/* ds.c */ -extern struct bus_type pcmcia_bus_type; - -struct pcmcia_device ; - -/* pcmcia_resource.c */ -extern int pcmcia_release_configuration (struct pcmcia_device *p_dev); -extern int pcmcia_validate_mem (struct pcmcia_socket *s); -extern struct resource *pcmcia_find_mem_region (u_long base, -u_long num, -u_long align, -int low, -struct pcmcia_socket *s); - -void pcmcia_cleanup_irq (struct pcmcia_socket *s); -int pcmcia_setup_irq (struct pcmcia_device *p_dev); - -/* cistpl.c */ -extern const struct bin_attribute pccard_cis_attr; - -int pcmcia_read_cis_mem (struct pcmcia_socket *s,int attr, -u_int addr,u_int len,void *ptr); -int pcmcia_write_cis_mem (struct pcmcia_socket *s,int attr, -u_int addr,u_int len,void *ptr); -void release_cis_mem (struct pcmcia_socket *s); -void destroy_cis_cache (struct pcmcia_socket *s); -int pccard_read_tuple (struct pcmcia_socket *s,unsigned int function, -cisdata_t code,void *parse); -int pcmcia_replace_cis (struct pcmcia_socket *s, -const u8 *data,const size_t len); -int pccard_validate_cis (struct pcmcia_socket *s,unsigned int *count); -int verify_cis_cache (struct pcmcia_socket *s); - -int pccard_get_first_tuple (struct pcmcia_socket *s,unsigned int function, -tuple_t *tuple); - -int pccard_get_next_tuple (struct pcmcia_socket *s,unsigned int function, -tuple_t *tuple); - -int pccard_get_tuple_data (struct pcmcia_socket *s,tuple_t *tuple); - -#endif /* _LINUX_CS_INTERNAL_H */ -/* -* cs.c -- Kernel Card Services - core services -* -* The initial developer of the original code is David A. Hinds -* <[email protected]>. Portions created by David A. Hinds -* are Copyright (C) 1999 David A. Hinds. All Rights Reserved. -* -* (C) 1999 David A. Hinds -*/ - -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/init.h> -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/major.h> -#include <linux/errno.h> -#include <linux/slab.h> -#include <linux/mm.h> -#include <linux/interrupt.h> -#include <linux/timer.h> -#include <linux/ioport.h> -#include <linux/delay.h> -#include <linux/pm.h> -#include <linux/device.h> -#include <linux/kthread.h> -#include <linux/freezer.h> -#include <asm/irq.h> - -#include <pcmcia/cisreg.h> -/* Module parameters */ #define INT_MODULE_PARM (n, v) static int n = v; module_param(n, int, 0444)
@@ -611,37 +337,9 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's *//* Access speed for attribute memory windows */ INT_MODULE_PARM (cis_speed,300 );/* ns */ - -socket_state_t dead_socket = { +static socket_state_t dead_socket = { .csc_mask =SS_DETECT , }; -EXPORT_SYMBOL (dead_socket); - - -/* List of all sockets, protected by a rwsem */ -LIST_HEAD (pcmcia_socket_list); -EXPORT_SYMBOL (pcmcia_socket_list); - -DECLARE_RWSEM (pcmcia_socket_list_rwsem); -EXPORT_SYMBOL (pcmcia_socket_list_rwsem); - - -struct pcmcia_socket *pcmcia_get_socket (struct pcmcia_socket *skt) -{ -struct device *dev =get_device (&skt->dev); -if (!dev) -return NULL ; -return dev_get_drvdata (dev); -} -EXPORT_SYMBOL (pcmcia_get_socket); - - -void pcmcia_put_socket (struct pcmcia_socket *skt) -{ -put_device (&skt->dev); -} -EXPORT_SYMBOL (pcmcia_put_socket); -static void pcmcia_release_socket (struct device *dev) {
@@ -656,56 +354,22 @@ static int pccardd(void *__skt);* pcmcia_register_socket - add a new pcmcia socket device * @socket: the &socket to register */ -int pcmcia_register_socket (struct pcmcia_socket *socket) +static int pcmcia_register_socket (struct pcmcia_socket *socket) {struct task_struct *tsk; +static atomic_t sock;int ret; -if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) +if (!socket || !socket->dev.parent)return -EINVAL ; -dev_dbg (&socket->dev,"pcmcia_register_socket(0x%p)\n" , socket->ops); - -/* try to obtain a socket number [yes, it gets ugly if we -* register more than 2^sizeof(unsigned int) pcmcia -* sockets... but the socket number is deprecated -* anyways, so I don't care] */ -down_write (&pcmcia_socket_list_rwsem); -if (list_empty (&pcmcia_socket_list)) - socket->sock =0 ; -else { -unsigned int found, i =1 ; -struct pcmcia_socket *tmp; -do { - found =1 ; -list_for_each_entry (tmp, &pcmcia_socket_list, socket_list) { -if (tmp->sock == i) - found =0 ; - } - i++; - }while (!found); - socket->sock = i -1 ; - } -list_add_tail (&socket->socket_list, &pcmcia_socket_list); -up_write (&pcmcia_socket_list_rwsem); - -#if !IS_ENABLED (CONFIG_CARDBUS ) -/* -* If we do not support Cardbus, ensure that -* the Cardbus socket capability is disabled. -*/ - socket->features &= ~SS_CAP_CARDBUS ; -#endif + socket->sock =atomic_fetch_inc (&sock);/* set proper values in socket->dev */ dev_set_drvdata (&socket->dev, socket); socket->dev.class = &pcmcia_socket_class;dev_set_name (&socket->dev,"pcmcia_socket%u" , socket->sock); -/* base address = 0, map = 0 */ - socket->cis_mem.flags =0 ; - socket->cis_mem.speed = cis_speed; -INIT_LIST_HEAD (&socket->cis_cache);init_completion (&socket->socket_released);
@@ -714,13 +378,11 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)mutex_init (&socket->ops_mutex);spin_lock_init (&socket->thread_lock); -if (socket->resource_ops->init) { -mutex_lock (&socket->ops_mutex); - ret = socket->resource_ops->init (socket); -mutex_unlock (&socket->ops_mutex); -if (ret) - goto err; - } +mutex_lock (&socket->ops_mutex); + ret =static_init (socket); +mutex_unlock (&socket->ops_mutex); +if (ret) + goto err; tsk =kthread_run (pccardd, socket,"pccardd" );if (IS_ERR (tsk)) {
@@ -747,60 +409,23 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)return 0 ; err: -down_write (&pcmcia_socket_list_rwsem); -list_del (&socket->socket_list); -up_write (&pcmcia_socket_list_rwsem);return ret; }/* pcmcia_register_socket */ -EXPORT_SYMBOL (pcmcia_register_socket); -/** * pcmcia_unregister_socket - remove a pcmcia socket device * @socket: the &socket to unregister */ -void pcmcia_unregister_socket (struct pcmcia_socket *socket) +static void pcmcia_unregister_socket (struct pcmcia_socket *socket) {if (!socket)return ; -dev_dbg (&socket->dev,"pcmcia_unregister_socket(0x%p)\n" , socket->ops); -if (socket->thread)kthread_stop (socket->thread); -/* remove from our own list */ -down_write (&pcmcia_socket_list_rwsem); -list_del (&socket->socket_list); -up_write (&pcmcia_socket_list_rwsem); - -/* wait for sysfs to drop all references */ -if (socket->resource_ops->exit) { -mutex_lock (&socket->ops_mutex); - socket->resource_ops->exit (socket); -mutex_unlock (&socket->ops_mutex); - }wait_for_completion (&socket->socket_released); }/* pcmcia_unregister_socket */ -EXPORT_SYMBOL (pcmcia_unregister_socket); - - -struct pcmcia_socket *pcmcia_get_socket_by_nr (unsigned int nr) -{ -struct pcmcia_socket *s; - -down_read (&pcmcia_socket_list_rwsem); -list_for_each_entry (s, &pcmcia_socket_list, socket_list) -if (s->sock == nr) { -up_read (&pcmcia_socket_list_rwsem); -return s; - } -up_read (&pcmcia_socket_list_rwsem); - -return NULL ; - -} -EXPORT_SYMBOL (pcmcia_get_socket_by_nr);static int socket_reset (struct pcmcia_socket *skt) {
@@ -809,15 +434,15 @@ static int socket_reset(struct pcmcia_socket *skt)dev_dbg (&skt->dev,"reset\n" ); skt->socket.flags |=SS_OUTPUT_ENA |SS_RESET ; - skt->ops->set_socket (skt, &skt->socket); +yenta_set_socket (skt, &skt->socket);udelay ((long )reset_time); skt->socket.flags &= ~SS_RESET ; - skt->ops->set_socket (skt, &skt->socket); +yenta_set_socket (skt, &skt->socket);msleep (unreset_delay *10 );for (i =0 ; i < unreset_limit; i++) { - skt->ops->get_status (skt, &status); +yenta_get_status (skt, &status);if (!(status &SS_DETECT ))return -ENODEV ;
@@ -844,9 +469,6 @@ static void socket_shutdown(struct pcmcia_socket *s)dev_dbg (&s->dev,"shutdown\n" ); -if (s->callback) - s->callback->remove (s); -mutex_lock (&s->ops_mutex); s->state &=SOCKET_INUSE |SOCKET_PRESENT ;msleep (shutdown_delay *10 );
@@ -854,9 +476,8 @@ static void socket_shutdown(struct pcmcia_socket *s)/* Blank out the socket state */ s->socket = dead_socket; - s->ops->init (s); - s->ops->set_socket (s, &s->socket); - s->lock_count =0 ; +yenta_sock_init (s); +yenta_set_socket (s, &s->socket);kfree (s->fake_cis); s->fake_cis =NULL ; s->functions =0 ;
@@ -869,14 +490,12 @@ static void socket_shutdown(struct pcmcia_socket *s)*/ mutex_unlock (&s->ops_mutex); -#if IS_ENABLED (CONFIG_CARDBUS )cb_free (s); -#endif /* give socket some time to power down */ msleep (100 ); - s->ops->get_status (s, &status); +yenta_get_status (s, &status);if (status &SS_POWERON ) {dev_err (&s->dev,"*** DANGER *** unable to remove socket power\n" );
@@ -891,14 +510,14 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)dev_dbg (&skt->dev,"setup\n" ); - skt->ops->get_status (skt, &status); +yenta_get_status (skt, &status);if (!(status &SS_DETECT ))return -ENODEV ;msleep (initial_delay *10 );for (i =0 ; i <100 ; i++) { - skt->ops->get_status (skt, &status); +yenta_get_status (skt, &status);if (!(status &SS_DETECT ))return -ENODEV ;
@@ -914,10 +533,6 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) }if (status &SS_CARDBUS ) { -if (!(skt->features &SS_CAP_CARDBUS )) { -dev_err (&skt->dev,"cardbus cards are not supported\n" ); -return -EINVAL ; - } skt->state |=SOCKET_CARDBUS ; }else skt->state &= ~SOCKET_CARDBUS ;
@@ -938,14 +553,14 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) skt->power_hook (skt,HOOK_POWER_PRE ); skt->socket.flags =0 ; - skt->ops->set_socket (skt, &skt->socket); +yenta_set_socket (skt, &skt->socket);/* * Wait "vcc_settle" for the supply to stabilise. */ msleep (vcc_settle *10 ); - skt->ops->get_status (skt, &status); +yenta_get_status (skt, &status);if (!(status &SS_POWERON )) {dev_err (&skt->dev,"unable to apply power\n" );return -EIO ;
@@ -984,17 +599,11 @@ static int socket_insert(struct pcmcia_socket *skt) (skt->state &SOCKET_CARDBUS ) ?"CardBus" :"PCMCIA" , skt->sock); -#if IS_ENABLED (CONFIG_CARDBUS ) -if (skt->state &SOCKET_CARDBUS ) { -cb_alloc (skt); - skt->state |=SOCKET_CARDBUS_CONFIG ; - } -#endif +cb_alloc (skt); + skt->state |=SOCKET_CARDBUS_CONFIG ; +dev_dbg (&skt->dev,"insert done\n" );mutex_unlock (&skt->ops_mutex); - -if (!(skt->state &SOCKET_CARDBUS ) && (skt->callback)) - skt->callback->add (skt); }else {mutex_unlock (&skt->ops_mutex);socket_shutdown (skt);
@@ -1014,9 +623,8 @@ static int socket_suspend(struct pcmcia_socket *skt) skt->suspended_state = skt->state; skt->socket = dead_socket; - skt->ops->set_socket (skt, &skt->socket); -if (skt->ops->suspend) - skt->ops->suspend (skt); +yenta_set_socket (skt, &skt->socket); +yenta_sock_suspend (skt); skt->state |=SOCKET_SUSPEND ; skt->state &= ~SOCKET_IN_RESUME ;mutex_unlock (&skt->ops_mutex);
@@ -1027,8 +635,8 @@ static int socket_early_resume(struct pcmcia_socket *skt) {mutex_lock (&skt->ops_mutex); skt->socket = dead_socket; - skt->ops->init (skt); - skt->ops->set_socket (skt, &skt->socket); +yenta_sock_init (skt); +yenta_set_socket (skt, &skt->socket);if (skt->state &SOCKET_PRESENT ) skt->resume_status =socket_setup (skt, resume_delay); skt->state |=SOCKET_IN_RESUME ;
@@ -1065,8 +673,6 @@ static int socket_late_resume(struct pcmcia_socket *skt)return socket_insert (skt); } -if (!(skt->state &SOCKET_CARDBUS ) && (skt->callback)) - ret = skt->callback->early_resume (skt);return ret; }
@@ -1078,36 +684,16 @@ static int socket_late_resume(struct pcmcia_socket *skt)static int socket_complete_resume (struct pcmcia_socket *skt) {int ret =0 ; -#if IS_ENABLED (CONFIG_CARDBUS ) -if (skt->state &SOCKET_CARDBUS ) { -/* We can't be sure the CardBus card is the same -* as the one previously inserted. Therefore, remove -* and re-add... */ -cb_free (skt); - ret =cb_alloc (skt); -if (ret) -cb_free (skt); - } -#endif -return ret; -} -/* -* Resume a socket. If a card is present, verify its CIS against -* our cached copy. If they are different, the card has been -* replaced, and we need to tell the drivers. -*/ -static int socket_resume (struct pcmcia_socket *skt) -{ -int err; -if (!(skt->state &SOCKET_SUSPEND )) -return -EBUSY ; +/* We can't be sure the CardBus card is the same +* as the one previously inserted. Therefore, remove +* and re-add... */ +cb_free (skt); + ret =cb_alloc (skt); +if (ret) +cb_free (skt); -socket_early_resume (skt); - err =socket_late_resume (skt); -if (!err) - err =socket_complete_resume (skt); -return err; +return ret; }static void socket_remove (struct pcmcia_socket *skt)
@@ -1135,7 +721,7 @@ static void socket_detect_change(struct pcmcia_socket *skt)if (!(skt->state &SOCKET_PRESENT ))msleep (20 ); - skt->ops->get_status (skt, &status); +yenta_get_status (skt, &status);if ((skt->state &SOCKET_PRESENT ) && !(status &SS_DETECT ))socket_remove (skt);
@@ -1152,8 +738,8 @@ static int pccardd(void *__skt) skt->thread = current; skt->socket = dead_socket; - skt->ops->init (skt); - skt->ops->set_socket (skt, &skt->socket); +yenta_sock_init (skt); +yenta_set_socket (skt, &skt->socket);/* register with the device core */ ret =device_register (&skt->dev);
@@ -1194,28 +780,6 @@ static int pccardd(void *__skt)socket_remove (skt);if (sysfs_events &PCMCIA_UEVENT_INSERT )socket_insert (skt); -if ((sysfs_events &PCMCIA_UEVENT_SUSPEND ) && - !(skt->state &SOCKET_CARDBUS )) { -if (skt->callback) - ret = skt->callback->suspend (skt); -else - ret =0 ; -if (!ret) { -socket_suspend (skt); -msleep (100 ); - } - } -if ((sysfs_events &PCMCIA_UEVENT_RESUME ) && - !(skt->state &SOCKET_CARDBUS )) { - ret =socket_resume (skt); -if (!ret && skt->callback) - skt->callback->resume (skt); - } -if ((sysfs_events &PCMCIA_UEVENT_REQUERY ) && - !(skt->state &SOCKET_CARDBUS )) { -if (!ret && skt->callback) - skt->callback->requery (skt); - } }mutex_unlock (&skt->skt_mutex);
@@ -1251,7 +815,7 @@ static int pccardd(void *__skt)* Yenta (at least) probes interrupts before registering the socket and * starting the handler thread. */ -void pcmcia_parse_events (struct pcmcia_socket *s,u_int events) +static void pcmcia_parse_events (struct pcmcia_socket *s,u_int events) {unsigned long flags;dev_dbg (&s->dev,"parse_events: events %08x\n" , events);
@@ -1263,7 +827,6 @@ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)wake_up_process (s->thread); } }/* pcmcia_parse_events */ -EXPORT_SYMBOL (pcmcia_parse_events);/** * pcmcia_parse_uevents() - tell pccardd to issue manual commands
@@ -1276,7 +839,7 @@ EXPORT_SYMBOL(pcmcia_parse_events);* PCMCIA_UEVENT_RESUME (for resume), PCMCIA_UEVENT_SUSPEND (for suspend) * and PCMCIA_UEVENT_REQUERY (for re-querying the PCMCIA card). */ -void pcmcia_parse_uevents (struct pcmcia_socket *s,u_int events) +static void pcmcia_parse_uevents (struct pcmcia_socket *s,u_int events) {unsigned long flags;dev_dbg (&s->dev,"parse_uevents: events %08x\n" , events);
@@ -1288,84 +851,12 @@ void pcmcia_parse_uevents(struct pcmcia_socket *s, u_int events)wake_up_process (s->thread); } } -EXPORT_SYMBOL (pcmcia_parse_uevents); - - -/* register pcmcia_callback */ -int pccard_register_pcmcia (struct pcmcia_socket *s,struct pcmcia_callback *c) -{ -int ret =0 ; - -/* s->skt_mutex also protects s->callback */ -mutex_lock (&s->skt_mutex); - -if (c) { -/* registration */ -if (s->callback) { - ret = -EBUSY ; - goto err; - } - - s->callback = c; - -if ((s->state & (SOCKET_PRESENT |SOCKET_CARDBUS )) ==SOCKET_PRESENT ) - s->callback->add (s); - }else - s->callback =NULL ; - err: -mutex_unlock (&s->skt_mutex); - -return ret; -} -EXPORT_SYMBOL (pccard_register_pcmcia); -/* I'm not sure which "reset" function this is supposed to use, * but for now, it uses the low-level interface's reset, not the * CIS register. */ -int pcmcia_reset_card (struct pcmcia_socket *skt) -{ -int ret; - -dev_dbg (&skt->dev,"resetting socket\n" ); - -mutex_lock (&skt->skt_mutex); -do { -if (!(skt->state &SOCKET_PRESENT )) { -dev_dbg (&skt->dev,"can't reset, not present\n" ); - ret = -ENODEV ; -break ; - } -if (skt->state &SOCKET_SUSPEND ) { -dev_dbg (&skt->dev,"can't reset, suspended\n" ); - ret = -EBUSY ; -break ; - } -if (skt->state &SOCKET_CARDBUS ) { -dev_dbg (&skt->dev,"can't reset, is cardbus\n" ); - ret = -EPERM ; -break ; - } - -if (skt->callback) - skt->callback->suspend (skt); -mutex_lock (&skt->ops_mutex); - ret =socket_reset (skt); -mutex_unlock (&skt->ops_mutex); -if ((ret ==0 ) && (skt->callback)) - skt->callback->resume (skt); - - ret =0 ; - }while (0 ); -mutex_unlock (&skt->skt_mutex); - -return ret; -}/* reset_card */ -EXPORT_SYMBOL (pcmcia_reset_card); - -static int pcmcia_socket_uevent (const struct device *dev,struct kobj_uevent_env *env) {
@@ -1385,9 +876,6 @@ static void pcmcia_release_socket_class(struct class *data)complete (&pcmcia_unload); } - -#ifdef CONFIG_PM -static int __pcmcia_pm_op (struct device *dev,int (*callback) (struct pcmcia_socket *skt)) {
@@ -1424,8 +912,7 @@ static void __used pcmcia_socket_dev_complete(struct device *dev)static const struct dev_pm_ops pcmcia_socket_pm_ops = {/* dev_resume may be called with IRQs enabled */ -SET_SYSTEM_SLEEP_PM_OPS (NULL , - pcmcia_socket_dev_resume) +SYSTEM_SLEEP_PM_OPS (NULL , pcmcia_socket_dev_resume)/* late suspend must be called with IRQs disabled */ .suspend_noirq = pcmcia_socket_dev_suspend_noirq,
@@ -1439,49 +926,13 @@ static const struct dev_pm_ops pcmcia_socket_pm_ops = { .complete = pcmcia_socket_dev_complete, }; -#define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops) - -#else /* CONFIG_PM */ - -#define PCMCIA_SOCKET_CLASS_PM_OPS NULL - -#endif /* CONFIG_PM */ - -struct class pcmcia_socket_class = { +static struct class pcmcia_socket_class = { .name ="pcmcia_socket" , .dev_uevent = pcmcia_socket_uevent, .dev_release = pcmcia_release_socket, .class_release = pcmcia_release_socket_class, - .pm =PCMCIA_SOCKET_CLASS_PM_OPS , + .pm =pm_ptr (&pcmcia_socket_pm_ops), }; -EXPORT_SYMBOL (pcmcia_socket_class); - -/* -* socket_sysfs.c -- most of socket-related sysfs output -* -* (C) 2003 - 2004 Dominik Brodowski -*/ - -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/init.h> -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/major.h> -#include <linux/errno.h> -#include <linux/mm.h> -#include <linux/interrupt.h> -#include <linux/timer.h> -#include <linux/ioport.h> -#include <linux/delay.h> -#include <linux/pm.h> -#include <linux/device.h> -#include <linux/mutex.h> -#include <asm/irq.h> - -#include <pcmcia/ss.h> -#include <pcmcia/cisreg.h> -#include <pcmcia/ds.h> #define to_socket (_dev) container_of(_dev, struct pcmcia_socket, dev)
@@ -1492,9 +943,7 @@ static ssize_t pccard_show_type(struct device *dev, struct device_attribute *attif (!(s->state &SOCKET_PRESENT ))return -ENODEV ; -if (s->state &SOCKET_CARDBUS ) -return sysfs_emit (buf,"32-bit\n" ); -return sysfs_emit (buf,"16-bit\n" ); +return sysfs_emit (buf,"32-bit\n" ); } static DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL);
@@ -1672,43 +1121,16 @@ static const struct attribute_group socket_attrs = { .attrs = pccard_socket_attributes, }; -int pccard_sysfs_add_socket (struct device *dev) +static int pccard_sysfs_add_socket (struct device *dev) {return sysfs_create_group (&dev->kobj, &socket_attrs); } -void pccard_sysfs_remove_socket (struct device *dev) +static void pccard_sysfs_remove_socket (struct device *dev) {sysfs_remove_group (&dev->kobj, &socket_attrs); } -/* -* cardbus.c -- 16-bit PCMCIA core support -* -* The initial developer of the original code is David A. Hinds -* <[email protected]>. Portions created by David A. Hinds -* are Copyright (C) 1999 David A. Hinds. All Rights Reserved. -* -* (C) 1999 David A. Hinds -*/ - -/* -* Cardbus handling has been re-written to be more of a PCI bridge thing, -* and the PCI code basically does all the resource handling. -* -* Linus, Jan 2000 -*/ - - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/pci.h> - -#include <pcmcia/ss.h> -#include <pcmcia/cistpl.h> - -#include "cs_internal.h" -static void cardbus_config_irq_and_cls (struct pci_bus *bus,int irq) {struct pci_dev *dev;
@@ -1746,7 +1168,7 @@ static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)* cb_alloc() allocates the kernel data structures for a Cardbus device * and handles the lowest level PCI device setup issues. */ -int __ref cb_alloc (struct pcmcia_socket *s) +static int __ref cb_alloc (struct pcmcia_socket *s) {struct pci_bus *bus = s->cb_dev->subordinate;struct pci_dev *dev;
@@ -1785,7 +1207,7 @@ int __ref cb_alloc(struct pcmcia_socket *s)* * cb_free() handles the lowest level PCI device cleanup. */ -void cb_free (struct pcmcia_socket *s) +static void cb_free (struct pcmcia_socket *s) {struct pci_dev *bridge, *dev, *tmp;struct pci_bus *bus;
@@ -1807,25 +1229,7 @@ void cb_free(struct pcmcia_socket *s) } -/* -* rsrc_mgr.c -- Resource management routines and/or wrappers -* -* The initial developer of the original code is David A. Hinds -* <[email protected]>. Portions created by David A. Hinds -* are Copyright (C) 1999 David A. Hinds. All Rights Reserved. -* -* (C) 1999 David A. Hinds -*/ - -#include <linux/slab.h> -#include <linux/module.h> -#include <linux/kernel.h> - -#include <pcmcia/ss.h> -#include <pcmcia/cistpl.h> -#include "cs_internal.h" - -int static_init (struct pcmcia_socket *s) +static int static_init (struct pcmcia_socket *s) {/* the good thing about SS_CAP_STATIC_MAP sockets is * that they don't need a resource database */
@@ -1835,69 +1239,6 @@ int static_init(struct pcmcia_socket *s)return 0 ; } -struct resource *pcmcia_make_resource (resource_size_t start, -resource_size_t end, -unsigned long flags,const char *name) -{ -struct resource *res =kzalloc (sizeof (*res),GFP_KERNEL ); - -if (res) { - res->name = name; - res->start = start; - res->end = start + end -1 ; - res->flags = flags; - } -return res; -} - -static int static_find_io (struct pcmcia_socket *s,unsigned int attr, -unsigned int *base,unsigned int num, -unsigned int align,struct resource **parent) -{ -if (!s->io_offset) -return -EINVAL ; - *base = s->io_offset | (*base &0x0fff ); - *parent =NULL ; - -return 0 ; -} - -struct pccard_resource_ops pccard_static_ops = { - .validate_mem =NULL , - .find_io = static_find_io, - .find_mem =NULL , - .init = static_init, - .exit =NULL , -}; -EXPORT_SYMBOL (pccard_static_ops); - - -/* -* Regular cardbus driver ("yenta_socket") -* -* (C) Copyright 1999, 2000 Linus Torvalds -* -* Changelog: -* Aug 2002: Manfred Spraul <[email protected]> -* Dynamically adjust the size of the bridge resource -* -* May 2003: Dominik Brodowski <[email protected]> -* Merge pci_socket.c and yenta.c into one file -*/ -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/workqueue.h> -#include <linux/interrupt.h> -#include <linux/delay.h> -#include <linux/module.h> -#include <linux/io.h> -#include <linux/slab.h> - -#include <pcmcia/ss.h> - -#include "i82365.h" -#include "cs_internal.h" -static bool disable_clkrun;module_param (disable_clkrun, bool,0444 ); MODULE_PARM_DESC(disable_clkrun,
@@ -2111,59 +1452,8 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)static void yenta_set_power (struct yenta_socket *socket,socket_state_t *state) { -/* some birdges require to use the ExCA registers to power 16bit cards */ -if (!(cb_readl (socket,CB_SOCKET_STATE ) &CB_CBCARD ) && - (socket->flags &YENTA_16BIT_POWER_EXCA )) { -u8 reg, old; - reg = old =exca_readb (socket,I365_POWER ); - reg &= ~(I365_VCC_MASK |I365_VPP1_MASK |I365_VPP2_MASK ); - -/* i82365SL-DF style */ -if (socket->flags &YENTA_16BIT_POWER_DF ) { -switch (state->Vcc) { -case 33 : - reg |=I365_VCC_3V ; -break ; -case 50 : - reg |=I365_VCC_5V ; -break ; -default : - reg =0 ; -break ; - } -switch (state->Vpp) { -case 33 : -case 50 : - reg |=I365_VPP1_5V ; -break ; -case 120 : - reg |=I365_VPP1_12V ; -break ; - } - }else { -/* i82365SL-B style */ -switch (state->Vcc) { -case 50 : - reg |=I365_VCC_5V ; -break ; -default : - reg =0 ; -break ; - } -switch (state->Vpp) { -case 50 : - reg |=I365_VPP1_5V |I365_VPP2_5V ; -break ; -case 120 : - reg |=I365_VPP1_12V |I365_VPP2_12V ; -break ; - } - } - -if (reg != old) -exca_writeb (socket,I365_POWER , reg); - }else { -u32 reg =0 ;/* CB_SC_STPCLK? */ +if (cb_readl (socket,CB_SOCKET_STATE ) &CB_CBCARD ) { +u32 reg =0 ;/* CB_SC_STPCLK? */ switch (state->Vcc) {case 33 : reg =CB_SC_VCC_3V ;
@@ -2214,46 +1504,6 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) bridge |=CB_BRIDGE_INTR ; }exca_writeb (socket,I365_INTCTL , intr); - }else { -u8 reg; - - reg =exca_readb (socket,I365_INTCTL ) & (I365_RING_ENA |I365_INTR_ENA ); - reg |= (state->flags &SS_RESET ) ?0 :I365_PC_RESET ; - reg |= (state->flags &SS_IOCARD ) ?I365_PC_IOCARD :0 ; -if (state->io_irq != socket->dev->irq) { - reg |= state->io_irq; - bridge |=CB_BRIDGE_INTR ; - } -exca_writeb (socket,I365_INTCTL , reg); - - reg =exca_readb (socket,I365_POWER ) & (I365_VCC_MASK |I365_VPP1_MASK ); - reg |=I365_PWR_NORESET ; -if (state->flags &SS_PWR_AUTO ) - reg |=I365_PWR_AUTO ; -if (state->flags &SS_OUTPUT_ENA ) - reg |=I365_PWR_OUT ; -if (exca_readb (socket,I365_POWER ) != reg) -exca_writeb (socket,I365_POWER , reg); - -/* CSC interrupt: no ISA irq for CSC */ - reg =exca_readb (socket,I365_CSCINT ); - reg &=I365_CSC_IRQ_MASK ; - reg |=I365_CSC_DETECT ; -if (state->flags &SS_IOCARD ) { -if (state->csc_mask &SS_STSCHG ) - reg |=I365_CSC_STSCHG ; - }else { -if (state->csc_mask &SS_BATDEAD ) - reg |=I365_CSC_BVD1 ; -if (state->csc_mask &SS_BATWARN ) - reg |=I365_CSC_BVD2 ; -if (state->csc_mask &SS_READY ) - reg |=I365_CSC_READY ; - } -exca_writeb (socket,I365_CSCINT , reg); -exca_readb (socket,I365_CSC ); -if (sock->zoom_video) - sock->zoom_video (sock, state->flags &SS_ZVCARD ); }config_writew (socket,CB_BRIDGE_CONTROL , bridge);/* Socket event mask: get card insert/remove events.. */
@@ -2689,16 +1939,6 @@ static void yenta_close(struct pci_dev *dev)kfree (sock); } - -static struct pccard_operations yenta_socket_operations = { - .init = yenta_sock_init, - .suspend = yenta_sock_suspend, - .get_status = yenta_get_status, - .set_socket = yenta_set_socket, - .set_io_map = yenta_set_io_map, - .set_mem_map = yenta_set_mem_map, -}; -#ifdef CONFIG_YENTA_TI /* * ti113x.h 1.16 1999/10/25 20:03:34
@@ -4435,13 +3675,8 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)return -ENOMEM ;/* prepare pcmcia_socket */ - socket->socket.ops = ¥ta_socket_operations; - socket->socket.resource_ops = &pccard_static_ops; socket->socket.dev.parent = &dev->dev; - socket->socket.driver_data = socket; socket->socket.owner =THIS_MODULE ; - socket->socket.features =SS_CAP_PAGE_REGS |SS_CAP_PCCARD ; - socket->socket.map_size =0x1000 ; socket->socket.cb_dev = dev;/* prepare struct yenta_socket */
@@ -4514,8 +3749,6 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id) "no PCI IRQ, CardBus support disabled for this socket.\n");dev_info (&dev->dev,"check your BIOS CardBus, BIOS IRQ or ACPI settings.\n" ); - }else { - socket->socket.features |=SS_CAP_CARDBUS ; }/* Figure out what the dang thing can do for the PCMCIA layer... */
@@ -4559,7 +3792,6 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)return ret; } -#ifdef CONFIG_PM_SLEEP static int yenta_dev_suspend_noirq (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
@@ -4604,14 +3836,9 @@ static int yenta_dev_resume_noirq(struct device *dev) }static const struct dev_pm_ops yenta_pm_ops = { -SET_NOIRQ_SYSTEM_SLEEP_PM_OPS (yenta_dev_suspend_noirq, yenta_dev_resume_noirq) +NOIRQ_SYSTEM_SLEEP_PM_OPS (yenta_dev_suspend_noirq, yenta_dev_resume_noirq) }; -#define YENTA_PM_OPS (¥ta_pm_ops) -#else -#define YENTA_PM_OPS NULL -#endif -#define CB_ID (vend, dev, type) \ { \ .vendor = vend, \
@@ -4707,7 +3934,7 @@ static struct pci_driver yenta_cardbus_driver = { .id_table = yenta_table, .probe = yenta_probe, .remove = yenta_close, - .driver.pm = YENTA_PM_OPS, + .driver.pm = pm_sleep_ptr(¥ta_pm_ops), };static int __init yenta_init (void )
Signature · 1 line
2.39.2
RFC 5/6 pccard: drop remnants of cardbus support
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Now that cardbus/yenta support is independent of PCMCIA support, there is no need to keep the conditional compilation bits around any longer.
This means we can allow both CARDBUS and PCMCIA to be built as loadable modules, though actually loading them at the same time, or building them into the kernel would still fails because they try to create the same sysfs interface.
--- drivers/pcmcia/Kconfig | 2 +- drivers/pcmcia/cistpl.c | 10 +--- drivers/pcmcia/cs.c | 86 ++++------------------------------- drivers/pcmcia/cs_internal.h | 9 ---- drivers/pcmcia/socket_sysfs.c | 2 - include/pcmcia/ss.h | 21 --------- 6 files changed, 11 insertions(+), 119 deletions(-)
drivers/pcmcia/Kconfig +1 -1
@@ -23,7 +23,7 @@ config PCMCIA select CRC32 depends on X86_32 || ARCH_PXA || ARCH_SA1100 || ARCH_OMAP1 || \ MIPS_ALCHEMY || PPC_PASEMI || COMPILE_TEST - depends on CARDBUS=n + depends on !CARDBUS default y help This option enables support for 16-bit PCMCIA cards. Most older
drivers/pcmcia/cistpl.c +2 -8
@@ -290,9 +290,6 @@ static int read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,struct cis_cache_entry *cis;int ret =0 ; -if (s->state &SOCKET_CARDBUS ) -return -EINVAL ; -mutex_lock (&s->ops_mutex);if (s->fake_cis) {if (s->fake_cis_len >= addr+len)
@@ -374,9 +371,6 @@ int verify_cis_cache(struct pcmcia_socket *s)char *buf;int ret; -if (s->state &SOCKET_CARDBUS ) -return -EINVAL ; - buf =kmalloc (256 ,GFP_KERNEL );if (buf ==NULL ) {dev_warn (&s->dev,"no memory for verifying CIS\n" );
@@ -449,7 +443,7 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,if (!s)return -EINVAL ; -if (!(s->state &SOCKET_PRESENT ) || (s->state &SOCKET_CARDBUS )) +if (!(s->state &SOCKET_PRESENT ))return -ENODEV ; tuple->TupleLink = tuple->Flags =0 ;
@@ -527,7 +521,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,if (!s)return -EINVAL ; -if (!(s->state &SOCKET_PRESENT ) || (s->state &SOCKET_CARDBUS )) +if (!(s->state &SOCKET_PRESENT ))return -ENODEV ; link[1 ] = tuple->TupleLink;
drivers/pcmcia/cs.c +8 -78
174 lines not on this page · raw message
drivers/pcmcia/cs_internal.h +0 -9
@@ -70,9 +70,6 @@ struct pccard_resource_ops {#define SOCKET_IN_RESUME 0x0040#define SOCKET_SUSPEND 0x0080#define SOCKET_WIN_REQ (i) (0x0100<<(i)) -#define SOCKET_CARDBUS 0x8000 -#define SOCKET_CARDBUS_CONFIG 0x10000 -/* * Stuff internal to module "pcmcia_rsrc":
@@ -90,12 +87,6 @@ extern struct resource *pcmcia_make_resource(resource_size_t start,extern int pccard_sysfs_add_socket (struct device *dev);extern void pccard_sysfs_remove_socket (struct device *dev); -/* cardbus.c */ -int cb_alloc (struct pcmcia_socket *s); -void cb_free (struct pcmcia_socket *s); - - -/* * Stuff exported by module "pcmcia_core" to module "pcmcia" */
drivers/pcmcia/socket_sysfs.c +0 -2
@@ -37,8 +37,6 @@ static ssize_t pccard_show_type(struct device *dev, struct device_attribute *attif (!(s->state &SOCKET_PRESENT ))return -ENODEV ; -if (s->state &SOCKET_CARDBUS ) -return sysfs_emit (buf,"32-bit\n" );return sysfs_emit (buf,"16-bit\n" ); } static DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL);
include/pcmcia/ss.h +0 -21
@@ -16,10 +16,6 @@#include <linux/sched.h> /* task_struct, completion */ #include <linux/mutex.h> -#if IS_ENABLED (CONFIG_CARDBUS ) -#include <linux/pci.h> -#endif -/* Definitions for card status flags for GetStatus */ #define SS_WRPROT 0x0001#define SS_CARDLOCK 0x0002
@@ -175,11 +171,6 @@ struct pcmcia_socket {/* so is power hook */ int (*power_hook)(struct pcmcia_socket *sock,int operation); -/* allows tuning the CB bridge before loading driver for the CB card */ -#if IS_ENABLED (CONFIG_CARDBUS ) -void (*tune_bridge)(struct pcmcia_socket *sock,struct pci_bus *bus); -#endif -/* state thread */ struct task_struct *thread;struct completion thread_done;
@@ -197,7 +188,6 @@ struct pcmcia_socket {/* pcmcia (16-bit) */ struct pcmcia_callback *callback; -#if defined(CONFIG_PCMCIA ) || defined(CONFIG_PCMCIA_MODULE )/* The following elements refer to 16-bit PCMCIA devices inserted * into the socket */ struct list_head devices_list;
@@ -215,8 +205,6 @@ struct pcmcia_socket {/* IRQ to be used by PCMCIA devices. May not be IRQ 0. */ unsigned int pcmcia_irq; -#endif /* CONFIG_PCMCIA */ -/* socket device */ struct device dev;/* data internal to the socket driver */
@@ -239,17 +227,8 @@ struct pcmcia_socket {* */ extern struct pccard_resource_ops pccard_static_ops; -#if defined(CONFIG_PCMCIA ) || defined(CONFIG_PCMCIA_MODULE )extern struct pccard_resource_ops pccard_iodyn_ops;extern struct pccard_resource_ops pccard_nonstatic_ops; -#else -/* If PCMCIA is not used, but only CARDBUS, these functions are not used -* at all. Therefore, do not use the large (240K!) rsrc_nonstatic module -*/ -#define pccard_iodyn_ops pccard_static_ops -#define pccard_nonstatic_ops pccard_static_ops -#endif -/* socket drivers use this callback in their IRQ handler */ extern void pcmcia_parse_events(struct pcmcia_socket *socket,
Signature · 1 line
2.39.2
RFC 6/6 pci: hotplug: move cardbus code from drivers/pcmcia
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
16-bit pcmcia and 32-bit cardbus code are now completely separate code bases, with the cardbus implementation just interfacig with the PCI core for hotplugging cards, so move it to the same place as the other PCI hotplug drivers.
The pcmcia/i82365.h header file is the only bit that contains shared definitions for common registers.
---
drivers/Makefile | 2 +-
drivers/pci/hotplug/Kconfig | 56 +++++++++++++++++++
drivers/pci/hotplug/Makefile | 1 +
.../{pcmcia => pci/hotplug}/yenta_socket.c | 2 +-
drivers/pcmcia/Kconfig | 56 -------------------
drivers/pcmcia/Makefile | 3 -
drivers/pcmcia/i82092.c | 2 +-
drivers/pcmcia/i82365.c | 2 +-
drivers/pcmcia/pd6729.c | 3 +-
{drivers => include}/pcmcia/i82365.h | 0
10 files changed, 62 insertions(+), 65 deletions(-)
rename drivers/{pcmcia => pci/hotplug}/yenta_socket.c (99%)
rename {drivers => include}/pcmcia/i82365.h (100%)drivers/Makefile +1 -1
@@ -93,7 +93,7 @@ obj-$(CONFIG_UIO) += uio/ obj-$(CONFIG_VFIO) += vfio/ obj-y += cdrom/ obj-y += auxdisplay/ -obj-$(CONFIG_PCCARD) += pcmcia/ +obj-$(CONFIG_PCMCIA) += pcmcia/ obj-$(CONFIG_DIO) += dio/ obj-$(CONFIG_SBUS) += sbus/ obj-$(CONFIG_ZORRO) += zorro/
drivers/pci/hotplug/Kconfig +56 -0
60 lines not on this page · raw message
drivers/pci/hotplug/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_HOTPLUG_PCI_RPA) += rpaphp.o obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR) += rpadlpar_io.o obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o obj-$(CONFIG_HOTPLUG_PCI_S390) += s390_pci_hpc.o +obj-$(CONFIG_CARDBUS) += yenta_socket.o # acpiphp_ibm extends acpiphp, so should be linked afterwards.
drivers/pci/hotplug/yenta_socket.c renamed from drivers/pcmcia/yenta_socket.c +1 -1
@@ -34,7 +34,7 @@#include <linux/timer.h> #include <linux/workqueue.h> #include <asm/irq.h> -#include "i82365.h" +#include <pcmcia/i82365.h> /* Definitions for card status flags for GetStatus */ #define SS_WRPROT 0x0001
drivers/pcmcia/Kconfig +0 -56
67 lines not on this page · raw message
drivers/pcmcia/Makefile +0 -3
@@ -14,9 +14,6 @@ obj-$(CONFIG_PCMCIA) += pcmcia_rsrc.o # socket drivers - -obj-$(CONFIG_YENTA) += yenta_socket.o - obj-$(CONFIG_PD6729) += pd6729.o obj-$(CONFIG_I82365) += i82365.o obj-$(CONFIG_I82092) += i82092.o
drivers/pcmcia/i82092.c +1 -1
@@ -17,11 +17,11 @@#include <linux/device.h> #include <pcmcia/ss.h> +#include <pcmcia/i82365.h> #include <linux/io.h> #include "i82092aa.h" -#include "i82365.h" MODULE_LICENSE ("GPL" );
drivers/pcmcia/i82365.c +1 -1
@@ -54,7 +54,7 @@#include <linux/isapnp.h> /* ISA-bus controllers */ -#include "i82365.h" +#include <pcmcia/i82365.h> #include "cirrus.h" #include "vg468.h" #include "ricoh.h"
drivers/pcmcia/pd6729.c +1 -2
@@ -18,10 +18,9 @@#include <linux/io.h> #include <pcmcia/ss.h> - +#include <pcmcia/i82365.h> #include "pd6729.h" -#include "i82365.h" #include "cirrus.h" MODULE_LICENSE ("GPL" );
include/pcmcia/i82365.h renamed from drivers/pcmcia/i82365.h +0 -0
Signature · 1 line
2.39.2
kernel test robot
build botRe: [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Arnd,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus soc/for-next linus/master v6.2 next-20230227] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/pccard-remove-bcm63xx-socket-driver/20230227-213913 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next patch link: https://lore.kernel.org/r/20230227133457.431729-7-arnd%40kernel.org patch subject: [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230228/[email protected]/config) compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/ee29671804f97a3f4ccc122dd9c2e6fa6555aa5d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arnd-Bergmann/pccard-remove-bcm63xx-socket-driver/20230227-213913 git checkout ee29671804f97a3f4ccc122dd9c2e6fa6555aa5d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/pci/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/pci/hotplug/yenta_socket.c:2816: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* EnE specific part. EnE bridges are register compatible with TI bridges but
vim +2816 drivers/pci/hotplug/yenta_socket.c
eb0a90b4970d66 drivers/pcmcia/yenta_socket.c Dominik Brodowski 2005-07-12 2813 eb0a90b4970d66 drivers/pcmcia/yenta_socket.c Dominik Brodowski 2005-07-12 2814 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 2815 /** 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 @2816 * EnE specific part. EnE bridges are register compatible with TI bridges but 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 2817 * have their own test registers and more important their own little problems. 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 2818 * Some fixup code to make everybody happy (TM). 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 2819 */ 34b7367024292e drivers/pcmcia/yenta_socket.c Arnd Bergmann 2023-02-27 2820
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [RFC 3/6] yenta_socket: copy pccard core code into driver
In reply to Arnd Bergmann[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Arnd,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus soc/for-next linus/master v6.2 next-20230227] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/pccard-remove-bcm63xx-socket-driver/20230227-213913 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next patch link: https://lore.kernel.org/r/20230227133457.431729-4-arnd%40kernel.org patch subject: [RFC 3/6] yenta_socket: copy pccard core code into driver config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230228/[email protected]/config) compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/34b7367024292e3954b6dcb4f1e126ed0da3f7c1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arnd-Bergmann/pccard-remove-bcm63xx-socket-driver/20230227-213913 git checkout 34b7367024292e3954b6dcb4f1e126ed0da3f7c1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/pcmcia/yenta_socket.c:1328:5: warning: no previous prototype for 'pcmcia_reset_card' [-Wmissing-prototypes]
1328 | int pcmcia_reset_card(struct pcmcia_socket *skt)
| ^~~~~~~~~~~~~~~~~
--
>> drivers/pcmcia/yenta_socket.c:3576: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst* EnE specific part. EnE bridges are register compatible with TI bridges but
vim +/pcmcia_reset_card +1328 drivers/pcmcia/yenta_socket.c
1321
1322
1323 /* I'm not sure which "reset" function this is supposed to use,
1324 * but for now, it uses the low-level interface's reset, not the
1325 * CIS register.
1326 */
1327
> 1328 int pcmcia_reset_card(struct pcmcia_socket *skt)
1329 {
1330 int ret;
1331
1332 dev_dbg(&skt->dev, "resetting socket\n");
1333
1334 mutex_lock(&skt->skt_mutex);
1335 do {
1336 if (!(skt->state & SOCKET_PRESENT)) {
1337 dev_dbg(&skt->dev, "can't reset, not present\n");
1338 ret = -ENODEV;
1339 break;
1340 }
1341 if (skt->state & SOCKET_SUSPEND) {
1342 dev_dbg(&skt->dev, "can't reset, suspended\n");
1343 ret = -EBUSY;
1344 break;
1345 }
1346 if (skt->state & SOCKET_CARDBUS) {
1347 dev_dbg(&skt->dev, "can't reset, is cardbus\n");
1348 ret = -EPERM;
1349 break;
1350 }
1351
1352 if (skt->callback)
1353 skt->callback->suspend(skt);
1354 mutex_lock(&skt->ops_mutex);
1355 ret = socket_reset(skt);
1356 mutex_unlock(&skt->ops_mutex);
1357 if ((ret == 0) && (skt->callback))
1358 skt->callback->resume(skt);
1359
1360 ret = 0;
1361 } while (0);
1362 mutex_unlock(&skt->skt_mutex);
1363
1364 return ret;
1365 } /* reset_card */
1366 EXPORT_SYMBOL(pcmcia_reset_card);
1367
1368
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Hello Arnd,
Quoted 1 line · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
(..)
Quoted 4 lines
The remaining cardbus/yenta support is essentially a PCI hotplug driver with a slightly unusual sysfs interface, and it would still support all 32-bit cardbus hosts and cards, but no longer work with the even older 16-bit cards that require the
pcmcia_driverinfrastructure.
I'm using a 2005 Samsung X20 laptop (Pentium M 1.6GHz, Centrino) with PCMCIA (type 2) CAN bus cards:
- EMS PCMCIA
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/sja1000/ems_pcmcia.c
- PEAK PCCard
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/sja1000/peak_pcmcia.c
As I still maintain the EMS PCMCIA and had to tweak and test a patch recently (with a 5.16-rc2 kernel):
I assume these CAN bus PCMCIA interfaces won't work after your patch set, right?
Here is the dmesg output of the PCMCIA driver and the CAN drivers from the 5.16-rc2 kernel:
[ 17.167938] yenta_cardbus 0000:02:09.0: CardBus bridge found [144d:c01a] [ 17.304252] yenta_cardbus 0000:02:09.0: ISA IRQ mask 0x0cb8, PCI irq 16 [ 17.304266] yenta_cardbus 0000:02:09.0: Socket status: 30000006 [ 17.304275] yenta_cardbus 0000:02:09.0: pcmcia: parent PCI bridge window: [io 0x4000-0x4fff] [ 17.304282] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x4000-0x4fff: [ 17.305582] excluding 0x4000-0x40ff 0x4400-0x44ff [ 17.318112] yenta_cardbus 0000:02:09.0: pcmcia: parent PCI bridge window: [mem 0xb8000000-0xb80fffff] [ 17.318122] pcmcia_socket pcmcia_socket0: cs: memory probe 0xb8000000-0xb80fffff: [ 17.318129] excluding 0xb8000000-0xb801ffff [ 18.481675] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3af: [ 18.482680] excluding 0x170-0x177 0x1f0-0x1f7 0x370-0x377 [ 18.483428] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x3e0-0x4ff: [ 18.484196] excluding 0x3f0-0x3f7 0x4d0-0x4d7 [ 18.484570] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x820-0x8ff: [ 18.485149] clean [ 18.485178] pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcf7: [ 18.485818] clean [ 18.485856] pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0fffff: [ 18.485863] excluding 0xc0000-0xc7fff 0xd8000-0xfffff [ 18.485908] pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: [ 18.485929] clean [ 18.485958] pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: [ 18.485972] excluding 0x60000000-0x60ffffff [ 18.486005] pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: [ 18.486663] clean
(..)
[ 176.999473] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 [ 176.999489] pcmcia_socket pcmcia_socket0: cs: memory probe 0xb8020000-0xb80fffff: [ 177.009792] clean [ 177.010039] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 3) [ 177.119671] CAN device driver interface [ 177.140214] sja1000 CAN netdevice driver [ 177.204920] ems_pcmcia: registered can0 on channel #0 at 0xbd4852ee, irq 3 [ 177.212167] ems_pcmcia: registered can1 on channel #1 at 0x081f55b8, irq 3 [ 1003.014730] pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0 [ 1003.014801] ems_pcmcia: removing can0 on channel #0 [ 1003.027520] ems_pcmcia: removing can1 on channel #1 [ 1019.943489] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 [ 1019.943715] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 3) [ 1020.035605] peak_pcmcia 0.0: PEAK-System pcmcia card PC_CAN_CARD fw 1.5 [ 1020.039539] peak_pcmcia 0.0: can0 on channel 0 at 0x55749494 irq 3 [ 1020.045816] peak_pcmcia 0.0: can1 on channel 1 at 0x415066ba irq 3
Best regards,
Oliver
Quoted 100 lines
I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Support for device drivers is somewhat less clear. Losing support for 16-bit cards in cardbus sockets is obviously a limiting factor for anyone who still has those cards, but there is also a good chance that the only reason to keep the cards around is for using them in pre-cardbus machines that cannot be upgrade to 32-bit devices.
Completely removing the 16-bit PCMCIA support would however break some 20+ year old embedded machines that rely on CompactFlash cards as their mass-storage device (extension), this notably includes early PocketPC models and the reference implementations for OMAP1, StrongARM1100, Alchemy and PA-Semi. All of these are still maintained, though most of the PocketPC machines got removed in the 6.3 merge window and the PA-Semi Electra board is the only one that was introduced after 2003.
The approach that I take in this series is to split
drivers/pcmciainto two mutually incompatible parts: the Cardbus support contains all the code that is relevant for post-1997 laptops and gets moved todrivers/pci/hotplug, while thedrivers/pcmcia/subsystem is retained for both the older laptops and the embedded systems but no longer works with the yenta socket host driver. The BCM63xx PCMCIA/Cardbus host driver appears to be unused and conflicts with this series, so it is removed in the process.My series does not touch any of the
pcmcia_driverinstances, but if there is consensus about splitting out the cardbus support, a lot of them can probably get removed as a follow-up.[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/Cc Bjorn Helgaas <[email protected]>Cc Dominik Brodowski <[email protected]>Cc Florian Fainelli <[email protected]>Cc H Hartley Sweeten <[email protected]>Cc Ian Abbott <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Kevin Cernekee <[email protected]>Cc Lukas Wunner <[email protected]>Cc Manuel Lauss <[email protected]>Cc Oliver Hartkopp <[email protected]>Cc Olof Johansson <[email protected]>Cc Robert Jarzmik <[email protected]>Cc YOKOTA Hiroshi <[email protected]>Arnd Bergmann (6):
pccard: remove bcm63xx socket driver
pccard: split cardbus support from pcmcia
yenta_socket: copy pccard core code into driver
yenta_socket: remove dead code
pccard: drop remnants of cardbus support
pci: hotplug: move cardbus code fromdrivers/pcmciaarch/mips/bcm63xx/Makefile | 2 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 14 - arch/mips/bcm63xx/dev-pcmcia.c | 144 - arch/mips/configs/bcm63xx_defconfig | 1 - .../asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h | 14 - arch/mips/pci/ops-bcm63xx.c | 294 -- arch/mips/pci/pci-bcm63xx.c | 44 - drivers/Makefile | 2 +- drivers/pci/hotplug/Kconfig | 56 + drivers/pci/hotplug/Makefile | 1 + drivers/pci/hotplug/yenta_socket.c | 4056 +++++++++++++++++ drivers/pcmcia/Kconfig | 63 +- drivers/pcmcia/Makefile | 13 +- drivers/pcmcia/bcm63xx_pcmcia.c | 538 --- drivers/pcmcia/bcm63xx_pcmcia.h | 61 - drivers/pcmcia/cardbus.c | 124 - drivers/pcmcia/cistpl.c | 10 +- drivers/pcmcia/cs.c | 103 +- drivers/pcmcia/cs_internal.h | 10 +- drivers/pcmcia/ds.c | 14 +- drivers/pcmcia/i82092.c | 2 +- drivers/pcmcia/i82365.c | 2 +- drivers/pcmcia/o2micro.h | 183 - drivers/pcmcia/pd6729.c | 3 +- drivers/pcmcia/ricoh.h | 169 - drivers/pcmcia/socket_sysfs.c | 2 - drivers/pcmcia/ti113x.h | 978 ---- drivers/pcmcia/topic.h | 168 - drivers/pcmcia/yenta_socket.c | 1455 ------ drivers/pcmcia/yenta_socket.h | 136 - {drivers => include}/pcmcia/i82365.h | 0 include/pcmcia/ss.h | 21 - 32 files changed, 4147 insertions(+), 4536 deletions(-)
Quoted 13 lines
delete mode 100644
arch/mips/bcm63xx/dev-pcmcia.c
delete mode 100644arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.hcreate mode 100644drivers/pci/hotplug/yenta_socket.c
delete mode 100644drivers/pcmcia/bcm63xx_pcmcia.c
delete mode 100644drivers/pcmcia/bcm63xx_pcmcia.h
delete mode 100644drivers/pcmcia/cardbus.c
delete mode 100644drivers/pcmcia/o2micro.h
delete mode 100644drivers/pcmcia/ti113x.h
delete mode 100644drivers/pcmcia/topic.h
delete mode 100644drivers/pcmcia/yenta_socket.c
delete mode 100644drivers/pcmcia/yenta_socket.h
rename {drivers =>include}/pcmcia/i82365.h(100%)
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 21 lines · Oliver Hartkopp
Hello Arnd,
Quoted 1 line · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
(..)
Quoted 4 lines
The remaining cardbus/yenta support is essentially a PCI hotplug driver with a slightly unusual sysfs interface, and it would still support all 32-bit cardbus hosts and cards, but no longer work with the even older 16-bit cards that require the
pcmcia_driverinfrastructure.I'm using a 2005 Samsung X20 laptop (Pentium M 1.6GHz, Centrino) with PCMCIA (type 2) CAN bus cards:
- EMS PCMCIA
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/sja1000/ems_pcmcia.c- PEAK PCCard
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/sja1000/peak_pcmcia.c
Quoted 7 lines
As I still maintain the EMS PCMCIA and had to tweak and test a patch recently (with a 5.16-rc2 kernel):
I assume these CAN bus PCMCIA interfaces won't work after your patch set, right?
Correct, the patch series in its current form breaks this since your laptop is cardbus compatible. The options I can see are:
- abandon my series and keep everything unchanged, possibly removing some of the pcmcia drivers that Dominik identified as candidates
- decide on a future timeline for when you are comfortable with discontinuing this setup and require any CAN users with cardbus laptops to move to USB or cardbus CAN adapters, apply the series then
- duplicate the yenta_socket driver to have two variants of that, require the user to choose between the cardbus and the pcmcia variant depending on what card is going to be used.
Can you give more background on who is using the EMS PCMCIA card? I.e. are there reasons to use this device on modern kernels with machines that could also support the USB, expresscard or cardbus variants, or are you likely the only one doing this for the purpose of maintaining the driver?
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 4 lines · Arnd Bergmann
I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Am I understanding that the argument you're putting forward here is "cardbus started in year X, so from year X we can ignore 16-bit PCMCIA support" ?
Given that PCMCIA support has been present in x86 hardware at least up to 2010, I don't see how that is any basis for making a decision about 16-bit PCMCIA support.
Isn't the relevant factor here whether 16-bit PCMCIA cards are still in use on hardware that can run a modern distro? (And yes, x86 machines that have 16-bit PCMCIA can still run Debian Stable today.)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 41 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Based on some recent discussions [1][2][3], I experimented wtih what
drivers/pcmciawould look like if we completely removed 16-bit support, which was one of the options that Dominik suggested for winding down pcmcia maintenance.The remaining cardbus/yenta support is essentially a PCI hotplug driver with a slightly unusual sysfs interface, and it would still support all 32-bit cardbus hosts and cards, but no longer work with the even older 16-bit cards that require the
pcmcia_driverinfrastructure.I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Support for device drivers is somewhat less clear. Losing support for 16-bit cards in cardbus sockets is obviously a limiting factor for anyone who still has those cards, but there is also a good chance that the only reason to keep the cards around is for using them in pre-cardbus machines that cannot be upgrade to 32-bit devices.
Completely removing the 16-bit PCMCIA support would however break some 20+ year old embedded machines that rely on CompactFlash cards as their mass-storage device (extension), this notably includes early PocketPC models and the reference implementations for OMAP1, StrongARM1100, Alchemy and PA-Semi. All of these are still maintained, though most of the PocketPC machines got removed in the 6.3 merge window and the PA-Semi Electra board is the only one that was introduced after 2003.
The approach that I take in this series is to split
drivers/pcmciainto two mutually incompatible parts: the Cardbus support contains all the code that is relevant for post-1997 laptops and gets moved todrivers/pci/hotplug, while thedrivers/pcmcia/subsystem is retained for both the older laptops and the embedded systems but no longer works with the yenta socket host driver. The BCM63xx PCMCIA/Cardbus host driver appears to be unused and conflicts with this series, so it is removed in the process.
Quoted 3 lines
My series does not touch any of the
pcmcia_driverinstances, but if there is consensus about splitting out the cardbus support, a lot of them can probably get removed as a follow-up.
Arnd,
Your patch set also breaks my PowerBook G4. The output of 'lspci -nn | grep Network' shows the following before your patch is applied:
0001:10:12.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4306 802.11b/g Wireless LAN Controller [14e4:4320] (rev 03) 0001:11:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller [14e4:4318] (rev 02)
The first of these is broken and built into the laptop. The second is plugged into a PCMCIA slot, and uses yenta-socket as a driver.
When your patches are applied, the second entry vanishes.
Yes, this hardware is ancient, but I would prefer having this wifi interface work. I can provide any output you need.
Larry
Quoted 20 lines · Arnd Bergmann
Quoted 2 lines · Oliver Hartkopp
I assume these CAN bus PCMCIA interfaces won't work after your patch set, right?
Correct, the patch series in its current form breaks this since your laptop is cardbus compatible. The options I can see are:
- abandon my series and keep everything unchanged, possibly removing some of the pcmcia drivers that Dominik identified as candidates
- decide on a future timeline for when you are comfortable with discontinuing this setup and require any CAN users with cardbus laptops to move to USB or cardbus CAN adapters, apply the series then
- duplicate the
yenta_socketdriver to have two variants of that, require the user to choose between the cardbus and the pcmcia variant depending on what card is going to be used.
Quoted 5 lines
Can you give more background on who is using the EMS PCMCIA card? I.e. are there reasons to use this device on modern kernels with machines that could also support the USB, expresscard or cardbus variants, or are you likely the only one doing this for the purpose of maintaining the driver?
Haha, good point.
In fact the EMS PCMCIA, the PEAK PCMCIA (PCAN PC Card) and the supported Softing PCMCIA cards are nearly 20 year old designs and they are all discontinued for some time now. Today you can easily get a high performance Classical CAN USB adapter with an excellent OSS firmware for ~13 EUR.
The only other laptop CAN "Cards" I'm aware of are PCIe "ExpressCard" 34/54 from PEAK System which use the PCI subsystem.
Maybe you are right and we should simply drop the support for those old PCMCIA drivers which will still be supported for the LTS 6.1 lifetime then.
@Marc Kleine-Budde: What do you think about removing these three drivers?
Best regards,
Oliver
Quoted 11 lines · Larry Finger
On 2/27/23 07:34, Arnd Bergmann wrote:
Your patch set also breaks my PowerBook G4. The output of 'lspci -nn | grep Network' shows the following before your patch is applied:
0001:10:12.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4306 802.11b/g Wireless LAN Controller [14e4:4320] (rev 03) 0001:11:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller [14e4:4318] (rev 02)
Quoted 7 lines
The first of these is broken and built into the laptop. The second is plugged into a PCMCIA slot, and uses yenta-socket as a driver.
When your patches are applied, the second entry vanishes.
Yes, this hardware is ancient, but I would prefer having this wifi interface work. I can provide any output you need.
Is this the Cardbus or the PCMCIA version of the BCM4306 device? As far as I understand this particular chip can be wired up either way inside of the card, and the PowerBook G4 supports both types of devices.
If it's the PCMCIA version, then dropping support for it was the idea of the patch series that we can debate, but if it was the Cardbus version that broke, then this was likely a bug I introduced by accident.
Arnd
Marc Kleine-Budde
maintainerQuoted 34 lines · Oliver Hartkopp
Quoted 20 lines · Arnd Bergmann
Quoted 2 lines · Oliver Hartkopp
I assume these CAN bus PCMCIA interfaces won't work after your patch set, right?
Correct, the patch series in its current form breaks this since your laptop is cardbus compatible. The options I can see are:
- abandon my series and keep everything unchanged, possibly removing some of the pcmcia drivers that Dominik identified as candidates
- decide on a future timeline for when you are comfortable with discontinuing this setup and require any CAN users with cardbus laptops to move to USB or cardbus CAN adapters, apply the series then
- duplicate the
yenta_socketdriver to have two variants of that, require the user to choose between the cardbus and the pcmcia variant depending on what card is going to be used.Quoted 5 lines
Can you give more background on who is using the EMS PCMCIA card? I.e. are there reasons to use this device on modern kernels with machines that could also support the USB, expresscard or cardbus variants, or are you likely the only one doing this for the purpose of maintaining the driver?
Haha, good point.
In fact the EMS PCMCIA, the PEAK PCMCIA (PCAN PC Card) and the supported Softing PCMCIA cards are nearly 20 year old designs and they are all discontinued for some time now. Today you can easily get a high performance Classical CAN USB adapter with an excellent OSS firmware for ~13 EUR.
Quoted 7 lines
The only other laptop CAN "Cards" I'm aware of are PCIe "ExpressCard" 34/54 from PEAK System which use the PCI subsystem.
Maybe you are right and we should simply drop the support for those old PCMCIA drivers which will still be supported for the LTS 6.1 lifetime then.
@Marc Kleine-Budde: What do you think about removing these three drivers?
I don't have any of these cards, nor any $CUSTOMER who's using it.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 20 lines · Arnd Bergmann
Quoted 11 lines · Larry Finger
On 2/27/23 07:34, Arnd Bergmann wrote:
Your patch set also breaks my PowerBook G4. The output of 'lspci -nn | grep Network' shows the following before your patch is applied:
0001:10:12.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4306 802.11b/g Wireless LAN Controller [14e4:4320] (rev 03) 0001:11:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller [14e4:4318] (rev 02)
Quoted 7 lines
The first of these is broken and built into the laptop. The second is plugged into a PCMCIA slot, and uses yenta-socket as a driver.
When your patches are applied, the second entry vanishes.
Yes, this hardware is ancient, but I would prefer having this wifi interface work. I can provide any output you need.
Quoted 7 lines
Is this the Cardbus or the PCMCIA version of the BCM4306 device? As far as I understand this particular chip can be wired up either way inside of the card, and the PowerBook G4 supports both types of devices.
If it's the PCMCIA version, then dropping support for it was the idea of the patch series that we can debate, but if it was the Cardbus version that broke, then this was likely a bug I introduced by accident.
If it shows up as a PCI device, it will be cardbus, not 16-bit ISA.
PCMCIA cards don't show up in lspci.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 9 lines · Russell King (Oracle)
Quoted 4 lines · Arnd Bergmann
I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Am I understanding that the argument you're putting forward here is "cardbus started in year X, so from year X we can ignore 16-bit PCMCIA support" ?
Right, but I'm asking this as a question, hence the 'RFC' in the subject.
Quoted 3 lines
Given that PCMCIA support has been present in x86 hardware at least up to 2010, I don't see how that is any basis for making a decision about 16-bit PCMCIA support.
I assume you mean machines with Cardbus slots that can use 16-bit PCMCIA slots, rather than laptops with only PCMCIA here, right?
Quoted 3 lines
Isn't the relevant factor here whether 16-bit PCMCIA cards are still in use on hardware that can run a modern distro? (And yes, x86 machines that have 16-bit PCMCIA can still run Debian Stable today.)
There are three combinations that are supported at the moment:
1. Machines with only 16-bit PCMCIA support, all very old, which rely on these slots for basic functionality.
2. Machines that support Cardbus slots that are actually used to connect 16-bit cards.
3. Machines that have a Cardbus slot and can just use 32-bit cards for whatever they need.
Dominik originally raised the question whether we could kill off all PCMCIA support already given its age, which would either break all three of the above or at least the first two if Yenta-socket is kept as a PCI hotplug driver.
I wanted to make sure that we keep both case 1) for sa1100/omap1/pxa and case 3) for x86, while case 2) seems much less important because there are presumably fewer users than 3), and they have an upgrade path that only involves replacing one cheap card instead of trashing the whole machine.
Arnd
Quoted 7 lines · Arnd Bergmann
Is this the Cardbus or the PCMCIA version of the BCM4306 device? As far as I understand this particular chip can be wired up either way inside of the card, and the PowerBook G4 supports both types of devices.
If it's the PCMCIA version, then dropping support for it was the idea of the patch series that we can debate, but if it was the Cardbus version that broke, then this was likely a bug I introduced by accident.
Arnd,
The BCM4306 is internal, and wired directly to the PCI bus. My understanding is that the BCM4318 is a cardbus device. It definitely shows up in an lspci scan.
Larry
Quoted 11 lines · Larry Finger
Quoted 7 lines · Arnd Bergmann
Is this the Cardbus or the PCMCIA version of the BCM4306 device? As far as I understand this particular chip can be wired up either way inside of the card, and the PowerBook G4 supports both types of devices.
If it's the PCMCIA version, then dropping support for it was the idea of the patch series that we can debate, but if it was the Cardbus version that broke, then this was likely a bug I introduced by accident.
The BCM4306 is internal, and wired directly to the PCI bus. My understanding is that the BCM4318 is a cardbus device. It definitely shows up in an lspci scan.
Ah right, I got confused because I had googled for BCM4306 for too long trying to find out whether that might be used in combination with the BCM63xx SoC support that patch 1 removed.
BCM4318 should definitely keep working after my series. My best guess is that the problem is that I introduced an unnecessary dependency between CONFIG_CARDBUS and CONFIG_PCI_HOTPLUG, so you'd need to either undo the dependency or enable both in the local config.
If it's not that, then it's a bug in my changes that needs to be fixed before they can be considered for integration. As long as we are still debating whether the series makes sense at all, I'm not worried about this.
Arnd
Re: [RFC 1/6] pccard: remove bcm63xx socket driver
In reply to Arnd Bergmann+Maxime,
Quoted 18 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The bcm63xx pcmcia driver is the only nonstandard cardbus implementation, everything else is handled by the
yenta_socketdriver. Upon a closer look, this seems entirely unused, because:- There are two ports for bcm63xx in
arch/mips, both of which support the bcm6358 hardware, but the newer one does not use this driver at all.- The only distro I could find for bcm63xx is OpenWRT, but they do not enable pcmcia support. However they have 130 patches, a lot of which are likely required to run anything at all.
- The device list at https://deviwiki.com/wiki/Broadcom only lists machines using mini-PCI cards rather than PCMCIA or Cardbus devices.
Quoted 6 lines
- The cardbus support is entirely made up to work with the kernel subsystem, but the hardware appears to just be a normal PCI host that should work fine after removing all the cardbus code.
Signed-off-by Arnd Bergmann <[email protected]>
This is probably fine because PCMCIA on BCM63xx was only needed for the very old and early devices like the 6348 which modern kernels are unlikely to be able to run on since they are usually RAM constrained with 16MB or 32MB of DRAM populated. Maxime, do you care if this driver gets removed?
Signature · 1 line
Florian
Quoted 22 lines · Arnd Bergmann
Quoted 11 lines · Larry Finger
Quoted 7 lines · Arnd Bergmann
Is this the Cardbus or the PCMCIA version of the BCM4306 device? As far as I understand this particular chip can be wired up either way inside of the card, and the PowerBook G4 supports both types of devices.
If it's the PCMCIA version, then dropping support for it was the idea of the patch series that we can debate, but if it was the Cardbus version that broke, then this was likely a bug I introduced by accident.
The BCM4306 is internal, and wired directly to the PCI bus. My understanding is that the BCM4318 is a cardbus device. It definitely shows up in an lspci scan.
Ah right, I got confused because I had googled for BCM4306 for too long trying to find out whether that might be used in combination with the BCM63xx SoC support that patch 1 removed.
BCM4318 should definitely keep working after my series. My best guess is that the problem is that I introduced an unnecessary dependency between
CONFIG_CARDBUSandCONFIG_PCI_HOTPLUG, so you'd need to either undo the dependency or enable both in the local config.
Quoted 4 lines
If it's not that, then it's a bug in my changes that needs to be fixed before they can be considered for integration. As long as we are still debating whether the series makes sense at all, I'm not worried about this.
Arnd,
It was a configuration problem. In the .config obtained by installing your patches, and doing a make, CONFIG_CARDBUS was not mentioned, and CONFIG_PCI_HOTPLUG was not selected. When I deleted the reference to the latter, did a make, and set ..._HOTPLUG, I got CONFIG+CARDBUS set to "m", and the yenta modules were built. This version sees the BCM4318 in the lspci scan, and the interface works. Your patches are OK.
I am not sure how to warn people about the configuration change possible breaking things.
Larry
Quoted 12 lines · Larry Finger
On 2/27/23 15:30, Arnd Bergmann wrote:
It was a configuration problem. In the .config obtained by installing your
patches, and doing a make,CONFIG_CARDBUSwas not mentioned, andCONFIG_PCI_HOTPLUGwas not selected. When I deleted the reference to the latter,
did a make, and set ..._HOTPLUG, I got CONFIG+CARDBUS set to "m", and the yenta
modules were built. This version sees the BCM4318 in the lspci scan, and the
interface works. Your patches are OK.
Ok, great, thanks for testing!
Quoted 2 lines
I am not sure how to warn people about the configuration change possible breaking things.
My intention was to keep Cardbus support working with old defconfig files, and I've not moved CONFIG_CARDBUS into a separate submenu between CONFIG_PCI_HOTPLUG and CONFIG_PCI_CONTROLLER but left the driver in drivers/pci/hotplug. I think that's the best compromise here, but maybe the PCI maintainers have a better idea.
Arnd
Quoted 17 lines · On Monday 27 February 2023 14:34:51 Arnd Bergmann wrote:
From: Arnd Bergmann <[email protected]>
Based on some recent discussions [1][2][3], I experimented wtih what
drivers/pcmciawould look like if we completely removed 16-bit support, which was one of the options that Dominik suggested for winding down pcmcia maintenance.The remaining cardbus/yenta support is essentially a PCI hotplug driver with a slightly unusual sysfs interface, and it would still support all 32-bit cardbus hosts and cards, but no longer work with the even older 16-bit cards that require the
pcmcia_driverinfrastructure.I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Quoted 5 lines
Support for device drivers is somewhat less clear. Losing support for 16-bit cards in cardbus sockets is obviously a limiting factor for anyone who still has those cards, but there is also a good chance that the only reason to keep the cards around is for using them in pre-cardbus machines that cannot be upgrade to 32-bit devices.
I think that most users are using CardBus controllers, either in laptops (from Pentium MMX up to Core 2, e.g. DELL Latitude E6400) or as PCI (or even PCIe) adapters for desktop machines. Users generally treat all the cards as PCMCIA and don't know that there are two kinds of them (16-bit PCMCIA and 32-bit CardBus).
Quoted 9 lines
Completely removing the 16-bit PCMCIA support would however break some 20+ year old embedded machines that rely on CompactFlash cards as their mass-storage device (extension), this notably includes early PocketPC models and the reference implementations for OMAP1, StrongARM1100, Alchemy and PA-Semi. All of these are still maintained, though most of the PocketPC machines got removed in the 6.3 merge window and the PA-Semi Electra board is the only one that was introduced after 2003.
Quoted 8 lines
The approach that I take in this series is to split
drivers/pcmciainto two mutually incompatible parts: the Cardbus support contains all the code that is relevant for post-1997 laptops and gets moved todrivers/pci/hotplug, while thedrivers/pcmcia/subsystem is retained for both the older laptops and the embedded systems but no longer works with the yenta socket host driver. The BCM63xx PCMCIA/Cardbus host driver appears to be unused and conflicts with this series, so it is removed in the process.
This is bad. The drivers remain but could not be used by most machines :(
Signature · 1 line
Ondrej Zary
From: Russell King
Quoted 12 lines
Sent: 27 February 2023 20:16
Quoted 4 lines · Arnd Bergmann
I don't expect this to be a problem normal laptop support, as the last PC models that predate Cardbus support (e.g. 1997 ThinkPad 380ED) are all limited to i586MMX CPUs and 80MB of RAM. This is barely enough to boot Tiny Core Linux but not a regular distro.
Am I understanding that the argument you're putting forward here is "cardbus started in year X, so from year X we can ignore 16-bit PCMCIA support" ?
Quoted 7 lines
Given that PCMCIA support has been present in x86 hardware at least up to 2010, I don't see how that is any basis for making a decision about 16-bit PCMCIA support.
Isn't the relevant factor here whether 16-bit PCMCIA cards are still in use on hardware that can run a modern distro? (And yes, x86 machines that have 16-bit PCMCIA can still run Debian Stable today.)
Or, more specifically, are any people using 16-bit PCMCIA cards in cardbus-capable sockets with a current kernel. They might be using unusual cards that aren't available as cardbus - perhaps 56k modems (does anyone still use those?).
I'm pretty sure I've used sparc systems that had slots that would take both pcmcia and cardbus cards.
Would have been 20 years ago - but they were 64MHz PCI so wouldn't have been that slow (I can't remember which cpu it was). They ran Solaris, but weren't made by Sun.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
From: David Laight
Quoted 1 line
Sent: 28 February 2023 22:45
...
Quoted 4 lines
Or, more specifically, are any people using 16-bit PCMCIA cards in cardbus-capable sockets with a current kernel. They might be using unusual cards that aren't available as cardbus - perhaps 56k modems (does anyone still use those?).
Or, what I now remember we were doing:
Copying images to linear pcmcia sram cards to access from an embedded system that only supported pcmcia.
(Which means the sparc systems supported both cardbus and pcmcia.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 5 lines · Arnd Bergmann
My intention was to keep Cardbus support working with old defconfig files, and I've not moved
CONFIG_CARDBUSinto a separate submenu betweenCONFIG_PCI_HOTPLUGandCONFIG_PCI_CONTROLLERbut left the driver indrivers/pci/hotplug. I think that's the best compromise here, but maybe the PCI maintainers have a better idea.
Arnd,
I did a bit more investigation. My original .config had CONFIG_PCI_HOTPLUG not defined, but did have CONFIG_CARDBUS and the various yenta modules turned on. With your changes, the CONFIG_PCI_HOTPLUG overrode CARDBUS.
I thought mine was a corner case, but now I am not sure. As stated above, the Debian 12 factory configuration for ppc32 does not turn on PCI hotplug, but the x86_64 configuration for openSUSE Tumbleweed does. The x86_64 configuration in Fedora 37 does not contain CONFIG_PCI_HOTPLUG, but does have CARDBUS set.
It seems that several distros may get the wrong result with this change,
Larry
Quoted 11 lines · Larry Finger
Quoted 5 lines · Arnd Bergmann
My intention was to keep Cardbus support working with old defconfig files, and I've not moved
CONFIG_CARDBUSinto a separate submenu betweenCONFIG_PCI_HOTPLUGandCONFIG_PCI_CONTROLLERbut left the driver indrivers/pci/hotplug. I think that's the best compromise here, but maybe the PCI maintainers have a better idea.I did a bit more investigation. My original .config had
CONFIG_PCI_HOTPLUGnot defined, but did haveCONFIG_CARDBUSand the various yenta modules turned on. With your changes, theCONFIG_PCI_HOTPLUGoverrode CARDBUS.
Quoted 6 lines
I thought mine was a corner case, but now I am not sure. As stated above, the Debian 12 factory configuration for ppc32 does not turn on PCI hotplug, but the
x86_64configuration for openSUSE Tumbleweed does. Thex86_64configuration in Fedora 37 does not containCONFIG_PCI_HOTPLUG, but does have CARDBUS set.It seems that several distros may get the wrong result with this change,
As far as I can tell, this should work with the changes I described above, since CONFIG_CARDBUS no longer depends on CONFIG_PCI_HOTPLUG. I now uploaded the changed version to
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=pccard-rework-2
Arnd
Re: [RFC 1/6] pccard: remove bcm63xx socket driver
In reply to Florian FainelliOn Mon, 2023-02-27 at 13:33 -0800, Florian Fainelli wrote:
Hello Florian,
Quoted 5 lines
This is probably fine because PCMCIA on BCM63xx was only needed for the very old and early devices like the 6348 which modern kernels are unlikely to be able to run on since they are usually RAM constrained with 16MB or 32MB of DRAM populated. Maxime, do you care if this driver gets removed?
Not at all, thanks for asking.
Signature · 1 line
Maxime