usbatm cxacru.c,1.22,1.23

kagan at infradead.org kagan at infradead.org
Fri Apr 1 06:11:38 EST 2005


Update of /home/cvs/usbatm
In directory phoenix.infradead.org:/tmp/cvs-serv9834

Modified Files:
	cxacru.c 
Log Message:
Hardwire the knowledge about different chipset revisions into the driver.

Index: cxacru.c
===================================================================
RCS file: /home/cvs/usbatm/cxacru.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- cxacru.c	24 Mar 2005 21:18:42 -0000	1.22
+++ cxacru.c	1 Apr 2005 11:11:35 -0000	1.23
@@ -64,10 +64,6 @@
 #define BR_STACK_ADDR	0x00187f10
 
 /* Values */
-#define PLLFCLK_NEW	0x5
-#define PLLBCLK_NEW	0x3
-#define PLLFCLK_OLD	0x02d874df
-#define PLLBCLK_OLD	0x0196a51a
 #define SDRAM_ENA	0x1
 
 /* Timeout in jiffies */
@@ -154,9 +150,17 @@
 	CXINF_MAX = 0x1c,
 };
 
+struct cxacru_modem_type {
+	u32 pll_f_clk;
+	u32 pll_b_clk;
+	int boot_rom_patch;
+};
+
 struct cxacru_data {
 	struct usbatm_data *usbatm;
 
+	const struct cxacru_modem_type *modem_type;
+
 	int line_status; 
 	struct work_struct poll_work;
 	struct timer_list poll_timer;
@@ -522,7 +526,7 @@
 	dbg("cxacru_upload_firmware");
 
 	/* FirmwarePllFClkValue */
-	val = cpu_to_le32(bp ? PLLFCLK_OLD : PLLFCLK_NEW);
+	val = cpu_to_le32(instance->modem_type->pll_f_clk);
 	ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4);
 	if (ret) {
 		dev_err(dev, "FirmwarePllFClkValue failed: %d\n", ret);
@@ -530,7 +534,7 @@
 	}
 
 	/* FirmwarePllBClkValue */
-	val = cpu_to_le32(bp ? PLLBCLK_OLD : PLLBCLK_NEW);
+	val = cpu_to_le32(instance->modem_type->pll_b_clk);
 	ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4);
 	if (ret) {
 		dev_err(dev, "FirmwarePllBClkValue failed: %d\n", ret);
@@ -553,7 +557,7 @@
 	}
 
 	/* Boot ROM patch */
