83xx: UEC: Added support for bitBang MII driver access to PHYs
Subsystems (2)
PATCH 1/1 83xx: UEC: Added support for bitBang MII driver access to PHYs
From 3aa39a9788c020b2192f44132d310b22e7c866a4 Mon Sep 17 00:00:00 2001
From: Richard Retanubun <[email protected]>
Date: Wed, 17 Jun 2009 16:00:41 -0400
Subject: [PATCH] 83xx: UEC: Added support for bitBang MII driver access to PHYs
This patch enabled support for having PHYs on bitBang MII and uec MII operating at the same time. Modeled after the MPC8360ADS implementation and added the ability to specify which ethernet interfaces have bitbang SMI on the board header file.
--- drivers/net/phy/miiphybb.c | 28 ++++++++++++++++++++----- drivers/net/phy/miiphybb.h | 26 +++++++++++++++++++++++ drivers/qe/uec.c | 6 +--- drivers/qe/uec_phy.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 10 deletions(-)
create mode 100644 drivers/net/phy/miiphybb.h
drivers/net/phy/miiphybb.c +22 -6
@@ -29,6 +29,7 @@#include <common.h> #include <ioports.h> #include <ppc_asm.tmpl> +#include "miiphybb.h" /***************************************************************************** *
@@ -38,8 +39,13 @@static void miiphy_pre (char read,unsigned char addr,unsigned char reg) {int j;/* counter */ -#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) -volatile ioport_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) \ + && !defined(CONFIG_MPC83XX ) +volatile gpio_n_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#elif defined(CONFIG_MPC83XX ) +volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR ; +volatile qepio83xx_t *par_io = (volatile qepio83xx_t *)&im->qepio; +volatile gpio_n_t *iop = &(par_io->ioport[MDIO_PORT ]);#endif /*
@@ -123,8 +129,13 @@ int bb_miiphy_read (char *devname, unsigned char addr, {short rdreg;/* register working value */ int j;/* counter */ -#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) -volatile ioport_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) \ + && !defined(CONFIG_MPC83XX ) +volatile gpio_n_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#elif defined(CONFIG_MPC83XX ) +volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR ; +volatile qepio83xx_t *par_io = (volatile qepio83xx_t *)&im->qepio; +volatile gpio_n_t *iop = &(par_io->ioport[MDIO_PORT ]);#endif miiphy_pre (1 , addr, reg);
@@ -190,8 +201,13 @@ int bb_miiphy_write (char *devname, unsigned char addr, unsigned char reg, unsigned short value) { int j; /* counter */ -#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) -volatile ioport_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) \ + && !defined(CONFIG_MPC83XX ) +volatile gpio_n_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#elif defined(CONFIG_MPC83XX ) +volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR ; +volatile qepio83xx_t *par_io = (volatile qepio83xx_t *)&im->qepio; +volatile gpio_n_t *iop = &(par_io->ioport[MDIO_PORT ]);#endif miiphy_pre (0 , addr, reg);
drivers/net/phy/miiphybb.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2006-2009 RuggedCom, Inc. +* +* Richard Retanubun <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +int bb_miiphy_read (char *devname,unsigned char addr, +unsigned char reg,unsigned short *value); + +int bb_miiphy_write (char *devname,unsigned char addr, +unsigned char reg,unsigned short value);
drivers/qe/uec.c +2 -4
@@ -579,8 +579,7 @@ static void phy_change(struct eth_device *dev)adjust_link (dev); } -#if defined(CONFIG_MII ) || defined(CONFIG_CMD_MII ) \ - && !defined(BITBANGMII ) +#if defined(CONFIG_MII ) || defined(CONFIG_CMD_MII )/*&& !defined(BITBANGMII)*/ /* * Find a device index from the devlist by name
@@ -1383,8 +1382,7 @@ int uec_initialize(bd_t *bis, uec_info_t *uec_info)return err; } -#if defined(CONFIG_MII ) || defined(CONFIG_CMD_MII ) \ - && !defined(BITBANGMII ) +#if defined(CONFIG_MII ) || defined(CONFIG_CMD_MII )/* && !defined(CONFIG_BITBANGMII) */ miiphy_register (dev->name, uec_miiphy_read, uec_miiphy_write);#endif
drivers/qe/uec_phy.c +48 -0
72 lines not on this page · raw message
Signature · 1 line
1.6.2.4
PATCH 1/1 83xx: UEC: Added support for bitBang MII driver access to PHYs
Hi Richard,
drivers/net/phy/miiphybb.c line 49
Quoted 10 lines
drivers/net/phy/miiphybb.c +7
-2-#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) -volatile ioport_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#if !(defined(CONFIG_EP8248 ) || defined(CONFIG_EP82XXM )) \ + && !defined(CONFIG_MPC83XX ) +volatile gpio_n_t *iop =ioport_addr ((immap_t *)CONFIG_SYS_IMMR ,MDIO_PORT ); +#elif defined(CONFIG_MPC83XX ) +volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR ; +volatile qepio83xx_t *par_io = (volatile qepio83xx_t *)&im->qepio; +volatile gpio_n_t *iop = &(par_io->ioport[MDIO_PORT ]);#endif
CONFIG_MPC83XX was recently replaced with CONFIG_MPC83xx. I didn't look through the patches with a fine-toothed comb, but it looked like there were a couple of instances of CONFIG_MPC83XX.
Best,
Peter