diff options
Diffstat (limited to 'drivers/staging/ft1000/ft1000-pcmcia')
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/boot.h | 34 | ||||
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 30 | ||||
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 50 | ||||
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 212 | ||||
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 935 |
5 files changed, 592 insertions, 669 deletions
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/boot.h b/drivers/staging/ft1000/ft1000-pcmcia/boot.h index 60c015c1c28a..e4a698528520 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/boot.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/boot.h @@ -1,28 +1,28 @@ /*--------------------------------------------------------------------------- - FT1000 driver for Flarion Flash OFDM NIC Device + FT1000 driver for Flarion Flash OFDM NIC Device - Copyright (C) 2002 Flarion Technologies, All rights reserved. + Copyright (C) 2002 Flarion Technologies, All rights reserved. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. --------------------------------------------------------------------------- - File: boot.h + File: boot.h - Description: boatloader + Description: boatloader - History: - 1/11/05 Whc Ported to Linux. + History: + 1/11/05 Whc Ported to Linux. ----------------------------------------------------------------------------*/ + ---------------------------------------------------------------------------*/ #ifndef _BOOTH_ #define _BOOTH_ diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index 1d52738fff49..5992670f7747 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -1,21 +1,21 @@ /*--------------------------------------------------------------------------- - FT1000 driver for Flarion Flash OFDM NIC Device + FT1000 driver for Flarion Flash OFDM NIC Device - Copyright (C) 2002 Flarion Technologies, All rights reserved. + Copyright (C) 2002 Flarion Technologies, All rights reserved. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. ---------------------------------------------------------------------------- - Description: Common structures and defines ----------------------------------------------------------------------------*/ + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. + --------------------------------------------------------------------------- + Description: Common structures and defines + ---------------------------------------------------------------------------*/ #ifndef _FT1000H_ #define _FT1000H_ diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c index 1f8b3ca35c69..922478e1cb57 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c @@ -1,30 +1,30 @@ /*--------------------------------------------------------------------------- - FT1000 driver for Flarion Flash OFDM NIC Device + FT1000 driver for Flarion Flash OFDM NIC Device - Copyright (C) 1999 David A. Hinds. All Rights Reserved. - Copyright (C) 2002 Flarion Technologies, All rights reserved. - Copyright (C) 2006 Patrik Ostrihon, All rights reserved. - Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. + Copyright (C) 1999 David A. Hinds. All Rights Reserved. + Copyright (C) 2002 Flarion Technologies, All rights reserved. + Copyright (C) 2006 Patrik Ostrihon, All rights reserved. + Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. - The initial developer of the original code is David A. Hinds - <dahinds@users.sourceforge.net>. Portions created by David A. Hinds. + The initial developer of the original code is David A. Hinds + <dahinds@users.sourceforge.net>. Portions created by David A. Hinds. - This file was modified to support the Flarion Flash OFDM NIC Device - by Wai Chan (w.chan@flarion.com). + This file was modified to support the Flarion Flash OFDM NIC Device + by Wai Chan (w.chan@flarion.com). - Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk) + Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk) - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. + -----------------------------------------------------------------------------*/ #include <linux/kernel.h> #include <linux/module.h> @@ -80,11 +80,11 @@ static int ft1000_confcheck(struct pcmcia_device *link, void *priv_data) /*====================================================================== - ft1000_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. + ft1000_config() is scheduled to run after a CARD_INSERTION event + is received, to configure the PCMCIA socket, and to make the + device available to the system. -======================================================================*/ + ======================================================================*/ static int ft1000_config(struct pcmcia_device *link) { diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index c1856f7d1e26..06b0e9cfb9b1 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -1,24 +1,26 @@ /*--------------------------------------------------------------------------- - FT1000 driver for Flarion Flash OFDM NIC Device - - Copyright (C) 2002 Flarion Technologies, All rights reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. + FT1000 driver for Flarion Flash OFDM NIC Device + + Copyright (C) 2002 Flarion Technologies, All rights reserved. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. -------------------------------------------------------------------------- - Description: This module will handshake with the DSP bootloader to - download the DSP runtime image. + Description: This module will handshake with the DSP bootloader to + download the DSP runtime image. ----------------------------------------------------------------------------*/ + ---------------------------------------------------------------------------*/ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define __KERNEL_SYSCALLS__ @@ -99,7 +101,7 @@ struct dsp_file_hdr { u32 version_data_offset; /* Offset were scrambled version data begins. */ u32 version_data_size; /* Size, in words, of scrambled version data. */ u32 nDspImages; /* Number of DSP images in file. */ -} __attribute__ ((packed)); +} __packed; struct dsp_image_info { u32 coff_date; /* Date/time when DSP Coff image was built. */ @@ -110,11 +112,11 @@ struct dsp_image_info { u32 version; /* Embedded version # of DSP code. */ unsigned short checksum; /* Dsp File checksum */ unsigned short pad1; -} __attribute__ ((packed)); +} __packed; void card_bootload(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); unsigned long flags; u32 *pdata; u32 size; @@ -123,7 +125,7 @@ void card_bootload(struct net_device *dev) netdev_dbg(dev, "card_bootload is called\n"); - pdata = (u32 *) bootimage; + pdata = (u32 *)bootimage; size = sizeof(bootimage); /* check for odd word */ @@ -146,7 +148,7 @@ void card_bootload(struct net_device *dev) u16 get_handshake(struct net_device *dev, u16 expected_value) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); u16 handshake; u32 tempx; int loopcnt; @@ -161,12 +163,12 @@ u16 get_handshake(struct net_device *dev, u16 expected_value) } else { tempx = ntohl(ft1000_read_dpram_mag_32 - (dev, DWNLD_MAG_HANDSHAKE_LOC)); - handshake = (u16) tempx; + (dev, DWNLD_MAG_HANDSHAKE_LOC)); + handshake = (u16)tempx; } if ((handshake == expected_value) - || (handshake == HANDSHAKE_RESET_VALUE)) { + || (handshake == HANDSHAKE_RESET_VALUE)) { return handshake; } loopcnt++; @@ -180,7 +182,7 @@ u16 get_handshake(struct net_device *dev, u16 expected_value) void put_handshake(struct net_device *dev, u16 handshake_value) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); u32 tempx; if (info->AsicID == ELECTRABUZZ_ID) { @@ -188,7 +190,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value) DWNLD_HANDSHAKE_LOC); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, handshake_value); /* Handshake */ } else { - tempx = (u32) handshake_value; + tempx = (u32)handshake_value; tempx = ntohl(tempx); ft1000_write_dpram_mag_32(dev, DWNLD_MAG_HANDSHAKE_LOC, tempx); /* Handshake */ } @@ -196,7 +198,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value) u16 get_request_type(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); u16 request_type; u32 tempx; @@ -206,7 +208,7 @@ u16 get_request_type(struct net_device *dev) } else { tempx = ft1000_read_dpram_mag_32(dev, DWNLD_MAG_TYPE_LOC); tempx = ntohl(tempx); - request_type = (u16) tempx; + request_type = (u16)tempx; } return request_type; @@ -215,7 +217,7 @@ u16 get_request_type(struct net_device *dev) long get_request_value(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); long value; u16 w_val; @@ -244,7 +246,7 @@ long get_request_value(struct net_device *dev) void put_request_value(struct net_device *dev, long lvalue) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); u16 size; u32 tempx; @@ -271,11 +273,11 @@ void put_request_value(struct net_device *dev, long lvalue) u16 hdr_checksum(struct pseudo_hdr *pHdr) { - u16 *usPtr = (u16 *) pHdr; + u16 *usPtr = (u16 *)pHdr; u16 chksum; chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ - usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); + usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); return chksum; } @@ -283,7 +285,7 @@ u16 hdr_checksum(struct pseudo_hdr *pHdr) int card_download(struct net_device *dev, const u8 *pFileStart, size_t FileLength) { - struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); + struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); int Status = SUCCESS; u32 uiState; u16 handshake; @@ -316,13 +318,13 @@ int card_download(struct net_device *dev, const u8 *pFileStart, file_version = *(long *)pFileStart; if (file_version != 6) { - printk(KERN_ERR "ft1000: unsupported firmware version %ld\n", file_version); + pr_err("unsupported firmware version %ld\n", file_version); Status = FAILURE; } uiState = STATE_START_DWNLD; - pFileHdr5 = (struct dsp_file_hdr *) pFileStart; + pFileHdr5 = (struct dsp_file_hdr *)pFileStart; pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->loader_offset); pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->loader_offset); @@ -376,7 +378,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, break; } if ((word_length * 2 + (long)pUcFile) > - (long)pBootEnd) { + (long)pBootEnd) { /* * Error, beyond boot code range. */ @@ -390,8 +392,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) word_length++; word_length = word_length / 2; @@ -402,12 +404,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, (*pUsFile++ << 16); pUcFile += 4; outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + dpram_lock, + flags); break; default: Status = FAILURE; @@ -430,7 +432,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, switch (request) { case REQUEST_FILE_CHECKSUM: netdev_dbg(dev, - "ft1000_dnld: REQUEST_FOR_CHECKSUM\n"); + "ft1000_dnld: REQUEST_FOR_CHECKSUM\n"); put_request_value(dev, image_chksum); break; case REQUEST_RUN_ADDRESS: @@ -468,7 +470,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, break; } if ((word_length * 2 + (long)pUcFile) > - (long)pCodeEnd) { + (long)pCodeEnd) { /* * Error, beyond boot code range. */ @@ -479,8 +481,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) word_length++; word_length = word_length / 2; @@ -491,8 +493,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, (*pUsFile++ << 16); pUcFile += 4; outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } break; @@ -502,9 +504,9 @@ int card_download(struct net_device *dev, const u8 *pFileStart, (long)(info->DSPInfoBlklen + 1) / 2; put_request_value(dev, word_length); pMailBoxData = - (struct drv_msg *) &info->DSPInfoBlk[0]; + (struct drv_msg *)&info->DSPInfoBlk[0]; pUsData = - (u16 *) &pMailBoxData->data[0]; + (u16 *)&pMailBoxData->data[0]; /* Provide mutual exclusive access while reading ASIC registers. */ spin_lock_irqsave(&info->dpram_lock, flags); @@ -528,8 +530,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) word_length++; @@ -540,13 +542,13 @@ int card_download(struct net_device *dev, const u8 *pFileStart, templong |= (*pUsData++ << 16); outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } } spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + dpram_lock, + flags); break; case REQUEST_VERSION_INFO: @@ -555,8 +557,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, put_request_value(dev, word_length); pUsFile = (u16 *) ((long)pFileStart + - pFileHdr5-> - version_data_offset); + pFileHdr5-> + version_data_offset); /* Provide mutual exclusive access while reading ASIC registers. */ spin_lock_irqsave(&info->dpram_lock, flags); @@ -564,8 +566,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) word_length++; word_length = word_length / 2; @@ -578,12 +580,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, templong |= (temp << 16); outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + dpram_lock, + flags); break; case REQUEST_CODE_BY_VERSION: @@ -592,14 +594,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart, get_request_value(dev); pDspImageInfoV6 = (struct dsp_image_info *) ((long) - pFileStart - + - sizeof - (struct dsp_file_hdr)); + pFileStart + + + sizeof + (struct dsp_file_hdr)); for (imageN = 0; - imageN < - pFileHdr5->nDspImages; - imageN++) { + imageN < + pFileHdr5->nDspImages; + imageN++) { temp = (u16) (pDspImageInfoV6-> version); @@ -610,30 +612,30 @@ int card_download(struct net_device *dev, const u8 *pFileStart, templong |= (temp << 16); if (templong == - requested_version) { + requested_version) { bGoodVersion = true; pUsFile = (u16 *) ((long) - pFileStart - + - pDspImageInfoV6-> - begin_offset); + pFileStart + + + pDspImageInfoV6-> + begin_offset); pUcFile = (u8 *) ((long) - pFileStart - + - pDspImageInfoV6-> - begin_offset); + pFileStart + + + pDspImageInfoV6-> + begin_offset); pCodeEnd = (u8 *) ((long) - pFileStart - + - pDspImageInfoV6-> - end_offset); + pFileStart + + + pDspImageInfoV6-> + end_offset); run_address = pDspImageInfoV6-> run_address; @@ -645,10 +647,10 @@ int card_download(struct net_device *dev, const u8 *pFileStart, pDspImageInfoV6-> checksum; netdev_dbg(dev, - "ft1000_dnld: image_chksum = 0x%8x\n", - (unsigned - int) - image_chksum); + "ft1000_dnld: image_chksum = 0x%8x\n", + (unsigned + int) + image_chksum); break; } pDspImageInfoV6++; @@ -674,25 +676,25 @@ int card_download(struct net_device *dev, const u8 *pFileStart, break; case STATE_DONE_DWNLD: - if (((unsigned long) (pUcFile) - (unsigned long) pFileStart) >= - (unsigned long) FileLength) { + if (((unsigned long)(pUcFile) - (unsigned long) pFileStart) >= + (unsigned long)FileLength) { uiState = STATE_DONE_FILE; break; } - pHdr = (struct pseudo_hdr *) pUsFile; + pHdr = (struct pseudo_hdr *)pUsFile; if (pHdr->portdest == 0x80 /* DspOAM */ - && (pHdr->portsrc == 0x00 /* Driver */ + && (pHdr->portsrc == 0x00 /* Driver */ || pHdr->portsrc == 0x10 /* FMM */)) { uiState = STATE_SECTION_PROV; } else { netdev_dbg(dev, - "FT1000:download:Download error: Bad Port IDs in Pseudo Record\n"); + "Download error: Bad Port IDs in Pseudo Record\n"); netdev_dbg(dev, "\t Port Source = 0x%2.2x\n", - pHdr->portsrc); + pHdr->portsrc); netdev_dbg(dev, "\t Port Destination = 0x%2.2x\n", - pHdr->portdest); + pHdr->portdest); Status = FAILURE; } @@ -700,7 +702,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, case STATE_SECTION_PROV: - pHdr = (struct pseudo_hdr *) pUcFile; + pHdr = (struct pseudo_hdr *)pUcFile; if (pHdr->checksum == hdr_checksum(pHdr)) { if (pHdr->portdest != 0x80 /* Dsp OAM */) { @@ -715,8 +717,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, GFP_ATOMIC); if (pbuffer) { memcpy(pbuffer, (void *)pUcFile, - (u32) (usHdrLength + - sizeof(struct pseudo_hdr))); + (u32) (usHdrLength + + sizeof(struct pseudo_hdr))); /* link provisioning data */ pprov_record = kmalloc(sizeof(struct prov_record), @@ -725,15 +727,15 @@ int card_download(struct net_device *dev, const u8 *pFileStart, pprov_record->pprov_data = pbuffer; list_add_tail(&pprov_record-> - list, - &info->prov_list); + list, + &info->prov_list); /* Move to next entry if available */ pUcFile = - (u8 *) ((unsigned long) pUcFile + - (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr)); + (u8 *)((unsigned long) pUcFile + + (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr)); if ((unsigned long) (pUcFile) - - (unsigned long) (pFileStart) >= - (unsigned long) FileLength) { + (unsigned long) (pFileStart) >= + (unsigned long)FileLength) { uiState = STATE_DONE_FILE; } diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 44575c78cf0c..d5475b7270a8 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1,22 +1,24 @@ /*--------------------------------------------------------------------------- - FT1000 driver for Flarion Flash OFDM NIC Device - - Copyright (C) 2002 Flarion Technologies, All rights reserved. - Copyright (C) 2006 Patrik Ostrihon, All rights reserved. - Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. + FT1000 driver for Flarion Flash OFDM NIC Device + + Copyright (C) 2002 Flarion Technologies, All rights reserved. + Copyright (C) 2006 Patrik Ostrihon, All rights reserved. + Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. -------------------------------------------------------------------------*/ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> @@ -44,12 +46,6 @@ #include <pcmcia/cisreg.h> #include <pcmcia/ds.h> -#ifdef FT_DEBUG -#define DEBUG(n, args...) printk(KERN_DEBUG args); -#else -#define DEBUG(n, args...) -#endif - #include <linux/delay.h> #include "ft1000.h" @@ -57,7 +53,7 @@ static const struct firmware *fw_entry; static void ft1000_hbchk(u_long data); static struct timer_list poll_timer = { - .function = ft1000_hbchk + .function = ft1000_hbchk }; static u16 cmdbuffer[1024]; @@ -72,7 +68,7 @@ static void ft1000_disable_interrupts(struct net_device *dev); /* new kernel */ MODULE_AUTHOR(""); MODULE_DESCRIPTION - ("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs."); +("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs."); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("FT1000"); @@ -80,15 +76,15 @@ MODULE_SUPPORTED_DEVICE("FT1000"); /*--------------------------------------------------------------------------- - Function: ft1000_read_fifo_len - Description: This function will read the ASIC Uplink FIFO status register - which will return the number of bytes remaining in the Uplink FIFO. - Sixteen bytes are subtracted to make sure that the ASIC does not - reach its threshold. - Input: - dev - network device structure - Output: - value - number of bytes available in the ASIC Uplink FIFO. + Function: ft1000_read_fifo_len + Description: This function will read the ASIC Uplink FIFO status register + which will return the number of bytes remaining in the Uplink FIFO. + Sixteen bytes are subtracted to make sure that the ASIC does not + reach its threshold. + Input: + dev - network device structure + Output: + value - number of bytes available in the ASIC Uplink FIFO. -------------------------------------------------------------------------*/ static inline u16 ft1000_read_fifo_len(struct net_device *dev) @@ -103,14 +99,14 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_read_dpram - Description: This function will read the specific area of dpram - (Electrabuzz ASIC only) - Input: - dev - device structure - offset - index of dpram - Output: - value - value of dpram + Function: ft1000_read_dpram + Description: This function will read the specific area of dpram + (Electrabuzz ASIC only) + Input: + dev - device structure + offset - index of dpram + Output: + value - value of dpram -------------------------------------------------------------------------*/ u16 ft1000_read_dpram(struct net_device *dev, int offset) @@ -130,19 +126,19 @@ u16 ft1000_read_dpram(struct net_device *dev, int offset) /*--------------------------------------------------------------------------- - Function: ft1000_write_dpram - Description: This function will write to a specific area of dpram - (Electrabuzz ASIC only) - Input: - dev - device structure - offset - index of dpram - value - value to write - Output: - none. + Function: ft1000_write_dpram + Description: This function will write to a specific area of dpram + (Electrabuzz ASIC only) + Input: + dev - device structure + offset - index of dpram + value - value to write + Output: + none. -------------------------------------------------------------------------*/ static inline void ft1000_write_dpram(struct net_device *dev, - int offset, u16 value) + int offset, u16 value) { struct ft1000_info *info = netdev_priv(dev); unsigned long flags; @@ -156,14 +152,14 @@ static inline void ft1000_write_dpram(struct net_device *dev, /*--------------------------------------------------------------------------- - Function: ft1000_read_dpram_mag_16 - Description: This function will read the specific area of dpram - (Magnemite ASIC only) - Input: - dev - device structure - offset - index of dpram - Output: - value - value of dpram + Function: ft1000_read_dpram_mag_16 + Description: This function will read the specific area of dpram + (Magnemite ASIC only) + Input: + dev - device structure + offset - index of dpram + Output: + value - value of dpram -------------------------------------------------------------------------*/ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) @@ -188,19 +184,19 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) /*--------------------------------------------------------------------------- - Function: ft1000_write_dpram_mag_16 - Description: This function will write to a specific area of dpram - (Magnemite ASIC only) - Input: - dev - device structure - offset - index of dpram - value - value to write - Output: - none. + Function: ft1000_write_dpram_mag_16 + Description: This function will write to a specific area of dpram + (Magnemite ASIC only) + Input: + dev - device structure + offset - index of dpram + value - value to write + Output: + none. -------------------------------------------------------------------------*/ static inline void ft1000_write_dpram_mag_16(struct net_device *dev, - int offset, u16 value, int Index) + int offset, u16 value, int Index) { struct ft1000_info *info = netdev_priv(dev); unsigned long flags; @@ -218,14 +214,14 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev, /*--------------------------------------------------------------------------- - Function: ft1000_read_dpram_mag_32 - Description: This function will read the specific area of dpram - (Magnemite ASIC only) - Input: - dev - device structure - offset - index of dpram - Output: - value - value of dpram + Function: ft1000_read_dpram_mag_32 + Description: This function will read the specific area of dpram + (Magnemite ASIC only) + Input: + dev - device structure + offset - index of dpram + Output: + value - value of dpram -------------------------------------------------------------------------*/ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) @@ -245,15 +241,15 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) /*--------------------------------------------------------------------------- - Function: ft1000_write_dpram_mag_32 - Description: This function will write to a specific area of dpram - (Magnemite ASIC only) - Input: - dev - device structure - offset - index of dpram - value - value to write - Output: - none. + Function: ft1000_write_dpram_mag_32 + Description: This function will write to a specific area of dpram + (Magnemite ASIC only) + Input: + dev - device structure + offset - index of dpram + value - value to write + Output: + none. -------------------------------------------------------------------------*/ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) @@ -270,57 +266,51 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) /*--------------------------------------------------------------------------- - Function: ft1000_enable_interrupts - Description: This function will enable interrupts base on the current interrupt mask. - Input: - dev - device structure - Output: - None. + Function: ft1000_enable_interrupts + Description: This function will enable interrupts base on the current interrupt mask. + Input: + dev - device structure + Output: + None. -------------------------------------------------------------------------*/ static void ft1000_enable_interrupts(struct net_device *dev) { u16 tempword; - DEBUG(1, "ft1000_hw:ft1000_enable_interrupts()\n"); ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_DEFAULT_MASK); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); - DEBUG(1, - "ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n", - tempword); + pr_debug("current interrupt enable mask = 0x%x\n", tempword); } /*--------------------------------------------------------------------------- - Function: ft1000_disable_interrupts - Description: This function will disable all interrupts. - Input: - dev - device structure - Output: - None. + Function: ft1000_disable_interrupts + Description: This function will disable all interrupts. + Input: + dev - device structure + Output: + None. -------------------------------------------------------------------------*/ static void ft1000_disable_interrupts(struct net_device *dev) { u16 tempword; - DEBUG(1, "ft1000_hw: ft1000_disable_interrupts()\n"); ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_MASK_ALL); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); - DEBUG(1, - "ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n", - tempword); + pr_debug("current interrupt enable mask = 0x%x\n", tempword); } /*--------------------------------------------------------------------------- - Function: ft1000_reset_asic - Description: This function will call the Card Service function to reset the - ASIC. - Input: - dev - device structure - Output: - none + Function: ft1000_reset_asic + Description: This function will call the Card Service function to reset the + ASIC. + Input: + dev - device structure + Output: + none -------------------------------------------------------------------------*/ static void ft1000_reset_asic(struct net_device *dev) @@ -329,8 +319,6 @@ static void ft1000_reset_asic(struct net_device *dev) struct ft1000_pcmcia *pcmcia = info->priv; u16 tempword; - DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n"); - (*info->ft1000_reset) (pcmcia->link); /* @@ -351,22 +339,22 @@ static void ft1000_reset_asic(struct net_device *dev) } /* clear interrupts */ tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); + pr_debug("interrupt status register = 0x%x\n", tempword); ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); + pr_debug("interrupt status register = 0x%x\n", tempword); } /*--------------------------------------------------------------------------- - Function: ft1000_reset_card - Description: This function will reset the card - Input: - dev - device structure - Output: - status - false (card reset fail) - true (card reset successful) + Function: ft1000_reset_card + Description: This function will reset the card + Input: + dev - device structure + Output: + status - false (card reset fail) + true (card reset successful) -------------------------------------------------------------------------*/ static int ft1000_reset_card(struct net_device *dev) @@ -377,8 +365,6 @@ static int ft1000_reset_card(struct net_device *dev) unsigned long flags; struct prov_record *ptr; - DEBUG(1, "ft1000_hw:ft1000_reset_card called.....\n"); - info->CardReady = 0; info->ProgConStat = 0; info->squeseqnum = 0; @@ -388,8 +374,7 @@ static int ft1000_reset_card(struct net_device *dev) /* Make sure we free any memory reserve for provisioning */ while (list_empty(&info->prov_list) == 0) { - DEBUG(0, - "ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); + pr_debug("deleting provisioning record\n"); ptr = list_entry(info->prov_list.next, struct prov_record, list); list_del(&ptr->list); kfree(ptr->pprov_data); @@ -397,11 +382,10 @@ static int ft1000_reset_card(struct net_device *dev) } if (info->AsicID == ELECTRABUZZ_ID) { - DEBUG(1, "ft1000_hw:ft1000_reset_card:resetting DSP\n"); + pr_debug("resetting DSP\n"); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); } else { - DEBUG(1, - "ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n"); + pr_debug("resetting ASIC and DSP\n"); ft1000_write_reg(dev, FT1000_REG_RESET, (DSP_RESET_BIT | ASIC_RESET_BIT)); } @@ -428,17 +412,16 @@ static int ft1000_reset_card(struct net_device *dev) spin_unlock_irqrestore(&info->dpram_lock, flags); } - DEBUG(1, "ft1000_hw:ft1000_reset_card:resetting ASIC\n"); + pr_debug("resetting ASIC\n"); mdelay(10); /* reset ASIC */ ft1000_reset_asic(dev); - DEBUG(1, "ft1000_hw:ft1000_reset_card:downloading dsp image\n"); + pr_debug("downloading dsp image\n"); if (info->AsicID == MAGNEMITE_ID) { /* Put dsp in reset and take ASIC out of reset */ - DEBUG(0, - "ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); + pr_debug("Put DSP in reset and take ASIC out of reset\n"); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); /* Setting MAGNEMITE ASIC to big endian mode */ @@ -450,7 +433,7 @@ static int ft1000_reset_card(struct net_device *dev) ft1000_write_reg(dev, FT1000_REG_RESET, 0); /* FLARION_DSP_ACTIVE; */ mdelay(10); - DEBUG(0, "ft1000_hw:ft1000_reset_card:Take DSP out of reset\n"); + pr_debug("Take DSP out of reset\n"); /* Wait for 0xfefe indicating dsp ready before starting download */ for (i = 0; i < 50; i++) { @@ -464,8 +447,7 @@ static int ft1000_reset_card(struct net_device *dev) } if (i == 50) { - DEBUG(0, - "ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); + pr_debug("No FEFE detected from DSP\n"); return false; } @@ -476,10 +458,10 @@ static int ft1000_reset_card(struct net_device *dev) } if (card_download(dev, fw_entry->data, fw_entry->size)) { - DEBUG(1, "card download unsuccessful\n"); + pr_debug("card download unsuccessful\n"); return false; } else { - DEBUG(1, "card download successful\n"); + pr_debug("card download successful\n"); } mdelay(10); @@ -494,8 +476,7 @@ static int ft1000_reset_card(struct net_device *dev) /* Initialize DSP heartbeat area to ho */ ft1000_write_dpram(dev, FT1000_HI_HO, ho); tempword = ft1000_read_dpram(dev, FT1000_HI_HO); - DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n", - tempword); + pr_debug("hi_ho value = 0x%x\n", tempword); } else { /* Initialize DSP heartbeat area to ho */ ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag, @@ -503,8 +484,7 @@ static int ft1000_reset_card(struct net_device *dev) tempword = ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX); - DEBUG(1, "ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", - tempword); + pr_debug("hi_ho value = 0x%x\n", tempword); } info->CardReady = 1; @@ -521,14 +501,14 @@ static int ft1000_reset_card(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_chkcard - Description: This function will check if the device is presently available on - the system. - Input: - dev - device structure - Output: - status - false (device is not present) - true (device is present) + Function: ft1000_chkcard + Description: This function will check if the device is presently available on + the system. + Input: + dev - device structure + Output: + status - false (device is not present) + true (device is present) -------------------------------------------------------------------------*/ static int ft1000_chkcard(struct net_device *dev) @@ -541,8 +521,7 @@ static int ft1000_chkcard(struct net_device *dev) */ tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); if (tempword == 0) { - DEBUG(1, - "ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); + pr_debug("IMASK = 0 Card not detected\n"); return false; } /* @@ -551,8 +530,7 @@ static int ft1000_chkcard(struct net_device *dev) */ tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); if (tempword == 0xffff) { - DEBUG(1, - "ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); + pr_debug("Version = 0xffff Card not detected\n"); return false; } return true; @@ -561,13 +539,13 @@ static int ft1000_chkcard(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_hbchk - Description: This function will perform the heart beat check of the DSP as - well as the ASIC. - Input: - dev - device structure - Output: - none + Function: ft1000_hbchk + Description: This function will perform the heart beat check of the DSP as + well as the ASIC. + Input: + dev - device structure + Output: + none -------------------------------------------------------------------------*/ static void ft1000_hbchk(u_long data) @@ -586,11 +564,10 @@ static void ft1000_hbchk(u_long data) } else { tempword = ntohs(ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_HI_HO, - FT1000_MAG_HI_HO_INDX)); + (dev, FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } - DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", - tempword); + pr_debug("hi_ho value = 0x%x\n", tempword); /* Let's perform another check if ho is not detected */ if (tempword != ho) { if (info->AsicID == ELECTRABUZZ_ID) { @@ -601,8 +578,7 @@ static void ft1000_hbchk(u_long data) } } if (tempword != ho) { - printk(KERN_INFO - "ft1000: heartbeat failed - no ho detected\n"); + pr_info("heartbeat failed - no ho detected\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -632,8 +608,7 @@ static void ft1000_hbchk(u_long data) } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { - printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + pr_info("Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } @@ -650,8 +625,7 @@ static void ft1000_hbchk(u_long data) tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); } if (tempword & FT1000_DB_HB) { - printk(KERN_INFO - "ft1000: heartbeat doorbell not clear by firmware\n"); + pr_info("heartbeat doorbell not clear by firmware\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -681,8 +655,7 @@ static void ft1000_hbchk(u_long data) } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { - printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + pr_info("Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } @@ -708,8 +681,8 @@ static void ft1000_hbchk(u_long data) } else { tempword = ntohs(ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_HI_HO, - FT1000_MAG_HI_HO_INDX)); + (dev, FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } /* Let's write hi again if fail */ if (tempword != hi) { @@ -730,8 +703,7 @@ static void ft1000_hbchk(u_long data) } if (tempword != hi) { - printk(KERN_INFO - "ft1000: heartbeat failed - cannot write hi into DPRAM\n"); + pr_info("heartbeat failed - cannot write hi into DPRAM\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -761,8 +733,7 @@ static void ft1000_hbchk(u_long data) } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { - printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + pr_info("Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } @@ -778,19 +749,19 @@ static void ft1000_hbchk(u_long data) /* Schedule this module to run every 2 seconds */ poll_timer.expires = jiffies + (2 * HZ); - poll_timer.data = (u_long) dev; + poll_timer.data = (u_long)dev; add_timer(&poll_timer); } /*--------------------------------------------------------------------------- - Function: ft1000_send_cmd - Description: - Input: - Output: + Function: ft1000_send_cmd + Description: + Input: + Output: -------------------------------------------------------------------------*/ -static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype) +static void ft1000_send_cmd(struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype) { struct ft1000_info *info = netdev_priv(dev); int i; @@ -802,26 +773,26 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, if ((size & 0x0001)) { size++; } - DEBUG(1, "FT1000:ft1000_send_cmd:total length = %d\n", size); - DEBUG(1, "FT1000:ft1000_send_cmd:length = %d\n", ntohs(*ptempbuffer)); + pr_debug("total length = %d\n", size); + pr_debug("length = %d\n", ntohs(*ptempbuffer)); /* * put message into slow queue area * All messages are in the form total_len + pseudo header + message body */ spin_lock_irqsave(&info->dpram_lock, flags); - /* Make sure SLOWQ doorbell is clear */ - tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - i=0; - while (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - i++; - if (i==10) { - spin_unlock_irqrestore(&info->dpram_lock, flags); - return; - } - tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - } + /* Make sure SLOWQ doorbell is clear */ + tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); + i = 0; + while (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + i++; + if (i == 10) { + spin_unlock_irqrestore(&info->dpram_lock, flags); + return; + } + tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); + } if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, @@ -830,8 +801,7 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, size); /* Write pseudo header and messgae body */ for (i = 0; i < (size >> 1); i++) { - DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i, - *ptempbuffer); + pr_debug("data %d = 0x%x\n", i, *ptempbuffer); tempword = htons(*ptempbuffer++); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, tempword); } @@ -844,18 +814,16 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, FT1000_DPRAM_MAG_TX_BASE + 1); for (i = 0; i < (size >> 2); i++) { - DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", - *ptempbuffer); + pr_debug("data = 0x%x\n", *ptempbuffer); outw(*ptempbuffer++, - dev->base_addr + FT1000_REG_MAG_DPDATAL); - DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", - *ptempbuffer); + dev->base_addr + FT1000_REG_MAG_DPDATAL); + pr_debug("data = 0x%x\n", *ptempbuffer); outw(*ptempbuffer++, - dev->base_addr + FT1000_REG_MAG_DPDATAH); + dev->base_addr + FT1000_REG_MAG_DPDATAH); } - DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", *ptempbuffer); + pr_debug("data = 0x%x\n", *ptempbuffer); outw(*ptempbuffer++, dev->base_addr + FT1000_REG_MAG_DPDATAL); - DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", *ptempbuffer); + pr_debug("data = 0x%x\n", *ptempbuffer); outw(*ptempbuffer++, dev->base_addr + FT1000_REG_MAG_DPDATAH); } spin_unlock_irqrestore(&info->dpram_lock, flags); @@ -866,19 +834,19 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, /*--------------------------------------------------------------------------- - Function: ft1000_receive_cmd - Description: This function will read a message from the dpram area. - Input: - dev - network device structure - pbuffer - caller supply address to buffer - pnxtph - pointer to next pseudo header - Output: - Status = 0 (unsuccessful) - = 1 (successful) + Function: ft1000_receive_cmd + Description: This function will read a message from the dpram area. + Input: + dev - network device structure + pbuffer - caller supply address to buffer + pnxtph - pointer to next pseudo header + Output: + Status = 0 (unsuccessful) + = 1 (successful) -------------------------------------------------------------------------*/ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, - int maxsz, u16 *pnxtph) + int maxsz, u16 *pnxtph) { struct ft1000_info *info = netdev_priv(dev); u16 size; @@ -888,20 +856,18 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, unsigned long flags; if (info->AsicID == ELECTRABUZZ_ID) { - size = ( ft1000_read_dpram(dev, *pnxtph) ) + sizeof(struct pseudo_hdr); + size = (ft1000_read_dpram(dev, *pnxtph)) + sizeof(struct pseudo_hdr); } else { size = ntohs(ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_PH_LEN, - FT1000_MAG_PH_LEN_INDX)) + sizeof(struct pseudo_hdr); + (dev, FT1000_MAG_PH_LEN, + FT1000_MAG_PH_LEN_INDX)) + sizeof(struct pseudo_hdr); } if (size > maxsz) { - DEBUG(1, - "FT1000:ft1000_receive_cmd:Invalid command length = %d\n", - size); + pr_debug("Invalid command length = %d\n", size); return false; } else { - ppseudohdr = (u16 *) pbuffer; + ppseudohdr = (u16 *)pbuffer; spin_lock_irqsave(&info->dpram_lock, flags); if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, @@ -915,26 +881,26 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, FT1000_DPRAM_MAG_RX_BASE); *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); - DEBUG(1, "ft1000_hw:received data = 0x%x\n", *pbuffer); + pr_debug("received data = 0x%x\n", *pbuffer); pbuffer++; ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, FT1000_DPRAM_MAG_RX_BASE + 1); for (i = 0; i <= (size >> 2); i++) { *pbuffer = inw(dev->base_addr + - FT1000_REG_MAG_DPDATAL); + FT1000_REG_MAG_DPDATAL); pbuffer++; *pbuffer = inw(dev->base_addr + - FT1000_REG_MAG_DPDATAH); + FT1000_REG_MAG_DPDATAH); pbuffer++; } /* copy odd aligned word */ *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAL); - DEBUG(1, "ft1000_hw:received data = 0x%x\n", *pbuffer); + pr_debug("received data = 0x%x\n", *pbuffer); pbuffer++; *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); - DEBUG(1, "ft1000_hw:received data = 0x%x\n", *pbuffer); + pr_debug("received data = 0x%x\n", *pbuffer); pbuffer++; } if (size & 0x0001) { @@ -953,8 +919,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, tempword ^= *ppseudohdr++; } if ((tempword != *ppseudohdr)) { - DEBUG(1, - "FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n"); + pr_debug("Pseudo header checksum mismatch\n"); /* Drop this message */ return false; } @@ -964,13 +929,13 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, /*--------------------------------------------------------------------------- - Function: ft1000_proc_drvmsg - Description: This function will process the various driver messages. - Input: - dev - device structure - pnxtph - pointer to next pseudo header - Output: - none + Function: ft1000_proc_drvmsg + Description: This function will process the various driver messages. + Input: + dev - device structure + pnxtph - pointer to next pseudo header + Output: + none -------------------------------------------------------------------------*/ static void ft1000_proc_drvmsg(struct net_device *dev) @@ -992,25 +957,24 @@ static void ft1000_proc_drvmsg(struct net_device *dev) u16 wrd; } convert; - if (info->AsicID == ELECTRABUZZ_ID) { - tempword = FT1000_DPRAM_RX_BASE+2; - } - else { - tempword = FT1000_DPRAM_MAG_RX_BASE; - } - if ( ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword) ) { + if (info->AsicID == ELECTRABUZZ_ID) { + tempword = FT1000_DPRAM_RX_BASE+2; + } + else { + tempword = FT1000_DPRAM_MAG_RX_BASE; + } + if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { /* Get the message type which is total_len + PSEUDO header + msgtype + message body */ - pdrvmsg = (struct drv_msg *) & cmdbuffer[0]; + pdrvmsg = (struct drv_msg *)&cmdbuffer[0]; msgtype = ntohs(pdrvmsg->type); - DEBUG(1, "Command message type = 0x%x\n", msgtype); + pr_debug("Command message type = 0x%x\n", msgtype); switch (msgtype) { case DSP_PROVISION: - DEBUG(0, - "Got a provisioning request message from DSP\n"); + pr_debug("Got a provisioning request message from DSP\n"); mdelay(25); while (list_empty(&info->prov_list) == 0) { - DEBUG(0, "Sending a provisioning message\n"); + pr_debug("Sending a provisioning message\n"); /* Make sure SLOWQ doorbell is clear */ tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); @@ -1025,25 +989,25 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ptr = list_entry(info->prov_list.next, struct prov_record, list); - len = *(u16 *) ptr->pprov_data; + len = *(u16 *)ptr->pprov_data; len = htons(len); - pmsg = (u16 *) ptr->pprov_data; - ppseudo_hdr = (struct pseudo_hdr *) pmsg; + pmsg = (u16 *)ptr->pprov_data; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; /* Insert slow queue sequence number */ ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->portsrc = 0; /* Calculate new checksum */ ppseudo_hdr->checksum = *pmsg++; - DEBUG(1, "checksum = 0x%x\n", - ppseudo_hdr->checksum); + pr_debug("checksum = 0x%x\n", + ppseudo_hdr->checksum); for (i = 1; i < 7; i++) { ppseudo_hdr->checksum ^= *pmsg++; - DEBUG(1, "checksum = 0x%x\n", - ppseudo_hdr->checksum); + pr_debug("checksum = 0x%x\n", + ppseudo_hdr->checksum); } - ft1000_send_cmd (dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE); + ft1000_send_cmd(dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE); list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); @@ -1055,19 +1019,29 @@ static void ft1000_proc_drvmsg(struct net_device *dev) info->CardReady = 1; break; case MEDIA_STATE: - pmediamsg = (struct media_msg *) & cmdbuffer[0]; + pmediamsg = (struct media_msg *)&cmdbuffer[0]; if (info->ProgConStat != 0xFF) { - if (pmediamsg->state) { - DEBUG(1, "Media is up\n"); - if (info->mediastate == 0) { - netif_carrier_on(dev); - netif_wake_queue(dev); - info->mediastate = 1; - do_gettimeofday(&tv); - info->ConTm = tv.tv_sec; + if (pmediamsg->state) { + pr_debug("Media is up\n"); + if (info->mediastate == 0) { + netif_carrier_on(dev); + netif_wake_queue(dev); + info->mediastate = 1; + do_gettimeofday(&tv); + info->ConTm = tv.tv_sec; + } + } else { + pr_debug("Media is down\n"); + if (info->mediastate == 1) { + info->mediastate = 0; + netif_carrier_off(dev); + netif_stop_queue(dev); + info->ConTm = 0; + } } - } else { - DEBUG(1, "Media is down\n"); + } + else { + pr_debug("Media is down\n"); if (info->mediastate == 1) { info->mediastate = 0; netif_carrier_off(dev); @@ -1075,25 +1049,15 @@ static void ft1000_proc_drvmsg(struct net_device *dev) info->ConTm = 0; } } - } - else { - DEBUG(1, "Media is down\n"); - if (info->mediastate == 1) { - info->mediastate = 0; - netif_carrier_off(dev); - netif_stop_queue(dev); - info->ConTm = 0; - } - } break; case DSP_INIT_MSG: - pdspinitmsg = (struct dsp_init_msg *) & cmdbuffer[0]; + pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[0]; memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); - DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", - info->DspVer[0], info->DspVer[1], info->DspVer[2], - info->DspVer[3]); + pr_debug("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", + info->DspVer[0], info->DspVer[1], + info->DspVer[2], info->DspVer[3]); memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, - HWSERNUMSZ); + HWSERNUMSZ); memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); dev->dev_addr[0] = info->eui64[0]; @@ -1104,34 +1068,33 @@ static void ft1000_proc_drvmsg(struct net_device *dev) dev->dev_addr[5] = info->eui64[7]; if (ntohs(pdspinitmsg->length) == - (sizeof(struct dsp_init_msg) - 20)) { + (sizeof(struct dsp_init_msg) - 20)) { memcpy(info->ProductMode, - pdspinitmsg->ProductMode, MODESZ); + pdspinitmsg->ProductMode, MODESZ); memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, - CALVERSZ); + CALVERSZ); memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, - CALDATESZ); - DEBUG(1, "RFCalVer = 0x%2x 0x%2x\n", - info->RfCalVer[0], info->RfCalVer[1]); + CALDATESZ); + pr_debug("RFCalVer = 0x%2x 0x%2x\n", + info->RfCalVer[0], info->RfCalVer[1]); } - break ; + break; case DSP_STORE_INFO: - DEBUG(1, "FT1000:drivermsg:Got DSP_STORE_INFO\n"); + pr_debug("Got DSP_STORE_INFO\n"); tempword = ntohs(pdrvmsg->length); info->DSPInfoBlklen = tempword; if (tempword < (MAX_DSP_SESS_REC - 4)) { - pmsg = (u16 *) & pdrvmsg->data[0]; + pmsg = (u16 *)&pdrvmsg->data[0]; for (i = 0; i < ((tempword + 1) / 2); i++) { - DEBUG(1, - "FT1000:drivermsg:dsp info data = 0x%x\n", - *pmsg); + pr_debug("dsp info data = 0x%x\n", + *pmsg); info->DSPInfoBlk[i + 10] = *pmsg++; } } break; case DSP_GET_INFO: - DEBUG(1, "FT1000:drivermsg:Got DSP_GET_INFO\n"); + pr_debug("Got DSP_GET_INFO\n"); /* * copy dsp info block to dsp * allow any outstanding ioctl to finish @@ -1152,8 +1115,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) * Put message into Slow Queue * Form Pseudo header */ - pmsg = (u16 *) info->DSPInfoBlk; - ppseudo_hdr = (struct pseudo_hdr *) pmsg; + pmsg = (u16 *)info->DSPInfoBlk; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; ppseudo_hdr->length = htons(info->DSPInfoBlklen + 4); ppseudo_hdr->source = 0x10; @@ -1177,12 +1140,12 @@ static void ft1000_proc_drvmsg(struct net_device *dev) info->DSPInfoBlk[8] = 0x7200; info->DSPInfoBlk[9] = htons(info->DSPInfoBlklen); - ft1000_send_cmd (dev, (u16 *)info->DSPInfoBlk, (u16)(info->DSPInfoBlklen+4), 0); + ft1000_send_cmd(dev, (u16 *)info->DSPInfoBlk, (u16)(info->DSPInfoBlklen+4), 0); } break; case GET_DRV_ERR_RPT_MSG: - DEBUG(1, "FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); + pr_debug("Got GET_DRV_ERR_RPT_MSG\n"); /* * copy driver error message to dsp * allow any outstanding ioctl to finish @@ -1203,8 +1166,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) * Put message into Slow Queue * Form Pseudo header */ - pmsg = (u16 *) & tempbuffer[0]; - ppseudo_hdr = (struct pseudo_hdr *) pmsg; + pmsg = (u16 *)&tempbuffer[0]; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; ppseudo_hdr->length = htons(0x0012); ppseudo_hdr->source = 0x10; ppseudo_hdr->destination = 0x20; @@ -1220,11 +1183,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev) /* Insert application id */ ppseudo_hdr->portsrc = 0; /* Calculate new checksum */ - ppseudo_hdr->checksum = *pmsg++; - for (i=1; i<7; i++) { - ppseudo_hdr->checksum ^= *pmsg++; - } - pmsg = (u16 *) & tempbuffer[16]; + ppseudo_hdr->checksum = *pmsg++; + for (i = 1; i < 7; i++) { + ppseudo_hdr->checksum ^= *pmsg++; + } + pmsg = (u16 *)&tempbuffer[16]; *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); *pmsg++ = htons(0x000e); *pmsg++ = htons(info->DSP_TIME[0]); @@ -1239,7 +1202,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) *pmsg++ = convert.wrd; *pmsg++ = htons(info->DrvErrNum); - ft1000_send_cmd (dev, (u16 *)&tempbuffer[0], (u16)(0x0012), 0); + ft1000_send_cmd(dev, (u16 *)&tempbuffer[0], (u16)(0x0012), 0); info->DrvErrNum = 0; } @@ -1252,14 +1215,14 @@ static void ft1000_proc_drvmsg(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_parse_dpram_msg - Description: This function will parse the message received from the DSP - via the DPRAM interface. - Input: - dev - device structure - Output: - status - FAILURE - SUCCESS + Function: ft1000_parse_dpram_msg + Description: This function will parse the message received from the DSP + via the DPRAM interface. + Input: + dev - device structure + Output: + status - FAILURE + SUCCESS -------------------------------------------------------------------------*/ static int ft1000_parse_dpram_msg(struct net_device *dev) @@ -1270,11 +1233,10 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) u16 nxtph; u16 total_len; int i = 0; - int cnt; unsigned long flags; doorbell = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - DEBUG(1, "Doorbell = 0x%x\n", doorbell); + pr_debug("Doorbell = 0x%x\n", doorbell); if (doorbell & FT1000_ASIC_RESET_REQ) { /* Copy DSP session record from info block */ @@ -1291,7 +1253,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) FT1000_DPRAM_MAG_RX_BASE); for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) { outl(info->DSPSess.MagRec[i], - dev->base_addr + FT1000_REG_MAG_DPDATA); + dev->base_addr + FT1000_REG_MAG_DPDATA); } } spin_unlock_irqrestore(&info->dpram_lock, flags); @@ -1299,7 +1261,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) /* clear ASIC RESET request */ ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_ASIC_RESET_REQ); - DEBUG(1, "Got an ASIC RESET Request\n"); + pr_debug("Got an ASIC RESET Request\n"); ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_ASIC_RESET_DSP); @@ -1311,8 +1273,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) } if (doorbell & FT1000_DSP_ASIC_RESET) { - DEBUG(0, - "FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n"); + pr_debug("Got a dsp ASIC reset message\n"); ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_DSP_ASIC_RESET); udelay(200); @@ -1320,8 +1281,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) } if (doorbell & FT1000_DB_DPRAM_RX) { - DEBUG(1, - "FT1000:ft1000_parse_dpram_msg: Got a slow queue message\n"); + pr_debug("Got a slow queue message\n"); nxtph = FT1000_DPRAM_RX_BASE + 2; if (info->AsicID == ELECTRABUZZ_ID) { total_len = @@ -1329,14 +1289,12 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) } else { total_len = ntohs(ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_TOTAL_LEN, - FT1000_MAG_TOTAL_LEN_INDX)); + (dev, FT1000_MAG_TOTAL_LEN, + FT1000_MAG_TOTAL_LEN_INDX)); } - DEBUG(1, "FT1000:ft1000_parse_dpram_msg:total length = %d\n", - total_len); + pr_debug("total length = %d\n", total_len); if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) { - total_len += nxtph; - cnt = 0; + total_len += nxtph; /* * ft1000_read_reg will return a value that needs to be byteswap * in order to get DSP_QID_OFFSET. @@ -1353,7 +1311,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) (dev, FT1000_MAG_PORT_ID, FT1000_MAG_PORT_ID_INDX) & 0xff); } - DEBUG(1, "DSP_QID = 0x%x\n", portid); + pr_debug("DSP_QID = 0x%x\n", portid); if (portid == DRIVERID) { /* We are assumming one driver message from the DSP at a time. */ @@ -1389,7 +1347,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DSP_CONDRESET_INFO; - DEBUG(1, "ft1000_hw:DSP conditional reset requested\n"); + pr_debug("DSP conditional reset requested\n"); ft1000_reset_card(dev); ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_DB_COND_RESET); @@ -1397,9 +1355,9 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) /* let's clear any unexpected doorbells from DSP */ doorbell = doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ | - FT1000_DB_COND_RESET | 0xff00); + FT1000_DB_COND_RESET | 0xff00); if (doorbell) { - DEBUG(1, "Clearing unexpected doorbell = 0x%x\n", doorbell); + pr_debug("Clearing unexpected doorbell = 0x%x\n", doorbell); ft1000_write_reg(dev, FT1000_REG_DOORBELL, doorbell); } @@ -1409,14 +1367,14 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_flush_fifo - Description: This function will flush one packet from the downlink - FIFO. - Input: - dev - device structure - drv_err - driver error causing the flush fifo - Output: - None. + Function: ft1000_flush_fifo + Description: This function will flush one packet from the downlink + FIFO. + Input: + dev - device structure + drv_err - driver error causing the flush fifo + Output: + None. -------------------------------------------------------------------------*/ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) @@ -1427,7 +1385,6 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) u32 templong; u16 tempword; - DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n"); if (pcmcia->PktIntfErr > MAX_PH_ERR) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = @@ -1514,7 +1471,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) */ tempword = inw(dev->base_addr + - FT1000_REG_SUP_IMASK); + FT1000_REG_SUP_IMASK); if (tempword == 0) { /* This indicates that we can not communicate with the ASIC */ info->DrvErrNum = @@ -1533,23 +1490,23 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) } while ((tempword & 0x03) != 0x03); if (info->AsicID == ELECTRABUZZ_ID) { i++; - DEBUG(0, "Flushing FIFO complete = %x\n", tempword); + pr_debug("Flushing FIFO complete = %x\n", tempword); /* Flush last word in FIFO. */ tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); /* Update FIFO counter for DSP */ i = i * 2; - DEBUG(0, "Flush Data byte count to dsp = %d\n", i); + pr_debug("Flush Data byte count to dsp = %d\n", i); info->fifo_cnt += i; ft1000_write_dpram(dev, FT1000_FIFO_LEN, info->fifo_cnt); } else { - DEBUG(0, "Flushing FIFO complete = %x\n", tempword); + pr_debug("Flushing FIFO complete = %x\n", tempword); /* Flush last word in FIFO */ templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); - DEBUG(0, "FT1000_REG_SUP_STAT = 0x%x\n", tempword); + pr_debug("FT1000_REG_SUP_STAT = 0x%x\n", tempword); tempword = inw(dev->base_addr + FT1000_REG_MAG_DFSR); - DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword); + pr_debug("FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } if (DrvErrNum) { pcmcia->PktIntfErr++; @@ -1559,15 +1516,15 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) /*--------------------------------------------------------------------------- - Function: ft1000_copy_up_pkt - Description: This function will pull Flarion packets out of the Downlink - FIFO and convert it to an ethernet packet. The ethernet packet will - then be deliver to the TCP/IP stack. - Input: - dev - device structure - Output: - status - FAILURE - SUCCESS + Function: ft1000_copy_up_pkt + Description: This function will pull Flarion packets out of the Downlink + FIFO and convert it to an ethernet packet. The ethernet packet will + then be deliver to the TCP/IP stack. + Input: + dev - device structure + Output: + status - FAILURE + SUCCESS -------------------------------------------------------------------------*/ static int ft1000_copy_up_pkt(struct net_device *dev) @@ -1583,7 +1540,6 @@ static int ft1000_copy_up_pkt(struct net_device *dev) u32 *ptemplong; u32 templong; - DEBUG(1, "ft1000_copy_up_pkt\n"); /* Read length */ if (info->AsicID == ELECTRABUZZ_ID) { tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); @@ -1593,10 +1549,10 @@ static int ft1000_copy_up_pkt(struct net_device *dev) len = ntohs(tempword); } chksum = tempword; - DEBUG(1, "Number of Bytes in FIFO = %d\n", len); + pr_debug("Number of Bytes in FIFO = %d\n", len); if (len > ENET_MAX_SIZE) { - DEBUG(0, "size of ethernet packet invalid\n"); + pr_debug("size of ethernet packet invalid\n"); if (info->AsicID == MAGNEMITE_ID) { /* Read High word to complete 32 bit access */ tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); @@ -1609,7 +1565,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) skb = dev_alloc_skb(len + 12 + 2); if (skb == NULL) { - DEBUG(0, "No Network buffers available\n"); + pr_debug("No Network buffers available\n"); /* Read High word to complete 32 bit access */ if (info->AsicID == MAGNEMITE_ID) { tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); @@ -1618,7 +1574,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) info->stats.rx_errors++; return FAILURE; } - pbuffer = (u8 *) skb_put(skb, len + 12); + pbuffer = (u8 *)skb_put(skb, len + 12); /* Pseudo header */ if (info->AsicID == ELECTRABUZZ_ID) { @@ -1630,37 +1586,37 @@ static int ft1000_copy_up_pkt(struct net_device *dev) tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); } else { tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRL); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRL); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRL); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); chksum ^= tempword; /* read checksum value */ tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); - DEBUG(1, "Pseudo = 0x%x\n", tempword); + pr_debug("Pseudo = 0x%x\n", tempword); } if (chksum != tempword) { - DEBUG(0, "Packet checksum mismatch 0x%x 0x%x\n", chksum, - tempword); + pr_debug("Packet checksum mismatch 0x%x 0x%x\n", + chksum, tempword); ft1000_flush_fifo(dev, DSP_PKTPHCKSUM_INFO); info->stats.rx_errors++; kfree_skb(skb); @@ -1687,7 +1643,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) for (i = 0; i < len / 2; i++) { tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); *pbuffer++ = (u8) (tempword >> 8); - *pbuffer++ = (u8) tempword; + *pbuffer++ = (u8)tempword; if (ft1000_chkcard(dev) == false) { kfree_skb(skb); return FAILURE; @@ -1700,25 +1656,25 @@ static int ft1000_copy_up_pkt(struct net_device *dev) *pbuffer++ = (u8) (tempword >> 8); } } else { - ptemplong = (u32 *) pbuffer; + ptemplong = (u32 *)pbuffer; for (i = 0; i < len / 4; i++) { templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); - DEBUG(1, "Data = 0x%8x\n", templong); + pr_debug("Data = 0x%8x\n", templong); *ptemplong++ = templong; } /* Need to read one more word if odd align. */ if (len & 0x0003) { templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); - DEBUG(1, "Data = 0x%8x\n", templong); + pr_debug("Data = 0x%8x\n", templong); *ptemplong++ = templong; } } - DEBUG(1, "Data passed to Protocol layer:\n"); + pr_debug("Data passed to Protocol layer:\n"); for (i = 0; i < len + 12; i++) { - DEBUG(1, "Protocol Data: 0x%x\n ", *ptemp++); + pr_debug("Protocol Data: 0x%x\n", *ptemp++); } skb->dev = dev; @@ -1745,20 +1701,20 @@ static int ft1000_copy_up_pkt(struct net_device *dev) /*--------------------------------------------------------------------------- - Function: ft1000_copy_down_pkt - Description: This function will take an ethernet packet and convert it to - a Flarion packet prior to sending it to the ASIC Downlink - FIFO. - Input: - dev - device structure - packet - address of ethernet packet - len - length of IP packet - Output: - status - FAILURE - SUCCESS + Function: ft1000_copy_down_pkt + Description: This function will take an ethernet packet and convert it to + a Flarion packet prior to sending it to the ASIC Downlink + FIFO. + Input: + dev - device structure + packet - address of ethernet packet + len - length of IP packet + Output: + status - FAILURE + SUCCESS -------------------------------------------------------------------------*/ -static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) +static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) { struct ft1000_info *info = netdev_priv(dev); struct ft1000_pcmcia *pcmcia = info->priv; @@ -1770,8 +1726,6 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) int i; u32 *plong; - DEBUG(1, "ft1000_hw: copy_down_pkt()\n"); - /* Check if there is room on the FIFO */ if (len > ft1000_read_fifo_len(dev)) { udelay(10); @@ -1791,8 +1745,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) udelay(20); } if (len > ft1000_read_fifo_len(dev)) { - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n"); + pr_debug("Transmit FIFO is full - pkt drop\n"); info->stats.tx_errors++; return SUCCESS; } @@ -1823,39 +1776,30 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) if (info->AsicID == ELECTRABUZZ_ID) { /* copy first word to UFIFO_BEG reg */ ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n", - pseudo.buff[0]); + pr_debug("data 0 BEG = 0x%04x\n", pseudo.buff[0]); /* copy subsequent words to UFIFO_MID reg */ ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n", - pseudo.buff[1]); + pr_debug("data 1 MID = 0x%04x\n", pseudo.buff[1]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[2]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 2 MID = 0x%04x\n", - pseudo.buff[2]); + pr_debug("data 2 MID = 0x%04x\n", pseudo.buff[2]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[3]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 3 MID = 0x%04x\n", - pseudo.buff[3]); + pr_debug("data 3 MID = 0x%04x\n", pseudo.buff[3]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[4]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 4 MID = 0x%04x\n", - pseudo.buff[4]); + pr_debug("data 4 MID = 0x%04x\n", pseudo.buff[4]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[5]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 5 MID = 0x%04x\n", - pseudo.buff[5]); + pr_debug("data 5 MID = 0x%04x\n", pseudo.buff[5]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[6]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 6 MID = 0x%04x\n", - pseudo.buff[6]); + pr_debug("data 6 MID = 0x%04x\n", pseudo.buff[6]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[7]); - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n", - pseudo.buff[7]); + pr_debug("data 7 MID = 0x%04x\n", pseudo.buff[7]); /* Write PPP type + IP Packet into Downlink FIFO */ for (i = 0; i < (len >> 1) - 1; i++) { ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, htons(*packet)); - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + pr_debug("data %d MID = 0x%04x\n", + i + 8, htons(*packet)); packet++; } @@ -1863,41 +1807,33 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) if (len & 0x0001) { ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, htons(*packet)); - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data MID = 0x%04x\n", - htons(*packet)); + pr_debug("data MID = 0x%04x\n", htons(*packet)); packet++; ft1000_write_reg(dev, FT1000_REG_UFIFO_END, htons(*packet)); - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + pr_debug("data %d MID = 0x%04x\n", + i + 8, htons(*packet)); } else { ft1000_write_reg(dev, FT1000_REG_UFIFO_END, htons(*packet)); - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + pr_debug("data %d MID = 0x%04x\n", + i + 8, htons(*packet)); } } else { - outl(*(u32 *) & pseudo.buff[0], - dev->base_addr + FT1000_REG_MAG_UFDR); - DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[0]); - outl(*(u32 *) & pseudo.buff[2], - dev->base_addr + FT1000_REG_MAG_UFDR); - DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[2]); - outl(*(u32 *) & pseudo.buff[4], - dev->base_addr + FT1000_REG_MAG_UFDR); - DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[4]); - outl(*(u32 *) & pseudo.buff[6], - dev->base_addr + FT1000_REG_MAG_UFDR); - DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[6]); - - plong = (u32 *) packet; + outl(*(u32 *)&pseudo.buff[0], + dev->base_addr + FT1000_REG_MAG_UFDR); + pr_debug("Pseudo = 0x%8x\n", *(u32 *)&pseudo.buff[0]); + outl(*(u32 *)&pseudo.buff[2], + dev->base_addr + FT1000_REG_MAG_UFDR); + pr_debug("Pseudo = 0x%8x\n", *(u32 *)&pseudo.buff[2]); + outl(*(u32 *)&pseudo.buff[4], + dev->base_addr + FT1000_REG_MAG_UFDR); + pr_debug("Pseudo = 0x%8x\n", *(u32 *)&pseudo.buff[4]); + outl(*(u32 *)&pseudo.buff[6], + dev->base_addr + FT1000_REG_MAG_UFDR); + pr_debug("Pseudo = 0x%8x\n", *(u32 *)&pseudo.buff[6]); + + plong = (u32 *)packet; /* Write PPP type + IP Packet into Downlink FIFO */ for (i = 0; i < (len >> 2); i++) { outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); @@ -1905,9 +1841,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) /* Check for odd alignment */ if (len & 0x0003) { - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", - *plong); + pr_debug("data = 0x%8x\n", *plong); outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); } outl(1, dev->base_addr + FT1000_REG_MAG_UFER); @@ -1928,19 +1862,14 @@ static struct net_device_stats *ft1000_stats(struct net_device *dev) static int ft1000_open(struct net_device *dev) { - - DEBUG(0, "ft1000_hw: ft1000_open is called\n"); - ft1000_reset_card(dev); - DEBUG(0, "ft1000_hw: ft1000_open is ended\n"); /* schedule ft1000_hbchk to perform periodic heartbeat checks on DSP and ASIC */ init_timer(&poll_timer); poll_timer.expires = jiffies + (2 * HZ); - poll_timer.data = (u_long) dev; + poll_timer.data = (u_long)dev; add_timer(&poll_timer); - DEBUG(0, "ft1000_hw: ft1000_open is ended2\n"); return 0; } @@ -1948,13 +1877,11 @@ static int ft1000_close(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - DEBUG(0, "ft1000_hw: ft1000_close()\n"); - info->CardReady = 0; del_timer(&poll_timer); if (ft1000_card_present == 1) { - DEBUG(0, "Media is down\n"); + pr_debug("Media is down\n"); netif_stop_queue(dev); ft1000_disable_interrupts(dev); @@ -1971,31 +1898,28 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) struct ft1000_info *info = netdev_priv(dev); u8 *pdata; - DEBUG(1, "ft1000_hw: ft1000_start_xmit()\n"); if (skb == NULL) { - DEBUG(1, "ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n"); + pr_debug("skb == NULL!!!\n"); return 0; } - DEBUG(1, "ft1000_hw: ft1000_start_xmit:length of packet = %d\n", - skb->len); + pr_debug("length of packet = %d\n", skb->len); - pdata = (u8 *) skb->data; + pdata = (u8 *)skb->data; if (info->mediastate == 0) { /* Drop packet is mediastate is down */ - DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:mediastate is down\n"); + pr_debug("mediastate is down\n"); return SUCCESS; } if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) { /* Drop packet which has invalid size */ - DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:invalid ethernet length\n"); + pr_debug("invalid ethernet length\n"); return SUCCESS; } ft1000_copy_down_pkt(dev, (u16 *) (pdata + ENET_HEADER_SIZE - 2), - skb->len - ENET_HEADER_SIZE + 2); + skb->len - ENET_HEADER_SIZE + 2); dev_kfree_skb(skb); @@ -2004,14 +1928,12 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) static irqreturn_t ft1000_interrupt(int irq, void *dev_id) { - struct net_device *dev = (struct net_device *)dev_id; + struct net_device *dev = dev_id; struct ft1000_info *info = netdev_priv(dev); u16 tempword; u16 inttype; int cnt; - DEBUG(1, "ft1000_hw: ft1000_interrupt()\n"); - if (info->CardReady == 0) { ft1000_disable_interrupts(dev); return IRQ_HANDLED; @@ -2033,19 +1955,19 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ft1000_parse_dpram_msg(dev); if (inttype & ISR_RCV) { - DEBUG(1, "Data in FIFO\n"); + pr_debug("Data in FIFO\n"); cnt = 0; do { /* Check if we have packets in the Downlink FIFO */ if (info->AsicID == ELECTRABUZZ_ID) { tempword = - ft1000_read_reg(dev, - FT1000_REG_DFIFO_STAT); + ft1000_read_reg(dev, + FT1000_REG_DFIFO_STAT); } else { tempword = - ft1000_read_reg(dev, - FT1000_REG_MAG_DFSR); + ft1000_read_reg(dev, + FT1000_REG_MAG_DFSR); } if (tempword & 0x1f) { ft1000_copy_up_pkt(dev); @@ -2058,12 +1980,13 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) } /* clear interrupts */ tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); + pr_debug("interrupt status register = 0x%x\n", tempword); ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); /* Read interrupt type */ - inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register after clear = 0x%x\n", inttype); + inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); + pr_debug("interrupt status register after clear = 0x%x\n", + inttype); } ft1000_enable_interrupts(dev); return IRQ_HANDLED; @@ -2075,8 +1998,6 @@ void stop_ft1000_card(struct net_device *dev) struct prov_record *ptr; /* int cnt; */ - DEBUG(0, "ft1000_hw: stop_ft1000_card()\n"); - info->CardReady = 0; ft1000_card_present = 0; netif_stop_queue(dev); @@ -2105,7 +2026,7 @@ void stop_ft1000_card(struct net_device *dev) } static void ft1000_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) + struct ethtool_drvinfo *info) { struct ft1000_info *ft_info; ft_info = netdev_priv(dev); @@ -2121,6 +2042,7 @@ static void ft1000_get_drvinfo(struct net_device *dev, static u32 ft1000_get_link(struct net_device *dev) { struct ft1000_info *info; + info = netdev_priv(dev); return info->mediastate; } @@ -2131,37 +2053,36 @@ static const struct ethtool_ops ops = { }; struct net_device *init_ft1000_card(struct pcmcia_device *link, - void *ft1000_reset) + void *ft1000_reset) { struct ft1000_info *info; struct ft1000_pcmcia *pcmcia; struct net_device *dev; static const struct net_device_ops ft1000ops = /* Slavius 21.10.2009 due to kernel changes */ - { - .ndo_open = &ft1000_open, - .ndo_stop = &ft1000_close, - .ndo_start_xmit = &ft1000_start_xmit, - .ndo_get_stats = &ft1000_stats, - }; + { + .ndo_open = &ft1000_open, + .ndo_stop = &ft1000_close, + .ndo_start_xmit = &ft1000_start_xmit, + .ndo_get_stats = &ft1000_stats, + }; - DEBUG(1, "ft1000_hw: init_ft1000_card()\n"); - DEBUG(1, "ft1000_hw: irq = %d\n", link->irq); - DEBUG(1, "ft1000_hw: port = 0x%04x\n", link->resource[0]->start); + pr_debug("irq = %d, port = 0x%04llx\n", + link->irq, (unsigned long long)link->resource[0]->start); flarion_ft1000_cnt++; if (flarion_ft1000_cnt > 1) { flarion_ft1000_cnt--; - printk(KERN_INFO - "ft1000: This driver can not support more than one instance\n"); + dev_info(&link->dev, + "This driver can not support more than one instance\n"); return NULL; } dev = alloc_etherdev(sizeof(struct ft1000_info)); if (!dev) { - printk(KERN_ERR "ft1000: failed to allocate etherdev\n"); + dev_err(&link->dev, "Failed to allocate etherdev\n"); return NULL; } @@ -2170,9 +2091,9 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, memset(info, 0, sizeof(struct ft1000_info)); - DEBUG(1, "address of dev = 0x%8x\n", (u32) dev); - DEBUG(1, "address of dev info = 0x%8x\n", (u32) info); - DEBUG(0, "device name = %s\n", dev->name); + pr_debug("address of dev = 0x%p\n", dev); + pr_debug("address of dev info = 0x%p\n", info); + pr_debug("device name = %s\n", dev->name); memset(&info->stats, 0, sizeof(struct net_device_stats)); @@ -2204,41 +2125,41 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, dev->netdev_ops = &ft1000ops; /* Slavius 21.10.2009 due to kernel changes */ - DEBUG(0, "device name = %s\n", dev->name); + pr_debug("device name = %s\n", dev->name); dev->irq = link->irq; dev->base_addr = link->resource[0]->start; if (pcmcia_get_mac_from_cis(link, dev)) { - printk(KERN_ERR "ft1000: Could not read mac address\n"); + netdev_err(dev, "Could not read mac address\n"); goto err_dev; } if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, dev)) { - printk(KERN_ERR "ft1000: Could not request_irq\n"); + netdev_err(dev, "Could not request_irq\n"); goto err_dev; } if (request_region(dev->base_addr, 256, dev->name) == NULL) { - printk(KERN_ERR "ft1000: Could not request_region\n"); + netdev_err(dev, "Could not request_region\n"); goto err_irq; } if (register_netdev(dev) != 0) { - DEBUG(0, "ft1000: Could not register netdev"); + pr_debug("Could not register netdev\n"); goto err_reg; } info->AsicID = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); if (info->AsicID == ELECTRABUZZ_ID) { - DEBUG(0, "ft1000_hw: ELECTRABUZZ ASIC\n"); + pr_debug("ELECTRABUZZ ASIC\n"); if (request_firmware(&fw_entry, "ft1000.img", &link->dev) != 0) { - printk(KERN_INFO "ft1000: Could not open ft1000.img\n"); + pr_info("Could not open ft1000.img\n"); goto err_unreg; } } else { - DEBUG(0, "ft1000_hw: MAGNEMITE ASIC\n"); + pr_debug("MAGNEMITE ASIC\n"); if (request_firmware(&fw_entry, "ft2000.img", &link->dev) != 0) { - printk(KERN_INFO "ft1000: Could not open ft2000.img\n"); + pr_info("Could not open ft2000.img\n"); goto err_unreg; } } @@ -2247,8 +2168,8 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ft1000_card_present = 1; dev->ethtool_ops = &ops; - printk(KERN_INFO "ft1000: %s: addr 0x%04lx irq %d, MAC addr %pM\n", - dev->name, dev->base_addr, dev->irq, dev->dev_addr); + pr_info("%s: addr 0x%04lx irq %d, MAC addr %pM\n", + dev->name, dev->base_addr, dev->irq, dev->dev_addr); return dev; err_unreg: |