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.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index db9f952f9e3c..ec6ab65f0872 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -151,6 +151,40 @@ static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val)
151 readb(socket->base + 0x800 + reg + 1); 151 readb(socket->base + 0x800 + reg + 1);
152} 152}
153 153
154static ssize_t show_yenta_registers(struct device *yentadev, struct device_attribute *attr, char *buf)
155{
156 struct pci_dev *dev = to_pci_dev(yentadev);
157 struct yenta_socket *socket = pci_get_drvdata(dev);
158 int offset = 0, i;
159
160 offset = snprintf(buf, PAGE_SIZE, "CB registers:");
161 for (i = 0; i < 0x24; i += 4) {
162 unsigned val;
163 if (!(i & 15))
164 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n%02x:", i);
165 val = cb_readl(socket, i);
166 offset += snprintf(buf + offset, PAGE_SIZE - offset, " %08x", val);
167 }
168
169 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n\nExCA registers:");
170 for (i = 0; i < 0x45; i++) {
171 unsigned char val;
172 if (!(i & 7)) {
173 if (i & 8) {
174 memcpy(buf + offset, " -", 2);
175 offset += 2;
176 } else
177 offset += snprintf(buf + offset, PAGE_SIZE - offset, "\n%02x:", i);
178 }
179 val = exca_readb(socket, i);
180 offset += snprintf(buf + offset, PAGE_SIZE - offset, " %02x", val);
181 }
182 buf[offset++] = '\n';
183 return offset;
184}
185
186static DEVICE_ATTR(yenta_registers, S_IRUSR, show_yenta_registers, NULL);
187
154/* 188/*
155 * Ugh, mixed-mode cardbus and 16-bit pccard state: things depend 189 * Ugh, mixed-mode cardbus and 16-bit pccard state: things depend
156 * on what kind of card is inserted.. 190 * on what kind of card is inserted..
@@ -765,6 +799,9 @@ static void yenta_close(struct pci_dev *dev)
765{ 799{
766 struct yenta_socket *sock = pci_get_drvdata(dev); 800 struct yenta_socket *sock = pci_get_drvdata(dev);
767 801
802 /* Remove the register attributes */
803 device_remove_file(&dev->dev, &dev_attr_yenta_registers);
804
768 /* we don't want a dying socket registered */ 805 /* we don't want a dying socket registered */
769 pcmcia_unregister_socket(&sock->socket); 806 pcmcia_unregister_socket(&sock->socket);
770 807
@@ -1138,8 +1175,11 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1138 1175
1139 /* Register it with the pcmcia layer.. */ 1176 /* Register it with the pcmcia layer.. */
1140 ret = pcmcia_register_socket(&socket->socket); 1177 ret = pcmcia_register_socket(&socket->socket);
1141 if (ret == 0) 1178 if (ret == 0) {
1179 /* Add the yenta register attributes */
1180 device_create_file(&dev->dev, &dev_attr_yenta_registers);
1142 goto out; 1181 goto out;
1182 }
1143 1183
1144 unmap: 1184 unmap:
1145 iounmap(socket->base); 1185 iounmap(socket->base);