Re: [U-Boot] [RFC 1/6] odroid: exynos: USB initialization on the U3/X2

2019-04-03 Thread Tobias Jakobi
Hello,

in case this isn't totally obvious, I want to state it here again: THIS IS A 
HACK!

This patch of mine was never meant for upstream submission. Note that the
original commit has a TODO included, which again makes clear: This is not the
proper way to do it. It's a quick solution because I needed booting via
tftp. Nothing more.

I have seen this plently of times now. Anand Moon takes some code, tinkers
around with it and then presents it for review. The problem is that he doesn't
even bother to understand what he's doing and when he arrives at something
semi-working, it is more by chance than anything else. I feel sorry for
Krzysztof (and others), who, with the patience of a monk to say the least, has
to deal with this time and time again.

- Tobias



Anand Moon wrote:
> From: Tobias Jakobi 
> 
> Rename board_usb_init() to exynos_usb_init() and call it
> early in the Exynos EHCI driver when probing.
> 
> This kind of works. After a 'usb start; usb stop; usb start'
> cycle the attached devices are recognized.
> 
> Add small delay between gpio_direction_output to stable
> initialization of usb gpio pins.
> 
> Signed-off-by: Tobias Jakobi 
> Signed-off-by: Anand Moon 
> ---
> Reoder the exynos_usb_init so that "usb start" command initialization
> correcly.
> ---
> ---
>  board/samsung/odroid/odroid.c  | 14 +-
>  drivers/usb/host/ehci-exynos.c |  7 +++
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> index 3e594fd850..79d14ead01 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
>  };
>  #endif
>  
> -#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
> -
>  static void set_usb3503_ref_clk(void)
>  {
>  #ifdef CONFIG_BOARD_TYPES
> @@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
>  #endif /* CONFIG_BOARD_TYPES */
>  }
>  
> -int board_usb_init(int index, enum usb_init_type init)
> +int exynos_usb_init(void)
>  {
> -#ifdef CONFIG_CMD_USB
>   struct udevice *dev;
>   int ret;
>  
> @@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type init)
>   /* Disconnect, Reset, Connect */
>   gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
>   gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
> + sdelay(20);
>   gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
>   gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
>  
> @@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type init)
>   pr_err("Regulator %s value setting error: %d\n", dev->name, 
> ret);
>   return ret;
>   }
> -#endif
> +
> + return 0;
> +}
> +
> +#ifdef CONFIG_USB_GADGET
> +int board_usb_init(int index, enum usb_init_type init)
> +{
>   debug("USB_udc_probe\n");
>   return dwc2_udc_probe(_otg_data);
>  }
> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> index fabc662eb6..b0f7bd4936 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
>   struct gpio_desc vbus_gpio;
>  };
>  
> +extern int exynos_usb_init(void);
> +
>  /**
>   * Contains pointers to register base addresses
>   * for the usb controller.
> @@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct 
> exynos4412_usb_phy *usb)
>   setbits_le32(>usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
>   udelay(10);
>   clrbits_le32(>usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
> +
> + /*
> +  * "usb start" initialize the usb driver
> +  */
> + exynos_usb_init();
>  }
>  
>  static void setup_usb_phy(struct exynos_usb_phy *usb)
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 4/4] exynos: more debug and cleanup in do_sdhci_init()

2015-10-05 Thread Tobias Jakobi
Add more debug printfs in do_sdhci_init() for calls
that can potentially fail.

Acked-by: Przemyslaw Marczak <p.marc...@samsung.com>
Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index b203bee..15ecfee 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -101,29 +101,31 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
 
 static int do_sdhci_init(struct sdhci_host *host)
 {
-   int dev_id, flag;
-   int err = 0;
+   int dev_id, flag, ret;
 
flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
dev_id = host->index + PERIPH_ID_SDMMC0;
 
if (dm_gpio_is_valid(>pwr_gpio)) {
dm_gpio_set_value(>pwr_gpio, 1);
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
debug("MMC not configured\n");
-   return err;
+   return ret;
}
}
 
if (dm_gpio_is_valid(>cd_gpio)) {
-   if (dm_gpio_get_value(>cd_gpio))
+   ret = dm_gpio_get_value(>cd_gpio);
+   if (ret) {
+   debug("no SD card detected (%d)\n", ret);
return -ENODEV;
+   }
 
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
printf("external SD not configured\n");
-   return err;
+   return ret;
}
}
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/4] exynos: Fix passing of errors in exynos_mmc_init()

2015-10-05 Thread Tobias Jakobi
exynos_mmc_init() always returns zero, so for the caller
it looks like it never fails.

Correct this by returning the error code of process_nodes().
For process_nodes() do something similar and return early
when do_sdhci_init() fails.

v2: Only fail in process_nodes() if we fail on all
available nodes.

Acked-by: Przemyslaw Marczak <p.marc...@samsung.com>
Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 911e7a8..bd9e014 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -171,6 +171,7 @@ static int process_nodes(const void *blob, int node_list[], 
int count)
 {
struct sdhci_host *host;
int i, node;
+   int failed = 0;
 
debug("%s: count = %d\n", __func__, count);
 
@@ -184,11 +185,18 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
 
if (sdhci_get_config(blob, node, host)) {
printf("%s: failed to decode dev %d\n", __func__, i);
-   return -1;
+   failed++;
+   continue;
+   }
+
+   if (do_sdhci_init(host)) {
+   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   failed++;
}
-   do_sdhci_init(host);
}
-   return 0;
+
+   /* we only consider it an error when all nodes fail */
+   return (failed == count ? -1 : 0);
 }
 
 int exynos_mmc_init(const void *blob)
@@ -200,8 +208,6 @@ int exynos_mmc_init(const void *blob)
COMPAT_SAMSUNG_EXYNOS_MMC, node_list,
SDHCI_MAX_HOSTS);
 
-   process_nodes(blob, node_list, count);
-
-   return 0;
+   return process_nodes(blob, node_list, count);
 }
 #endif
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/4] exynos: be more verbose in process_nodes()

2015-10-05 Thread Tobias Jakobi
In case sdhci_get_config() or do_sdhci_init() fail, show
the error code that was returned.

Acked-by: Przemyslaw Marczak <p.marc...@samsung.com>
Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index bd9e014..b203bee 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -170,7 +170,7 @@ static int sdhci_get_config(const void *blob, int node, 
struct sdhci_host *host)
 static int process_nodes(const void *blob, int node_list[], int count)
 {
struct sdhci_host *host;
-   int i, node;
+   int i, node, ret;
int failed = 0;
 
debug("%s: count = %d\n", __func__, count);
@@ -183,14 +183,16 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
 
host = _host[i];
 
-   if (sdhci_get_config(blob, node, host)) {
-   printf("%s: failed to decode dev %d\n", __func__, i);
+   ret = sdhci_get_config(blob, node, host);
+   if (ret) {
+   printf("%s: failed to decode dev %d (%d)\n",
__func__, i, ret);
failed++;
continue;
}
 
-   if (do_sdhci_init(host)) {
-   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   ret = do_sdhci_init(host);
+   if (ret) {
+   printf("%s: failed to initialize dev %d (%d)\n", 
__func__, i, ret);
failed++;
}
}
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/4] exynos: Properly zero initialize host in s5p_sdhci_init()

2015-10-05 Thread Tobias Jakobi
This makes sure that setting the host_caps in s5p_sdhci_core_init()
doesn't operate on potentially uninitialized memory.

Acked-by: Lukasz Majewski <l.majew...@samsung.com>
Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 4db51d6..911e7a8 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -84,9 +84,9 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
 
 int s5p_sdhci_init(u32 regbase, int index, int bus_width)
 {
-   struct sdhci_host *host = malloc(sizeof(struct sdhci_host));
+   struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
if (!host) {
-   printf("sdhci__host malloc fail!\n");
+   printf("sdhci__host allocation fail!\n");
return 1;
}
host->ioaddr = (void *)regbase;
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] exynos: be more verbose in process_nodes()

2015-09-26 Thread Tobias Jakobi
In case sdhci_get_config() or do_sdhci_init() fail, show
the error code that was returned.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index b461fde..b60bc23 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -171,7 +171,7 @@ static int sdhci_get_config(const void *blob, int node, 
struct sdhci_host *host)
 static int process_nodes(const void *blob, int node_list[], int count)
 {
struct sdhci_host *host;
-   int i, node;
+   int i, node, ret;
int failed = 0;
 
debug("%s: count = %d\n", __func__, count);
@@ -184,14 +184,16 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
 
host = _host[i];
 
-   if (sdhci_get_config(blob, node, host)) {
-   printf("%s: failed to decode dev %d\n", __func__, i);
+   ret = sdhci_get_config(blob, node, host);
+   if (ret) {
+   printf("%s: failed to decode dev %d (%d)\n",
__func__, i, ret);
failed++;
continue;
}
 
-   if (do_sdhci_init(host)) {
-   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   ret = do_sdhci_init(host);
+   if (ret) {
+   printf("%s: failed to initialize dev %d (%d)\n", 
__func__, i, ret);
failed++;
}
}
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 4/4] exynos: more debug and cleanup in do_sdhci_init()

2015-09-26 Thread Tobias Jakobi
Add more debug printfs in do_sdhci_init() for calls
that can potentially fail.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index b60bc23..f88d76b 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -102,29 +102,31 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
 
 static int do_sdhci_init(struct sdhci_host *host)
 {
-   int dev_id, flag;
-   int err = 0;
+   int dev_id, flag, ret;
 
flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
dev_id = host->index + PERIPH_ID_SDMMC0;
 
if (dm_gpio_is_valid(>pwr_gpio)) {
dm_gpio_set_value(>pwr_gpio, 1);
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
debug("MMC not configured\n");
-   return err;
+   return ret;
}
}
 
if (dm_gpio_is_valid(>cd_gpio)) {
-   if (dm_gpio_get_value(>cd_gpio))
+   ret = dm_gpio_get_value(>cd_gpio);
+   if (ret) {
+   debug("no SD card detected (%d)\n", ret);
return -ENODEV;
+   }
 
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
printf("external SD not configured\n");
-   return err;
+   return ret;
}
}
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] exynos: Properly initialize host_caps in s5p_sdhci_core_init()

