Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15737
b: refs/heads/master
c: 15d014d
h: refs/heads/master
i:
  15735: f520aea
v: v3
  • Loading branch information
Lennert Buytenhek authored and Jeff Garzik committed Nov 18, 2005
1 parent 664e207 commit ceb7ec2
Show file tree
Hide file tree
Showing 19 changed files with 2,463 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7f7f53168dbee6d6a462acea666fddd18aad4f08
refs/heads/master: 15d014d13149aedd76cbff1b5c3bbfe839391457
2 changes: 2 additions & 0 deletions trunk/drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,8 @@ config E1000_NAPI

If in doubt, say N.

source "drivers/net/ixp2000/Kconfig"

config MYRI_SBUS
tristate "MyriCOM Gigabit Ethernet support"
depends on SBUS
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ obj-$(CONFIG_NET_TULIP) += tulip/
obj-$(CONFIG_HAMRADIO) += hamradio/
obj-$(CONFIG_IRDA) += irda/
obj-$(CONFIG_ETRAX_ETHERNET) += cris/
obj-$(CONFIG_ENP2611_MSF_NET) += ixp2000/

obj-$(CONFIG_NETCONSOLE) += netconsole.o

Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/net/ixp2000/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config ENP2611_MSF_NET
tristate "Radisys ENP2611 MSF network interface support"
depends on ARCH_ENP2611
help
This is a driver for the MSF network interface unit in
the IXP2400 on the Radisys ENP2611 platform.
3 changes: 3 additions & 0 deletions trunk/drivers/net/ixp2000/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
obj-$(CONFIG_ENP2611_MSF_NET) += enp2611_mod.o

enp2611_mod-objs := caleb.o enp2611.o ixp2400-msf.o ixpdev.o pm3386.o
136 changes: 136 additions & 0 deletions trunk/drivers/net/ixp2000/caleb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Helper functions for the SPI-3 bridge FPGA on the Radisys ENP2611
* Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
* Dedicated to Marija Kulikova.
*
* 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.
*/

#include <linux/config.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <asm/io.h>

#define CALEB_IDLO 0x00
#define CALEB_IDHI 0x01
#define CALEB_RID 0x02
#define CALEB_RESET 0x03
#define CALEB_INTREN0 0x04
#define CALEB_INTREN1 0x05
#define CALEB_INTRSTAT0 0x06
#define CALEB_INTRSTAT1 0x07
#define CALEB_PORTEN 0x08
#define CALEB_BURST 0x09
#define CALEB_PORTPAUS 0x0A
#define CALEB_PORTPAUSD 0x0B
#define CALEB_PHY0RX 0x10
#define CALEB_PHY1RX 0x11
#define CALEB_PHY0TX 0x12
#define CALEB_PHY1TX 0x13
#define CALEB_IXPRX_HI_CNTR 0x15
#define CALEB_PHY0RX_HI_CNTR 0x16
#define CALEB_PHY1RX_HI_CNTR 0x17
#define CALEB_IXPRX_CNTR 0x18
#define CALEB_PHY0RX_CNTR 0x19
#define CALEB_PHY1RX_CNTR 0x1A
#define CALEB_IXPTX_CNTR 0x1B
#define CALEB_PHY0TX_CNTR 0x1C
#define CALEB_PHY1TX_CNTR 0x1D
#define CALEB_DEBUG0 0x1E
#define CALEB_DEBUG1 0x1F


static u8 caleb_reg_read(int reg)
{
u8 value;

value = *((volatile u8 *)(ENP2611_CALEB_VIRT_BASE + reg));

// printk(KERN_INFO "caleb_reg_read(%d) = %.2x\n", reg, value);

return value;
}

static void caleb_reg_write(int reg, u8 value)
{
u8 dummy;

// printk(KERN_INFO "caleb_reg_write(%d, %.2x)\n", reg, value);

*((volatile u8 *)(ENP2611_CALEB_VIRT_BASE + reg)) = value;

dummy = *((volatile u8 *)ENP2611_CALEB_VIRT_BASE);
__asm__ __volatile__("mov %0, %0" : "+r" (dummy));
}


void caleb_reset(void)
{
/*
* Perform a chip reset.
*/
caleb_reg_write(CALEB_RESET, 0x02);
udelay(1);

/*
* Enable all interrupt sources. This is needed to get
* meaningful results out of the status bits (register 6
* and 7.)
*/
caleb_reg_write(CALEB_INTREN0, 0xff);
caleb_reg_write(CALEB_INTREN1, 0x07);

/*
* Set RX and TX FIFO thresholds to 1.5kb.
*/
caleb_reg_write(CALEB_PHY0RX, 0x11);
caleb_reg_write(CALEB_PHY1RX, 0x11);
caleb_reg_write(CALEB_PHY0TX, 0x11);
caleb_reg_write(CALEB_PHY1TX, 0x11);

/*
* Program SPI-3 burst size.
*/
caleb_reg_write(CALEB_BURST, 0); // 64-byte RBUF mpackets
// caleb_reg_write(CALEB_BURST, 1); // 128-byte RBUF mpackets
// caleb_reg_write(CALEB_BURST, 2); // 256-byte RBUF mpackets
}

void caleb_enable_rx(int port)
{
u8 temp;

temp = caleb_reg_read(CALEB_PORTEN);
temp |= 1 << port;
caleb_reg_write(CALEB_PORTEN, temp);
}

void caleb_disable_rx(int port)
{
u8 temp;

temp = caleb_reg_read(CALEB_PORTEN);
temp &= ~(1 << port);
caleb_reg_write(CALEB_PORTEN, temp);
}

void caleb_enable_tx(int port)
{
u8 temp;

temp = caleb_reg_read(CALEB_PORTEN);
temp |= 1 << (port + 4);
caleb_reg_write(CALEB_PORTEN, temp);
}

void caleb_disable_tx(int port)
{
u8 temp;

temp = caleb_reg_read(CALEB_PORTEN);
temp &= ~(1 << (port + 4));
caleb_reg_write(CALEB_PORTEN, temp);
}
22 changes: 22 additions & 0 deletions trunk/drivers/net/ixp2000/caleb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Helper functions for the SPI-3 bridge FPGA on the Radisys ENP2611
* Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
* Dedicated to Marija Kulikova.
*
* 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.
*/

#ifndef __CALEB_H
#define __CALEB_H

void caleb_reset(void);
void caleb_enable_rx(int port);
void caleb_disable_rx(int port);
void caleb_enable_tx(int port);
void caleb_disable_tx(int port);


#endif
Loading

0 comments on commit ceb7ec2

Please sign in to comment.