-	if (bp) {
+	if (instance->modem_type->boot_rom_patch) {
 		ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size);
 		if (ret) {
 			dev_err(dev, "Boot ROM patching failed: %d\n", ret);
@@ -568,7 +572,7 @@
 		return;
 	}
 
-	if (bp) {
+	if (instance->modem_type->boot_rom_patch) {
 		val = cpu_to_le32(BR_ADDR);
 		ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
 	}
@@ -635,7 +639,7 @@
 }
 
 static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
-		struct usb_interface *usb_intf)
+			     struct usb_interface *usb_intf)
 {
 	struct device *dev = &usbatm_instance->usb_intf->dev;
 	const struct firmware *fw, *bp, *cf;
@@ -643,22 +647,28 @@
 
 	int ret = cxacru_find_firmware(instance, "fw", &fw);
 	if (ret) {
-		dev_warn(dev, "firmware unavailable (hotplug configuration problem?)\n");
+		dev_warn(dev, "firmware (cxacru-fw.bin) unavailable (hotplug misconfiguration?)\n");
 		return ret;
 	}
 
+	if (instance->modem_type->boot_rom_patch) {
+		ret = cxacru_find_firmware(instance, "bp", &bp);
+		if (ret) {
+			dev_warn(dev, "boot ROM patch (cxacru-bp.bin) unavailable (hotplug misconfiguration?)\n");
+			release_firmware(fw);
+			return ret;
+		}
+	}
+
 	if (cxacru_find_firmware(instance, "cf", &cf))		/* optional */
 		cf = NULL;
 
-	if (cxacru_find_firmware(instance, "bp", &bp))		/* optional */
-		bp = NULL;
-
 	cxacru_upload_firmware(instance, fw, bp, cf);
 
-	if (bp)
-		release_firmware(bp);
 	if (cf)
 		release_firmware(cf);
+	if (instance->modem_type->boot_rom_patch)
+		release_firmware(bp);
 	release_firmware(fw);
 
 	ret = cxacru_card_status(instance);
@@ -672,7 +682,8 @@
 #endif /* USE_FW_LOADER */
 
 static int cxacru_bind(struct usbatm_data *usbatm_instance,
-		struct usb_interface *intf, int *need_heavy_init)
+		       struct usb_interface *intf, const struct usb_device_id *id,
+		       int *need_heavy_init)
 {
 	struct cxacru_data *instance;
 	struct usb_device *usb_dev = interface_to_usbdev(intf);
@@ -688,6 +699,7 @@
 	memset(instance, 0, sizeof(*instance));
 
 	instance->usbatm = usbatm_instance;
+	instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
 
 	instance->rcv_buf = (u8 *) __get_free_page(GFP_KERNEL);
 	if (!instance->rcv_buf) {
@@ -779,66 +791,63 @@
 	usbatm_instance->driver_data = NULL;
 }
 
+static const struct cxacru_modem_type cxacru_cafe = {
+	.pll_f_clk = 0x02d874df,
+	.pll_b_clk = 0x0196a51a,
+	.boot_rom_patch = 1,
+};
+
+static const struct cxacru_modem_type cxacru_cb00 = {
+	.pll_f_clk = 0x5,
+	.pll_b_clk = 0x3,
+	.boot_rom_patch = 0,
+};
+
 static const struct usb_device_id cxacru_usb_ids[] = {
-	{
-		/* V = Conexant				P = ADSL modem (Euphrates project)	*/
-		USB_DEVICE(0x0572, 0xcafe)
-	},
-	{
-		/* V = Conexant				P = ADSL modem (Hasbani project)	*/
-		USB_DEVICE(0x0572, 0xcb00)
-	},
-	{
-		/* V = Conexant				P = ADSL modem				*/
-		USB_DEVICE(0x0572, 0xcb01)
-	},
-	{
-		/* V = Conexant				P = ADSL modem				*/
-		USB_DEVICE(0x0572, 0xcb06)
-	},
-	{
-		/* V = Olitec				P = ADSL modem version 2		*/
-		USB_DEVICE(0x08e3, 0x0100)
-	},
-	{
-		/* V = Olitec				P = ADSL modem version 3		*/
-		USB_DEVICE(0x08e3, 0x0102)
-	},
-	{
-		/* V = Trust/Amigo Technology Co.	P = AMX-CA86U				*/
-		USB_DEVICE(0x0eb0, 0x3457)
-	},
-	{
-		/* V = Zoom				P = 5510				*/
-		USB_DEVICE(0x1803, 0x5510)
-	},
-	{
-		/* V = Draytek				P = Vigor 318				*/
-		USB_DEVICE(0x0675, 0x0200)
-	},
-	{
-		/* V = Zyxel				P = 630-C1 aka OMNI ADSL USB (Annex A)	*/
-		USB_DEVICE(0x0586, 0x330a)
-	},
-	{
-		/* V = Zyxel				P = 630-C3 aka OMNI ADSL USB (Annex B)	*/
-		USB_DEVICE(0x0586, 0x330b)
-	},
-	{
-		/* V = Aethra				P = Starmodem UM1020			*/
-		USB_DEVICE(0x0659, 0x0020)
-	},
-	{
-		/* V = Aztech Systems			P = ? AKA Pirelli AUA-010		*/
-		USB_DEVICE(0x0509, 0x0812)
-	},
-	{
-		/* V = Netopia				P = Cayman 3341(Annex A)/3351(Annex B)	*/
-		USB_DEVICE(0x100d, 0xcb01)
-	},
-	{
-		/* V = Netopia				P = Cayman 3342(Annex A)/3352(Annex B)	*/
-		USB_DEVICE(0x100d, 0x3342)
+	{ /* V = Conexant			P = ADSL modem (Euphrates project)	*/
+		USB_DEVICE(0x0572, 0xcafe),	.driver_info = (unsigned long) &cxacru_cafe
+	},
+	{ /* V = Conexant			P = ADSL modem (Hasbani project)	*/
+		USB_DEVICE(0x0572, 0xcb00),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Conexant			P = ADSL modem				*/
+		USB_DEVICE(0x0572, 0xcb01),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Conexant			P = ADSL modem				*/
+		USB_DEVICE(0x0572, 0xcb06),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Olitec				P = ADSL modem version 2		*/
+		USB_DEVICE(0x08e3, 0x0100),	.driver_info = (unsigned long) &cxacru_cafe
+	},
+	{ /* V = Olitec				P = ADSL modem version 3		*/
+		USB_DEVICE(0x08e3, 0x0102),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Trust/Amigo Technology Co.	P = AMX-CA86U				*/
+		USB_DEVICE(0x0eb0, 0x3457),	.driver_info = (unsigned long) &cxacru_cafe
+	},
+	{ /* V = Zoom				P = 5510				*/
+		USB_DEVICE(0x1803, 0x5510),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Draytek			P = Vigor 318				*/
+		USB_DEVICE(0x0675, 0x0200),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Zyxel				P = 630-C1 aka OMNI ADSL USB (Annex A)	*/
+		USB_DEVICE(0x0586, 0x330a),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Zyxel				P = 630-C3 aka OMNI ADSL USB (Annex B)	*/
+		USB_DEVICE(0x0586, 0x330b),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Aethra				P = Starmodem UM1020			*/
+		USB_DEVICE(0x0659, 0x0020),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Aztech Systems			P = ? AKA Pirelli AUA-010		*/
+		USB_DEVICE(0x0509, 0x0812),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Netopia			P = Cayman 3341(Annex A)/3351(Annex B)	*/
+		USB_DEVICE(0x100d, 0xcb01),	.driver_info = (unsigned long) &cxacru_cb00
+	},
+	{ /* V = Netopia			P = Cayman 3342(Annex A)/3352(Annex B)	*/
+		USB_DEVICE(0x100d, 0x3342),	.driver_info = (unsigned long) &cxacru_cb00
 	},
 	{}
 };




More information about the Usbatm-commits mailing list