CH375 ISA-USB block driver for Linux 2.2 ======================================== A Linux 2.2 kernel module for CH375 based ISA to USB boards, ported from FreddyV's DOS driver CH375 V0.22. It lets an old PC (386 and up) read and write a USB mass-storage device - a USB stick, card reader or USB disk - plugged straight into the board. The CH375 chip handles the USB side itself, so no USB support is needed in the kernel. The board has no IRQ; the driver polls the chip. Tested on a Book386 (386SX, 16 MB) with Linux 2.2.26 and a 4 GB stick holding a FAT16 partition. Supported: USB mass storage, one device per board, up to 15 partitions Not supported: hubs, keyboards/mice, printers, network adapters, the 16-bit LoTech board variant Files ----- ch375.c the driver source (block device, major 60) ch375.o the binary driver for Book386 Linux ch375_hw.h CH375 protocol, ported from the DOS driver Makefile builds the module for 2.2.6 and 2.2.26 sim/ch375sim.c userspace chip simulator for testing the protocol code Building -------- You need gcc (2.7.2.3 or egcs 1.1.2 work) and the source of the kernel the module will run on. A module only loads on the kernel version it was built for. 1. Prepare the kernel headers (once). You don't need to build the kernel: cd /usr/src tar xzf linux-2.2.26.tar.gz cd linux-2.2.26 cp arch/i386/defconfig .config Edit .config so that these lines read: CONFIG_M386=y # CONFIG_M686 is not set # CONFIG_SMP is not set If you have your kernel's own .config, use it instead. Then run: yes "" | make oldconfig make symlinks include/linux/version.h 2. Build the module: cd ch375-linux make ch375-2.2.26.o # for a 2.2.26 kernel make ch375.o # for a 2.2.6 kernel (/usr/src/linux) make test # optional: run the simulator test Or by hand, for any 2.2 kernel tree: gcc -D__KERNEL__ -DMODULE -I/usr/src/linux-2.2.26/include \ -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ -fno-strength-reduce -pipe -m386 -DCPU=386 \ -c ch375.c -o ch375-2.2.26.o Usage ----- 1. Plug in the USB device, then load the module: insmod ch375-2.2.26.o io=0x260 dmesg should show the chip, the disk size and the partitions, e.g.: ch375: chip version 0xb7 at 0x260, bus mode 2, ... (built for 2.2.26) ch375a: 7946240 sectors (3880 MB) ch375a: ch375a1 ch375a2 2. Create the device files (once; Linux 2.2 does not create them for you): mknod /dev/ch375a b 60 0 # whole device mknod /dev/ch375a1 b 60 1 # partition 1 mknod /dev/ch375a2 b 60 2 # partition 2 (and so on up to 15) 3. Mount a partition: mkdir -p /mnt/usb mount -t msdos /dev/ch375a1 /mnt/usb # or -t vfat for long names 4. Before unplugging the device or unloading the module: umount /mnt/usb rmmod ch375 Module options: io=0x260 I/O base of the board (data port; command port is io+1) speed=0 extra delay per port access, like the DOS driver's % option; raise it if transfers are unreliable sectors=N disk size in 512-byte sectors, if the device reports it wrongly To load it at boot, copy the module to /lib/modules/2.2.26/block/ch375.o and add "insmod ch375 io=0x260" and the mount command to /etc/rc on the Book386 However the USB stick must be attached to the USB port, otherwise you need to load it manually !