[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Change usb_lowlevel_init( ) parameters



Hi Alan, more patches :-)

Thanks!

Commit message:

Change specific PCI interface parameters in usb_lowlevel_init( )
function to something more generic through a void pointer to host
controller drivers's private data. Add this parameter to
usb_lowlevel_stop() function too. Add also this void pointer to hcd
private data to the ucdif structure.
Index: sys/usb/src.km/usb.h
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/usb.h,v
retrieving revision 1.9
diff -u -8 -r1.9 usb.h
--- sys/usb/src.km/usb.h	4 Apr 2014 11:38:59 -0000	1.9
+++ sys/usb/src.km/usb.h	5 Apr 2014 09:44:23 -0000
@@ -256,18 +256,18 @@
 
 /* memory */
 //void *usb_malloc(long amount);
 //long usb_free(void *addr);
 //long usb_mem_init(void);
 //void usb_mem_stop(void);
 
 /* low level functions */
-long 		usb_lowlevel_init	(long handle, const struct pci_device_id *ent);
-long 		usb_lowlevel_stop	(void);
+long 		usb_lowlevel_init		(void *ucd_priv);
+long 		usb_lowlevel_stop		(void *ucd_priv);
 
 /* routines */
 void		usb_main		(void *dummy);
 long 		usb_init		(void); /* initialize the USB Controller */
 long 		usb_stop		(void); /* stop the USB Controller */
 
 
 long		usb_set_protocol	(struct usb_device *dev, long ifnum, long protocol);
Index: sys/usb/src.km/ucd/ucd_defs.h
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/ucd_defs.h,v
retrieving revision 1.2
diff -u -8 -r1.2 ucd_defs.h
--- sys/usb/src.km/ucd/ucd_defs.h	4 Feb 2014 09:54:53 -0000	1.2
+++ sys/usb/src.km/ucd/ucd_defs.h	5 Apr 2014 09:44:23 -0000
@@ -40,22 +40,16 @@
  */
 #define LOWLEVEL_INIT		(('U'<< 8) | 0)
 #define LOWLEVEL_STOP		(('U'<< 8) | 1)
 #define SUBMIT_CONTROL_MSG	(('U'<< 8) | 2)
 #define SUBMIT_BULK_MSG		(('U'<< 8) | 3)
 #define SUBMIT_INT_MSG		(('U'<< 8) | 4)
 
 
-struct lowlevel_init
-{
-	long handle;
-	struct pci_device_id *ent;
-};
-
 struct bulk_msg
 {
 	struct usb_device 	*dev;
 	unsigned long 		pipe;
 	void 			*data;
 	long 			len;
 	long                    flags;
 };
@@ -90,18 +84,19 @@
 
 	unsigned short	flags;
 
 	long		(*open)		(struct ucdif *);
 	long		(*close)	(struct ucdif *);
 	long		resrvd1;	/* (*output)  */
 	long		(*ioctl)	(struct ucdif *, short cmd, long arg);
 	long		resrvd2;	/* (*timeout) */
+	void		*ucd_priv;	/* host controller driver private data */
 
