Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-29 Thread stefano babic
Am 29/04/2012 20:24, schrieb Eric Nelson:
> On 04/29/2012 07:59 AM, Stefano Babic wrote:
>> On 26/04/2012 02:14, Eric Nelson wrote:
>>> Uses the 'magic_keys' idiom as described in doc/README.kbd:
>>> http://lists.denx.de/pipermail/u-boot/2012-April/122502.html
>>>
>>> Signed-off-by: Eric Nelson
>>> Acked-by: Marek Vasut
>>> ---
>>
>> Applied after rebasing on current u-boot-imx, thanks.
>>
> Thanks Stefano,
> 
> I'm never quite sure whether I should submit patches against u-boot-imx
> or the mainline head.

Of course it should be enough to submit patches against mainline - only
in the time approaching the release (as it was for your patch) I have
the problem I must postpone patches for the next release, putting them
on the -next branch, and then some rebasing is needed.

Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-29 Thread Eric Nelson

On 04/29/2012 07:59 AM, Stefano Babic wrote:

On 26/04/2012 02:14, Eric Nelson wrote:

Uses the 'magic_keys' idiom as described in doc/README.kbd:
http://lists.denx.de/pipermail/u-boot/2012-April/122502.html

Signed-off-by: Eric Nelson
Acked-by: Marek Vasut
---


Applied after rebasing on current u-boot-imx, thanks.


Thanks Stefano,

I'm never quite sure whether I should submit patches against u-boot-imx
or the mainline head.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-29 Thread Stefano Babic
On 26/04/2012 02:14, Eric Nelson wrote:
> Uses the 'magic_keys' idiom as described in doc/README.kbd:
>   http://lists.denx.de/pipermail/u-boot/2012-April/122502.html
> 
> Signed-off-by: Eric Nelson 
> Acked-by: Marek Vasut 
> ---

Applied after rebasing on current 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: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-29 Thread Stefano Babic
On 26/04/2012 12:12, Marek Vasut wrote:
> Dear Eric Nelson,
> 
>> On 04/25/2012 05:17 PM, Marek Vasut wrote:
>>> Dear Eric Nelson,
>>>
 Uses the 'magic_keys' idiom as described in doc/README.kbd:
http://lists.denx.de/pipermail/u-boot/2012-April/122502.html
>>>
>>> If this is a V2 of a patch, please send is as "in-reply-to" and descibe
>>> the changes below (at spot marked V2 (and V3 etc))... Also, change the
>>> keywork "PATCH" in teh subject to teh "PATCH V2" etc ;-)
>>>
 Signed-off-by: Eric Nelson
 Acked-by: Marek Vasut
 ---
>>>
>>> V2:
>>>
>>> This is just a nitpick though (and I got about similar scolding in the
>>> LAKML today, so don't let it bother you ;-) ), thanks for your work ;-)
>>
>> Thanks Marek.
>>
>> I coulda sworn I did that, but apparently not...

Apart of that, patch looks good, I am going to merge it.

Acked-by: Stefano Babic 

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: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-26 Thread Marek Vasut
Dear Eric Nelson,

> On 04/25/2012 05:17 PM, Marek Vasut wrote:
> > Dear Eric Nelson,
> > 
> >> Uses the 'magic_keys' idiom as described in doc/README.kbd:
> >>http://lists.denx.de/pipermail/u-boot/2012-April/122502.html
> > 
> > If this is a V2 of a patch, please send is as "in-reply-to" and descibe
> > the changes below (at spot marked V2 (and V3 etc))... Also, change the
> > keywork "PATCH" in teh subject to teh "PATCH V2" etc ;-)
> > 
> >> Signed-off-by: Eric Nelson
> >> Acked-by: Marek Vasut
> >> ---
> > 
> > V2:
> > 
> > This is just a nitpick though (and I got about similar scolding in the
> > LAKML today, so don't let it bother you ;-) ), thanks for your work ;-)
> 
> Thanks Marek.
> 
> I coulda sworn I did that, but apparently not...

Happens to everyone, don't worry about it :)

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-25 Thread Eric Nelson

On 04/25/2012 05:17 PM, Marek Vasut wrote:

Dear Eric Nelson,


Uses the 'magic_keys' idiom as described in doc/README.kbd:
http://lists.denx.de/pipermail/u-boot/2012-April/122502.html



If this is a V2 of a patch, please send is as "in-reply-to" and descibe the
changes below (at spot marked V2 (and V3 etc))... Also, change the keywork
"PATCH" in teh subject to teh "PATCH V2" etc ;-)



Signed-off-by: Eric Nelson
Acked-by: Marek Vasut
---


V2:

This is just a nitpick though (and I got about similar scolding in the LAKML
today, so don't let it bother you ;-) ), thanks for your work ;-)



Thanks Marek.

I coulda sworn I did that, but apparently not...
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

2012-04-25 Thread Marek Vasut
Dear Eric Nelson,

> Uses the 'magic_keys' idiom as described in doc/README.kbd:
>   http://lists.denx.de/pipermail/u-boot/2012-April/122502.html


If this is a V2 of a patch, please send is as "in-reply-to" and descibe the 
changes below (at spot marked V2 (and V3 etc))... Also, change the keywork 
"PATCH" in teh subject to teh "PATCH V2" etc ;-)

