linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/6] pcmcia: separate 16-bit support from cardbus
@ 2023-02-27 13:34 Arnd Bergmann
  2023-02-27 13:34 ` [RFC 1/6] pccard: remove bcm63xx socket driver Arnd Bergmann
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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/Y07d7rMvd5++85BJ@owl.dominikbrodowski.net/
[2] https://lore.kernel.org/all/c5b39544-a4fb-4796-a046-0b9be9853787@app.fastmail.com/
[3] https://lore.kernel.org/all/20230222092302.6348-1-jirislaby@kernel.org/

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Olof Johansson <olof@lixom.net>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-can@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org

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%)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [RFC 1/6] pccard: remove bcm63xx socket driver
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
@ 2023-02-27 13:34 ` Arnd Bergmann
  2023-02-27 21:33   ` Florian Fainelli
  2023-02-27 13:34 ` [RFC 2/6] pccard: split cardbus support from pcmcia Arnd Bergmann
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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

diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index d89651e538f6..fccaeeee757d 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -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
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 01aff80a5967..d88d3043a288 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -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);
diff --git a/arch/mips/bcm63xx/dev-pcmcia.c b/arch/mips/bcm63xx/dev-pcmcia.c
deleted file mode 100644
index 9496cd236951..000000000000
--- a/arch/mips/bcm63xx/dev-pcmcia.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <asm/bootinfo.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_cs.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_dev_pcmcia.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-
-static struct resource pcmcia_resources[] = {
-	/* pcmcia registers */
-	{
-		/* start & end filled at runtime */
-		.flags		= IORESOURCE_MEM,
-	},
-
-	/* pcmcia memory zone resources */
-	{
-		.start		= BCM_PCMCIA_COMMON_BASE_PA,
-		.end		= BCM_PCMCIA_COMMON_END_PA,
-		.flags		= IORESOURCE_MEM,
-	},
-	{
-		.start		= BCM_PCMCIA_ATTR_BASE_PA,
-		.end		= BCM_PCMCIA_ATTR_END_PA,
-		.flags		= IORESOURCE_MEM,
-	},
-	{
-		.start		= BCM_PCMCIA_IO_BASE_PA,
-		.end		= BCM_PCMCIA_IO_END_PA,
-		.flags		= IORESOURCE_MEM,
-	},
-
-	/* PCMCIA irq */
-	{
-		/* start filled at runtime */
-		.flags		= IORESOURCE_IRQ,
-	},
-
-	/* declare PCMCIA IO resource also */
-	{
-		.start		= BCM_PCMCIA_IO_BASE_PA,
-		.end		= BCM_PCMCIA_IO_END_PA,
-		.flags		= IORESOURCE_IO,
-	},
-};
-
-static struct bcm63xx_pcmcia_platform_data pd;
-
-static struct platform_device bcm63xx_pcmcia_device = {
-	.name		= "bcm63xx_pcmcia",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(pcmcia_resources),
-	.resource	= pcmcia_resources,
-	.dev		= {
-		.platform_data = &pd,
-	},
-};
-
-static int __init config_pcmcia_cs(unsigned int cs,
-				   u32 base, unsigned int size)
-{
-	int ret;
-
-	ret = bcm63xx_set_cs_status(cs, 0);
-	if (!ret)
-		ret = bcm63xx_set_cs_base(cs, base, size);
-	if (!ret)
-		ret = bcm63xx_set_cs_status(cs, 1);
-	return ret;
-}
-
-static const struct {
-	unsigned int	cs;
-	unsigned int	base;
-	unsigned int	size;
-} pcmcia_cs[3] __initconst = {
-	{
-		.cs	= MPI_CS_PCMCIA_COMMON,
-		.base	= BCM_PCMCIA_COMMON_BASE_PA,
-		.size	= BCM_PCMCIA_COMMON_SIZE
-	},
-	{
-		.cs	= MPI_CS_PCMCIA_ATTR,
-		.base	= BCM_PCMCIA_ATTR_BASE_PA,
-		.size	= BCM_PCMCIA_ATTR_SIZE
-	},
-	{
-		.cs	= MPI_CS_PCMCIA_IO,
-		.base	= BCM_PCMCIA_IO_BASE_PA,
-		.size	= BCM_PCMCIA_IO_SIZE
-	},
-};
-
-int __init bcm63xx_pcmcia_register(void)
-{
-	int ret, i;
-
-	if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358())
-		return 0;
-
-	/* use correct pcmcia ready gpio depending on processor */
-	switch (bcm63xx_get_cpu_id()) {
-	case BCM6348_CPU_ID:
-		pd.ready_gpio = 22;
-		break;
-
-	case BCM6358_CPU_ID:
-		pd.ready_gpio = 18;
-		break;
-
-	default:
-		return -ENODEV;
-	}
-
-	pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
-	pcmcia_resources[0].end = pcmcia_resources[0].start +
-		RSET_PCMCIA_SIZE - 1;
-	pcmcia_resources[4].start = bcm63xx_get_irq_number(IRQ_PCMCIA);
-
-	/* configure pcmcia chip selects */
-	for (i = 0; i < 3; i++) {
-		ret = config_pcmcia_cs(pcmcia_cs[i].cs,
-				       pcmcia_cs[i].base,
-				       pcmcia_cs[i].size);
-		if (ret)
-			goto out_err;
-	}
-
-	return platform_device_register(&bcm63xx_pcmcia_device);
-
-out_err:
-	pr_err("unable to set pcmcia chip select\n");
-	return ret;
-}
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index 34d0ca638ef0..d1a185c20f00 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -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
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
deleted file mode 100644
index 01674ac58bb5..000000000000
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
+++ /dev/null
@@ -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_ */
diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c
index dc6dc2741272..4cb6185a9f66 100644
--- a/arch/mips/pci/ops-bcm63xx.c
+++ b/arch/mips/pci/ops-bcm63xx.c
@@ -151,9 +151,6 @@ static int bcm63xx_pci_read(struct pci_bus *bus, unsigned int devfn,
 
 	type = bus->parent ? 1 : 0;
 
-	if (type == 0 && PCI_SLOT(devfn) == CARDBUS_PCI_IDSEL)
-		return PCIBIOS_DEVICE_NOT_FOUND;
-
 	return bcm63xx_do_cfg_read(type, bus->number, devfn,
 				    where, size, val);
 }
@@ -165,9 +162,6 @@ static int bcm63xx_pci_write(struct pci_bus *bus, unsigned int devfn,
 
 	type = bus->parent ? 1 : 0;
 
-	if (type == 0 && PCI_SLOT(devfn) == CARDBUS_PCI_IDSEL)
-		return PCIBIOS_DEVICE_NOT_FOUND;
-
 	return bcm63xx_do_cfg_write(type, bus->number, devfn,
 				     where, size, val);
 }
@@ -177,294 +171,6 @@ struct pci_ops bcm63xx_pci_ops = {
 	.write	= bcm63xx_pci_write
 };
 
-#ifdef CONFIG_CARDBUS
-/*
- * emulate configuration read access on a cardbus bridge
- */
-#define FAKE_CB_BRIDGE_SLOT	0x1e
-
-static int fake_cb_bridge_bus_number = -1;
-
-static struct {
-	u16 pci_command;
-	u8 cb_latency;
-	u8 subordinate_busn;
-	u8 cardbus_busn;
-	u8 pci_busn;
-	int bus_assigned;
-	u16 bridge_control;
-
-	u32 mem_base0;
-	u32 mem_limit0;
-	u32 mem_base1;
-	u32 mem_limit1;
-
-	u32 io_base0;
-	u32 io_limit0;
-	u32 io_base1;
-	u32 io_limit1;
-} fake_cb_bridge_regs;
-
-static int fake_cb_bridge_read(int where, int size, u32 *val)
-{
-	unsigned int reg;
-	u32 data;
-
-	data = 0;
-	reg = where >> 2;
-	switch (reg) {
-	case (PCI_VENDOR_ID >> 2):
-	case (PCI_CB_SUBSYSTEM_VENDOR_ID >> 2):
-		/* create dummy vendor/device id from our cpu id */
-		data = (bcm63xx_get_cpu_id() << 16) | PCI_VENDOR_ID_BROADCOM;
-		break;
-
-	case (PCI_COMMAND >> 2):
-		data = (PCI_STATUS_DEVSEL_SLOW << 16);
-		data |= fake_cb_bridge_regs.pci_command;
-		break;
-
-	case (PCI_CLASS_REVISION >> 2):
-		data = (PCI_CLASS_BRIDGE_CARDBUS << 16);
-		break;
-
-	case (PCI_CACHE_LINE_SIZE >> 2):
-		data = (PCI_HEADER_TYPE_CARDBUS << 16);
-		break;
-
-	case (PCI_INTERRUPT_LINE >> 2):
-		/* bridge control */
-		data = (fake_cb_bridge_regs.bridge_control << 16);
-		/* pin:intA line:0xff */
-		data |= (0x1 << 8) | 0xff;
-		break;
-
-	case (PCI_CB_PRIMARY_BUS >> 2):
-		data = (fake_cb_bridge_regs.cb_latency << 24);
-		data |= (fake_cb_bridge_regs.subordinate_busn << 16);
-		data |= (fake_cb_bridge_regs.cardbus_busn << 8);
-		data |= fake_cb_bridge_regs.pci_busn;
-		break;
-
-	case (PCI_CB_MEMORY_BASE_0 >> 2):
-		data = fake_cb_bridge_regs.mem_base0;
-		break;
-
-	case (PCI_CB_MEMORY_LIMIT_0 >> 2):
-		data = fake_cb_bridge_regs.mem_limit0;
-		break;
-
-	case (PCI_CB_MEMORY_BASE_1 >> 2):
-		data = fake_cb_bridge_regs.mem_base1;
-		break;
-
-	case (PCI_CB_MEMORY_LIMIT_1 >> 2):
-		data = fake_cb_bridge_regs.mem_limit1;
-		break;
-
-	case (PCI_CB_IO_BASE_0 >> 2):
-		/* | 1 for 32bits io support */
-		data = fake_cb_bridge_regs.io_base0 | 0x1;
-		break;
-
-	case (PCI_CB_IO_LIMIT_0 >> 2):
-		data = fake_cb_bridge_regs.io_limit0;
-		break;
-
-	case (PCI_CB_IO_BASE_1 >> 2):
-		/* | 1 for 32bits io support */
-		data = fake_cb_bridge_regs.io_base1 | 0x1;
-		break;
-
-	case (PCI_CB_IO_LIMIT_1 >> 2):
-		data = fake_cb_bridge_regs.io_limit1;
-		break;
-	}
-
-	*val = postprocess_read(data, where, size);
-	return PCIBIOS_SUCCESSFUL;
-}
-
-/*
- * emulate configuration write access on a cardbus bridge
- */
-static int fake_cb_bridge_write(int where, int size, u32 val)
-{
-	unsigned int reg;
-	u32 data, tmp;
-	int ret;
-
-	ret = fake_cb_bridge_read((where & ~0x3), 4, &data);
-	if (ret != PCIBIOS_SUCCESSFUL)
-		return ret;
-
-	data = preprocess_write(data, val, where, size);
-
-	reg = where >> 2;
-	switch (reg) {
-	case (PCI_COMMAND >> 2):
-		fake_cb_bridge_regs.pci_command = (data & 0xffff);
-		break;
-
-	case (PCI_CB_PRIMARY_BUS >> 2):
-		fake_cb_bridge_regs.cb_latency = (data >> 24) & 0xff;
-		fake_cb_bridge_regs.subordinate_busn = (data >> 16) & 0xff;
-		fake_cb_bridge_regs.cardbus_busn = (data >> 8) & 0xff;
-		fake_cb_bridge_regs.pci_busn = data & 0xff;
-		if (fake_cb_bridge_regs.cardbus_busn)
-			fake_cb_bridge_regs.bus_assigned = 1;
-		break;
-
-	case (PCI_INTERRUPT_LINE >> 2):
-		tmp = (data >> 16) & 0xffff;
-		/* disable memory prefetch support */
-		tmp &= ~PCI_CB_BRIDGE_CTL_PREFETCH_MEM0;
-		tmp &= ~PCI_CB_BRIDGE_CTL_PREFETCH_MEM1;
-		fake_cb_bridge_regs.bridge_control = tmp;
-		break;
-
-	case (PCI_CB_MEMORY_BASE_0 >> 2):
-		fake_cb_bridge_regs.mem_base0 = data;
-		break;
-
-	case (PCI_CB_MEMORY_LIMIT_0 >> 2):
-		fake_cb_bridge_regs.mem_limit0 = data;
-		break;
-
-	case (PCI_CB_MEMORY_BASE_1 >> 2):
-		fake_cb_bridge_regs.mem_base1 = data;
-		break;
-
-	case (PCI_CB_MEMORY_LIMIT_1 >> 2):
-		fake_cb_bridge_regs.mem_limit1 = data;
-		break;
-
-	case (PCI_CB_IO_BASE_0 >> 2):
-		fake_cb_bridge_regs.io_base0 = data;
-		break;
-
-	case (PCI_CB_IO_LIMIT_0 >> 2):
-		fake_cb_bridge_regs.io_limit0 = data;
-		break;
-
-	case (PCI_CB_IO_BASE_1 >> 2):
-		fake_cb_bridge_regs.io_base1 = data;
-		break;
-
-	case (PCI_CB_IO_LIMIT_1 >> 2):
-		fake_cb_bridge_regs.io_limit1 = data;
-		break;
-	}
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int bcm63xx_cb_read(struct pci_bus *bus, unsigned int devfn,
-			   int where, int size, u32 *val)
-{
-	/* snoop access to slot 0x1e on root bus, we fake a cardbus
-	 * bridge at this location */
-	if (!bus->parent && PCI_SLOT(devfn) == FAKE_CB_BRIDGE_SLOT) {
-		fake_cb_bridge_bus_number = bus->number;
-		return fake_cb_bridge_read(where, size, val);
-	}
-
-	/* a  configuration  cycle for	the  device  behind the	 cardbus
-	 * bridge is  actually done as a  type 0 cycle	on the primary
-	 * bus. This means that only  one device can be on the cardbus
-	 * bus */
-	if (fake_cb_bridge_regs.bus_assigned &&
-	    bus->number == fake_cb_bridge_regs.cardbus_busn &&
-	    PCI_SLOT(devfn) == 0)
-		return bcm63xx_do_cfg_read(0, 0,
-					   PCI_DEVFN(CARDBUS_PCI_IDSEL, 0),
-					   where, size, val);
-
-	return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
-static int bcm63xx_cb_write(struct pci_bus *bus, unsigned int devfn,
-			    int where, int size, u32 val)
-{
-	if (!bus->parent && PCI_SLOT(devfn) == FAKE_CB_BRIDGE_SLOT) {
-		fake_cb_bridge_bus_number = bus->number;
-		return fake_cb_bridge_write(where, size, val);
-	}
-
-	if (fake_cb_bridge_regs.bus_assigned &&
-	    bus->number == fake_cb_bridge_regs.cardbus_busn &&
-	    PCI_SLOT(devfn) == 0)
-		return bcm63xx_do_cfg_write(0, 0,
-					    PCI_DEVFN(CARDBUS_PCI_IDSEL, 0),
-					    where, size, val);
-
-	return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
-struct pci_ops bcm63xx_cb_ops = {
-	.read	= bcm63xx_cb_read,
-	.write	 = bcm63xx_cb_write,
-};
-
-/*
- * only one IO window, so it  cannot be shared by PCI and cardbus, use
- * fixup to choose and detect unhandled configuration
- */
-static void bcm63xx_fixup(struct pci_dev *dev)
-{
-	static int io_window = -1;
-	int i, found, new_io_window;
-	u32 val;
-
-	/* look for any io resource */
-	found = 0;
-	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
-		if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
-			found = 1;
-			break;
-		}
-	}
-
-	if (!found)
-		return;
-
-	/* skip our fake bus with only cardbus bridge on it */
-	if (dev->bus->number == fake_cb_bridge_bus_number)
-		return;
-
-	/* find on which bus the device is */
-	if (fake_cb_bridge_regs.bus_assigned &&
-	    dev->bus->number == fake_cb_bridge_regs.cardbus_busn &&
-	    PCI_SLOT(dev->devfn) == 0)
-		new_io_window = 1;
-	else
-		new_io_window = 0;
-
-	if (new_io_window == io_window)
-		return;
-
-	if (io_window != -1) {
-		printk(KERN_ERR "bcm63xx: both PCI and cardbus devices "
-		       "need IO, which hardware cannot do\n");
-		return;
-	}
-
-	printk(KERN_INFO "bcm63xx: PCI IO window assigned to %s\n",
-	       (new_io_window == 0) ? "PCI" : "cardbus");
-
-	val = bcm_mpi_readl(MPI_L2PIOREMAP_REG);
-	if (io_window)
-		val |= MPI_L2PREMAP_IS_CARDBUS_MASK;
-	else
-		val &= ~MPI_L2PREMAP_IS_CARDBUS_MASK;
-	bcm_mpi_writel(val, MPI_L2PIOREMAP_REG);
-
-	io_window = new_io_window;
-}
-
-DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, bcm63xx_fixup);
-#endif
-
 static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn)
 {
 	switch (bus->number) {
diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c
index ac83243772d2..ebe062b149f6 100644
--- a/arch/mips/pci/pci-bcm63xx.c
+++ b/arch/mips/pci/pci-bcm63xx.c
@@ -34,11 +34,7 @@ static struct resource bcm_pci_mem_resource = {
 static struct resource bcm_pci_io_resource = {
 	.name	= "bcm63xx PCI IO space",
 	.start	= BCM_PCI_IO_BASE_PA,
-#ifdef CONFIG_CARDBUS
-	.end	= BCM_PCI_IO_HALF_PA,
-#else
 	.end	= BCM_PCI_IO_END_PA,
-#endif
 	.flags	= IORESOURCE_IO
 };
 
@@ -48,33 +44,6 @@ struct pci_controller bcm63xx_controller = {
 	.mem_resource	= &bcm_pci_mem_resource,
 };
 
-/*
- * We handle cardbus  via a fake Cardbus bridge,  memory and io spaces
- * have to be  clearly separated from PCI one  since we have different
- * memory decoder.
- */
-#ifdef CONFIG_CARDBUS
-static struct resource bcm_cb_mem_resource = {
-	.name	= "bcm63xx Cardbus memory space",
-	.start	= BCM_CB_MEM_BASE_PA,
-	.end	= BCM_CB_MEM_END_PA,
-	.flags	= IORESOURCE_MEM
-};
-
-static struct resource bcm_cb_io_resource = {
-	.name	= "bcm63xx Cardbus IO space",
-	.start	= BCM_PCI_IO_HALF_PA + 1,
-	.end	= BCM_PCI_IO_END_PA,
-	.flags	= IORESOURCE_IO
-};
-
-struct pci_controller bcm63xx_cb_controller = {
-	.pci_ops	= &bcm63xx_cb_ops,
-	.io_resource	= &bcm_cb_io_resource,
-	.mem_resource	= &bcm_cb_mem_resource,
-};
-#endif
-
 static struct resource bcm_pcie_mem_resource = {
 	.name	= "bcm63xx PCIe memory space",
 	.start	= BCM_PCIE_MEM_BASE_PA,
@@ -238,17 +207,8 @@ static int __init bcm63xx_register_pci(void)
 	val |= (CARDBUS_PCI_IDSEL << PCMCIA_C1_CBIDSEL_SHIFT);
 	bcm_pcmcia_writel(val, PCMCIA_C1_REG);
 
-#ifdef CONFIG_CARDBUS
-	/* setup local bus to PCI access (Cardbus memory) */
-	val = BCM_CB_MEM_BASE_PA & MPI_L2P_BASE_MASK;
-	bcm_mpi_writel(val, MPI_L2PMEMBASE2_REG);
-	bcm_mpi_writel(~(BCM_CB_MEM_SIZE - 1), MPI_L2PMEMRANGE2_REG);
-	val |= MPI_L2PREMAP_ENABLED_MASK | MPI_L2PREMAP_IS_CARDBUS_MASK;
-	bcm_mpi_writel(val, MPI_L2PMEMREMAP2_REG);
-#else
 	/* disable second access windows */
 	bcm_mpi_writel(0, MPI_L2PMEMREMAP2_REG);
-#endif
 
 	/* setup local bus  to PCI access (IO memory),	we have only 1
 	 * IO window  for both PCI  and cardbus, but it	 cannot handle
@@ -318,10 +278,6 @@ static int __init bcm63xx_register_pci(void)
 
 	register_pci_controller(&bcm63xx_controller);
 
-#ifdef CONFIG_CARDBUS
-	register_pci_controller(&bcm63xx_cb_controller);
-#endif
-
 	/* mark memory space used for IO mapping as reserved */
 	request_mem_region(BCM_PCI_IO_BASE_PA, BCM_PCI_IO_SIZE,
 			   "bcm63xx PCI IO space");
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 1525023e49b6..26c89eefa18e 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -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
 
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index b3a2accf47af..67d447c62b8d 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -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
diff --git a/drivers/pcmcia/bcm63xx_pcmcia.c b/drivers/pcmcia/bcm63xx_pcmcia.c
deleted file mode 100644
index dd3c26099048..000000000000
--- a/drivers/pcmcia/bcm63xx_pcmcia.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/ioport.h>
-#include <linux/timer.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/pci.h>
-#include <linux/gpio.h>
-
-#include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
-#include "bcm63xx_pcmcia.h"
-
-#define PFX	"bcm63xx_pcmcia: "
-
-#ifdef CONFIG_CARDBUS
-/* if cardbus is used, platform device needs reference to actual pci
- * device */
-static struct pci_dev *bcm63xx_cb_dev;
-#endif
-
-/*
- * read/write helper for pcmcia regs
- */
-static inline u32 pcmcia_readl(struct bcm63xx_pcmcia_socket *skt, u32 off)
-{
-	return bcm_readl(skt->base + off);
-}
-
-static inline void pcmcia_writel(struct bcm63xx_pcmcia_socket *skt,
-				 u32 val, u32 off)
-{
-	bcm_writel(val, skt->base + off);
-}
-
-/*
- * This callback should (re-)initialise the socket, turn on status
- * interrupts and PCMCIA bus, and wait for power to stabilise so that
- * the card status signals report correctly.
- *
- * Hardware cannot do that.
- */
-static int bcm63xx_pcmcia_sock_init(struct pcmcia_socket *sock)
-{
-	return 0;
-}
-
-/*
- * This callback should remove power on the socket, disable IRQs from
- * the card, turn off status interrupts, and disable the PCMCIA bus.
- *
- * Hardware cannot do that.
- */
-static int bcm63xx_pcmcia_suspend(struct pcmcia_socket *sock)
-{
-	return 0;
-}
-
-/*
- * Implements the set_socket() operation for the in-kernel PCMCIA
- * service (formerly SS_SetSocket in Card Services). We more or
- * less punt all of this work and let the kernel handle the details
- * of power configuration, reset, &c. We also record the value of
- * `state' in order to regurgitate it to the PCMCIA core later.
- */
-static int bcm63xx_pcmcia_set_socket(struct pcmcia_socket *sock,
-				     socket_state_t *state)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-	unsigned long flags;
-	u32 val;
-
-	skt = sock->driver_data;
-
-	spin_lock_irqsave(&skt->lock, flags);
-
-	/* note: hardware cannot control socket power, so we will
-	 * always report SS_POWERON */
-
-	/* apply socket reset */
-	val = pcmcia_readl(skt, PCMCIA_C1_REG);
-	if (state->flags & SS_RESET)
-		val |= PCMCIA_C1_RESET_MASK;
-	else
-		val &= ~PCMCIA_C1_RESET_MASK;
-
-	/* reverse reset logic for cardbus card */
-	if (skt->card_detected && (skt->card_type & CARD_CARDBUS))
-		val ^= PCMCIA_C1_RESET_MASK;
-
-	pcmcia_writel(skt, val, PCMCIA_C1_REG);
-
-	/* keep requested state for event reporting */
-	skt->requested_state = *state;
-
-	spin_unlock_irqrestore(&skt->lock, flags);
-
-	return 0;
-}
-
-/*
- * identity cardtype from VS[12] input, CD[12] input while only VS2 is
- * floating, and CD[12] input while only VS1 is floating
- */
-enum {
-	IN_VS1 = (1 << 0),
-	IN_VS2 = (1 << 1),
-	IN_CD1_VS2H = (1 << 2),
-	IN_CD2_VS2H = (1 << 3),
-	IN_CD1_VS1H = (1 << 4),
-	IN_CD2_VS1H = (1 << 5),
-};
-
-static const u8 vscd_to_cardtype[] = {
-
-	/* VS1 float, VS2 float */
-	[IN_VS1 | IN_VS2] = (CARD_PCCARD | CARD_5V),
-
-	/* VS1 grounded, VS2 float */
-	[IN_VS2] = (CARD_PCCARD | CARD_5V | CARD_3V),
-
-	/* VS1 grounded, VS2 grounded */
-	[0] = (CARD_PCCARD | CARD_5V | CARD_3V | CARD_XV),
-
-	/* VS1 tied to CD1, VS2 float */
-	[IN_VS1 | IN_VS2 | IN_CD1_VS1H] = (CARD_CARDBUS | CARD_3V),
-
-	/* VS1 grounded, VS2 tied to CD2 */
-	[IN_VS2 | IN_CD2_VS2H] = (CARD_CARDBUS | CARD_3V | CARD_XV),
-
-	/* VS1 tied to CD2, VS2 grounded */
-	[IN_VS1 | IN_CD2_VS1H] = (CARD_CARDBUS | CARD_3V | CARD_XV | CARD_YV),
-
-	/* VS1 float, VS2 grounded */
-	[IN_VS1] = (CARD_PCCARD | CARD_XV),
-
-	/* VS1 float, VS2 tied to CD2 */
-	[IN_VS1 | IN_VS2 | IN_CD2_VS2H] = (CARD_CARDBUS | CARD_3V),
-
-	/* VS1 float, VS2 tied to CD1 */
-	[IN_VS1 | IN_VS2 | IN_CD1_VS2H] = (CARD_CARDBUS | CARD_XV | CARD_YV),
-
-	/* VS1 tied to CD2, VS2 float */
-	[IN_VS1 | IN_VS2 | IN_CD2_VS1H] = (CARD_CARDBUS | CARD_YV),
-
-	/* VS2 grounded, VS1 is tied to CD1, CD2 is grounded */
-	[IN_VS1 | IN_CD1_VS1H] = 0, /* ignore cardbay */
-};
-
-/*
- * poll hardware to check card insertion status
- */
-static unsigned int __get_socket_status(struct bcm63xx_pcmcia_socket *skt)
-{
-	unsigned int stat;
-	u32 val;
-
-	stat = 0;
-
-	/* check CD for card presence */
-	val = pcmcia_readl(skt, PCMCIA_C1_REG);
-
-	if (!(val & PCMCIA_C1_CD1_MASK) && !(val & PCMCIA_C1_CD2_MASK))
-		stat |= SS_DETECT;
-
-	/* if new insertion, detect cardtype */
-	if ((stat & SS_DETECT) && !skt->card_detected) {
-		unsigned int stat = 0;
-
-		/* float VS1, float VS2 */
-		val |= PCMCIA_C1_VS1OE_MASK;
-		val |= PCMCIA_C1_VS2OE_MASK;
-		pcmcia_writel(skt, val, PCMCIA_C1_REG);
-
-		/* wait for output to stabilize and read VS[12] */
-		udelay(10);
-		val = pcmcia_readl(skt, PCMCIA_C1_REG);
-		stat |= (val & PCMCIA_C1_VS1_MASK) ? IN_VS1 : 0;
-		stat |= (val & PCMCIA_C1_VS2_MASK) ? IN_VS2 : 0;
-
-		/* drive VS1 low, float VS2 */
-		val &= ~PCMCIA_C1_VS1OE_MASK;
-		val |= PCMCIA_C1_VS2OE_MASK;
-		pcmcia_writel(skt, val, PCMCIA_C1_REG);
-
-		/* wait for output to stabilize and read CD[12] */
-		udelay(10);
-		val = pcmcia_readl(skt, PCMCIA_C1_REG);
-		stat |= (val & PCMCIA_C1_CD1_MASK) ? IN_CD1_VS2H : 0;
-		stat |= (val & PCMCIA_C1_CD2_MASK) ? IN_CD2_VS2H : 0;
-
-		/* float VS1, drive VS2 low */
-		val |= PCMCIA_C1_VS1OE_MASK;
-		val &= ~PCMCIA_C1_VS2OE_MASK;
-		pcmcia_writel(skt, val, PCMCIA_C1_REG);
-
-		/* wait for output to stabilize and read CD[12] */
-		udelay(10);
-		val = pcmcia_readl(skt, PCMCIA_C1_REG);
-		stat |= (val & PCMCIA_C1_CD1_MASK) ? IN_CD1_VS1H : 0;
-		stat |= (val & PCMCIA_C1_CD2_MASK) ? IN_CD2_VS1H : 0;
-
-		/* guess cardtype from all this */
-		skt->card_type = vscd_to_cardtype[stat];
-		if (!skt->card_type)
-			dev_err(&skt->socket.dev, "unsupported card type\n");
-
-		/* drive both VS pin to 0 again */
-		val &= ~(PCMCIA_C1_VS1OE_MASK | PCMCIA_C1_VS2OE_MASK);
-
-		/* enable correct logic */
-		val &= ~(PCMCIA_C1_EN_PCMCIA_MASK | PCMCIA_C1_EN_CARDBUS_MASK);
-		if (skt->card_type & CARD_PCCARD)
-			val |= PCMCIA_C1_EN_PCMCIA_MASK;
-		else
-			val |= PCMCIA_C1_EN_CARDBUS_MASK;
-
-		pcmcia_writel(skt, val, PCMCIA_C1_REG);
-	}
-	skt->card_detected = (stat & SS_DETECT) ? 1 : 0;
-
-	/* report card type/voltage */
-	if (skt->card_type & CARD_CARDBUS)
-		stat |= SS_CARDBUS;
-	if (skt->card_type & CARD_3V)
-		stat |= SS_3VCARD;
-	if (skt->card_type & CARD_XV)
-		stat |= SS_XVCARD;
-	stat |= SS_POWERON;
-
-	if (gpio_get_value(skt->pd->ready_gpio))
-		stat |= SS_READY;
-
-	return stat;
-}
-
-/*
- * core request to get current socket status
- */
-static int bcm63xx_pcmcia_get_status(struct pcmcia_socket *sock,
-				     unsigned int *status)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-
-	skt = sock->driver_data;
-
-	spin_lock_bh(&skt->lock);
-	*status = __get_socket_status(skt);
-	spin_unlock_bh(&skt->lock);
-
-	return 0;
-}
-
-/*
- * socket polling timer callback
- */
-static void bcm63xx_pcmcia_poll(struct timer_list *t)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-	unsigned int stat, events;
-
-	skt = from_timer(skt, t, timer);
-
-	spin_lock_bh(&skt->lock);
-
-	stat = __get_socket_status(skt);
-
-	/* keep only changed bits, and mask with required one from the
-	 * core */
-	events = (stat ^ skt->old_status) & skt->requested_state.csc_mask;
-	skt->old_status = stat;
-	spin_unlock_bh(&skt->lock);
-
-	if (events)
-		pcmcia_parse_events(&skt->socket, events);
-
-	mod_timer(&skt->timer,
-		  jiffies + msecs_to_jiffies(BCM63XX_PCMCIA_POLL_RATE));
-}
-
-static int bcm63xx_pcmcia_set_io_map(struct pcmcia_socket *sock,
-				     struct pccard_io_map *map)
-{
-	/* this doesn't seem to be called by pcmcia layer if static
-	 * mapping is used */
-	return 0;
-}
-
-static int bcm63xx_pcmcia_set_mem_map(struct pcmcia_socket *sock,
-				      struct pccard_mem_map *map)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-	struct resource *res;
-
-	skt = sock->driver_data;
-	if (map->flags & MAP_ATTRIB)
-		res = skt->attr_res;
-	else
-		res = skt->common_res;
-
-	map->static_start = res->start + map->card_start;
-	return 0;
-}
-
-static struct pccard_operations bcm63xx_pcmcia_operations = {
-	.init			= bcm63xx_pcmcia_sock_init,
-	.suspend		= bcm63xx_pcmcia_suspend,
-	.get_status		= bcm63xx_pcmcia_get_status,
-	.set_socket		= bcm63xx_pcmcia_set_socket,
-	.set_io_map		= bcm63xx_pcmcia_set_io_map,
-	.set_mem_map		= bcm63xx_pcmcia_set_mem_map,
-};
-
-/*
- * register pcmcia socket to core
- */
-static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-	struct pcmcia_socket *sock;
-	struct resource *res;
-	unsigned int regmem_size = 0, iomem_size = 0;
-	u32 val;
-	int ret;
-	int irq;
-
-	skt = kzalloc(sizeof(*skt), GFP_KERNEL);
-	if (!skt)
-		return -ENOMEM;
-	spin_lock_init(&skt->lock);
-	sock = &skt->socket;
-	sock->driver_data = skt;
-
-	/* make sure we have all resources we need */
-	skt->common_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	skt->attr_res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
-	irq = platform_get_irq(pdev, 0);
-	skt->pd = pdev->dev.platform_data;
-	if (!skt->common_res || !skt->attr_res || (irq < 0) || !skt->pd) {
-		ret = -EINVAL;
-		goto err;
-	}
-
-	/* remap pcmcia registers */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	regmem_size = resource_size(res);
-	if (!request_mem_region(res->start, regmem_size, "bcm63xx_pcmcia")) {
-		ret = -EINVAL;
-		goto err;
-	}
-	skt->reg_res = res;
-
-	skt->base = ioremap(res->start, regmem_size);
-	if (!skt->base) {
-		ret = -ENOMEM;
-		goto err;
-	}
-
-	/* remap io registers */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
-	iomem_size = resource_size(res);
-	skt->io_base = ioremap(res->start, iomem_size);
-	if (!skt->io_base) {
-		ret = -ENOMEM;
-		goto err;
-	}
-
-	/* resources are static */
-	sock->resource_ops = &pccard_static_ops;
-	sock->ops = &bcm63xx_pcmcia_operations;
-	sock->owner = THIS_MODULE;
-	sock->dev.parent = &pdev->dev;
-	sock->features = SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
-	sock->io_offset = (unsigned long)skt->io_base;
-	sock->pci_irq = irq;
-
-#ifdef CONFIG_CARDBUS
-	sock->cb_dev = bcm63xx_cb_dev;
-	if (bcm63xx_cb_dev)
-		sock->features |= SS_CAP_CARDBUS;
-#endif
-
-	/* assume common & attribute memory have the same size */
-	sock->map_size = resource_size(skt->common_res);
-
-	/* initialize polling timer */
-	timer_setup(&skt->timer, bcm63xx_pcmcia_poll, 0);
-
-	/* initialize  pcmcia  control register,  drive  VS[12] to  0,
-	 * leave CB IDSEL to the old  value since it is set by the PCI
-	 * layer */
-	val = pcmcia_readl(skt, PCMCIA_C1_REG);
-	val &= PCMCIA_C1_CBIDSEL_MASK;
-	val |= PCMCIA_C1_EN_PCMCIA_GPIO_MASK;
-	pcmcia_writel(skt, val, PCMCIA_C1_REG);
-
-	/*
-	 * Hardware has only one set of timings registers, not one for
-	 * each memory access type, so we configure them for the
-	 * slowest one: attribute memory.
-	 */
-	val = PCMCIA_C2_DATA16_MASK;
-	val |= 10 << PCMCIA_C2_RWCOUNT_SHIFT;
-	val |= 6 << PCMCIA_C2_INACTIVE_SHIFT;
-	val |= 3 << PCMCIA_C2_SETUP_SHIFT;
-	val |= 3 << PCMCIA_C2_HOLD_SHIFT;
-	pcmcia_writel(skt, val, PCMCIA_C2_REG);
-
-	ret = pcmcia_register_socket(sock);
-	if (ret)
-		goto err;
-
-	/* start polling socket */
-	mod_timer(&skt->timer,
-		  jiffies + msecs_to_jiffies(BCM63XX_PCMCIA_POLL_RATE));
-
-	platform_set_drvdata(pdev, skt);
-	return 0;
-
-err:
-	if (skt->io_base)
-		iounmap(skt->io_base);
-	if (skt->base)
-		iounmap(skt->base);
-	if (skt->reg_res)
-		release_mem_region(skt->reg_res->start, regmem_size);
-	kfree(skt);
-	return ret;
-}
-
-static int bcm63xx_drv_pcmcia_remove(struct platform_device *pdev)
-{
-	struct bcm63xx_pcmcia_socket *skt;
-	struct resource *res;
-
-	skt = platform_get_drvdata(pdev);
-	timer_shutdown_sync(&skt->timer);
-	iounmap(skt->base);
-	iounmap(skt->io_base);
-	res = skt->reg_res;
-	release_mem_region(res->start, resource_size(res));
-	kfree(skt);
-	return 0;
-}
-
-struct platform_driver bcm63xx_pcmcia_driver = {
-	.probe	= bcm63xx_drv_pcmcia_probe,
-	.remove	= bcm63xx_drv_pcmcia_remove,
-	.driver	= {
-		.name	= "bcm63xx_pcmcia",
-		.owner  = THIS_MODULE,
-	},
-};
-
-#ifdef CONFIG_CARDBUS
-static int bcm63xx_cb_probe(struct pci_dev *dev,
-				      const struct pci_device_id *id)
-{
-	/* keep pci device */
-	bcm63xx_cb_dev = dev;
-	return platform_driver_register(&bcm63xx_pcmcia_driver);
-}
-
-static void bcm63xx_cb_exit(struct pci_dev *dev)
-{
-	platform_driver_unregister(&bcm63xx_pcmcia_driver);
-	bcm63xx_cb_dev = NULL;
-}
-
-static const struct pci_device_id bcm63xx_cb_table[] = {
-	{
-		.vendor		= PCI_VENDOR_ID_BROADCOM,
-		.device		= BCM6348_CPU_ID,
-		.subvendor	= PCI_VENDOR_ID_BROADCOM,
-		.subdevice	= PCI_ANY_ID,
-		.class		= PCI_CLASS_BRIDGE_CARDBUS << 8,
-		.class_mask	= ~0,
-	},
-
-	{
-		.vendor		= PCI_VENDOR_ID_BROADCOM,
-		.device		= BCM6358_CPU_ID,
-		.subvendor	= PCI_VENDOR_ID_BROADCOM,
-		.subdevice	= PCI_ANY_ID,
-		.class		= PCI_CLASS_BRIDGE_CARDBUS << 8,
-		.class_mask	= ~0,
-	},
-
-	{ },
-};
-
-MODULE_DEVICE_TABLE(pci, bcm63xx_cb_table);
-
-static struct pci_driver bcm63xx_cardbus_driver = {
-	.name		= "bcm63xx_cardbus",
-	.id_table	= bcm63xx_cb_table,
-	.probe		= bcm63xx_cb_probe,
-	.remove		= bcm63xx_cb_exit,
-};
-#endif
-
-/*
- * if cardbus support is enabled, register our platform device after
- * our fake cardbus bridge has been registered
- */
-static int __init bcm63xx_pcmcia_init(void)
-{
-#ifdef CONFIG_CARDBUS
-	return pci_register_driver(&bcm63xx_cardbus_driver);
-#else
-	return platform_driver_register(&bcm63xx_pcmcia_driver);
-#endif
-}
-
-static void __exit bcm63xx_pcmcia_exit(void)
-{
-#ifdef CONFIG_CARDBUS
-	return pci_unregister_driver(&bcm63xx_cardbus_driver);
-#else
-	platform_driver_unregister(&bcm63xx_pcmcia_driver);
-#endif
-}
-
-module_init(bcm63xx_pcmcia_init);
-module_exit(bcm63xx_pcmcia_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Maxime Bizon <mbizon@freebox.fr>");
-MODULE_DESCRIPTION("Linux PCMCIA Card Services: bcm63xx Socket Controller");
diff --git a/drivers/pcmcia/bcm63xx_pcmcia.h b/drivers/pcmcia/bcm63xx_pcmcia.h
deleted file mode 100644
index 2122c59a1c4a..000000000000
--- a/drivers/pcmcia/bcm63xx_pcmcia.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef BCM63XX_PCMCIA_H_
-#define BCM63XX_PCMCIA_H_
-
-#include <linux/types.h>
-#include <linux/timer.h>
-#include <pcmcia/ss.h>
-#include <bcm63xx_dev_pcmcia.h>
-
-/* socket polling rate in ms */
-#define BCM63XX_PCMCIA_POLL_RATE	500
-
-enum {
-	CARD_CARDBUS = (1 << 0),
-	CARD_PCCARD = (1 << 1),
-	CARD_5V = (1 << 2),
-	CARD_3V = (1 << 3),
-	CARD_XV = (1 << 4),
-	CARD_YV = (1 << 5),
-};
-
-struct bcm63xx_pcmcia_socket {
-	struct pcmcia_socket socket;
-
-	/* platform specific data */
-	struct bcm63xx_pcmcia_platform_data *pd;
-
-	/* all regs access are protected by this spinlock */
-	spinlock_t lock;
-
-	/* pcmcia registers resource */
-	struct resource *reg_res;
-
-	/* base remapped address of registers */
-	void __iomem *base;
-
-	/* whether a card is detected at the moment */
-	int card_detected;
-
-	/* type of detected card (mask of above enum) */
-	u8 card_type;
-
-	/* keep last socket status to implement event reporting */
-	unsigned int old_status;
-
-	/* backup of requested socket state */
-	socket_state_t requested_state;
-
-	/* timer used for socket status polling */
-	struct timer_list timer;
-
-	/* attribute/common memory resources */
-	struct resource *attr_res;
-	struct resource *common_res;
-	struct resource *io_res;
-
-	/* base address of io memory */
-	void __iomem *io_base;
-};
-
-#endif /* BCM63XX_PCMCIA_H_ */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC 2/6] pccard: split cardbus support from pcmcia
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
  2023-02-27 13:34 ` [RFC 1/6] pccard: remove bcm63xx socket driver Arnd Bergmann
@ 2023-02-27 13:34 ` Arnd Bergmann
  2023-02-27 13:34 ` [RFC 4/6] yenta_socket: remove dead code Arnd Bergmann
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 26c89eefa18e..7b449d40da5e 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -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
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index 67d447c62b8d..0f090543cefe 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -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
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index 45c8252c8edc..2c5673ae58ba 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -121,4 +121,5 @@ void cb_free(struct pcmcia_socket *s)
 		pci_stop_and_remove_bus_device(dev);
 
 	pci_unlock_rescan_remove();
+
 }
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index e3224e49c43f..8ed89d7cfc94 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -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);
-
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 580369f3c0b0..1fc527fd06c3 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -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))
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index ace133b9f7d4..d68acd1ceabb 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -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);
 
diff --git a/drivers/pcmcia/ricoh.h b/drivers/pcmcia/ricoh.h
index 8ac7b138c094..bca3ebffb5c4 100644
--- a/drivers/pcmcia/ricoh.h
+++ b/drivers/pcmcia/ricoh.h
@@ -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])
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 1365eaa20ff4..ac98d9bb8349 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -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 = &yenta_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(&yenta_cardbus_driver);
+	if (ret)
+		class_unregister(&pcmcia_socket_class);
+
+	return ret;
+}
+module_init(yenta_init);
+
+static void __exit yenta_exit(void)
+{
+	pci_unregister_driver(&yenta_cardbus_driver);
+	class_unregister(&pcmcia_socket_class);
+}
+module_exit(yenta_exit);
 
 MODULE_LICENSE("GPL");
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 7cf7dbbfa131..b905f5248fc6 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -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
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC 4/6] yenta_socket: remove dead code
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
  2023-02-27 13:34 ` [RFC 1/6] pccard: remove bcm63xx socket driver Arnd Bergmann
  2023-02-27 13:34 ` [RFC 2/6] pccard: split cardbus support from pcmcia Arnd Bergmann
@ 2023-02-27 13:34 ` Arnd Bergmann
  2023-02-27 13:34 ` [RFC 5/6] pccard: drop remnants of cardbus support Arnd Bergmann
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pcmcia/yenta_socket.c | 955 ++++------------------------------
 1 file changed, 91 insertions(+), 864 deletions(-)

diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 64d11592bd99..68b852f18cbb 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -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
  * <dahinds@users.sourceforge.net>.  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
- * <dahinds@users.sourceforge.net>.  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
- * <dahinds@users.sourceforge.net>.  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 *att
 
 	if (!(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
- * <dahinds@users.sourceforge.net>.  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
- * <dahinds@users.sourceforge.net>.  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 <manfred@colorfullife.com>
- * 	Dynamically adjust the size of the bridge resource
- *
- * May 2003: Dominik Brodowski <linux@brodo.de>
- * 	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 = &yenta_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	(&yenta_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(&yenta_pm_ops),
 };
 
 static int __init yenta_init(void)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC 5/6] pccard: drop remnants of cardbus support
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (2 preceding siblings ...)
  2023-02-27 13:34 ` [RFC 4/6] yenta_socket: remove dead code Arnd Bergmann
@ 2023-02-27 13:34 ` Arnd Bergmann
  2023-02-27 13:34 ` [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia Arnd Bergmann
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 7b449d40da5e..c05d95cf7d3e 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -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
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 948b763dc451..05967953fafa 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -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;
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 8ed89d7cfc94..3d69914f5fec 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -133,14 +133,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 	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
-
 	/* set proper values in socket->dev */
 	dev_set_drvdata(&socket->dev, socket);
 	socket->dev.class = &pcmcia_socket_class;
@@ -313,10 +305,6 @@ 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);
 
@@ -357,15 +345,6 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
 		return -ETIMEDOUT;
 	}
 
-	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;
-
 	/*
 	 * Decode the card voltage requirements, and apply power to the card.
 	 */
@@ -425,19 +404,12 @@ static int socket_insert(struct pcmcia_socket *skt)
 		skt->state |= SOCKET_PRESENT;
 
 		dev_notice(&skt->dev, "pccard: %s card inserted into slot %d\n",
-			   (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
-			   skt->sock);
+			   "PCMCIA", skt->sock);
 
-#if IS_ENABLED(CONFIG_CARDBUS)
-		if (skt->state & SOCKET_CARDBUS) {
-			cb_alloc(skt);
-			skt->state |= SOCKET_CARDBUS_CONFIG;
-		}
-#endif
 		dev_dbg(&skt->dev, "insert done\n");
 		mutex_unlock(&skt->ops_mutex);
 
-		if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
+		if (skt->callback)
 			skt->callback->add(skt);
 	} else {
 		mutex_unlock(&skt->ops_mutex);
@@ -509,33 +481,11 @@ static int socket_late_resume(struct pcmcia_socket *skt)
 		return socket_insert(skt);
 	}
 
-	if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
+	if (skt->callback)
 		ret = skt->callback->early_resume(skt);
 	return ret;
 }
 
-/*
- * Finalize the resume. In case of a cardbus socket, we have
- * to rebind the devices as we can't be certain that it has been
- * replaced, or not.
- */
-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
@@ -543,15 +493,11 @@ static int socket_complete_resume(struct pcmcia_socket *skt)
  */
 static int socket_resume(struct pcmcia_socket *skt)
 {
-	int err;
 	if (!(skt->state & SOCKET_SUSPEND))
 		return -EBUSY;
 
 	socket_early_resume(skt);
-	err = socket_late_resume(skt);
-	if (!err)
-		err = socket_complete_resume(skt);
-	return err;
+	return socket_late_resume(skt);
 }
 
 static void socket_remove(struct pcmcia_socket *skt)
@@ -638,8 +584,7 @@ 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 (sysfs_events & PCMCIA_UEVENT_SUSPEND) {
 				if (skt->callback)
 					ret = skt->callback->suspend(skt);
 				else
@@ -649,14 +594,12 @@ static int pccardd(void *__skt)
 					msleep(100);
 				}
 			}
-			if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
-				!(skt->state & SOCKET_CARDBUS)) {
+			if (sysfs_events & PCMCIA_UEVENT_RESUME) {
 				ret = socket_resume(skt);
 				if (!ret && skt->callback)
 					skt->callback->resume(skt);
 			}
-			if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
-				!(skt->state & SOCKET_CARDBUS)) {
+			if (sysfs_events & PCMCIA_UEVENT_REQUERY) {
 				if (!ret && skt->callback)
 					skt->callback->requery(skt);
 			}
@@ -752,7 +695,7 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
 
 		s->callback = c;
 
-		if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
+		if (s->state & SOCKET_PRESENT)
 			s->callback->add(s);
 	} else
 		s->callback = NULL;
@@ -787,12 +730,6 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
 			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);
@@ -860,12 +797,6 @@ static int __used pcmcia_socket_dev_resume(struct device *dev)
 	return __pcmcia_pm_op(dev, socket_late_resume);
 }
 
-static void __used pcmcia_socket_dev_complete(struct device *dev)
-{
-	WARN(__pcmcia_pm_op(dev, socket_complete_resume),
-		"failed to complete resume");
-}
-
 static const struct dev_pm_ops pcmcia_socket_pm_ops = {
 	/* dev_resume may be called with IRQs enabled */
 	SET_SYSTEM_SLEEP_PM_OPS(NULL,
@@ -880,7 +811,6 @@ static const struct dev_pm_ops pcmcia_socket_pm_ops = {
 	.resume_noirq = pcmcia_socket_dev_resume_noirq,
 	.thaw_noirq = pcmcia_socket_dev_resume_noirq,
 	.restore_noirq = pcmcia_socket_dev_resume_noirq,
-	.complete = pcmcia_socket_dev_complete,
 };
 
 #define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 1fc527fd06c3..c29b86d6910b 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -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"
  */
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index c7a906664c36..d41d6fbe48cf 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -37,8 +37,6 @@ static ssize_t pccard_show_type(struct device *dev, struct device_attribute *att
 
 	if (!(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);
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index b905f5248fc6..ea22367e6a78 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (3 preceding siblings ...)
  2023-02-27 13:34 ` [RFC 5/6] pccard: drop remnants of cardbus support Arnd Bergmann
@ 2023-02-27 13:34 ` Arnd Bergmann
  2023-02-27 19:07 ` [RFC 0/6] pcmcia: separate 16-bit support from cardbus Oliver Hartkopp
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 13:34 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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%)

diff --git a/drivers/Makefile b/drivers/Makefile
index bdf1c66141c9..900a37a1b401 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -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/
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 48113b210cf9..83941cb45291 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -161,4 +161,60 @@ config HOTPLUG_PCI_S390
 
 	  When in doubt, say Y.
 
+config CARDBUS
+	tristate "32-bit CardBus support"
+	depends on PCI
+	select YENTA
+	default PCCARD
+	help
+	  CardBus is a bus mastering architecture for PC-cards, which allows
+	  for 32 bit PC-cards (the original PCMCIA standard specifies only
+	  a 16 bit wide bus). Many newer PC-cards are actually CardBus cards.
+
+	  To use 32 bit PC-cards, you also need a CardBus compatible host
+	  bridge. Virtually all modern PCMCIA bridges do this, and most of
+	  them are "yenta-compatible", so say Y or M there, too.
+
+	  If unsure, say Y.
+
+config YENTA
+	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
+	  the hardware inside your computer that PCMCIA cards are plugged
+	  into.
+
+	  To compile this driver as modules, choose M here: the
+	  module will be called yenta_socket.
+
+	  If unsure, say Y.
+
+config YENTA_O2
+	default y
+	bool "Special initialization for O2Micro bridges" if EXPERT
+	depends on YENTA
+
+config YENTA_RICOH
+	default y
+	bool "Special initialization for Ricoh bridges" if EXPERT
+	depends on YENTA
+
+config YENTA_TI
+	default y
+	bool "Special initialization for TI and EnE bridges" if EXPERT
+	depends on YENTA
+
+config YENTA_ENE_TUNE
+	default y
+	bool "Auto-tune EnE bridges for CB cards" if EXPERT
+	depends on YENTA_TI && CARDBUS
+
+config YENTA_TOSHIBA
+	default y
+	bool "Special initialization for Toshiba ToPIC bridges" if EXPERT
+	depends on YENTA
+
 endif # HOTPLUG_PCI
diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
index 5196983220df..8b655c283565 100644
--- a/drivers/pci/hotplug/Makefile
+++ b/drivers/pci/hotplug/Makefile
@@ -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.
 
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pci/hotplug/yenta_socket.c
similarity index 99%
rename from drivers/pcmcia/yenta_socket.c
rename to drivers/pci/hotplug/yenta_socket.c
index 68b852f18cbb..3b530ce76809 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pci/hotplug/yenta_socket.c
@@ -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
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index c05d95cf7d3e..3c4b895dba80 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -53,67 +53,11 @@ config PCMCIA_LOAD_CIS
 
 	  If unsure, say Y.
 
-config CARDBUS
-	tristate "32-bit CardBus support"
-	depends on PCI
-	select YENTA
-	default y
-	help
-	  CardBus is a bus mastering architecture for PC-cards, which allows
-	  for 32 bit PC-cards (the original PCMCIA standard specifies only
-	  a 16 bit wide bus). Many newer PC-cards are actually CardBus cards.
-
-	  To use 32 bit PC-cards, you also need a CardBus compatible host
-	  bridge. Virtually all modern PCMCIA bridges do this, and most of
-	  them are "yenta-compatible", so say Y or M there, too.
-
-	  If unsure, say Y.
-
 config PCMCIA_MAX1600
 	tristate
 
 comment "PC-card bridges"
 
-config YENTA
-	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
-	  the hardware inside your computer that PCMCIA cards are plugged
-	  into.
-
-	  To compile this driver as modules, choose M here: the
-	  module will be called yenta_socket.
-
-	  If unsure, say Y.
-
-config YENTA_O2
-	default y
-	bool "Special initialization for O2Micro bridges" if EXPERT
-	depends on YENTA
-
-config YENTA_RICOH
-	default y
-	bool "Special initialization for Ricoh bridges" if EXPERT
-	depends on YENTA
-
-config YENTA_TI
-	default y
-	bool "Special initialization for TI and EnE bridges" if EXPERT
-	depends on YENTA
-
-config YENTA_ENE_TUNE
-	default y
-	bool "Auto-tune EnE bridges for CB cards" if EXPERT
-	depends on YENTA_TI && CARDBUS
-
-config YENTA_TOSHIBA
-	default y
-	bool "Special initialization for Toshiba ToPIC bridges" if EXPERT
-	depends on YENTA
-
 config PD6729
 	tristate "Cirrus PD6729 compatible bridge support"
 	depends on PCMCIA && PCI
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index 4d0af3e27c1c..481468778f46 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -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
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index a335748bdef5..b74eb77e7489 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -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");
 
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index 891ccea2cccb..bb4045b4613a 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -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"
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index a0a2e7f18356..ec8c093e7fd0 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -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");
diff --git a/drivers/pcmcia/i82365.h b/include/pcmcia/i82365.h
similarity index 100%
rename from drivers/pcmcia/i82365.h
rename to include/pcmcia/i82365.h
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (4 preceding siblings ...)
  2023-02-27 13:34 ` [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia Arnd Bergmann
@ 2023-02-27 19:07 ` Oliver Hartkopp
  2023-02-27 19:53   ` Arnd Bergmann
  2023-02-27 20:15 ` Russell King (Oracle)
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Oliver Hartkopp @ 2023-02-27 19:07 UTC (permalink / raw)
  To: Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Olof Johansson, Robert Jarzmik,
	YOKOTA Hiroshi, bcm-kernel-feedback-list, linux-arm-kernel,
	linux-can, linux-mips, linux-pci, linux-wireless, netdev

Hello Arnd,

On 27.02.23 14:34, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>

(..)

> 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'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):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/can/sja1000/ems_pcmcia.c?id=3ec6ca6b1a8e64389f0212b5a1b0f6fed1909e45

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


> 
> 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/Y07d7rMvd5++85BJ@owl.dominikbrodowski.net/
> [2] https://lore.kernel.org/all/c5b39544-a4fb-4796-a046-0b9be9853787@app.fastmail.com/
> [3] https://lore.kernel.org/all/20230222092302.6348-1-jirislaby@kernel.org/
> 
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Ian Abbott <abbotti@mev.co.uk>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Kevin Cernekee <cernekee@gmail.com>
> Cc: Lukas Wunner <lukas@wunner.de>
> Cc: Manuel Lauss <manuel.lauss@gmail.com>
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Robert Jarzmik <robert.jarzmik@free.fr>
> Cc: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-can@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> Cc: linux-wireless@vger.kernel.org
> Cc: netdev@vger.kernel.org
> 
> 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%)
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 19:07 ` [RFC 0/6] pcmcia: separate 16-bit support from cardbus Oliver Hartkopp
@ 2023-02-27 19:53   ` Arnd Bergmann
  2023-02-27 20:32     ` Oliver Hartkopp
  0 siblings, 1 reply; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 19:53 UTC (permalink / raw)
  To: Oliver Hartkopp, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Mon, Feb 27, 2023, at 20:07, Oliver Hartkopp wrote:
> Hello Arnd,
>
> On 27.02.23 14:34, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>
> (..)
>
>> 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'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):
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/can/sja1000/ems_pcmcia.c?id=3ec6ca6b1a8e64389f0212b5a1b0f6fed1909e45
>
> 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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (5 preceding siblings ...)
  2023-02-27 19:07 ` [RFC 0/6] pcmcia: separate 16-bit support from cardbus Oliver Hartkopp
@ 2023-02-27 20:15 ` Russell King (Oracle)
  2023-02-27 21:04   ` Arnd Bergmann
  2023-02-28 22:45   ` David Laight
  2023-02-27 20:23 ` Larry Finger
  2023-02-28 21:35 ` Ondrej Zary
  8 siblings, 2 replies; 26+ messages in thread
From: Russell King (Oracle) @ 2023-02-27 20:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dominik Brodowski, linux-kernel, Arnd Bergmann, Bjorn Helgaas,
	Florian Fainelli, H Hartley Sweeten, Ian Abbott, Jakub Kicinski,
	Kevin Cernekee, Lukas Wunner, Manuel Lauss, Oliver Hartkopp,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, netdev

On Mon, Feb 27, 2023 at 02:34:51PM +0100, Arnd Bergmann wrote:
> 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.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (6 preceding siblings ...)
  2023-02-27 20:15 ` Russell King (Oracle)
@ 2023-02-27 20:23 ` Larry Finger
  2023-02-27 20:38   ` Arnd Bergmann
  2023-02-28 21:35 ` Ondrej Zary
  8 siblings, 1 reply; 26+ messages in thread
From: Larry Finger @ 2023-02-27 20:23 UTC (permalink / raw)
  To: Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

On 2/27/23 07:34, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

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



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 19:53   ` Arnd Bergmann
@ 2023-02-27 20:32     ` Oliver Hartkopp
  2023-02-27 20:54       ` Marc Kleine-Budde
  0 siblings, 1 reply; 26+ messages in thread
From: Oliver Hartkopp @ 2023-02-27 20:32 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Dominik Brodowski, linux-kernel,
	Marc Kleine-Budde
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On 27.02.23 20:53, Arnd Bergmann wrote:
> On Mon, Feb 27, 2023, at 20:07, Oliver Hartkopp wrote:

>> 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?

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:23 ` Larry Finger
@ 2023-02-27 20:38   ` Arnd Bergmann
  2023-02-27 20:59     ` Russell King (Oracle)
  2023-02-27 21:09     ` Larry Finger
  0 siblings, 2 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 20:38 UTC (permalink / raw)
  To: Larry Finger, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Mon, Feb 27, 2023, at 21:23, Larry Finger wrote:
> 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)
>
> 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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:32     ` Oliver Hartkopp
@ 2023-02-27 20:54       ` Marc Kleine-Budde
  0 siblings, 0 replies; 26+ messages in thread
From: Marc Kleine-Budde @ 2023-02-27 20:54 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Arnd Bergmann, Arnd Bergmann, Dominik Brodowski, linux-kernel,
	Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

[-- Attachment #1: Type: text/plain, Size: 2356 bytes --]

On 27.02.2023 21:32:40, Oliver Hartkopp wrote:
> On 27.02.23 20:53, Arnd Bergmann wrote:
> > On Mon, Feb 27, 2023, at 20:07, Oliver Hartkopp wrote:
> 
> > > 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?
> 
> 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?

I don't have any of these cards, nor any $CUSTOMER who's using it.

Marc

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:38   ` Arnd Bergmann
@ 2023-02-27 20:59     ` Russell King (Oracle)
  2023-02-27 21:09     ` Larry Finger
  1 sibling, 0 replies; 26+ messages in thread
From: Russell King (Oracle) @ 2023-02-27 20:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Larry Finger, Arnd Bergmann, Dominik Brodowski, linux-kernel,
	Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Mon, Feb 27, 2023 at 09:38:54PM +0100, Arnd Bergmann wrote:
> On Mon, Feb 27, 2023, at 21:23, Larry Finger wrote:
> > 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)
> >
> > 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.

If it shows up as a PCI device, it will be cardbus, not 16-bit ISA.

PCMCIA cards don't show up in lspci.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:15 ` Russell King (Oracle)
@ 2023-02-27 21:04   ` Arnd Bergmann
  2023-02-28 22:45   ` David Laight
  1 sibling, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 21:04 UTC (permalink / raw)
  To: Russell King
  Cc: Dominik Brodowski, linux-kernel, Arnd Bergmann, Bjorn Helgaas,
	Florian Fainelli, Hartley Sweeten, Ian Abbott, Jakub Kicinski,
	Kevin Cernekee, Lukas Wunner, Manuel Lauss, Oliver Hartkopp,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Mon, Feb 27, 2023, at 21:15, Russell King (Oracle) wrote:
> On Mon, Feb 27, 2023 at 02:34:51PM +0100, Arnd Bergmann wrote:
>> 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.

> 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?

> 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


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:38   ` Arnd Bergmann
  2023-02-27 20:59     ` Russell King (Oracle)
@ 2023-02-27 21:09     ` Larry Finger
  2023-02-27 21:30       ` Arnd Bergmann
  1 sibling, 1 reply; 26+ messages in thread
From: Larry Finger @ 2023-02-27 21:09 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On 2/27/23 14:38, Arnd Bergmann wrote:
> 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


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 21:09     ` Larry Finger
@ 2023-02-27 21:30       ` Arnd Bergmann
  2023-02-28  3:57         ` Larry Finger
  0 siblings, 1 reply; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-27 21:30 UTC (permalink / raw)
  To: Larry Finger, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Mon, Feb 27, 2023, at 22:09, Larry Finger wrote:
> On 2/27/23 14:38, Arnd Bergmann wrote:
>> 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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/6] pccard: remove bcm63xx socket driver
  2023-02-27 13:34 ` [RFC 1/6] pccard: remove bcm63xx socket driver Arnd Bergmann
@ 2023-02-27 21:33   ` Florian Fainelli
  2023-03-14  8:53     ` Maxime Bizon
  0 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2023-02-27 21:33 UTC (permalink / raw)
  To: Arnd Bergmann, Dominik Brodowski, linux-kernel, Maxime Bizon
  Cc: Arnd Bergmann, Bjorn Helgaas, Florian Fainelli,
	H Hartley Sweeten, Ian Abbott, Jakub Kicinski, Kevin Cernekee,
	Lukas Wunner, Manuel Lauss, Oliver Hartkopp, Olof Johansson,
	Robert Jarzmik, YOKOTA Hiroshi, bcm-kernel-feedback-list,
	linux-arm-kernel, linux-can, linux-mips, linux-pci,
	linux-wireless, netdev

+Maxime,

On 2/27/2023 5:34 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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?
-- 
Florian

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 21:30       ` Arnd Bergmann
@ 2023-02-28  3:57         ` Larry Finger
  2023-02-28  8:37           ` Arnd Bergmann
  0 siblings, 1 reply; 26+ messages in thread
From: Larry Finger @ 2023-02-28  3:57 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On 2/27/23 15:30, Arnd Bergmann wrote:
> On Mon, Feb 27, 2023, at 22:09, Larry Finger wrote:
>> On 2/27/23 14:38, Arnd Bergmann wrote:
>>> 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,

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



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-28  3:57         ` Larry Finger
@ 2023-02-28  8:37           ` Arnd Bergmann
  2023-03-01  1:13             ` Larry Finger
  0 siblings, 1 reply; 26+ messages in thread
From: Arnd Bergmann @ 2023-02-28  8:37 UTC (permalink / raw)
  To: Larry Finger, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Tue, Feb 28, 2023, at 04:57, Larry Finger wrote:
> 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_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.

Ok, great, thanks for testing!

> 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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
                   ` (7 preceding siblings ...)
  2023-02-27 20:23 ` Larry Finger
@ 2023-02-28 21:35 ` Ondrej Zary
  8 siblings, 0 replies; 26+ messages in thread
From: Ondrej Zary @ 2023-02-28 21:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dominik Brodowski, linux-kernel, Arnd Bergmann, Bjorn Helgaas,
	Florian Fainelli, H Hartley Sweeten, Ian Abbott, Jakub Kicinski,
	Kevin Cernekee, Lukas Wunner, Manuel Lauss, Oliver Hartkopp,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, netdev

On Monday 27 February 2023 14:34:51 Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

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).

> 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.

This is bad. The drivers remain but could not be used by most machines :(

-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-27 20:15 ` Russell King (Oracle)
  2023-02-27 21:04   ` Arnd Bergmann
@ 2023-02-28 22:45   ` David Laight
  2023-02-28 22:55     ` David Laight
  1 sibling, 1 reply; 26+ messages in thread
From: David Laight @ 2023-02-28 22:45 UTC (permalink / raw)
  To: 'Russell King', Arnd Bergmann
  Cc: Dominik Brodowski, linux-kernel, Arnd Bergmann, Bjorn Helgaas,
	Florian Fainelli, H Hartley Sweeten, Ian Abbott, Jakub Kicinski,
	Kevin Cernekee, Lukas Wunner, Manuel Lauss, Oliver Hartkopp,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, netdev

From: Russell King
> Sent: 27 February 2023 20:16
> 
> On Mon, Feb 27, 2023 at 02:34:51PM +0100, Arnd Bergmann wrote:
> > 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.)

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)


^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-28 22:45   ` David Laight
@ 2023-02-28 22:55     ` David Laight
  0 siblings, 0 replies; 26+ messages in thread
From: David Laight @ 2023-02-28 22:55 UTC (permalink / raw)
  To: David Laight, 'Russell King', Arnd Bergmann
  Cc: Dominik Brodowski, linux-kernel, Arnd Bergmann, Bjorn Helgaas,
	Florian Fainelli, H Hartley Sweeten, Ian Abbott, Jakub Kicinski,
	Kevin Cernekee, Lukas Wunner, Manuel Lauss, Oliver Hartkopp,
	Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, netdev

From: David Laight
> Sent: 28 February 2023 22:45
...
> 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)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-02-28  8:37           ` Arnd Bergmann
@ 2023-03-01  1:13             ` Larry Finger
  2023-03-01  8:01               ` Arnd Bergmann
  0 siblings, 1 reply; 26+ messages in thread
From: Larry Finger @ 2023-03-01  1:13 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On 2/28/23 02:37, Arnd Bergmann wrote:
> 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,

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 0/6] pcmcia: separate 16-bit support from cardbus
  2023-03-01  1:13             ` Larry Finger
@ 2023-03-01  8:01               ` Arnd Bergmann
  0 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2023-03-01  8:01 UTC (permalink / raw)
  To: Larry Finger, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Bjorn Helgaas, Florian Fainelli, Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, Netdev

On Wed, Mar 1, 2023, at 02:13, Larry Finger wrote:
> On 2/28/23 02:37, Arnd Bergmann wrote:
>> 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.
>
> 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,

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/6] pccard: remove bcm63xx socket driver
  2023-02-27 21:33   ` Florian Fainelli
@ 2023-03-14  8:53     ` Maxime Bizon
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Bizon @ 2023-03-14  8:53 UTC (permalink / raw)
  To: Florian Fainelli, Arnd Bergmann, Dominik Brodowski, linux-kernel
  Cc: Arnd Bergmann, Bjorn Helgaas, H Hartley Sweeten, Ian Abbott,
	Jakub Kicinski, Kevin Cernekee, Lukas Wunner, Manuel Lauss,
	Oliver Hartkopp, Olof Johansson, Robert Jarzmik, YOKOTA Hiroshi,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-can,
	linux-mips, linux-pci, linux-wireless, netdev


On Mon, 2023-02-27 at 13:33 -0800, Florian Fainelli wrote:

Hello Florian,


> 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.

-- 
Maxime




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-03-14 10:09 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 13:34 [RFC 0/6] pcmcia: separate 16-bit support from cardbus Arnd Bergmann
2023-02-27 13:34 ` [RFC 1/6] pccard: remove bcm63xx socket driver Arnd Bergmann
2023-02-27 21:33   ` Florian Fainelli
2023-03-14  8:53     ` Maxime Bizon
2023-02-27 13:34 ` [RFC 2/6] pccard: split cardbus support from pcmcia Arnd Bergmann
2023-02-27 13:34 ` [RFC 4/6] yenta_socket: remove dead code Arnd Bergmann
2023-02-27 13:34 ` [RFC 5/6] pccard: drop remnants of cardbus support Arnd Bergmann
2023-02-27 13:34 ` [RFC 6/6] pci: hotplug: move cardbus code from drivers/pcmcia Arnd Bergmann
2023-02-27 19:07 ` [RFC 0/6] pcmcia: separate 16-bit support from cardbus Oliver Hartkopp
2023-02-27 19:53   ` Arnd Bergmann
2023-02-27 20:32     ` Oliver Hartkopp
2023-02-27 20:54       ` Marc Kleine-Budde
2023-02-27 20:15 ` Russell King (Oracle)
2023-02-27 21:04   ` Arnd Bergmann
2023-02-28 22:45   ` David Laight
2023-02-28 22:55     ` David Laight
2023-02-27 20:23 ` Larry Finger
2023-02-27 20:38   ` Arnd Bergmann
2023-02-27 20:59     ` Russell King (Oracle)
2023-02-27 21:09     ` Larry Finger
2023-02-27 21:30       ` Arnd Bergmann
2023-02-28  3:57         ` Larry Finger
2023-02-28  8:37           ` Arnd Bergmann
2023-03-01  1:13             ` Larry Finger
2023-03-01  8:01               ` Arnd Bergmann
2023-02-28 21:35 ` Ondrej Zary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).