All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH u-boot-marvell v3 02/10] board: turris_mox: Change SERDES map depending on module topology
Date: Thu, 29 Nov 2018 13:56:41 +0100	[thread overview]
Message-ID: <9a7057ed-34a2-e67c-462a-6c00f75ec378@denx.de> (raw)
In-Reply-To: <20181120120409.12822-2-marek.behun@nic.cz>

On 20.11.18 13:04, Marek Behún wrote:
> When SFP module is connected directly to CPU module we want the SGMII
> lane speed at 1.25 Gbps.
> 
> This is a temporary solution till there is a comphy driver in the kernel
> capable of changing SGMII speed at runtime.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/CZ.NIC/turris_mox/turris_mox.c | 33 ++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)
> 
> diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
> index 415c462493..3c0ab58756 100644
> --- a/board/CZ.NIC/turris_mox/turris_mox.c
> +++ b/board/CZ.NIC/turris_mox/turris_mox.c
> @@ -8,6 +8,7 @@
>   #include <dm.h>
>   #include <clk.h>
>   #include <spi.h>
> +#include <mvebu/comphy.h>
>   #include <linux/string.h>
>   #include <linux/libfdt.h>
>   #include <fdt_support.h>
> @@ -206,6 +207,38 @@ static int mox_get_topology(const u8 **ptopology, int *psize, int *pis_sd)
>   	return 0;
>   }
>   
> +int comphy_update_map(struct comphy_map *serdes_map, int count)
> +{
> +	int ret, i, size, sfpindex = -1, swindex = -1;
> +	const u8 *topology;
> +
> +	ret = mox_get_topology(&topology, &size, NULL);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0; i < size; ++i) {
> +		if (topology[i] == MOX_MODULE_SFP && sfpindex == -1)
> +			sfpindex = i;
> +		else if ((topology[i] == MOX_MODULE_TOPAZ ||
> +			  topology[i] == MOX_MODULE_PERIDOT) &&
> +			 swindex == -1)
> +			swindex = i;
> +	}
> +
> +	if (sfpindex >= 0 && swindex >= 0) {
> +		if (sfpindex < swindex)
> +			serdes_map[0].speed = PHY_SPEED_1_25G;
> +		else
> +			serdes_map[0].speed = PHY_SPEED_3_125G;
> +	} else if (sfpindex >= 0) {
> +		serdes_map[0].speed = PHY_SPEED_1_25G;
> +	} else if (swindex >= 0) {
> +		serdes_map[0].speed = PHY_SPEED_3_125G;
> +	}
> +
> +	return 0;
> +}
> +
>   int last_stage_init(void)
>   {
>   	int ret, i;
> 

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

  reply	other threads:[~2018-11-29 12:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 12:04 [U-Boot] [PATCH u-boot-marvell v3 01/10] board: turris_mox: Cosmetic restructurization Marek Behún
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 02/10] board: turris_mox: Change SERDES map depending on module topology Marek Behún
2018-11-29 12:56   ` Stefan Roese [this message]
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 03/10] board: turris_mox: Check and configure modules Marek Behún
2018-11-29 13:00   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 04/10] arch/arm/dts: Fix Turris Mox device tree Marek Behún
2018-11-29 13:01   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 05/10] board: turris_mox: Update defconfig Marek Behún
2018-11-29 13:01   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 06/10] watchdog: armada_37xx: Fix compliance with kernel's driver Marek Behún
2018-11-29 13:03   ` Stefan Roese
2018-12-11 12:15     ` Marek Behún
2018-12-11 14:31       ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 07/10] MAINTAINERS: Add entry for CZ.NIC's Turris project Marek Behún
2018-11-29 13:03   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 08/10] board: turris_mox: Read info (and ethaddrs) from OTP Marek Behún
2018-11-29 13:04   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 09/10] board: turris_mox: Support 1 GB version of Turris Mox Marek Behún
2018-11-29 13:07   ` Stefan Roese
2018-12-11 13:59     ` Marek Behún
2018-12-11 14:28       ` Stefan Roese
     [not found]         ` <20181211155338.044d02bf@dellmb.labs.office.nic.cz>
     [not found]           ` <5790e39e-07e9-94d9-829d-bc0b42aa2e03@denx.de>
2018-12-12  2:23             ` Marek Behun
2018-12-12  9:44               ` Stefan Roese
2018-12-13  3:53                 ` Marek Behun
2018-12-13  6:23                   ` Stefan Roese
2018-11-20 12:04 ` [U-Boot] [PATCH u-boot-marvell v3 10/10] configs: turris_mox: Add 64 MiB of boot memory Marek Behún
2018-11-29 13:08   ` Stefan Roese
2018-11-29 12:56 ` [U-Boot] [PATCH u-boot-marvell v3 01/10] board: turris_mox: Cosmetic restructurization Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a7057ed-34a2-e67c-462a-6c00f75ec378@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.