hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/arm/mach-rpc/ecard.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/kernel/ecard.c
34 *
45 * Copyright 1995-2001 Russell King
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 *
107 * Find all installed expansion cards, and handle interrupts from them.
118 *
....@@ -66,21 +63,25 @@
6663 struct completion *complete;
6764 };
6865
69
-struct expcard_blacklist {
66
+struct expcard_quirklist {
7067 unsigned short manufacturer;
7168 unsigned short product;
7269 const char *type;
70
+ void (*init)(ecard_t *ec);
7371 };
7472
7573 static ecard_t *cards;
7674 static ecard_t *slot_to_expcard[MAX_ECARDS];
7775 static unsigned int ectcr;
7876
77
+static void atomwide_3p_quirk(ecard_t *ec);
78
+
7979 /* List of descriptions of cards which don't have an extended
8080 * identification, or chunk directories containing a description.
8181 */
82
-static struct expcard_blacklist __initdata blacklist[] = {
83
- { MANU_ACORN, PROD_ACORN_ETHER1, "Acorn Ether1" }
82
+static struct expcard_quirklist quirklist[] __initdata = {
83
+ { MANU_ACORN, PROD_ACORN_ETHER1, "Acorn Ether1" },
84
+ { MANU_ATOMWIDE, PROD_ATOMWIDE_3PSERIAL, NULL, atomwide_3p_quirk },
8485 };
8586
8687 asmlinkage extern int
....@@ -496,18 +497,21 @@
496497 printk("Expansion card IRQ state:\n");
497498
498499 for (ec = cards; ec; ec = ec->next) {
500
+ const char *claimed;
501
+
499502 if (ec->slot_no == 8)
500503 continue;
501504
502
- printk(" %d: %sclaimed, ",
503
- ec->slot_no, ec->claimed ? "" : "not ");
505
+ claimed = ec->claimed ? "" : "not ";
504506
505507 if (ec->ops && ec->ops->irqpending &&
506508 ec->ops != &ecard_default_ops)
507
- printk("irq %spending\n",
509
+ printk(" %d: %sclaimed irq %spending\n",
510
+ ec->slot_no, claimed,
508511 ec->ops->irqpending(ec) ? "" : "not ");
509512 else
510
- printk("irqaddr %p, mask = %02X, status = %02X\n",
513
+ printk(" %d: %sclaimed irqaddr %p, mask = %02X, status = %02X\n",
514
+ ec->slot_no, claimed,
511515 ec->irqaddr, ec->irqmask, readb(ec->irqaddr));
512516 }
513517 }
....@@ -868,6 +872,16 @@
868872 }
869873 EXPORT_SYMBOL(ecardm_iomap);
870874
875
+static void atomwide_3p_quirk(ecard_t *ec)
876
+{
877
+ void __iomem *addr = __ecard_address(ec, ECARD_IOC, ECARD_SYNC);
878
+ unsigned int i;
879
+
880
+ /* Disable interrupts on each port */
881
+ for (i = 0x2000; i <= 0x2800; i += 0x0400)
882
+ writeb(0, addr + i + 4);
883
+}
884
+
871885 /*
872886 * Probe for an expansion card.
873887 *
....@@ -921,10 +935,13 @@
921935 ec->fiqmask = 4;
922936 }
923937
924
- for (i = 0; i < ARRAY_SIZE(blacklist); i++)
925
- if (blacklist[i].manufacturer == ec->cid.manufacturer &&
926
- blacklist[i].product == ec->cid.product) {
927
- ec->card_desc = blacklist[i].type;
938
+ for (i = 0; i < ARRAY_SIZE(quirklist); i++)
939
+ if (quirklist[i].manufacturer == ec->cid.manufacturer &&
940
+ quirklist[i].product == ec->cid.product) {
941
+ if (quirklist[i].type)
942
+ ec->card_desc = quirklist[i].type;
943
+ if (quirklist[i].init)
944
+ quirklist[i].init(ec);
928945 break;
929946 }
930947