* [PATCH 01/13] net: fec_imx: Make ptp clock optional
@ 2020-05-06 8:17 Sascha Hauer
2020-05-06 8:17 ` [PATCH 02/13] net: fec_imx: Return with an error when mandatory clock is missing Sascha Hauer
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The ptp clock doesn't exist on all SoCs, make it optional. In fact it
was optional before due to a bug in the driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec_imx.c | 4 ++--
drivers/net/fec_imx.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index f814b3b960..585cdcb24c 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -705,10 +705,10 @@ static int fec_clk_get(struct fec_priv *fec)
{
int i, err = 0;
static const char *clk_names[ARRAY_SIZE(fec->clk)] = {
- "ipg", "ahb", "ptp"
+ "ipg", "ahb",
};
static const char *opt_clk_names[ARRAY_SIZE(fec->opt_clk)] = {
- "enet_clk_ref", "enet_out",
+ "enet_clk_ref", "enet_out", "ptp"
};
for (i = 0; i < ARRAY_SIZE(fec->clk); i++) {
diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h
index d1ac92f0e3..316eefe48f 100644
--- a/drivers/net/fec_imx.h
+++ b/drivers/net/fec_imx.h
@@ -121,7 +121,6 @@ enum fec_type {
enum fec_clock {
FEC_CLK_IPG,
FEC_CLK_AHB,
- FEC_CLK_PTP,
FEC_CLK_NUM
};
@@ -129,6 +128,7 @@ enum fec_clock {
enum fec_opt_clock {
FEC_OPT_CLK_REF,
FEC_OPT_CLK_OUT,
+ FEC_OPT_CLK_PTP,
FEC_OPT_CLK_NUM
};
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 02/13] net: fec_imx: Return with an error when mandatory clock is missing
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 03/13] clk: mxs: Do not enable enet_out clock Sascha Hauer
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
When a mandatory clock is missing we have to return with an error. Just
breaking out of the loop results in ignoring the error.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec_imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 585cdcb24c..772f930f0d 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -716,7 +716,7 @@ static int fec_clk_get(struct fec_priv *fec)
if (IS_ERR(fec->clk[i])) {
err = PTR_ERR(fec->clk[i]);
fec_clk_put(fec);
- break;
+ return err;
}
}
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 03/13] clk: mxs: Do not enable enet_out clock
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
2020-05-06 8:17 ` [PATCH 02/13] net: fec_imx: Return with an error when mandatory clock is missing Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 04/13] arm: mxs: Add Kconfig option for device tree boards Sascha Hauer
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The enet_out clock gate is wrongly abstracted. The bit it is controlling
is not just a bit to enable the clock, it also controls the direction of
the ethernet reference clock. When the bit is cleared, the ethernet
reference clock must be fed into the SoC from an external oscillator;
when it's set then the ethernet reference clock is generated internally.
The correct setting depends on the board, so we must not set the bit
unconditionally during probe of the clock driver. Whether or not the
clock is enabled can be selected by the board by removing the clock from
the FEC in its dts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/mxs/clk-imx28.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 4adb1c6866..aedd8d4a7c 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -131,7 +131,6 @@ static int __init mx28_clocks_init(void __iomem *regs)
clk_set_rate(clks[ssp2], 96000000);
clk_set_rate(clks[ssp3], 96000000);
clk_set_parent(clks[lcdif_sel], clks[ref_pix]);
- clk_enable(clks[enet_out]);
clkdev_add_physbase(clks[ssp0], IMX_SSP0_BASE, NULL);
clkdev_add_physbase(clks[ssp1], IMX_SSP1_BASE, NULL);
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 04/13] arm: mxs: Add Kconfig option for device tree boards
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
2020-05-06 8:17 ` [PATCH 02/13] net: fec_imx: Return with an error when mandatory clock is missing Sascha Hauer
2020-05-06 8:17 ` [PATCH 03/13] clk: mxs: Do not enable enet_out clock Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 05/13] clk: mxs: Fix clock numbering Sascha Hauer
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
Boards supporting device tree have to make sure OFTREE and OFDEVICE are
selected. Add a convenience option pulling in the right options and
select it from the boards.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mxs/Kconfig | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index b3a7c6259c..f7d13569ea 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -9,6 +9,11 @@ config ARCH_TEXT_BASE
default 0x47000000 if MACH_MX28EVK
default 0x47000000 if MACH_CFA10036
+config ARCH_MXS_OF_SUPPORT
+ bool
+ select OFTREE
+ select OFDEVICE
+
comment "Freescale i.MX System-on-Chip"
choice
@@ -57,12 +62,14 @@ config MACH_TX28
config MACH_MX28EVK
bool "mx28-evk"
select MXS_OCOTP
+ select ARCH_MXS_OF_SUPPORT
help
Say Y here if you are using the Freescale i.MX28-EVK board
config MACH_DUCKBILL
bool "Duckbill"
select MXS_OCOTP
+ select ARCH_MXS_OF_SUPPORT
help
Say Y here if you are using the I2SE Duckbill board
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 05/13] clk: mxs: Fix clock numbering
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (2 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 04/13] arm: mxs: Add Kconfig option for device tree boards Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 06/13] clk imx28: Add USB clocks Sascha Hauer
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The device tree clock lookups use the position in the clks array,
hence they must match. fec_sleep is a barebox specific clock and
is in between other clocks. Put the clock at the end of the array.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/mxs/clk-imx28.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index aedd8d4a7c..241b26c9a2 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -56,8 +56,8 @@ enum imx28_clk {
emi_xtal, lcdif_div, etm_div, ptp, saif0_div, saif1_div,
clk32k_div, rtc, lradc, spdif_div, clk32k, pwm, uart, ssp0,
ssp1, ssp2, ssp3, gpmi, spdif, emi, saif0, saif1, lcdif, etm,
- fec_sleep, fec, can0, can1, usb0, usb1, usb0_phy, usb1_phy, enet_out,
- lcdif_comp, clk_max
+ fec, can0, can1, usb0, usb1, usb0_phy, usb1_phy, enet_out,
+ lcdif_comp, fec_sleep, clk_max
};
static struct clk *clks[clk_max];
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 06/13] clk imx28: Add USB clocks
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (3 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 05/13] clk: mxs: Fix clock numbering Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 07/13] clk: mxs: Use device tree provided clock lookups Sascha Hauer
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The USB clocks are missing, add them to make USB work as part of the
i.MX chipidea driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/mxs/clk-imx28.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 241b26c9a2..aa528e109a 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -11,6 +11,7 @@
#include <linux/clkdev.h>
#include <linux/err.h>
#include <mach/imx28-regs.h>
+#include <of_address.h>
#include "clk.h"
@@ -38,6 +39,9 @@
#define FRAC1 (regs + 0x01c0)
#define CLKSEQ (regs + 0x01d0)
+static void __iomem *digctrl;
+#define DIGCTRL digctrl
+
static const char *sel_cpu[] = { "ref_cpu", "ref_xtal", };
static const char *sel_io0[] = { "ref_io0", "ref_xtal", };
static const char *sel_io1[] = { "ref_io1", "ref_xtal", };
@@ -64,6 +68,8 @@ static struct clk *clks[clk_max];
static int __init mx28_clocks_init(void __iomem *regs)
{
+ struct device_node *dcnp;
+
clks[ref_xtal] = clk_fixed("ref_xtal", 24000000);
clks[pll0] = mxs_clk_pll("pll0", "ref_xtal", PLL0CTRL0, 17, 480000000);
clks[pll1] = mxs_clk_pll("pll1", "ref_xtal", PLL1CTRL0, 17, 480000000);
@@ -120,6 +126,13 @@ static int __init mx28_clocks_init(void __iomem *regs)
clks[lcdif_comp] = mxs_clk_lcdif("lcdif_comp", clks[ref_pix],
clks[lcdif_div], clks[lcdif]);
+ dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
+ if (dcnp) {
+ digctrl = of_iomap(dcnp, 0);
+ clks[usb0] = mxs_clk_gate("usb0", "usb0_phy", DIGCTRL, 2);
+ clks[usb1] = mxs_clk_gate("usb1", "usb1_phy", DIGCTRL, 16);
+ }
+
clk_set_rate(clks[ref_io0], 480000000);
clk_set_rate(clks[ref_io1], 480000000);
clk_set_parent(clks[ssp0_sel], clks[ref_io0]);
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 07/13] clk: mxs: Use device tree provided clock lookups
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (4 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 06/13] clk imx28: Add USB clocks Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 08/13] ARM: mxs: Increase VDDD voltage to match specification Sascha Hauer
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
When probing from the device tree use the device tree provided clock
lookups. So far we only used the clock lookups based on the physical
base address of the device, but these should go sooner or later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mxs/Kconfig | 1 +
drivers/clk/mxs/clk-imx28.c | 45 +++++++++++++++++++++----------------
2 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index f7d13569ea..f4a9d3d422 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -11,6 +11,7 @@ config ARCH_TEXT_BASE
config ARCH_MXS_OF_SUPPORT
bool
+ select COMMON_CLK_OF_PROVIDER
select OFTREE
select OFDEVICE
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index aa528e109a..bf65a4a3b8 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -65,8 +65,9 @@ enum imx28_clk {
};
static struct clk *clks[clk_max];
+static struct clk_onecell_data clk_data;
-static int __init mx28_clocks_init(void __iomem *regs)
+static int __init mx28_clocks_init(struct device_d *dev, void __iomem *regs)
{
struct device_node *dcnp;
@@ -145,23 +146,29 @@ static int __init mx28_clocks_init(void __iomem *regs)
clk_set_rate(clks[ssp3], 96000000);
clk_set_parent(clks[lcdif_sel], clks[ref_pix]);
- clkdev_add_physbase(clks[ssp0], IMX_SSP0_BASE, NULL);
- clkdev_add_physbase(clks[ssp1], IMX_SSP1_BASE, NULL);
- clkdev_add_physbase(clks[ssp2], IMX_SSP2_BASE, NULL);
- clkdev_add_physbase(clks[ssp3], IMX_SSP3_BASE, NULL);
- clkdev_add_physbase(clks[fec], IMX_FEC0_BASE, NULL);
- clkdev_add_physbase(clks[xbus], IMX_DBGUART_BASE, NULL);
- clkdev_add_physbase(clks[hbus], IMX_OCOTP_BASE, NULL);
- clkdev_add_physbase(clks[hbus], MXS_APBH_BASE, NULL);
- clkdev_add_physbase(clks[uart], IMX_UART0_BASE, NULL);
- clkdev_add_physbase(clks[uart], IMX_UART1_BASE, NULL);
- clkdev_add_physbase(clks[uart], IMX_UART2_BASE, NULL);
- clkdev_add_physbase(clks[uart], IMX_UART3_BASE, NULL);
- clkdev_add_physbase(clks[uart], IMX_UART4_BASE, NULL);
- clkdev_add_physbase(clks[gpmi], MXS_GPMI_BASE, NULL);
- clkdev_add_physbase(clks[pwm], IMX_PWM_BASE, NULL);
- if (IS_ENABLED(CONFIG_DRIVER_VIDEO_STM))
- clkdev_add_physbase(clks[lcdif_comp], IMX_FB_BASE, NULL);
+ if (dev->device_node) {
+ clk_data.clks = clks;
+ clk_data.clk_num = clk_max;
+ of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
+ } else {
+ clkdev_add_physbase(clks[ssp0], IMX_SSP0_BASE, NULL);
+ clkdev_add_physbase(clks[ssp1], IMX_SSP1_BASE, NULL);
+ clkdev_add_physbase(clks[ssp2], IMX_SSP2_BASE, NULL);
+ clkdev_add_physbase(clks[ssp3], IMX_SSP3_BASE, NULL);
+ clkdev_add_physbase(clks[fec], IMX_FEC0_BASE, NULL);
+ clkdev_add_physbase(clks[xbus], IMX_DBGUART_BASE, NULL);
+ clkdev_add_physbase(clks[hbus], IMX_OCOTP_BASE, NULL);
+ clkdev_add_physbase(clks[hbus], MXS_APBH_BASE, NULL);
+ clkdev_add_physbase(clks[uart], IMX_UART0_BASE, NULL);
+ clkdev_add_physbase(clks[uart], IMX_UART1_BASE, NULL);
+ clkdev_add_physbase(clks[uart], IMX_UART2_BASE, NULL);
+ clkdev_add_physbase(clks[uart], IMX_UART3_BASE, NULL);
+ clkdev_add_physbase(clks[uart], IMX_UART4_BASE, NULL);
+ clkdev_add_physbase(clks[gpmi], MXS_GPMI_BASE, NULL);
+ clkdev_add_physbase(clks[pwm], IMX_PWM_BASE, NULL);
+ if (IS_ENABLED(CONFIG_DRIVER_VIDEO_STM))
+ clkdev_add_physbase(clks[lcdif_comp], IMX_FB_BASE, NULL);
+ }
return 0;
}
@@ -176,7 +183,7 @@ static int imx28_ccm_probe(struct device_d *dev)
return PTR_ERR(iores);
regs = IOMEM(iores->start);
- mx28_clocks_init(regs);
+ mx28_clocks_init(dev, regs);
return 0;
}
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 08/13] ARM: mxs: Increase VDDD voltage to match specification
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (5 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 07/13] clk: mxs: Use device tree provided clock lookups Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 09/13] filetype: Add filetype for i.MX23/28 SD card images Sascha Hauer
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
Adoption of U-Boot commit:
| commit b4a2cdc13ed886b981e8fcd3087293ba9296f17f
| Author: Marek Vasut <marex@denx.de>
| Date: Tue Oct 15 18:26:57 2019 +0200
|
| arm: mxs: Increase VDDD voltage to match specification
|
| According to IMX28CEC rev. 4, 10/2018, Table 15. Recommended Operating
| Conditions, page 16, the VDDD should be set to 1.55V when the CPU is
| operating at 454MHz. This is the case in U-Boot, hence increase the
| VDDD voltage. This fixes instability when performing TFTP transfers.
| Increase the brownout threshold to 1.4V. The documentation recommends
| 1.45V setting for the brownout, however, this triggers failure during
| power block init, so keep the brownout slightly lower.
|
| Signed-off-by: Marek Vasut <marex@denx.de>
| Cc: Stefano Babic <sbabic@denx.de>
| Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mxs/power-init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
index ca7c349d7f..c89f1f5f5d 100644
--- a/arch/arm/mach-mxs/power-init.c
+++ b/arch/arm/mach-mxs/power-init.c
@@ -1172,7 +1172,7 @@ static void mx23_ungate_power(void)
writel(MX23_POWER_CTRL_CLKGATE, &power_regs->hw_power_ctrl_clr);
}
-struct mxs_power_ctrl mxs_vddd_default = { .target = 1500, .brownout = 1325 };
+struct mxs_power_ctrl mxs_vddd_default = { .target = 1550, .brownout = 1400 };
struct mxs_power_ctrl mxs_vdda_default = { .target = 1800, .brownout = 1650 };
struct mxs_power_ctrl mxs_vddio_default = { .target = 3300, .brownout = 3150 };
struct mxs_power_ctrl mx23_vddmem_default = { .target = 2500, .brownout = 1700 };
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 09/13] filetype: Add filetype for i.MX23/28 SD card images
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (6 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 08/13] ARM: mxs: Increase VDDD voltage to match specification Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 10/13] watchdog: i.MX28: Add device tree support Sascha Hauer
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
Add a filetype for i.MX23/28 SD card images so that they can be
detected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/filetype.c | 4 ++++
include/filetype.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index fd6e8e3d1c..813f55ef61 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -81,6 +81,7 @@ static const struct filetype_str filetype_str[] = {
"ubootvar" },
[filetype_stm32_image_v1] = { "STM32 image (v1)", "stm32-image-v1" },
[filetype_zynq_image] = { "Zynq image", "zynq-image" },
+ [filetype_mxs_sd_image] = { "i.MX23/28 SD card image", "mxs-sd-image" },
};
const char *file_type_to_string(enum filetype f)
@@ -342,6 +343,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (buf[0] == 0x01ee0100 && buf[1] == 0xaa55aa55)
return filetype_layerscape_qspi_image;
+ if (le32_to_cpu(buf[0]) == 0x00112233 && le32_to_cpu(buf[1]) == 0x1)
+ return filetype_mxs_sd_image;
+
if (bufsize < 64)
return filetype_unknown;
diff --git a/include/filetype.h b/include/filetype.h
index c3a5bdfbbe..3019dda6ed 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -51,6 +51,7 @@ enum filetype {
filetype_ubootvar,
filetype_stm32_image_v1,
filetype_zynq_image,
+ filetype_mxs_sd_image,
filetype_max,
};
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 10/13] watchdog: i.MX28: Add device tree support
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (7 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 09/13] filetype: Add filetype for i.MX23/28 SD card images Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 11/13] usb: imx-usb-phy: Add delay Sascha Hauer
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/im28wd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/watchdog/im28wd.c b/drivers/watchdog/im28wd.c
index 2b233ede20..6ebd97e5f5 100644
--- a/drivers/watchdog/im28wd.c
+++ b/drivers/watchdog/im28wd.c
@@ -229,9 +229,18 @@ static void imx28_wd_remove(struct device_d *dev)
free(priv);
}
+static __maybe_unused struct of_device_id imx28_wdt_dt_ids[] = {
+ {
+ .compatible = "fsl,stmp3xxx-rtc",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d imx28_wd_driver = {
.name = "im28wd",
.probe = imx28_wd_probe,
.remove = imx28_wd_remove,
+ .of_compatible = DRV_OF_COMPAT(imx28_wdt_dt_ids),
};
device_platform_driver(imx28_wd_driver);
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 11/13] usb: imx-usb-phy: Add delay
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (8 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 10/13] watchdog: i.MX28: Add device tree support Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 12/13] usb: i.MX: Add i.MX28 support Sascha Hauer
2020-05-06 8:17 ` [PATCH 13/13] ARM: i.MX28: Update defconfig Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The imx-usb-phy needs a small delay on i.MX28, otherwise the
stmp_reset_block() fails. Add this delay unconditionally as it doesn't
seem to be worth it to limit the delay on this platform.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/imx/imx-usb-phy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 069dddcacb..c23a747d0b 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -57,6 +57,7 @@ static int imx_usbphy_phy_init(struct phy *phy)
int ret;
clk_enable(imxphy->clk);
+ mdelay(1);
ret = stmp_reset_block(imxphy->base + HW_USBPHY_CTRL, false);
if (ret)
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 12/13] usb: i.MX: Add i.MX28 support
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (9 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 11/13] usb: imx-usb-phy: Add delay Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
2020-05-06 8:17 ` [PATCH 13/13] ARM: i.MX28: Update defconfig Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
The existing i.MX chipidea support can be used for i.MX28 as well. The
main difference is that the i.MX28 doesn't have a usbmisc unit, so the
bulk of this patch makes this unit optional in the driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/imx/Kconfig | 8 +++--
drivers/usb/imx/Makefile | 3 +-
drivers/usb/imx/chipidea-imx.c | 60 +++++++++++++++++++++++++---------
include/usb/chipidea-imx.h | 13 ++++++++
4 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/imx/Kconfig b/drivers/usb/imx/Kconfig
index 34f35e0ff6..2b9e63b21c 100644
--- a/drivers/usb/imx/Kconfig
+++ b/drivers/usb/imx/Kconfig
@@ -1,7 +1,7 @@
config USB_IMX_CHIPIDEA
bool "i.MX USB support (read help)"
- depends on ARCH_IMX
+ depends on ARCH_IMX || ARCH_MXS
select USB_OTGDEV
help
The Freescale i.MX SoCs have a variant of the chipidea ci13xxx for
@@ -15,8 +15,12 @@ config USB_IMX_CHIPIDEA
support to work.
It's safe to say yes here. Also select EHCI support for USB host.
+config USB_IMX_CHIPIDEA_USBMISC
+ bool
+ default y if ARCH_IMX
+
config USB_IMX_PHY
bool
- default y if (ARCH_IMX6 || ARCH_VF610) && GENERIC_PHY
+ default y if (ARCH_IMX6 || ARCH_VF610 || ARCH_MXS) && GENERIC_PHY
select STMP_DEVICE
select MFD_SYSCON
diff --git a/drivers/usb/imx/Makefile b/drivers/usb/imx/Makefile
index e15bc711a9..ac17e91e99 100644
--- a/drivers/usb/imx/Makefile
+++ b/drivers/usb/imx/Makefile
@@ -1,2 +1,3 @@
-obj-$(CONFIG_USB_IMX_CHIPIDEA) += imx-usb-misc.o chipidea-imx.o
+obj-$(CONFIG_USB_IMX_CHIPIDEA) += chipidea-imx.o
+obj-$(CONFIG_USB_IMX_CHIPIDEA_USBMISC) += imx-usb-misc.o
obj-$(CONFIG_USB_IMX_PHY) += imx-usb-phy.o
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 03301d9c3e..635be02929 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -31,6 +31,10 @@
#define MXC_EHCI_PORTSC_MASK ((0xf << 28) | (1 << 25))
+struct imx_chipidea_data {
+ bool have_usb_misc;
+};
+
struct imx_chipidea {
struct device_d *dev;
void __iomem *base;
@@ -47,13 +51,14 @@ struct imx_chipidea {
struct clk *clk;
struct ehci_host *ehci;
struct fsl_udc *udc;
+ bool have_usb_misc;
};
static int imx_chipidea_port_init(void *drvdata)
{
struct imx_chipidea *ci = drvdata;
uint32_t portsc;
- int ret;
+ int ret = 0;
if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
dev_dbg(ci->dev, "using ULPI phy\n");
@@ -72,9 +77,11 @@ static int imx_chipidea_port_init(void *drvdata)
return ret;
}
- ret = imx_usbmisc_port_init(ci->usbmisc, ci->portno, ci->flags);
- if (ret)
- dev_err(ci->dev, "misc init failed: %s\n", strerror(-ret));
+ if (ci->have_usb_misc) {
+ ret = imx_usbmisc_port_init(ci->usbmisc, ci->portno, ci->flags);
+ if (ret)
+ dev_err(ci->dev, "misc init failed: %s\n", strerror(-ret));
+ }
/* PFSC bit is reset by ehci_reset(), thus have to set it not in
* probe but here, after ehci_reset() is already called */
@@ -90,11 +97,13 @@ static int imx_chipidea_port_init(void *drvdata)
static int imx_chipidea_port_post_init(void *drvdata)
{
struct imx_chipidea *ci = drvdata;
- int ret;
+ int ret = 0;
- ret = imx_usbmisc_port_post_init(ci->usbmisc, ci->portno, ci->flags);
- if (ret)
- dev_err(ci->dev, "post misc init failed: %s\n", strerror(-ret));
+ if (ci->have_usb_misc) {
+ ret = imx_usbmisc_port_post_init(ci->usbmisc, ci->portno, ci->flags);
+ if (ret)
+ dev_err(ci->dev, "post misc init failed: %s\n", strerror(-ret));
+ }
return ret;
}
@@ -103,15 +112,18 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
{
struct of_phandle_args out_args;
- if (of_parse_phandle_with_args(ci->dev->device_node, "fsl,usbmisc",
- "#index-cells", 0, &out_args))
- return -ENODEV;
+ if (ci->have_usb_misc) {
+ if (of_parse_phandle_with_args(ci->dev->device_node, "fsl,usbmisc",
+ "#index-cells", 0, &out_args))
+ return -ENODEV;
+
+ ci->usbmisc = of_find_device_by_node(out_args.np);
+ if (!ci->usbmisc)
+ return -ENODEV;
- ci->usbmisc = of_find_device_by_node(out_args.np);
- if (!ci->usbmisc)
- return -ENODEV;
+ ci->portno = out_args.args[0];
+ }
- ci->portno = out_args.args[0];
ci->flags = MXC_EHCI_MODE_UTMI_8BIT;
ci->mode = of_usb_get_dr_mode(ci->dev->device_node, NULL);
@@ -219,6 +231,7 @@ static int ci_set_mode(void *ctx, enum usb_dr_mode mode)
static int imx_chipidea_probe(struct device_d *dev)
{
struct resource *iores;
+ struct imx_chipidea_data *imx_data;
struct imxusb_platformdata *pdata = dev->platform_data;
int ret;
void __iomem *base;
@@ -229,6 +242,10 @@ static int imx_chipidea_probe(struct device_d *dev)
ci->dev = dev;
dev->priv = ci;
+ ret = dev_get_drvdata(dev, (const void **)&imx_data);
+ if (!ret)
+ ci->have_usb_misc = imx_data->have_usb_misc;
+
if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
ret = imx_chipidea_probe_dt(ci);
if (ret)
@@ -319,11 +336,24 @@ static void imx_chipidea_remove(struct device_d *dev)
ci_udc_unregister(ci->udc);
}
+static const struct imx_chipidea_data imx_data = {
+ .have_usb_misc = 1,
+};
+
+static const struct imx_chipidea_data imx28_data = {
+ .have_usb_misc = 0,
+};
+
static __maybe_unused struct of_device_id imx_chipidea_dt_ids[] = {
{
.compatible = "fsl,imx27-usb",
+ .data = &imx_data,
+ }, {
+ .compatible = "fsl,imx28-usb",
+ .data = &imx28_data,
}, {
.compatible = "fsl,imx7d-usb",
+ .data = &imx_data,
}, {
/* sentinel */
},
diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h
index 5ea5fcc26d..d6939886fc 100644
--- a/include/usb/chipidea-imx.h
+++ b/include/usb/chipidea-imx.h
@@ -43,7 +43,20 @@ struct imxusb_platformdata {
enum usb_dr_mode mode;
};
+#ifdef USB_IMX_CHIPIDEA_USBMISC
int imx_usbmisc_port_init(struct device_d *dev, int port, unsigned flags);
int imx_usbmisc_port_post_init(struct device_d *dev, int port, unsigned flags);
+#else
+static inline int imx_usbmisc_port_init(struct device_d *dev, int port,
+ unsigned flags)
+{
+ return 0;
+}
+static inline int imx_usbmisc_port_post_init(struct device_d *dev, int port,
+ unsigned flags)
+{
+ return 0;
+}
+#endif
#endif /* __USB_CHIPIDEA_IMX_H */
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 13/13] ARM: i.MX28: Update defconfig
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
` (10 preceding siblings ...)
2020-05-06 8:17 ` [PATCH 12/13] usb: i.MX: Add i.MX28 support Sascha Hauer
@ 2020-05-06 8:17 ` Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2020-05-06 8:17 UTC (permalink / raw)
To: Barebox List
Enable more features:
- USB support
- wd command
- ubiformat
- regulator command
Changes:
- Disable all consoles (they are enabled using stdout-path property)
- Do not probe MMC/SD cards during probe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/configs/imx28_defconfig | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arm/configs/imx28_defconfig b/arch/arm/configs/imx28_defconfig
index 1acc8dd94f..4442c79cc4 100644
--- a/arch/arm/configs/imx28_defconfig
+++ b/arch/arm/configs/imx28_defconfig
@@ -20,7 +20,9 @@ CONFIG_BOOTM_SHOW_TYPE=y
CONFIG_BOOTM_VERBOSE=y
CONFIG_BOOTM_INITRD=y
CONFIG_BLSPEC=y
+CONFIG_CONSOLE_ACTIVATE_NONE=y
CONFIG_CONSOLE_ALLOW_COLOR=y
+CONFIG_PBL_CONSOLE=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_RESET_SOURCE=y
CONFIG_CMD_DMESG=y
@@ -28,11 +30,13 @@ CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_REGULATOR=y
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_GO=y
CONFIG_CMD_RESET=y
CONFIG_CMD_UIMAGE=y
CONFIG_CMD_PARTITION=y
+CONFIG_CMD_UBIFORMAT=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_PRINTENV=y
@@ -72,16 +76,20 @@ CONFIG_CMD_NANDTEST=y
CONFIG_CMD_SPI=y
CONFIG_CMD_LED_TRIGGER=y
CONFIG_CMD_USBGADGET=y
+CONFIG_CMD_WD=y
CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
-CONFIG_OFDEVICE=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_AUART=y
CONFIG_DRIVER_NET_FEC_IMX=y
+CONFIG_NET_USB=y
+CONFIG_NET_USB_ASIX=y
+CONFIG_USB_NET_AX88179_178A=y
+CONFIG_NET_USB_SMSC95XX=y
CONFIG_DRIVER_SPI_MXS=y
CONFIG_I2C=y
CONFIG_MTD=y
@@ -89,6 +97,10 @@ CONFIG_NAND=y
CONFIG_NAND_MXS=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_USB_HOST=y
+CONFIG_USB_IMX_CHIPIDEA=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
@@ -97,7 +109,6 @@ CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_STM=y
CONFIG_MCI=y
-CONFIG_MCI_STARTUP=y
CONFIG_MCI_MXS=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
@@ -108,6 +119,7 @@ CONFIG_WATCHDOG_MXS28=y
CONFIG_MXS_APBH_DMA=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y
+CONFIG_GENERIC_PHY=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
CONFIG_FS_NFS=y
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-05-06 8:17 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 8:17 [PATCH 01/13] net: fec_imx: Make ptp clock optional Sascha Hauer
2020-05-06 8:17 ` [PATCH 02/13] net: fec_imx: Return with an error when mandatory clock is missing Sascha Hauer
2020-05-06 8:17 ` [PATCH 03/13] clk: mxs: Do not enable enet_out clock Sascha Hauer
2020-05-06 8:17 ` [PATCH 04/13] arm: mxs: Add Kconfig option for device tree boards Sascha Hauer
2020-05-06 8:17 ` [PATCH 05/13] clk: mxs: Fix clock numbering Sascha Hauer
2020-05-06 8:17 ` [PATCH 06/13] clk imx28: Add USB clocks Sascha Hauer
2020-05-06 8:17 ` [PATCH 07/13] clk: mxs: Use device tree provided clock lookups Sascha Hauer
2020-05-06 8:17 ` [PATCH 08/13] ARM: mxs: Increase VDDD voltage to match specification Sascha Hauer
2020-05-06 8:17 ` [PATCH 09/13] filetype: Add filetype for i.MX23/28 SD card images Sascha Hauer
2020-05-06 8:17 ` [PATCH 10/13] watchdog: i.MX28: Add device tree support Sascha Hauer
2020-05-06 8:17 ` [PATCH 11/13] usb: imx-usb-phy: Add delay Sascha Hauer
2020-05-06 8:17 ` [PATCH 12/13] usb: i.MX: Add i.MX28 support Sascha Hauer
2020-05-06 8:17 ` [PATCH 13/13] ARM: i.MX28: Update defconfig Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox