* [PATCH 0/3] APBH DMA fixes for i.MX7
@ 2018-04-01 1:13 Andrey Smirnov
2018-04-01 1:13 ` [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux Andrey Smirnov
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-04-01 1:13 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Hi everyone:
The following two patches are to fix a case of broken boot I
discovered when I built a mult-image build for i.MX6 and i.MX7 and
tried to boot it on my i.MX7 SabreSD board.
Let me know if anything needs changing.
Thanks,
Andrey Smirnov
Andrey Smirnov (3):
clk: i.MX7: Port NAND clock setup code from Linux
clk: Forward declare struct of_device_id in linux/clk.h
dma: apbh: Enable clock as a part of probing
drivers/clk/imx/clk-imx7.c | 5 +++--
drivers/clk/imx/clk.h | 7 +++++++
drivers/dma/apbh_dma.c | 13 +++++++++++++
include/linux/clk.h | 1 +
4 files changed, 24 insertions(+), 2 deletions(-)
--
2.14.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
@ 2018-04-01 1:13 ` Andrey Smirnov
2018-04-01 1:13 ` [PATCH 2/3] clk: Forward declare struct of_device_id in linux/clk.h Andrey Smirnov
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-04-01 1:13 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Port Linux kernel commit 22039d150f716e4e ("clk: imx7d: create clocks
behind rawnand clock gate") in order to correctly initialize clocks
necessary for APBH DMA block to be functional on i.MX7
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/clk/imx/clk-imx7.c | 5 +++--
drivers/clk/imx/clk.h | 7 +++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/imx/clk-imx7.c b/drivers/clk/imx/clk-imx7.c
index b79c8c301..548f86cbe 100644
--- a/drivers/clk/imx/clk-imx7.c
+++ b/drivers/clk/imx/clk-imx7.c
@@ -676,7 +676,7 @@ static int imx7_ccm_probe(struct device_d *dev)
clks[IMX7D_ENET2_TIME_ROOT_DIV] = imx_clk_divider2("enet2_time_post_div", "enet2_time_pre_div", base + 0xa880, 0, 6);
clks[IMX7D_ENET_PHY_REF_ROOT_DIV] = imx_clk_divider2("enet_phy_ref_post_div", "enet_phy_ref_pre_div", base + 0xa900, 0, 6);
clks[IMX7D_EIM_ROOT_DIV] = imx_clk_divider2("eim_post_div", "eim_pre_div", base + 0xa980, 0, 6);
- clks[IMX7D_NAND_ROOT_DIV] = imx_clk_divider2("nand_post_div", "nand_pre_div", base + 0xaa00, 0, 6);
+ clks[IMX7D_NAND_ROOT_CLK] = imx_clk_divider2("nand_root_clk", "nand_pre_div", base + 0xaa00, 0, 6);
clks[IMX7D_QSPI_ROOT_DIV] = imx_clk_divider2("qspi_post_div", "qspi_pre_div", base + 0xaa80, 0, 6);
clks[IMX7D_USDHC1_ROOT_DIV] = imx_clk_divider2("usdhc1_post_div", "usdhc1_pre_div", base + 0xab00, 0, 6);
clks[IMX7D_USDHC2_ROOT_DIV] = imx_clk_divider2("usdhc2_post_div", "usdhc2_pre_div", base + 0xab80, 0, 6);
@@ -751,7 +751,8 @@ static int imx7_ccm_probe(struct device_d *dev)
clks[IMX7D_ENET_PHY_REF_ROOT_CLK] = imx_clk_gate4("enet_phy_ref_root_clk", "enet_phy_ref_post_div", base + 0x4520, 0);
clks[IMX7D_EIM_ROOT_CLK] = imx_clk_gate4("eim_root_clk", "eim_post_div", base + 0x4160, 0);
- clks[IMX7D_NAND_ROOT_CLK] = imx_clk_gate4("nand_root_clk", "nand_post_div", base + 0x4140, 0);
+ clks[IMX7D_NAND_RAWNAND_CLK] = imx_clk_gate2_shared2("nand_rawnand_clk", "nand_root_clk", base + 0x4140, 0);
+ clks[IMX7D_NAND_USDHC_BUS_RAWNAND_CLK] = imx_clk_gate2_shared2("nand_usdhc_rawnand_clk", "nand_usdhc_root_clk", base + 0x4140, 0);
clks[IMX7D_QSPI_ROOT_CLK] = imx_clk_gate4("qspi_root_clk", "qspi_post_div", base + 0x4150, 0);
clks[IMX7D_USB_CTRL_CLK] = imx_clk_gate4("usb_ctrl_clk", "osc", base + 0x4680, 0);
clks[IMX7D_USB_PHY1_CLK] = imx_clk_gate4("usbphy1_clk", "osc", base + 0x46a0, 0);
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index c46c2614d..71c6f459a 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -80,6 +80,13 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
return clk_gate2(name, parent, reg, shift, 0x3, 0);
}
+static inline struct clk *imx_clk_gate2_shared2(const char *name, const char *parent,
+ void __iomem *reg, u8 shift)
+{
+ return clk_gate2(name, parent, reg, shift, 0x3,
+ CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE);
+}
+
static inline struct clk *imx_clk_gate2_cgr(const char *name, const char *parent,
void __iomem *reg, u8 shift, u8 cgr_val)
{
--
2.14.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] clk: Forward declare struct of_device_id in linux/clk.h
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
2018-04-01 1:13 ` [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux Andrey Smirnov
@ 2018-04-01 1:13 ` Andrey Smirnov
2018-04-01 1:13 ` [PATCH 3/3] dma: apbh: Enable clock as a part of probing Andrey Smirnov
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-04-01 1:13 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Forward declare struct of_device_id in linux/clk.h in order to avoid
warnings like the following:
warning: 'struct of_device_id' declared inside parameter list will not be visible outside
of this definition or declaration
int of_clk_init(struct device_node *root, const struct of_device_id *matches);
^~~~~~~~~~~~
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
include/linux/clk.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 081a85972..c6465b1c9 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -323,6 +323,7 @@ struct clk *clk_register_composite(const char *name,
struct device_node;
struct of_phandle_args;
+struct of_device_id;
#if defined(CONFIG_COMMON_CLK_OF_PROVIDER)
--
2.14.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] dma: apbh: Enable clock as a part of probing
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
2018-04-01 1:13 ` [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux Andrey Smirnov
2018-04-01 1:13 ` [PATCH 2/3] clk: Forward declare struct of_device_id in linux/clk.h Andrey Smirnov
@ 2018-04-01 1:13 ` Andrey Smirnov
2018-04-01 1:13 ` [PATCH] Revert "startup: Load default environment earlier" Andrey Smirnov
2018-04-03 7:12 ` [PATCH 0/3] APBH DMA fixes for i.MX7 Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-04-01 1:13 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Enable clock as a part of probing in order to avoid problems on SoCs
that do not have this block ungated out of reset (e.g. i.MX7).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/dma/apbh_dma.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index b84c0f798..79f25109f 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -17,6 +17,7 @@
#include <dma/apbh-dma.h>
#include <stmp-device.h>
+#include <linux/clk.h>
#include <linux/list.h>
#include <linux/err.h>
#include <common.h>
@@ -55,6 +56,7 @@ enum mxs_dma_id {
struct apbh_dma {
void __iomem *regs;
+ struct clk *clk;
enum mxs_dma_id id;
};
@@ -606,6 +608,17 @@ static int apbh_dma_probe(struct device_d *dev)
apbh->id = id;
+ apbh->clk = clk_get(dev, NULL);
+ if (IS_ERR(apbh->clk))
+ return PTR_ERR(apbh->clk);
+
+ ret = clk_enable(apbh->clk);
+ if (ret) {
+ dev_err(dev, "Failed to enable clock: %s\n",
+ strerror(ret));
+ return ret;
+ }
+
ret = stmp_reset_block(apbh->regs, 0);
if (ret)
return ret;
--
2.14.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Revert "startup: Load default environment earlier"
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
` (2 preceding siblings ...)
2018-04-01 1:13 ` [PATCH 3/3] dma: apbh: Enable clock as a part of probing Andrey Smirnov
@ 2018-04-01 1:13 ` Andrey Smirnov
2018-04-03 7:12 ` [PATCH 0/3] APBH DMA fixes for i.MX7 Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-04-01 1:13 UTC (permalink / raw)
To: Barebox List
From: Sascha Hauer <s.hauer@pengutronix.de>
Several boards use defaultenv_append_directory() to append a board
specific envfs snippet during runtime. This only works when
defaultenv_append_directory() is called before defaultenv_load() is
exectuted. Since that was executed at the end of the start process
every initcall level could be used to append a env directory. With this
patch only initcall levels earlier than fsdevice_initcall work and
most boards do not cope with this.
Revert this patch until a better solution is found.
Reported-by: Alexander Kurz <akurz@blala.de>
This reverts commit 5b92cfceff38f3a6462a21cf6b69159ad0ae9744.
---
common/startup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index 8940674528..8553849cb3 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -67,9 +67,6 @@ static int mount_root(void)
mount("none", "pstore", "/pstore", NULL);
}
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
- defaultenv_load("/env", 0);
-
return 0;
}
fs_initcall(mount_root);
@@ -82,6 +79,9 @@ static int load_environment(void)
default_environment_path = default_environment_path_get();
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
+ defaultenv_load("/env", 0);
+
envfs_load(default_environment_path, "/env", 0);
nvvar_load();
--
2.16.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] APBH DMA fixes for i.MX7
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
` (3 preceding siblings ...)
2018-04-01 1:13 ` [PATCH] Revert "startup: Load default environment earlier" Andrey Smirnov
@ 2018-04-03 7:12 ` Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2018-04-03 7:12 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Sat, Mar 31, 2018 at 06:13:54PM -0700, Andrey Smirnov wrote:
> Hi everyone:
>
> The following two patches are to fix a case of broken boot I
> discovered when I built a mult-image build for i.MX6 and i.MX7 and
> tried to boot it on my i.MX7 SabreSD board.
>
> Let me know if anything needs changing.
Looks fine, thanks. Applied.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Revert "startup: Load default environment earlier"
@ 2018-03-19 8:29 Sascha Hauer
0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2018-03-19 8:29 UTC (permalink / raw)
To: Barebox List
Several boards use defaultenv_append_directory() to append a board
specific envfs snippet during runtime. This only works when
defaultenv_append_directory() is called before defaultenv_load() is
exectuted. Since that was executed at the end of the start process
every initcall level could be used to append a env directory. With this
patch only initcall levels earlier than fsdevice_initcall work and
most boards do not cope with this.
Revert this patch until a better solution is found.
Reported-by: Alexander Kurz <akurz@blala.de>
This reverts commit 5b92cfceff38f3a6462a21cf6b69159ad0ae9744.
---
common/startup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index 8940674528..8553849cb3 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -67,9 +67,6 @@ static int mount_root(void)
mount("none", "pstore", "/pstore", NULL);
}
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
- defaultenv_load("/env", 0);
-
return 0;
}
fs_initcall(mount_root);
@@ -82,6 +79,9 @@ static int load_environment(void)
default_environment_path = default_environment_path_get();
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
+ defaultenv_load("/env", 0);
+
envfs_load(default_environment_path, "/env", 0);
nvvar_load();
--
2.16.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-04-03 7:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01 1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
2018-04-01 1:13 ` [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux Andrey Smirnov
2018-04-01 1:13 ` [PATCH 2/3] clk: Forward declare struct of_device_id in linux/clk.h Andrey Smirnov
2018-04-01 1:13 ` [PATCH 3/3] dma: apbh: Enable clock as a part of probing Andrey Smirnov
2018-04-01 1:13 ` [PATCH] Revert "startup: Load default environment earlier" Andrey Smirnov
2018-04-03 7:12 ` [PATCH 0/3] APBH DMA fixes for i.MX7 Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2018-03-19 8:29 [PATCH] Revert "startup: Load default environment earlier" Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox