Hi,
I'm working on getting a userspace EIM application working on a 6sololite board using the 3.14.28 kernel. I had modified my devicetree dts to add the weim interface. While trying to figure that part out, I noticed that drivers/bus/imx-weim.c on 3.14.28 only lists the following:
static const struct of_device_id weim_id_table[] = {
/* i.MX1/21 */
{ .compatible = "fsl,imx1-weim", .data = &imx1_weim_devtype, },
/* i.MX25/27/31/35 */
{ .compatible = "fsl,imx27-weim", .data = &imx27_weim_devtype, },
/* i.MX50/53/6Q */
{ .compatible = "fsl,imx50-weim", .data = &imx50_weim_devtype, },
{ .compatible = "fsl,imx6q-weim", .data = &imx50_weim_devtype, },
/* i.MX51 */
{ .compatible = "fsl,imx51-weim", .data = &imx51_weim_devtype, },
{ }
};
Searching for imx6sl-weim gets no hits. Does that mean the imx-weim driver is not compatible with imx6sl? My guess is that it is not. It looks like I would need to add some 6sl specific handling for the clock setup. Also:
static const struct imx_weim_devtype imx50_weim_devtype = {
.cs_count = 4,
.cs_regs_count = 6,
.cs_stride = 0x18,
};
If I'm mistaken, please help point me to a 6sl example that uses imx-weim in its device tree config.
Thanks!
ps: Igor, if you reply, please do NOT mark as Assumed Answered until I have a chance to reply! At least give me 2-3 days to try any suggestions rather than assuming that your "answer" is the solution. Thanks for understanding!
"fsl,imx6q-weim" is included in
imx6sx.dtsi
linux-2.6-imx.git - Freescale i.MX Linux Tree
Best regards
igor
Hi Igor,
Thanks for your reply. Now I understand your meaning.
Ok, in my case, when I test, I'm getting:
io scheduler deadline registered
io scheduler cfq registered (default)
imx-weim: probe of 21b8000.weim failed with error -2
After adding debug to imx-weim, I found the error is actually due to the clock setup.
imx-weim 21b8000.weim: fail on clk get.
imx-weim: probe of 21b8000.weim failed with error -2
Which is from the following code in imx-weim:
clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "fail on clk get.\n");
So it looks like the root cause is my clock setup in the dts.
Previously on 3.0.35, in my board setup I was setting my EMI clock to 66MHz using:
/* CLKCTL_CCGR6: Set emi_slow_clock to be on in all modes */
printk(KERN_ERR "setting EMI slow clock to always be on\n");
reg = readl(ccm_reg + 0x80);
reg |= 0x00000C00;
writel(reg, ccm_reg + 0x80);
printk(KERN_ERR "setting CLKCTL_CCGR6 to be 0x%x\n", reg);
clk = clk_get(NULL, "emi_slow_clk");
if (IS_ERR(clk))
printk(KERN_ERR "emi_slow_clk not found\n");
...
ret = clk_set_rate(clk, clk_round_rate(clk, 66000000));
It looks like I'll need to figure out arch/arm/mach-imx/clk-imx6sl.c to add a suitable clock for EIM there.
Thanks!
I added the following patch:
--- a/include/dt-bindings/clock/imx6sl-clock.h
+++ b/include/dt-bindings/clock/imx6sl-clock.h
@@ -175,7 +175,8 @@
#define IMX6SL_CLK_SSI3_IPG 162
#define IMX6SL_CLK_UART_OSC_4M 163
#define IMX6SL_CLK_SPDIF_GCLK 164
-#define IMX6SL_CLK_END 165
+#define IMX6SL_CLK_EIM_SLOW 165
+#define IMX6SL_CLK_END 166
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -415,6 +415,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
clks[IMX6SL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4);
clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
+ clks[IMX6SL_CLK_EIM_SLOW] = imx_clk_gate2("eim", "perclk", base + 0x80, 10);
for (i = 0; i < ARRAY_SIZE(clks); i++)
if (IS_ERR(clks[i]))
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -903,8 +903,9 @@
};
weim: weim@021b8000 {
+ compatible = "fsl,imx6sx-weim", "fsl,imx6q-weim";
reg = <0x021b8000 0x4000>;
- interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX6SL_CLK_EIM_SLOW>;
};
ocotp: ocotp-ctrl@021bc000 {
Seems to bootup but no EIM transactions working yet.
I was expecting clock rate to be 66MHz but looks like it is 24MHz.
root@imx6slevk:~# cat /sys/kernel/debug/clk/osc/perclk_sel/perclk/eim/clk_rate
24000000
Hi Jaya
i.MX6SL weim module is the same as in i.MX6SX,UL
so one can look for example working configuration for
imx6sx-19x19-arm2.dts:
linux-2.6-imx.git - Freescale i.MX Linux Tree
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor,
Thanks for your reply. But I'm confused. I'm asking about the imx-weim driver specifically, whereas the imx6sx-19x19-arm2.dts example uses the nor driver. This is the section of code in the imx6sx dts that is relevant:
nor@0,0 { | ||
compatible = "cfi-flash"; |
Whereas what I was saying is that if we put compatible = "imx-weim", then it would not work on 6sl because the imx-weim driver doesn't have a 6sl id included.
static const struct of_device_id weim_id_table[] = {
/* i.MX1/21 */
{ .compatible = "fsl,imx1-weim", .data = &imx1_weim_devtype, },
/* i.MX25/27/31/35 */
{ .compatible = "fsl,imx27-weim", .data = &imx27_weim_devtype, },
/* i.MX50/53/6Q */
{ .compatible = "fsl,imx50-weim", .data = &imx50_weim_devtype, },
{ .compatible = "fsl,imx6q-weim", .data = &imx50_weim_devtype, },
/* i.MX51 */
{ .compatible = "fsl,imx51-weim", .data = &imx51_weim_devtype, },
{ }
};
Thanks,
jaya
Hi Jaya
mentioned i.MX6SX example also has not "6sx id included", however it works.
Seems "fsl,imx6q-weim", .compatible = "fsl,imx6q-weim" records are sufficient for correct operation.
Best regards
igor
Hi Igor,
I'm not sure why you're saying "it works". I thought I gave an explanation of the difference above. The imx6sx example does not use the imx-weim driver, it uses cfi-flash which is a different driver (it is only for nor flash) than imx-weim which is what the subject of this is. The reason for using imx-weim is that I'm interfacing with an fpga in userspace, not a flash chip.
Thanks!
Hi Jaya
I believe i.MX6SX uses imx-weim driver, for interfacing fpga
one can use "nor flash" configuration or reuse it.
Best regards
igor
Igor,
"I believe i.MX6SX uses imx-weim driver"
I'm not able to follow this logic. You mentioned compatible = "fsl,imx6q-weim" which does not exist in that dts or any dts in the arch/arm/boot/dts directory. Could you check where you got that from because it is not in imx6sx-19x19-arm2.dts.
Eg:
linux-imx/3.14.28-r0/git$ egrep "imx6q-weim" arch/arm/boot/dts/*
linux-imx/3.14.28-r0/git$
The only place where "imx6q-weim" is mentioned is in Documentation/devicetree/bindings/bus/imx-weim.txt.
Thanks!