-	long		reserved[24];
+	long		reserved[20];
 };
 
 struct ucdinfo
 {
 	short		(*getfreeunit)			(char *);
 	long		(*ucd_register)			(struct ucdif *);
 	long		(*ucd_unregister)		(struct ucdif *);
 
Index: sys/usb/src.km/ucd/aranym/aranym-hcd.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/aranym/aranym-hcd.c,v
retrieving revision 1.3
diff -u -8 -r1.3 aranym-hcd.c
--- sys/usb/src.km/ucd/aranym/aranym-hcd.c	1 Mar 2014 10:46:39 -0000	1.3
+++ sys/usb/src.km/ucd/aranym/aranym-hcd.c	5 Apr 2014 09:44:23 -0000
@@ -277,22 +277,22 @@
 	{
 		case FS_INFO:
 		{
 			*(long *)arg = (((long)VER_MAJOR << 16) | VER_MINOR);
 			break;
 		}
 		case LOWLEVEL_INIT :
 		{
-			ret = usb_lowlevel_init (0, NULL);
+			ret = usb_lowlevel_init (u->ucd_priv);
 			break;
 		}
 		case LOWLEVEL_STOP :
 		{
-			ret = usb_lowlevel_stop ();
+			ret = usb_lowlevel_stop (u->ucd_priv);
 			break;
 		}
 		case SUBMIT_CONTROL_MSG :
 		{
 			struct control_msg *ctrl_msg = (struct control_msg *)arg;
 			
 			ret = submit_control_msg (ctrl_msg->dev, ctrl_msg->pipe,
 			 		    ctrl_msg->data, ctrl_msg->size, ctrl_msg->setup);	
@@ -324,33 +324,33 @@
 	}	
 	return ret;
 }
 
 
 /* --- Init functions ------------------------------------------------------ */
 
 long 
-usb_lowlevel_init(long dummy1, const struct pci_device_id *dummy2)
+usb_lowlevel_init(void *dummy)
 {
 	int r;
 	
 	r = nf_call(USBHOST(USBHOST_LOWLEVEL_INIT));
 
 	if (!r) 
 		(void) Cconws("Aranym USB Controller Driver init \r\n");
 	else
 		(void) Cconws("Couldn't init aranym host chip emulator \r\n");
 
 	return 0;
 }
 
 
 long 
-usb_lowlevel_stop(void)
+usb_lowlevel_stop(void *dummy)
 {
 	int r;
 
 	r = nf_call(USBHOST(USBHOST_LOWLEVEL_STOP));
 
 	return r;
 }
 
Index: sys/usb/src.km/ucd/aranym/aranym.h
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/aranym/aranym.h,v
retrieving revision 1.1
diff -u -8 -r1.1 aranym.h
--- sys/usb/src.km/ucd/aranym/aranym.h	20 Jan 2012 22:37:12 -0000	1.1
+++ sys/usb/src.km/ucd/aranym/aranym.h	5 Apr 2014 09:44:23 -0000
@@ -113,19 +113,19 @@
 	port_t port[NUMBER_OF_PORTS];
 	unsigned char number_of_roothub;
 } roothub_t;
 
 
 /*--- Low level API functions that need to be supported ---*/
 /*
 
-	int usb_lowlevel_init(void)
+	int usb_lowlevel_init(void *ucd_priv)
 
-	int usb_lowlevel_stop(void)
+	int usb_lowlevel_stop(void *ucd_priv)
 
 	int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 				int len, int interval)
 
 	int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 			        int len, struct devrequest *setup)
       
 	int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
Index: sys/usb/src.km/ucd/ethernat/isp116x-hcd.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/ethernat/isp116x-hcd.c,v
retrieving revision 1.6
diff -u -8 -r1.6 isp116x-hcd.c
--- sys/usb/src.km/ucd/ethernat/isp116x-hcd.c	4 Feb 2014 09:54:53 -0000	1.6
+++ sys/usb/src.km/ucd/ethernat/isp116x-hcd.c	5 Apr 2014 09:44:24 -0000
@@ -1747,22 +1747,22 @@
 	{
 		case FS_INFO:
 		{
 			*(long *)arg = (((long)VER_MAJOR << 16) | VER_MINOR);
 			break;
 		}
 		case LOWLEVEL_INIT :
 		{
-			ret = usb_lowlevel_init (0, NULL);
+			ret = usb_lowlevel_init (u->ucd_priv);
 			break;
 		}
 		case LOWLEVEL_STOP :
 		{
-			ret = usb_lowlevel_stop ();
+			ret = usb_lowlevel_stop (u->ucd_priv);
 			break;
 		}
 		case SUBMIT_CONTROL_MSG :
 		{
 			struct control_msg *ctrl_msg = (struct control_msg *)arg;
 
 			ret = submit_control_msg (ctrl_msg->dev, ctrl_msg->pipe,
 						  ctrl_msg->data, ctrl_msg->size,
@@ -1813,17 +1813,17 @@
 		ALERT(("invalid chip ID %04x", val));
 		return -1;
 	}
 
 	return 0;
 }
 
 long
-usb_lowlevel_init(long dummy1, const struct pci_device_id *dummy2)
+usb_lowlevel_init(void *dummy)
 {
 //	unsigned short val;
 
 	struct isp116x *isp116x = &isp116x_dev;
 
 	got_rhsc = rh_devnum = 0;
 
 	/* Init device registers addr */
@@ -1867,17 +1867,17 @@
 
 	isp116x_reset(isp116x);
 	isp116x_start(isp116x);
 
 	return 0;
 }
 
 long
-usb_lowlevel_stop(void)
+usb_lowlevel_stop(void *dummy)
 {
 	struct isp116x *isp116x = &isp116x_dev;
 
 	if (!isp116x->disabled)
 		isp116x_stop(isp116x);
 
 	return 0;
 }
Index: sys/usb/src.km/ucd/netusbee/isp116x-hcd.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/netusbee/isp116x-hcd.c,v
retrieving revision 1.5
diff -u -8 -r1.5 isp116x-hcd.c
--- sys/usb/src.km/ucd/netusbee/isp116x-hcd.c	4 Feb 2014 09:54:53 -0000	1.5
+++ sys/usb/src.km/ucd/netusbee/isp116x-hcd.c	5 Apr 2014 09:44:24 -0000
@@ -1785,22 +1785,22 @@
 	{
 		case FS_INFO:
 		{
 			*(long *)arg = (((long)VER_MAJOR << 16) | VER_MINOR);
 			break;
 		}
 		case LOWLEVEL_INIT :
 		{
-			ret = usb_lowlevel_init (0, NULL);
+			ret = usb_lowlevel_init (u->ucd_priv);
 			break;
 		}
 		case LOWLEVEL_STOP :
 		{
-			ret = usb_lowlevel_stop ();
+			ret = usb_lowlevel_stop (u->ucd_priv);
 			break;
 		}
 		case SUBMIT_CONTROL_MSG :
 		{
 			struct control_msg *ctrl_msg = (struct control_msg *)arg;
 
 			ret = submit_control_msg (ctrl_msg->dev, ctrl_msg->pipe,
 						  ctrl_msg->data, ctrl_msg->size,
@@ -1851,17 +1851,17 @@
 		ALERT(("invalid chip ID %04x", val));
 		return -1;
 	}
 
 	return 0;
 }
 
 long
-usb_lowlevel_init(long dummy1, const struct pci_device_id *dummy2)
+usb_lowlevel_init(void *dummy)
 {
 //	unsigned short val;
 
 	struct isp116x *isp116x = &isp116x_dev;
 
 	got_rhsc = rh_devnum = 0;
 
 	/* Init device registers addr */
@@ -1895,17 +1895,17 @@
 
 	isp116x_reset(isp116x);
 	isp116x_start(isp116x);
 
 	return 0;
 }
 
 long
-usb_lowlevel_stop(void)
+usb_lowlevel_stop(void *dummy)
 {
 	struct isp116x *isp116x = &isp116x_dev;
 
 	if (!isp116x->disabled)
 		isp116x_stop(isp116x);
 
 	return 0;
 }
Index: sys/usb/src.km/ucd/unicorn/sl811-hcd.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/unicorn/sl811-hcd.c,v
retrieving revision 1.7
diff -u -8 -r1.7 sl811-hcd.c
--- sys/usb/src.km/ucd/unicorn/sl811-hcd.c	21 Mar 2014 15:02:52 -0000	1.7
+++ sys/usb/src.km/ucd/unicorn/sl811-hcd.c	5 Apr 2014 09:44:25 -0000
@@ -298,17 +298,17 @@
 
 static inline void
 int_handle_tophalf(PROC *process, long arg)
 {
 	(*uinf->usb_rh_wakeup)();
 }
 
 long
-usb_lowlevel_init(long dummy1, const struct pci_device_id *dummy2)
+usb_lowlevel_init(void *dummy)
 {
 	long r;
 
 	/*
 	 * Check the adapter is functional.
 	 */
 	if (usb_init_atari() != 0)
 	   return -1;
@@ -332,17 +332,17 @@
 	{
 		return -1;
 	}
 
 	return 0;
 }
 
 long 
-usb_lowlevel_stop(void)
+usb_lowlevel_stop(void *dummy)
 {
 	DEBUG(("USB SL811 DISABLED DUE TO LOWLEVEL STOP!"));
 	
 	LOCKUSB;
 	sl811_write_intr(0);
 	sl811_write(SL811_INTRSTS, 0xff);
 	UNLOCKUSB;
 
@@ -987,22 +987,22 @@
 	{
 		case FS_INFO:
 		{
 			*(long *)arg = (((long)VER_MAJOR << 16) | VER_MINOR);
 			break;
 		}
 		case LOWLEVEL_INIT :
 		{
-			ret = usb_lowlevel_init (0, NULL);
+			ret = usb_lowlevel_init (u->ucd_priv);
 			break;
 		}
 		case LOWLEVEL_STOP :
 		{
-			ret = usb_lowlevel_stop ();
+			ret = usb_lowlevel_stop (u->ucd_priv);
 			break;
 		}
 		case SUBMIT_CONTROL_MSG :
 		{
 			struct control_msg *ctrl_msg = (struct control_msg *)arg;
 			ret = submit_control_msg (ctrl_msg->dev, ctrl_msg->pipe,
 			 		    ctrl_msg->data, ctrl_msg->size, ctrl_msg->setup);	
 			break;