Subject: Re: Help required for porting ISP1362 usb device driver

From: Clemens Koller <[email-masked]>
Date: Fri, 13 Jul 2007 22:27:32 +0200

Don't remove the list, use "reply-to-all".

Vikram Kone schrieb:
> Hi Clemens..
> Thanks for replying..
> 
> The problem that I actually have is..
> The documentation that I got with the device and host controller drivers is
> based on kernel 2.6.6 so I'm not sure whther it works for 2.6.22 or not....
> I followed the instructions in that document and was able to compile to
> modules by running 'make' command in the folder. That's all fine. 
> But the problem is....as I said I'm working on the MPC8548 board by free
> scale and as you know its based on power pc architecture.

> I have attched the device driver files that I got from sourceforge.net

You don't need to attach drivers, when they are somewhere in the
web. Linking to it is fine.
I don't have the hardware and such an old kernel.
(I am using the ISP1563 on PCI and that works just fine.)

The driver is not in the kernel tree. There is no real support
for out of kernel drivers, so these drivers just get old and broken.
Contact the driver author mentioned in the code (Marlon Jose Masbad)
and tell him to push the code into the latest kernel.

> What I did was... Unzipped them and copied the folders in
> /usr/src/linux-2.6.10/drivers/usb 

I prefer not riding dead horses. ;-)

> As you can see the two folders that I have got are ISP1362_Device and
> ISP1362_Host
 >
> When I run 'make' in the Device folder I get the following error
> 
> bash-2.05b$ make
> make -C
> /ws/vkone/usb/Vendor/linux-2.6.10/drivers/usb/ISP1362_Device/device/diskemu
> make[1]: Entering directory
> `/auto/wsvkone/usb/Vendor/linux-2.6.10/drivers/usb/ISP1362_Device/device/dis
> kemu'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory
> `/auto/wsvkone/usb/Vendor/linux-2.6.10/drivers/usb/ISP1362_Device/device/dis
> kemu'
> make -C /ws/vkone/usb/Vendor/linux-2.6.10
> M=/ws/vkone/usb/Vendor/linux-2.6.10/drivers/usb/ISP1362_Device
> make[1]: Entering directory `/auto/wsvkone/usb/Vendor/linux-2.6.10'
> Makefile:531: /auto/wsvkone/usb/Vendor/linux-2.6.10/arch/i386/Makefile: No
> such file or directory
> make[1]: *** No rule to make target
> `/auto/wsvkone/usb/Vendor/linux-2.6.10/arch/i386/Makefile'.  Stop.
> make[1]: Leaving directory `/auto/wsvkone/usb/Vendor/linux-2.6.10'
> make: *** [all] Error 2
> bash-2.05b$
> 
> 
> I guess this is due to the 'arch' problem. I mean since there is no i386
> folder in the arch directory I guess its messing up. 
> 
> Can you help me now

Have you tried
$ export ARCH=ppc
or something similar?
(powerpc is current)

On my MPC8540 and the latest tools (than one still on ARCH=ppc), I ran into some crap:

/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/devmscd.c:35:26: error: linux/config.h: No such file or directory
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/devmscd.c:61:25: error: asm/segment.h: No such file or directory

So, well, just out of curiosity, I just killed some of the bad stuff and got it to build... :-)

$ make
make -C /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu
make[1]: Entering directory `/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu'
cc  -I../devmscd -D_8MB_SIZE_ -c disk_emu.c
cc -g -s -o msdisk disk_emu.o
make[1]: Leaving directory `/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu'
make -C /usr/src/linux-2.6.21.5 M=/usr/src/linux-2.6.21.5/drivers/ISP1362_Device
make[1]: Entering directory `/usr/src/linux-2.6.21.5'
   LD      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/built-in.o
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/devmscd.o
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/msbridge.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/mscd.o
   LD      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/built-in.o
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.o
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c: In function 'pdc_dev_control':
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c:313: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c: In function 'rx_command':
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c:647: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c: In function 'pdc_get_frame_number':
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/usb_pdc.c:851: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc_bus.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc.o
   LD      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/built-in.o
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.o
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.c: In function 'isp1362_request_irq':
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.c:724: warning: passing argument 2 of 'request_irq' from incompatible pointer type
   Building modules, stage 2.
   MODPOST 3 modules
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/mscd.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/mscd.ko
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc.ko
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.ko
make[1]: Leaving directory `/usr/src/linux-2.6.21.5'
root@fox:/usr/src/linux-2.6.21.5/drivers/ISP1362_Device$ make
make -C /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu
make[1]: Entering directory `/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/diskemu'
make -C /usr/src/linux-2.6.21.5 M=/usr/src/linux-2.6.21.5/drivers/ISP1362_Device
make[1]: Entering directory `/usr/src/linux-2.6.21.5'
   CC [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.o
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.c: In function 'isp1362_request_irq':
/usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.c:724: warning: passing argument 2 of 'request_irq' from incompatible pointer type
   Building modules, stage 2.
   MODPOST 3 modules
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/mscd.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/devmscd/mscd.ko
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/device/pdc/pdc.ko
   CC      /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.mod.o
   LD [M]  /usr/src/linux-2.6.21.5/drivers/ISP1362_Device/x86pci/hal_pci.ko
make[1]: Leaving directory `/usr/src/linux-2.6.21.5'