2015-09-26 Thread Tobias Jakobi
The sdhci_host struct is allocated in s5p_sdhci_init() but the
fields are not initialized.

Acked-by: Lukasz Majewski <l.majew...@samsung.com>
Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 4db51d6..e9c43a9 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -76,6 +76,7 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
host->set_control_reg = _sdhci_set_control_reg;
host->set_clock = set_mmc_clk;
 
+   host->host_caps = 0;
if (host->bus_width == 8)
host->host_caps |= MMC_MODE_8BIT;
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] exynos: Fix passing of errors in exynos_mmc_init()

2015-09-26 Thread Tobias Jakobi
exynos_mmc_init() always returns zero, so for the caller
it looks like it never fails.

Correct this by returning the error code of process_nodes().
For process_nodes() do something similar and return early
when do_sdhci_init() fails.

v2: Only fail in process_nodes() if we fail on all
available nodes.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index e9c43a9..b461fde 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -172,6 +172,7 @@ static int process_nodes(const void *blob, int node_list[], 
int count)
 {
struct sdhci_host *host;
int i, node;
+   int failed = 0;
 
debug("%s: count = %d\n", __func__, count);
 
@@ -185,11 +186,18 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
 
if (sdhci_get_config(blob, node, host)) {
printf("%s: failed to decode dev %d\n", __func__, i);
-   return -1;
+   failed++;
+   continue;
+   }
+
+   if (do_sdhci_init(host)) {
+   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   failed++;
}
-   do_sdhci_init(host);
}
-   return 0;
+
+   /* we only consider it an error when all nodes fail */
+   return (failed == count ? -1 : 0);
 }
 
 int exynos_mmc_init(const void *blob)
@@ -201,8 +209,6 @@ int exynos_mmc_init(const void *blob)
COMPAT_SAMSUNG_EXYNOS_MMC, node_list,
SDHCI_MAX_HOSTS);
 
-   process_nodes(blob, node_list, count);
-
-   return 0;
+   return process_nodes(blob, node_list, count);
 }
 #endif
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] exynos: fix and cleanup do_sdhci_init()

2015-09-24 Thread Tobias Jakobi
Hello,


Minkyu Kang wrote:
> On 23/09/15 18:59, Jaehoon Chung wrote:
>> Hi,
>>
>> On 09/23/2015 06:48 PM, Lukasz Majewski wrote:
>>> Hi Lukasz,
>>>
>>>> Hi Tobias,
>>>>
>>>>> The CD check is currently inverted. dm_gpio_get_value() returns
>>>>> one when a card is detected. All other values (zero when there
>>>>> is no card, or negative values for the internal errors) indicate
>>>>> failure.
>>>>>
>>>>> Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
>>>>> ---
>>>>>  drivers/mmc/s5p_sdhci.c | 20 +++-
>>>>>  1 file changed, 11 insertions(+), 9 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
>>>>> index 6be3609..bc04370 100644
>>>>> --- a/drivers/mmc/s5p_sdhci.c
>>>>> +++ b/drivers/mmc/s5p_sdhci.c
>>>>> @@ -102,29 +102,31 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
>>>>>  
>>>>>  static int do_sdhci_init(struct sdhci_host *host)
>>>>>  {
>>>>> - int dev_id, flag;
>>>>> - int err = 0;
>>>>> + int dev_id, flag, ret;
>>>>>  
>>>>>   flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE :
>>>>> PINMUX_FLAG_NONE; dev_id = host->index + PERIPH_ID_SDMMC0;
>>>>>  
>>>>>   if (dm_gpio_is_valid(>pwr_gpio)) {
>>>>>   dm_gpio_set_value(>pwr_gpio, 1);
>>>>> - err = exynos_pinmux_config(dev_id, flag);
>>>>> - if (err) {
>>>>> + ret = exynos_pinmux_config(dev_id, flag);
>>>>> + if (ret) {
>>>>>   debug("MMC not configured\n");
>>>>> - return err;
>>>>> + return ret;
>>>>>   }
>>>>>   }
>>>>>  
>>>>>   if (dm_gpio_is_valid(>cd_gpio)) {
>>>>> - if (dm_gpio_get_value(>cd_gpio))
>>>>> + ret = dm_gpio_get_value(>cd_gpio);
>>>>> + if (ret != 1) {
>>>>> + debug("No card detected (%d)\n", ret);
>>>>>   return -ENODEV;
>>>>> + }
>>>>>  
>>>>> - err = exynos_pinmux_config(dev_id, flag);
>>>>> - if (err) {
>>>>> + ret = exynos_pinmux_config(dev_id, flag);
>>>>> + if (ret) {
>>>>>   printf("external SD not configured\n");
>>>>> - return err;
>>>>> + return ret;
>>>>>   }
>>>>>   }
>>>>>  
>>>>
>>>> Reviewed-by: Lukasz Majewski <l.majew...@samsung.com>
>>>>
>>>
>>> Sorry, I was too fast. I've read the whole thread and I can confirm
>>> that your change would break Trats board.
>>> ry
>>> I hope that we will come up with proper solution.
>>
>> We can use the "cd-inverted" property like linux-kernel.
>> Then i think that all board based on exynos4412 can cover.
>> how about?
I don't think this is going to work. I asked someone else to check
current upstream u-boot on his Odroid-U3 and he has confirmed that it
boots fine from SD card.

So this seems to be a X2 specific thing. However the 'cd-inverted'
property is present in exynos4412-odroid-common.dtsi, so it applies to
both U3 and X2 in the kernel.

So either the kernel is wrong here, or this is board difference which
can't be derived from 'cd-inverted'.

With best wishes,
Tobias





>>
> 
> I agree :)
> 
> Thanks,
> Minkyu Kang.
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] Fix operation on Odroid devices

2015-09-21 Thread Tobias Jakobi
Hello,

Jaehoon Chung wrote:
> Hi,
> 
> On 09/21/2015 08:18 AM, Tobias Jakobi wrote:
>> Hello,
>>
>> currently operation on Exynos4412-based Odroid devices is broken.
>>
>> The bootloader stops with this message:
>> Card did not respond to voltage select!
>> *** Warning - MMC init failed, using default environment
> 
> Which board did you use? and Which cad is failed? SD or eMMC?
This is an Odroid-X2. I'm booting from SD with a Sandisk Extreme. I
don't have any eMMC here.

Actually it was some other person who encountered this issue with his
Odroid-X2 and booting from SD. After he made me aware of it, I also
updated my u-boot (I was then using a version from May 2015, which works
perfectly btw) and encountered the very same issue as him.



> Your [PATCH 4/4] is strange..so i want to get more information.
For me it restores proper operation of the bootloader to the board.


With best wishes,
Tobias


> 
> If you can share more information, i can explain more exactly about your 
> problem.
> 
> Best Regards,
> Jaehoon Chung
> 
>>
>> This series fixes error handling in the s5p sdhci driver
>> and the cause of the issue, which is an inverted card
>> detection check.
>>
>> Thanks goes to Marek Vasut and Sjoerd Simons who helped
>> me on IRC to get this triaged.
>>
>> With best wishes,
>> Tobias
>>
>> Tobias Jakobi (4):
>>   exynos: Properly initialize host_caps in s5p_sdhci_core_init()
>>   exynos: Fix passing of errors in exynos_mmc_init()
>>   exynos: be more verbose in process_nodes()
>>   exynos: fix and cleanup do_sdhci_init()
>>
>>  drivers/mmc/s5p_sdhci.c | 39 +++
>>  1 file changed, 23 insertions(+), 16 deletions(-)
>>
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] Fix operation on Odroid devices

