diff mbox

[U-Boot,v4,1/4] mvgbe: allow non-sequential PHY addresses

Message ID 1352071924-20268-1-git-send-email-albert.u.boot@aribaud.net
State Not Applicable
Delegated to: Prafulla Wadaskar
Headers show

Commit Message

Albert ARIBAUD Nov. 4, 2012, 11:32 p.m. UTC
Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
Changes in v3:
- fixed building when SoC provides only one GbE port.

 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    1 -
 arch/arm/include/asm/arch-orion5x/orion5x.h   |    1 -
 drivers/net/mvgbe.c                           |   12 +++++++++++-
 drivers/net/mvgbe.h                           |    7 -------
 4 files changed, 11 insertions(+), 10 deletions(-)

Comments

Prafulla Wadaskar Nov. 10, 2012, 6:41 a.m. UTC | #1
> -----Original Message-----
> From: Albert ARIBAUD [mailto:albert.u.boot@aribaud.net]
> Sent: 05 November 2012 05:02
> To: U-Boot
> Cc: Prafulla Wadaskar; Simon Guinot; Albert ARIBAUD
> Subject: [PATCH v4 1/4] mvgbe: allow non-sequential PHY addresses
> 
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
> Changes in v3:
> - fixed building when SoC provides only one GbE port.
> 
>  arch/arm/include/asm/arch-kirkwood/kirkwood.h |    1 -
>  arch/arm/include/asm/arch-orion5x/orion5x.h   |    1 -
>  drivers/net/mvgbe.c                           |   12 +++++++++++-
>  drivers/net/mvgbe.h                           |    7 -------
>  4 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
> b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
> index 47771d5..503fb1e 100644
> --- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
> +++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
> @@ -61,7 +61,6 @@
>  #define KW_SATA_PORT1_OFFSET		0x4000
> 
>  /* Kirkwood GbE controller has two ports */
> -#define MAX_MVGBE_DEVS	2
>  #define MVGBE0_BASE	KW_EGIGA0_BASE
>  #define MVGBE1_BASE	KW_EGIGA1_BASE
> 
> diff --git a/arch/arm/include/asm/arch-orion5x/orion5x.h
> b/arch/arm/include/asm/arch-orion5x/orion5x.h
> index b0d3368..b32d1d3 100644
> --- a/arch/arm/include/asm/arch-orion5x/orion5x.h
> +++ b/arch/arm/include/asm/arch-orion5x/orion5x.h
> @@ -55,7 +55,6 @@
>  #define ORION5X_SATA_PORT1_OFFSET		0x4000
> 
>  /* Orion5x GbE controller has a single port */
> -#define MAX_MVGBE_DEVS	1
>  #define MVGBE0_BASE	ORION5X_EGIGA_BASE
> 
>  /* Orion5x USB Host controller is port 1 */
> diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
> index 47bf27c..2533614 100644
> --- a/drivers/net/mvgbe.c
> +++ b/drivers/net/mvgbe.c
> @@ -49,6 +49,8 @@
> 
>  DECLARE_GLOBAL_DATA_PTR;
> 
> +#define MAX_MVGBE_DEVS	2
> +
>  #define MV_PHY_ADR_REQUEST 0xee
>  #define MVGBE_SMI_REG (((struct mvgbe_registers *)MVGBE0_BASE)->smi)
> 
> @@ -653,6 +655,14 @@ int mvgbe_initialize(bd_t *bis)
>  	struct eth_device *dev;
>  	int devnum;
>  	u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
> +#if defined(CONFIG_MVGBE_PHY_ADRS)
> +#define MVGBE_PHY_ADRS CONFIG_MVGBE_PHY_ADRS
> +#elif defined(CONFIG_PHY_BASE_ADR)
> +#define MVGBE_PHY_ADRS {CONFIG_PHY_BASE_ADR, CONFIG_PHY_BASE_ADR+1}
> +#else
> +#define MVGBE_PHY_ADRS {8, 9}
> +#endif
> +	u8 used_phy_adrs[MAX_MVGBE_DEVS] = MVGBE_PHY_ADRS;
> 
>  	for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
>  		/*skip if port is configured not to use */
> @@ -733,7 +743,7 @@ error1:
>  		miiphy_register(dev->name, smi_reg_read, smi_reg_write);
>  		/* Set phy address of the port */
>  		miiphy_write(dev->name, MV_PHY_ADR_REQUEST,
> -				MV_PHY_ADR_REQUEST, PHY_BASE_ADR + devnum);
> +				MV_PHY_ADR_REQUEST, used_phy_adrs[devnum]);
>  #endif
>  	}
>  	return 0;
> diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h
> index d8a5429..5434839 100644
> --- a/drivers/net/mvgbe.h
> +++ b/drivers/net/mvgbe.h
> @@ -28,13 +28,6 @@
>  #ifndef __MVGBE_H__
>  #define __MVGBE_H__
> 
> -/* PHY_BASE_ADR is board specific and can be configured */
> -#if defined (CONFIG_PHY_BASE_ADR)
> -#define PHY_BASE_ADR		CONFIG_PHY_BASE_ADR
> -#else
> -#define PHY_BASE_ADR		0x08	/* default phy base addr */
> -#endif
> -
>  /* Constants */
>  #define INT_CAUSE_UNMASK_ALL		0x0007ffff
>  #define INT_CAUSE_UNMASK_ALL_EXT	0x0011ffff
> --

Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>

Regards...
Prafulla . . .
Albert ARIBAUD Nov. 26, 2012, 9:27 p.m. UTC | #2
This series adds support to the LaCie Wireless Space,
a Marvell Kirkwood-based product featuring USB, SATA,
Ethernet and an integrated mv88e6161 Ethernet switch.

Note 1: up to v4, this series had changes to mvgbe
for supporting non-sequential PHY addresses on egiga0
and egiga1. This proved unneeded for switch support,
and was dropped in v5.

Note 2: up to v3, this series made the Wireless Space
a variant of the Net Space V2. Starting from v4, the
Wireless Space is not based on Net Space V2 any more
and the changes to Net Space V2 related code have been
dropped.

Changes in v5:
- Fixes to the initialization sequence
- Added a configurable read/write command
- made fan, usb, HDD powered on at boot
- fixed NAND env and Ethernet configs
- general "ws" command with support for buttons
- made netconsole accessible before boot delay

Changes in v4:
- switched from netspace_V2-based to standalone board
- added support for mv88e61xx switch
- corrected some kwbimage.cfg values

Changes in v3:
- fix broken support for NETSPACE_(MINI|LITE)_V2

Changes in v2:
- split the patch in two: mvgbe phy/port changes and WS support.
- removed spurious DEBUG define
- fixed various checkpatch errors/warnings/typos

Albert ARIBAUD (3):
  mv88e61xx: refactor PHY and SWITCH level-code
  kirkwood: make MPP arrays static const
  ARM: lacie_kw: add support for WIRELESS_SPACE

 arch/arm/cpu/arm926ejs/kirkwood/mpp.c           |    2 +-
 arch/arm/include/asm/arch-kirkwood/mpp.h        |    2 +-
 board/LaCie/net2big_v2/net2big_v2.c             |    2 +-
 board/LaCie/netspace_v2/netspace_v2.c           |    2 +-
 board/LaCie/wireless_space/Makefile             |   46 +++
 board/LaCie/wireless_space/kwbimage.cfg         |   82 ++++
 board/LaCie/wireless_space/wireless_space.c     |  176 ++++++++
 board/Marvell/dreamplug/dreamplug.c             |    2 +-
 board/Marvell/guruplug/guruplug.c               |    2 +-
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |    2 +-
 board/Marvell/openrd/openrd.c                   |    2 +-
 board/Marvell/rd6281a/rd6281a.c                 |    2 +-
 board/Marvell/sheevaplug/sheevaplug.c           |    2 +-
 board/Seagate/dockstar/dockstar.c               |    2 +-
 board/buffalo/lsxl/lsxl.c                       |    2 +-
 board/cloudengines/pogo_e02/pogo_e02.c          |    2 +-
 board/d-link/dns325/dns325.c                    |    2 +-
 board/iomega/iconnect/iconnect.c                |    2 +-
 board/karo/tk71/tk71.c                          |    2 +-
 board/keymile/km_arm/km_arm.c                   |    2 +-
 board/raidsonic/ib62x0/ib62x0.c                 |    2 +-
 boards.cfg                                      |    1 +
 drivers/net/phy/mv88e61xx.c                     |  495 ++++++++++++++---------
 drivers/net/phy/mv88e61xx.h                     |   39 +-
 drivers/spi/kirkwood_spi.c                      |   12 +-
 include/configs/wireless_space.h                |  194 +++++++++
 include/netdev.h                                |   21 +-
 27 files changed, 880 insertions(+), 222 deletions(-)
 create mode 100644 board/LaCie/wireless_space/Makefile
 create mode 100644 board/LaCie/wireless_space/kwbimage.cfg
 create mode 100644 board/LaCie/wireless_space/wireless_space.c
 create mode 100644 include/configs/wireless_space.h
Prafulla Wadaskar Dec. 20, 2012, 6:51 a.m. UTC | #3
> -----Original Message-----
> From: Albert ARIBAUD [mailto:albert.u.boot@aribaud.net]
> Sent: 27 November 2012 02:58
> To: U-Boot
> Cc: Prafulla Wadaskar; Simon Guinot; Albert ARIBAUD
> Subject: [PATCH v5 0/3] Add support for the LaCie Wireless Space
> 
> This series adds support to the LaCie Wireless Space,
> a Marvell Kirkwood-based product featuring USB, SATA,
> Ethernet and an integrated mv88e6161 Ethernet switch.
> 
> Note 1: up to v4, this series had changes to mvgbe
> for supporting non-sequential PHY addresses on egiga0
> and egiga1. This proved unneeded for switch support,
> and was dropped in v5.
> 
> Note 2: up to v3, this series made the Wireless Space
> a variant of the Net Space V2. Starting from v4, the
> Wireless Space is not based on Net Space V2 any more
> and the changes to Net Space V2 related code have been
> dropped.
> 
> Changes in v5:
> - Fixes to the initialization sequence
> - Added a configurable read/write command
> - made fan, usb, HDD powered on at boot
> - fixed NAND env and Ethernet configs
> - general "ws" command with support for buttons
> - made netconsole accessible before boot delay
> 
> Changes in v4:
> - switched from netspace_V2-based to standalone board
> - added support for mv88e61xx switch
> - corrected some kwbimage.cfg values
> 
> Changes in v3:
> - fix broken support for NETSPACE_(MINI|LITE)_V2
> 
> Changes in v2:
> - split the patch in two: mvgbe phy/port changes and WS support.
> - removed spurious DEBUG define
> - fixed various checkpatch errors/warnings/typos
> 
> Albert ARIBAUD (3):
>   mv88e61xx: refactor PHY and SWITCH level-code
>   kirkwood: make MPP arrays static const
>   ARM: lacie_kw: add support for WIRELESS_SPACE
> 
>  arch/arm/cpu/arm926ejs/kirkwood/mpp.c           |    2 +-
>  arch/arm/include/asm/arch-kirkwood/mpp.h        |    2 +-
>  board/LaCie/net2big_v2/net2big_v2.c             |    2 +-
>  board/LaCie/netspace_v2/netspace_v2.c           |    2 +-
>  board/LaCie/wireless_space/Makefile             |   46 +++
>  board/LaCie/wireless_space/kwbimage.cfg         |   82 ++++
>  board/LaCie/wireless_space/wireless_space.c     |  176 ++++++++
>  board/Marvell/dreamplug/dreamplug.c             |    2 +-
>  board/Marvell/guruplug/guruplug.c               |    2 +-
>  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |    2 +-
>  board/Marvell/openrd/openrd.c                   |    2 +-
>  board/Marvell/rd6281a/rd6281a.c                 |    2 +-
>  board/Marvell/sheevaplug/sheevaplug.c           |    2 +-
>  board/Seagate/dockstar/dockstar.c               |    2 +-
>  board/buffalo/lsxl/lsxl.c                       |    2 +-
>  board/cloudengines/pogo_e02/pogo_e02.c          |    2 +-
>  board/d-link/dns325/dns325.c                    |    2 +-
>  board/iomega/iconnect/iconnect.c                |    2 +-
>  board/karo/tk71/tk71.c                          |    2 +-
>  board/keymile/km_arm/km_arm.c                   |    2 +-
>  board/raidsonic/ib62x0/ib62x0.c                 |    2 +-
>  boards.cfg                                      |    1 +
>  drivers/net/phy/mv88e61xx.c                     |  495
> ++++++++++++++---------
>  drivers/net/phy/mv88e61xx.h                     |   39 +-
>  drivers/spi/kirkwood_spi.c                      |   12 +-
>  include/configs/wireless_space.h                |  194 +++++++++
>  include/netdev.h                                |   21 +-
>  27 files changed, 880 insertions(+), 222 deletions(-)
>  create mode 100644 board/LaCie/wireless_space/Makefile
>  create mode 100644 board/LaCie/wireless_space/kwbimage.cfg
>  create mode 100644 board/LaCie/wireless_space/wireless_space.c
>  create mode 100644 include/configs/wireless_space.h
> 
> --
> 1.7.10.4

Applied this patch series to u-boot-marvell.git master branch

Regards...
Prafulla . . .
diff mbox

Patch

diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index 47771d5..503fb1e 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -61,7 +61,6 @@ 
 #define KW_SATA_PORT1_OFFSET		0x4000
 
 /* Kirkwood GbE controller has two ports */
-#define MAX_MVGBE_DEVS	2
 #define MVGBE0_BASE	KW_EGIGA0_BASE
 #define MVGBE1_BASE	KW_EGIGA1_BASE
 
diff --git a/arch/arm/include/asm/arch-orion5x/orion5x.h b/arch/arm/include/asm/arch-orion5x/orion5x.h
index b0d3368..b32d1d3 100644
--- a/arch/arm/include/asm/arch-orion5x/orion5x.h
+++ b/arch/arm/include/asm/arch-orion5x/orion5x.h
@@ -55,7 +55,6 @@ 
 #define ORION5X_SATA_PORT1_OFFSET		0x4000
 
 /* Orion5x GbE controller has a single port */
-#define MAX_MVGBE_DEVS	1
 #define MVGBE0_BASE	ORION5X_EGIGA_BASE
 
 /* Orion5x USB Host controller is port 1 */
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 47bf27c..2533614 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -49,6 +49,8 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define MAX_MVGBE_DEVS	2
+
 #define MV_PHY_ADR_REQUEST 0xee
 #define MVGBE_SMI_REG (((struct mvgbe_registers *)MVGBE0_BASE)->smi)
 
@@ -653,6 +655,14 @@  int mvgbe_initialize(bd_t *bis)
 	struct eth_device *dev;
 	int devnum;
 	u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
+#if defined(CONFIG_MVGBE_PHY_ADRS)
+#define MVGBE_PHY_ADRS CONFIG_MVGBE_PHY_ADRS
+#elif defined(CONFIG_PHY_BASE_ADR)
+#define MVGBE_PHY_ADRS {CONFIG_PHY_BASE_ADR, CONFIG_PHY_BASE_ADR+1}
+#else
+#define MVGBE_PHY_ADRS {8, 9}
+#endif
+	u8 used_phy_adrs[MAX_MVGBE_DEVS] = MVGBE_PHY_ADRS;
 
 	for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
 		/*skip if port is configured not to use */
@@ -733,7 +743,7 @@  error1:
 		miiphy_register(dev->name, smi_reg_read, smi_reg_write);
 		/* Set phy address of the port */
 		miiphy_write(dev->name, MV_PHY_ADR_REQUEST,
-				MV_PHY_ADR_REQUEST, PHY_BASE_ADR + devnum);
+				MV_PHY_ADR_REQUEST, used_phy_adrs[devnum]);
 #endif
 	}
 	return 0;
diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h
index d8a5429..5434839 100644
--- a/drivers/net/mvgbe.h
+++ b/drivers/net/mvgbe.h
@@ -28,13 +28,6 @@ 
 #ifndef __MVGBE_H__
 #define __MVGBE_H__
 
-/* PHY_BASE_ADR is board specific and can be configured */
-#if defined (CONFIG_PHY_BASE_ADR)
-#define PHY_BASE_ADR		CONFIG_PHY_BASE_ADR
-#else
-#define PHY_BASE_ADR		0x08	/* default phy base addr */
-#endif
-
 /* Constants */
 #define INT_CAUSE_UNMASK_ALL		0x0007ffff
 #define INT_CAUSE_UNMASK_ALL_EXT	0x0011ffff