<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-01-14)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
* mpc83xx/network/tsec.c, mpc83xx/network/tsec.h: Use configuration
structure instead of many function parameters. Moved board specific
initializations. Added support for interfaces without PHY access.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/ChangeLog.diff?r1=text&tr1=1.367&r2=text&tr2=1.368&diff_format=h">M</a></td><td width='1%'>1.368</td><td width='100%'>c/src/lib/libcpu/powerpc/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.367 rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.368
--- rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.367 Mon Jan 10 06:00:27 2011
+++ rtems/c/src/lib/libcpu/powerpc/ChangeLog Fri Jan 14 04:48:56 2011
</font><font color='#997700'>@@ -1,3 +1,9 @@
</font><font color='#000088'>+2011-01-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * mpc83xx/network/tsec.c, mpc83xx/network/tsec.h: Use configuration
+ structure instead of many function parameters. Moved board specific
+ initializations. Added support for interfaces without PHY access.
+
</font> 2011-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
* new-exceptions/bspsupport/ppc_exc_categories.c: Fixed e200 machine
<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h:1.2 rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h:1.3
--- rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h:1.2 Thu Dec 30 07:09:47 2010
+++ rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.h Fri Jan 14 04:48:57 2011
</font><font color='#997700'>@@ -21,6 +21,8 @@
</font> #define LIBCPU_POWERPC_TSEC_H
#include <stdint.h>
<font color='#000088'>+
+#include <bsp/irq.h>
</font> #include <bsp/tsec-config.h>
#ifdef __cplusplus
<font color='#997700'>@@ -355,12 +357,19 @@
</font>
struct rtems_bsdnet_ifconfig;
<font color='#000088'>+typedef struct {
+ int unit_number;
+ char *unit_name;
+ volatile tsec_registers *reg_ptr;
+ volatile tsec_registers *mdio_ptr;
+ rtems_irq_number irq_num_tx;
+ rtems_irq_number irq_num_rx;
+ rtems_irq_number irq_num_err;
+ int phy_default;
+} tsec_config;
+
</font> int tsec_driver_attach_detach(
struct rtems_bsdnet_ifconfig *config,
<font color='#880000'>- int unitNumber,
- char *unitName,
- volatile tsec_registers *reg_ptr,
- volatile tsec_registers *mdio_ptr,
</font> int attaching
);
<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c:1.10 rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c:1.11
--- rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c:1.10 Thu Dec 30 07:09:47 2010
+++ rtems/c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c Fri Jan 14 04:48:56 2011
</font><font color='#997700'>@@ -16,17 +16,11 @@
</font> +-----------------------------------------------------------------+
| this file contains the MPC83xx TSEC networking driver |
\*===============================================================*/
<font color='#880000'>-/*
- * this driver has the following HW assumptions:
- * - PHY for TSEC1 uses address 0
- * - PHY for TSEC2 uses address 1
- * - PHY uses GMII for 1000Base-T and MII for the rest of the modes
- */
</font><font color='#000088'>+
</font> #include <stdlib.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <bsp/tsec.h>
<font color='#880000'>-#include <libcpu/spr.h>
</font> #include <rtems/error.h>
#include <rtems/bspIo.h>
#include <rtems/rtems_bsdnet.h>
<font color='#997700'>@@ -43,17 +37,16 @@
</font> #include <netinet/if_ether.h>
#include <stdio.h>
<font color='#880000'>-/* System Version Register */
-#define SVR 286
-SPR_RO( SVR)
-
-/* Processor Version Register */
-SPR_RO( PVR)
-
</font> #define CLREVENT_IN_IRQ
#define TSEC_WATCHDOG_TIMEOUT 5 /* check media every 5 seconds */
<font color='#000088'>+#ifdef DEBUG
+ #define PF(fmt, ...) printk("%s: " fmt, __func__, ##__VA_ARGS__)
+#else
+ #define PF(...)
+#endif
+
</font> /*
* Device data
*/
<font color='#997700'>@@ -64,11 +57,11 @@
</font> /*
* HW links: (filled from rtems_bsdnet_ifconfig
*/
<font color='#880000'>- volatile tsec_registers *reg_ptr; /* pointer to TSEC register block */
- volatile tsec_registers *mdio_ptr; /* pointer to TSEC register block which is responsible for MDIO communication */
- int irq_num_tx; /* tx irq number */
- int irq_num_rx; /* rx irq number */
- int irq_num_err; /* error irq number */
</font><font color='#000088'>+ volatile tsec_registers *reg_ptr; /* pointer to TSEC register block */
+ volatile tsec_registers *mdio_ptr; /* pointer to TSEC register block which is responsible for MDIO communication */
+ rtems_irq_number irq_num_tx;
+ rtems_irq_number irq_num_rx;
+ rtems_irq_number irq_num_err;
</font>
/*
* BD management
<font color='#997700'>@@ -371,14 +364,12 @@
</font>
/* pointer to TSEC registers */
volatile tsec_registers *reg_ptr = sc->mdio_ptr;
<font color='#000088'>+ PF("%u\n", reg);
</font>
/*
* make sure we work with a valid phy
*/
if (phy == -1) {
<font color='#880000'>- /*
- * set default phy number: 0 for TSEC1, 1 for TSEC2
- */
</font> phy = sc->phy_default;
}
if ( (phy < 0) || (phy > 31)) {
<font color='#997700'>@@ -439,6 +430,7 @@
</font>
/* pointer to TSEC registers */
volatile tsec_registers *reg_ptr = sc->mdio_ptr;
<font color='#000088'>+ PF("%u\n", reg);
</font>
/*
* make sure we work with a valid phy
<font color='#997700'>@@ -622,6 +614,7 @@
</font> - sizeof(struct ether_header));
eh = mtod(m, struct ether_header *);
m->m_data += sizeof(struct ether_header);
<font color='#000088'>+ PF("RX[%08x] (%i)\n", BD_ptr, m->m_len);
</font> ether_input(&sc->arpcom.ac_if,eh,m);
}
else {
<font color='#997700'>@@ -1001,6 +994,7 @@
</font> CurrBD->buffer = mtod(m, void *);
CurrBD->length = (uint32_t)m->m_len;
l = m; /* remember: we use this mbuf */
<font color='#000088'>+ PF("TX[%08x] (%i)\n", CurrBD, m->m_len);
</font>
bd_idx = CurrBD - sc->Tx_Frst_BD;
sc->Tx_mBuf_Ptr[bd_idx] = m;
<font color='#997700'>@@ -1147,6 +1141,7 @@
</font> uint32_t irq_events;
#endif
<font color='#000088'>+ PF("TXIRQ\n");
</font> sc->txInterrupts++;
/*
* disable tx interrupts
<font color='#997700'>@@ -1191,6 +1186,7 @@
</font> #endif
sc->rxInterrupts++;
<font color='#000088'>+ PF("RXIRQ\n");
</font> /*
* disable rx interrupts
*/
<font color='#997700'>@@ -1229,6 +1225,7 @@
</font> {
struct tsec_struct *sc =
(struct tsec_struct *)handle;
<font color='#000088'>+ PF("ERIRQ\n");
</font> /*
* clear error events in IEVENT
*/
<font color='#997700'>@@ -1689,8 +1686,6 @@
</font> return error;
}
<font color='#880000'>-/* #define DEBUG */
-
</font> /*=========================================================================*\
| Function: |
\*-------------------------------------------------------------------------*/
<font color='#997700'>@@ -1713,9 +1708,11 @@
</font> struct tsec_struct *sc = ifp->if_softc;
int media = IFM_MAKEWORD( 0, 0, 0, sc->phy_default);
<font color='#880000'>-#ifdef DEBUG
- printf("c");
-#endif
</font><font color='#000088'>+ /* In case no PHY is available stop now */
+ if (sc->phy_default < 0) {
+ return 0;
+ }
+
</font> /*
* fetch media status
*/
<font color='#997700'>@@ -1723,9 +1720,7 @@
</font> if (result != 0) {
return result;
}
<font color='#880000'>-#ifdef DEBUG
- printf("C");
-#endif
</font><font color='#000088'>+
</font> /*
* status is unchanged? then do nothing
*/
<font color='#997700'>@@ -1821,18 +1816,13 @@
</font> ifp->if_timer = TSEC_WATCHDOG_TIMEOUT;
}
<font color='#880000'>-static int tsec_driver_attach(
- struct rtems_bsdnet_ifconfig *config,
- int unitNumber,
- char *unitName,
- volatile tsec_registers *reg_ptr,
- volatile tsec_registers *mdio_ptr
-)
</font><font color='#000088'>+static int tsec_driver_attach(struct rtems_bsdnet_ifconfig *config)
</font> {
<font color='#000088'>+ tsec_config *tsec_cfg = config->drv_ctrl;
+ int unitNumber = tsec_cfg->unit_number;
+ char *unitName = tsec_cfg->unit_name;
</font> struct tsec_struct *sc;
struct ifnet *ifp;
<font color='#880000'>- uint32_t svr = _read_SVR();
- uint32_t pvr = _read_PVR();
</font>
/*
* Is driver free?
<font color='#997700'>@@ -1846,10 +1836,6 @@
</font>
sc = &tsec_driver[unitNumber - 1];
ifp = &sc->arpcom.ac_if;
<font color='#880000'>- /*
- * add sc to config
- */
- config->drv_ctrl = sc;
</font>
if(ifp->if_softc != NULL) {
printk ("Driver already in use.\n");
<font color='#997700'>@@ -1871,35 +1857,14 @@
</font> sc->acceptBroadcast = !config->ignore_broadcast;
/* get pointer to TSEC register block */
<font color='#880000'>- sc->reg_ptr = reg_ptr;
- sc->mdio_ptr = mdio_ptr;
</font><font color='#000088'>+ sc->reg_ptr = tsec_cfg->reg_ptr;
+ sc->mdio_ptr = tsec_cfg->mdio_ptr;
</font>
<font color='#880000'>- if (svr == 0x80b00010 && pvr == 0x80850010) {
- /*
- * This is a special case for MPC8313ERDB with silicon revision 1. Look in
- * "MPC8313ECE Rev. 3, 3/2008" errata for "IPIC 1".
- */
- if (unitNumber == 1) {
- sc->irq_num_tx = 37;
- sc->irq_num_rx = 36;
- sc->irq_num_err = 35;
- } else if (unitNumber == 2) {
- sc->irq_num_tx = 34;
- sc->irq_num_rx = 33;
- sc->irq_num_err = 32;
- } else {
- return 0;
- }
- } else {
- /* get base interrupt number (for Tx irq, Rx=base+1,Err=base+2) */
- sc->irq_num_tx = config->irno + 0; /* tx irq number from BSP */
- sc->irq_num_rx = config->irno + 1; /* rx irq number from BSP */
- sc->irq_num_err = config->irno + 2; /* err irq number from BSP */
- }
</font><font color='#000088'>+ /* IRQ numbers */
+ sc->irq_num_tx = tsec_cfg->irq_num_tx;
+ sc->irq_num_rx = tsec_cfg->irq_num_rx;
+ sc->irq_num_err = tsec_cfg->irq_num_err;
</font>
<font color='#880000'>- if (config->irno == 0) {
- rtems_panic("TSEC: interupt base number irno not defined");
- }
</font> /*
* setup info about mdio interface
*/
<font color='#997700'>@@ -1907,20 +1872,8 @@
</font> sc->mdio_info.mdio_w = tsec_mdio_write;
sc->mdio_info.has_gmii = 1; /* we support gigabit IF */
<font color='#880000'>- /*
- * XXX: Although most hardware builders will assign the PHY addresses
- * like this, this should be more configurable
- */
-#ifdef MPC8313ERDB
- if (unitNumber == 2) {
- sc->phy_default = 4;
- } else {
- /* TODO */
- return 0;
- }
-#else /* MPC8313ERDB */
- sc->phy_default = unitNumber-1;
-#endif /* MPC8313ERDB */
</font><font color='#000088'>+ /* PHY address */
+ sc->phy_default = tsec_cfg->phy_default;
</font>
/*
* Set up network interface values
<font color='#997700'>@@ -1954,21 +1907,11 @@
</font>
int tsec_driver_attach_detach(
struct rtems_bsdnet_ifconfig *config,
<font color='#880000'>- int unitNumber,
- char *unitName,
- volatile tsec_registers *reg_ptr,
- volatile tsec_registers *mdio_ptr,
</font> int attaching
)
{
if (attaching) {
<font color='#880000'>- return tsec_driver_attach(
- config,
- unitNumber,
- unitName,
- reg_ptr,
- mdio_ptr
- );
</font><font color='#000088'>+ return tsec_driver_attach(config);
</font> } else {
return 0;
}
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
* network/network.c: Moved initializations from generic TSEC driver
part.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog.diff?r1=text&tr1=1.97&r2=text&tr2=1.98&diff_format=h">M</a></td><td width='1%'>1.98</td><td width='100%'>c/src/lib/libbsp/powerpc/gen83xx/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/powerpc/gen83xx/network/network.c.diff?r1=text&tr1=1.15&r2=text&tr2=1.16&diff_format=h">M</a></td><td width='1%'>1.16</td><td width='100%'>c/src/lib/libbsp/powerpc/gen83xx/network/network.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog:1.97 rtems/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog:1.98
--- rtems/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog:1.97 Thu Dec 30 07:16:41 2010
+++ rtems/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog Fri Jan 14 04:54:06 2011
</font><font color='#997700'>@@ -1,3 +1,8 @@
</font><font color='#000088'>+2011-01-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * network/network.c: Moved initializations from generic TSEC driver
+ part.
+
</font> 2010-12-30 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/u-boot.h: Removed file.
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/powerpc/gen83xx/network/network.c:1.15 rtems/c/src/lib/libbsp/powerpc/gen83xx/network/network.c:1.16
--- rtems/c/src/lib/libbsp/powerpc/gen83xx/network/network.c:1.15 Thu Dec 30 08:05:34 2010
+++ rtems/c/src/lib/libbsp/powerpc/gen83xx/network/network.c Fri Jan 14 04:54:06 2011
</font><font color='#997700'>@@ -25,7 +25,8 @@
</font> #include <bsp/tsec.h>
#include <bsp/u-boot.h>
#include <mpc83xx/mpc83xx.h>
<font color='#880000'>-#include <stdio.h>
</font><font color='#000088'>+#include <string.h>
+#include <libcpu/spr.h>
</font>
#define TSEC_IFMODE_RGMII 0
#define TSEC_IFMODE_GMII 1
<font color='#997700'>@@ -48,6 +49,13 @@
</font>
#endif
<font color='#000088'>+/* System Version Register */
+#define SVR 286
+SPR_RO( SVR)
+
+/* Processor Version Register */
+SPR_RO( PVR)
+
</font> /*=========================================================================*\
| Function: |
\*-------------------------------------------------------------------------*/
<font color='#997700'>@@ -67,8 +75,14 @@
</font> | 1, if success |
\*=========================================================================*/
{
<font color='#000088'>+ tsec_config tsec_cfg;
</font> int unitNumber;
char *unitName;
<font color='#000088'>+ uint32_t svr = _read_SVR();
+ uint32_t pvr = _read_PVR();
+
+ memset(&tsec_cfg, 0, sizeof(tsec_cfg));
+ config->drv_ctrl = &tsec_cfg;
</font>
/*
* Parse driver name
<font color='#997700'>@@ -76,6 +90,10 @@
</font> if((unitNumber = rtems_bsdnet_parse_driver_name(config, &unitName)) < 0) {
return 0;
}
<font color='#000088'>+
+ tsec_cfg.reg_ptr = &mpc83xx.tsec [unitNumber - 1];
+ tsec_cfg.mdio_ptr = &mpc83xx.tsec [0];
+
</font> if (attaching) {
#if (TSEC_IFMODE==TSEC_IFMODE_GMII)
#if !defined(HSC_CM01)
<font color='#997700'>@@ -126,11 +144,10 @@
</font> if (config->hardware_address == NULL) {
#if !defined(HAS_UBOOT)
static char hw_addr [TSEC_COUNT][6];
<font color='#880000'>- volatile tsec_registers *reg_ptr;
</font><font color='#000088'>+ volatile tsec_registers *reg_ptr = tsec_cfg->reg_ptr;
</font>
/* read MAC address from hardware register */
/* we expect it htere from the boot loader */
<font color='#880000'>- reg_ptr = &mpc83xx.tsec[unitNumber - 1];
</font> config->hardware_address = hw_addr[unitNumber-1];
hw_addr[unitNumber-1][5] = (reg_ptr->macstnaddr[0] >> 24) & 0xff;
<font color='#997700'>@@ -180,15 +197,53 @@
</font> ? BSP_IPIC_IRQ_TSEC1_TX
: BSP_IPIC_IRQ_TSEC2_TX
);
<font color='#000088'>+
+ if (svr == 0x80b00010 && pvr == 0x80850010) {
+ /*
+ * This is a special case for MPC8313ERDB with silicon revision 1. Look in
+ * "MPC8313ECE Rev. 3, 3/2008" errata for "IPIC 1".
+ */
+ if (unitNumber == 1) {
+ tsec_cfg.irq_num_tx = 37;
+ tsec_cfg.irq_num_rx = 36;
+ tsec_cfg.irq_num_err = 35;
+ } else if (unitNumber == 2) {
+ tsec_cfg.irq_num_tx = 34;
+ tsec_cfg.irq_num_rx = 33;
+ tsec_cfg.irq_num_err = 32;
+ } else {
+ return 0;
+ }
+ } else {
+ rtems_irq_number irno = unitNumber == 1 ?
+ BSP_IPIC_IRQ_TSEC1_TX : BSP_IPIC_IRQ_TSEC2_TX;
+
+ /* get base interrupt number (for Tx irq, Rx=base+1,Err=base+2) */
+ tsec_cfg.irq_num_tx = irno + 0;
+ tsec_cfg.irq_num_rx = irno + 1;
+ tsec_cfg.irq_num_err = irno + 2;
+ }
+
+ /*
+ * XXX: Although most hardware builders will assign the PHY addresses
+ * like this, this should be more configurable
+ */
+#ifdef MPC8313ERDB
+ if (unitNumber == 2) {
+ tsec_cfg.phy_default = 4;
+ } else {
+ /* TODO */
+ return 0;
+ }
+#else /* MPC8313ERDB */
+ tsec_cfg.phy_default = unitNumber-1;
+#endif /* MPC8313ERDB */
+
+ tsec_cfg.unit_number = unitNumber;
+ tsec_cfg.unit_name = unitName;
+
</font> /*
* call attach function of board independent driver
*/
<font color='#880000'>- return tsec_driver_attach_detach(
- config,
- unitNumber,
- unitName,
- &mpc83xx.tsec [unitNumber - 1],
- &mpc83xx.tsec [0],
- attaching
- );
</font><font color='#000088'>+ return tsec_driver_attach_detach(config, attaching);
</font> }
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>