From: Vladimir Oltean <olteanv@gmail.com>
To: Ante Knezic <ante.knezic@helmholz.de>
Cc: netdev@vger.kernel.org, woojung.huh@microchip.com,
andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, marex@denx.de, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/2] net:dsa:microchip: add property to select internal RMII reference clock
Date: Mon, 16 Oct 2023 13:37:08 +0300 [thread overview]
Message-ID: <20231016103708.6ka5vxfkdatrjvdk@skbuf> (raw)
In-Reply-To: <c8bb7002e6d81a661c853dd21e0fe18e95887609.1697107915.git.ante.knezic@helmholz.de> <c8bb7002e6d81a661c853dd21e0fe18e95887609.1697107915.git.ante.knezic@helmholz.de>
Commit message: "net: dsa: microchip: ".
On Thu, Oct 12, 2023 at 12:55:55PM +0200, Ante Knezic wrote:
> Microchip KSZ8863/KSZ8873 have the ability to select between internal
> and external RMII reference clock. By default, reference clock
> needs to be provided via REFCLKI_3 pin. If required, device can be
> setup to provide RMII clock internally so that REFCLKI_3 pin can be
> left unconnected.
> Add a new "microchip,rmii-clk-internal" property which will set
> RMII clock reference to internal. If property is not set, reference
> clock needs to be provided externally.
>
> Signed-off-by: Ante Knezic <ante.knezic@helmholz.de>
> ---
> drivers/net/dsa/microchip/ksz8795.c | 5 +++++
> drivers/net/dsa/microchip/ksz8795_reg.h | 3 +++
> drivers/net/dsa/microchip/ksz_common.c | 3 +++
> drivers/net/dsa/microchip/ksz_common.h | 1 +
> 4 files changed, 12 insertions(+)
>
> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 91aba470fb2f..78f3a668aa99 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -1434,6 +1434,11 @@ int ksz8_setup(struct dsa_switch *ds)
> for (i = 0; i < (dev->info->num_vlans / 4); i++)
> ksz8_r_vlan_entries(dev, i);
>
> + if (ksz_is_ksz88x3(dev))
> + ksz_cfg(dev, KSZ88X3_REG_FVID_AND_HOST_MODE,
> + KSZ88X3_PORT3_RMII_CLK_INTERNAL,
> + dev->rmii_clk_internal);
> +
Can this be done in dev->dev_ops->phylink_mac_config() (which so far has no implementation)
for port 3 of ksz88x3?
> return ksz8_handle_global_errata(ds);
> }
>
> diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
> index 3c9dae53e4d8..beca974e0171 100644
> --- a/drivers/net/dsa/microchip/ksz8795_reg.h
> +++ b/drivers/net/dsa/microchip/ksz8795_reg.h
> @@ -22,6 +22,9 @@
> #define KSZ8863_GLOBAL_SOFTWARE_RESET BIT(4)
> #define KSZ8863_PCS_RESET BIT(0)
>
> +#define KSZ88X3_REG_FVID_AND_HOST_MODE 0xC6
> +#define KSZ88X3_PORT3_RMII_CLK_INTERNAL BIT(3)
> +
> #define REG_SW_CTRL_0 0x02
>
> #define SW_NEW_BACKOFF BIT(7)
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index b800ace40ce1..0a0a53ce5b1b 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -4160,6 +4160,9 @@ int ksz_switch_register(struct ksz_device *dev)
> }
> }
>
> + dev->rmii_clk_internal = of_property_read_bool(dev->dev->of_node,
> + "microchip,rmii-clk-internal");
Port property.
> +
> ret = dsa_register_switch(dev->ds);
> if (ret) {
> dev->dev_ops->exit(dev);
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index 8842efca0871..e5b0445fe2ca 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -163,6 +163,7 @@ struct ksz_device {
> phy_interface_t compat_interface;
> bool synclko_125;
> bool synclko_disable;
> + bool rmii_clk_internal;
>
> struct vlan_table *vlan_cache;
>
> --
> 2.11.0
next prev parent reply other threads:[~2023-10-16 10:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 10:55 [PATCH net-next v2 0/2] net: dsa: microchip: enable setting rmii Ante Knezic
2023-10-12 10:55 ` [PATCH net-next v2 1/2] net:dsa:microchip: add property to select internal RMII reference clock Ante Knezic
2023-10-16 10:37 ` Vladimir Oltean [this message]
2023-10-17 7:27 ` Ante Knezic
2023-10-17 7:35 ` [PATCH net-next v2 2/2] dt-bindings: net: microchip,ksz: document microchip,rmii-clk-internal Ante Knezic
2023-10-17 7:48 ` Conor Dooley
2023-10-17 9:31 ` Vladimir Oltean
2023-10-12 10:55 ` Ante Knezic
2023-10-12 15:18 ` Conor Dooley
2023-10-16 7:53 ` [PATCH net-next " Ante Knezic
2023-10-17 8:00 ` Conor Dooley
2023-10-17 9:04 ` [PATCH net-next v2 " Ante Knezic
2023-10-17 12:59 ` [PATCH net-next " Andrew Lunn
2023-10-17 13:39 ` Conor Dooley
2023-10-16 10:32 ` [PATCH net-next v2 " Vladimir Oltean
2023-10-16 10:55 ` [PATCH net-next v2 0/2] net: dsa: microchip: enable setting rmii Vladimir Oltean
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=20231016103708.6ka5vxfkdatrjvdk@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=ante.knezic@helmholz.de \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=woojung.huh@microchip.com \
/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;
as well as URLs for NNTP newsgroup(s).