mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: i.MX Riotboard: Add SD card update handler
@ 2023-02-07 12:53 Sascha Hauer
  2023-02-07 12:53 ` [PATCH 2/3] ARM: i.MX Riotboard: Switch to board driver Sascha Hauer
  2023-02-07 12:53 ` [PATCH 3/3] ARM: i.MX Riotboard: Let phy driver initialize the phy Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-02-07 12:53 UTC (permalink / raw)
  To: Barebox List

The Riotboard has an SD card slot from which the board can be booted.
Add an update handler for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/embest-riotboard/board.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boards/embest-riotboard/board.c b/arch/arm/boards/embest-riotboard/board.c
index 2e0cc9f0ab..ee6ae22190 100644
--- a/arch/arm/boards/embest-riotboard/board.c
+++ b/arch/arm/boards/embest-riotboard/board.c
@@ -60,6 +60,7 @@ static int riotboard_device_init(void)
 
 	imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc3.barebox",
 			BBU_HANDLER_FLAG_DEFAULT);
+	imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc2", 0);
 
 	barebox_set_hostname("riotboard");
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] ARM: i.MX Riotboard: Switch to board driver
  2023-02-07 12:53 [PATCH 1/3] ARM: i.MX Riotboard: Add SD card update handler Sascha Hauer
@ 2023-02-07 12:53 ` Sascha Hauer
  2023-02-07 12:53 ` [PATCH 3/3] ARM: i.MX Riotboard: Let phy driver initialize the phy Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-02-07 12:53 UTC (permalink / raw)
  To: Barebox List

Switch the Riotboard to board driver with deep probe enabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/embest-riotboard/board.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/embest-riotboard/board.c b/arch/arm/boards/embest-riotboard/board.c
index ee6ae22190..c5162d2b06 100644
--- a/arch/arm/boards/embest-riotboard/board.c
+++ b/arch/arm/boards/embest-riotboard/board.c
@@ -17,6 +17,7 @@
 #include <mfd/imx6q-iomuxc-gpr.h>
 #include <linux/sizes.h>
 #include <linux/phy.h>
+#include <deep-probe.h>
 
 static int ar8035_phy_fixup(struct phy_device *dev)
 {
@@ -51,11 +52,8 @@ static int ar8035_phy_fixup(struct phy_device *dev)
 	return 0;
 }
 
-static int riotboard_device_init(void)
+static int riotboard_probe(struct device *dev)
 {
-	if (!of_machine_is_compatible("riot,imx6s-riotboard"))
-		return 0;
-
 	phy_register_fixup_for_uid(0x004dd072, 0xffffffef, ar8035_phy_fixup);
 
 	imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc3.barebox",
@@ -66,4 +64,16 @@ static int riotboard_device_init(void)
 
 	return 0;
 }
-device_initcall(riotboard_device_init);
+
+static const struct of_device_id riotboard_of_match[] = {
+	{ .compatible = "riot,imx6s-riotboard"},
+	{ /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(riotboard_of_match);
+
+static struct driver riotboard_board_driver = {
+	.name = "board-riotboard",
+	.probe = riotboard_probe,
+	.of_compatible = DRV_OF_COMPAT(riotboard_of_match),
+};
+device_platform_driver(riotboard_board_driver);
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] ARM: i.MX Riotboard: Let phy driver initialize the phy
  2023-02-07 12:53 [PATCH 1/3] ARM: i.MX Riotboard: Add SD card update handler Sascha Hauer
  2023-02-07 12:53 ` [PATCH 2/3] ARM: i.MX Riotboard: Switch to board driver Sascha Hauer
@ 2023-02-07 12:53 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-02-07 12:53 UTC (permalink / raw)
  To: Barebox List

The phy setup done in the board code is done by the phy driver already,
so drop the board code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/embest-riotboard/board.c | 35 ------------------------
 arch/arm/mach-imx/Kconfig                |  1 +
 2 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/arch/arm/boards/embest-riotboard/board.c b/arch/arm/boards/embest-riotboard/board.c
index c5162d2b06..cd912f79e5 100644
--- a/arch/arm/boards/embest-riotboard/board.c
+++ b/arch/arm/boards/embest-riotboard/board.c
@@ -19,43 +19,8 @@
 #include <linux/phy.h>
 #include <deep-probe.h>
 
-static int ar8035_phy_fixup(struct phy_device *dev)
-{
-	u16 val;
-
-	/* Ar803x phy SmartEEE feature cause link status generates glitch,
-	 * which cause ethernet link down/up issue, so disable SmartEEE
-	 */
-	phy_write(dev, 0xd, 0x3);
-	phy_write(dev, 0xe, 0x805d);
-	phy_write(dev, 0xd, 0x4003);
-
-	val = phy_read(dev, 0xe);
-	phy_write(dev, 0xe, val & ~(1 << 8));
-
-	/* To enable AR8031 ouput a 125MHz clk from CLK_25M */
-	phy_write(dev, 0xd, 0x7);
-	phy_write(dev, 0xe, 0x8016);
-	phy_write(dev, 0xd, 0x4007);
-
-	val = phy_read(dev, 0xe);
-	val &= 0xffe3;
-	val |= 0x18;
-	phy_write(dev, 0xe, val);
-
-	/* introduce tx clock delay */
-	phy_write(dev, 0x1d, 0x5);
-	val = phy_read(dev, 0x1e);
-	val |= 0x0100;
-	phy_write(dev, 0x1e, val);
-
-	return 0;
-}
-
 static int riotboard_probe(struct device *dev)
 {
-	phy_register_fixup_for_uid(0x004dd072, 0xffffffef, ar8035_phy_fixup);
-
 	imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc3.barebox",
 			BBU_HANDLER_FLAG_DEFAULT);
 	imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc2", 0);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index dce5d9e1bb..2092b0b000 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -467,6 +467,7 @@ config MACH_EMBEST_MARSBOARD
 config MACH_EMBEST_RIOTBOARD
 	bool "Embest RIoTboard"
 	select ARCH_IMX6
+	imply AT803X_PHY
 
 config MACH_UDOO
 	bool "Freescale i.MX6 UDOO Board"
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-07 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 12:53 [PATCH 1/3] ARM: i.MX Riotboard: Add SD card update handler Sascha Hauer
2023-02-07 12:53 ` [PATCH 2/3] ARM: i.MX Riotboard: Switch to board driver Sascha Hauer
2023-02-07 12:53 ` [PATCH 3/3] ARM: i.MX Riotboard: Let phy driver initialize the phy Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox