Commit 588c31ea authored by Daniel Dodge's avatar Daniel Dodge Committed by Greg Kroah-Hartman

Drivers: Staging: ft1000: Fixed C99 // comments styling issue

This patch removes C99 style comments from the driver and whenever
possible attempts to match coding style of the rest of the driver.
Signed-off-by: default avatarDaniel Dodge <danieldodgese@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9b89b049
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
// 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 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 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 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, 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 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 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 more details. You should have received a copy of the GNU General Public
// License along with this program; if not, write to the License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
// Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
//--------------------------------------------------------------------------- ---------------------------------------------------------------------------
//
// File: boot.h File: boot.h
//
// Description: boatloader Description: boatloader
//
// History: History:
// 1/11/05 Whc Ported to Linux. 1/11/05 Whc Ported to Linux.
//
//--------------------------------------------------------------------------- ---------------------------------------------------------------------------*/
#ifndef _BOOTH_ #ifndef _BOOTH_
#define _BOOTH_ #define _BOOTH_
// Official bootloader /* Official bootloader */
static unsigned char bootimage[] = { static unsigned char bootimage[] = {
0x00, 0x00, 0x01, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x01, 0x5E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0xD7, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD7,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -80,19 +80,19 @@ MODULE_SUPPORTED_DEVICE("FT1000"); ...@@ -80,19 +80,19 @@ MODULE_SUPPORTED_DEVICE("FT1000");
#define MAX_RCV_LOOP 100 #define MAX_RCV_LOOP 100
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_read_fifo_len Function: ft1000_read_fifo_len
// Description: This function will read the ASIC Uplink FIFO status register Description: This function will read the ASIC Uplink FIFO status register
// which will return the number of bytes remaining in the Uplink FIFO. which will return the number of bytes remaining in the Uplink FIFO.
// Sixteen bytes are subtracted to make sure that the ASIC does not Sixteen bytes are subtracted to make sure that the ASIC does not
// reach its threshold. reach its threshold.
// Input: Input:
// dev - network device structure dev - network device structure
// Output: Output:
// value - number of bytes available in the ASIC Uplink FIFO. value - number of bytes available in the ASIC Uplink FIFO.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static inline u16 ft1000_read_fifo_len(struct net_device *dev) static inline u16 ft1000_read_fifo_len(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -103,25 +103,25 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev) ...@@ -103,25 +103,25 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev)
return (ft1000_read_reg(dev, FT1000_REG_MAG_UFSR) - 16); return (ft1000_read_reg(dev, FT1000_REG_MAG_UFSR) - 16);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram Function: ft1000_read_dpram
// Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
// (Electrabuzz ASIC only) (Electrabuzz ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// Output: Output:
// value - value of dpram value - value of dpram
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
u16 ft1000_read_dpram(struct net_device *dev, int offset) u16 ft1000_read_dpram(struct net_device *dev, int offset)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
u16 data; u16 data;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
data = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); data = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA);
...@@ -130,54 +130,54 @@ u16 ft1000_read_dpram(struct net_device *dev, int offset) ...@@ -130,54 +130,54 @@ u16 ft1000_read_dpram(struct net_device *dev, int offset)
return (data); return (data);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram Function: ft1000_write_dpram
// Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
// (Electrabuzz ASIC only) (Electrabuzz ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// value - value to write value - value to write
// Output: Output:
// none. none.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static inline void ft1000_write_dpram(struct net_device *dev, 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); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, value); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, value);
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram_mag_16 Function: ft1000_read_dpram_mag_16
// Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
// (Magnemite ASIC only) (Magnemite ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// Output: Output:
// value - value of dpram value - value of dpram
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
u16 data; u16 data;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
// check if we want to read upper or lower 32-bit word /* check if we want to read upper or lower 32-bit word */
if (Index) { if (Index) {
data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL); data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL);
} else { } else {
...@@ -188,26 +188,26 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) ...@@ -188,26 +188,26 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
return (data); return (data);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram_mag_16 Function: ft1000_write_dpram_mag_16
// Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
// (Magnemite ASIC only) (Magnemite ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// value - value to write value - value to write
// Output: Output:
// none. none.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static inline void ft1000_write_dpram_mag_16(struct net_device *dev, 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); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
if (Index) { if (Index) {
...@@ -218,25 +218,25 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev, ...@@ -218,25 +218,25 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram_mag_32 Function: ft1000_read_dpram_mag_32
// Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
// (Magnemite ASIC only) (Magnemite ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// Output: Output:
// value - value of dpram value - value of dpram
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
u32 data; u32 data;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
data = inl(dev->base_addr + FT1000_REG_MAG_DPDATAL); data = inl(dev->base_addr + FT1000_REG_MAG_DPDATAL);
...@@ -245,41 +245,41 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) ...@@ -245,41 +245,41 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset)
return (data); return (data);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram_mag_32 Function: ft1000_write_dpram_mag_32
// Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
// (Magnemite ASIC only) (Magnemite ASIC only)
// Input: Input:
// dev - device structure dev - device structure
// offset - index of dpram offset - index of dpram
// value - value to write value - value to write
// Output: Output:
// none. none.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
// Provide mutual exclusive access while reading ASIC registers. /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
outl(value, dev->base_addr + FT1000_REG_MAG_DPDATAL); outl(value, dev->base_addr + FT1000_REG_MAG_DPDATAL);
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_enable_interrupts Function: ft1000_enable_interrupts
// Description: This function will enable interrupts base on the current interrupt mask. Description: This function will enable interrupts base on the current interrupt mask.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// None. None.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_enable_interrupts(struct net_device *dev) static void ft1000_enable_interrupts(struct net_device *dev)
{ {
u16 tempword; u16 tempword;
...@@ -292,16 +292,16 @@ static void ft1000_enable_interrupts(struct net_device *dev) ...@@ -292,16 +292,16 @@ static void ft1000_enable_interrupts(struct net_device *dev)
tempword); tempword);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_disable_interrupts Function: ft1000_disable_interrupts
// Description: This function will disable all interrupts. Description: This function will disable all interrupts.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// None. None.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_disable_interrupts(struct net_device *dev) static void ft1000_disable_interrupts(struct net_device *dev)
{ {
u16 tempword; u16 tempword;
...@@ -314,17 +314,17 @@ static void ft1000_disable_interrupts(struct net_device *dev) ...@@ -314,17 +314,17 @@ static void ft1000_disable_interrupts(struct net_device *dev)
tempword); tempword);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_reset_asic Function: ft1000_reset_asic
// Description: This function will call the Card Service function to reset the Description: This function will call the Card Service function to reset the
// ASIC. ASIC.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// none none
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_reset_asic(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -335,21 +335,23 @@ static void ft1000_reset_asic(struct net_device *dev) ...@@ -335,21 +335,23 @@ static void ft1000_reset_asic(struct net_device *dev)
(*info->ft1000_reset) (pcmcia->link); (*info->ft1000_reset) (pcmcia->link);
// Let's use the register provided by the Magnemite ASIC to reset the /*
// ASIC and DSP. * Let's use the register provided by the Magnemite ASIC to reset the
* ASIC and DSP.
*/
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
ft1000_write_reg(dev, FT1000_REG_RESET, ft1000_write_reg(dev, FT1000_REG_RESET,
(DSP_RESET_BIT | ASIC_RESET_BIT)); (DSP_RESET_BIT | ASIC_RESET_BIT));
} }
mdelay(1); mdelay(1);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
// set watermark to -1 in order to not generate an interrupt /* set watermark to -1 in order to not generate an interrupt */
ft1000_write_reg(dev, FT1000_REG_WATERMARK, 0xffff); ft1000_write_reg(dev, FT1000_REG_WATERMARK, 0xffff);
} else { } else {
// set watermark to -1 in order to not generate an interrupt /* set watermark to -1 in order to not generate an interrupt */
ft1000_write_reg(dev, FT1000_REG_MAG_WATERMARK, 0xffff); ft1000_write_reg(dev, FT1000_REG_MAG_WATERMARK, 0xffff);
} }
// clear interrupts /* clear interrupts */
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR);
DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword);
ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword);
...@@ -358,17 +360,17 @@ static void ft1000_reset_asic(struct net_device *dev) ...@@ -358,17 +360,17 @@ static void ft1000_reset_asic(struct net_device *dev)
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_reset_card Function: ft1000_reset_card
// Description: This function will reset the card Description: This function will reset the card
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// status - false (card reset fail) status - false (card reset fail)
// true (card reset successful) true (card reset successful)
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static int ft1000_reset_card(struct net_device *dev) static int ft1000_reset_card(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -384,9 +386,9 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -384,9 +386,9 @@ static int ft1000_reset_card(struct net_device *dev)
info->squeseqnum = 0; info->squeseqnum = 0;
ft1000_disable_interrupts(dev); ft1000_disable_interrupts(dev);
// del_timer(&poll_timer); /* del_timer(&poll_timer); */
// Make sure we free any memory reserve for provisioning /* Make sure we free any memory reserve for provisioning */
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
DEBUG(0, DEBUG(0,
"ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); "ft1000_hw:ft1000_reset_card:deleting provisioning record\n");
...@@ -406,7 +408,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -406,7 +408,7 @@ static int ft1000_reset_card(struct net_device *dev)
(DSP_RESET_BIT | ASIC_RESET_BIT)); (DSP_RESET_BIT | ASIC_RESET_BIT));
} }
// Copy DSP session record into info block if this is not a coldstart /* Copy DSP session record into info block if this is not a coldstart */
if (ft1000_card_present == 1) { if (ft1000_card_present == 1) {
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
...@@ -430,29 +432,29 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -430,29 +432,29 @@ static int ft1000_reset_card(struct net_device *dev)
DEBUG(1, "ft1000_hw:ft1000_reset_card:resetting ASIC\n"); DEBUG(1, "ft1000_hw:ft1000_reset_card:resetting ASIC\n");
mdelay(10); mdelay(10);
//reset ASIC /* reset ASIC */
ft1000_reset_asic(dev); ft1000_reset_asic(dev);
DEBUG(1, "ft1000_hw:ft1000_reset_card:downloading dsp image\n"); DEBUG(1, "ft1000_hw:ft1000_reset_card:downloading dsp image\n");
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
// Put dsp in reset and take ASIC out of reset /* Put dsp in reset and take ASIC out of reset */
DEBUG(0, DEBUG(0,
"ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); "ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n");
ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT);
// Setting MAGNEMITE ASIC to big endian mode /* Setting MAGNEMITE ASIC to big endian mode */
ft1000_write_reg(dev, FT1000_REG_SUP_CTRL, HOST_INTF_BE); ft1000_write_reg(dev, FT1000_REG_SUP_CTRL, HOST_INTF_BE);
// Download bootloader /* Download bootloader */
card_bootload(dev); card_bootload(dev);
// Take DSP out of reset /* Take DSP out of reset */
ft1000_write_reg(dev, FT1000_REG_RESET, 0); ft1000_write_reg(dev, FT1000_REG_RESET, 0);
// FLARION_DSP_ACTIVE; /* FLARION_DSP_ACTIVE; */
mdelay(10); mdelay(10);
DEBUG(0, "ft1000_hw:ft1000_reset_card:Take DSP out of reset\n"); DEBUG(0, "ft1000_hw:ft1000_reset_card:Take DSP out of reset\n");
// Wait for 0xfefe indicating dsp ready before starting download /* Wait for 0xfefe indicating dsp ready before starting download */
for (i = 0; i < 50; i++) { for (i = 0; i < 50; i++) {
tempword = tempword =
ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE, ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE,
...@@ -470,7 +472,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -470,7 +472,7 @@ static int ft1000_reset_card(struct net_device *dev)
} }
} else { } else {
// Take DSP out of reset /* Take DSP out of reset */
ft1000_write_reg(dev, FT1000_REG_RESET, ~DSP_RESET_BIT); ft1000_write_reg(dev, FT1000_REG_RESET, ~DSP_RESET_BIT);
mdelay(10); mdelay(10);
} }
...@@ -485,17 +487,19 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -485,17 +487,19 @@ static int ft1000_reset_card(struct net_device *dev)
mdelay(10); mdelay(10);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
// Need to initialize the FIFO length counter to zero in order to sync up /*
// with the DSP * Need to initialize the FIFO length counter to zero in order to sync up
* with the DSP
*/
info->fifo_cnt = 0; info->fifo_cnt = 0;
ft1000_write_dpram(dev, FT1000_FIFO_LEN, info->fifo_cnt); ft1000_write_dpram(dev, FT1000_FIFO_LEN, info->fifo_cnt);
// Initialize DSP heartbeat area to ho /* Initialize DSP heartbeat area to ho */
ft1000_write_dpram(dev, FT1000_HI_HO, ho); ft1000_write_dpram(dev, FT1000_HI_HO, ho);
tempword = ft1000_read_dpram(dev, FT1000_HI_HO); tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n", DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n",
tempword); tempword);
} else { } else {
// Initialize DSP heartbeat area to ho /* Initialize DSP heartbeat area to ho */
ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag, ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag,
FT1000_MAG_HI_HO_INDX); FT1000_MAG_HI_HO_INDX);
tempword = tempword =
...@@ -509,40 +513,44 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -509,40 +513,44 @@ static int ft1000_reset_card(struct net_device *dev)
ft1000_enable_interrupts(dev); ft1000_enable_interrupts(dev);
/* Schedule heartbeat process to run every 2 seconds */ /* Schedule heartbeat process to run every 2 seconds */
// poll_timer.expires = jiffies + (2*HZ); /* poll_timer.expires = jiffies + (2*HZ); */
// poll_timer.data = (u_long)dev; /* poll_timer.data = (u_long)dev; */
// add_timer(&poll_timer); /* add_timer(&poll_timer); */
return true; return true;
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_chkcard Function: ft1000_chkcard
// Description: This function will check if the device is presently available on Description: This function will check if the device is presently available on
// the system. the system.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// status - false (device is not present) status - false (device is not present)
// true (device is present) true (device is present)
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static int ft1000_chkcard(struct net_device *dev) static int ft1000_chkcard(struct net_device *dev)
{ {
u16 tempword; u16 tempword;
// Mask register is used to check for device presence since it is never /*
// set to zero. * Mask register is used to check for device presence since it is never
* set to zero.
*/
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK);
if (tempword == 0) { if (tempword == 0) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); "ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n");
return false; return false;
} }
// The system will return the value of 0xffff for the version register /*
// if the device is not present. * The system will return the value of 0xffff for the version register
* if the device is not present.
*/
tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID);
if (tempword == 0xffff) { if (tempword == 0xffff) {
DEBUG(1, DEBUG(1,
...@@ -553,17 +561,17 @@ static int ft1000_chkcard(struct net_device *dev) ...@@ -553,17 +561,17 @@ static int ft1000_chkcard(struct net_device *dev)
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_hbchk Function: ft1000_hbchk
// Description: This function will perform the heart beat check of the DSP as Description: This function will perform the heart beat check of the DSP as
// well as the ASIC. well as the ASIC.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// none none
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_hbchk(u_long data) static void ft1000_hbchk(u_long data)
{ {
struct net_device *dev = (struct net_device *)data; struct net_device *dev = (struct net_device *)data;
...@@ -574,7 +582,7 @@ static void ft1000_hbchk(u_long data) ...@@ -574,7 +582,7 @@ static void ft1000_hbchk(u_long data)
info = netdev_priv(dev); info = netdev_priv(dev);
if (info->CardReady == 1) { if (info->CardReady == 1) {
// Perform dsp heartbeat check /* Perform dsp heartbeat check */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = ft1000_read_dpram(dev, FT1000_HI_HO); tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
} else { } else {
...@@ -585,7 +593,7 @@ static void ft1000_hbchk(u_long data) ...@@ -585,7 +593,7 @@ static void ft1000_hbchk(u_long data)
} }
DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n",
tempword); tempword);
// Let's perform another check if ho is not detected /* Let's perform another check if ho is not detected */
if (tempword != ho) { if (tempword != ho) {
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = ft1000_read_dpram(dev, FT1000_HI_HO); tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
...@@ -639,7 +647,7 @@ static void ft1000_hbchk(u_long data) ...@@ -639,7 +647,7 @@ static void ft1000_hbchk(u_long data)
} }
tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
// Let's check doorbell again if fail /* Let's check doorbell again if fail */
if (tempword & FT1000_DB_HB) { if (tempword & FT1000_DB_HB) {
tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
} }
...@@ -686,8 +694,10 @@ static void ft1000_hbchk(u_long data) ...@@ -686,8 +694,10 @@ static void ft1000_hbchk(u_long data)
add_timer(&poll_timer); add_timer(&poll_timer);
return; return;
} }
// Set dedicated area to hi and ring appropriate doorbell according /*
// to hi/ho heartbeat protocol * Set dedicated area to hi and ring appropriate doorbell according
* to hi/ho heartbeat protocol
*/
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_dpram(dev, FT1000_HI_HO, hi); ft1000_write_dpram(dev, FT1000_HI_HO, hi);
} else { } else {
...@@ -703,7 +713,7 @@ static void ft1000_hbchk(u_long data) ...@@ -703,7 +713,7 @@ static void ft1000_hbchk(u_long data)
(dev, FT1000_MAG_HI_HO, (dev, FT1000_MAG_HI_HO,
FT1000_MAG_HI_HO_INDX)); FT1000_MAG_HI_HO_INDX));
} }
// Let's write hi again if fail /* Let's write hi again if fail */
if (tempword != hi) { if (tempword != hi) {
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_dpram(dev, FT1000_HI_HO, hi); ft1000_write_dpram(dev, FT1000_HI_HO, hi);
...@@ -774,14 +784,14 @@ static void ft1000_hbchk(u_long data) ...@@ -774,14 +784,14 @@ static void ft1000_hbchk(u_long data)
add_timer(&poll_timer); add_timer(&poll_timer);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_send_cmd Function: ft1000_send_cmd
// Description: Description:
// Input: Input:
// Output: 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); struct ft1000_info *info = netdev_priv(dev);
...@@ -790,17 +800,19 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -790,17 +800,19 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
unsigned long flags; unsigned long flags;
size += sizeof(struct pseudo_hdr); size += sizeof(struct pseudo_hdr);
// check for odd byte and increment to 16-bit word align value /* check for odd byte and increment to 16-bit word align value */
if ((size & 0x0001)) { if ((size & 0x0001)) {
size++; size++;
} }
DEBUG(1, "FT1000:ft1000_send_cmd:total length = %d\n", size); DEBUG(1, "FT1000:ft1000_send_cmd:total length = %d\n", size);
DEBUG(1, "FT1000:ft1000_send_cmd:length = %d\n", ntohs(*ptempbuffer)); DEBUG(1, "FT1000:ft1000_send_cmd:length = %d\n", ntohs(*ptempbuffer));
// put message into slow queue area /*
// All messages are in the form total_len + pseudo header + message body * 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); spin_lock_irqsave(&info->dpram_lock, flags);
// Make sure SLOWQ doorbell is clear /* Make sure SLOWQ doorbell is clear */
tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
i=0; i=0;
while (tempword & FT1000_DB_DPRAM_TX) { while (tempword & FT1000_DB_DPRAM_TX) {
...@@ -816,9 +828,9 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -816,9 +828,9 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
FT1000_DPRAM_TX_BASE); FT1000_DPRAM_TX_BASE);
// Write total length to dpram /* Write total length to dpram */
ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, size); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, size);
// Write pseudo header and messgae body /* Write pseudo header and messgae body */
for (i = 0; i < (size >> 1); i++) { for (i = 0; i < (size >> 1); i++) {
DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i, DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i,
*ptempbuffer); *ptempbuffer);
...@@ -828,9 +840,9 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -828,9 +840,9 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
} else { } else {
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
FT1000_DPRAM_MAG_TX_BASE); FT1000_DPRAM_MAG_TX_BASE);
// Write total length to dpram /* Write total length to dpram */
ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, htons(size)); ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, htons(size));
// Write pseudo header and messgae body /* Write pseudo header and messgae body */
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
FT1000_DPRAM_MAG_TX_BASE + 1); FT1000_DPRAM_MAG_TX_BASE + 1);
for (i = 0; i < (size >> 2); i++) { for (i = 0; i < (size >> 2); i++) {
...@@ -850,23 +862,23 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -850,23 +862,23 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
} }
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
// ring doorbell to notify DSP that we have a message ready /* ring doorbell to notify DSP that we have a message ready */
ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_DB_DPRAM_TX); ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_DB_DPRAM_TX);
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_receive_cmd Function: ft1000_receive_cmd
// Description: This function will read a message from the dpram area. Description: This function will read a message from the dpram area.
// Input: Input:
// dev - network device structure dev - network device structure
// pbuffer - caller supply address to buffer pbuffer - caller supply address to buffer
// pnxtph - pointer to next pseudo header pnxtph - pointer to next pseudo header
// Output: Output:
// Status = 0 (unsuccessful) Status = 0 (unsuccessful)
// = 1 (successful) = 1 (successful)
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
int maxsz, u16 *pnxtph) int maxsz, u16 *pnxtph)
{ {
...@@ -919,7 +931,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -919,7 +931,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
FT1000_REG_MAG_DPDATAH); FT1000_REG_MAG_DPDATAH);
pbuffer++; pbuffer++;
} }
//copy odd aligned word /* copy odd aligned word */
*pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAL); *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAL);
DEBUG(1, "ft1000_hw:received data = 0x%x\n", *pbuffer); DEBUG(1, "ft1000_hw:received data = 0x%x\n", *pbuffer);
pbuffer++; pbuffer++;
...@@ -928,14 +940,16 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -928,14 +940,16 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
pbuffer++; pbuffer++;
} }
if (size & 0x0001) { if (size & 0x0001) {
//copy odd byte from fifo /* copy odd byte from fifo */
tempword = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); tempword = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA);
*pbuffer = ntohs(tempword); *pbuffer = ntohs(tempword);
} }
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
// Check if pseudo header checksum is good /*
// Calculate pseudo header checksum * Check if pseudo header checksum is good
* Calculate pseudo header checksum
*/
tempword = *ppseudohdr++; tempword = *ppseudohdr++;
for (i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
tempword ^= *ppseudohdr++; tempword ^= *ppseudohdr++;
...@@ -943,24 +957,24 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -943,24 +957,24 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
if ((tempword != *ppseudohdr)) { if ((tempword != *ppseudohdr)) {
DEBUG(1, DEBUG(1,
"FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n"); "FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n");
// Drop this message /* Drop this message */
return false; return false;
} }
return true; return true;
} }
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_proc_drvmsg Function: ft1000_proc_drvmsg
// Description: This function will process the various driver messages. Description: This function will process the various driver messages.
// Input: Input:
// dev - device structure dev - device structure
// pnxtph - pointer to next pseudo header pnxtph - pointer to next pseudo header
// Output: Output:
// none none
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_proc_drvmsg(struct net_device *dev) static void ft1000_proc_drvmsg(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -988,7 +1002,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -988,7 +1002,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
} }
if ( ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword) ) { if ( ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword) ) {
// Get the message type which is total_len + PSEUDO header + msgtype + message body /* 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); msgtype = ntohs(pdrvmsg->type);
DEBUG(1, "Command message type = 0x%x\n", msgtype); DEBUG(1, "Command message type = 0x%x\n", msgtype);
...@@ -999,7 +1013,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -999,7 +1013,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
mdelay(25); mdelay(25);
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
DEBUG(0, "Sending a provisioning message\n"); DEBUG(0, "Sending a provisioning message\n");
// Make sure SLOWQ doorbell is clear /* Make sure SLOWQ doorbell is clear */
tempword = tempword =
ft1000_read_reg(dev, FT1000_REG_DOORBELL); ft1000_read_reg(dev, FT1000_REG_DOORBELL);
i = 0; i = 0;
...@@ -1018,10 +1032,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1018,10 +1032,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
pmsg = (u16 *) ptr->pprov_data; pmsg = (u16 *) ptr->pprov_data;
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *) pmsg;
// Insert slow queue sequence number /* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->seq_num = info->squeseqnum++;
ppseudo_hdr->portsrc = 0; ppseudo_hdr->portsrc = 0;
// Calculate new checksum /* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++; ppseudo_hdr->checksum = *pmsg++;
DEBUG(1, "checksum = 0x%x\n", DEBUG(1, "checksum = 0x%x\n",
ppseudo_hdr->checksum); ppseudo_hdr->checksum);
...@@ -1036,8 +1050,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1036,8 +1050,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
kfree(ptr->pprov_data); kfree(ptr->pprov_data);
kfree(ptr); kfree(ptr);
} }
// Indicate adapter is ready to take application messages after all /*
// provisioning messages are sent * Indicate adapter is ready to take application messages after all
* provisioning messages are sent
*/
info->CardReady = 1; info->CardReady = 1;
break; break;
case MEDIA_STATE: case MEDIA_STATE:
...@@ -1118,8 +1134,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1118,8 +1134,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
break; break;
case DSP_GET_INFO: case DSP_GET_INFO:
DEBUG(1, "FT1000:drivermsg:Got DSP_GET_INFO\n"); DEBUG(1, "FT1000:drivermsg:Got DSP_GET_INFO\n");
// copy dsp info block to dsp /*
// allow any outstanding ioctl to finish * copy dsp info block to dsp
* allow any outstanding ioctl to finish
*/
mdelay(10); mdelay(10);
tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { if (tempword & FT1000_DB_DPRAM_TX) {
...@@ -1132,8 +1150,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1132,8 +1150,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
} }
if ((tempword & FT1000_DB_DPRAM_TX) == 0) { if ((tempword & FT1000_DB_DPRAM_TX) == 0) {
// Put message into Slow Queue /*
// Form Pseudo header * Put message into Slow Queue
* Form Pseudo header
*/
pmsg = (u16 *) info->DSPInfoBlk; pmsg = (u16 *) info->DSPInfoBlk;
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *) pmsg;
ppseudo_hdr->length = ppseudo_hdr->length =
...@@ -1147,11 +1167,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1147,11 +1167,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
ppseudo_hdr->rsvd1 = 0; ppseudo_hdr->rsvd1 = 0;
ppseudo_hdr->rsvd2 = 0; ppseudo_hdr->rsvd2 = 0;
ppseudo_hdr->qos_class = 0; ppseudo_hdr->qos_class = 0;
// Insert slow queue sequence number /* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->seq_num = info->squeseqnum++;
// Insert application id /* Insert application id */
ppseudo_hdr->portsrc = 0; ppseudo_hdr->portsrc = 0;
// Calculate new checksum /* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++; ppseudo_hdr->checksum = *pmsg++;
for (i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->checksum ^= *pmsg++;
...@@ -1165,8 +1185,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1165,8 +1185,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
break; break;
case GET_DRV_ERR_RPT_MSG: case GET_DRV_ERR_RPT_MSG:
DEBUG(1, "FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); DEBUG(1, "FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n");
// copy driver error message to dsp /*
// allow any outstanding ioctl to finish * copy driver error message to dsp
* allow any outstanding ioctl to finish
*/
mdelay(10); mdelay(10);
tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { if (tempword & FT1000_DB_DPRAM_TX) {
...@@ -1179,8 +1201,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1179,8 +1201,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
} }
if ((tempword & FT1000_DB_DPRAM_TX) == 0) { if ((tempword & FT1000_DB_DPRAM_TX) == 0) {
// Put message into Slow Queue /*
// Form Pseudo header * Put message into Slow Queue
* Form Pseudo header
*/
pmsg = (u16 *) & tempbuffer[0]; pmsg = (u16 *) & tempbuffer[0];
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *) pmsg;
ppseudo_hdr->length = htons(0x0012); ppseudo_hdr->length = htons(0x0012);
...@@ -1193,11 +1217,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1193,11 +1217,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
ppseudo_hdr->rsvd1 = 0; ppseudo_hdr->rsvd1 = 0;
ppseudo_hdr->rsvd2 = 0; ppseudo_hdr->rsvd2 = 0;
ppseudo_hdr->qos_class = 0; ppseudo_hdr->qos_class = 0;
// Insert slow queue sequence number /* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->seq_num = info->squeseqnum++;
// Insert application id /* Insert application id */
ppseudo_hdr->portsrc = 0; ppseudo_hdr->portsrc = 0;
// Calculate new checksum /* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++; ppseudo_hdr->checksum = *pmsg++;
for (i=1; i<7; i++) { for (i=1; i<7; i++) {
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->checksum ^= *pmsg++;
...@@ -1228,18 +1252,18 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1228,18 +1252,18 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
} }
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_parse_dpram_msg Function: ft1000_parse_dpram_msg
// Description: This function will parse the message received from the DSP Description: This function will parse the message received from the DSP
// via the DPRAM interface. via the DPRAM interface.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// status - FAILURE status - FAILURE
// SUCCESS SUCCESS
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static int ft1000_parse_dpram_msg(struct net_device *dev) static int ft1000_parse_dpram_msg(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -1255,7 +1279,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1255,7 +1279,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
DEBUG(1, "Doorbell = 0x%x\n", doorbell); DEBUG(1, "Doorbell = 0x%x\n", doorbell);
if (doorbell & FT1000_ASIC_RESET_REQ) { if (doorbell & FT1000_ASIC_RESET_REQ) {
// Copy DSP session record from info block /* Copy DSP session record from info block */
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
...@@ -1274,7 +1298,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1274,7 +1298,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
} }
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
// clear ASIC RESET request /* clear ASIC RESET request */
ft1000_write_reg(dev, FT1000_REG_DOORBELL, ft1000_write_reg(dev, FT1000_REG_DOORBELL,
FT1000_ASIC_RESET_REQ); FT1000_ASIC_RESET_REQ);
DEBUG(1, "Got an ASIC RESET Request\n"); DEBUG(1, "Got an ASIC RESET Request\n");
...@@ -1282,7 +1306,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1282,7 +1306,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
FT1000_ASIC_RESET_DSP); FT1000_ASIC_RESET_DSP);
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
// Setting MAGNEMITE ASIC to big endian mode /* Setting MAGNEMITE ASIC to big endian mode */
ft1000_write_reg(dev, FT1000_REG_SUP_CTRL, ft1000_write_reg(dev, FT1000_REG_SUP_CTRL,
HOST_INTF_BE); HOST_INTF_BE);
} }
...@@ -1315,8 +1339,10 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1315,8 +1339,10 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) { if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) {
total_len += nxtph; total_len += nxtph;
cnt = 0; cnt = 0;
// ft1000_read_reg will return a value that needs to be byteswap /*
// in order to get DSP_QID_OFFSET. * ft1000_read_reg will return a value that needs to be byteswap
* in order to get DSP_QID_OFFSET.
*/
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
portid = portid =
(ft1000_read_dpram (ft1000_read_dpram
...@@ -1332,7 +1358,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1332,7 +1358,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
DEBUG(1, "DSP_QID = 0x%x\n", portid); DEBUG(1, "DSP_QID = 0x%x\n", portid);
if (portid == DRIVERID) { if (portid == DRIVERID) {
// We are assumming one driver message from the DSP at a time. /* We are assumming one driver message from the DSP at a time. */
ft1000_proc_drvmsg(dev); ft1000_proc_drvmsg(dev);
} }
} }
...@@ -1340,7 +1366,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1340,7 +1366,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
} }
if (doorbell & FT1000_DB_COND_RESET) { if (doorbell & FT1000_DB_COND_RESET) {
// Reset ASIC and DSP /* Reset ASIC and DSP */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
info->DSP_TIME[0] = info->DSP_TIME[0] =
ft1000_read_dpram(dev, FT1000_DSP_TIMER0); ft1000_read_dpram(dev, FT1000_DSP_TIMER0);
...@@ -1370,7 +1396,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1370,7 +1396,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
ft1000_write_reg(dev, FT1000_REG_DOORBELL, ft1000_write_reg(dev, FT1000_REG_DOORBELL,
FT1000_DB_COND_RESET); FT1000_DB_COND_RESET);
} }
// let's clear any unexpected doorbells from DSP /* let's clear any unexpected doorbells from DSP */
doorbell = doorbell =
doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ | doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ |
FT1000_DB_COND_RESET | 0xff00); FT1000_DB_COND_RESET | 0xff00);
...@@ -1383,18 +1409,18 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1383,18 +1409,18 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_flush_fifo Function: ft1000_flush_fifo
// Description: This function will flush one packet from the downlink Description: This function will flush one packet from the downlink
// FIFO. FIFO.
// Input: Input:
// dev - device structure dev - device structure
// drv_err - driver error causing the flush fifo drv_err - driver error causing the flush fifo
// Output: Output:
// None. None.
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
...@@ -1432,7 +1458,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1432,7 +1458,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
ft1000_reset_card(dev); ft1000_reset_card(dev);
return; return;
} else { } else {
// Flush corrupted pkt from FIFO /* Flush corrupted pkt from FIFO */
i = 0; i = 0;
do { do {
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
...@@ -1447,8 +1473,10 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1447,8 +1473,10 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
inw(dev->base_addr + FT1000_REG_MAG_DFSR); inw(dev->base_addr + FT1000_REG_MAG_DFSR);
} }
i++; i++;
// This should never happen unless the ASIC is broken. /*
// We must reset to recover. * This should never happen unless the ASIC is broken.
* We must reset to recover.
*/
if ((i > 2048) || (tempword == 0)) { if ((i > 2048) || (tempword == 0)) {
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
info->DSP_TIME[0] = info->DSP_TIME[0] =
...@@ -1482,17 +1510,19 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1482,17 +1510,19 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
FT1000_MAG_DSP_TIMER3_INDX); FT1000_MAG_DSP_TIMER3_INDX);
} }
if (tempword == 0) { if (tempword == 0) {
// Let's check if ASIC reads are still ok by reading the Mask register /*
// which is never zero at this point of the code. * Let's check if ASIC reads are still ok by reading the Mask register
* which is never zero at this point of the code.
*/
tempword = tempword =
inw(dev->base_addr + inw(dev->base_addr +
FT1000_REG_SUP_IMASK); FT1000_REG_SUP_IMASK);
if (tempword == 0) { if (tempword == 0) {
// This indicates that we can not communicate with the ASIC /* This indicates that we can not communicate with the ASIC */
info->DrvErrNum = info->DrvErrNum =
FIFO_FLUSH_BADCNT; FIFO_FLUSH_BADCNT;
} else { } else {
// Let's assume that we really flush the FIFO /* Let's assume that we really flush the FIFO */
pcmcia->PktIntfErr++; pcmcia->PktIntfErr++;
return; return;
} }
...@@ -1506,9 +1536,9 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1506,9 +1536,9 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
i++; i++;
DEBUG(0, "Flushing FIFO complete = %x\n", tempword); DEBUG(0, "Flushing FIFO complete = %x\n", tempword);
// Flush last word in FIFO. /* Flush last word in FIFO. */
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
// Update FIFO counter for DSP /* Update FIFO counter for DSP */
i = i * 2; i = i * 2;
DEBUG(0, "Flush Data byte count to dsp = %d\n", i); DEBUG(0, "Flush Data byte count to dsp = %d\n", i);
info->fifo_cnt += i; info->fifo_cnt += i;
...@@ -1516,7 +1546,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1516,7 +1546,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
info->fifo_cnt); info->fifo_cnt);
} else { } else {
DEBUG(0, "Flushing FIFO complete = %x\n", tempword); DEBUG(0, "Flushing FIFO complete = %x\n", tempword);
// Flush last word in FIFO /* Flush last word in FIFO */
templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); templong = inl(dev->base_addr + FT1000_REG_MAG_DFR);
tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT);
DEBUG(0, "FT1000_REG_SUP_STAT = 0x%x\n", tempword); DEBUG(0, "FT1000_REG_SUP_STAT = 0x%x\n", tempword);
...@@ -1529,19 +1559,19 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1529,19 +1559,19 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
} }
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_copy_up_pkt Function: ft1000_copy_up_pkt
// Description: This function will pull Flarion packets out of the Downlink Description: This function will pull Flarion packets out of the Downlink
// FIFO and convert it to an ethernet packet. The ethernet packet will FIFO and convert it to an ethernet packet. The ethernet packet will
// then be deliver to the TCP/IP stack. then be deliver to the TCP/IP stack.
// Input: Input:
// dev - device structure dev - device structure
// Output: Output:
// status - FAILURE status - FAILURE
// SUCCESS SUCCESS
//
//--------------------------------------------------------------------------- -------------------------------------------------------------------------*/
static int ft1000_copy_up_pkt(struct net_device *dev) static int ft1000_copy_up_pkt(struct net_device *dev)
{ {
u16 tempword; u16 tempword;
...@@ -1556,7 +1586,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1556,7 +1586,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
u32 templong; u32 templong;
DEBUG(1, "ft1000_copy_up_pkt\n"); DEBUG(1, "ft1000_copy_up_pkt\n");
// Read length /* Read length */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
len = tempword; len = tempword;
...@@ -1570,7 +1600,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1570,7 +1600,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
if (len > ENET_MAX_SIZE) { if (len > ENET_MAX_SIZE) {
DEBUG(0, "size of ethernet packet invalid\n"); DEBUG(0, "size of ethernet packet invalid\n");
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
// Read High word to complete 32 bit access /* Read High word to complete 32 bit access */
tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH);
} }
ft1000_flush_fifo(dev, DSP_PKTLEN_INFO); ft1000_flush_fifo(dev, DSP_PKTLEN_INFO);
...@@ -1582,7 +1612,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1582,7 +1612,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
if (skb == NULL) { if (skb == NULL) {
DEBUG(0, "No Network buffers available\n"); DEBUG(0, "No Network buffers available\n");
// Read High word to complete 32 bit access /* Read High word to complete 32 bit access */
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH);
} }
...@@ -1592,13 +1622,13 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1592,13 +1622,13 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
} }
pbuffer = (u8 *) skb_put(skb, len + 12); pbuffer = (u8 *) skb_put(skb, len + 12);
// Pseudo header /* Pseudo header */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
for (i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
chksum ^= tempword; chksum ^= tempword;
} }
// read checksum value /* read checksum value */
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
} else { } else {
tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH);
...@@ -1625,7 +1655,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1625,7 +1655,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
DEBUG(1, "Pseudo = 0x%x\n", tempword); DEBUG(1, "Pseudo = 0x%x\n", tempword);
chksum ^= tempword; chksum ^= tempword;
// read checksum value /* read checksum value */
tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH);
DEBUG(1, "Pseudo = 0x%x\n", tempword); DEBUG(1, "Pseudo = 0x%x\n", tempword);
} }
...@@ -1638,10 +1668,10 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1638,10 +1668,10 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
kfree_skb(skb); kfree_skb(skb);
return FAILURE; return FAILURE;
} }
//subtract the number of bytes read already /* subtract the number of bytes read already */
ptemp = pbuffer; ptemp = pbuffer;
// fake MAC address /* fake MAC address */
*pbuffer++ = dev->dev_addr[0]; *pbuffer++ = dev->dev_addr[0];
*pbuffer++ = dev->dev_addr[1]; *pbuffer++ = dev->dev_addr[1];
*pbuffer++ = dev->dev_addr[2]; *pbuffer++ = dev->dev_addr[2];
...@@ -1666,7 +1696,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1666,7 +1696,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
} }
} }
// Need to read one more word if odd byte /* Need to read one more word if odd byte */
if (len & 0x0001) { if (len & 0x0001) {
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
*pbuffer++ = (u8) (tempword >> 8); *pbuffer++ = (u8) (tempword >> 8);
...@@ -1679,7 +1709,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1679,7 +1709,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
*ptemplong++ = templong; *ptemplong++ = templong;
} }
// Need to read one more word if odd align. /* Need to read one more word if odd align. */
if (len & 0x0003) { if (len & 0x0003) {
templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); templong = inl(dev->base_addr + FT1000_REG_MAG_DFR);
DEBUG(1, "Data = 0x%8x\n", templong); DEBUG(1, "Data = 0x%8x\n", templong);
...@@ -1699,11 +1729,11 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1699,11 +1729,11 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
netif_rx(skb); netif_rx(skb);
info->stats.rx_packets++; info->stats.rx_packets++;
// Add on 12 bytes for MAC address which was removed /* Add on 12 bytes for MAC address which was removed */
info->stats.rx_bytes += (len + 12); info->stats.rx_bytes += (len + 12);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
// track how many bytes have been read from FIFO - round up to 16 bit word /* track how many bytes have been read from FIFO - round up to 16 bit word */
tempword = len + 16; tempword = len + 16;
if (tempword & 0x01) if (tempword & 0x01)
tempword++; tempword++;
...@@ -1715,21 +1745,21 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1715,21 +1745,21 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
return SUCCESS; return SUCCESS;
} }
//--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
//
// Function: ft1000_copy_down_pkt Function: ft1000_copy_down_pkt
// Description: This function will take an ethernet packet and convert it to Description: This function will take an ethernet packet and convert it to
// a Flarion packet prior to sending it to the ASIC Downlink a Flarion packet prior to sending it to the ASIC Downlink
// FIFO. FIFO.
// Input: Input:
// dev - device structure dev - device structure
// packet - address of ethernet packet packet - address of ethernet packet
// len - length of IP packet len - length of IP packet
// Output: Output:
// status - FAILURE status - FAILURE
// SUCCESS 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_info *info = netdev_priv(dev);
...@@ -1744,7 +1774,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1744,7 +1774,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
DEBUG(1, "ft1000_hw: copy_down_pkt()\n"); DEBUG(1, "ft1000_hw: copy_down_pkt()\n");
// Check if there is room on the FIFO /* Check if there is room on the FIFO */
if (len > ft1000_read_fifo_len(dev)) { if (len > ft1000_read_fifo_len(dev)) {
udelay(10); udelay(10);
if (len > ft1000_read_fifo_len(dev)) { if (len > ft1000_read_fifo_len(dev)) {
...@@ -1769,15 +1799,15 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1769,15 +1799,15 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
return SUCCESS; return SUCCESS;
} }
} }
// Create pseudo header and send pseudo/ip to hardware /* Create pseudo header and send pseudo/ip to hardware */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
pseudo.blk.length = len; pseudo.blk.length = len;
} else { } else {
pseudo.blk.length = ntohs(len); pseudo.blk.length = ntohs(len);
} }
pseudo.blk.source = DSPID; // Need to swap to get in correct order pseudo.blk.source = DSPID; /* Need to swap to get in correct order */
pseudo.blk.destination = HOSTID; pseudo.blk.destination = HOSTID;
pseudo.blk.portdest = NETWORKID; // Need to swap to get in correct order pseudo.blk.portdest = NETWORKID; /* Need to swap to get in correct order */
pseudo.blk.portsrc = DSPAIRID; pseudo.blk.portsrc = DSPAIRID;
pseudo.blk.sh_str_id = 0; pseudo.blk.sh_str_id = 0;
pseudo.blk.control = 0; pseudo.blk.control = 0;
...@@ -1791,14 +1821,14 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1791,14 +1821,14 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
pseudo.blk.checksum ^= pseudo.buff[i]; pseudo.blk.checksum ^= pseudo.buff[i];
} }
// Production Mode /* Production Mode */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
// copy first word to UFIFO_BEG reg /* copy first word to UFIFO_BEG reg */
ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]); 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", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n",
pseudo.buff[0]); pseudo.buff[0]);
// copy subsequent words to UFIFO_MID reg /* copy subsequent words to UFIFO_MID reg */
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]); 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", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n",
pseudo.buff[1]); pseudo.buff[1]);
...@@ -1821,7 +1851,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1821,7 +1851,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n",
pseudo.buff[7]); pseudo.buff[7]);
// Write PPP type + IP Packet into Downlink FIFO /* Write PPP type + IP Packet into Downlink FIFO */
for (i = 0; i < (len >> 1) - 1; i++) { for (i = 0; i < (len >> 1) - 1; i++) {
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, ft1000_write_reg(dev, FT1000_REG_UFIFO_MID,
htons(*packet)); htons(*packet));
...@@ -1831,7 +1861,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1831,7 +1861,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
packet++; packet++;
} }
// Check for odd byte /* Check for odd byte */
if (len & 0x0001) { if (len & 0x0001) {
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, ft1000_write_reg(dev, FT1000_REG_UFIFO_MID,
htons(*packet)); htons(*packet));
...@@ -1870,12 +1900,12 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1870,12 +1900,12 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
*(u32 *) & pseudo.buff[6]); *(u32 *) & pseudo.buff[6]);
plong = (u32 *) packet; plong = (u32 *) packet;
// Write PPP type + IP Packet into Downlink FIFO /* Write PPP type + IP Packet into Downlink FIFO */
for (i = 0; i < (len >> 2); i++) { for (i = 0; i < (len >> 2); i++) {
outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR);
} }
// Check for odd alignment /* Check for odd alignment */
if (len & 0x0003) { if (len & 0x0003) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n",
...@@ -1886,7 +1916,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1886,7 +1916,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
} }
info->stats.tx_packets++; info->stats.tx_packets++;
// Add 14 bytes for MAC address plus ethernet type /* Add 14 bytes for MAC address plus ethernet type */
info->stats.tx_bytes += (len + 14); info->stats.tx_bytes += (len + 14);
return SUCCESS; return SUCCESS;
} }
...@@ -1931,7 +1961,7 @@ static int ft1000_close(struct net_device *dev) ...@@ -1931,7 +1961,7 @@ static int ft1000_close(struct net_device *dev)
ft1000_disable_interrupts(dev); ft1000_disable_interrupts(dev);
ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT);
//reset ASIC /* reset ASIC */
ft1000_reset_asic(dev); ft1000_reset_asic(dev);
} }
return 0; return 0;
...@@ -1995,10 +2025,10 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ...@@ -1995,10 +2025,10 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
ft1000_disable_interrupts(dev); ft1000_disable_interrupts(dev);
// Read interrupt type /* Read interrupt type */
inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR);
// Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type /* Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type */
while (inttype) { while (inttype) {
if (inttype & ISR_DOORBELL_PEND) if (inttype & ISR_DOORBELL_PEND)
ft1000_parse_dpram_msg(dev); ft1000_parse_dpram_msg(dev);
...@@ -2008,7 +2038,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ...@@ -2008,7 +2038,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
cnt = 0; cnt = 0;
do { do {
// Check if we have packets in the Downlink FIFO /* Check if we have packets in the Downlink FIFO */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = tempword =
ft1000_read_reg(dev, ft1000_read_reg(dev,
...@@ -2027,12 +2057,12 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ...@@ -2027,12 +2057,12 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
} while (cnt < MAX_RCV_LOOP); } while (cnt < MAX_RCV_LOOP);
} }
// clear interrupts /* clear interrupts */
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR);
DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword);
ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword);
// Read interrupt type /* Read interrupt type */
inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR);
DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype); DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype);
} }
...@@ -2044,7 +2074,7 @@ void stop_ft1000_card(struct net_device *dev) ...@@ -2044,7 +2074,7 @@ void stop_ft1000_card(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
struct prov_record *ptr; struct prov_record *ptr;
// int cnt; /* int cnt; */
DEBUG(0, "ft1000_hw: stop_ft1000_card()\n"); DEBUG(0, "ft1000_hw: stop_ft1000_card()\n");
...@@ -2053,7 +2083,7 @@ void stop_ft1000_card(struct net_device *dev) ...@@ -2053,7 +2083,7 @@ void stop_ft1000_card(struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
ft1000_disable_interrupts(dev); ft1000_disable_interrupts(dev);
// Make sure we free any memory reserve for provisioning /* Make sure we free any memory reserve for provisioning */
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
ptr = list_entry(info->prov_list.next, struct prov_record, list); ptr = list_entry(info->prov_list.next, struct prov_record, list);
list_del(&ptr->list); list_del(&ptr->list);
...@@ -2109,7 +2139,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2109,7 +2139,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
struct ft1000_pcmcia *pcmcia; struct ft1000_pcmcia *pcmcia;
struct net_device *dev; struct net_device *dev;
static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes static const struct net_device_ops ft1000ops = /* Slavius 21.10.2009 due to kernel changes */
{ {
.ndo_open = &ft1000_open, .ndo_open = &ft1000_open,
.ndo_stop = &ft1000_close, .ndo_stop = &ft1000_close,
...@@ -2169,12 +2199,12 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2169,12 +2199,12 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
info->squeseqnum = 0; info->squeseqnum = 0;
// dev->hard_start_xmit = &ft1000_start_xmit; /* dev->hard_start_xmit = &ft1000_start_xmit; */
// dev->get_stats = &ft1000_stats; /* dev->get_stats = &ft1000_stats; */
// dev->open = &ft1000_open; /* dev->open = &ft1000_open; */
// dev->stop = &ft1000_close; /* dev->stop = &ft1000_close; */
dev->netdev_ops = &ft1000ops; // Slavius 21.10.2009 due to kernel changes dev->netdev_ops = &ft1000ops; /* Slavius 21.10.2009 due to kernel changes */
DEBUG(0, "device name = %s\n", dev->name); DEBUG(0, "device name = %s\n", dev->name);
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#define MAX_LENGTH 0x7f0 #define MAX_LENGTH 0x7f0
// Temporary download mechanism for Magnemite /* Temporary download mechanism for Magnemite */
#define DWNLD_MAG_TYPE_LOC 0x00 #define DWNLD_MAG_TYPE_LOC 0x00
#define DWNLD_MAG_LEN_LOC 0x01 #define DWNLD_MAG_LEN_LOC 0x01
#define DWNLD_MAG_ADDR_LOC 0x02 #define DWNLD_MAG_ADDR_LOC 0x02
...@@ -74,35 +74,35 @@ ...@@ -74,35 +74,35 @@
#define HANDSHAKE_MAG_TIMEOUT_VALUE 0xF1F1 #define HANDSHAKE_MAG_TIMEOUT_VALUE 0xF1F1
// New Magnemite downloader /* New Magnemite downloader */
#define DWNLD_MAG1_HANDSHAKE_LOC 0x00 #define DWNLD_MAG1_HANDSHAKE_LOC 0x00
#define DWNLD_MAG1_TYPE_LOC 0x01 #define DWNLD_MAG1_TYPE_LOC 0x01
#define DWNLD_MAG1_SIZE_LOC 0x02 #define DWNLD_MAG1_SIZE_LOC 0x02
#define DWNLD_MAG1_PS_HDR_LOC 0x03 #define DWNLD_MAG1_PS_HDR_LOC 0x03
struct dsp_file_hdr { struct dsp_file_hdr {
long version_id; // Version ID of this image format. long version_id; /* Version ID of this image format. */
long package_id; // Package ID of code release. long package_id; /* Package ID of code release. */
long build_date; // Date/time stamp when file was built. long build_date; /* Date/time stamp when file was built. */
long commands_offset; // Offset to attached commands in Pseudo Hdr format. long commands_offset; /* Offset to attached commands in Pseudo Hdr format. */
long loader_offset; // Offset to bootloader code. long loader_offset; /* Offset to bootloader code. */
long loader_code_address; // Start address of bootloader. long loader_code_address; /* Start address of bootloader. */
long loader_code_end; // Where bootloader code ends. long loader_code_end; /* Where bootloader code ends. */
long loader_code_size; long loader_code_size;
long version_data_offset; // Offset were scrambled version data begins. long version_data_offset; /* Offset were scrambled version data begins. */
long version_data_size; // Size, in words, of scrambled version data. long version_data_size; /* Size, in words, of scrambled version data. */
long nDspImages; // Number of DSP images in file. long nDspImages; /* Number of DSP images in file. */
}; };
#pragma pack(1) #pragma pack(1)
struct dsp_image_info { struct dsp_image_info {
long coff_date; // Date/time when DSP Coff image was built. long coff_date; /* Date/time when DSP Coff image was built. */
long begin_offset; // Offset in file where image begins. long begin_offset; /* Offset in file where image begins. */
long end_offset; // Offset in file where image begins. long end_offset; /* Offset in file where image begins. */
long run_address; // On chip Start address of DSP code. long run_address; /* On chip Start address of DSP code. */
long image_size; // Size of image. long image_size; /* Size of image. */
long version; // Embedded version # of DSP code. long version; /* Embedded version # of DSP code. */
unsigned short checksum; // DSP File checksum unsigned short checksum; /* DSP File checksum */
unsigned short pad1; unsigned short pad1;
}; };
...@@ -511,7 +511,7 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, ...@@ -511,7 +511,7 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
static void usb_dnld_complete(struct urb *urb) static void usb_dnld_complete(struct urb *urb)
{ {
//DEBUG("****** usb_dnld_complete\n"); /* DEBUG("****** usb_dnld_complete\n"); */
} }
/* writes a block of DSP image to DPRAM /* writes a block of DSP image to DPRAM
...@@ -651,9 +651,9 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -651,9 +651,9 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
ft1000dev->usbboot = 0; ft1000dev->usbboot = 0;
ft1000dev->dspalive = 0xffff; ft1000dev->dspalive = 0xffff;
// /*
// Get version id of file, at first 4 bytes of file, for newer files. * Get version id of file, at first 4 bytes of file, for newer files.
// */
state = STATE_START_DWNLD; state = STATE_START_DWNLD;
...@@ -702,8 +702,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -702,8 +702,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
/* Reposition ptrs to beginning of code section */ /* Reposition ptrs to beginning of code section */
s_file = (u16 *) (boot_end); s_file = (u16 *) (boot_end);
c_file = (u8 *) (boot_end); c_file = (u8 *) (boot_end);
//DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file); /* DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file); */
//DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file); /* DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file); */
state = STATE_CODE_DWNLD; state = STATE_CODE_DWNLD;
ft1000dev->fcodeldr = 1; ft1000dev->fcodeldr = 1;
break; break;
...@@ -735,7 +735,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -735,7 +735,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
break; break;
case STATE_CODE_DWNLD: case STATE_CODE_DWNLD:
//DEBUG("FT1000:STATE_CODE_DWNLD\n"); /* DEBUG("FT1000:STATE_CODE_DWNLD\n"); */
ft1000dev->bootmode = 0; ft1000dev->bootmode = 0;
if (ft1000dev->usbboot) if (ft1000dev->usbboot)
handshake = handshake =
...@@ -805,7 +805,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -805,7 +805,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
state = STATE_DONE_DWNLD; state = STATE_DONE_DWNLD;
break; break;
case REQUEST_CODE_SEGMENT: case REQUEST_CODE_SEGMENT:
//DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n"); /* DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n"); */
if (!correct_version) { if (!correct_version) {
DEBUG DEBUG
("FT1000:download:Download error: Got Code Segment request before image offset request.\n"); ("FT1000:download:Download error: Got Code Segment request before image offset request.\n");
...@@ -823,7 +823,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -823,7 +823,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
case REQUEST_MAILBOX_DATA: case REQUEST_MAILBOX_DATA:
DEBUG DEBUG
("FT1000:download: REQUEST_MAILBOX_DATA\n"); ("FT1000:download: REQUEST_MAILBOX_DATA\n");
// Convert length from byte count to word count. Make sure we round up. /* Convert length from byte count to word count. Make sure we round up. */
word_length = word_length =
(long)(pft1000info->DSPInfoBlklen + (long)(pft1000info->DSPInfoBlklen +
1) / 2; 1) / 2;
...@@ -939,7 +939,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -939,7 +939,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
} }
dsp_img_info++; dsp_img_info++;
} //end of for } /* end of for */
if (!correct_version) { if (!correct_version) {
/* /*
...@@ -1002,7 +1002,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -1002,7 +1002,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
(u32) (pseudo_header_len + (u32) (pseudo_header_len +
sizeof(struct sizeof(struct
pseudo_hdr))); pseudo_hdr)));
// link provisioning data /* link provisioning data */
pprov_record = pprov_record =
kmalloc(sizeof(struct prov_record), kmalloc(sizeof(struct prov_record),
GFP_ATOMIC); GFP_ATOMIC);
...@@ -1013,7 +1013,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -1013,7 +1013,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
list, list,
&pft1000info-> &pft1000info->
prov_list); prov_list);
// Move to next entry if available /* Move to next entry if available */
c_file = c_file =
(u8 *) ((unsigned long) (u8 *) ((unsigned long)
c_file + c_file +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment