Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 	backpack.c (c) 2001 Micro Solutions Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 		Released under the terms of the GNU General Public license
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 	backpack.c is a low-level protocol driver for the Micro Solutions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 		"BACKPACK" parallel port IDE adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 		(Works on Series 6 drives)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 	Written by: Ken Hahn     (linux-dev@micro-solutions.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	            Clive Turvey (linux-dev@micro-solutions.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)    This is Ken's linux wrapper for the PPC library
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)    Version 1.0.0 is the backpack driver for which source is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)    Version 2.0.0 is the first to have source released 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)    Version 2.0.1 is the "Cox-ified" source code 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)    Version 2.0.2 - fixed version string usage, and made ppc functions static 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define BACKPACK_VERSION "2.0.2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/parport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "ppc6lnx.c"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include "paride.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /* PARAMETERS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static bool verbose; /* set this to 1 to see debugging messages and whatnot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define PPCSTRUCT(pi) ((Interface *)(pi->private))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) /****************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  ATAPI CDROM DRIVE REGISTERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define ATAPI_DATA       0      /* data port                  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define ATAPI_ERROR      1      /* error register (read)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define ATAPI_FEATURES   1      /* feature register (write)   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define ATAPI_INT_REASON 2      /* interrupt reason register  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define ATAPI_COUNT_LOW  4      /* byte count register (low)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define ATAPI_COUNT_HIGH 5      /* byte count register (high) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define ATAPI_DRIVE_SEL  6      /* drive select register      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define ATAPI_STATUS     7      /* status port (read)         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define ATAPI_COMMAND    7      /* command port (write)       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define ATAPI_ALT_STATUS 0x0e /* alternate status reg (read) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define ATAPI_DEVICE_CONTROL 0x0e /* device control (write)   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /****************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static int bpck6_read_regr(PIA *pi, int cont, int reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	unsigned int out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/* check for bad settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (reg<0 || reg>7 || cont<0 || cont>2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		return(-1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	out=ppc6_rd_port(PPCSTRUCT(pi),cont?reg|8:reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	return(out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static void bpck6_write_regr(PIA *pi, int cont, int reg, int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	/* check for bad settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	if (reg>=0 && reg<=7 && cont>=0 && cont<=1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		ppc6_wr_port(PPCSTRUCT(pi),cont?reg|8:reg,(u8)val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static void bpck6_write_block( PIA *pi, char * buf, int len )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	ppc6_wr_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static void bpck6_read_block( PIA *pi, char * buf, int len )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	ppc6_rd_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static void bpck6_connect ( PIA *pi  )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		printk(KERN_DEBUG "connect\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if(pi->mode >=2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)   	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		PPCSTRUCT(pi)->mode=4+pi->mode-2;	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	else if(pi->mode==1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		PPCSTRUCT(pi)->mode=3;	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		PPCSTRUCT(pi)->mode=1;		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	ppc6_open(PPCSTRUCT(pi));  
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	ppc6_wr_extout(PPCSTRUCT(pi),0x3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static void bpck6_disconnect ( PIA *pi )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		printk("disconnect\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	ppc6_wr_extout(PPCSTRUCT(pi),0x0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	ppc6_close(PPCSTRUCT(pi));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static int bpck6_test_port ( PIA *pi )   /* check for 8-bit port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		printk(KERN_DEBUG "PARPORT indicates modes=%x for lp=0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)                		((struct pardevice*)(pi->pardev))->port->modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			((struct pardevice *)(pi->pardev))->port->base); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	/*copy over duplicate stuff.. initialize state info*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	PPCSTRUCT(pi)->ppc_id=pi->unit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	PPCSTRUCT(pi)->lpt_addr=pi->port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	/* look at the parport device to see if what modes we can use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	if(((struct pardevice *)(pi->pardev))->port->modes & 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		(PARPORT_MODE_EPP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)           )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		return 5; /* Can do EPP*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	else if(((struct pardevice *)(pi->pardev))->port->modes & 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			(PARPORT_MODE_TRISTATE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)                )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		return 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	else /*Just flat SPP*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static int bpck6_probe_unit ( PIA *pi )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	int out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		printk(KERN_DEBUG "PROBE UNIT %x on port:%x\n",pi->unit,pi->port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	/*SET PPC UNIT NUMBER*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	PPCSTRUCT(pi)->ppc_id=pi->unit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	/*LOWER DOWN TO UNIDIRECTIONAL*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	PPCSTRUCT(pi)->mode=1;		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	out=ppc6_open(PPCSTRUCT(pi));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		printk(KERN_DEBUG "ppc_open returned %2x\n",out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)   	if(out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		ppc6_close(PPCSTRUCT(pi));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			printk(KERN_DEBUG "leaving probe\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)                return(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)   	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)   	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			printk(KERN_DEBUG "Failed open\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)     		return(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)   	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) static void bpck6_log_adapter( PIA *pi, char * scratch, int verbose )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	char *mode_string[5]=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		{"4-bit","8-bit","EPP-8","EPP-16","EPP-32"};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	printk("%s: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n",pi->device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	printk("%s: Copyright 2001 by Micro Solutions, Inc., DeKalb IL.\n",pi->device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	printk("%s: BACKPACK %s, Micro Solutions BACKPACK Drive at 0x%x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		pi->device,BACKPACK_VERSION,pi->port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	printk("%s: Unit: %d Mode:%d (%s) Delay %d\n",pi->device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		pi->unit,pi->mode,mode_string[pi->mode],pi->delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static int bpck6_init_proto(PIA *pi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	Interface *p = kzalloc(sizeof(Interface), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	if (p) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		pi->private = (unsigned long)p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	printk(KERN_ERR "%s: ERROR COULDN'T ALLOCATE MEMORY\n", pi->device); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static void bpck6_release_proto(PIA *pi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	kfree((void *)(pi->private)); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static struct pi_protocol bpck6 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.owner		= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.name		= "bpck6",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.max_mode	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.epp_first	= 2, /* 2-5 use epp (need 8 ports) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.max_units	= 255,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	.write_regr	= bpck6_write_regr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	.read_regr	= bpck6_read_regr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	.write_block	= bpck6_write_block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	.read_block	= bpck6_read_block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	.connect	= bpck6_connect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	.disconnect	= bpck6_disconnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	.test_port	= bpck6_test_port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	.probe_unit	= bpck6_probe_unit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.log_adapter	= bpck6_log_adapter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	.init_proto	= bpck6_init_proto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.release_proto	= bpck6_release_proto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static int __init bpck6_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	printk(KERN_INFO "bpck6: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	if(verbose)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	return paride_register(&bpck6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static void __exit bpck6_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	paride_unregister(&bpck6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) MODULE_AUTHOR("Micro Solutions Inc.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) module_param(verbose, bool, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) module_init(bpck6_init)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) module_exit(bpck6_exit)