android_kernel_motorola_sm6225/include/linux/fs_enet_pd.h
Linus Torvalds c010b2f76c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (82 commits)
  ipw2200: Call netif_*_queue() interfaces properly.
  netxen: Needs to include linux/vmalloc.h
  [netdrvr] atl1d: fix !CONFIG_PM build
  r6040: rework init_one error handling
  r6040: bump release number to 0.18
  r6040: handle RX fifo full and no descriptor interrupts
  r6040: change the default waiting time
  r6040: use definitions for magic values in descriptor status
  r6040: completely rework the RX path
  r6040: call napi_disable when puting down the interface and set lp->dev accordingly.
  mv643xx_eth: fix NETPOLL build
  r6040: rework the RX buffers allocation routine
  r6040: fix scheduling while atomic in r6040_tx_timeout
  r6040: fix null pointer access and tx timeouts
  r6040: prefix all functions with r6040
  rndis_host: support WM6 devices as modems
  at91_ether: use netstats in net_device structure
  sfc: Create one RX queue and interrupt per CPU package by default
  sfc: Use a separate workqueue for resets
  sfc: I2C adapter initialisation fixes
  ...
2008-07-22 19:09:51 -07:00

164 lines
3.4 KiB
C

/*
* Platform information definitions for the
* universal Freescale Ethernet driver.
*
* Copyright (c) 2003 Intracom S.A.
* by Pantelis Antoniou <panto@intracom.gr>
*
* 2005 (c) MontaVista Software, Inc.
* Vitaly Bordug <vbordug@ru.mvista.com>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#ifndef FS_ENET_PD_H
#define FS_ENET_PD_H
#include <linux/string.h>
#include <asm/types.h>
#define FS_ENET_NAME "fs_enet"
enum fs_id {
fsid_fec1,
fsid_fec2,
fsid_fcc1,
fsid_fcc2,
fsid_fcc3,
fsid_scc1,
fsid_scc2,
fsid_scc3,
fsid_scc4,
};
#define FS_MAX_INDEX 9
static inline int fs_get_fec_index(enum fs_id id)
{
if (id >= fsid_fec1 && id <= fsid_fec2)
return id - fsid_fec1;
return -1;
}
static inline int fs_get_fcc_index(enum fs_id id)
{
if (id >= fsid_fcc1 && id <= fsid_fcc3)
return id - fsid_fcc1;
return -1;
}
static inline int fs_get_scc_index(enum fs_id id)
{
if (id >= fsid_scc1 && id <= fsid_scc4)
return id - fsid_scc1;
return -1;
}
static inline int fs_fec_index2id(int index)
{
int id = fsid_fec1 + index - 1;
if (id >= fsid_fec1 && id <= fsid_fec2)
return id;
return FS_MAX_INDEX;
}
static inline int fs_fcc_index2id(int index)
{
int id = fsid_fcc1 + index - 1;
if (id >= fsid_fcc1 && id <= fsid_fcc3)
return id;
return FS_MAX_INDEX;
}
static inline int fs_scc_index2id(int index)
{
int id = fsid_scc1 + index - 1;
if (id >= fsid_scc1 && id <= fsid_scc4)
return id;
return FS_MAX_INDEX;
}
enum fs_mii_method {
fsmii_fixed,
fsmii_fec,
fsmii_bitbang,
};
enum fs_ioport {
fsiop_porta,
fsiop_portb,
fsiop_portc,
fsiop_portd,
fsiop_porte,
};
struct fs_mii_bit {
u32 offset;
u8 bit;
u8 polarity;
};
struct fs_mii_bb_platform_info {
struct fs_mii_bit mdio_dir;
struct fs_mii_bit mdio_dat;
struct fs_mii_bit mdc_dat;
int delay; /* delay in us */
int irq[32]; /* irqs per phy's */
};
struct fs_platform_info {
void(*init_ioports)(struct fs_platform_info *);
/* device specific information */
int fs_no; /* controller index */
char fs_type[4]; /* controller type */
u32 cp_page; /* CPM page */
u32 cp_block; /* CPM sblock */
u32 cp_command; /* CPM page/sblock/mcn */
u32 clk_trx; /* some stuff for pins & mux configuration*/
u32 clk_rx;
u32 clk_tx;
u32 clk_route;
u32 clk_mask;
u32 mem_offset;
u32 dpram_offset;
u32 fcc_regs_c;
u32 device_flags;
int phy_addr; /* the phy address (-1 no phy) */
char bus_id[16];
int phy_irq; /* the phy irq (if it exists) */
const struct fs_mii_bus_info *bus_info;
int rx_ring, tx_ring; /* number of buffers on rx */
__u8 macaddr[6]; /* mac address */
int rx_copybreak; /* limit we copy small frames */
int use_napi; /* use NAPI */
int napi_weight; /* NAPI weight */
int use_rmii; /* use RMII mode */
int has_phy; /* if the network is phy container as well...*/
};
struct fs_mii_fec_platform_info {
u32 irq[32];
u32 mii_speed;
};
static inline int fs_get_id(struct fs_platform_info *fpi)
{
if(strstr(fpi->fs_type, "SCC"))
return fs_scc_index2id(fpi->fs_no);
if(strstr(fpi->fs_type, "FCC"))
return fs_fcc_index2id(fpi->fs_no);
if(strstr(fpi->fs_type, "FEC"))
return fs_fec_index2id(fpi->fs_no);
return fpi->fs_no;
}
#endif