aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/yenta_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/yenta_socket.c')
-rw-r--r--drivers/pcmcia/yenta_socket.c86
1 files changed, 47 insertions, 39 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 0ab1fb65cdc3..3ecd7c99d8eb 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -38,11 +38,7 @@ static int pwr_irqs_off;
38module_param(pwr_irqs_off, bool, 0644); 38module_param(pwr_irqs_off, bool, 0644);
39MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!"); 39MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!");
40 40
41#if 0 41#define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args)
42#define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args)
43#else
44#define debug(x,args...)
45#endif
46 42
47/* Don't ask.. */ 43/* Don't ask.. */
48#define to_cycles(ns) ((ns)/120) 44#define to_cycles(ns) ((ns)/120)
@@ -69,13 +65,13 @@ MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation");
69static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg) 65static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg)
70{ 66{
71 u32 val = readl(socket->base + reg); 67 u32 val = readl(socket->base + reg);
72 debug("%p %04x %08x\n", socket, reg, val); 68 debug("%04x %08x\n", socket, reg, val);
73 return val; 69 return val;
74} 70}
75 71
76static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val) 72static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val)
77{ 73{
78 debug("%p %04x %08x\n", socket, reg, val); 74 debug("%04x %08x\n", socket, reg, val);
79 writel(val, socket->base + reg); 75 writel(val, socket->base + reg);
80 readl(socket->base + reg); /* avoid problems with PCI write posting */ 76 readl(socket->base + reg); /* avoid problems with PCI write posting */
81} 77}
@@ -84,7 +80,7 @@ static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
84{ 80{
85 u8 val; 81 u8 val;
86 pci_read_config_byte(socket->dev, offset, &val); 82 pci_read_config_byte(socket->dev, offset, &val);
87 debug("%p %04x %02x\n", socket, offset, val); 83 debug("%04x %02x\n", socket, offset, val);
88 return val; 84 return val;
89} 85}
90 86
@@ -92,7 +88,7 @@ static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
92{ 88{
93 u16 val; 89 u16 val;
94 pci_read_config_word(socket->dev, offset, &val); 90 pci_read_config_word(socket->dev, offset, &val);
95 debug("%p %04x %04x\n", socket, offset, val); 91 debug("%04x %04x\n", socket, offset, val);
96 return val; 92 return val;
97} 93}
98 94
@@ -100,32 +96,32 @@ static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
100{ 96{
101 u32 val; 97 u32 val;
102 pci_read_config_dword(socket->dev, offset, &val); 98 pci_read_config_dword(socket->dev, offset, &val);
103 debug("%p %04x %08x\n", socket, offset, val); 99 debug("%04x %08x\n", socket, offset, val);
104 return val; 100 return val;
105} 101}
106 102
107static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val) 103static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val)
108{ 104{
109 debug("%p %04x %02x\n", socket, offset, val); 105 debug("%04x %02x\n", socket, offset, val);
110 pci_write_config_byte(socket->dev, offset, val); 106 pci_write_config_byte(socket->dev, offset, val);
111} 107}
112 108
113static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val) 109static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val)
114{ 110{
115 debug("%p %04x %04x\n", socket, offset, val); 111 debug("%04x %04x\n", socket, offset, val);
116 pci_write_config_word(socket->dev, offset, val); 112 pci_write_config_word(socket->dev, offset, val);
117} 113}
118 114
119static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val) 115static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val)
120{ 116{
121 debug("%p %04x %08x\n", socket, offset, val); 117 debug("%04x %08x\n", socket, offset, val);
122 pci_write_config_dword(socket->dev, offset, val); 118 pci_write_config_dword(socket->dev, offset, val);
123} 119}
124 120
125static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg) 121static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg)
126{ 122{
127 u8 val = readb(socket->base + 0x800 + reg); 123 u8 val = readb(socket->base + 0x800 + reg);
128 debug("%p %04x %02x\n", socket, reg, val); 124 debug("%04x %02x\n", socket, reg, val);
129 return val; 125 return val;
130} 126}
131 127
@@ -134,20 +130,20 @@ static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
134 u16 val; 130 u16 val;
135 val = readb(socket->base + 0x800 + reg); 131 val = readb(socket->base + 0x800 + reg);
136 val |= readb(socket->base + 0x800 + reg + 1) << 8; 132 val |= readb(socket->base + 0x800 + reg + 1) << 8;
137 debug("%p %04x %04x\n", socket, reg, val); 133 debug("%04x %04x\n", socket, reg, val);
138 return val; 134 return val;
139} 135}
140 136
141static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val) 137static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val)
142{ 138{
143 debug("%p %04x %02x\n", socket, reg, val); 139 debug("%04x %02x\n", socket, reg, val);
144 writeb(val, socket->base + 0x800 + reg); 140 writeb(val, socket->base + 0x800 + reg);
145 readb(socket->base + 0x800 + reg); /* PCI write posting... */ 141 readb(socket->base + 0x800 + reg); /* PCI write posting... */
146} 142}
147 143
148static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val) 144static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val)
149{ 145{
150 debug("%p %04x %04x\n", socket, reg, val); 146 debug("%04x %04x\n", socket, reg, val);
151 writeb(val, socket->base + 0x800 + reg); 147 writeb(val, socket->base + 0x800 + reg);
152 writeb(val >> 8, socket->base + 0x800 + reg + 1); 148 writeb(val >> 8, socket->base + 0x800 + reg + 1);
153 149
@@ -207,7 +203,7 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
207 203
208 204
209 if (state & CB_CBCARD) { 205 if (state & CB_CBCARD) {
210 val |= SS_CARDBUS; 206 val |= SS_CARDBUS;
211 val |= (state & CB_CARDSTS) ? SS_STSCHG : 0; 207 val |= (state & CB_CARDSTS) ? SS_STSCHG : 0;
212 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT; 208 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT;
213 val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0; 209 val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0;
@@ -650,8 +646,10 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
650 root = pci_find_parent_resource(socket->dev, res); 646 root = pci_find_parent_resource(socket->dev, res);
651 if (root && (request_resource(root, res) == 0)) 647 if (root && (request_resource(root, res) == 0))
652 return 0; 648 return 0;
653 printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", 649 dev_printk(KERN_INFO, &socket->dev->dev,
654 pci_name(socket->dev), nr); 650 "Preassigned resource %d busy or not available, "
651 "reconfiguring...\n",
652 nr);
655 } 653 }
656 654
657 if (type & IORESOURCE_IO) { 655 if (type & IORESOURCE_IO) {
@@ -674,8 +672,9 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
674 return 1; 672 return 1;
675 } 673 }
676 674
677 printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", 675 dev_printk(KERN_INFO, &socket->dev->dev,
678 pci_name(socket->dev), type); 676 "no resource of type %x available, trying to continue...\n",
677 type);
679 res->start = res->end = res->flags = 0; 678 res->start = res->end = res->flags = 0;
680 return 0; 679 return 0;
681} 680}
@@ -923,7 +922,8 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
923 socket->probe_status = 0; 922 socket->probe_status = 0;
924 923
925 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) { 924 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) {
926 printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); 925 dev_printk(KERN_WARNING, &socket->dev->dev,
926 "request_irq() in yenta_probe_cb_irq() failed!\n");
927 return -1; 927 return -1;
928 } 928 }
929 929
@@ -960,8 +960,9 @@ static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_i
960 else 960 else
961 socket->socket.irq_mask = 0; 961 socket->socket.irq_mask = 0;
962 962
963 printk(KERN_INFO "Yenta: ISA IRQ mask 0x%04x, PCI irq %d\n", 963 dev_printk(KERN_INFO, &socket->dev->dev,
964 socket->socket.irq_mask, socket->cb_irq); 964 "ISA IRQ mask 0x%04x, PCI irq %d\n",
965 socket->socket.irq_mask, socket->cb_irq);
965} 966}
966 967
967/* 968/*
@@ -1051,8 +1052,9 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1051 1052
1052 /* Show that the wanted subordinate number is not possible: */ 1053 /* Show that the wanted subordinate number is not possible: */
1053 if (cardbus_bridge->subordinate > upper_limit) 1054 if (cardbus_bridge->subordinate > upper_limit)
1054 printk(KERN_WARNING "Yenta: Upper limit for fixing this " 1055 dev_printk(KERN_WARNING, &cardbus_bridge->dev,
1055 "bridge's parent bridge: #%02x\n", upper_limit); 1056 "Upper limit for fixing this "
1057 "bridge's parent bridge: #%02x\n", upper_limit);
1056 1058
1057 /* If we have room to increase the bridge's subordinate number, */ 1059 /* If we have room to increase the bridge's subordinate number, */
1058 if (bridge_to_fix->subordinate < upper_limit) { 1060 if (bridge_to_fix->subordinate < upper_limit) {
@@ -1061,10 +1063,11 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1061 unsigned char subordinate_to_assign = 1063 unsigned char subordinate_to_assign =
1062 min(cardbus_bridge->subordinate, upper_limit); 1064 min(cardbus_bridge->subordinate, upper_limit);
1063 1065
1064 printk(KERN_INFO "Yenta: Raising subordinate bus# of parent " 1066 dev_printk(KERN_INFO, &bridge_to_fix->dev,
1065 "bus (#%02x) from #%02x to #%02x\n", 1067 "Raising subordinate bus# of parent "
1066 bridge_to_fix->number, 1068 "bus (#%02x) from #%02x to #%02x\n",
1067 bridge_to_fix->subordinate, subordinate_to_assign); 1069 bridge_to_fix->number,
1070 bridge_to_fix->subordinate, subordinate_to_assign);
1068 1071
1069 /* Save the new subordinate in the bus struct of the bridge */ 1072 /* Save the new subordinate in the bus struct of the bridge */
1070 bridge_to_fix->subordinate = subordinate_to_assign; 1073 bridge_to_fix->subordinate = subordinate_to_assign;
@@ -1091,8 +1094,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1091 * Bail out if so. 1094 * Bail out if so.
1092 */ 1095 */
1093 if (!dev->subordinate) { 1096 if (!dev->subordinate) {
1094 printk(KERN_ERR "Yenta: no bus associated with %s! " 1097 dev_printk(KERN_ERR, &dev->dev, "no bus associated! "
1095 "(try 'pci=assign-busses')\n", pci_name(dev)); 1098 "(try 'pci=assign-busses')\n");
1096 return -ENODEV; 1099 return -ENODEV;
1097 } 1100 }
1098 1101
@@ -1127,7 +1130,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1127 goto disable; 1130 goto disable;
1128 1131
1129 if (!pci_resource_start(dev, 0)) { 1132 if (!pci_resource_start(dev, 0)) {
1130 printk(KERN_ERR "No cardbus resource!\n"); 1133 dev_printk(KERN_ERR, &dev->dev, "No cardbus resource!\n");
1131 ret = -ENODEV; 1134 ret = -ENODEV;
1132 goto release; 1135 goto release;
1133 } 1136 }
@@ -1146,8 +1149,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1146 * report the subsystem vendor and device for help debugging 1149 * report the subsystem vendor and device for help debugging
1147 * the irq stuff... 1150 * the irq stuff...
1148 */ 1151 */
1149 printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n", 1152 dev_printk(KERN_INFO, &dev->dev, "CardBus bridge found [%04x:%04x]\n",
1150 pci_name(dev), dev->subsystem_vendor, dev->subsystem_device); 1153 dev->subsystem_vendor, dev->subsystem_device);
1151 1154
1152 yenta_config_init(socket); 1155 yenta_config_init(socket);
1153 1156
@@ -1179,8 +1182,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1179 socket->poll_timer.data = (unsigned long)socket; 1182 socket->poll_timer.data = (unsigned long)socket;
1180 socket->poll_timer.expires = jiffies + HZ; 1183 socket->poll_timer.expires = jiffies + HZ;
1181 add_timer(&socket->poll_timer); 1184 add_timer(&socket->poll_timer);
1182 printk(KERN_INFO "Yenta: no PCI IRQ, CardBus support disabled for this socket.\n" 1185 dev_printk(KERN_INFO, &dev->dev,
1183 KERN_INFO "Yenta: check your BIOS CardBus, BIOS IRQ or ACPI settings.\n"); 1186 "no PCI IRQ, CardBus support disabled for this "
1187 "socket.\n");
1188 dev_printk(KERN_INFO, &dev->dev,
1189 "check your BIOS CardBus, BIOS IRQ or ACPI "
1190 "settings.\n");
1184 } else { 1191 } else {
1185 socket->socket.features |= SS_CAP_CARDBUS; 1192 socket->socket.features |= SS_CAP_CARDBUS;
1186 } 1193 }
@@ -1188,7 +1195,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1188 /* Figure out what the dang thing can do for the PCMCIA layer... */ 1195 /* Figure out what the dang thing can do for the PCMCIA layer... */
1189 yenta_interrogate(socket); 1196 yenta_interrogate(socket);
1190 yenta_get_socket_capabilities(socket, isa_interrupts); 1197 yenta_get_socket_capabilities(socket, isa_interrupts);
1191 printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); 1198 dev_printk(KERN_INFO, &dev->dev,
1199 "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE));
1192 1200
1193 yenta_fixup_parent_bridge(dev->subordinate); 1201 yenta_fixup_parent_bridge(dev->subordinate);
1194 1202