Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 1/6] powerpc/85xx: add support for FM2 DTSEC5

Unlike previous SOCs, the Freescale P5040 has a fifth DTSEC on the second
Fman, so add the Fman and SerDes macros for that DTSEC.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |    6 ++++++
 arch/powerpc/include/asm/fsl_serdes.h         |    1 +
 arch/powerpc/include/asm/immap_85xx.h         |    1 +
 drivers/net/fm/init.c                         |    3 +++
 include/fm_eth.h                              |    1 +
 5 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 4b52dad..8aac1de 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
 <at>  <at>  -68,6 +68,7  <at>  <at>  static const char *serdes_prtcl_str[] = {
 	[SGMII_FM2_DTSEC2] = "SGMII_FM2_DTSEC2",
 	[SGMII_FM2_DTSEC3] = "SGMII_FM2_DTSEC3",
 	[SGMII_FM2_DTSEC4] = "SGMII_FM2_DTSEC4",
+	[SGMII_FM2_DTSEC5] = "SGMII_FM2_DTSEC5",
 	[XAUI_FM1] = "XAUI_FM1",
 	[XAUI_FM2] = "XAUI_FM2",
 	[AURORA] = "DEBUG",
 <at>  <at>  -658,6 +659,7  <at>  <at>  void fsl_serdes_init(void)
 		case SGMII_FM2_DTSEC2:
 		case SGMII_FM2_DTSEC3:
 		case SGMII_FM2_DTSEC4:
+		case SGMII_FM2_DTSEC5:
 		case XAUI_FM1:
(Continue reading)

Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 4/6] fm-eth: use fdt_status_disabled() function in ft_fixup_port()

We have a dedicated function for setting the node status now, so use it.
Also improve a comment and fix the type of the phandle variable.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 drivers/net/fm/init.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 8a5311c..736b8b9 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
 <at>  <at>  -200,7 +200,8  <at>  <at>  void board_ft_fman_fixup_port(void *blob, char * prop, phys_addr_t pa,

 static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
 {
-	int off, ph;
+	int off;
+	uint32_t ph;
 	phys_addr_t paddr = CONFIG_SYS_CCSRBAR_PHYS + info->compat_offset;
 	u64 dtsec1_addr = (u64)CONFIG_SYS_CCSRBAR_PHYS +
 				CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET;
 <at>  <at>  -217,12 +218,10  <at>  <at>  static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
 	off = fdt_node_offset_by_compat_reg(blob, prop, paddr);

 	/* Don't disable FM1-DTSEC1 MAC as its used for MDIO */
-	if (paddr != dtsec1_addr) {
-		/* disable the mac node */
-		fdt_setprop_string(blob, off, "status", "disabled");
-	}
(Continue reading)

Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 2/6] fm-eth: add function fm_info_get_phy_address()

Function fm_info_get_phy_address() returns the PHY address for a given
Fman port.  This is handy when the MDIO code needs to fixup the Ethernet
nodes in the device tree to point to PHY nodes for a specific PHY address.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 drivers/net/fm/init.c |   16 ++++++++++++++++
 include/fm_eth.h      |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 9834cd9..8a5311c 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
 <at>  <at>  -155,6 +155,22  <at>  <at>  void fm_info_set_phy_address(enum fm_port port, int address)
 }

 /*
+ * Returns the PHY address for a given Fman port
+ *
+ * The port must be set via a prior call to fm_info_set_phy_address().
+ * A negative error code is returned if the port is invalid.
+ */
+int fm_info_get_phy_address(enum fm_port port)
+{
+	int i = fm_port_to_index(port);
+
+	if (i == -1)
+		return -1;
+
(Continue reading)

Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 6/6] powerpc/85xx: update P4080DS MDIO bus multiplexer support

The Freescale P4080DS has a complex multiplexed MDIO bus, where the
muxing varies per SerDes protocol.  This is because the protocol
determines in which PCI slot the various SGMII and XGMII interface
cards belong, as well as whether the RGMII ports are enabled.

The Freescale SDK includes support for MDIO bus multiplexing, but the
upstream Linux kernel uses David Daney's (Cavium) method instead.
Therefore, the P4080 code needs to be migrated to the new method.

The device tree contains two top-level mdio-mux nodes, one for EMI1
(RGMII and SGMII) and the other for EMI2 (XGMII).  The U-boot code
depends on several device tree aliases to help it find the nodes that
need to be updated.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 board/freescale/corenet_ds/eth_p4080.c |  172 ++++++++++++++++++++++++--------
 1 files changed, 129 insertions(+), 43 deletions(-)

diff --git a/board/freescale/corenet_ds/eth_p4080.c b/board/freescale/corenet_ds/eth_p4080.c
index 2c69c51..3c1c3a1 100644
--- a/board/freescale/corenet_ds/eth_p4080.c
+++ b/board/freescale/corenet_ds/eth_p4080.c
 <at>  <at>  -53,7 +53,7  <at>  <at> 
 #define EMI1_MASK	0xc0000000
 #define EMI2_MASK	0x30000000

-static int mdio_mux[NUM_FM_PORTS];
+static u32 mdio_mux[NUM_FM_PORTS];

(Continue reading)

Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 5/6] powerpc/85xx: get rid of enum board_slots in P4080 MDIO driver

enum board_slots contained six values, where SLOT1 == 1, SLOT2 == 2, and
so on.  This is pointless, so remove it.  Also move the lane_to_slot[]
array to the top of the file so that it can be used by other functions.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 board/freescale/corenet_ds/eth_p4080.c |   59 ++++++++++---------------------
 1 files changed, 19 insertions(+), 40 deletions(-)

diff --git a/board/freescale/corenet_ds/eth_p4080.c b/board/freescale/corenet_ds/eth_p4080.c
index b87b092..2c69c51 100644
--- a/board/freescale/corenet_ds/eth_p4080.c
+++ b/board/freescale/corenet_ds/eth_p4080.c
 <at>  <at>  -68,6 +68,15  <at>  <at>  static char *mdio_names[16] = {
 	NULL, NULL, NULL,
 };

+/*
+ * Mapping of all 18 SERDES lanes to board slots. A value of '0' here means
+ * that the mapping must be determined dynamically, or that the lane maps to
+ * something other than a board slot.
+ */
+static u8 lane_to_slot[] = {
+	1, 1, 2, 2, 3, 3, 3, 3, 6, 6, 4, 4, 4, 4, 5, 5, 5, 5
+};
+
 static char *p4080ds_mdio_name_for_muxval(u32 muxval)
 {
 	return mdio_names[(muxval & EMI_MASK) >> 28];
 <at>  <at>  -290,15 +299,6  <at>  <at>  void fdt_fixup_board_enet(void *fdt)
(Continue reading)

Timur Tabi | 11 Aug 2012 00:01
Favicon

[PATCH 3/6] powerpc/85xx: introduce function serdes_device_from_fm_port()

In order to figure out which SerDes lane a given Fman port is connected
to, we need a function that maps the fm_port namespace to the srds_prtcl
namespace.

Signed-off-by: Timur Tabi <timur <at> freescale.com>
---
 board/freescale/common/fman.c |   40 ++++++++++++++++++++++++++++++++++++++++
 board/freescale/common/fman.h |    2 ++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/board/freescale/common/fman.c b/board/freescale/common/fman.c
index 6ddf816..58b7c44 100644
--- a/board/freescale/common/fman.c
+++ b/board/freescale/common/fman.c
 <at>  <at>  -25,6 +25,9  <at>  <at> 
 #include <libfdt_env.h>
 #include <fdt_support.h>

+#include <fm_eth.h>
+#include <asm/fsl_serdes.h>
+
 /*
  * Given the following ...
  *
 <at>  <at>  -67,3 +70,40  <at>  <at>  int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr,

 	return fdt_setprop(fdt, offset, "phy-handle", &ph, sizeof(ph));
 }
+
+/*
(Continue reading)

Kim Phillips | 13 Aug 2012 23:10
Favicon

Re: [u-boot-release] [PATCH 3/6] powerpc/85xx: introduce function serdes_device_from_fm_port()

please don't post patches upstream with '[u-boot-release]' in the
subject.

On Fri, 10 Aug 2012 17:01:33 -0500
Timur Tabi <timur <at> freescale.com> wrote:

> +enum srds_prtcl serdes_device_from_fm_port(enum fm_port port)
> +{
> +	switch (port) {
> +	case FM1_DTSEC1:
> +		return SGMII_FM1_DTSEC1;
> +	case FM1_DTSEC2:
> +		return SGMII_FM1_DTSEC2;
> +	case FM1_DTSEC3:
> +		return SGMII_FM1_DTSEC3;
> +	case FM1_DTSEC4:
> +		return SGMII_FM1_DTSEC4;
> +	case FM1_DTSEC5:
> +		return SGMII_FM1_DTSEC5;
> +	case FM1_10GEC1:
> +		return XAUI_FM1;
> +	case FM2_DTSEC1:
> +		return SGMII_FM2_DTSEC1;
> +	case FM2_DTSEC2:
> +		return SGMII_FM2_DTSEC2;
> +	case FM2_DTSEC3:
> +		return SGMII_FM2_DTSEC3;
> +	case FM2_DTSEC4:
> +		return SGMII_FM2_DTSEC4;
> +	case FM2_DTSEC5:
(Continue reading)

Timur Tabi | 13 Aug 2012 23:22
Favicon

Re: [u-boot-release] [PATCH 3/6] powerpc/85xx: introduce function serdes_device_from_fm_port()

Kim Phillips wrote:
> please don't post patches upstream with '[u-boot-release]' in the
> subject.

I didn't.

http://lists.denx.de/pipermail/u-boot/2012-August/130618.html

Your mailer is confused.  I bcc the u-boot-release mailing list, and I
presume your mailer (or our mail server) sent you that copy of the mail
instead of the "real" one.

> shouldn't this be a static const array lookup?

The compiler should convert it into an array lookup automatically, but I
can change it if you insist.  Since I don't like writing code that depends
on the values of an enum, the array will look like this:

	static const enum srds_prtcl srds_table[] = {
		[FM1_DTSEC1] = SGMII_FM1_DTSEC1,
		[FM1_DTSEC2] = SGMII_FM1_DTSEC2,
		[FM1_DTSEC3] = SGMII_FM1_DTSEC3,
		[FM1_DTSEC4] = SGMII_FM1_DTSEC4,
		[FM1_DTSEC5] = SGMII_FM1_DTSEC5,
		[FM1_10GEC1] = XAUI_FM1,
		[FM2_DTSEC1] = SGMII_FM2_DTSEC1,
		[FM2_DTSEC2] = SGMII_FM2_DTSEC2,
		[FM2_DTSEC3] = SGMII_FM2_DTSEC3,
		[FM2_DTSEC4] = SGMII_FM2_DTSEC4,
		[FM2_DTSEC5] = SGMII_FM2_DTSEC5,
(Continue reading)

Kim Phillips | 13 Aug 2012 23:34
Favicon

Re: [u-boot-release] [PATCH 3/6] powerpc/85xx: introduce function serdes_device_from_fm_port()

On Mon, 13 Aug 2012 16:22:01 -0500
Timur Tabi <timur <at> freescale.com> wrote:

> Kim Phillips wrote:
> > shouldn't this be a static const array lookup?
> 
> The compiler should convert it into an array lookup automatically, but I
> can change it if you insist.  Since I don't like writing code that depends
> on the values of an enum, the array will look like this:
> 
> 	static const enum srds_prtcl srds_table[] = {
> 		[FM1_DTSEC1] = SGMII_FM1_DTSEC1,
> 		[FM1_DTSEC2] = SGMII_FM1_DTSEC2,
> 		[FM1_DTSEC3] = SGMII_FM1_DTSEC3,
> 		[FM1_DTSEC4] = SGMII_FM1_DTSEC4,
> 		[FM1_DTSEC5] = SGMII_FM1_DTSEC5,
> 		[FM1_10GEC1] = XAUI_FM1,
> 		[FM2_DTSEC1] = SGMII_FM2_DTSEC1,
> 		[FM2_DTSEC2] = SGMII_FM2_DTSEC2,
> 		[FM2_DTSEC3] = SGMII_FM2_DTSEC3,
> 		[FM2_DTSEC4] = SGMII_FM2_DTSEC4,
> 		[FM2_DTSEC5] = SGMII_FM2_DTSEC5,
> 		[FM2_10GEC1] = XAUI_FM2,
> 	};
> 
> 	if ((port < FM1_DTSEC1) || (port > FM2_10GEC1))
> 		return NONE;
> 	else
> 		return srds_table[port];
> 
(Continue reading)

Timur Tabi | 13 Aug 2012 23:41
Favicon

Re: [u-boot-release] [PATCH 3/6] powerpc/85xx: introduce function serdes_device_from_fm_port()

Kim Phillips wrote:
> it's ~30% less lines of code, and the maps lie on the same line,
> which helps when grepping.

OK.

--

-- 
Timur Tabi
Linux kernel developer at Freescale

Gmane