> 
> Signed-off-by: Eric Nelson 
> Acked-by: Marek Vasut 
> ---

V2: 

This is just a nitpick though (and I got about similar scolding in the LAKML 
today, so don't let it bother you ;-) ), thanks for your work ;-)

>  board/freescale/mx6qsabrelite/mx6qsabrelite.c |  122
> - include/configs/mx6qsabrelite.h   | 
>   3 +
>  2 files changed, 123 insertions(+), 2 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> b/board/freescale/mx6qsabrelite/mx6qsabrelite.c index db5e775..f63cef7
> 100644
> --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> @@ -52,6 +52,10 @@ DECLARE_GLOBAL_DATA_PTR;
>   PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
>   PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
> 
> +#define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
> + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
> + PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
> +
>  int dram_init(void)
>  {
> gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
> @@ -124,6 +128,22 @@ iomux_v3_cfg_t enet_pads2[] = {
>   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
>  };
> 
> +/* Button assignments for J14 */
> +static iomux_v3_cfg_t button_pads[] = {
> + /* Menu */
> + MX6Q_PAD_NANDF_D1__GPIO_2_1 | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> + /* Back */
> + MX6Q_PAD_NANDF_D2__GPIO_2_2 | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> + /* Labelled Search (mapped to Power under Android) */
> + MX6Q_PAD_NANDF_D3__GPIO_2_3 | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> + /* Home */
> + MX6Q_PAD_NANDF_D4__GPIO_2_4 | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> + /* Volume Down */
> + MX6Q_PAD_GPIO_19__GPIO_4_5  | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> + /* Volume Up */
> + MX6Q_PAD_GPIO_18__GPIO_7_13 | MUX_PAD_CTRL(BUTTON_PAD_CTRL),
> +};
> +
>  static void setup_iomux_enet(void)
>  {
>   gpio_direction_output(87, 0);  /* GPIO 3-23 */
> @@ -295,11 +315,18 @@ int setup_sata(void)
>  }
>  #endif
> 
> +static void setup_buttons(void)
> +{
> + imx_iomux_v3_setup_multiple_pads(button_pads,
> +  ARRAY_SIZE(button_pads));
> +}
> +
>  int board_early_init_f(void)
>  {
> -   setup_iomux_uart();
> + setup_iomux_uart();
> + setup_buttons();
> 
> -   return 0;
> + return 0;
>  }
> 
>  int board_init(void)
> @@ -324,3 +351,94 @@ int checkboard(void)
> 
> return 0;
>  }
> +
> +struct button_key {
> + char const  *name;
> + unsignedgpnum;
> + charident;
> +};
> +
> +static struct button_key const buttons[] = {
> + {"back",GPIO_NUMBER(2, 2),  'B'},
> + {"home",GPIO_NUMBER(2, 4),  'H'},
> + {"menu",GPIO_NUMBER(2, 1),  'M'},
> + {"search",  GPIO_NUMBER(2, 3),  'S'},
> + {"volup",   GPIO_NUMBER(7, 13), 'V'},
> + {"voldown", GPIO_NUMBER(4, 5),  'v'},
> +};
> +
> +/*
> + * generate a null-terminated string containing the buttons pressed
> + * returns number of keys pressed
> + */
> +static int read_keys(char *buf)
> +{
> + int i, numpressed = 0;
> + for (i = 0; i < ARRAY_SIZE(buttons); i++) {
> + if (!gpio_get_value(buttons[i].gpnum))
> + buf[numpressed++] = buttons[i].ident;
> + }
> + buf[numpressed] = '\0';
> + return numpressed;
> +}
> +
> +static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[]) +{
> + char envvalue[ARRAY_SIZE(buttons)+1];
> + int numpressed = read_keys(envvalue);
> + setenv("keybd", envvalue);
> + return numpressed == 0;
> +}
> +
> +U_BOOT_CMD(
> + kbd, 1, 1, do_kbd,
> + "Tests for keypresses, sets 'keybd' environment variable",
> + "Returns 0 (true) to shell if key is pressed."
> +);
> +
> +#ifdef CONFIG_PREBOOT
> +static char const kbd_magic_prefix[] = "key_magic";
> +static char const kbd_command_prefix[] = "key_cmd";
> +
> +static void preboot_keys(void)
> +{
> + int numpressed;
> + char keypress[ARRAY_SIZE(buttons)+1];
> + numpressed = read_keys(keypress);
> + if (numpressed) {
> + char *kbd_magic_keys = getenv("magic_keys");
> + char *suffix;
> + /*
> +  * loop over all magic keys
> +  */
> + for (suffix = kbd_magic_keys; *suffix; ++suffix) {
> + char *keys;
> + char magic[sizeof(kbd_magic_prefix) + 1];
> + sprintf(magic, "%s%c", kbd_magic_pr