]> git.pld-linux.org Git - packages/delkin_cb.git/commitdiff
- Initial version - compiles on 2.6.18.3 and works.
authorlmasko <lmasko@pld-linux.org>
Fri, 12 Jan 2007 20:00:33 +0000 (20:00 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    delkin_cb.c -> 1.1
    delkin_cb.spec -> 1.1

delkin_cb.c [new file with mode: 0644]
delkin_cb.spec [new file with mode: 0644]

diff --git a/delkin_cb.c b/delkin_cb.c
new file mode 100644 (file)
index 0000000..e2672fc
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ *  linux/drivers/ide/pci/delkin_cb.c
+ *
+ *  Created 20 Oct 2004 by Mark Lord
+ *
+ *  Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter
+ *
+ *  Modeled after the 16-bit PCMCIA driver: ide-cs.c
+ *
+ *  This is slightly peculiar, in that it is a PCI driver,
+ *  but is NOT an IDE PCI driver -- the IDE layer does not directly
+ *  support hot insertion/removal of PCI interfaces, so this driver
+ *  is unable to use the IDE PCI interfaces.  Instead, it uses the
+ *  same interfaces as the ide-cs (PCMCIA) driver uses.
+ *  On the plus side, the driver is also smaller/simpler this way.
+ *
+ *  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.
+ */
+#include <linux/autoconf.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <asm/io.h>
+
+/*
+ * No chip documentation has yet been found,
+ * so these configuration values were pulled from
+ * a running Win98 system using "debug".
+ * This gives around 3MByte/second read performance,
+ * which is about 2/3 of what the chip is capable of.
+ *
+ * There is also a 4KByte mmio region on the card,
+ * but its purpose has yet to be reverse-engineered.
+ */
+static const u8 setup[] = {
+       0x00, 0x05, 0xbe, 0x01, 0x20, 0x8f, 0x00, 0x00,
+       0xa4, 0x1f, 0xb3, 0x1b, 0x00, 0x00, 0x00, 0x80,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0xa4, 0x83, 0x02, 0x13,
+};
+
+static int __devinit
+delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
+{
+       unsigned long base;
+       hw_regs_t hw;
+       ide_hwif_t *hwif = NULL;
+       ide_drive_t *drive;
+       int i, rc;
+
+       rc = pci_enable_device(dev);
+       if (rc) {
+               printk(KERN_ERR "delkin_cb: pci_enable_device failed (%d)\n", rc);
+               return rc;
+       }
+       rc = pci_request_regions(dev, "delkin_cb");
+       if (rc) {
+               printk(KERN_ERR "delkin_cb: pci_request_regions failed (%d)\n", rc);
+               pci_disable_device(dev);
+               return rc;
+       }
+       base = pci_resource_start(dev, 0);
+       outb(0x02, base + 0x1e);        /* set nIEN to block interrupts */
+       inb(base + 0x17);               /* read status to clear interrupts */
+       for (i = 0; i < sizeof(setup); ++i) {
+               if (setup[i])
+                       outb(setup[i], base + i);
+       }
+       pci_release_regions(dev);       /* IDE layer handles regions itself */
+
+       memset(&hw, 0, sizeof(hw));
+       ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
+       hw.irq = dev->irq;
+       hw.chipset = ide_pci;           /* this enables IRQ sharing */
+
+       rc = ide_register_hw_with_fixup(&hw, &hwif, ide_undecoded_slave);
+       if (rc < 0) {
+               printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
+               pci_disable_device(dev);
+               return -ENODEV;
+       }
+       pci_set_drvdata(dev, hwif);
+       hwif->pci_dev = dev;
+       drive = &hwif->drives[0];
+       if (drive->present) {
+               drive->io_32bit = 1;
+               drive->unmask   = 1;
+       }
+       return 0;
+}
+
+static void
+delkin_cb_remove (struct pci_dev *dev)
+{
+       ide_hwif_t *hwif = pci_get_drvdata(dev);
+
+       if (hwif)
+               ide_unregister(hwif->index);
+       pci_disable_device(dev);
+}
+
+static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = {
+       { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       { 0, },
+};
+MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl);
+
+static struct pci_driver driver = {
+       .name           = "Delkin-ASKA-Workbit Cardbus IDE",
+       .id_table       = delkin_cb_pci_tbl,
+       .probe          = delkin_cb_probe,
+       .remove         = delkin_cb_remove,
+};
+
+static int
+delkin_cb_init (void)
+{
+       return pci_module_init(&driver);
+}
+
+static void
+delkin_cb_exit (void)
+{
+       pci_unregister_driver(&driver);
+}
+
+module_init(delkin_cb_init);
+module_exit(delkin_cb_exit);
+
+MODULE_AUTHOR("Mark Lord");
+MODULE_DESCRIPTION("Basic support for Delkin/ASKA/Workbit Cardbus IDE");
+MODULE_LICENSE("GPL");
+
diff --git a/delkin_cb.spec b/delkin_cb.spec
new file mode 100644 (file)
index 0000000..3078b63
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# Conditional build:
+%bcond_without dist_kernel     # without kernel from distribution
+%bcond_without up              # don't build UP module
+%bcond_without smp             # don't build SMP module
+%bcond_with    verbose         # verbose build (V=1)
+#
+%define        rel     0.1
+Summary:       Delkin CardBus IDE CompactFlash Adapter driver
+Name:          delkin_cb
+Version:       0.1
+Release:       %{rel}
+License:       GPL
+Group:         Base/Kernel
+Source0:       %{name}.c
+URL:           http://rtr.ca/dell_i9300/kernel/latest/
+%if %{with kernel}
+%{?with_dist_kernel:BuildRequires:     kernel%{_alt_kernel}-module-build}
+%endif
+BuildRequires: rpmbuild(macros) >= 1.330
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Linux kernel driver for Delkin CardBus IDE CompactFlash Adapter
+
+%package -n kernel%{_alt_kernel}-block-delkin_cb
+Summary:       Linux kernel driver for Delkin CardBus IDE CompactFlash Adapter
+Release:       %{rel}@%{_kernel_ver_str}
+Group:         Base/Kernel
+%{?with_dist_kernel:%requires_releq_kernel_up}
+Requires(post,postun): /sbin/depmod
+Requires:      kernel%{_alt_kernel}-pcmcia
+
+%description -n kernel%{_alt_kernel}-block-delkin_cb
+Delkin CardBus IDE CompactFlash Adapter driver
+
+%package -n kernel%{_alt_kernel}-smp-block-delkin_cb
+Summary:       Linux kernel driver for Delkin CardBus IDE CompactFlash Adapter (SMP)
+Release:       %{rel}@%{_kernel_ver_str}
+Group:         Base/Kernel
+%{?with_dist_kernel:%requires_releq_kernel_smp}
+Requires(post,postun): /sbin/depmod
+Requires:      kernel%{_alt_kernel}-smp-pcmcia
+
+%description -n kernel%{_alt_kernel}-smp-block-delkin_cb
+Delkin CardBus IDE CompactFlash Adapter driver (SMP)
+
+%prep
+%setup -q -c -T
+echo 'obj-m += delkin_cb.o' > Makefile
+install %{SOURCE0} delkin_cb.c
+
+%build
+%build_kernel_modules -m delkin_cb
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%install_kernel_modules -m delkin_cb -d kernel/drivers/ide/pci
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -n kernel%{_alt_kernel}-block-delkin_cb
+%depmod %{_kernel_ver}
+
+%postun -n kernel%{_alt_kernel}-block-delkin_cb
+%depmod %{_kernel_ver}
+
+%post -n kernel%{_alt_kernel}-smp-block-delkin_cb
+%depmod %{_kernel_ver}smp
+
+%postun -n kernel%{_alt_kernel}-smp-block-delkin_cb
+%depmod %{_kernel_ver}smp
+
+%if %{with up}
+%files -n kernel%{_alt_kernel}-block-delkin_cb
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/kernel/drivers/ide/pci/delkin_cb.ko.gz
+%endif
+
+%if %{with smp}
+%files -n kernel%{_alt_kernel}-smp-block-delkin_cb
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}smp/kernel/drivers/ide/pci/delkin_cb.ko.gz
+%endif
This page took 0.280805 seconds and 4 git commands to generate.