* [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks
@ 2014-04-28 1:38 Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter Marek Vasut
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Marek Vasut @ 2014-04-28 1:38 UTC (permalink / raw)
To: u-boot
Add board-specific callbacks for enabling/disabling port power
into the MXS EHCI controller driver. This is in-line with the
names of callbacks on other systems.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
drivers/usb/host/ehci-mxs.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c
index 4d652b3..6b8d969 100644
--- a/drivers/usb/host/ehci-mxs.c
+++ b/drivers/usb/host/ehci-mxs.c
@@ -77,6 +77,16 @@ static int ehci_mxs_toggle_clock(const struct ehci_mxs_port *port, int enable)
return 0;
}
+int __weak board_ehci_hcd_init(int port)
+{
+ return 0;
+}
+
+int __weak board_ehci_hcd_exit(int port)
+{
+ return 0;
+}
+
int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
{
@@ -90,6 +100,10 @@ int ehci_hcd_init(int index, enum usb_init_type init,
return -EINVAL;
}
+ ret = board_ehci_hcd_init(index);
+ if (ret)
+ return ret;
+
port = &mxs_port[index];
/* Reset the PHY block */
@@ -154,5 +168,7 @@ int ehci_hcd_stop(int index)
/* Disable USB clock */
ret = ehci_mxs_toggle_clock(port, 0);
+ board_ehci_hcd_exit(index);
+
return ret;
}
--
1.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
@ 2014-04-28 1:38 ` Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 3/5] arm: mxs: Wait for DRAM to start Marek Vasut
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-04-28 1:38 UTC (permalink / raw)
To: u-boot
According to i.MX23 datasheet Table 32-17, we must wait for the supply
to settle before disabling the current limiter. Indeed, not waiting a
little here causes the system to crash at times.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index 3baf4dd..de8841a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -240,9 +240,14 @@ static void mx23_mem_setup_vddmem(void)
struct mxs_power_regs *power_regs =
(struct mxs_power_regs *)MXS_POWER_BASE;
+ /* We must wait before and after disabling the current limiter! */
+ early_delay(10000);
+
clrbits_le32(&power_regs->hw_power_vddmemctrl,
POWER_VDDMEMCTRL_ENABLE_ILIMIT);
+ early_delay(10000);
+
}
static void mx23_mem_init(void)
--
1.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 3/5] arm: mxs: Wait for DRAM to start
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter Marek Vasut
@ 2014-04-28 1:38 ` Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 4/5] arm: mxs: olinuxino: Enable USB only when needed Marek Vasut
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-04-28 1:38 UTC (permalink / raw)
To: u-boot
Instead of waiting for a fixed period of time and hoping for the best
that the DRAM will start, read back an EMI status register which tells
us exactly when the DRAM started.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
NOTE: It's interesting that Freescale failed to document this register
in the i.MX23 datasheet, thus this part is undocumented.
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index de8841a..97ef67d 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -274,7 +274,13 @@ static void mx23_mem_init(void)
setbits_le32(MXS_DRAM_BASE + 0x20, 1 << 16);
clrbits_le32(MXS_DRAM_BASE + 0x40, 1 << 17);
- early_delay(20000);
+
+ /* Wait for EMI_STAT bit DRAM_HALTED */
+ for (;;) {
+ if (!(readl(MXS_EMI_BASE + 0x10) & (1 << 1)))
+ break;
+ early_delay(1000);
+ }
/* Adjust EMI port priority. */
clrsetbits_le32(0x80020000, 0x1f << 16, 0x2);
--
1.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 4/5] arm: mxs: olinuxino: Enable USB only when needed
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 3/5] arm: mxs: Wait for DRAM to start Marek Vasut
@ 2014-04-28 1:38 ` Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 5/5] arm: mxs: olinuxino: Fine-tune DRAM configuration Marek Vasut
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-04-28 1:38 UTC (permalink / raw)
To: u-boot
Enable the power to the USB port only when the USB port is really needed.
Do not enable the power unconditionally.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
board/olimex/mx23_olinuxino/mx23_olinuxino.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index e2a03a1..65cbbf1 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -30,13 +30,25 @@ int board_early_init_f(void)
/* SSP0 clock at 96MHz */
mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
+ return 0;
+}
+
#ifdef CONFIG_CMD_USB
- /* Enable LAN9512 */
+int board_ehci_hcd_init(int port)
+{
+ /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
-#endif
+ udelay(100);
+ return 0;
+}
+int board_ehci_hcd_exit(int port)
+{
+ /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
+ gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0);
return 0;
}
+#endif
int dram_init(void)
{
--
1.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 5/5] arm: mxs: olinuxino: Fine-tune DRAM configuration
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
` (2 preceding siblings ...)
2014-04-28 1:38 ` [U-Boot] [PATCH 4/5] arm: mxs: olinuxino: Enable USB only when needed Marek Vasut
@ 2014-04-28 1:38 ` Marek Vasut
2014-06-12 22:03 ` [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-04-28 1:38 UTC (permalink / raw)
To: u-boot
Add fine-tuning for the DRAM configuration according to the DRAM chip
datasheet. THis configuration applies to both Hynix HY5DU12622DTP and
Samsung K5H511538J-D43 .
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
board/olimex/mx23_olinuxino/mx23_olinuxino.c | 30 ++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index 65cbbf1..313ab20 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -78,3 +78,33 @@ int board_init(void)
return 0;
}
+
+/* Fine-tune the DRAM configuration. */
+void mxs_adjust_memory_params(uint32_t *dram_vals)
+{
+ /* Enable Auto Precharge. */
+ dram_vals[3] |= 1 << 8;
+ /* Enable Fast Writes. */
+ dram_vals[5] |= 1 << 8;
+ /* tEMRS = 3*tCK */
+ dram_vals[10] &= ~(0x3 << 8);
+ dram_vals[10] |= (0x3 << 8);
+ /* CASLAT = 3*tCK */
+ dram_vals[11] &= ~(0x3 << 0);
+ dram_vals[11] |= (0x3 << 0);
+ /* tCKE = 1*tCK */
+ dram_vals[12] &= ~(0x7 << 0);
+ dram_vals[12] |= (0x1 << 0);
+ /* CASLAT_LIN_GATE = 3*tCK , CASLAT_LIN = 3*tCK, tWTR=2*tCK */
+ dram_vals[13] &= ~((0xf << 16) | (0xf << 24) | (0xf << 0));
+ dram_vals[13] |= (0x6 << 16) | (0x6 << 24) | (0x2 << 0);
+ /* tDAL = 6*tCK */
+ dram_vals[15] &= ~(0xf << 16);
+ dram_vals[15] |= (0x6 << 16);
+ /* tREF = 1040*tCK */
+ dram_vals[26] &= ~0xffff;
+ dram_vals[26] |= 0x0410;
+ /* tRAS_MAX = 9334*tCK */
+ dram_vals[32] &= ~0xffff;
+ dram_vals[32] |= 0x2475;
+}
--
1.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
` (3 preceding siblings ...)
2014-04-28 1:38 ` [U-Boot] [PATCH 5/5] arm: mxs: olinuxino: Fine-tune DRAM configuration Marek Vasut
@ 2014-06-12 22:03 ` Marek Vasut
2014-09-24 10:53 ` Marek Vasut
2014-09-29 7:03 ` Stefano Babic
6 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-06-12 22:03 UTC (permalink / raw)
To: u-boot
On Monday, April 28, 2014 at 03:38:39 AM, Marek Vasut wrote:
> Add board-specific callbacks for enabling/disabling port power
> into the MXS EHCI controller driver. This is in-line with the
> names of callbacks on other systems.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
Do you mind picking it all?
Thanks!
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
` (4 preceding siblings ...)
2014-06-12 22:03 ` [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
@ 2014-09-24 10:53 ` Marek Vasut
2014-09-25 8:25 ` Stefano Babic
2014-09-29 7:03 ` Stefano Babic
6 siblings, 1 reply; 9+ messages in thread
From: Marek Vasut @ 2014-09-24 10:53 UTC (permalink / raw)
To: u-boot
On Monday, April 28, 2014 at 03:38:39 AM, Marek Vasut wrote:
> Add board-specific callbacks for enabling/disabling port power
> into the MXS EHCI controller driver. This is in-line with the
> names of callbacks on other systems.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
This series seems to be still not applied.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks
2014-09-24 10:53 ` Marek Vasut
@ 2014-09-25 8:25 ` Stefano Babic
0 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2014-09-25 8:25 UTC (permalink / raw)
To: u-boot
On 24/09/2014 12:53, Marek Vasut wrote:
> On Monday, April 28, 2014 at 03:38:39 AM, Marek Vasut wrote:
>> Add board-specific callbacks for enabling/disabling port power
>> into the MXS EHCI controller driver. This is in-line with the
>> names of callbacks on other systems.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Stefano Babic <sbabic@denx.de>
>
> This series seems to be still not applied.
>
Right, I pick it up
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
` (5 preceding siblings ...)
2014-09-24 10:53 ` Marek Vasut
@ 2014-09-29 7:03 ` Stefano Babic
6 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2014-09-29 7:03 UTC (permalink / raw)
To: u-boot
Hi Marek,
On 28/04/2014 03:38, Marek Vasut wrote:
> Add board-specific callbacks for enabling/disabling port power
> into the MXS EHCI controller driver. This is in-line with the
> names of callbacks on other systems.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
Series applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-29 7:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 1:38 [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 3/5] arm: mxs: Wait for DRAM to start Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 4/5] arm: mxs: olinuxino: Enable USB only when needed Marek Vasut
2014-04-28 1:38 ` [U-Boot] [PATCH 5/5] arm: mxs: olinuxino: Fine-tune DRAM configuration Marek Vasut
2014-06-12 22:03 ` [U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks Marek Vasut
2014-09-24 10:53 ` Marek Vasut
2014-09-25 8:25 ` Stefano Babic
2014-09-29 7:03 ` Stefano Babic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.