Re: KERNEL 2.6.29 and Agere Systems Soft Modem (chipset 11c1:0620)

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

 



Folks,

 Along with the fix suggested by John below, I have
made a few other cleanup fixes, and introduced the Kbuild
file that shall simplify the module build process, same idea
I used some time ago
for the 11c11040 chip. I do not have the 0620 chip, so
please test this patch if you can. On my notebook, it builds Ok for
the vanilla
2.6.29.1 kernel, and the modules load Ok with modprobe.

The patch is attached.

Patch and then build as follows:
$ make clean
$ make
$ sudo make modules_install
$ sudo modprobe agrmodem

General comments:

I would say that modprobe not finding the modules is a sign
of some trouble. Forcing it with insmod is a mere workaround.
Thoughts?

--
Nick Zhuravlev
www.auriga.com


On Sat, Dec 12, 2009 at 12:19:01PM -0500, John McGowan <jmcgowan@xxxxxxxx> wrote:

> KERNEL 2.6.29 and Agere Systems Soft Modem (chipset 11c1:0620)
> ==============================================================
> 
> The following is using Fedora Core11.
> 
> Using agrsm06pci-2.1.80~20090825.tar.gz as the source for
> the modules to work with this modem:
> 
> 
> Attempting to compile the modules for kernel 2.6.29 (Fedora Core 11 with its
> PAE configuration) led to
>   agrsm06pci-2.1.80~20090825/agrsoftmodem.c:263: error: too few arguments to function `__request_region'
> 
> Examining
>   /usr/src/linux/include/linux/ioport.h
> 
> I see
>   #define request_region(start,n,name)    __request_region(&ioport_resource, (start), (n), (name), 0)
> 
>   #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
> 
>   extern struct resource * __request_region(struct resource *,
>                                         resource_size_t start,
>                                         resource_size_t n,
>                                         const char *name, int flags);
> 
>   #define request_mem_region_exclusive(start,n,name) \
>         __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
> 
> 
> and it appears that __request_region has gained another argument, a flag
> which may specify exclusivity along with request_region(start,n,name)
> which uses a value of zero for that argument.
> 
> I changed the code
> 
>   //  return(request_region(start, n, name));
>   return(__request_region(&ioport_resource, (start), (n), (name)));
> 
> in agrsoftmodem.c to
> 
>   //  return(request_region(start, n, name));
>   //  return(__request_region(&ioport_resource, (start), (n), (name)));
>   return(__request_region(&ioport_resource, (start), (n), (name), 0));
> 
> It seems that request_region was originally used,
> then changed to use the more kernel-specific __request_region and
> while request_region did not change, __request_region did.
> 
> I am no C-programmer but I *seem* to have gotten it to work.
> 
> 
> MODPROBE:
> =========
> After installing I find that modprobe will not find it.
> Howver,
>   insmod -f [filename]
> is used in
>   /etc/init.d/agr_softmodem
> 
>     /sbin/insmod -f /lib/modules`uname -r`/kernel/drivers/char/agrmodem.ko; \
>     /sbin/insmod -f /lib/modules/`uname -r`/kernel/drivers/char/agrserial.ko; \
>     /usr/lib/AgereSoftModem/AgereMdmDaemon
> 
> so one may want to edit the material on using modprobe (which cannot
> find the module while insmod can specify the module by path/filename
> and so the attempt to load the modules in agrsm-test.txt from
> agrsm-tools-0.0.1-2.noarch.rpm using modprobe fails).
> 
>   service agr_softmodem (start|stop)
> 
> can be used to start/stop it (inserting/removing the modules and so
> creating/removing /dev/ttyAGS3) in Fedora Core11.
diff -Naur agrsm06pci-backup/agrsoftmodem.c agrsm06pci-2.1.80~20090825/agrsoftmodem.c
--- agrsm06pci-backup/agrsoftmodem.c	2009-12-13 01:04:56.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/agrsoftmodem.c	2009-12-13 01:06:09.000000000 +0300
@@ -260,7 +260,11 @@
 fnatr void *x_request_region(unsigned long start, unsigned long n, const char *name)
 {
 //  return(request_region(start, n, name));
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
   return(__request_region(&ioport_resource, (start), (n), (name)));
+#else
+  return(__request_region(&ioport_resource, (start), (n), (name), 0));
+#endif
 }
 
 #ifndef LT_KER_26
@@ -385,22 +389,23 @@
 }
 	
 fnatr int x_pcibios_read_config_byte (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned char *val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_byte(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_byte(dev, where, val));}
             
 fnatr int x_pcibios_read_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short *val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_word(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_word(dev, where, val));}
 
 fnatr int x_pcibios_read_config_dword (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned int *val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_dword(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_read_config_dword(dev, where, val));}
 
 fnatr int x_pcibios_write_config_byte (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned char val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_byte(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_byte(dev, where, val));}
 
 fnatr int x_pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_word(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_word(dev, where, val));}
 
 fnatr int x_pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned int val)
-{struct pci_dev *dev = pci_find_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_dword(dev, where, val));}
+{struct pci_dev *dev = pci_get_bus_and_slot(bus, dev_fn); return ((!dev)? PCIBIOS_DEVICE_NOT_FOUND : pci_write_config_dword(dev, where, val));}
+
 
 #ifndef LT_KER_26
 int x_pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn)
@@ -439,7 +444,7 @@
 #else
 	struct work_struct *x_tqueue = (struct work_struct *) task_x;
 
-    INIT_WORK(x_tqueue, wrap_LXHardwareBottomHalf);
+    INIT_WORK(x_tqueue, (work_func_t)wrap_LXHardwareBottomHalf);
 #endif
 }
 
@@ -451,7 +456,7 @@
 #else
 	struct work_struct *x_tqueue = (struct work_struct *) task_x;
 
-    INIT_WORK(x_tqueue, func);   
+    INIT_WORK(x_tqueue, (work_func_t)func);   
 #endif
 }
 
diff -Naur agrsm06pci-backup/hda.c agrsm06pci-2.1.80~20090825/hda.c
--- agrsm06pci-backup/hda.c	2009-12-13 01:04:56.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/hda.c	2009-12-13 01:06:09.000000000 +0300
@@ -10,7 +10,7 @@
  * 
  *****************************************************************************/
 
-#include <sound/driver.h>
+// #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
@@ -23,8 +23,7 @@
 //#include <sound/tlv.h>
 #include <sound/initval.h>
 
-//#define HDA_MODEM
-//#define wake_enable
+// #define HDA_MODEM
 
 #define fnatr __attribute__((regparm(0)))
 
@@ -35,47 +34,57 @@
 //#define HDAdbg 
 struct azx_dev {
 	struct snd_dma_buffer bdl; /* BDL buffer */
-	u32 *posbuf;		/* position buffer pointer */
+	u32 *posbuf;            /* position buffer pointer */
 
-	unsigned int bufsize;	/* size of the play buffer in bytes */
-	unsigned int frags;	/* number for period in the play buffer */
-	unsigned int fifo_size;	/* FIFO size */
+	unsigned int bufsize;   /* size of the play buffer in bytes */
+	unsigned int period_bytes; /* size of the period in bytes */
+	unsigned int frags;     /* number for period in the play buffer */
+	unsigned int fifo_size; /* FIFO size */
+	unsigned long start_jiffies;    /* start + minimum jiffies */
+	unsigned long min_jiffies;      /* minimum jiffies before position is valid */
 
-	void __iomem *sd_addr;	/* stream descriptor pointer */
+	void __iomem *sd_addr;  /* stream descriptor pointer */
 
-	u32 sd_int_sta_mask;	/* stream int status mask */
+	u32 sd_int_sta_mask;    /* stream int status mask */
 
 	/* pcm support */
-	struct snd_pcm_substream *substream;	/* assigned substream,
+	struct snd_pcm_substream *substream;    /* assigned substream,
 						 * set in PCM open
 						 */
-	unsigned int format_val;	/* format value to be set in the
+	unsigned int format_val;        /* format value to be set in the
 					 * controller and the codec
 					 */
-	unsigned char stream_tag;	/* assigned stream */
-	unsigned char index;		/* stream index */
-	/* for sanity check of position buffer */
-	unsigned int period_intr;
+	unsigned char stream_tag;       /* assigned stream */
+	unsigned char index;            /* stream index */
 
 	unsigned int opened :1;
 	unsigned int running :1;
+	unsigned int irq_pending :1;
+	unsigned int start_flag: 1;     /* stream full start flag */
+	/*
+	 * For VIA:
+	 *  A flag to ensure DMA position is 0
+	 *  when link position is not greater than FIFO size
+	 */
+	unsigned int insufficient :1;
 };
 
 /* CORB/RIRB */
 struct azx_rb {
-	u32 *buf;		/* CORB/RIRB buffer
+	u32 *buf;               /* CORB/RIRB buffer
 				 * Each CORB entry is 4byte, RIRB is 8byte
-				 */
-	dma_addr_t addr;	/* physical address of CORB/RIRB buffer */
+				 *                                  */
+	dma_addr_t addr;        /* physical address of CORB/RIRB buffer */
 	/* for RIRB */
-	unsigned short rp, wp;	/* read/write pointers */
-	int cmds;		/* number of pending requests */
-	u32 res;		/* last read value */
+	unsigned short rp, wp;  /* read/write pointers */
+	int cmds;               /* number of pending requests */
+	u32 res;                /* last read value */
 };
 
 struct azx {
 	struct snd_card *card;
 	struct pci_dev *pci;
+	int dev_index;
 
 	/* chip type specific */
 	int driver_type;
@@ -102,6 +111,7 @@
 
 	/* HD codec */
 	unsigned short codec_mask;
+	int  codec_probe_mask; /* copied from probe_mask option */
 	struct hda_bus *bus;
 
 	/* CORB/RIRB */
@@ -119,10 +129,20 @@
 	unsigned int single_cmd :1;
 	unsigned int polling_mode :1;
 	unsigned int msi :1;
+	unsigned int irq_pending_warned :1;
+	unsigned int via_dmapos_patch :1; /* enable DMA-position fix for VIA */
+	unsigned int probing :1; /* codec probing phase */
 
 	/* for debugging */
-	unsigned int last_cmd;	/* last issued command (to sync) */
+	unsigned int last_cmd;  /* last issued command (to sync) */
+
+	/* for pending irqs */
+	struct work_struct irq_pending_work;
+
+	/* reboot notifier (for mysterious hangup problem at power-down) */
+	struct notifier_block reboot_notifier;
 };
+
 extern void snd_hda_get_codec_name(struct hda_codec *, char *, int);
 extern struct snd_card *snd_cards[SNDRV_CARDS];
 extern unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, int direct,
@@ -130,8 +150,8 @@
 extern  int HDA_resume(void);
 extern  int HDA_suspend(void);
 
-int *ResumePt;
-int *SuspendPt;
+int *(ResumePt);
+int *(SuspendPt);
 struct hda_codec *AgrHDACodec;
 
 /* assign a stream for the PCM */
@@ -150,9 +170,9 @@
 			chip->azx_dev[dev].opened = 1;
 #ifdef HDAdbg 
 			if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-				snd_printk(KERN_WARNING "AGR_azx_assign_device SNDRV_PCM_STREAM_PLAYBACK %x %x %x\n",i,dev,&chip->azx_dev[dev]);
+				snd_printk(KERN_WARNING "AGR_azx_assign_device SNDRV_PCM_STREAM_PLAYBACK %x %x %p\n",i,dev,&chip->azx_dev[dev]);
 			else
-				snd_printk(KERN_WARNING "AGR_azx_assign_device SNDRV_PCM_STREAM_receiveBACK %x %x %x\n",i,dev,&chip->azx_dev[dev]);
+				snd_printk(KERN_WARNING "AGR_azx_assign_device SNDRV_PCM_STREAM_receiveBACK %x %x %p\n",i,dev,&chip->azx_dev[dev]);
 #endif
 	
 			return &chip->azx_dev[dev];
@@ -183,15 +203,13 @@
 int fnatr releaseHDAStream(void **pDev)
 {
 #ifdef HDAdbg 
-snd_printk(KERN_WARNING"eleaseHDAStream %x\n",*pDev);
+snd_printk(KERN_WARNING"releaseHDAStream %p\n",*pDev);
 #endif
 azx_release_device(*pDev);
 return 1;
 
 }
 
-#ifdef HDA_MODEM
-
 int fnatr getHDAStream( unsigned int streamType, unsigned char *StreamId, void **pRegMap, void **pDev)
 {
 struct azx_dev  * azx_dev_temp;
@@ -204,23 +222,22 @@
 *pRegMap = (unsigned int *)azx_dev_temp->sd_addr;
 *StreamId  = (unsigned int) azx_dev_temp->stream_tag;
 #ifdef HDAdbg 
-printk(KERN_ALERT"getHdaStream  dev = %x stream id = %x\n", azx_dev_temp, *StreamId);
+printk(KERN_ALERT"getHdaStream  dev = %p stream id = %x\n", azx_dev_temp, *StreamId);
 #endif
 return 1;
 }
 
 
-unsigned long * GetHDABaseAddress()
+unsigned long * GetHDABaseAddress(void)
 {
 struct azx *chip_temp;
 struct hda_bus *bus_temp;
-struct hda_codec *codec_temp;
-unsigned long temp;
+unsigned long *temp;
 
 chip_temp = snd_cards[0]->private_data;
 bus_temp = chip_temp->bus;
 #ifdef HDAdbg 
-snd_printk(KERN_ERR"HDA chip address %x \n",chip_temp->remap_addr);
+snd_printk(KERN_ERR"HDA chip address %p \n",chip_temp->remap_addr);
 #endif
 temp = (unsigned long *) chip_temp->remap_addr;
 
@@ -234,100 +251,87 @@
 unsigned long *temp;
 struct azx *chip_temp;
 struct hda_bus *bus_temp;
-struct hda_codec *codec_temp;
 
 chip_temp = snd_cards[0]->private_data;  //probe
 bus_temp = chip_temp->bus;
 //hda register dump
-snd_printk(KERN_ERR"HDA chip address %x \n",chip_temp->remap_addr);
+snd_printk(KERN_ERR"HDA chip address %p \n",chip_temp->remap_addr);
 temp = (unsigned long *) chip_temp->remap_addr;
 for (i=0; i<(0x1A0/4);)
 {
-	snd_printk(KERN_ERR"HDA register %04X %08X %08X %08X %08X\n",i*4,temp[i],temp[i+1],temp[i+2],temp[i+3]);
+	snd_printk(KERN_ERR"HDA register %04X %08lX %08lX %08lX %08lX\n",i*4,temp[i],temp[i+1],temp[i+2],temp[i+3]);
 	i = i+4;
 }
 }
 
 char findHDACodec(void)
 {
-int i;
-struct azx *chip_temp;
-struct hda_bus *bus_temp;
-struct hda_codec *codec_temp;
+	int i;
+	struct azx *chip_temp;
+	struct hda_bus *bus_temp;
+	struct hda_codec *codec_temp;
 
-chip_temp = snd_cards[0]->private_data;  //probe
-bus_temp = chip_temp->bus;
+	chip_temp = snd_cards[0]->private_data;  //probe
+	bus_temp = chip_temp->bus;
 
-for (i=0; i<16; i++)
-{
-	codec_temp = bus_temp->caddr_tbl[i];
-	if (codec_temp == 0)
-		return 0;
-	if ((codec_temp->vendor_id >> 16) == 0x11C1)
+	for (i=0; i<16; i++)
 	{
+		codec_temp = bus_temp->caddr_tbl[i];
+		if (codec_temp == 0)
+			return 0;
+		if ((codec_temp->vendor_id >> 16) == 0x11C1)
+		{
 #ifdef HDAdbg 
-		snd_printk(KERN_ERR"found agr codec vendor id %x %x\n",codec_temp->vendor_id,codec_temp->addr & 0x0f);
+			snd_printk(KERN_ERR"found agr codec vendor id %x %x\n",codec_temp->vendor_id,codec_temp->addr & 0x0f);
 #endif
-		AgrHDACodec = codec_temp;
-		return (codec_temp->addr & 0x0F);
+			AgrHDACodec = codec_temp;
+			return (codec_temp->addr & 0x0F);
+		}
 	}
+	return -ESRCH;
 }
 
-}
-#else
-
-int fnatr getHDAStream( unsigned int streamType, unsigned char *StreamId, void **pRegMap, void **pDev){}
-unsigned long * GetHDABaseAddress() {}
-void HDAdump(void) {}
-char findHDACodec(void) {}
-#endif
-
 void fnatr azlGetResourceInformation(unsigned char *codecAddress,  unsigned char* functionGroupStartNode)
 {
-codecAddress[0] =  findHDACodec();
+#ifdef HDAdbg
+	HDAdump();
+#endif
+	codecAddress[0] =  findHDACodec();
 }
 
 int fnatr setResumeCallBack(int *ResumeCallBack)
 {
-#ifdef wake_enable
-ResumePt = AgrHDACodec->patch_ops.resume;
-AgrHDACodec->patch_ops.resume=ResumeCallBack;
-#endif
-return(1);
+	ResumePt = (int *)AgrHDACodec->patch_ops.resume;
+	AgrHDACodec->patch_ops.resume=(void *)ResumeCallBack;
+	return(1);
 }
 int fnatr setSuspendCallBack(int *SuspendCallBack)
 {
-#ifdef wake_enable
-SuspendPt = AgrHDACodec->patch_ops.suspend;
-AgrHDACodec->patch_ops.suspend=SuspendCallBack;
-#endif
-return(1);
+	SuspendPt = (int *)AgrHDACodec->patch_ops.suspend;
+	AgrHDACodec->patch_ops.suspend=(void *)SuspendCallBack;
+	return(1);
 }
-int fnatr resetResumeCallBack()
+int fnatr resetResumeCallBack(void)
 {
-#ifdef wake_enable
-AgrHDACodec->patch_ops.resume=ResumePt;
-#endif
-return(1);
+	AgrHDACodec->patch_ops.resume=(void *)ResumePt;
+	return(1);
 }
-int fnatr resetSuspendCallBack()
+int fnatr resetSuspendCallBack(void)
 {
-#ifdef wake_enable
-AgrHDACodec->patch_ops.suspend=SuspendPt;
-#endif
-return(1);
+	AgrHDACodec->patch_ops.suspend=(void *)SuspendPt;
+	return(1);
 }
 
 unsigned long fnatr LnxTransferCodecVerbs(unsigned long* cmd)
 {
-unsigned int CodecAddress, nid,direct, verb, para, rvalue;
+unsigned int nid,direct, verb, para, rvalue=0;
 //snd_printk(KERN_ERR"azlTransferCodecVerbs  %x\n", *cmd);
 nid = (*cmd >> 20) & 0x7F;
 direct = (*cmd >> 27) & 1;
 verb = (*cmd >> 8) & 0xFFF;
 para = *cmd & 0xFF;
 #ifdef HDAdbg 
-snd_printk(KERN_ERR"azlTransferCodecVerbs %x %x %x %x %x %x\n",AgrHDACodec, nid, direct, verb, para);
+snd_printk(KERN_ERR"azlTransferCodecVerbs %p %x %x %x %x\n",AgrHDACodec, nid, direct, verb, para);
 #endif 
 if (AgrHDACodec == 0)
 	return 0;
@@ -341,14 +345,14 @@
 }
 unsigned long fnatr LnxTransferCodecVerbsWrite(unsigned long* cmd)
 {
-unsigned int CodecAddress, nid,direct, verb, para, rvalue;
+unsigned int nid,direct, verb, para, rvalue=0;
 //snd_printk(KERN_ERR"azlTransferCodecVerbsWrite  %x\n", *cmd);
 nid = (*cmd >> 20) & 0x7F;
 direct = (*cmd >> 27) & 1;
 verb = (*cmd >> 8) & 0xFFF;
 para = *cmd & 0xFF;
 #ifdef HDAdbg 
-snd_printk(KERN_ERR"azlTransferCodecVerbsWrite %x %x %x %x %x %x\n",AgrHDACodec, nid, direct, verb, para);
+snd_printk(KERN_ERR"azlTransferCodecVerbsWrite %p %x %x %x %x\n",AgrHDACodec, nid, direct, verb, para);
 #endif 
 if (AgrHDACodec == 0)
 	return 0;
diff -Naur agrsm06pci-backup/Kbuild agrsm06pci-2.1.80~20090825/Kbuild
--- agrsm06pci-backup/Kbuild	1970-01-01 03:00:00.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/Kbuild	2009-12-12 01:04:44.000000000 +0300
@@ -0,0 +1,14 @@
+obj-m += agrmodem.o agrserial.o
+
+# Stupid definition of LT_KER_26
+EXTRA_CFLAGS += -Wall -DLT_KER_26
+# For Debug Build use next line too
+#EXTRA_CFLAGS += -DHDAdbg -DDebIn -DDebAc
+EXTRA_CFLAGS += -Isound/pci/hda -Idrivers/serial
+# Ubuntu/Debian Users - Fix this Path to your alsa version
+#EXTRA_CFLAGS += -I/usr/src/modules/alsa/alsa-driver-VERSION/alsa-kernel/pci/hda
+
+EXTRA_LDFLAGS := -d
+agrmodem-objs := agrsoftmodem.o agrmodemlib.o hda.o
+agrserial-objs := serial26.o
+
diff -Naur agrsm06pci-backup/Makefile agrsm06pci-2.1.80~20090825/Makefile
--- agrsm06pci-backup/Makefile	2009-12-13 01:05:49.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/Makefile	2009-12-13 01:06:00.000000000 +0300
@@ -5,91 +5,27 @@
 # Description:
 # Makes the following modules
 #   - Agere Soft Modem Controller driver module 
-#   - Modem Serial Interface driver module
+#   - Modem Serail Interface driver module
 #
 # Usage:
-#   make install: to make and install the driver modules
-#   make uninstall: to uninstall the driver modules
+#   make                 - build the module(s)
+#   make modules_install - install the module(s)
+#   make clean           - remove generated files in module directory only
 #
 # Revision History:
 #   Name                   Date          Change
 #   Soumyendu Sarkar       12/03/2002    Initial
 #
 
-KERNEL_DIR = /lib/modules/`uname -r`/build/
-#KERNEL_DIR = /usr/src/linux-`uname -r | sed -e 's,\-default,,'`/
-#KERNEL_DIR = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/
-KERNEL_DIR1 = /usr/src/linux-`uname -r`/include
-KERNEL_DIR2 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/include
-KERNEL_DIR5 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/include/asm/mach-default
-KERNEL_DIR3 = /usr/src/linux-`uname -r | sed -e 's,\..*,,'`.`uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`/include
-KERNEL_DIR4 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`.SuSE/include
+PWD := $(shell pwd)
+KRELEASE = $(shell uname -r)
+KERNEL_DIR := /lib/modules/$(KRELEASE)/build
 
-I_FLAGS =  -I$(KERNEL_DIR1) -I$(KERNEL_DIR2) -I$(KERNEL_DIR5) -I$(KERNEL_DIR3) -I$(KERNEL_DIR4)/include
+default:
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
 
-#C_FLAGS = -Wall -Wno-unused -O2 -fomit-frame-pointer -fno-strength-reduce  -pipe\
-#		-mcpu=i486 -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-#		-DMODULE -D__KERNEL__ -DLT_KER_24 -DLT_KER_26 -DKERNEL_DIR -DNO_EEPROM
-
-C_FLAGS = -Wall	-Wno-unused -O1 -fomit-frame-pointer -fno-strength-reduce -pipe \
-		-fno-gcse-after-reload \
-		-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-		-DMODULE -D__KERNEL__ -DLT_KER_24 -DLT_KER_26 -DNO_EEPROM $(I_FLAGS)
-
-EXTRA_CFLAGS += -Wall -DLT_KER_24 -DLT_KER_26 -DNO_EEPROM 
-
-EXTRA_LDFLAGS := -d
-    
-help :
-	@echo ''
-	@echo 'Run "make install" to install Agere Systems Soft Modem on your system.'
-	@echo 'Run "make uninstall" to remove a previously installed modem.'
-	@echo ''
-
-agrmodem-objs := \
-        agrsoftmodem.o agrmodemlib.o hda.o 
-
-agrserial-objs := \
-	serial26.o
-
-obj-m += agrmodem.o agrserial.o
-
-module:
-#	cp ../../build/Linux/dbg-agr-linux-fedora-6-0/bin/AGRSMDM_lib.o agrmodemlib.o
-
-	make -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
-
-$(obj)/agrmodemlib.o:
-	cp $(src)/agrmodemlib.o $(obj)/agrmodemlib.o
+modules_install:
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
 
 clean:
-	rm -f *.a
-	rm -f *~
-	rm -f agrmodem.o
-	rm -f agrmodem.ko
-	rm -f agrmodem.mod.o
-	rm -f agrmodem.mod.c
-	rm -f agrserial.o
-	rm -f agrserial.ko
-	rm -f agrserial.mod.o
-	rm -f agrserial.mod.c
-	rm -f agrsoftmodem.o
-	rm -f serial26.o
-	rm -f HDA.o
-	rm -f hda.o
-	rm -f modules.order
-	rm -f Module.symvers
-	rm -f Module.markers
-
-distclean: clean
-	rm -f .*.cmd
-	rm -rf .tmp_versions
-
-install:
-	./agrinst
-  
-uninstall :
-	./agruninst
-
-
-	
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
diff -Naur agrsm06pci-backup/modules.order agrsm06pci-2.1.80~20090825/modules.order
--- agrsm06pci-backup/modules.order	1970-01-01 03:00:00.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/modules.order	2009-12-13 01:15:01.000000000 +0300
@@ -0,0 +1,2 @@
+kernel//home/ndz/SOURCES/modem/agrsm06pci-2.1.80~20090825/agrmodem.ko
+kernel//home/ndz/SOURCES/modem/agrsm06pci-2.1.80~20090825/agrserial.ko
diff -Naur agrsm06pci-backup/README agrsm06pci-2.1.80~20090825/README
--- agrsm06pci-backup/README	2009-12-13 01:05:49.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/README	1970-01-01 03:00:00.000000000 +0300
@@ -1,52 +0,0 @@
-Please note that this software is distributed under the Agere Systems Soft
-Modem End User SOFTWARE LICENSE AGREEMENT, which can be found in the file
-LICENSE, included in this package
-
-Please note that this version of the driver is intended to work Red Flag NE 5.0
-having Linux kernel version 2.6.21.0-22
-
-#################################################################
-INSTALLING THE AGERE SOFT MODEM DRIVER VERSION 2.1.80 
-from the sandard driver package ( zip / tar.gz archieve)
-
-Step 1
-Uninstall any older version of the Agere soft modem driver by running 
-"make uninstall" from the directory containing the previously installed 
-Agere softmodem driver.
-
-Step 2
-To install the Agere soft modem driver in LINUX, extract the driver package
-(unzip /tar -xzvf) in a directory under Linux. 
-
-To install the modem driver you must be logged in as root.
-
-If your kernel version matches the one stated above, run "make install" from 
-the command prompt. This will install both the Agere soft modem controller 
-driver agrmodem.ko and the Modem serial interface driver agrserial.ko. 
-
-If your kernel version doesn't matches the one stated above, channces are you 
-need to regenerate agrmodem.ko & agrserial.ko. Make sure that you have the 
-kernel source installed in your system and the kernel directory is linked to
-/usr/src/linux. Run "make module" and then "make install" from the command prompt.
-
-Step 3
-To use Agere soft modem using KPPP choose "/dev/ttyAGS3" or "/dev/modem" as the modem device.
-
-To use the Agere soft modem, you can configure "minicom" for the modem device.
-Enter "minicom -s" at the command prompt.
-Choose "Serial Port Setup"
-For "Serial Device" choose "/dev/ttyAGS3" or "/dev/modem"
-Save settings as default (dfl) and start using the modem with minicom.
-
-UNINSTALLING THE MODEM DRIVER
-
-Following are the steps to follow to uninstall the Agere soft modem driver for
-Linux.
-
-Step 1
-To uninstall the Agere soft modem driver in LINUX, you can run "make uninstall"
-from the command prompt. To uninstall the modem driver you must be logged in as
-root.
-
-
-
diff -Naur agrsm06pci-backup/serial26.c agrsm06pci-2.1.80~20090825/serial26.c
--- agrsm06pci-backup/serial26.c	2009-12-13 01:04:56.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/serial26.c	2009-12-13 01:06:09.000000000 +0300
@@ -69,8 +69,7 @@
 static char *serialif_revdate = "2007-10-01";
 static char *serialif_name = "Agere Modem Interface driver";
 #endif
-//bala-dbg
-//#include <linux/config.h>
+#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/ioport.h>
@@ -290,7 +289,11 @@
 
 struct ltmodem_ops lt_modem_ops;
 struct ltmodem_res lt_modem_res;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+static void agr_rs_interrupt (unsigned long z);
+#else
 static void agr_rs_interrupt (void);
+#endif
 static int intf_flag = 0;
 static int uart_flag = 0;
 static int tx_empty_flag = 0;
@@ -929,7 +932,11 @@
 	up->port.irq = (irq > 0) ? irq : 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+static void serial8250_stop_tx(struct uart_port *port)
+#else
 static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
+#endif
 {
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 
@@ -937,13 +944,21 @@
 		up->ier &= ~UART_IER_THRI;
 		serial_out(up, UART_IER, up->ier);
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+	if (up->port.type == PORT_16C950) {
+#else
 	if (up->port.type == PORT_16C950 && tty_stop) {
+#endif
 		up->acr |= UART_ACR_TXDIS;
 		serial_icr_write(up, UART_ACR, up->acr);
 	}
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+static void serial8250_start_tx(struct uart_port *port)
+#else
 static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
+#endif
 {
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 
@@ -954,7 +969,11 @@
 	/*
 	 * We only do this from uart_start
 	 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+	if (up->port.type == PORT_16C950) {
+#else
 	if (tty_start && up->port.type == PORT_16C950) {
+#endif
 		up->acr &= ~UART_ACR_TXDIS;
 		serial_icr_write(up, UART_ACR, up->acr);
 	}
@@ -1064,7 +1083,11 @@
 		return;
 	}
 	if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+		serial8250_stop_tx(&up->port);
+#else
 		serial8250_stop_tx(&up->port, 0);
+#endif
 		return;
 	}
 
@@ -1083,7 +1106,11 @@
 	DEBUG_INTR("THRE...");
 
 	if (uart_circ_empty(xmit))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+		serial8250_stop_tx(&up->port);
+#else
 		serial8250_stop_tx(&up->port, 0);
+#endif
 }
 
 static _INLINE_ void check_modem_status(struct uart_8250_port *up)
@@ -1196,7 +1223,11 @@
 }
 
 #ifdef LUCENT_MODEM
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+static void agr_rs_interrupt (unsigned long z)
+#else
 static void agr_rs_interrupt (void)
+#endif
 {
   serial8250_interrupt(lt_modem_res.Irq,NULL,NULL);
  if(start_int)
@@ -1658,8 +1689,13 @@
 }
 
 static void
-serial8250_set_termios(struct uart_port *port, struct termios *termios,
-		       struct termios *old)
+serial8250_set_termios(struct uart_port *port, 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 22)
+		struct ktermios *termios,
+#else
+		struct termios *termios,
+#endif
+		struct ktermios *old)
 {
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 	unsigned char cval, fcr = 0;
diff -Naur agrsm06pci-backup/test.sh agrsm06pci-2.1.80~20090825/test.sh
--- agrsm06pci-backup/test.sh	2009-12-13 01:05:49.000000000 +0300
+++ agrsm06pci-2.1.80~20090825/test.sh	1970-01-01 03:00:00.000000000 +0300
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-$count=1;
-while [ 1 ]
-do
-echo "Test count:: $count"
-sleep 1
-sudo make uninstall install
-count=`expr $count + 1`
-done

[Index of Archives]     [Linux Media Development]     [Asterisk]     [DCCP]     [Netdev]     [X.org]     [Xfree86]     [Fedora Women]     [Linux USB]

  Powered by Linux