summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/zd1211rw/zd_usb.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2006-12-12 01:25:52 +0000
committerJeff Garzik <jeff@garzik.org>2007-02-05 16:58:42 -0500
commitee30276774451d657407855d95d9393ee8bc0bac (patch)
treeceb02ea0a59acf90ac532c72e7ff294c2736f9a4 /drivers/net/wireless/zd1211rw/zd_usb.c
parenta2bdcc679288307f9237c9611a0cc0c3c06669a9 (diff)
[PATCH] zd1211rw: Consistency for address space constants
The zd1211rw address space has confused me once too many times. This patch introduces the following naming notation: Memory space is split into segments (cr, fw, eeprom) and segments may contain components (e.g. boot code inside eeprom). These names are arbitrary and only for the description below: x_START: Absolute address of segment start (previously these were named such as CR_BASE_OFFSET, but they weren't really offsets unless you were considering them as an offset to 0) x_LEN: Segment length x_y_LEN: Length of component y of segment x x_y_OFFSET: Relative address of component y into segment x. The absolute address for this component is (x_START + x_y_OFFSET) I also renamed EEPROM registers to EEPROM data. These 'registers' can't be written to using standard I/O and really represent predefined data from the vendor. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_usb.c')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index b061d11d4ab0..6a524409aeac 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -152,10 +152,10 @@ static u16 usb_addr(struct zd_usb *usb, zd_addr_t addr)
switch (base) {
case CR_BASE:
- offset += CR_BASE_OFFSET;
+ offset += CR_START;
break;
case E2P_BASE:
- offset += E2P_BASE_OFFSET;
+ offset += E2P_START + E2P_DATA_OFFSET;
break;
case FW_BASE:
offset += usb->fw_base_offset;
@@ -297,14 +297,13 @@ static int handle_version_mismatch(struct usb_device *udev, u8 device_type,
if (r)
goto error;
- r = upload_code(udev, ur_fw->data, ur_fw->size, FW_START_OFFSET,
- REBOOT);
+ r = upload_code(udev, ur_fw->data, ur_fw->size, FW_START, REBOOT);
if (r)
goto error;
- offset = ((EEPROM_REGS_OFFSET + EEPROM_REGS_SIZE) * sizeof(u16));
+ offset = (E2P_BOOT_CODE_OFFSET * sizeof(u16));
r = upload_code(udev, ub_fw->data + offset, ub_fw->size - offset,
- E2P_BASE_OFFSET + EEPROM_REGS_SIZE, REBOOT);
+ E2P_START + E2P_BOOT_CODE_OFFSET, REBOOT);
/* At this point, the vendor driver downloads the whole firmware
* image, hacks around with version IDs, and uploads it again,
@@ -333,7 +332,7 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
if (r)
goto error;
- fw_bcdDevice = get_word(ub_fw->data, EEPROM_REGS_OFFSET);
+ fw_bcdDevice = get_word(ub_fw->data, E2P_DATA_OFFSET);
if (fw_bcdDevice != bcdDevice) {
dev_info(&udev->dev,
@@ -359,8 +358,7 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
if (r)
goto error;
- r = upload_code(udev, uph_fw->data, uph_fw->size, FW_START_OFFSET,
- REBOOT);
+ r = upload_code(udev, uph_fw->data, uph_fw->size, FW_START, REBOOT);
if (r) {
dev_err(&udev->dev,
"Could not upload firmware code uph. Error number %d\n",
@@ -899,7 +897,7 @@ int zd_usb_init_hw(struct zd_usb *usb)
ZD_ASSERT(mutex_is_locked(&chip->mutex));
r = zd_ioread16_locked(chip, &usb->fw_base_offset,
- USB_REG((u16)FW_BASE_ADDR_OFFSET));
+ USB_REG(FW_START + FW_REGS_ADDR_OFFSET));
if (r)
return r;
dev_dbg_f(zd_usb_dev(usb), "fw_base_offset: %#06hx\n",