Quick and dirty patch attached below...
Give it a try and publish your results (also to the list!)

Anybody who wants to see this in mainline?
It would be good to pick up *now*!
For sure it needs more clean up...

Regards,
-- 
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
diff -Nurp ISP1362_Device/Makefile ISP1362_Device.fixed/Makefile
--- ISP1362_Device/Makefile	2006-09-25 11:37:29.000000000 +0200
+++ ISP1362_Device.fixed/Makefile	2007-07-13 22:04:53.000000000 +0200
@@ -1,5 +1,5 @@
 TOPDIR=$(shell pwd)
-KERNEL_DIR=/usr/src/linux-2.6.6
+KERNEL_DIR=/usr/src/linux-2.6.21.5
 export $(KERNEL_DIR)
 
 obj-m += x86pci/
diff -Nurp ISP1362_Device/device/devmscd/devmscd.c ISP1362_Device.fixed/device/devmscd/devmscd.c
--- ISP1362_Device/device/devmscd/devmscd.c	2006-09-25 11:32:21.000000000 +0200
+++ ISP1362_Device.fixed/device/devmscd/devmscd.c	2007-07-13 22:08:48.000000000 +0200
@@ -32,10 +32,6 @@
  *
  ***********************************************************************/
 
-#include <linux/config.h>
-#ifdef LINUX_24
-#define	MODULE
-#endif
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
@@ -50,20 +46,14 @@
 #include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/init.h>
-#ifdef LINUX_24
-#include <linux/tqueue.h>
-#else
 #include <linux/workqueue.h>
-#endif
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/segment.h>
 #include <asm/io.h>
 #include <linux/proc_fs.h>
 #include <linux/poll.h>
 
-
 #include "pdc_intf.h"
 #include "devmscd.h"
 #include "mscdbridge.h"
diff -Nurp ISP1362_Device/device/devmscd/msbridge.c ISP1362_Device.fixed/device/devmscd/msbridge.c
--- ISP1362_Device/device/devmscd/msbridge.c	2006-09-25 11:32:21.000000000 +0200
+++ ISP1362_Device.fixed/device/devmscd/msbridge.c	2007-07-13 22:09:46.000000000 +0200
@@ -30,17 +30,12 @@
  * 09/25/06		MMASBAD					Released with GPL
  * 
  ***********************************************************************/
-#include <linux/config.h>
-#ifdef LINUX_24
-#define	MODULE
-#endif
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/sched.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/errno.h>
Binary files ISP1362_Device/device/diskemu/msdisk and ISP1362_Device.fixed/device/diskemu/msdisk differ
diff -Nurp ISP1362_Device/device/pdc/pdc_bus.c ISP1362_Device.fixed/device/pdc/pdc_bus.c
--- ISP1362_Device/device/pdc/pdc_bus.c	2006-09-25 11:32:22.000000000 +0200
+++ ISP1362_Device.fixed/device/pdc/pdc_bus.c	2007-07-13 22:11:04.000000000 +0200
@@ -31,10 +31,6 @@
  * 09/20/06		MMASBAD					Added Interface-based debugging options
  * 09/25/06		MMASBAD					Released with GPL
  ***********************************************************************/
-#include <linux/config.h>
-#ifdef LINUX_24
-#define MODULE
-#endif
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
@@ -49,15 +45,10 @@
 #include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/init.h>
-#ifdef LINUX_24
-#include <linux/tqueue.h>
-#else
 #include <linux/workqueue.h>
-#endif
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/segment.h>
 #include <asm/io.h>
 #include <linux/proc_fs.h>
 #include <linux/poll.h>
diff -Nurp ISP1362_Device/device/pdc/usb_pdc.c ISP1362_Device.fixed/device/pdc/usb_pdc.c
--- ISP1362_Device/device/pdc/usb_pdc.c	2006-09-25 11:44:02.000000000 +0200
+++ ISP1362_Device.fixed/device/pdc/usb_pdc.c	2007-07-13 22:10:29.000000000 +0200
@@ -52,10 +52,6 @@
  *
  */
 
-#include <linux/config.h>
-#ifdef LINUX_24
-#define MODULE
-#endif
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
@@ -70,14 +66,9 @@
 #include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/init.h>
-#ifdef LINUX_24
-#include <linux/tqueue.h>
-#else
 #include <linux/workqueue.h>
-#endif
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/segment.h>
 #include <asm/io.h>
 #include <linux/proc_fs.h>
 #include <linux/poll.h>
diff -Nurp ISP1362_Device/x86pci/hal_pci.c ISP1362_Device.fixed/x86pci/hal_pci.c
--- ISP1362_Device/x86pci/hal_pci.c	2006-09-25 11:32:22.000000000 +0200
+++ ISP1362_Device.fixed/x86pci/hal_pci.c	2007-07-13 22:11:32.000000000 +0200
@@ -30,10 +30,6 @@
  * 09/25/06		MMASBAD					Released with GPL
  *
  ***********************************************************************/
-#include <linux/config.h>
-#ifdef LINUX_24
-#define	MODULE
-#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>