public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: u-boot@lists.denx.de
Subject: [PATCH 1/3] phy: marvell: cp110: let the firmware configure the comphy
Date: Sun, 18 Oct 2020 21:43:51 +0200	[thread overview]
Message-ID: <20201018214351.0551fe08@nic.cz> (raw)
In-Reply-To: <8b5722f0428d958a777d4f49a98de6d527b4ff22.1603027887.git.baruch@tkos.co.il>

On Sun, 18 Oct 2020 17:11:11 +0300
Baruch Siach <baruch@tkos.co.il> wrote:

> From: Grzegorz Jaszczyk <jaz@semihalf.com>
> 
> Replace all comphy initialization with appropriate smc calls. It will
> result with triggering synchronous exception that is handled by Secure
> Monitor code in EL3. Then the Secure Monitor code will dispatch each smc
> call (by parsing the smc function identifier) and triggers appropriate
> comphy initialization.
> 
> This patch reworks serdes handling for: SATA, SGMII, HS-SGMII and SFI
> interfaces.
> 
> Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
> Reviewed-by: Igal Liberman <igall@marvell.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  drivers/phy/marvell/comphy_cp110.c | 816 ++++-------------------------
>  1 file changed, 89 insertions(+), 727 deletions(-)
> 
> diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c
> index 15e80049def6..31baa0bb3700 100644
> --- a/drivers/phy/marvell/comphy_cp110.c
> +++ b/drivers/phy/marvell/comphy_cp110.c
> @@ -7,6 +7,7 @@
>  #include <fdtdec.h>
>  #include <log.h>
>  #include <asm/io.h>
> +#include <asm/ptrace.h>
>  #include <asm/arch/cpu.h>
>  #include <asm/arch/soc.h>
>  #include <linux/delay.h>
> @@ -22,6 +23,32 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define HPIPE_ADDR(base, lane)			(SD_ADDR(base, lane) + 0x800)
>  #define COMPHY_ADDR(base, lane)			(base + 0x28 * lane)
>  
> +/* Firmware related definitions used for SMC calls */
> +#define MV_SIP_COMPHY_POWER_ON	0x82000001
> +#define MV_SIP_COMPHY_POWER_OFF	0x82000002
> +#define MV_SIP_COMPHY_PLL_LOCK	0x82000003
> +
> +#define COMPHY_FW_MODE_FORMAT(mode)		((mode) << 12)
> +#define COMPHY_FW_FORMAT(mode, idx, speeds)	\
> +			(((mode) << 12) | ((idx) << 8) | ((speeds) << 2))
> +#define COMPHY_SATA_MODE	0x1
> +#define COMPHY_SGMII_MODE	0x2	/* SGMII 1G */
> +#define COMPHY_HS_SGMII_MODE	0x3	/* SGMII 2.5G */
> +#define COMPHY_USB3H_MODE	0x4
> +#define COMPHY_USB3D_MODE	0x5
> +#define COMPHY_PCIE_MODE	0x6
> +#define COMPHY_RXAUI_MODE	0x7
> +#define COMPHY_XFI_MODE		0x8
> +#define COMPHY_SFI_MODE		0x9
> +#define COMPHY_USB3_MODE	0xa
> +#define COMPHY_AP_MODE		0xb

These same constants can be used for Armada 3720, btw... And maybe even
the code itself. So if this works, after it is applied I will try to
make this driver support Armada 3720 as well.

BTW, my opinion on using firmware calls in kernel for this changed
recently, when encountering problems on EspressoBIN which were result
of many people simply not upgrading the firmware... I now think kernel
should not depend on the firmware for this and implement this on its
own... But I think U-Boot is ok.

Marek

  reply	other threads:[~2020-10-18 19:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 14:11 [PATCH 0/3] phy: marvell: cp110: fix Armada 8k rev B0 boot hang Baruch Siach
2020-10-18 14:11 ` [PATCH 1/3] phy: marvell: cp110: let the firmware configure the comphy Baruch Siach
2020-10-18 19:43   ` Marek Behun [this message]
2020-10-20  7:20     ` Stefan Roese
2020-10-18 14:11 ` [PATCH 2/3] phy: marvell: cp110: let the firmware configure comphy for PCIe Baruch Siach
2020-10-18 14:11 ` [PATCH 3/3] phy: marvell: cp110: update mode parameter for pcie power on calls Baruch Siach
2020-10-20  7:38 ` [PATCH 0/3] phy: marvell: cp110: fix Armada 8k rev B0 boot hang Stefan Roese
2020-10-20  9:12   ` Baruch Siach
2020-10-29 14:29 ` 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=20201018214351.0551fe08@nic.cz \
    --to=marek.behun@nic.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox