[U-Boot] [PATCH] mx6: Fix ECSPI typo in soc_boot_modes

2014-08-10 Thread picmaster
From: Nikolay Dimitrov 

Signed-off-by: Nikolay Dimitrov 
Cc: Stefano Babic 
---
 arch/arm/cpu/armv7/mx6/soc.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index f2dee76..99b7c86 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -318,10 +318,10 @@ const struct boot_mode soc_boot_modes[] = {
/* reserved value should start rom usb */
{"usb", MAKE_CFGVAL(0x01, 0x00, 0x00, 0x00)},
{"sata",MAKE_CFGVAL(0x20, 0x00, 0x00, 0x00)},
-   {"escpi1:0",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x08)},
-   {"escpi1:1",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x18)},
-   {"escpi1:2",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x28)},
-   {"escpi1:3",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x38)},
+   {"ecspi1:0",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x08)},
+   {"ecspi1:1",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x18)},
+   {"ecspi1:2",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x28)},
+   {"ecspi1:3",MAKE_CFGVAL(0x30, 0x00, 0x00, 0x38)},
/* 4 bit bus width */
{"esdhc1",  MAKE_CFGVAL(0x40, 0x20, 0x00, 0x00)},
{"esdhc2",  MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH V5] ARM: mx6: Add support for Kosagi Novena

2014-10-08 Thread picmaster
Hi Sean,

- Цитат от Sean Cross (x...@kosagi.com), на 08.10.2014 в 10:47 -

> On 08/10/2014 05:55, Nikolay Dimitrov wrote:
>> Hi Marek,
>>
>> I'm marking only the critical issues that are left unfixed from
>> previous conversations, to speed-up the process a little bit.
>> I'll send later patches for the non-critical issues to spare you the
>> extra work (and I'm sure my constructive criticism is already boring
>> :D ).
>>
>>
>> On 10/06/2014 07:02 PM, Marek Vasut wrote:
>>> +#define NOVENA_USB_HUB_RESETIMX_GPIO_NR(7, 12)
>> ...
>>> +/*
>>> + * USB
>>> + */
>>> +#ifdef CONFIG_USB_EHCI_MX6
>>> +int board_ehci_hcd_init(int port)
>>> +{
>>> +/* Reset USB hub */
>>> +if (port == 1) {
>>> +gpio_set_value(NOVENA_USB_HUB_RESET, 0);
>>> +mdelay(2);
>>> +gpio_set_value(NOVENA_USB_HUB_RESET, 1);
>>> +}
>>> +return 0;
>>> +}
>>> +#endif
>>
>> As we previously discussed, this pin definition conflicts with
>> NOVENA_PCIE_POWER_ON_GPIO (GPIO7_IO12 is connected to PCIE_PWRON), so
>> by asserting it, you'll turn-off the wrong sub-system.
>>
>> Currently the USB hub is reset only by system reset (RESETBMCU
>> asserted by the PMIC). I don't see how the CPU can selectively reset
>> the USB hub via a GPIO, so it would be better to remove the reset code.
>>
>> @Sean - can you please confirm/reject this finding?

@Sean: Do you have any comments on USB hub reset stuff? Should we ditch
entirely the reset code, or should we modify it somehow to work properly?


>>> +#define NOVENA_AUDIO_PWRONIMX_GPIO_NR(5, 17)
>> ...
>>> +/*
>>> + * Audio
>>> + */
>>> +static iomux_v3_cfg_t audio_pads[] = {
>>> +/* AUD_PWRON */
>>> +MX6_PAD_DISP0_DAT23__GPIO5_IO17 | MUX_PAD_CTRL(NO_PAD_CTRL),
>>> +};
>>
>> The speaker amplifiers will still be disabled, as AUDIO_PWRON is not
>> connected to them (R30A is marked as DNP). You need to add one more
>> GPIO to enable the speaker amplifiers, here's the fix:
>>
>> #define NOVENA_AUDIO_PWRONIMX_GPIO_NR(5, 17)
>> #define NOVENA_AUDIO_SPK_AMP_ONIMX_GPIO_NR(4, 9)
>>
>> /*
>>  * Audio
>>  */
>> static iomux_v3_cfg_t audio_pads[] = {
>> /* AUD_PWRON */
>> MX6_PAD_KEY_ROW1__GPIO5_IO17 | MUX_PAD_CTRL(NO_PAD_CTRL),
>>
>> /* Speakers' amplifiers #SHDWN  */
>> MX6_PAD_KEY_ROW1__GPIO4_IO09 | MUX_PAD_CTRL(NO_PAD_CTRL),
>> };
>>
>> static void novena_spl_setup_iomux_audio(void)
>> {
>> imx_iomux_v3_setup_multiple_pads(audio_pads, ARRAY_SIZE(audio_pads));
>>
>> gpio_direction_output(NOVENA_AUDIO_PWRON, 1);
>> gpio_direction_output(NOVENA_AUDIO_SPK_AMP_ON, 1);
>> }
>>
>>
>> Side comment: If someone needs to talk to the Audio Codec via I2C3 in
>> U-Boot environment, don't be surprised if the codec doesn't respond to
>> any I2C requests at all (I've had such issues with SGTL5000). The most
>> probable reason is that the codec doesn't receive reference clock from
>> imx6 GPIO0. This is not a critical issues as later the kernel muxes
>> this GPIO0 properly, but keep this in mind if you want to hack the
>> audio-codec at low level.
> 
> The audio codec ought to answer even when the reference clock isn't
> active.  I actually can't recall, but I think the digital side still
> works.

Well, that would be great if it works out this way. I just shared what
happened with another audio codec, to spare some frustration to others.


> The audio codec needs to be turned on because otherwise it will
> pull the SCL and SCK lines low, blocking I2C3 from working at all.

Agreed.


> Actually, now that I'm looking at it, we just had to make an ECO to get
> rid of SPK_AMP_ON.  It is now ganged to AUDIO_PWRON, because SPK_AMP_ON
> was accidentally dual-purposed as a GPIO for the front button on the
> desktop / laptop.  This change was made very recently (last Friday I
> think), and we'll be switching resistors on the mainboard when they're
> built in order to make the change.

Well, all I have is the Novena schematic 
(http://bunniefoo.com/novena/pvt2_release/novena_pvt2.PDF) so all my analysis 
is based on this PDF. On page 14, R30A is
DNP, and R28A is populated, this is why I suggested this modification to enable
speaker amps. If there are schematic changes, please publish the new version
so we can use the proper schematic and reduce spam.

@Marek: According to this latest update, there's no need for my fix for
NOVENA_AUDIO_SPK_AMP_ON, as your original code will work just fine with the
planned schematic changes. Please disregard the fix.

Kind regards,
Nikolay

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


[U-Boot] [PATCH] novena: Fix ethernet PHY reset sequence

2014-10-12 Thread picmaster
From: Nikolay Dimitrov 

This patch fixes conflict between PHY pins becoming outputs after reset and
imx6 still driving the pins. It also fixes the reset timing as recommended by
the PHY datasheet.

Signed-off-by: Nikolay Dimitrov 
Cc: Stefano Babic 
Cc: Sean Cross 
Cc: Marek Vasut 
---
 board/kosagi/novena/novena.c |3 --
 board/kosagi/novena/novena_spl.c |   64 +++---
 2 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 2361a3c..6add9e5 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -237,9 +237,6 @@ int board_early_init_f(void)
setup_display();
 #endif
 
-   /* Bring Ethernet PHY out of reset. */
-   gpio_set_value(IMX_GPIO_NR(3, 23), 1);
-
return 0;
 }
 
diff --git a/board/kosagi/novena/novena_spl.c b/board/kosagi/novena/novena_spl.c
index a8389d9..c4155dd 100644
--- a/board/kosagi/novena/novena_spl.c
+++ b/board/kosagi/novena/novena_spl.c
@@ -41,6 +41,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
 
+#define ENET_PHY_CFG_PAD_CTRL  \
+   (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_22K_UP | PAD_CTL_HYS)
+
 #define RGMII_PAD_CTRL \
(PAD_CTL_PKE | PAD_CTL_PUE |\
PAD_CTL_PUS_100K_UP | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
@@ -98,18 +102,20 @@ static iomux_v3_cfg_t enet_pads1[] = {
MX6_PAD_RGMII_TD3__RGMII_TD3| MUX_PAD_CTRL(RGMII_PAD_CTRL),
MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL  | MUX_PAD_CTRL(RGMII_PAD_CTRL),
MX6_PAD_ENET_REF_CLK__ENET_TX_CLK   | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   /* pin 35 - 1 (PHY_AD2) on reset */
-   MX6_PAD_RGMII_RXC__GPIO6_IO30   | MUX_PAD_CTRL(NO_PAD_CTRL),
-   /* pin 32 - 1 - (MODE0) all */
-   MX6_PAD_RGMII_RD0__GPIO6_IO25   | MUX_PAD_CTRL(NO_PAD_CTRL),
-   /* pin 31 - 1 - (MODE1) all */
-   MX6_PAD_RGMII_RD1__GPIO6_IO27   | MUX_PAD_CTRL(NO_PAD_CTRL),
-   /* pin 28 - 1 - (MODE2) all */
-   MX6_PAD_RGMII_RD2__GPIO6_IO28   | MUX_PAD_CTRL(NO_PAD_CTRL),
-   /* pin 27 - 1 - (MODE3) all */
-   MX6_PAD_RGMII_RD3__GPIO6_IO29   | MUX_PAD_CTRL(NO_PAD_CTRL),
-   /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */
-   MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(NO_PAD_CTRL),
+
+   /* pin 35, PHY_AD2 */
+   MX6_PAD_RGMII_RXC__GPIO6_IO30   | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+   /* pin 32, MODE0 */
+   MX6_PAD_RGMII_RD0__GPIO6_IO25   | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+   /* pin 31, MODE1 */
+   MX6_PAD_RGMII_RD1__GPIO6_IO27   | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+   /* pin 28, MODE2 */
+   MX6_PAD_RGMII_RD2__GPIO6_IO28   | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+   /* pin 27, MODE3 */
+   MX6_PAD_RGMII_RD3__GPIO6_IO29   | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+   /* pin 33, CLK125_EN */
+   MX6_PAD_RGMII_RX_CTL__GPIO6_IO24 | MUX_PAD_CTRL(ENET_PHY_CFG_PAD_CTRL),
+
/* pin 42 PHY nRST */
MX6_PAD_EIM_D23__GPIO3_IO23 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
@@ -127,15 +133,37 @@ static void novena_spl_setup_iomux_enet(void)
 {
imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
 
+   /* Assert Ethernet PHY nRST */
gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
-   gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
-   gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
-   gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
-   gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
-   gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
-   gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
 
+   /*
+* Use imx6 internal pull-ups to drive PHY mode pins during PHY reset
+* de-assertion. The intention is to use weak signal drivers (pull-ups)
+* to prevent the conflict between PHY pins becoming outputs after
+* reset and imx6 still driving the pins. The issue is described in PHY
+* datasheet, p.14
+*/
+   gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
+   gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
+   gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
+   gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
+   gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
+   gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */
+
+   /* Following reset timing (p.53, fig.8 from the PHY datasheet) */
+   mdelay(10);
+
+   /* De-assert Ethernet PHY nRST */
+   gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+
+   /* PHY is now configured, connect FEC to the pads */
imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_p

[U-Boot] [PATCH] mx6: video_skip: Fix crash on NULL pointer

2014-11-05 Thread picmaster
From: Nikolay Dimitrov 

Signed-off-by: Nikolay Dimitrov 
Cc: Stefano Babic 
---
 arch/arm/imx-common/video.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c
index 8651b80..46f8a1e 100644
--- a/arch/arm/imx-common/video.c
+++ b/arch/arm/imx-common/video.c
@@ -11,6 +11,7 @@ int board_video_skip(void)
int i;
int ret;
char const *panel = getenv("panel");
+
if (!panel) {
for (i = 0; i < display_count; i++) {
struct display_info_t const *dev = displays+i;
@@ -31,11 +32,14 @@ int board_video_skip(void)
break;
}
}
+
if (i < display_count) {
ret = ipuv3_fb_init(&displays[i].mode, 0,
displays[i].pixfmt);
if (!ret) {
-   displays[i].enable(displays+i);
+   if (displays[i].enable)
+   displays[i].enable(displays + i);
+
printf("Display: %s (%ux%u)\n",
   displays[i].mode.name,
   displays[i].mode.xres,
-- 
1.7.10.4

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


[U-Boot] [PATCH] Fix hash verification

2014-12-12 Thread picmaster
From: Nikolay Dimitrov 

Fix issue in parse_verify_sum() which swaps handling of env-var and *address.
Move hash_command() argc check earlier.
Cosmetic change on do_hash() variable declaration.
Improved help message for "hash" command.

Signed-off-by: Nikolay Dimitrov 
---
 common/cmd_hash.c |   28 +---
 common/hash.c |6 ++
 2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/common/cmd_hash.c b/common/cmd_hash.c
index 90facbb..704d21e 100644
--- a/common/cmd_hash.c
+++ b/common/cmd_hash.c
@@ -18,9 +18,9 @@
 static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
char *s;
-#ifdef CONFIG_HASH_VERIFY
int flags = HASH_FLAG_ENV;
 
+#ifdef CONFIG_HASH_VERIFY
if (argc < 4)
return CMD_RET_USAGE;
if (!strcmp(argv[1], "-v")) {
@@ -28,8 +28,6 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
argc--;
argv++;
}
-#else
-   const int flags = HASH_FLAG_ENV;
 #endif
/* Move forward to 'algorithm' parameter */
argc--;
@@ -40,19 +38,19 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 }
 
 #ifdef CONFIG_HASH_VERIFY
-U_BOOT_CMD(
-   hash,   6,  1,  do_hash,
-   "compute hash message digest",
-   "algorithm address count [[*]sum_dest]\n"
-   "- compute message digest [save to env var / *address]\n"
-   "hash -v algorithm address count [*]sum\n"
-   "- verify hash of memory area with env var / *address"
-);
+#define HARGS 6
 #else
+#define HARGS 5
+#endif
+
 U_BOOT_CMD(
-   hash,   5,  1,  do_hash,
-   "compute message digest",
-   "algorithm address count [[*]sum_dest]\n"
+   hash,   HARGS,  1,  do_hash,
+   "compute hash message digest",
+   "algorithm address count [[*]hash_dest]\n"
"- compute message digest [save to env var / *address]"
-);
+#ifdef CONFIG_HASH_VERIFY
+   "\nhash -v algorithm address count [*]hash\n"
+   "- verify message digest of memory area to immediate value, 
\n"
+   "  env var or *address"
 #endif
+);
diff --git a/common/hash.c b/common/hash.c
index 12d6759..aceabc5 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -256,7 +256,7 @@ static int parse_verify_sum(struct hash_algo *algo, char 
*verify_str,
env_var = 1;
}
 
-   if (env_var) {
+   if (!env_var) {
ulong addr;
void *buf;
 
@@ -347,7 +347,7 @@ int hash_command(const char *algo_name, int flags, 
cmd_tbl_t *cmdtp, int flag,
 {
ulong addr, len;
 
-   if (argc < 2)
+   if ((argc < 2) || ((flags & HASH_FLAG_VERIFY) && (argc < 3)))
return CMD_RET_USAGE;
 
addr = simple_strtoul(*argv++, NULL, 16);
@@ -380,8 +380,6 @@ int hash_command(const char *algo_name, int flags, 
cmd_tbl_t *cmdtp, int flag,
 #else
if (0) {
 #endif
-   if (!argc)
-   return CMD_RET_USAGE;
if (parse_verify_sum(algo, *argv, vsum,
flags & HASH_FLAG_ENV)) {
printf("ERROR: %s does not contain a valid "
-- 
1.7.10.4

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


[U-Boot] [PATCH] embestmx6boards: Increase boot delay to 3s

2014-12-12 Thread picmaster
From: Nikolay Dimitrov 

Signed-off-by: Nikolay Dimitrov 
---
 include/configs/embestmx6boards.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/embestmx6boards.h 
b/include/configs/embestmx6boards.h
index 185edbe..28099a8 100644
--- a/include/configs/embestmx6boards.h
+++ b/include/configs/embestmx6boards.h
@@ -120,7 +120,7 @@
 #define CONFIG_CMD_SETEXPR
 #undef CONFIG_CMD_IMLS
 
-#define CONFIG_BOOTDELAY   1
+#define CONFIG_BOOTDELAY   3
 
 #define CONFIG_LOADADDR0x1200
 #define CONFIG_SYS_TEXT_BASE   0x1780
-- 
1.7.10.4

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