2015-09-21 Thread Tobias Jakobi
Forgot to ask this: What about the first three patches?

- Tobias

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] Fix operation on Odroid devices

2015-09-21 Thread Tobias Jakobi
Hello Jaehoon,


Jaehoon Chung wrote:
> Dear, Tobias.
> 
> On 09/21/2015 06:34 PM, Tobias Jakobi wrote:
>> Hello,
>>
>> Jaehoon Chung wrote:
>>> Hi,
>>>
>>> On 09/21/2015 08:18 AM, Tobias Jakobi wrote:
>>>> Hello,
>>>>
>>>> currently operation on Exynos4412-based Odroid devices is broken.
>>>>
>>>> The bootloader stops with this message:
>>>> Card did not respond to voltage select!
>>>> *** Warning - MMC init failed, using default environment
>>>
>>> Which board did you use? and Which cad is failed? SD or eMMC?
>> This is an Odroid-X2. I'm booting from SD with a Sandisk Extreme. I
>> don't have any eMMC here.
> 
> But if your patch is applied, other exynos4412 and exynos using s5p_sdhci 
> don't work fine for SD-card.
> This case is the specific X2 board. I think schematic is wrong.
> (I have checked the Odrodd_X-base_Rev_06.pdf)
> 
> Commonly, SD-detect pin is supplied to always-on power.
> But odroid-x/u board used the same supplier with I/O line. It's wrong.
I wouldn't know, I don't even know how to properly read these schematics.



> This is H/W mis-designed problem, not code problem.
> Well, I will reproduce your problem with X2 board.
> And if reproduced your problem, I will find other solution, not this. how 
> about?
Sure, as long as this fixes the issue. Let me know if I can test anything.



>> Actually it was some other person who encountered this issue with his
>> Odroid-X2 and booting from SD. After he made me aware of it, I also
>> updated my u-boot (I was then using a version from May 2015, which works
>> perfectly btw) and encountered the very same issue as him.
>>
> 
> Need to consider other SoC. You seems to consider only Odroid based-on 
> exyno4412.
> Did you test other exynos4412 board?
I have only one ARM board here, which is the Odroid-X2. Nothing else.


With best wishes,
Tobias


> 
> Best Regards,
> Jaehoon Chung
> 
>>
>>
>>> Your [PATCH 4/4] is strange..so i want to get more information.
>> For me it restores proper operation of the bootloader to the board.
>>
>>
>> With best wishes,
>> Tobias
>>
>>
>>>
>>> If you can share more information, i can explain more exactly about your 
>>> problem.
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>>
>>>> This series fixes error handling in the s5p sdhci driver
>>>> and the cause of the issue, which is an inverted card
>>>> detection check.
>>>>
>>>> Thanks goes to Marek Vasut and Sjoerd Simons who helped
>>>> me on IRC to get this triaged.
>>>>
>>>> With best wishes,
>>>> Tobias
>>>>
>>>> Tobias Jakobi (4):
>>>>   exynos: Properly initialize host_caps in s5p_sdhci_core_init()
>>>>   exynos: Fix passing of errors in exynos_mmc_init()
>>>>   exynos: be more verbose in process_nodes()
>>>>   exynos: fix and cleanup do_sdhci_init()
>>>>
>>>>  drivers/mmc/s5p_sdhci.c | 39 +++
>>>>  1 file changed, 23 insertions(+), 16 deletions(-)
>>>>
>>>
>>
>>
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/4] Fix operation on Odroid devices

2015-09-20 Thread Tobias Jakobi
Hello,

currently operation on Exynos4412-based Odroid devices is broken.

The bootloader stops with this message:
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment

This series fixes error handling in the s5p sdhci driver
and the cause of the issue, which is an inverted card
detection check.

Thanks goes to Marek Vasut and Sjoerd Simons who helped
me on IRC to get this triaged.

With best wishes,
Tobias

Tobias Jakobi (4):
  exynos: Properly initialize host_caps in s5p_sdhci_core_init()
  exynos: Fix passing of errors in exynos_mmc_init()
  exynos: be more verbose in process_nodes()
  exynos: fix and cleanup do_sdhci_init()

 drivers/mmc/s5p_sdhci.c | 39 +++
 1 file changed, 23 insertions(+), 16 deletions(-)

-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/4] exynos: Fix passing of errors in exynos_mmc_init()

2015-09-20 Thread Tobias Jakobi
exynos_mmc_init() always returns zero, so for the caller
it looks like it never fails.

Correct this by returning the error code of process_nodes().
For process_nodes() do something similar and return early
when do_sdhci_init() fails.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index e9c43a9..bc2102a 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -187,7 +187,11 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
printf("%s: failed to decode dev %d\n", __func__, i);
return -1;
}
-   do_sdhci_init(host);
+
+   if (do_sdhci_init(host)) {
+   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   return -2;
+   }
}
return 0;
 }
@@ -201,8 +205,6 @@ int exynos_mmc_init(const void *blob)
COMPAT_SAMSUNG_EXYNOS_MMC, node_list,
SDHCI_MAX_HOSTS);
 
-   process_nodes(blob, node_list, count);
-
-   return 0;
+   return process_nodes(blob, node_list, count);
 }
 #endif
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] exynos: Properly initialize host_caps in s5p_sdhci_core_init()

2015-09-20 Thread Tobias Jakobi
The sdhci_host struct is allocated in s5p_sdhci_init() but the
fields are not initialized.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 4db51d6..e9c43a9 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -76,6 +76,7 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
host->set_control_reg = _sdhci_set_control_reg;
host->set_clock = set_mmc_clk;
 
+   host->host_caps = 0;
if (host->bus_width == 8)
host->host_caps |= MMC_MODE_8BIT;
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/4] exynos: be more verbose in process_nodes()

2015-09-20 Thread Tobias Jakobi
In case sdhci_get_config() or do_sdhci_init() fail, show
the error code that was returned.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index bc2102a..6be3609 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -171,7 +171,7 @@ static int sdhci_get_config(const void *blob, int node, 
struct sdhci_host *host)
 static int process_nodes(const void *blob, int node_list[], int count)
 {
struct sdhci_host *host;
-   int i, node;
+   int i, node, ret;
 
debug("%s: count = %d\n", __func__, count);
 
@@ -183,13 +183,15 @@ static int process_nodes(const void *blob, int 
node_list[], int count)
 
host = _host[i];
 
-   if (sdhci_get_config(blob, node, host)) {
-   printf("%s: failed to decode dev %d\n", __func__, i);
+   ret = sdhci_get_config(blob, node, host);
+   if (ret) {
+   printf("%s: failed to decode dev %d (%d)\n", __func__, 
i, ret);
return -1;
}
 
-   if (do_sdhci_init(host)) {
-   printf("%s: failed to initialize dev %d\n", __func__, 
i);
+   ret = do_sdhci_init(host);
+   if (ret) {
+   printf("%s: failed to initialize dev %d (%d)\n", 
__func__, i, ret);
return -2;
}
}
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] exynos: fix and cleanup do_sdhci_init()

2015-09-20 Thread Tobias Jakobi
The CD check is currently inverted. dm_gpio_get_value() returns
one when a card is detected. All other values (zero when there
is no card, or negative values for the internal errors) indicate
failure.

Signed-off-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de>
---
 drivers/mmc/s5p_sdhci.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 6be3609..bc04370 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -102,29 +102,31 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
 
 static int do_sdhci_init(struct sdhci_host *host)
 {
-   int dev_id, flag;
-   int err = 0;
+   int dev_id, flag, ret;
 
flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
dev_id = host->index + PERIPH_ID_SDMMC0;
 
if (dm_gpio_is_valid(>pwr_gpio)) {
dm_gpio_set_value(>pwr_gpio, 1);
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
debug("MMC not configured\n");
-   return err;
+   return ret;
}
}
 
if (dm_gpio_is_valid(>cd_gpio)) {
-   if (dm_gpio_get_value(>cd_gpio))
+   ret = dm_gpio_get_value(>cd_gpio);
+   if (ret != 1) {
+   debug("No card detected (%d)\n", ret);
return -ENODEV;
+   }
 
-   err = exynos_pinmux_config(dev_id, flag);
-   if (err) {
+   ret = exynos_pinmux_config(dev_id, flag);
+   if (ret) {
printf("external SD not configured\n");
-   return err;
+   return ret;
}
}
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] odroid: update link to X2/U3 proprietary binaries

2015-02-11 Thread Tobias Jakobi
Hello!

Przemyslaw Marczak wrote:
 I checked the old link, and it is fine.
 So maybe the link was dead only for a while?
 Please add an alternative instead of removing the working one.
Hmm, I just checked the link and like the last time I tried it, it
doesn't work.

~ $ curl
http://dev.odroid.com/projects/4412boot/wiki/FrontPage?action=downloadvalue=boot.tar.gz;
curl: (52) Empty reply from server

So either I'm just unlucky, or the server is highly unstable, or maybe
routing problems cause it only to be available for certain regions.

Since I've heard the complaint (that the link is not working) from
several people, I don't think it's a good idea to leave it there. GitHub
provides a much more stable service, so I would prefer to remove the
'wonky' link.

With best wishes,
Tobias

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] odroid: update link to X2/U3 proprietary binaries

2015-02-04 Thread Tobias Jakobi

Hello!

On 2015-02-04 11:42, Albert ARIBAUD wrote:

Hello Tobias,

You should use git send-email (or better yet, patman) for sending
patches; this one was attached instead of inline.
Sorry, I normally do that, but I didn't have access to my Odroid system 
when I sent the patch.




That being said, it did not seem to worry patchwork, so you don't
need to repost this one.

OK!


With best wishes,
Tobias

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] odroid: update link to X2/U3 proprietary binaries

2015-02-01 Thread Tobias Jakobi
From f12af0fe43378f945de3eaa5acbca4e0a4d711b8 Mon Sep 17 00:00:00 2001
From: Tobias Jakobi tjak...@math.uni-bielefeld.de
Date: Sun, 1 Feb 2015 19:47:50 +0100
Subject: odroid: update link to X2/U3 proprietary binaries

The old link was dead. Link to the Github repository which is
probably a more long-term solution.
---
 doc/README.odroid | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/README.odroid b/doc/README.odroid
index 528bb95..cc85348 100644
--- a/doc/README.odroid
+++ b/doc/README.odroid
@@ -19,7 +19,7 @@ iROM-BL1-(BL2 + TrustZone)-U-BOOT
 
 This version of U-BOOT doesn't implement SPL but it is required(BL2)
 and can be found in boot.tar.gz from here:
-http://dev.odroid.com/projects/4412boot/wiki/FrontPage?action=downloadvalue=boot.tar.gz
+https://github.com/hardkernel/u-boot/tree/odroid-v2010.12/sd_fuse
 or here:
 http://odroid.in/guides/ubuntu-lfs/boot.tar.gz
 
-- 
2.0.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot