All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Steen Hegelund <steen.hegelund@microchip.com>
Cc: Bjarni Jonasson <bjarni.jonasson@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Microchip UNG Driver List <UNGLinuxDriver@microchip.com>,
	Lars Povlsen <lars.povlsen@microchip.com>
Subject: Re: [PATCH v11 3/4] phy: Add Sparx5 ethernet serdes PHY driver
Date: Mon, 4 Jan 2021 14:15:02 +0200	[thread overview]
Message-ID: <20210104121502.GK31158@unreal> (raw)
In-Reply-To: <20210104082218.1389450-4-steen.hegelund@microchip.com>

On Mon, Jan 04, 2021 at 09:22:17AM +0100, Steen Hegelund wrote:
> Add the Microchip Sparx5 ethernet serdes PHY driver for the 6G, 10G and 25G
> interfaces available in the Sparx5 SoC.
>
> Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
> Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/phy/Kconfig                        |    1 +
>  drivers/phy/Makefile                       |    1 +
>  drivers/phy/microchip/Kconfig              |   12 +
>  drivers/phy/microchip/Makefile             |    6 +
>  drivers/phy/microchip/sparx5_serdes.c      | 2443 ++++++++++++++++++
>  drivers/phy/microchip/sparx5_serdes.h      |  129 +
>  drivers/phy/microchip/sparx5_serdes_regs.h | 2695 ++++++++++++++++++++
>  7 files changed, 5287 insertions(+)
>  create mode 100644 drivers/phy/microchip/Kconfig
>  create mode 100644 drivers/phy/microchip/Makefile
>  create mode 100644 drivers/phy/microchip/sparx5_serdes.c
>  create mode 100644 drivers/phy/microchip/sparx5_serdes.h
>  create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h
>
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 00dabe5fab8a..df35c752f3aa 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -70,6 +70,7 @@ source "drivers/phy/ingenic/Kconfig"
>  source "drivers/phy/lantiq/Kconfig"
>  source "drivers/phy/marvell/Kconfig"
>  source "drivers/phy/mediatek/Kconfig"
> +source "drivers/phy/microchip/Kconfig"
>  source "drivers/phy/motorola/Kconfig"
>  source "drivers/phy/mscc/Kconfig"
>  source "drivers/phy/qualcomm/Kconfig"
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 32261e164abd..adac1b1a39d1 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -20,6 +20,7 @@ obj-y					+= allwinner/	\
>  					   lantiq/	\
>  					   marvell/	\
>  					   mediatek/	\
> +					   microchip/	\
>  					   motorola/	\
>  					   mscc/	\
>  					   qualcomm/	\
> diff --git a/drivers/phy/microchip/Kconfig b/drivers/phy/microchip/Kconfig
> new file mode 100644
> index 000000000000..0b1a818e01b8

<...>

> +struct sparx5_sd10g28_args {
> +	bool                 skip_cmu_cfg; /* Enable/disable CMU cfg */
> +	bool                 no_pwrcycle;  /* Omit initial power-cycle */
> +	bool                 txinvert;     /* Enable inversion of output data */
> +	bool                 rxinvert;     /* Enable inversion of input data */
> +	bool                 txmargin;     /* Set output level to  half/full */
> +	u16                  txswing;      /* Set output level */
> +	bool                 mute;         /* Mute Output Buffer */
> +	bool                 is_6g;
> +	bool                 reg_rst;
> +};

All those bools in structs can be squeezed into one u8, just use
bitfields, e.g. "u8 a:1;".

Also I strongly advise do not do vertical alignment, it will cause to
too many churn later when this code will be updated.

> +

<...>

> +static inline void __iomem *sdx5_addr(void __iomem *base[],
> +				      int id, int tinst, int tcnt,
> +				      int gbase, int ginst,
> +				      int gcnt, int gwidth,
> +				      int raddr, int rinst,
> +				      int rcnt, int rwidth)
> +{
> +#if defined(CONFIG_DEBUG_KERNEL)
> +	WARN_ON((tinst) >= tcnt);
> +	WARN_ON((ginst) >= gcnt);
> +	WARN_ON((rinst) >= rcnt);
> +#endif

Please don't put "#if defined(CONFIG_DEBUG_KERNEL)", print WARN_ON().

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org>
To: Steen Hegelund <steen.hegelund@microchip.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Lars Povlsen <lars.povlsen@microchip.com>,
	Bjarni Jonasson <bjarni.jonasson@microchip.com>,
	Microchip UNG Driver List <UNGLinuxDriver@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v11 3/4] phy: Add Sparx5 ethernet serdes PHY driver
Date: Mon, 4 Jan 2021 14:15:02 +0200	[thread overview]
Message-ID: <20210104121502.GK31158@unreal> (raw)
In-Reply-To: <20210104082218.1389450-4-steen.hegelund@microchip.com>

On Mon, Jan 04, 2021 at 09:22:17AM +0100, Steen Hegelund wrote:
> Add the Microchip Sparx5 ethernet serdes PHY driver for the 6G, 10G and 25G
> interfaces available in the Sparx5 SoC.
>
> Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
> Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/phy/Kconfig                        |    1 +
>  drivers/phy/Makefile                       |    1 +
>  drivers/phy/microchip/Kconfig              |   12 +
>  drivers/phy/microchip/Makefile             |    6 +
>  drivers/phy/microchip/sparx5_serdes.c      | 2443 ++++++++++++++++++
>  drivers/phy/microchip/sparx5_serdes.h      |  129 +
>  drivers/phy/microchip/sparx5_serdes_regs.h | 2695 ++++++++++++++++++++
>  7 files changed, 5287 insertions(+)
>  create mode 100644 drivers/phy/microchip/Kconfig
>  create mode 100644 drivers/phy/microchip/Makefile
>  create mode 100644 drivers/phy/microchip/sparx5_serdes.c
>  create mode 100644 drivers/phy/microchip/sparx5_serdes.h
>  create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h
>
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 00dabe5fab8a..df35c752f3aa 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -70,6 +70,7 @@ source "drivers/phy/ingenic/Kconfig"
>  source "drivers/phy/lantiq/Kconfig"
>  source "drivers/phy/marvell/Kconfig"
>  source "drivers/phy/mediatek/Kconfig"
> +source "drivers/phy/microchip/Kconfig"
>  source "drivers/phy/motorola/Kconfig"
>  source "drivers/phy/mscc/Kconfig"
>  source "drivers/phy/qualcomm/Kconfig"
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 32261e164abd..adac1b1a39d1 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -20,6 +20,7 @@ obj-y					+= allwinner/	\
>  					   lantiq/	\
>  					   marvell/	\
>  					   mediatek/	\
> +					   microchip/	\
>  					   motorola/	\
>  					   mscc/	\
>  					   qualcomm/	\
> diff --git a/drivers/phy/microchip/Kconfig b/drivers/phy/microchip/Kconfig
> new file mode 100644
> index 000000000000..0b1a818e01b8

<...>

> +struct sparx5_sd10g28_args {
> +	bool                 skip_cmu_cfg; /* Enable/disable CMU cfg */
> +	bool                 no_pwrcycle;  /* Omit initial power-cycle */
> +	bool                 txinvert;     /* Enable inversion of output data */
> +	bool                 rxinvert;     /* Enable inversion of input data */
> +	bool                 txmargin;     /* Set output level to  half/full */
> +	u16                  txswing;      /* Set output level */
> +	bool                 mute;         /* Mute Output Buffer */
> +	bool                 is_6g;
> +	bool                 reg_rst;
> +};

All those bools in structs can be squeezed into one u8, just use
bitfields, e.g. "u8 a:1;".

Also I strongly advise do not do vertical alignment, it will cause to
too many churn later when this code will be updated.

> +

<...>

> +static inline void __iomem *sdx5_addr(void __iomem *base[],
> +				      int id, int tinst, int tcnt,
> +				      int gbase, int ginst,
> +				      int gcnt, int gwidth,
> +				      int raddr, int rinst,
> +				      int rcnt, int rwidth)
> +{
> +#if defined(CONFIG_DEBUG_KERNEL)
> +	WARN_ON((tinst) >= tcnt);
> +	WARN_ON((ginst) >= gcnt);
> +	WARN_ON((rinst) >= rcnt);
> +#endif

Please don't put "#if defined(CONFIG_DEBUG_KERNEL)", print WARN_ON().

Thanks

  reply	other threads:[~2021-01-04 12:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  8:22 [PATCH v11 0/4] Adding the Sparx5 Serdes driver Steen Hegelund
2021-01-04  8:22 ` [PATCH v11 1/4] dt-bindings: phy: Add sparx5-serdes bindings Steen Hegelund
2021-01-04  8:22 ` [PATCH v11 2/4] phy: Add ethernet serdes configuration option Steen Hegelund
2021-01-04  8:22 ` [PATCH v11 3/4] phy: Add Sparx5 ethernet serdes PHY driver Steen Hegelund
2021-01-04 12:15   ` Leon Romanovsky [this message]
2021-01-04 12:15     ` Leon Romanovsky
2021-01-04 13:16     ` Steen Hegelund
2021-01-04 13:16       ` Steen Hegelund
2021-01-04 14:20       ` Leon Romanovsky
2021-01-04 14:20         ` Leon Romanovsky
2021-01-04  8:22 ` [PATCH v11 4/4] arm64: dts: sparx5: Add Sparx5 serdes driver node Steen Hegelund

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=20210104121502.GK31158@unreal \
    --to=leon@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=bjarni.jonasson@microchip.com \
    --cc=kishon@ti.com \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steen.hegelund@microchip.com \
    --cc=vkoul@kernel.org \
    /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.