* [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi
2024-02-27 17:54 [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function Robert Marko
@ 2024-02-27 17:54 ` Robert Marko
2024-02-27 19:23 ` Andrew Lunn
2024-02-27 17:54 ` [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function Robert Marko
2024-02-29 9:30 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Robert Marko @ 2024-02-27 17:54 UTC (permalink / raw)
To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Cc: Robert Marko
The name mv88e6xxx_g2_scratch_gpio_set_smi is a bit ambiguous as it appears
to only be applicable to the 6390 family, so lets rename it to
mv88e6390_g2_scratch_gpio_set_smi to make it more obvious.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
drivers/net/dsa/mv88e6xxx/global2.h | 2 +-
drivers/net/dsa/mv88e6xxx/global2_scratch.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 9caecb4dfbfa..f9378fca8305 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3712,7 +3712,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
if (external) {
mv88e6xxx_reg_lock(chip);
- err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true);
+ err = mv88e6390_g2_scratch_gpio_set_smi(chip, true);
mv88e6xxx_reg_unlock(chip);
if (err)
diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h
index d9434f7cae53..20fefa08f54e 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.h
+++ b/drivers/net/dsa/mv88e6xxx/global2.h
@@ -378,7 +378,7 @@ extern const struct mv88e6xxx_avb_ops mv88e6390_avb_ops;
extern const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops;
-int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+int mv88e6390_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
bool external);
int mv88e6352_g2_scratch_port_has_serdes(struct mv88e6xxx_chip *chip, int port);
int mv88e6xxx_g2_atu_stats_set(struct mv88e6xxx_chip *chip, u16 kind, u16 bin);
diff --git a/drivers/net/dsa/mv88e6xxx/global2_scratch.c b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
index a9d6e40321a2..0e15efd898f2 100644
--- a/drivers/net/dsa/mv88e6xxx/global2_scratch.c
+++ b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
@@ -240,7 +240,7 @@ const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops = {
};
/**
- * mv88e6xxx_g2_scratch_gpio_set_smi - set gpio muxing for external smi
+ * mv88e6390_g2_scratch_gpio_set_smi - set gpio muxing for external smi
* @chip: chip private data
* @external: set mux for external smi, or free for gpio usage
*
@@ -248,7 +248,7 @@ const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops = {
* an external SMI interface, or they may be made free for other
* GPIO uses.
*/
-int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+int mv88e6390_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
bool external)
{
int misc_cfg = MV88E6352_G2_SCRATCH_MISC_CFG;
--
2.43.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi
2024-02-27 17:54 ` [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi Robert Marko
@ 2024-02-27 19:23 ` Andrew Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2024-02-27 19:23 UTC (permalink / raw)
To: Robert Marko
Cc: f.fainelli, olteanv, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
On Tue, Feb 27, 2024 at 06:54:21PM +0100, Robert Marko wrote:
> The name mv88e6xxx_g2_scratch_gpio_set_smi is a bit ambiguous as it appears
> to only be applicable to the 6390 family, so lets rename it to
> mv88e6390_g2_scratch_gpio_set_smi to make it more obvious.
>
> Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function
2024-02-27 17:54 [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function Robert Marko
2024-02-27 17:54 ` [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi Robert Marko
@ 2024-02-27 17:54 ` Robert Marko
2024-02-29 9:30 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Robert Marko @ 2024-02-27 17:54 UTC (permalink / raw)
To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Cc: Robert Marko
The existing mv88e6390_g2_scratch_gpio_set_smi() cannot be used on the
88E6393X as it requires certain P0_MODE, it also checks the CPU mode
as it impacts the bit setting value.
This is all irrelevant for Amethyst (MV88E6191X/6193X/6393X) as only
the default value of the SMI_PHY Config bit is set to CPU_MGD bootstrap
pin value but it can be changed without restrictions so that GPIO pins
9 and 10 are used as SMI pins.
So, introduce Amethyst specific function and call that if the Amethyst
family wants to setup the external PHY.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 5 +++-
drivers/net/dsa/mv88e6xxx/global2.h | 2 ++
drivers/net/dsa/mv88e6xxx/global2_scratch.c | 31 +++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index f9378fca8305..9ed1821184ec 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3712,7 +3712,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
if (external) {
mv88e6xxx_reg_lock(chip);
- err = mv88e6390_g2_scratch_gpio_set_smi(chip, true);
+ if (chip->info->family == MV88E6XXX_FAMILY_6393)
+ err = mv88e6393x_g2_scratch_gpio_set_smi(chip, true);
+ else
+ err = mv88e6390_g2_scratch_gpio_set_smi(chip, true);
mv88e6xxx_reg_unlock(chip);
if (err)
diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h
index 20fefa08f54e..82f9b410de0b 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.h
+++ b/drivers/net/dsa/mv88e6xxx/global2.h
@@ -380,6 +380,8 @@ extern const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops;
int mv88e6390_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
bool external);
+int mv88e6393x_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+ bool external);
int mv88e6352_g2_scratch_port_has_serdes(struct mv88e6xxx_chip *chip, int port);
int mv88e6xxx_g2_atu_stats_set(struct mv88e6xxx_chip *chip, u16 kind, u16 bin);
int mv88e6xxx_g2_atu_stats_get(struct mv88e6xxx_chip *chip, u16 *stats);
diff --git a/drivers/net/dsa/mv88e6xxx/global2_scratch.c b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
index 0e15efd898f2..61ab6cc4fbfc 100644
--- a/drivers/net/dsa/mv88e6xxx/global2_scratch.c
+++ b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
@@ -290,6 +290,37 @@ int mv88e6390_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
return mv88e6xxx_g2_scratch_write(chip, misc_cfg, val);
}
+/**
+ * mv88e6393x_g2_scratch_gpio_set_smi - set gpio muxing for external smi
+ * @chip: chip private data
+ * @external: set mux for external smi, or free for gpio usage
+ *
+ * MV88E6191X/6193X/6393X GPIO pins 9 and 10 can be configured as an
+ * external SMI interface or as regular GPIO-s.
+ *
+ * They however have a different register layout then the existing
+ * function.
+ */
+
+int mv88e6393x_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+ bool external)
+{
+ int misc_cfg = MV88E6352_G2_SCRATCH_MISC_CFG;
+ int err;
+ u8 val;
+
+ err = mv88e6xxx_g2_scratch_read(chip, misc_cfg, &val);
+ if (err)
+ return err;
+
+ if (external)
+ val &= ~MV88E6352_G2_SCRATCH_MISC_CFG_NORMALSMI;
+ else
+ val |= MV88E6352_G2_SCRATCH_MISC_CFG_NORMALSMI;
+
+ return mv88e6xxx_g2_scratch_write(chip, misc_cfg, val);
+}
+
/**
* mv88e6352_g2_scratch_port_has_serdes - indicate if a port can have a serdes
* @chip: chip private data
--
2.43.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function
2024-02-27 17:54 [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function Robert Marko
2024-02-27 17:54 ` [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi Robert Marko
2024-02-27 17:54 ` [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function Robert Marko
@ 2024-02-29 9:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-29 9:30 UTC (permalink / raw)
To: Robert Marko
Cc: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 27 Feb 2024 18:54:20 +0100 you wrote:
> Amethyst family (MV88E6191X/6193X/6393X) has a simplified SMI GPIO setting
> via the Scratch and Misc register so it requires family specific function.
>
> In the v1 review, Andrew pointed out that it would make sense to rename the
> existing mv88e6xxx_g2_scratch_gpio_set_smi as it only works on the MV6390
> family.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/2] net: dsa: mv88e6xxx: rename mv88e6xxx_g2_scratch_gpio_set_smi
https://git.kernel.org/netdev/net-next/c/5c5b0c444be3
- [net-next,v2,2/2] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function
https://git.kernel.org/netdev/net-next/c/e3ab3267a0bb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread