Re: [U-Boot] [PATCH 06/28] dm: stdio: Plumb in the new keyboard uclass

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:11, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> When driver model is used for keyboards we must scan the available keyboards
>> and register them with stdio. Add code to do this.
>>
>> At some point (once LCD/video is converted) we should be able to convert
>> stdio to driver model and avoid these dual data structures.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>
> Reviewed-by: Bin Meng 
>
> Please see one question below.
>
>>  common/stdio.c | 31 ++-
>>  1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/stdio.c b/common/stdio.c
>> index adbfc89..71cc32e 100644
>> --- a/common/stdio.c
>> +++ b/common/stdio.c
>> @@ -11,6 +11,7 @@
>>
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -24,6 +25,8 @@
>>  #include 
>>  #endif
>>
>> +#include 
>> +
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>>  static struct stdio_dev devs;
>> @@ -245,6 +248,32 @@ int stdio_init_tables(void)
>>
>>  int stdio_add_devices(void)
>>  {
>> +#ifdef CONFIG_DM_KEYBOARD
>> +   struct udevice *dev;
>> +   struct uclass *uc;
>> +   int ret;
>> +
>> +   /*
>> +* For now we probe all the devices here. At some point this should 
>> be
>> +* done only when the devices are required - e.g. we have a list of
>> +* input devices to start up in the stdin environment variable. That
>> +* work probably makes more sense when stdio itself is converted to
>> +* driver model.
>> +*
>> +* TODO(s...@chromium.org): Convert changing uclass_first_device() 
>> etc.
>> +* to return the device even on error. Then we could use that here.
>> +*/
>> +   ret = uclass_get(UCLASS_KEYBOARD, );
>> +   if (ret)
>> +   return ret;
>> +
>> +   /* Don't report errors to the caller - assume that they are 
>> non-fatal */
>> +   uclass_foreach_dev(dev, uc) {
>> +   ret = device_probe(dev);
>> +   if (ret)
>> +   printf("Failed to probe keyboard '%s'\n", dev->name);
>> +   }
>> +#endif
>>  #ifdef CONFIG_SYS_I2C
>> i2c_init_all();
>>  #else
>> @@ -258,7 +287,7 @@ int stdio_add_devices(void)
>>  #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
>> drv_video_init ();
>>  #endif
>> -#ifdef CONFIG_KEYBOARD
>> +#if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
>
> Should we remove this non-dm driver call completely?

We can once 'novena' is converted over.

>
>> drv_keyboard_init ();
>>  #endif
>>  #ifdef CONFIG_LOGBUFFER
>> --

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


Re: [U-Boot] [PATCH 24/28] x86: Add an i8042 device for boards that have it

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:12, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> Some boards have an i8042 device. Enable the driver for all x86 boards, and
>> add a device tree node for those which may have this keyboard.
>>
>> Also adjust the configuration so that i8042 is always separate from the VGA,
>> and rename the stdin driver accordingly. With this commit the keyboard will
>> not work, but it is fixed in the next commit.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/x86/Kconfig | 6 ++
>>  arch/x86/dts/bayleybay.dts   | 1 +
>>  arch/x86/dts/chromebook_link.dts | 1 +
>>  arch/x86/dts/keyboard.dtsi   | 5 +
>>  include/configs/x86-chromebook.h | 2 +-
>>  include/configs/x86-common.h | 2 +-
>>  6 files changed, 15 insertions(+), 2 deletions(-)
>>  create mode 100644 arch/x86/dts/keyboard.dtsi
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 5e42d7d..72a66ea 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -401,6 +401,12 @@ config PCIE_ECAM_SIZE
>>   so a default 0x1000 size covers all of the 256 buses which is 
>> the
>>   maximum number of PCI buses as defined by the PCI specification.
>>
>> +config I8042_KEYB
>> +   default y
>> +
>> +config DM_KEYBOARD
>> +   default y
>> +
>
> I am not in favor of adding driver options in the arch Kconfig. We
> specify other drivers in the boards' defconfig files. Can we move
> these two to defconfig too?

The idea is that x86 has moved to use driver model for keyboard. Any
new boards should also. This option will be removed when everything is
converted so I don't think it should be exposed too widely.

>
>>  source "arch/x86/lib/efi/Kconfig"
>>
>>  endmenu
>> diff --git a/arch/x86/dts/bayleybay.dts b/arch/x86/dts/bayleybay.dts
>> index d646987..58d97c8 100644
>> --- a/arch/x86/dts/bayleybay.dts
>> +++ b/arch/x86/dts/bayleybay.dts
>> @@ -10,6 +10,7 @@
>>  #include 
>>
>>  /include/ "skeleton.dtsi"
>> +/include/ "keyboard.dtsi"
>>  /include/ "serial.dtsi"
>>  /include/ "rtc.dtsi"
>>
>> diff --git a/arch/x86/dts/chromebook_link.dts 
>> b/arch/x86/dts/chromebook_link.dts
>> index 4291141..a52c84f 100644
>> --- a/arch/x86/dts/chromebook_link.dts
>> +++ b/arch/x86/dts/chromebook_link.dts
>> @@ -1,6 +1,7 @@
>>  /dts-v1/;
>>
>>  /include/ "skeleton.dtsi"
>> +/include/ "keyboard.dtsi"
>>  /include/ "serial.dtsi"
>>  /include/ "rtc.dtsi"
>>
>> diff --git a/arch/x86/dts/keyboard.dtsi b/arch/x86/dts/keyboard.dtsi
>> new file mode 100644
>> index 000..000751b
>> --- /dev/null
>> +++ b/arch/x86/dts/keyboard.dtsi
>> @@ -0,0 +1,5 @@
>> +/ {
>> +   keyboard {
>> +   compatible = "intel,i8042-keyboard";
>> +   };
>> +};
>> diff --git a/include/configs/x86-chromebook.h 
>> b/include/configs/x86-chromebook.h
>> index 2be8850..4ff8b94 100644
>> --- a/include/configs/x86-chromebook.h
>> +++ b/include/configs/x86-chromebook.h
>> @@ -51,7 +51,7 @@
>>  #define CONFIG_ENV_IS_IN_SPI_FLASH
>>  #define CONFIG_ENV_OFFSET  0x003f8000
>>
>> -#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \
>> +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
>> "stdout=vga,serial\0" \
>> "stderr=vga,serial\0"
>>
>> diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h
>> index 3f153f2..ff8fe0f 100644
>> --- a/include/configs/x86-common.h
>> +++ b/include/configs/x86-common.h
>> @@ -147,7 +147,7 @@
>>  #define CONFIG_VIDEO
>>  #define CONFIG_VIDEO_SW_CURSOR
>>  #define VIDEO_FB_16BPP_WORD_SWAP
>> -#define CONFIG_I8042_KBD
>> +#define CONFIG_VGA_AS_SINGLE_DEVICE
>
> Can we remove CONFIG_VGA_AS_SINGLE_DEVICE from all x86 board config.h
> files to avoid duplication?

Will do.

>
>>  #define CONFIG_CFB_CONSOLE
>>  #define CONFIG_CONSOLE_SCROLL_LINES 5

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


Re: [U-Boot] [PATCH 18/28] input: Support the German keymap

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:12, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> Add support for the German keymap, taken from i8042.c. This can be selected
>> when the input library it initialised.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  board/kosagi/novena/novena.c |  2 +-
>>  drivers/input/cros_ec_keyb.c |  2 +-
>>  drivers/input/input.c| 82 
>> 
>>  drivers/input/tegra-kbc.c|  2 +-
>>  include/input.h  |  3 +-
>>  5 files changed, 80 insertions(+), 11 deletions(-)
>>
>> diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
>> index 48cbb0f..0b61365 100644
>> --- a/board/kosagi/novena/novena.c
>> +++ b/board/kosagi/novena/novena.c
>> @@ -88,7 +88,7 @@ int drv_keyboard_init(void)
>> debug("%s: Cannot set up input\n", __func__);
>> return -1;
>> }
>> -   input_add_tables(_input);
>> +   input_add_tables(_input, false);
>> button_input.read_keys = novena_gpio_button_read_keys;
>>
>> error = input_stdio_register();
>> diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
>> index fe5caea..9bc4555 100644
>> --- a/drivers/input/cros_ec_keyb.c
>> +++ b/drivers/input/cros_ec_keyb.c
>> @@ -211,7 +211,7 @@ static int cros_ec_kbd_probe(struct udevice *dev)
>>
>> priv->input = input;
>> input->dev = dev;
>> -   input_add_tables(input);
>> +   input_add_tables(input, false);
>> input->read_keys = cros_ec_kbc_check;
>> strcpy(sdev->name, "cros-ec-keyb");
>>
>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>> index c488f3a..a54449e 100644
>> --- a/drivers/input/input.c
>> +++ b/drivers/input/input.c
>> @@ -78,6 +78,60 @@ static unsigned char kbd_ctrl_xlate[] = {
>> '\r', 0xff, '/',  '*',
>>  };
>>
>> +static const uchar kbd_plain_xlate_german[] = {
>> +   0xff, 0x1b,  '1',  '2',  '3',  '4',  '5',  '6', /* scan 00-07 */
>> +'7',  '8',  '9',  '0', 0xe1, '\'', 0x08, '\t', /* scan 08-0F */
>> +'q',  'w',  'e',  'r',  't',  'z',  'u',  'i', /* scan 10-17 */
>> +'o',  'p', 0x81,  '+', '\r', 0xff,  'a',  's', /* scan 18-1F */
>> +'d',  'f',  'g',  'h',  'j',  'k',  'l', 0x94, /* scan 20-27 */
>> +   0x84,  '^', 0xff,  '#',  'y',  'x',  'c',  'v', /* scan 28-2F */
>> +'b',  'n',  'm',  ',',  '.',  '-', 0xff,  '*', /* scan 30-37 */
>> +' ',  ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  '7', /* scan 40-47 */
>> +'8',  '9',  '-',  '4',  '5',  '6',  '+',  '1', /* scan 48-4F */
>> +'2',  '3',  '0',  ',', 0xff, 0xff,  '<', 0xff, /* scan 50-57 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */
>> +   '\r', 0xff,  '/',  '*',
>> +};
>> +
>> +static unsigned char kbd_shift_xlate_german[] = {
>> +  0xff, 0x1b,  '!',  '"', 0x15,  '$',  '%',  '&', /* scan 00-07 */
>> +'/',  '(',  ')',  '=',  '?',  '`', 0x08, '\t', /* scan 08-0F */
>> +'Q',  'W',  'E',  'R',  'T',  'Z',  'U',  'I', /* scan 10-17 */
>> +'O',  'P', 0x9a,  '*', '\r', 0xff,  'A',  'S', /* scan 18-1F */
>> +'D',  'F',  'G',  'H',  'J',  'K',  'L', 0x99, /* scan 20-27 */
>> +   0x8e, 0xf8, 0xff, '\'',  'Y',  'X',  'C',  'V', /* scan 28-2F */
>> +'B',  'N',  'M',  ';',  ':',  '_', 0xff,  '*', /* scan 30-37 */
>> +' ',  ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  '7', /* scan 40-47 */
>> +'8',  '9',  '-',  '4',  '5',  '6',  '+',  '1', /* scan 48-4F */
>> +'2',  '3',  '0',  ',', 0xff, 0xff,  '>', 0xff, /* scan 50-57 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */
>> +   '\r', 0xff,  '/',  '*',
>> +};
>> +
>> +static unsigned char kbd_right_alt_xlate_german[] = {
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
>> +'{',  '[',  ']',  '}', '\\', 0xff, 0xff, 0xff, /* scan 08-0F */
>> +'@', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10-17 */
>> +   0xff, 0xff, 0xff,  '~', 0xff, 0xff, 0xff, 0xff, /* scan 18-1F */
>> +   0xff, 0xff, 0xff, 0xff, 0xff, 

Re: [U-Boot] [PATCH v2] dm: tpm: Drop CONFIG_DM_TPM

2015-10-18 Thread Simon Glass
On 4 October 2015 at 02:46, Christophe Ricard
 wrote:
> Hi Simon,
>
> Acked-by: Christophe Ricard
>
> Best Regards
> Christophe
>

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


Re: [U-Boot] [PATCH 26/28] input: Convert i8042 to driver model

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:12, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> Adjust this driver to support driver model. The only users are x86 boards
>> so this should be safe.
>>
>> Signed-off-by: Simon Glass 
>> ---
>
> After updating QEMU to use the DM i8042 driver below:
>
> diff --git a/arch/x86/dts/qemu-x86_i440fx.dts 
> b/arch/x86/dts/qemu-x86_i440fx.dts
> index fc74cd0..14782b3 100644
> --- a/arch/x86/dts/qemu-x86_i440fx.dts
> +++ b/arch/x86/dts/qemu-x86_i440fx.dts
> @@ -11,6 +11,7 @@
>  /include/ "skeleton.dtsi"
>  /include/ "serial.dtsi"
>  /include/ "rtc.dtsi"
> +/include/ "keyboard.dtsi"
>
>  / {
> model = "QEMU x86 (I440FX)";
> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
> index 1b544c1..9daf943 100644
> --- a/include/configs/qemu-x86.h
> +++ b/include/configs/qemu-x86.h
> @@ -30,7 +30,7 @@
>
>  #define CONFIG_PCI_PNP
>
> -#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,vga\0" \
> +#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,i8042-kbd\0" \
> "stdout=serial,vga\0" \
> "stderr=serial,vga\0"
>
>
> The i8042 still does not work. I've applied the same changes to Crown
> Bay. i8042 does not work either. Could you please have a look?
>

It's hard for me to debug this on hardware. I should be able to use
qemu though. Is there anything special needed to make it use that
keyboard?

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


Re: [U-Boot] [PATCH 04/28] input: Add the keycode translation tables separately

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:11, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> Require the caller to add the keycode translation tables separately so that
>> it can select which ones to use. In a later patch we will add the option to
>> add German tables.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  board/kosagi/novena/novena.c |  1 +
>>  drivers/input/cros_ec_keyb.c |  1 +
>>  drivers/input/input.c| 21 -
>>  drivers/input/tegra-kbc.c|  1 +
>>  include/input.h  | 10 ++
>>  5 files changed, 25 insertions(+), 9 deletions(-)
>>
>> diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
>> index 69f5be3..48cbb0f 100644
>> --- a/board/kosagi/novena/novena.c
>> +++ b/board/kosagi/novena/novena.c
>> @@ -88,6 +88,7 @@ int drv_keyboard_init(void)
>> debug("%s: Cannot set up input\n", __func__);
>> return -1;
>> }
>> +   input_add_tables(_input);
>> button_input.read_keys = novena_gpio_button_read_keys;
>>
>> error = input_stdio_register();
>> diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
>> index a31aa77..eaab86f 100644
>> --- a/drivers/input/cros_ec_keyb.c
>> +++ b/drivers/input/cros_ec_keyb.c
>> @@ -255,6 +255,7 @@ int drv_keyboard_init(void)
>> return -1;
>> }
>> config.input.read_keys = cros_ec_kbc_check;
>> +   input_add_tables();
>>
>> memset(, '\0', sizeof(dev));
>> strcpy(dev.name, "cros-ec-keyb");
>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>> index 9033935..0f11ae6 100644
>> --- a/drivers/input/input.c
>> +++ b/drivers/input/input.c
>> @@ -457,19 +457,22 @@ void input_set_delays(struct input_config *config, int 
>> repeat_delay_ms,
>> config->repeat_rate_ms = repeat_rate_ms;
>>  }
>>
>> +int input_add_tables(struct input_config *config)
>> +{
>> +   input_add_table(config, -1, -1,
>> +   kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate));
>> +   input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
>> +   kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate));
>> +   input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
>> +   kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate));
>
> Should we return error codes here? In previous patch, we've added -ENOSPC.

It can't actually happen since there is always enough space for 3
items and this is called at the start. Still it looks strange to not
check errors so I will add it.

[snip]

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


Re: [U-Boot] [PATCH 09/28] video: Drop unused console functions

2015-10-18 Thread Simon Glass
Hi Bin,

On 15 September 2015 at 00:11, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>> CONFIG_CONSOLE_CURSOR, CONFIG_SYS_CONSOLE_BLINK_COUNT and
>> CONFIG_CONSOLE_TIME are not used by any board. The implementation is not
>> great and stands in the way of a refactor of i8042. Drop these for now.
>> They can be re-introduced quite easily later, perhaps with driver model
>> RTC support.
>
> RTC?

Yes - they use the real-time clock for this feature.

>
>>
>> When reintroducing, it might be useful to make a few changes:
>> - Blink time would be more useful than blink count
>> - The confusing #ifdefs should be avoided
>> - The time functions should support driver model
>> - It would be best keyed off console_tstc() or some similar idle loop
>> rather than a particular input driver (i8042 in this case)
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  README|  7 -
>>  drivers/input/i8042.c | 23 
>>  drivers/video/cfb_console.c   | 62 
>> +++
>>  include/configs/MPC8536DS.h   |  1 -
>>  include/configs/MPC8544DS.h   |  1 -
>>  include/configs/MPC8572DS.h   |  1 -
>>  include/configs/MPC8641HPCN.h |  1 -
>>  7 files changed, 9 insertions(+), 87 deletions(-)
>>
>> diff --git a/README b/README
>> index 08f2f70..54c1d08 100644
>> --- a/README
>> +++ b/README
>> @@ -890,13 +890,6 @@ The following options need to be configured:
>> (i.e. i8042_tstc)
>> VIDEO_GETC_FCT  get char fct
>> (i.e. i8042_getc)
>> -   CONFIG_CONSOLE_CURSOR   cursor drawing on/off
>> -   (requires blink timer
>> -   cf. i8042.c)
>> -   CONFIG_SYS_CONSOLE_BLINK_COUNT blink interval (cf. 
>> i8042.c)
>> -   CONFIG_CONSOLE_TIME display time/date info in
>> -   upper right corner
>> -   (requires CONFIG_CMD_DATE)
>> CONFIG_VIDEO_LOGO   display Linux logo in
>> upper left corner
>> CONFIG_VIDEO_BMP_LOGO   use bmp_logo.h instead of
>> diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
>> index 9b5fa32..7b95b21 100644
>> --- a/drivers/input/i8042.c
>> +++ b/drivers/input/i8042.c
>> @@ -17,12 +17,6 @@
>>  #define in8(p) inb(p)
>>  #define out8(p, v) outb(v, p)
>>
>> -#ifdef CONFIG_CONSOLE_CURSOR
>> -extern void console_cursor(int state);
>> -static int blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
>> -static int cursor_state;
>> -#endif
>> -
>>  /* locals */
>>
>>  static int kbd_input = -1; /* no input yet */
>> @@ -598,15 +592,6 @@ int i8042_tstc(struct stdio_dev *dev)
>>  {
>> unsigned char scan_code = 0;
>>
>> -#ifdef CONFIG_CONSOLE_CURSOR
>> -   if (--blink_count == 0) {
>> -   cursor_state ^= 1;
>> -   console_cursor(cursor_state);
>> -   blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
>> -   udelay(10);
>> -   }
>> -#endif
>> -
>> if ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
>> return 0;
>> } else {
>> @@ -635,14 +620,6 @@ int i8042_getc(struct stdio_dev *dev)
>>
>> while (kbd_input == -1) {
>> while ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
>> -#ifdef CONFIG_CONSOLE_CURSOR
>> -   if (--blink_count == 0) {
>> -   cursor_state ^= 1;
>> -   console_cursor(cursor_state);
>> -   blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
>> -   }
>> -   udelay(10);
>> -#endif
>> }
>> scan_code = in8(I8042_DATA_REG);
>> if (scan_code != 0xfa)
>> diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
>> index aa7ca86..1b5c3e0 100644
>> --- a/drivers/video/cfb_console.c
>> +++ b/drivers/video/cfb_console.c
>> @@ -43,13 +43,6 @@
>>   * VIDEO_TSTC_FCT- keyboard_tstc function
>>   * VIDEO_GETC_FCT- keyboard_getc function
>>   *
>> - * CONFIG_CONSOLE_CURSOR  - on/off drawing cursor is done with
>> - * delay loop in VIDEO_TSTC_FCT (i8042)
>> - *
>> - * CONFIG_SYS_CONSOLE_BLINK_COUNT - value for delay loop - blink rate
>> - * CONFIG_CONSOLE_TIME   - display time/date in upper right
>> - * corner, needs CONFIG_CMD_DATE and
>> - * CONFIG_CONSOLE_CURSOR
>>   * CONFIG_VIDEO_LOGO - display Linux Logo in upper left corner.
>>   * 

Re: [U-Boot] [PATCH] dfu: dfu_sf: Use the erase sector size for erase operations

2015-10-18 Thread Fabio Estevam
Hi Lukasz,

On Tue, Sep 22, 2015 at 4:46 AM, Lukasz Majewski  wrote:
> Hi Fabio,
>
>> From: Fabio Estevam 
>>
>> SPI NOR flashes need to erase the entire sector size and we cannot
>> pass any arbitrary length for the erase operation.
>>
>> To illustrate the problem:
>>
>> Copying data from PC to DFU device
>> Download[=] 100%   478208 bytes
>> Download done.
>> state(7) = dfuMANIFEST, status(0) = No error condition is present
>> state(10) = dfuERROR, status(14) = Something went wrong, but the
>> device does not know what it was
>> Done!
>>
>> In this case, the binary has 478208 bytes and the M25P32 SPI NOR
>> has an erase sector of 64kB.
>>
>> 478208  = 7 entire sectors of 64kiB + 19456 bytes.
>>
>> Erasing the first seven 64 kB sectors works fine, but when trying
>> to erase the remainding 19456 causes problem and the board hangs.
>>
>> Fix the issue by always erasing with the erase sector size.
>>
>> Signed-off-by: Fabio Estevam 

> Acked-by: Lukasz Majewski 
>
> Applied to u-boot-dfu tree.
>
> Thanks for your work.
>
> I'm looking forward for more patches :-)

Any chance of getting this one applied for 2015.10?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 02/13] x86: fsp: Report correct number of E820 table entries

2015-10-18 Thread Simon Glass
Hi Tom,

On 18 October 2015 at 18:09, Tom Rini  wrote:
> On Sun, Oct 18, 2015 at 06:58:51AM -0600, Simon Glass wrote:
>> Hi Tom,
>>
>> On 28 September 2015 at 22:52, Simon Glass  wrote:
>> > On 28 September 2015 at 03:11, Bin Meng  wrote:
>> >> The logic to calculate the number of E820 table entries is wrong
>> >> when walking through the FSP HOB tables. Fix it.
>> >>
>> >> Signed-off-by: Bin Meng 
>> >> Tested-by: Jian Luo 
>> >>
>> >> ---
>> >> Simon, I think we need get this fix in v2015.10 release.
>> >>
>> >> Changes in v2: None
>> >>
>> >>  arch/x86/lib/fsp/fsp_dram.c | 3 ++-
>> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > Acked-by: Simon Glass 
>>
>> Are you able to pick this one up if it is not too late?
>
> ...
> $ git am -3 
> U-Boot-v2-02-13-x86-fsp-Report-correct-number-of-E820-table-entries.patch
> Applying: x86: fsp: Report correct number of E820 table entries
> Using index info to reconstruct a base tree...
> Falling back to patching base and 3-way merge...
> No changes -- Patch already applied.
> $

Sorry, I must have applied it in a moment of delirium.

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


Re: [U-Boot] [PATCH 1/3] x86: ivybridge: Fix saving mrc cache and enable it

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 4:27 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 12 October 2015 at 02:30, Bin Meng  wrote:
>> Currently sdram_initialise() saves pei_data->mrc_output directly to
>> gd->arch.mrc_output. This is incorrect as pei_data->mrc_output points
>> to an address on the stack whose content is no longer valid when we
>> call mrccache_reserve(). To fix this, save it on the heap instead.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/ivybridge/sdram.c | 20 ++--
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
>> index fc66a3c..f3d97ca 100644
>> --- a/arch/x86/cpu/ivybridge/sdram.c
>> +++ b/arch/x86/cpu/ivybridge/sdram.c
>> @@ -151,14 +151,8 @@ static int prepare_mrc_cache(struct pei_data *pei_data)
>> if (!mrc_cache)
>> return -ENOENT;
>>
>> -   /*
>> -* TODO(s...@chromium.org): Skip this for now as it causes boot
>> -* problems
>> -*/
>> -   if (0) {
>> -   pei_data->mrc_input = mrc_cache->data;
>> -   pei_data->mrc_input_len = mrc_cache->data_size;
>> -   }
>> +   pei_data->mrc_input = mrc_cache->data;
>> +   pei_data->mrc_input_len = mrc_cache->data_size;
>> debug("%s: at %p, size %x checksum %04x\n", __func__,
>>   pei_data->mrc_input, pei_data->mrc_input_len,
>>   mrc_cache->checksum);
>> @@ -289,6 +283,7 @@ int sdram_initialise(struct pei_data *pei_data)
>> unsigned version;
>> const char *data;
>> uint16_t done;
>> +   char *cache;
>> int ret;
>>
>> report_platform_info();
>> @@ -386,8 +381,13 @@ int sdram_initialise(struct pei_data *pei_data)
>>  * This will be copied to SDRAM in reserve_arch(), then 
>> written
>>  * to SPI flash in mrccache_save()
>>  */
>> -   gd->arch.mrc_output = (char *)pei_data->mrc_output;
>> -   gd->arch.mrc_output_len = pei_data->mrc_output_len;
>> +   cache = malloc(pei_data->mrc_output_len);
>> +   if (cache) {
>> +   memcpy(cache, pei_data->mrc_output,
>> +  pei_data->mrc_output_len);
>> +   gd->arch.mrc_output = cache;
>> +   gd->arch.mrc_output_len = pei_data->mrc_output_len;
>> +   }
>
> This isn't really any better than what is there. The malloc() region
> is in CAR memory, just a different part of it. The function
> reserve_arch() copies it to SDRAM.

So where does this pei_data->mrc_input point to? Is it some place that
is malloced by the MRC itself and in a place that does not get
overwritten?

>
> I think with FSP this does not work but for ivybridge it seems OK.
>
> I'll resend your patch with this part removed. Your comments spurred
> me to take another look at why MRC was broken on ivybridge, and I
> found that car_uninit() was wrong. I'll send a series to fix it.
>
>> ret = write_seeds_to_cmos(pei_data);
>> if (ret)
>> debug("Failed to write seeds to CMOS: %d\n", ret);
>> --
>> 1.8.2.1
>>
>
> Regards,
> Simon

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


Re: [U-Boot] [PATCH 2/2] rockchip: firefly: Save the environment on SD card

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:27, Simon Glass  wrote:
> On 18 September 2015 at 22:49, Sjoerd Simons
>  wrote:
>> Save the environment on the SD card for Firefly in the empty space
>> between the SPL and the u-boot image.
>>
>> Signed-off-by: Sjoerd Simons 
>>
>> ---
>>
>>  include/configs/chromebook_jerry.h | 1 +
>>  include/configs/firefly-rk3288.h   | 8 
>>  include/configs/rk3288_common.h| 1 -
>>  3 files changed, 9 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] rockchip: Also load the initrd below 512M

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:27, Simon Glass  wrote:
> On 18 September 2015 at 22:49, Sjoerd Simons
>  wrote:
>> Similar to load an fdt, when loading an initrd about the 512Mb mark
>> things seem to break. For now force loading below 512Mb until the reason
>> why this fails has been determined/solved.
>>
>> Signed-off-by: Sjoerd Simons 
>> ---
>>
>>  include/configs/rk3288_common.h | 1 +
>>  1 file changed, 1 insertion(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/28] dm: tegra: Convert keyboard driver to driver model

2015-10-18 Thread Simon Glass
Adjust the tegra keyboard driver to support driver model, using the new
uclass. Make this the default for all Tegra boards so that those that use
a keyboard will build correctly with this driver.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-tegra/Kconfig |   1 +
 drivers/input/tegra-kbc.c   | 243 
 include/fdtdec.h|   1 -
 lib/fdtdec.c|   1 -
 4 files changed, 112 insertions(+), 134 deletions(-)

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index a5b7e0d..de2454e 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -12,6 +12,7 @@ config TEGRA_ARMV7_COMMON
select DM_I2C
select DM_SPI
select DM_GPIO
+   select DM_KEYBOARD
 
 choice
prompt "Tegra SoC select"
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
index 3310f84..a7137f1 100644
--- a/drivers/input/tegra-kbc.c
+++ b/drivers/input/tegra-kbc.c
@@ -6,8 +6,10 @@
  */
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,14 +42,13 @@ enum {
 };
 
 /* keyboard controller config and state */
-static struct keyb {
-   struct input_config input;  /* The input layer */
+struct tegra_kbd_priv {
+   struct input_config *input; /* The input layer */
struct key_matrix matrix;   /* The key matrix layer */
 
struct kbc_tegra *kbc;  /* tegra keyboard controller */
unsigned char inited;   /* 1 if keyboard has been inited */
unsigned char first_scan;   /* 1 if this is our first key scan */
-   unsigned char created;  /* 1 if driver has been created */
 
/*
 * After init we must wait a short time before polling the keyboard.
@@ -58,17 +59,17 @@ static struct keyb {
unsigned int start_time_ms; /* Time that we inited (in ms) */
unsigned int last_poll_ms;  /* Time we should last polled */
unsigned int next_repeat_ms;/* Next time we repeat a key */
-} config;
+};
 
 /**
  * reads the keyboard fifo for current keypresses
  *
- * @param config   Keyboard config
+ * @param priv Keyboard private data
  * @param fifo Place to put fifo results
  * @param max_keycodes Maximum number of key codes to put in the fifo
  * @return number of items put into fifo
  */
-static int tegra_kbc_find_keys(struct keyb *config, int *fifo,
+static int tegra_kbc_find_keys(struct tegra_kbd_priv *priv, int *fifo,
   int max_keycodes)
 {
struct key_matrix_key keys[KBC_MAX_KPENT], *key;
@@ -78,7 +79,7 @@ static int tegra_kbc_find_keys(struct keyb *config, int *fifo,
for (key = keys, i = 0; i < KBC_MAX_KPENT; i++, key++) {
/* Get next word */
if (!(i & 3))
-   kp_ent = readl(>kbc->kp_ent[i / 4]);
+   kp_ent = readl(>kbc->kp_ent[i / 4]);
 
key->valid = (kp_ent & KBC_KPENT_VALID) != 0;
key->row = (kp_ent >> 3) & 0xf;
@@ -87,7 +88,7 @@ static int tegra_kbc_find_keys(struct keyb *config, int *fifo,
/* Shift to get next entry */
kp_ent >>= 8;
}
-   return key_matrix_decode(>matrix, keys, KBC_MAX_KPENT, fifo,
+   return key_matrix_decode(>matrix, keys, KBC_MAX_KPENT, fifo,
 max_keycodes);
 }
 
@@ -106,10 +107,10 @@ static int tegra_kbc_find_keys(struct keyb *config, int 
*fifo,
  * Note: if fifo_cnt is 0, we will tell the input layer that no keys are
  * pressed.
  *
- * @param config   Keyboard config
+ * @param priv Keyboard private data
  * @param fifo_cnt Number of entries in the keyboard fifo
  */
-static void process_fifo(struct keyb *config, int fifo_cnt)
+static void process_fifo(struct tegra_kbd_priv *priv, int fifo_cnt)
 {
int fifo[KBC_MAX_KPENT];
int cnt = 0;
@@ -117,9 +118,9 @@ static void process_fifo(struct keyb *config, int fifo_cnt)
/* Always call input_send_keycodes() at least once */
do {
if (fifo_cnt)
-   cnt = tegra_kbc_find_keys(config, fifo, KBC_MAX_KPENT);
+   cnt = tegra_kbc_find_keys(priv, fifo, KBC_MAX_KPENT);
 
-   input_send_keycodes(>input, fifo, cnt);
+   input_send_keycodes(priv->input, fifo, cnt);
} while (--fifo_cnt > 0);
 }
 
@@ -127,24 +128,24 @@ static void process_fifo(struct keyb *config, int 
fifo_cnt)
  * Check the keyboard controller and emit ASCII characters for any keys that
  * are pressed.
  *
- * @param config   Keyboard config
+ * @param priv Keyboard private data
  */
-static void check_for_keys(struct keyb *config)
+static void check_for_keys(struct tegra_kbd_priv *priv)
 {
int fifo_cnt;
 
-   if (!config->first_scan &&
-   

[U-Boot] [PATCH v2 23/28] x86: Add an i8042 device for boards that have it

2015-10-18 Thread Simon Glass
Some boards have an i8042 device. Enable the driver for all x86 boards, and
add a device tree node for those which may have this keyboard.

Also adjust the configuration so that i8042 is always separate from the VGA,
and rename the stdin driver accordingly. With this commit the keyboard will
not work, but it is fixed in the next commit.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Drop CONFIG_VGA_AS_SINGLE_DEVICE from all x86 board config files

 arch/x86/Kconfig |  6 ++
 arch/x86/dts/bayleybay.dts   |  1 +
 arch/x86/dts/chromebook_link.dts |  5 +
 arch/x86/dts/keyboard.dtsi   |  5 +
 doc/device-tree-bindings/input/i8042.txt | 10 ++
 include/configs/bayleybay.h  |  3 ---
 include/configs/chromebox_panther.h  |  2 --
 include/configs/minnowmax.h  |  1 -
 include/configs/x86-chromebook.h |  2 +-
 include/configs/x86-common.h |  2 +-
 10 files changed, 29 insertions(+), 8 deletions(-)
 create mode 100644 arch/x86/dts/keyboard.dtsi
 create mode 100644 doc/device-tree-bindings/input/i8042.txt

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5e42d7d..72a66ea 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -401,6 +401,12 @@ config PCIE_ECAM_SIZE
  so a default 0x1000 size covers all of the 256 buses which is the
  maximum number of PCI buses as defined by the PCI specification.
 
+config I8042_KEYB
+   default y
+
+config DM_KEYBOARD
+   default y
+
 source "arch/x86/lib/efi/Kconfig"
 
 endmenu
diff --git a/arch/x86/dts/bayleybay.dts b/arch/x86/dts/bayleybay.dts
index d646987..58d97c8 100644
--- a/arch/x86/dts/bayleybay.dts
+++ b/arch/x86/dts/bayleybay.dts
@@ -10,6 +10,7 @@
 #include 
 
 /include/ "skeleton.dtsi"
+/include/ "keyboard.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
 
diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts
index 4291141..f09868b 100644
--- a/arch/x86/dts/chromebook_link.dts
+++ b/arch/x86/dts/chromebook_link.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 /include/ "skeleton.dtsi"
+/include/ "keyboard.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
 
@@ -41,6 +42,10 @@
stdout-path = "/serial";
};
 
+   keyboard {
+   intel,duplicate-por;
+   };
+
spd {
compatible = "memory-spd";
#address-cells = <1>;
diff --git a/arch/x86/dts/keyboard.dtsi b/arch/x86/dts/keyboard.dtsi
new file mode 100644
index 000..000751b
--- /dev/null
+++ b/arch/x86/dts/keyboard.dtsi
@@ -0,0 +1,5 @@
+/ {
+   keyboard {
+   compatible = "intel,i8042-keyboard";
+   };
+};
diff --git a/doc/device-tree-bindings/input/i8042.txt 
b/doc/device-tree-bindings/input/i8042.txt
new file mode 100644
index 000..cd079c2
--- /dev/null
+++ b/doc/device-tree-bindings/input/i8042.txt
@@ -0,0 +1,10 @@
+i8042 Keyboard
+
+The Intel i8042 is a keyboard controller used on many x86 PCs.
+
+Required properties:
+- compatible: "intel,i8042-keyboard"
+
+Optional properties:
+- intel,duplicate-por: Indicates that a keyboard reset may result in a
+  duplicate POR byte, which should be ignored.
diff --git a/include/configs/bayleybay.h b/include/configs/bayleybay.h
index 1ba2998..ac6b45b 100644
--- a/include/configs/bayleybay.h
+++ b/include/configs/bayleybay.h
@@ -33,9 +33,6 @@
 #define CONFIG_MMC_SDMA
 #define CONFIG_CMD_MMC
 
-/* BayTrail IGD support */
-#define CONFIG_VGA_AS_SINGLE_DEVICE
-
 /* Environment configuration */
 #define CONFIG_ENV_SECT_SIZE   0x1000
 #define CONFIG_ENV_OFFSET  0x006ff000
diff --git a/include/configs/chromebox_panther.h 
b/include/configs/chromebox_panther.h
index dc732b8..00fe26d 100644
--- a/include/configs/chromebox_panther.h
+++ b/include/configs/chromebox_panther.h
@@ -14,6 +14,4 @@
 /* Avoid a warning in the Realtek Ethernet driver */
 #define CONFIG_SYS_CACHELINE_SIZE 16
 
-#define CONFIG_VGA_AS_SINGLE_DEVICE
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/minnowmax.h b/include/configs/minnowmax.h
index 53d86a2..c90af40 100644
--- a/include/configs/minnowmax.h
+++ b/include/configs/minnowmax.h
@@ -43,7 +43,6 @@
 
 #define VIDEO_IO_OFFSET0
 #define CONFIG_X86EMU_RAW_IO
-#define CONFIG_VGA_AS_SINGLE_DEVICE
 
 #define CONFIG_FIT_SIGNATURE
 #define CONFIG_RSA
diff --git a/include/configs/x86-chromebook.h b/include/configs/x86-chromebook.h
index 2be8850..4ff8b94 100644
--- a/include/configs/x86-chromebook.h
+++ b/include/configs/x86-chromebook.h
@@ -51,7 +51,7 @@
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_OFFSET  0x003f8000
 
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \
+#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
"stdout=vga,serial\0" \
"stderr=vga,serial\0"
 
diff --git 

[U-Boot] [PATCH v2 14/28] input: Add a few more keyboard keycodes

2015-10-18 Thread Simon Glass
The slash and * are missing from the keycode tables. Add these so that
these keypad keys can be used.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Fix extra space in commit message

 drivers/input/input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index a6834cf..e65942e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -43,7 +43,7 @@ static const uchar kbd_plain_xlate[] = {
'8',  '9',  '-',  '4',  '5',  '6',  '+',  '1',  /* 0x40 - 0x4f */
'2',  '3',  '0',  '.', 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */
-   '\r', 0xff, 0xff
+   '\r', 0xff, '/',  '*',
 };
 
 static unsigned char kbd_shift_xlate[] = {
@@ -59,7 +59,7 @@ static unsigned char kbd_shift_xlate[] = {
'8', '9', '-', '4', '5', '6', '+', '1', /* 0x40 - 0x4f */
'2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,   /* 0x50 - 0x5F */
-   '\r', 0xff, 0xff
+   '\r', 0xff, '/',  '*',
 };
 
 static unsigned char kbd_ctrl_xlate[] = {
@@ -75,7 +75,7 @@ static unsigned char kbd_ctrl_xlate[] = {
'8', '9', '-', '4', '5', '6', '+', '1', /* 0x40 - 0x4f */
'2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */
-   '\r', 0xff, 0xff
+   '\r', 0xff, '/',  '*',
 };
 
 /*
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 09/28] video: Drop unused console functions

2015-10-18 Thread Simon Glass
CONFIG_CONSOLE_CURSOR, CONFIG_SYS_CONSOLE_BLINK_COUNT and
CONFIG_CONSOLE_TIME are not used by any board. The implementation is not
great and stands in the way of a refactor of i8042. Drop these for now.
They can be re-introduced quite easily later, perhaps with driver-model
real-time-clock (RTC) support.

When reintroducing, it might be useful to make a few changes:
- Blink time would be more useful than blink count
- The confusing #ifdefs should be avoided
- The time functions should support driver model
- It would be best keyed off console_tstc() or some similar idle loop
rather than a particular input driver (i8042 in this case)

Signed-off-by: Simon Glass 
---

Changes in v2:
- Update commit message to explain what RTC means

 README|  7 -
 drivers/input/i8042.c | 23 
 drivers/video/cfb_console.c   | 62 +++
 include/configs/MPC8536DS.h   |  1 -
 include/configs/MPC8544DS.h   |  1 -
 include/configs/MPC8572DS.h   |  1 -
 include/configs/MPC8641HPCN.h |  1 -
 7 files changed, 9 insertions(+), 87 deletions(-)

diff --git a/README b/README
index d381422..99f2b97 100644
--- a/README
+++ b/README
@@ -880,13 +880,6 @@ The following options need to be configured:
(i.e. i8042_tstc)
VIDEO_GETC_FCT  get char fct
(i.e. i8042_getc)
-   CONFIG_CONSOLE_CURSOR   cursor drawing on/off
-   (requires blink timer
-   cf. i8042.c)
-   CONFIG_SYS_CONSOLE_BLINK_COUNT blink interval (cf. 
i8042.c)
-   CONFIG_CONSOLE_TIME display time/date info in
-   upper right corner
-   (requires CONFIG_CMD_DATE)
CONFIG_VIDEO_LOGO   display Linux logo in
upper left corner
CONFIG_VIDEO_BMP_LOGO   use bmp_logo.h instead of
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 9b5fa32..7b95b21 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -17,12 +17,6 @@
 #define in8(p) inb(p)
 #define out8(p, v) outb(v, p)
 
-#ifdef CONFIG_CONSOLE_CURSOR
-extern void console_cursor(int state);
-static int blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-static int cursor_state;
-#endif
-
 /* locals */
 
 static int kbd_input = -1; /* no input yet */
@@ -598,15 +592,6 @@ int i8042_tstc(struct stdio_dev *dev)
 {
unsigned char scan_code = 0;
 
-#ifdef CONFIG_CONSOLE_CURSOR
-   if (--blink_count == 0) {
-   cursor_state ^= 1;
-   console_cursor(cursor_state);
-   blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-   udelay(10);
-   }
-#endif
-
if ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
return 0;
} else {
@@ -635,14 +620,6 @@ int i8042_getc(struct stdio_dev *dev)
 
while (kbd_input == -1) {
while ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
-#ifdef CONFIG_CONSOLE_CURSOR
-   if (--blink_count == 0) {
-   cursor_state ^= 1;
-   console_cursor(cursor_state);
-   blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-   }
-   udelay(10);
-#endif
}
scan_code = in8(I8042_DATA_REG);
if (scan_code != 0xfa)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index aa7ca86..1b5c3e0 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -43,13 +43,6 @@
  * VIDEO_TSTC_FCT- keyboard_tstc function
  * VIDEO_GETC_FCT- keyboard_getc function
  *
- * CONFIG_CONSOLE_CURSOR  - on/off drawing cursor is done with
- * delay loop in VIDEO_TSTC_FCT (i8042)
- *
- * CONFIG_SYS_CONSOLE_BLINK_COUNT - value for delay loop - blink rate
- * CONFIG_CONSOLE_TIME   - display time/date in upper right
- * corner, needs CONFIG_CMD_DATE and
- * CONFIG_CONSOLE_CURSOR
  * CONFIG_VIDEO_LOGO - display Linux Logo in upper left corner.
  * Use CONFIG_SPLASH_SCREEN_ALIGN with
  * environment variable "splashpos" to place
@@ -198,9 +191,6 @@
 
 /*
  * Cursor definition:
- * CONFIG_CONSOLE_CURSOR:  Uses a timer function (see drivers/input/i8042.c)
- *to let the cursor blink. Uses the macros
- *CURSOR_OFF and CURSOR_ON.
  * CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No
  *blinking 

[U-Boot] [PATCH v2 15/28] input: Add a function to add a keycode to the existing set

2015-10-18 Thread Simon Glass
Most keyboards can be scanned to produce a list of the keycodes which are
depressed. With the i8042 keyboard this scanning is done internally and
only the processed results are returned.

In this case, when a key is pressed, a 'make' code is sent. When the key
is released an 'unmake' code is sent. This means that the driver needs to
keep track of which keys are pressed. It also means that any protocol error
can lead to stuck keys.

In order to support this type of keyboard, add a function when can be used
to provide a single keycode and either add it to the list of what is pressed
or remove it from the list. Then the normal input_send_keycodes() function
can be used to actually do the decoding work.

Add debugging to display the ASCII characters written to the input queue
also.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/input/input.c | 46 ++
 include/input.h   | 20 
 2 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index e65942e..530bf51 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -107,6 +107,7 @@ static int input_queue_ascii(struct input_config *config, 
int ch)
return -1; /* buffer full */
config->fifo_in++;
}
+   debug(" {%02x} ", ch);
config->fifo[config->fifo_in] = (uchar)ch;
 
return 0;
@@ -394,8 +395,8 @@ static int input_keycodes_to_ascii(struct input_config 
*config,
return ch_count;
 }
 
-int input_send_keycodes(struct input_config *config,
-   int keycode[], int num_keycodes)
+static int _input_send_keycodes(struct input_config *config, int keycode[],
+   int num_keycodes, bool do_send)
 {
char ch[num_keycodes * ANSI_CHAR_MAX];
int count, i, same = 0;
@@ -420,8 +421,10 @@ int input_send_keycodes(struct input_config *config,
 
count = input_keycodes_to_ascii(config, keycode, num_keycodes,
ch, sizeof(ch), is_repeat ? 0 : same);
-   for (i = 0; i < count; i++)
-   input_queue_ascii(config, ch[i]);
+   if (do_send) {
+   for (i = 0; i < count; i++)
+   input_queue_ascii(config, ch[i]);
+   }
delay_ms = is_repeat ?
config->repeat_rate_ms :
config->repeat_delay_ms;
@@ -431,6 +434,41 @@ int input_send_keycodes(struct input_config *config,
return count;
 }
 
+int input_send_keycodes(struct input_config *config, int keycode[],
+   int num_keycodes)
+{
+   return _input_send_keycodes(config, keycode, num_keycodes, true);
+}
+
+int input_add_keycode(struct input_config *config, int new_keycode,
+ bool release)
+{
+   int keycode[INPUT_MAX_MODIFIERS + 1];
+   int count, i;
+
+   /* Add the old keycodes which are not removed by this new one */
+   for (i = 0, count = 0; i < config->num_prev_keycodes; i++) {
+   int code = config->prev_keycodes[i];
+
+   if (new_keycode == code) {
+   if (release)
+   continue;
+   new_keycode = -1;
+   }
+   keycode[count++] = code;
+   }
+
+   if (!release && new_keycode != -1)
+   keycode[count++] = new_keycode;
+   debug("\ncodes for %02x/%d: ", new_keycode, release);
+   for (i = 0; i < count; i++)
+   debug("%02x ", keycode[i]);
+   debug("\n");
+
+   /* Don't output any ASCII characters if this is a key release */
+   return _input_send_keycodes(config, keycode, count, !release);
+}
+
 int input_add_table(struct input_config *config, int left_keycode,
int right_keycode, const uchar *xlate, int num_entries)
 {
diff --git a/include/input.h b/include/input.h
index 71f3538..9942d6f 100644
--- a/include/input.h
+++ b/include/input.h
@@ -76,6 +76,26 @@ struct stdio_dev;
 int input_send_keycodes(struct input_config *config, int keycode[], int count);
 
 /**
+ * Add a new keycode to an existing list of keycodes
+ *
+ * This can be used to handle keyboards which do their own scanning. An
+ * internal list of depressed keys is maintained by the input library. Then
+ * this function is called to add a new key to the list (when a 'make code' is
+ * received), or remove a key (when a 'break code' is received).
+ *
+ * This function looks after maintenance of the list of active keys, and calls
+ * input_send_keycodes() with its updated list.
+ *
+ * @param config   Input state
+ * @param new_keycode  New keycode to add/remove
+ * @param release  true if this key was released, false if depressed
+ * @return number of ascii characters sent, or 0 if none, or -1 for an
+ * internal error
+ */
+int input_add_keycode(struct input_config 

[U-Boot] [PATCH v2 13/28] input: Correct keycode for Ctrl-Y

2015-10-18 Thread Simon Glass
This code is currently incorrect, perhaps due to a typo. Fix it.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/input/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 82e8381..a6834cf 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -65,7 +65,7 @@ static unsigned char kbd_shift_xlate[] = {
 static unsigned char kbd_ctrl_xlate[] = {
0xff, 0x1b, '1', 0x00, '3', '4', '5', 0x1E,
'7', '8', '9', '0', 0x1F, '=', '\b', '\t',  /* 0x00 - 0x0f */
-   0x11, 0x17, 0x05, 0x12, 0x14, 0x18, 0x15, 0x09,
+   0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09,
0x0f, 0x10, 0x1b, 0x1d, '\n', 0xff, 0x01, 0x13, /* 0x10 - 0x1f */
0x04, 0x06, 0x08, 0x09, 0x0a, 0x0b, 0x0c, ';',
'\'', '~', 0x00, 0x1c, 0x1a, 0x18, 0x03, 0x16,  /* 0x20 - 0x2f */
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 10/28] i8042: Use functions to handle register access

2015-10-18 Thread Simon Glass
At present the register access in kbd_reset() is quite primitive. This makes
it hard to follow.

Create functions to read and write data, both to a single register, and via
the command/data approach.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
Tested-on: Intel Crown Bay and QEMU
Tested-by: Bin Meng 
---

Changes in v2: None

 drivers/input/i8042.c | 75 ++-
 1 file changed, 44 insertions(+), 31 deletions(-)

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 7b95b21..dbd4b00 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -446,53 +446,66 @@ static void kbd_conv_char(unsigned char scan_code)
return;
 }
 
-static int kbd_reset(void)
+static int kbd_write(int reg, int value)
 {
-   u8 config;
-
-   /* controller self test */
-   if (kbd_input_empty() == 0)
-   return -1;
-   out8(I8042_CMD_REG, CMD_SELF_TEST);
-   if (kbd_output_full() == 0)
-   return -1;
-   if (in8(I8042_DATA_REG) != KBC_TEST_OK)
+   if (!kbd_input_empty())
return -1;
+   out8(reg, value);
 
-   /* keyboard reset */
-   if (kbd_input_empty() == 0)
+   return 0;
+}
+
+static int kbd_read(int reg)
+{
+   if (!kbd_output_full())
return -1;
-   out8(I8042_DATA_REG, CMD_RESET_KBD);
-   if (kbd_output_full() == 0)
+
+   return in8(reg);
+}
+
+static int kbd_cmd_read(int cmd)
+{
+   if (kbd_write(I8042_CMD_REG, cmd))
return -1;
-   if (in8(I8042_DATA_REG) != KBD_ACK)
+
+   return kbd_read(I8042_DATA_REG);
+}
+
+static int kbd_cmd_write(int cmd, int data)
+{
+   if (kbd_write(I8042_CMD_REG, cmd))
return -1;
-   if (kbd_output_full() == 0)
+
+   return kbd_write(I8042_DATA_REG, data);
+}
+
+static int kbd_reset(void)
+{
+   int config;
+
+   /* controller self test */
+   if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK)
return -1;
-   if (in8(I8042_DATA_REG) != KBD_POR)
+
+   /* keyboard reset */
+   if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
+   kbd_read(I8042_DATA_REG) != KBD_ACK ||
+   kbd_read(I8042_DATA_REG) != KBD_POR)
return -1;
 
/* set AT translation and disable irq */
-   if (kbd_input_empty() == 0)
-   return -1;
-   out8(I8042_CMD_REG, CMD_RD_CONFIG);
-   if (kbd_output_full() == 0)
+   config = kbd_cmd_read(CMD_RD_CONFIG);
+   if (config == -1)
return -1;
-   config = in8(I8042_DATA_REG);
+
config |= CONFIG_AT_TRANS;
config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
-   if (kbd_input_empty() == 0)
+   if (kbd_cmd_write(CMD_WR_CONFIG, config))
return -1;
-   out8(I8042_CMD_REG, CMD_WR_CONFIG);
-   if (kbd_input_empty() == 0)
-   return -1;
-   out8(I8042_DATA_REG, config);
 
/* enable keyboard */
-   if (kbd_input_empty() == 0)
-   return -1;
-   out8(I8042_CMD_REG, CMD_KBD_EN);
-   if (kbd_input_empty() == 0)
+   if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) ||
+   !kbd_input_empty())
return -1;
 
return 0;
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 06/28] dm: stdio: Plumb in the new keyboard uclass

2015-10-18 Thread Simon Glass
When driver model is used for keyboards we must scan the available keyboards
and register them with stdio. Add code to do this.

At some point (once LCD/video is converted) we should be able to convert
stdio to driver model and avoid these dual data structures.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 common/stdio.c | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/common/stdio.c b/common/stdio.c
index adbfc89..71cc32e 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -24,6 +25,8 @@
 #include 
 #endif
 
+#include 
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct stdio_dev devs;
@@ -245,6 +248,32 @@ int stdio_init_tables(void)
 
 int stdio_add_devices(void)
 {
+#ifdef CONFIG_DM_KEYBOARD
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   /*
+* For now we probe all the devices here. At some point this should be
+* done only when the devices are required - e.g. we have a list of
+* input devices to start up in the stdin environment variable. That
+* work probably makes more sense when stdio itself is converted to
+* driver model.
+*
+* TODO(s...@chromium.org): Convert changing uclass_first_device() etc.
+* to return the device even on error. Then we could use that here.
+*/
+   ret = uclass_get(UCLASS_KEYBOARD, );
+   if (ret)
+   return ret;
+
+   /* Don't report errors to the caller - assume that they are non-fatal */
+   uclass_foreach_dev(dev, uc) {
+   ret = device_probe(dev);
+   if (ret)
+   printf("Failed to probe keyboard '%s'\n", dev->name);
+   }
+#endif
 #ifdef CONFIG_SYS_I2C
i2c_init_all();
 #else
@@ -258,7 +287,7 @@ int stdio_add_devices(void)
 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
drv_video_init ();
 #endif
-#ifdef CONFIG_KEYBOARD
+#if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
drv_keyboard_init ();
 #endif
 #ifdef CONFIG_LOGBUFFER
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 08/28] dm: cros_ec: Convert cros_ec keyboard driver to driver model

2015-10-18 Thread Simon Glass
Adjust the cros_ec keyboard driver to support driver model. Make this the
default for all Exynos boards so that those that use a keyboard will build
correctly with this driver.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 README   |   5 --
 arch/arm/Kconfig |   1 +
 arch/sandbox/Kconfig |   3 +
 drivers/input/cros_ec_keyb.c | 148 +--
 4 files changed, 62 insertions(+), 95 deletions(-)

diff --git a/README b/README
index ca49225..d381422 100644
--- a/README
+++ b/README
@@ -1793,11 +1793,6 @@ CBFS (Coreboot Filesystem) support
Export function i8042_kbd_init, i8042_tstc and i8042_getc
for cfb_console. Supports cursor blinking.
 
-   CONFIG_CROS_EC_KEYB
-   Enables a Chrome OS keyboard using the CROS_EC interface.
-   This uses CROS_EC to communicate with a second microcontroller
-   which provides key scans on request.
-
 - Video support:
CONFIG_VIDEO
 
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7981355..f29febe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -420,6 +420,7 @@ config ARCH_EXYNOS
select DM_SERIAL
select DM_SPI
select DM_GPIO
+   select DM_KEYBOARD
 
 config ARCH_S5PC1XX
bool "Samsung S5PC1XX"
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index f078c9e..25e316c 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -17,4 +17,7 @@ config PCI
  used on some devices to allow the CPU to communicate with its
  peripherals.
 
+config DM_KEYBOARD
+   default y
+
 endmenu
diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
index 88397b0..fe5caea 100644
--- a/drivers/input/cros_ec_keyb.c
+++ b/drivers/input/cros_ec_keyb.c
@@ -8,9 +8,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -22,31 +24,29 @@ enum {
KBC_REPEAT_DELAY_MS = 240,
 };
 
-static struct keyb {
-   struct cros_ec_dev *dev;/* The CROS_EC device */
-   struct input_config input;  /* The input layer */
+struct cros_ec_keyb_priv {
+   struct input_config *input; /* The input layer */
struct key_matrix matrix;   /* The key matrix layer */
int key_rows;   /* Number of keyboard rows */
int key_cols;   /* Number of keyboard columns */
int ghost_filter;   /* 1 to enable ghost filter, else 0 */
-   int inited; /* 1 if keyboard is ready */
-} config;
+};
 
 
 /**
  * Check the keyboard controller and return a list of key matrix positions
  * for which a key is pressed
  *
- * @param config   Keyboard config
+ * @param dev  Keyboard device
  * @param keys List of keys that we have detected
  * @param max_countMaximum number of keys to return
  * @param samepSet to true if this scan repeats the last, else 
false
  * @return number of pressed keys, 0 for none, -EIO on error
  */
-static int check_for_keys(struct keyb *config,
-  struct key_matrix_key *keys, int max_count,
-  bool *samep)
+static int check_for_keys(struct udevice *dev, struct key_matrix_key *keys,
+ int max_count, bool *samep)
 {
+   struct cros_ec_keyb_priv *priv = dev_get_priv(dev);
struct key_matrix_key *key;
static struct mbkp_keyscan last_scan;
static bool last_scan_valid;
@@ -54,7 +54,7 @@ static int check_for_keys(struct keyb *config,
unsigned int row, col, bit, data;
int num_keys;
 
-   if (cros_ec_scan_keyboard(config->dev->dev, )) {
+   if (cros_ec_scan_keyboard(dev->parent, )) {
debug("%s: keyboard scan failed\n", __func__);
return -EIO;
}
@@ -69,9 +69,9 @@ static int check_for_keys(struct keyb *config,
last_scan_valid = true;
memcpy(_scan, , sizeof(last_scan));
 
-   for (col = num_keys = bit = 0; col < config->matrix.num_cols;
+   for (col = num_keys = bit = 0; col < priv->matrix.num_cols;
col++) {
-   for (row = 0; row < config->matrix.num_rows; row++) {
+   for (row = 0; row < priv->matrix.num_rows; row++) {
unsigned int mask = 1 << (bit & 7);
 
data = scan.data[bit / 8];
@@ -89,28 +89,6 @@ static int check_for_keys(struct keyb *config,
 }
 
 /**
- * Test if keys are available to be read
- *
- * @return 0 if no keys available, 1 if keys are available
- */
-static int kbd_tstc(struct stdio_dev *dev)
-{
-   /* Just get input to do this for us */
-   return config.inited ? input_tstc() : 0;
-}
-
-/**
- * Read a key
- *
- * @return ASCII key code, or 0 if no key, or -1 if error
- */
-static int kbd_getc(struct stdio_dev 

[U-Boot] [PATCH v2 12/28] i8042: Adjust keyboard init to assume success

2015-10-18 Thread Simon Glass
Modify i8042_kbd_init() so that the normal pass is sucessful init and
failure exits early. This will make the code easier to extend and is easier
to read.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 drivers/input/i8042.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 4c887f4..b1ada86 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -585,18 +585,17 @@ int i8042_kbd_init(void)
keymap = KBD_GER;
}
 
-   for (try = 0; try < KBD_RESET_TRIES; try++) {
-   if (kbd_reset() == 0) {
-   kbd_mapping = keymap;
-   kbd_flags   = NORMAL;
-   kbd_state   = 0;
-   kbd_led_set();
-
-   return 0;
-   }
+   for (try = 0; kbd_reset() != 0; try++) {
+   if (try >= KBD_RESET_TRIES)
+   return -1;
}
 
-   return -1;
+   kbd_mapping = keymap;
+   kbd_flags   = NORMAL;
+   kbd_state   = 0;
+   kbd_led_set();
+
+   return 0;
 }
 
 /*
-- 
2.6.0.rc2.230.g3dd15c0

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


Re: [U-Boot] [PATCH v2 2/5] debug_uart: Support board-specific UART initialisation

2015-10-18 Thread Bin Meng
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass  wrote:
> Some boards need to set things up before the debug UART can be used. On
> these boards a call to debug_uart_init() is insufficient. When this option
> is enabled, the function board_debug_uart_init() will be called when
> debug_uart_init() is called. You can put any code here that is needed to
> set up the UART ready for use, such as set pin multiplexing or enable
> clocks.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2: None
>
>  drivers/serial/Kconfig | 11 +++
>  include/debug_uart.h   | 14 ++
>  2 files changed, 25 insertions(+)
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index ddb725d..39f6500 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -109,6 +109,17 @@ config DEBUG_UART_SHIFT
>   value. Use this value to specify the shift to use, where 0=byte
>   registers, 2=32-bit word registers, etc.
>
> +config DEBUG_UART_BOARD_INIT
> +   bool "Enable board-specific debug UART init"
> +   depends on DEBUG_UART
> +   help
> + Some boards need to set things up before the debug UART can be used.
> + On these boards a call to debug_uart_init() is insufficient. When
> + this option is enabled, the function board_debug_uart_init() will
> + be called when debug_uart_init() is called. You can put any code
> + here that is needed to set up the UART ready for use, such as set
> + pin multiplexing or enable clocks.
> +
>  config ROCKCHIP_SERIAL
> bool "Rockchip on-chip UART support"
> depends on ARCH_ROCKCHIP && DM_SERIAL
> diff --git a/include/debug_uart.h b/include/debug_uart.h
> index 257ba00..a6b7ce8 100644
> --- a/include/debug_uart.h
> +++ b/include/debug_uart.h
> @@ -42,6 +42,11 @@
>   * - Define _debug_uart_putc() as static inline (avoiding stack usage)
>   * - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
>   * functionality (printch(), etc.)
> + *
> + * If your board needs additional init for the UART to work, enable
> + * CONFIG_DEBUG_UART_BOARD_INIT and write a function called
> + * board_debug_uart_init() to perform that init. When debug_uart_init() is
> + * called, the init will happen automatically.
>   */
>
>  /**
> @@ -57,6 +62,14 @@
>   */
>  void debug_uart_init(void);
>
> +#ifdef CONFIG_DEBUG_UART_BOARD_INIT
> +void board_debug_uart_init(void);
> +#else
> +static inline void board_debug_uart_init(void)
> +{
> +}
> +#endif
> +
>  /**
>   * printch() - Output a character to the debug UART
>   *
> @@ -136,6 +149,7 @@ void printhex8(uint value);
>  \
> void debug_uart_init(void) \
> { \
> +   board_debug_uart_init(); \
> _debug_uart_init(); \
> } \
>
> --

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


Re: [U-Boot] [PATCH v2 3/5] debug_uart: Add an option to announce the debug UART

2015-10-18 Thread Bin Meng
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass  wrote:
> It is useful to see a message from the debug UART early during boot so that
> you know things are working. Add an option to enable this. The message will
> be displayed as soon as debug_uart_init() is called.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2: None
>
>  drivers/serial/Kconfig | 10 ++
>  include/debug_uart.h   |  7 +++
>  2 files changed, 17 insertions(+)
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 39f6500..ac5920a 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -120,6 +120,16 @@ config DEBUG_UART_BOARD_INIT
>   here that is needed to set up the UART ready for use, such as set
>   pin multiplexing or enable clocks.
>
> +config DEBUG_UART_ANNOUNCE
> +   bool "Show a message when the debug UART starts up"
> +   depends on DEBUG_UART
> +   help
> + Enable this option to show a message when the debug UART is ready
> + for use. You will see a message like " " as soon as
> + U-Boot has the UART ready for use (i.e. your code calls
> + debug_uart_init()). This can be useful just as a check that
> + everything is working.
> +
>  config ROCKCHIP_SERIAL
> bool "Rockchip on-chip UART support"
> depends on ARCH_ROCKCHIP && DM_SERIAL
> diff --git a/include/debug_uart.h b/include/debug_uart.h
> index a6b7ce8..5d5349b 100644
> --- a/include/debug_uart.h
> +++ b/include/debug_uart.h
> @@ -105,6 +105,12 @@ void printhex4(uint value);
>   */
>  void printhex8(uint value);
>
> +#ifdef CONFIG_DEBUG_UART_ANNOUNCE
> +#define _DEBUG_UART_ANNOUNCE   printascii(" ");
> +#else
> +#define _DEBUG_UART_ANNOUNCE
> +#endif
> +
>  /*
>   * Now define some functions - this should be inserted into the serial driver
>   */
> @@ -151,6 +157,7 @@ void printhex8(uint value);
> { \
> board_debug_uart_init(); \
> _debug_uart_init(); \
> +   _DEBUG_UART_ANNOUNCE \
> } \
>
>  #endif
> --

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


Re: [U-Boot] [PATCH 3/3] x86: galileo: Enable mrc cache

2015-10-18 Thread Simon Glass
On 12 October 2015 at 02:30, Bin Meng  wrote:
> Now that we have added MRC cache on quark support codes,
> enable it on Intel Galileo board.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/dts/galileo.dts  | 4 
>  configs/galileo_defconfig | 1 +
>  2 files changed, 5 insertions(+)

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


[U-Boot] [PATCH v2 2/2] arm: fix compile warnings when semihosting is enabled on ARMv7M target.

2015-10-18 Thread Vadzim Dambrouski
Signed-off-by: Vadzim Dambrouski 
---

 arch/arm/lib/semihosting.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index ed5e8e4..6541cb4 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -92,7 +92,7 @@ static long smh_read(long fd, void *memp, size_t len)
size_t len;
} read;
 
-   debug("%s: fd %ld, memp %p, len %lu\n", __func__, fd, memp, len);
+   debug("%s: fd %ld, memp %p, len %lu\n", __func__, fd, memp, (ulong)len);
 
read.fd = fd;
read.memp = memp;
@@ -107,7 +107,7 @@ static long smh_read(long fd, void *memp, size_t len)
 * with an error message.
 */
printf("%s: ERROR ret %ld, fd %ld, len %lu memp %p\n",
-  __func__, ret, fd, len, memp);
+  __func__, ret, fd, (ulong)len, memp);
return -1;
}
 
-- 
2.6.1

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


[U-Boot] [PATCH v2 1/2] arm: add support for semihosting for ARMv7M targets

2015-10-18 Thread Vadzim Dambrouski
It is possible to enable CONFIG_SEMIHOSTING for STM32F429 target, but it
would result in compile error. This patch adds support for semihosting for
STM32F429 or any other ARMv7M target. Tested on STM32F429-DISCOVERY board.

Signed-off-by: Vadzim Dambrouski 
---

 arch/arm/lib/semihosting.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index c3e964e..ed5e8e4 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -31,6 +31,8 @@ static noinline long smh_trap(unsigned int sysnum, void *addr)
register long result asm("r0");
 #if defined(CONFIG_ARM64)
asm volatile ("hlt #0xf000" : "=r" (result) : "0"(sysnum), "r"(addr));
+#elif defined(CONFIG_CPU_V7M)
+   asm volatile ("bkpt #0xAB" : "=r" (result) : "0"(sysnum), "r"(addr));
 #else
/* Note - untested placeholder */
asm volatile ("svc #0x123456" : "=r" (result) : "0"(sysnum), "r"(addr));
-- 
2.6.1

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


[U-Boot] [PATCH 4/9] x86: ivybridge: Use 'ret' instead of 'rcode'

2015-10-18 Thread Simon Glass
For consistency, use 'ret' to handle a return value.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/ivybridge/sdram.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index fc66a3c..26e2e5b 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -93,11 +93,11 @@ static int read_seed_from_cmos(struct pei_data *pei_data)
 {
u16 c1, c2, checksum, seed_checksum;
struct udevice *dev;
-   int rcode = 0;
+   int ret = 0;
 
-   rcode = uclass_get_device(UCLASS_RTC, 0, );
-   if (rcode) {
-   debug("Cannot find RTC: err=%d\n", rcode);
+   ret = uclass_get_device(UCLASS_RTC, 0, );
+   if (ret) {
+   debug("Cannot find RTC: err=%d\n", ret);
return -ENODEV;
}
 
@@ -170,11 +170,11 @@ static int write_seeds_to_cmos(struct pei_data *pei_data)
 {
u16 c1, c2, checksum;
struct udevice *dev;
-   int rcode = 0;
+   int ret = 0;
 
-   rcode = uclass_get_device(UCLASS_RTC, 0, );
-   if (rcode) {
-   debug("Cannot find RTC: err=%d\n", rcode);
+   ret = uclass_get_device(UCLASS_RTC, 0, );
+   if (ret) {
+   debug("Cannot find RTC: err=%d\n", ret);
return -ENODEV;
}
 
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 3/9] dm: rtc: Correct rtc_read32() return value

2015-10-18 Thread Simon Glass
The current check is incorrect and will fail when any non-zero byte is read.
Fix it.

Signed-off-by: Simon Glass 
---

 drivers/rtc/rtc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index fe74c69..300e9b3 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 
*valuep)
 
for (i = 0; i < sizeof(value); i++) {
ret = rtc_read8(dev, reg + i);
-   if (ret)
+   if (ret < 0)
return ret;
value |= ret << (i << 3);
}
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 7/9] x86: ivybridge: Fix car_uninit() to correctly set run state

2015-10-18 Thread Simon Glass
At present a missing $ causes this code to hang when using the MRC cache/
Fix it.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/ivybridge/car.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/ivybridge/car.S b/arch/x86/cpu/ivybridge/car.S
index 770ef17..b75c2a5 100644
--- a/arch/x86/cpu/ivybridge/car.S
+++ b/arch/x86/cpu/ivybridge/car.S
@@ -188,7 +188,7 @@ car_uninit:
wrmsr
 
/* Disable the no-eviction run state */
-   movlNOEVICTMOD_MSR, %ecx
+   movl$NOEVICTMOD_MSR, %ecx
rdmsr
andl$~2, %eax
wrmsr
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 2/9] rtc: mc146818: Use probe() to set up the device

2015-10-18 Thread Simon Glass
At present this driver uses bind() to set up the device. The bind() method
should not touch the hardware, so move the init code to probe().

Signed-off-by: Simon Glass 
---

 drivers/rtc/mc146818.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c
index 9e94a80..da804d5 100644
--- a/drivers/rtc/mc146818.c
+++ b/drivers/rtc/mc146818.c
@@ -225,7 +225,7 @@ static int rtc_mc146818_write8(struct udevice *dev, 
unsigned int reg, int val)
return 0;
 }
 
-static int rtc_mc146818_bind(struct udevice *dev)
+static int rtc_mc146818_probe(struct udevice *dev)
 {
mc146818_init();
 
@@ -249,7 +249,7 @@ U_BOOT_DRIVER(rtc_mc146818) = {
.name = "rtc_mc146818",
.id = UCLASS_RTC,
.of_match = rtc_mc146818_ids,
-   .bind = rtc_mc146818_bind,
+   .probe = rtc_mc146818_probe,
.ops = _mc146818_ops,
 };
 
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 0/9] x86: Fix up the MRC cache on ivybridge

2015-10-18 Thread Simon Glass
At present the MRC cache on ivybridge is disabled due to a bug which was
unknown. This has now been located and a fix is included in this series. In
addition, the RTC functions have a few problems which prevent the checksum
from being read correctly. This series fixes these and adds a few other
minor improvements.

Also included is a modified version of Bin's patch to enable the MRC cache
on ivybridge.


Bin Meng (1):
  x86: ivybridge: Enable the MRC cache

Simon Glass (8):
  rtc: mc146818: Add a comment to the #endif
  rtc: mc146818: Use probe() to set up the device
  dm: rtc: Correct rtc_read32() return value
  x86: ivybridge: Use 'ret' instead of 'rcode'
  x86: ivybridge: Check the RTC return value
  x86: ivybridge: Use CONFIG_ENABLE_MRC_CACHE option
  x86: ivybridge: Fix car_uninit() to correctly set run state
  x86: ivybridge: Measure the MRC code execution time

 arch/x86/cpu/ivybridge/Kconfig |  6 --
 arch/x86/cpu/ivybridge/car.S   |  6 +++---
 arch/x86/cpu/ivybridge/sdram.c | 42 +++---
 drivers/rtc/mc146818.c |  6 +++---
 drivers/rtc/rtc-uclass.c   |  2 +-
 5 files changed, 30 insertions(+), 32 deletions(-)

-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 5/9] x86: ivybridge: Check the RTC return value

2015-10-18 Thread Simon Glass
The RTC can fail, so check the return value for reads.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/ivybridge/sdram.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index 26e2e5b..e637909 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -107,11 +107,18 @@ static int read_seed_from_cmos(struct pei_data *pei_data)
 * the flash too much. So we store these in CMOS and the large MRC
 * data in SPI flash.
 */
-   rtc_read32(dev, CMOS_OFFSET_MRC_SEED, _data->scrambler_seed);
+   ret = rtc_read32(dev, CMOS_OFFSET_MRC_SEED, _data->scrambler_seed);
+   if (!ret) {
+   ret = rtc_read32(dev, CMOS_OFFSET_MRC_SEED_S3,
+_data->scrambler_seed_s3);
+   }
+   if (ret) {
+   debug("Failed to read from RTC %s\n", dev->name);
+   return ret;
+   }
+
debug("Read scrambler seed0x%08x from CMOS 0x%02x\n",
  pei_data->scrambler_seed, CMOS_OFFSET_MRC_SEED);
-
-   rtc_read32(dev, CMOS_OFFSET_MRC_SEED_S3, _data->scrambler_seed_s3);
debug("Read S3 scrambler seed 0x%08x from CMOS 0x%02x\n",
  pei_data->scrambler_seed_s3, CMOS_OFFSET_MRC_SEED_S3);
 
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 8/9] x86: ivybridge: Measure the MRC code execution time

2015-10-18 Thread Simon Glass
This code takes about 450ms without the MRC cache and about 27ms with the
cache. Add a debug timer so that this time can be displayed.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/ivybridge/sdram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index e637909..d9b3dfc 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -336,9 +336,11 @@ int sdram_initialise(struct pei_data *pei_data)
if (data) {
int rv;
int (*func)(struct pei_data *);
+   ulong start;
 
debug("Calling MRC at %p\n", data);
post_code(POST_PRE_MRC);
+   start = get_timer(0);
func = (int (*)(struct pei_data *))data;
rv = func(pei_data);
post_code(POST_MRC);
@@ -356,6 +358,7 @@ int sdram_initialise(struct pei_data *pei_data)
printf("Nonzero MRC return value.\n");
return -EFAULT;
}
+   debug("MRC execution time %lu ms\n", get_timer(start));
} else {
printf("UEFI PEI System Agent not found.\n");
return -ENOSYS;
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 6/9] x86: ivybridge: Use CONFIG_ENABLE_MRC_CACHE option

2015-10-18 Thread Simon Glass
Use this option instead of a private CONFIG_CACHE_MRC_BIN option.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/ivybridge/Kconfig | 6 --
 arch/x86/cpu/ivybridge/car.S   | 4 ++--
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/x86/cpu/ivybridge/Kconfig b/arch/x86/cpu/ivybridge/Kconfig
index 0e249a4..c3f324e 100644
--- a/arch/x86/cpu/ivybridge/Kconfig
+++ b/arch/x86/cpu/ivybridge/Kconfig
@@ -8,12 +8,10 @@
 
 config NORTHBRIDGE_INTEL_SANDYBRIDGE
bool
-   select CACHE_MRC_BIN
select CPU_INTEL_MODEL_206AX
 
 config NORTHBRIDGE_INTEL_IVYBRIDGE
bool
-   select CACHE_MRC_BIN
select CPU_INTEL_MODEL_306AX
 
 if NORTHBRIDGE_INTEL_SANDYBRIDGE
@@ -136,8 +134,4 @@ config SOCKET_SPECIFIC_OPTIONS # dummy
select SSE
select CACHE_AS_RAM
 
-config CACHE_MRC_BIN
-   bool
-   default n
-
 endif
diff --git a/arch/x86/cpu/ivybridge/car.S b/arch/x86/cpu/ivybridge/car.S
index 407e451..770ef17 100644
--- a/arch/x86/cpu/ivybridge/car.S
+++ b/arch/x86/cpu/ivybridge/car.S
@@ -145,7 +145,7 @@ clear_mtrrs:
wrmsr
 
post_code(POST_CAR_ROM_CACHE)
-#ifdef CONFIG_CACHE_MRC_BIN
+#ifdef CONFIG_ENABLE_MRC_CACHE
/* Enable caching for ram init code to run faster */
movl$MTRR_PHYS_BASE_MSR(2), %ecx
movl$(CACHE_MRC_BASE | MTRR_TYPE_WRPROT), %eax
@@ -200,7 +200,7 @@ car_uninit:
andl$~1, %eax
wrmsr
 
-#ifdef CONFIG_CACHE_MRC_BIN
+#ifdef CONFIG_ENABLE_MRC_CACHE
/* Clear the MTRR that was used to cache MRC */
xorl%eax, %eax
xorl%edx, %edx
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 9/9] x86: ivybridge: Enable the MRC cache

2015-10-18 Thread Simon Glass
From: Bin Meng 

This works correctly now, so enable it.

Signed-off-by: Bin Meng 
Dropped malloc() and adjusted commit message:
Signed-off-by: Simon Glass 

---

 arch/x86/cpu/ivybridge/sdram.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index d9b3dfc..4372a5c 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -158,14 +158,8 @@ static int prepare_mrc_cache(struct pei_data *pei_data)
if (!mrc_cache)
return -ENOENT;
 
-   /*
-* TODO(s...@chromium.org): Skip this for now as it causes boot
-* problems
-*/
-   if (0) {
-   pei_data->mrc_input = mrc_cache->data;
-   pei_data->mrc_input_len = mrc_cache->data_size;
-   }
+   pei_data->mrc_input = mrc_cache->data;
+   pei_data->mrc_input_len = mrc_cache->data_size;
debug("%s: at %p, size %x checksum %04x\n", __func__,
  pei_data->mrc_input, pei_data->mrc_input_len,
  mrc_cache->checksum);
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH 1/9] rtc: mc146818: Add a comment to the #endif

2015-10-18 Thread Simon Glass
Add a comment to make it clear to which block the #endif relates.

Signed-off-by: Simon Glass 
---

 drivers/rtc/mc146818.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c
index 363ade3..9e94a80 100644
--- a/drivers/rtc/mc146818.c
+++ b/drivers/rtc/mc146818.c
@@ -192,7 +192,7 @@ static void mc146818_init(void)
/* Clear any pending interrupts */
mc146818_read8(RTC_CONFIG_C);
 }
-#endif
+#endif /* CONFIG_CMD_DATE */
 
 #ifdef CONFIG_DM_RTC
 
-- 
2.6.0.rc2.230.g3dd15c0

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


Re: [U-Boot] [PATCH v6] nios2: convert dma_alloc_coherent to use malloc_cache_aligned

2015-10-18 Thread Thomas Chou



On 10/16/2015 04:29 PM, Thomas Chou wrote:

Convert dma_alloc_coherent to use memalign.

Signed-off-by: Thomas Chou 
---
v2
   use memalign.
v3
   check memalign() return for out of memory.
v4
   use malloc_cache_aligned().
v5
   use invalidate_dcache_range() as Marek suggested.
v6
   defer assignment of handle as Marek suggested.

  arch/nios2/include/asm/dma-mapping.h | 27 ++-
  1 file changed, 14 insertions(+), 13 deletions(-)



Applied to u-boot-nios.

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


Re: [U-Boot] [PATCH 11/13] x86: baytrail: Issue full system reset in reset_cpu()

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 4:27 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 11 October 2015 at 22:37, Bin Meng  wrote:
>> With MRC cache enabled, when typing 'reset' in the U-Boot shell,
>> BayTrail FSP initialization hangs at "Configuring Memory Start":
>>
>>   Setting BootMode to 0
>>   Install PPI: 1F4C6F90-B06B-48D8-A201-BAE5F1CD7D56
>>   Register PPI Notify: F894643D-C449-42D1-8EA8-85BDD8C65BDE
>>   About to call MrcInit();
>>   BayleyBay Platform Type
>>   CurrentMrcData.BootMode = 4
>>   Taking Fastboot path!
>>   Configuring Memory Start...
>>
>> Changing reset_cpu() to do a full system reset fixes this issue.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/baytrail/valleyview.c | 6 ++
>>  1 file changed, 6 insertions(+)
>
> Acked-by: Simon Glass 
>
>>
>> diff --git a/arch/x86/cpu/baytrail/valleyview.c 
>> b/arch/x86/cpu/baytrail/valleyview.c
>> index 215e0d0..a009c14 100644
>> --- a/arch/x86/cpu/baytrail/valleyview.c
>> +++ b/arch/x86/cpu/baytrail/valleyview.c
>> @@ -65,3 +65,9 @@ int reserve_arch(void)
>>  #endif
>>  }
>>  #endif
>> +
>> +void reset_cpu(ulong addr)
>> +{
>> +   /* cold reset */
>> +   x86_full_reset();
>> +}
>> --
>> 1.8.2.1
>>
>
> Actually on Minnowmax this doesn't fix the hang.

That's strange. As full reset indicates a complete power cycle. Does
MinnowMax boot with MRC cache enabled?

>
> Also I don't see any speed-up from using the cache on Minnowmax.

On Galileo, I did not see any speed-up either. I think it is because
on MinnowMax and Galileo they both uses memory-down configuration. The
speed-up seems only helpful for DIMMs (on Intel Bayley Bay)

>
> Regards,
> Simon

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


Re: [U-Boot] [PATCH 7/9] x86: ivybridge: Fix car_uninit() to correctly set run state

2015-10-18 Thread Simon Glass
Hi Bin,

On 18 October 2015 at 20:23, Bin Meng  wrote:
> Hi Simon,
>
> On Mon, Oct 19, 2015 at 5:55 AM, Simon Glass  wrote:
>> At present a missing $ causes this code to hang when using the MRC cache/
>> Fix it.
>>
>> Signed-off-by: Simon Glass 
>
> Reviewed-by: Bin Meng 
>
>> ---
>>
>>  arch/x86/cpu/ivybridge/car.S | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/cpu/ivybridge/car.S b/arch/x86/cpu/ivybridge/car.S
>> index 770ef17..b75c2a5 100644
>> --- a/arch/x86/cpu/ivybridge/car.S
>> +++ b/arch/x86/cpu/ivybridge/car.S
>> @@ -188,7 +188,7 @@ car_uninit:
>> wrmsr
>>
>> /* Disable the no-eviction run state */
>> -   movlNOEVICTMOD_MSR, %ecx
>> +   movl$NOEVICTMOD_MSR, %ecx
>
> I am wondering why compiler does not complain this.
>

I suppose it just uses the value at that address.

>> rdmsr
>> andl$~2, %eax
>> wrmsr
>> --

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


Re: [U-Boot] [PATCH 2/9] rtc: mc146818: Use probe() to set up the device

2015-10-18 Thread Simon Glass
Hi Bin,

On 18 October 2015 at 20:22, Bin Meng  wrote:
> Hi Simon,
>
> On Mon, Oct 19, 2015 at 5:55 AM, Simon Glass  wrote:
>> At present this driver uses bind() to set up the device. The bind() method
>> should not touch the hardware, so move the init code to probe().
>>
>
> I think RTC should be initialized anyway. If moving it to probe, it
> may not be initialized by U-Boot before jumping to kernel.

That's fine, but the correct way to do this is to probe the device,
not put the init code into the bind() method.

>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  drivers/rtc/mc146818.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c
>> index 9e94a80..da804d5 100644
>> --- a/drivers/rtc/mc146818.c
>> +++ b/drivers/rtc/mc146818.c
>> @@ -225,7 +225,7 @@ static int rtc_mc146818_write8(struct udevice *dev, 
>> unsigned int reg, int val)
>> return 0;
>>  }
>>
>> -static int rtc_mc146818_bind(struct udevice *dev)
>> +static int rtc_mc146818_probe(struct udevice *dev)
>>  {
>> mc146818_init();
>>
>> @@ -249,7 +249,7 @@ U_BOOT_DRIVER(rtc_mc146818) = {
>> .name = "rtc_mc146818",
>> .id = UCLASS_RTC,
>> .of_match = rtc_mc146818_ids,
>> -   .bind = rtc_mc146818_bind,
>> +   .probe = rtc_mc146818_probe,
>> .ops = _mc146818_ops,
>>  };
>>
>> --
>
> Regards,
> Bin

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


[U-Boot] [PATCH] net: convert altera_tse to driver model and phylib

2015-10-18 Thread Thomas Chou
Convert altera_tse to driver model and phylib.

Signed-off-by: Thomas Chou 
---
 configs/nios2-generic_defconfig |   2 +
 doc/device-tree-bindings/net/altera_tse.txt | 112 
 drivers/net/Kconfig |   9 +
 drivers/net/altera_tse.c| 938 ++--
 drivers/net/altera_tse.h| 283 +++--
 include/configs/nios2-generic.h |   8 +
 6 files changed, 536 insertions(+), 816 deletions(-)
 create mode 100644 doc/device-tree-bindings/net/altera_tse.txt

diff --git a/configs/nios2-generic_defconfig b/configs/nios2-generic_defconfig
index ea07b56..fbc27ea 100644
--- a/configs/nios2-generic_defconfig
+++ b/configs/nios2-generic_defconfig
@@ -18,6 +18,8 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ALTERA_PIO=y
 CONFIG_MISC=y
 CONFIG_ALTERA_SYSID=y
+CONFIG_DM_ETH=y
+CONFIG_ALTERA_TSE=y
 CONFIG_ALTERA_JTAG_UART=y
 CONFIG_ALTERA_JTAG_UART_BYPASS=y
 CONFIG_TIMER=y
diff --git a/doc/device-tree-bindings/net/altera_tse.txt 
b/doc/device-tree-bindings/net/altera_tse.txt
new file mode 100644
index 000..cb190df
--- /dev/null
+++ b/doc/device-tree-bindings/net/altera_tse.txt
@@ -0,0 +1,112 @@
+* Altera Triple-Speed Ethernet MAC driver (TSE)
+
+Required properties:
+- compatible: Should be "altr,tse-1.0" for legacy SGDMA based TSE, and should
+   be "altr,tse-msgdma-1.0" for the preferred MSGDMA based TSE.
+- reg: Address and length of the register set for the device. It contains
+  the information of registers in the same order as described by reg-names
+- reg-names: Should contain the reg names
+  "control_port": MAC configuration space region
+  "tx_csr":   xDMA Tx dispatcher control and status space region
+  "tx_desc":  MSGDMA Tx dispatcher descriptor space region
+  "rx_csr" :  xDMA Rx dispatcher control and status space region
+  "rx_desc":  MSGDMA Rx dispatcher descriptor space region
+  "rx_resp":  MSGDMA Rx dispatcher response space region
+  "s1":  SGDMA descriptor memory
+- interrupts: Should contain the TSE interrupts and it's mode.
+- interrupt-names: Should contain the interrupt names
+  "rx_irq":   xDMA Rx dispatcher interrupt
+  "tx_irq":   xDMA Tx dispatcher interrupt
+- rx-fifo-depth: MAC receive FIFO buffer depth in bytes
+- tx-fifo-depth: MAC transmit FIFO buffer depth in bytes
+- phy-mode: See ethernet.txt in the same directory.
+- phy-handle: See ethernet.txt in the same directory.
+- phy-addr: See ethernet.txt in the same directory. A configuration should
+   include phy-handle or phy-addr.
+- altr,has-supplementary-unicast:
+   If present, TSE supports additional unicast addresses.
+   Otherwise additional unicast addresses are not supported.
+- altr,has-hash-multicast-filter:
+   If present, TSE supports a hash based multicast filter.
+   Otherwise, hash-based multicast filtering is not supported.
+
+- mdio device tree subnode: When the TSE has a phy connected to its local
+   mdio, there must be device tree subnode with the following
+   required properties:
+
+   - compatible: Must be "altr,tse-mdio".
+   - #address-cells: Must be <1>.
+   - #size-cells: Must be <0>.
+
+   For each phy on the mdio bus, there must be a node with the following
+   fields:
+
+   - reg: phy id used to communicate to phy.
+   - device_type: Must be "ethernet-phy".
+
+Optional properties:
+- local-mac-address: See ethernet.txt in the same directory.
+- max-frame-size: See ethernet.txt in the same directory.
+
+Example:
+
+   tse_sub_0_eth_tse_0: ethernet@0x1, {
+   compatible = "altr,tse-msgdma-1.0";
+   reg =   <0x0001 0x 0x0400>,
+   <0x0001 0x0460 0x0020>,
+   <0x0001 0x0480 0x0020>,
+   <0x0001 0x04A0 0x0008>,
+   <0x0001 0x0400 0x0020>,
+   <0x0001 0x0420 0x0020>;
+   reg-names = "control_port", "rx_csr", "rx_desc", "rx_resp", 
"tx_csr", "tx_desc";
+   interrupt-parent = <_0_arm_gic_0>;
+   interrupts = <0 41 4>, <0 40 4>;
+   interrupt-names = "rx_irq", "tx_irq";
+   rx-fifo-depth = <2048>;
+   tx-fifo-depth = <2048>;
+   address-bits = <48>;
+   max-frame-size = <1500>;
+   local-mac-address = [ 00 00 00 00 00 00 ];
+   phy-mode = "gmii";
+   altr,has-supplementary-unicast;
+   altr,has-hash-multicast-filter;
+   phy-handle = <>;
+   mdio {
+   compatible = "altr,tse-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   phy0: ethernet-phy@0 {
+  

Re: [U-Boot] [PATCH v4 00/21] sf: Tunning spi-flash layer

2015-10-18 Thread Simon Glass
Hi Jagan,

On 12 October 2015 at 09:00, Jagan Teki  wrote:
> Previous version link:
> http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/233262
>
> spi-flash layer need to tune a lot for better code handling and
> to sync with Linux spi-nor. So below areas got updated in this series.
> - BAR handling
> - spi_flash_cmd_wait_ready updates.
> - Separate core spi-flash handling and spi-flash interface
>   (interface between spi drivers vs spi-flash layer)
>
> Currently I'm working on spi-nor framework for u-boot which
> is slighly same as Linux spi-nor core with addition of
> u-boot driver model to it.
>
> This series will be starting point to add spi-nor functionalities.
>
> TODO:
> - MTD core addition to spi-flash layer.
> - spi-nor core addition.
>
> Code sizes:
> After:
> dm:
>textdata bss dec hex filename
>  354820   12016  221112  587948   8f8ac u-boot
> non-dm
>textdata bss dec hex filename
>  354317   11876  221124  587317   8f635 u-boot
>
> Before:
> dm
>textdata bss dec hex filename
>  354878   12016  221096  587990   8f8d6 u-boot
> non-dm
>textdata bss dec hex filename
>  354447   11876  221124  587447   8f6b7 u-boot

I don't think you should be adding new features to the
non-driver-model SPI flash code. We are supposed to be migrating
everything to driver model, so it would be better to move your boards
over, and then work to deprecate and remove the old code. Adding new
features to it sends the wrong message.

Sorry if I am misunderstanding your intent here.

>
> Testing:
> $ git clone git://git.denx.de/u-boot-spi.git
> $ cd u-boot-spi
> $ git checkout -b spi-nor-tune origin/next-spi-nor-tune
>
> thanks!
> Jagan.
>
> Jagan Teki (21):
>   spi: zynq_spi: Remove unneeded headers
>   sf: Return bank_sel, if flash->bank_curr == bank_sel
>   sf: Add spi_flash_read_bar
>   sf: Optimize BAR write code
>   sf: Make flash->flags use for generic usage
>   sf: Update status reg check in spi_flash_cmd_wait_ready
>   sf: Add FSR support to spi_flash_cmd_wait_ready
>   sf: spi_flash_validate_params => spi_flash_scan
>   sf: Move spi_flash_scan code to sf_ops
>   sf: Move the read_id code to sf_ops
>   sf: Move BAR defined code at once place
>   sf: Use static for file-scope functions
>   sf: Fix Makefile
>   sf: Use simple name for register access functions
>   sf: Use flash function pointers in dm_spi_flash_ops
>   sf: Flash power up read-only based on idcode0
>   sf: Use static for file-scope functions
>   sf: Remove unneeded header includes
>   sf: probe: Use spi_flash_scan in dm-spi-flash
>   sf: Re-factorize spi_flash_probe_tail code
>   dm-sf: Re-factorize spi_flash_std_probe code
>
>  drivers/mtd/spi/Makefile  |   6 +-
>  drivers/mtd/spi/sf_internal.h |  57 ++---
>  drivers/mtd/spi/sf_ops.c  | 488 
> +++---
>  drivers/mtd/spi/sf_probe.c| 446 ++
>  drivers/spi/zynq_spi.c|   6 +-
>  include/spi_flash.h   |  19 +-
>  6 files changed, 494 insertions(+), 528 deletions(-)
>
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH 09/13] x86: baytrail: Save mrc cache to spi flash

2015-10-18 Thread Simon Glass
On 11 October 2015 at 22:37, Bin Meng  wrote:
> Save MRC cache to SPI flash in arch_misc_init().
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/baytrail/valleyview.c | 19 +++
>  1 file changed, 19 insertions(+)

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


Re: [U-Boot] [PATCH 00/13] x86: Provide a common MRC cache library and enable it for FSP

2015-10-18 Thread Simon Glass
Hi Bin,

On 12 October 2015 at 02:30, Bin Meng  wrote:
> Hi Simon,
>
> On Mon, Oct 12, 2015 at 12:37 PM, Bin Meng  wrote:
>> This series moves existing MRC cache codes in the ivybridge cpu
>> diretory to a common place and makes some changes so that every
>> x86 board benefits from it. It also updates FSP support codes
>> to pass MRC cache data to fsp_init() to speed up boot time.
>>
>> Currently tested on Intel Bayley Bay board. Minnow Max board should
>> work as it uses the same FSP that Bayley Bay uses. For Chromebook
>> I cannot test that, but I see Simon added a TODO in the codes below:
>>
>> /*
>>  * TODO(s...@chromium.org): Skip this for now as it causes boot
>>  * problems
>>  */
>> if (0) {
>> pei_data->mrc_input = mrc_cache->data;
>> pei_data->mrc_input_len = mrc_cache->data_size;
>> }
>>
>> I have no idea what breaks the MRC cache on the Chromebook board.
>> Simon, you may retest this on top of this series to see if things
>> go better.
>>
>
> Can you please try this patch on Chromebook?
> http://patchwork.ozlabs.org/patch/528970/
>
> I suspect this patch fixes the boot failures you saw before.
>
> [snip]

Thanks for the prod - actually the problem turns out to be in
car_uninit() so I will send a series to fix that, and some RTC
problems.

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


Re: [U-Boot] [PATCH 10/13] x86: Enable mrc cache for bayleybay and minnowmax

2015-10-18 Thread Simon Glass
On 11 October 2015 at 22:37, Bin Meng  wrote:
> Now that we have added MRC cache for Intel FSP and BayTrail codes,
> enable it for all BayTrail boards (Bayley Bay and Minnow Max).
>
> Note it turns out that FSP for Intel Atom E6xx does not produce
> the HOB for NV storage, so we don't have such functionality on
> Intel Crown Bay board.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/dts/bayleybay.dts  | 6 ++
>  arch/x86/dts/minnowmax.dts  | 6 ++
>  configs/bayleybay_defconfig | 1 +
>  configs/minnowmax_defconfig | 1 +
>  doc/README.x86  | 1 +
>  5 files changed, 15 insertions(+)

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


Re: [U-Boot] [PATCH 11/13] x86: baytrail: Issue full system reset in reset_cpu()

2015-10-18 Thread Simon Glass
Hi Bin,

On 11 October 2015 at 22:37, Bin Meng  wrote:
> With MRC cache enabled, when typing 'reset' in the U-Boot shell,
> BayTrail FSP initialization hangs at "Configuring Memory Start":
>
>   Setting BootMode to 0
>   Install PPI: 1F4C6F90-B06B-48D8-A201-BAE5F1CD7D56
>   Register PPI Notify: F894643D-C449-42D1-8EA8-85BDD8C65BDE
>   About to call MrcInit();
>   BayleyBay Platform Type
>   CurrentMrcData.BootMode = 4
>   Taking Fastboot path!
>   Configuring Memory Start...
>
> Changing reset_cpu() to do a full system reset fixes this issue.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/baytrail/valleyview.c | 6 ++
>  1 file changed, 6 insertions(+)

Acked-by: Simon Glass 

>
> diff --git a/arch/x86/cpu/baytrail/valleyview.c 
> b/arch/x86/cpu/baytrail/valleyview.c
> index 215e0d0..a009c14 100644
> --- a/arch/x86/cpu/baytrail/valleyview.c
> +++ b/arch/x86/cpu/baytrail/valleyview.c
> @@ -65,3 +65,9 @@ int reserve_arch(void)
>  #endif
>  }
>  #endif
> +
> +void reset_cpu(ulong addr)
> +{
> +   /* cold reset */
> +   x86_full_reset();
> +}
> --
> 1.8.2.1
>

Actually on Minnowmax this doesn't fix the hang.

Also I don't see any speed-up from using the cache on Minnowmax.

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


Re: [U-Boot] [PATCH 12/13] x86: Remove unused rw-mrc-cache properties in the link and panther dts files

2015-10-18 Thread Simon Glass
Hi Bin,

On 11 October 2015 at 22:37, Bin Meng  wrote:
> "type" and "wipe-value" are never used by the mrccache codes.
> Remove them to avoid confusion. This also removes the alignment
> comment in the panther dts file.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/dts/chromebook_link.dts   | 2 --
>  arch/x86/dts/chromebox_panther.dts | 3 ---
>  2 files changed, 5 deletions(-)

Acked-by: Simon Glass 

These are used by the cros_bundle_firmware tool in Chrome OS, which
builds the image. But it does not matter for upstream.

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


Re: [U-Boot] [PATCH 13/13] x86: ivybridge: Correct two typos for MRC

2015-10-18 Thread Simon Glass
On 11 October 2015 at 22:37, Bin Meng  wrote:
> It should be MRC, not MCR.
>
> Signed-off-by: Bin Meng 
>
> ---
>
>  arch/x86/cpu/ivybridge/sdram.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 1/3] x86: ivybridge: Fix saving mrc cache and enable it

2015-10-18 Thread Simon Glass
Hi Bin,

On 12 October 2015 at 02:30, Bin Meng  wrote:
> Currently sdram_initialise() saves pei_data->mrc_output directly to
> gd->arch.mrc_output. This is incorrect as pei_data->mrc_output points
> to an address on the stack whose content is no longer valid when we
> call mrccache_reserve(). To fix this, save it on the heap instead.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/ivybridge/sdram.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
> index fc66a3c..f3d97ca 100644
> --- a/arch/x86/cpu/ivybridge/sdram.c
> +++ b/arch/x86/cpu/ivybridge/sdram.c
> @@ -151,14 +151,8 @@ static int prepare_mrc_cache(struct pei_data *pei_data)
> if (!mrc_cache)
> return -ENOENT;
>
> -   /*
> -* TODO(s...@chromium.org): Skip this for now as it causes boot
> -* problems
> -*/
> -   if (0) {
> -   pei_data->mrc_input = mrc_cache->data;
> -   pei_data->mrc_input_len = mrc_cache->data_size;
> -   }
> +   pei_data->mrc_input = mrc_cache->data;
> +   pei_data->mrc_input_len = mrc_cache->data_size;
> debug("%s: at %p, size %x checksum %04x\n", __func__,
>   pei_data->mrc_input, pei_data->mrc_input_len,
>   mrc_cache->checksum);
> @@ -289,6 +283,7 @@ int sdram_initialise(struct pei_data *pei_data)
> unsigned version;
> const char *data;
> uint16_t done;
> +   char *cache;
> int ret;
>
> report_platform_info();
> @@ -386,8 +381,13 @@ int sdram_initialise(struct pei_data *pei_data)
>  * This will be copied to SDRAM in reserve_arch(), then 
> written
>  * to SPI flash in mrccache_save()
>  */
> -   gd->arch.mrc_output = (char *)pei_data->mrc_output;
> -   gd->arch.mrc_output_len = pei_data->mrc_output_len;
> +   cache = malloc(pei_data->mrc_output_len);
> +   if (cache) {
> +   memcpy(cache, pei_data->mrc_output,
> +  pei_data->mrc_output_len);
> +   gd->arch.mrc_output = cache;
> +   gd->arch.mrc_output_len = pei_data->mrc_output_len;
> +   }

This isn't really any better than what is there. The malloc() region
is in CAR memory, just a different part of it. The function
reserve_arch() copies it to SDRAM.

I think with FSP this does not work but for ivybridge it seems OK.

I'll resend your patch with this part removed. Your comments spurred
me to take another look at why MRC was broken on ivybridge, and I
found that car_uninit() was wrong. I'll send a series to fix it.

> ret = write_seeds_to_cmos(pei_data);
> if (ret)
> debug("Failed to write seeds to CMOS: %d\n", ret);
> --
> 1.8.2.1
>

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


Re: [U-Boot] [PATCH 2/3] x86: quark: Implement mrc cache

2015-10-18 Thread Simon Glass
On 12 October 2015 at 02:30, Bin Meng  wrote:
> Using existing mrccache library to implement mrc cache support
> for Intel Quark.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/quark/dram.c  | 52 
> +++---
>  arch/x86/cpu/quark/quark.c | 19 +
>  2 files changed, 64 insertions(+), 7 deletions(-)

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


Re: [U-Boot] [PATCH v3 08/12] cmd: bootvx: Pass netmask and gatewayip to VxWorks bootline

2015-10-18 Thread Simon Glass
On 8 October 2015 at 10:09, Simon Glass  wrote:
> On 8 October 2015 at 04:19, Bin Meng  wrote:
>> There are fields in VxWorks bootline for netmask and gatewayip.
>> We can get these from U-Boot environment variables and pass them
>> to VxWorks, just like ipaddr and serverip.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - Avoid calls to strlen()
>>
>> Changes in v2:
>> - Fix the endian issue for netmask
>>
>>  common/cmd_elf.c | 17 +++--
>>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 07/12] cmd: bootvx: Avoid strlen() calls when constructing VxWorks bootline

2015-10-18 Thread Simon Glass
On 8 October 2015 at 10:09, Simon Glass  wrote:
> On 8 October 2015 at 04:19, Bin Meng  wrote:
>> Remember the position in the VxWorks bootline buffer to avoid the call
>> to strlen() each time.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - New patch to avoid strlen() calls when constructing VxWorks bootline
>>
>> Changes in v2: None
>>
>>  common/cmd_elf.c | 20 ++--
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> Reviewed-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 01/12] x86: Initialize GDT entry 1 to be the 32-bit CS as well

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> Some OS (like VxWorks) requires GDT entry 1 to be the 32-bit CS.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 
> Tested-by: Jian Luo 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/cpu/cpu.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 03/12] x86: Remove quotation mark in CONFIG_HOSTNAME

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> CONFIG_HOSTNAME is an environment varible, so that quotation mark
> is not needed.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 
>
> ---
>
> Changes in v3: None
> Changes in v2:
> - New patch to remove quotation mark in CONFIG_HOSTNAME
>
>  include/configs/x86-common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 02/12] x86: Move install_e820_map() out of zimage.c

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> install_e820_map() has nothing to do with zimage related codes.
> Move it to a dedicated place.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 
>
> ---
>
> Changes in v3: None
> Changes in v2:
> - New patch to move install_e820_map() out of zimage.c
>
>  arch/x86/include/asm/e820.h   |  3 +++
>  arch/x86/include/asm/zimage.h |  3 ---
>  arch/x86/lib/Makefile |  1 +
>  arch/x86/lib/e820.c   | 37 +
>  arch/x86/lib/zimage.c | 26 --
>  5 files changed, 41 insertions(+), 29 deletions(-)
>  create mode 100644 arch/x86/lib/e820.c

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 04/12] cmd: Convert CONFIG_CMD_ELF to Kconfig

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> Convert CONFIG_CMD_ELF to Kconfig and tidy up affected boards.
>
> Signed-off-by: Bin Meng 
>
> ---
>
> Changes in v3: None
> Changes in v2:
> - Split the defconfig reorder to another patch, making this patch
>   as CONFIG_CMD_ELF mods only
> - Update sparc and avr32 boards to unset CONFIG_CMD_ELF
>
>  common/Kconfig  | 6 ++
>  configs/atngw100_defconfig  | 1 +
>  configs/atngw100mkii_defconfig  | 1 +
>  configs/atstk1002_defconfig | 1 +
>  configs/dbau1000_defconfig  | 1 +
>  configs/dbau1100_defconfig  | 1 +
>  configs/dbau1500_defconfig  | 1 +
>  configs/dbau1550_defconfig  | 1 +
>  configs/dbau1550_el_defconfig   | 1 +
>  configs/dlvision-10g_defconfig  | 1 +
>  configs/dlvision_defconfig  | 1 +
>  configs/gr_cpci_ax2000_defconfig| 1 +
>  configs/gr_ep2s60_defconfig | 1 +
>  configs/gr_xc3s_1500_defconfig  | 1 +
>  configs/grasshopper_defconfig   | 1 +
>  configs/grsim_defconfig | 1 +
>  configs/grsim_leon2_defconfig   | 1 +
>  configs/io_defconfig| 1 +
>  configs/iocon_defconfig | 1 +
>  configs/neo_defconfig   | 1 +
>  configs/pb1000_defconfig| 1 +
>  configs/sandbox_defconfig   | 1 +
>  configs/vct_platinum_onenand_small_defconfig| 1 +
>  configs/vct_platinum_small_defconfig| 1 +
>  configs/vct_platinumavc_onenand_small_defconfig | 1 +
>  configs/vct_platinumavc_small_defconfig | 1 +
>  configs/vct_premium_onenand_small_defconfig | 1 +
>  configs/vct_premium_small_defconfig | 1 +
>  include/config_cmd_all.h| 1 -
>  include/config_distro_defaults.h| 1 -
>  include/configs/B4860QDS.h  | 1 -
>  include/configs/BSC9131RDB.h| 1 -
>  include/configs/BSC9132QDS.h| 1 -
>  include/configs/C29XPCIE.h  | 1 -
>  include/configs/CPCI2DP.h   | 1 -
>  include/configs/CPCI4052.h  | 1 -
>  include/configs/M5208EVBE.h | 1 -
>  include/configs/M52277EVB.h | 1 -
>  include/configs/M5235EVB.h  | 1 -
>  include/configs/M5272C3.h   | 1 -
>  include/configs/M5275EVB.h  | 1 -
>  include/configs/M53017EVB.h | 1 -
>  include/configs/M5329EVB.h  | 1 -
>  include/configs/M5373EVB.h  | 1 -
>  include/configs/M54418TWR.h | 1 -
>  include/configs/M54451EVB.h | 1 -
>  include/configs/M54455EVB.h | 1 -
>  include/configs/M5475EVB.h  | 1 -
>  include/configs/M5485EVB.h  | 1 -
>  include/configs/MIP405.h| 1 -
>  include/configs/MPC8536DS.h | 1 -
>  include/configs/MPC8540ADS.h| 1 -
>  include/configs/MPC8541CDS.h| 1 -
>  include/configs/MPC8544DS.h | 1 -
>  include/configs/MPC8548CDS.h| 1 -
>  include/configs/MPC8555CDS.h| 1 -
>  include/configs/MPC8560ADS.h| 1 -
>  include/configs/MPC8568MDS.h| 1 -
>  include/configs/MPC8569MDS.h| 1 -
>  include/configs/MPC8572DS.h | 1 -
>  include/configs/P1010RDB.h  | 1 -
>  include/configs/P1022DS.h   | 1 -
>  include/configs/P2041RDB.h  | 1 -
>  include/configs/PIP405.h| 1 -
>  include/configs/PLU405.h| 1 -
>  include/configs/PMC405DE.h  | 1 -
>  include/configs/PMC440.h| 1 -
>  include/configs/T102xQDS.h  | 1 -
>  include/configs/T102xRDB.h  | 1 -
>  include/configs/T1040QDS.h  | 1 -
>  include/configs/T104xRDB.h  | 1 -
>  include/configs/T208xQDS.h  | 1 -
>  include/configs/T208xRDB.h  | 1 -
>  include/configs/T4240RDB.h  | 1 -
>  include/configs/TQM823L.h   | 1 -
>  include/configs/TQM823M.h   | 1 -
>  include/configs/TQM850L.h   | 1 -
>  include/configs/TQM850M.h   | 1 -
>  include/configs/TQM855L.h   | 1 -
>  include/configs/TQM855M.h   | 1 -
>  include/configs/TQM860L.h  

Re: [U-Boot] [PATCH 6/6] x86: Allow disabling IGD on Intel Queensbay

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:29, Simon Glass  wrote:
> Hi Bin,
>
> On 1 October 2015 at 08:36, Bin Meng  wrote:
>> Add a Kconfig option to disable the Integrated Graphics Device (IGD)
>> so that it does not show in the PCI configuration space as a VGA
>> disaplay controller. This gives a chance for U-Boot to run PCI/PCIe
>> based graphics card's VGA BIOS and use that for the graphics console.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>>  arch/x86/cpu/queensbay/Kconfig|  8 
>>  arch/x86/cpu/queensbay/tnc.c  | 19 +++
>>  arch/x86/include/asm/arch-queensbay/tnc.h |  5 +
>>  include/configs/crownbay.h|  1 +
>>  4 files changed, 33 insertions(+)
>
> Acked-by: Simon Glass 
>
> But do we really want configs for such device-specific things? I
> wonder if device tree would be better. E.g. add 'status = "disabled"'
> in the PCI node.
>
>>
>> diff --git a/arch/x86/cpu/queensbay/Kconfig b/arch/x86/cpu/queensbay/Kconfig
>> index fbf85f2..6136d75 100644
>> --- a/arch/x86/cpu/queensbay/Kconfig
>> +++ b/arch/x86/cpu/queensbay/Kconfig
>> @@ -42,4 +42,12 @@ config CPU_ADDR_BITS
>> int
>> default 32
>>
>> +config DISABLE_IGD
>> +   bool "Disable Integrated Graphics Device (IGD)"
>> +   help
>> + Disable the Integrated Graphics Device (IGD) so that it does not
>> + show in the PCI configuration space as a VGA disaplay controller.
>> + This gives a chance for U-Boot to run PCI/PCIe based graphics
>> + card's VGA BIOS and use that card for the graphics console.
>> +
>>  endif
>> diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
>> index 9682cff..0c02a44 100644
>> --- a/arch/x86/cpu/queensbay/tnc.c
>> +++ b/arch/x86/cpu/queensbay/tnc.c
>> @@ -23,6 +23,16 @@ static void unprotect_spi_flash(void)
>> x86_pci_write_config32(TNC_LPC, 0xd8, bc);
>>  }
>>
>> +static void __maybe_unused disable_igd(void)
>> +{
>> +   u32 gc;
>> +
>> +   gc = x86_pci_read_config32(TNC_IGD, IGD_GC);
>> +   gc &= ~GMS_MASK;
>> +   gc |= VGA_DISABLE;
>> +   x86_pci_write_config32(TNC_IGD, IGD_GC, gc);
>> +}
>> +
>>  int arch_cpu_init(void)
>>  {
>> int ret;
>> @@ -39,6 +49,15 @@ int arch_cpu_init(void)
>> return 0;
>>  }
>>
>> +int arch_early_init_r(void)
>> +{
>> +#ifdef CONFIG_DISABLE_IGD
>> +   disable_igd();
>> +#endif
>> +
>> +   return 0;
>> +}
>> +
>>  void cpu_irq_init(void)
>>  {
>> struct tnc_rcba *rcba;
>> diff --git a/arch/x86/include/asm/arch-queensbay/tnc.h 
>> b/arch/x86/include/asm/arch-queensbay/tnc.h
>> index ad9a6c4..2365394 100644
>> --- a/arch/x86/include/asm/arch-queensbay/tnc.h
>> +++ b/arch/x86/include/asm/arch-queensbay/tnc.h
>> @@ -7,6 +7,11 @@
>>  #ifndef _X86_ARCH_TNC_H_
>>  #define _X86_ARCH_TNC_H_
>>
>> +/* IGD Control Register */
>> +#define IGD_GC 0x50
>> +#define VGA_DISABLE0x0002
>> +#define GMS_MASK   0x0070
>> +
>>  /* Memory BAR Enable */
>>  #define MEM_BAR_EN 0x0001
>>
>> diff --git a/include/configs/crownbay.h b/include/configs/crownbay.h
>> index 3153a74..7f91fff 100644
>> --- a/include/configs/crownbay.h
>> +++ b/include/configs/crownbay.h
>> @@ -15,6 +15,7 @@
>>
>>  #define CONFIG_SYS_MONITOR_LEN (1 << 20)
>>  #define CONFIG_BOARD_EARLY_INIT_F
>> +#define CONFIG_ARCH_EARLY_INIT_R
>>  #define CONFIG_ARCH_MISC_INIT
>>
>>  #define CONFIG_SMSC_LPC47M
>> --
>> 1.8.2.1
>>
>
> Regards,
> Simon

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] dm: pci: Enable VGA address forwarding on bridges

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:29, Simon Glass  wrote:
> On 1 October 2015 at 08:36, Bin Meng  wrote:
>> To support graphics card behind a PCI bridge, the bridge control
>> register (offset 0x3e) in the configuration space must turn on
>> VGA address forwarding.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  drivers/pci/pci-uclass.c | 18 ++
>>  1 file changed, 18 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] x86: ivybridge: Remove the dead codes that programs pci bridge

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:29, Simon Glass  wrote:
> On 1 October 2015 at 08:36, Bin Meng  wrote:
>> Remove bd82x6x_pci_bus_enable_resources() that is not called anywhere.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/ivybridge/bd82x6x.c | 32 
>>  1 file changed, 32 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 06/12] cmd: elf: Reorder load_elf_image_phdr() and load_elf_image_shdr()

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> Move load_elf_image_phdr() and load_elf_image_shdr() to the beginning
> of the cmd_elf.c so that forward declaration is not needed.
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  common/cmd_elf.c | 161 
> +++
>  1 file changed, 79 insertions(+), 82 deletions(-)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] dm: pci: Fix pci_last_busno() to return the real last bus no

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:29, Simon Glass  wrote:
> On 1 October 2015 at 08:36, Bin Meng  wrote:
>> Currently pci_last_busno() only checks the last bridge device
>> under the first UCLASS_PCI device. This is not the case when
>> there are multiple bridge devices.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  drivers/pci/pci-uclass.c | 25 +
>>  1 file changed, 1 insertion(+), 24 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 05/12] cmd: Clean up cmd_elf a little bit

2015-10-18 Thread Simon Glass
On 7 October 2015 at 21:19, Bin Meng  wrote:
> This commit cleans up cmd_elf.c per U-Boot coding convention,
> and removes the unnecessary DECLARE_GLOBAL_DATA_PTR and out-of-date
> powerpc comments (it actually supports not only powerpc targets).
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  common/cmd_elf.c | 171 
> ---
>  1 file changed, 73 insertions(+), 98 deletions(-)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] dm: core: Adjust device.h header file order

2015-10-18 Thread Simon Glass
On 28 September 2015 at 23:32, Simon Glass  wrote:
> Move a few functions around so that the ordering is consistent.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/dm/device.h | 26 +-
>  1 file changed, 13 insertions(+), 13 deletions(-)

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


Re: [U-Boot] [PATCH v3] common: Fix load and entry addresses in FIT image

2015-10-18 Thread Simon Glass
Hi,

On 18 October 2015 at 06:18, Simon Glass  wrote:
> On 9 September 2015 at 12:07, Simon Glass  wrote:
>>
>> On Friday, 4 September 2015, York Sun  wrote:
>> >
>> > FIT image supports more than 32 bits in addresses by using #address-cell
>> > field. However the address length is not handled when parsing FIT images.
>> > Beside, the variable used to host address has "ulong" type. It is OK for
>> > the target, but not always enough for host tools such as mkimage. This
>> > patch replaces "ulong" with "phys_addr_t" to make sure the address is
>> > correct for both the target and the host.
>> >
>> > Signed-off-by: York Sun 
>> >
>> > ---
>> >
>> > Changes in v3:
>> >   Define PRIpa for host and target in common/image-fit.c so printf works
>> >   properly for 32-, 64-bit targets and host tools.
>> >
>> > Changes in v2:
>> >   Make a common function for both load and entry addresses.
>> >   Simplify calculation of addresses in a similar way as fdtdec_get_number()
>> >   fdtdec_get_number() is not used, or too many files need to be included
>> > and/or twisted for host tool
>> >   Continue to use %08llx for print format for load and entry addresses
>> > because %pa does not always work for host tool (mkimage)
>> >
>> >  common/bootm.c |   13 +
>> >  common/image-fit.c |   81 
>> > +---
>> >  include/bootm.h|6 ++--
>> >  include/image.h|   12 +---
>> >  4 files changed, 63 insertions(+), 49 deletions(-)
>>
>
> Acked-by: Simon Glass 

Unfortunately this produces lots of warnings on sandbox. Can you
please take a look?

/usr/local/google/c/cosarm/src/third_party/u-boot/files/common/bootm.c:
In function ‘bootm_find_os’:
/usr/local/google/c/cosarm/src/third_party/u-boot/files/common/bootm.c:146:12:
warning: passing argument 3 of ‘fit_image_get_load’ from incompatible
pointer type [enabled by default]
)) {
^
In file included from
/usr/local/google/c/cosarm/src/third_party/u-boot/files/include/common.h:82:0,
 from
/usr/local/google/c/cosarm/src/third_party/u-boot/files/common/bootm.c:9:
/usr/local/google/c/cosarm/src/third_party/u-boot/files/include/image.h:851:5:
note: expected ‘phys_addr_t *’ but argument is of type ‘ulong *’
 int fit_image_get_load(const void *fit, int noffset, phys_addr_t *load);
 ^

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


Re: [U-Boot] [PATCH 1/6] dm: Rename dev_get_parentdata() to dev_get_parent_priv()

2015-10-18 Thread Simon Glass
On 29 September 2015 at 11:45, Joe Hershberger
 wrote:
> Hi Simon,
>
> On Tue, Sep 29, 2015 at 12:32 AM, Simon Glass  wrote:
>> The current name is inconsistent with other driver model data access
>> functions. Rename it and fix up all users.
>>
>> Signed-off-by: Simon Glass 
>
> Reviewed-by: Joe Hershberger 

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


Re: [U-Boot] [PATCH 3/6] dm: core: Fix device flag whitespace

2015-10-18 Thread Simon Glass
On 28 September 2015 at 23:32, Simon Glass  wrote:
> Line up the flag values in the code for easier readability.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/dm/device.h | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

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


Re: [U-Boot] [PATCH 5/6] dm: core: Remove a comment about dropping per_child_auto_alloc_size

2015-10-18 Thread Simon Glass
On 28 September 2015 at 23:32, Simon Glass  wrote:
> This has proven useful and we no-longer intend to remove it. Drop the
> comment.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/dm/device.h | 4 
>  1 file changed, 4 deletions(-)
>
Applied to u-boot-dm.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] nios2: zap nios2-generic board dir

2015-10-18 Thread Marek Vasut
On Monday, October 19, 2015 at 01:41:48 AM, Thomas Chou wrote:
> Hi Marek,

Hi,

> On 10/18/2015 11:35 PM, Marek Vasut wrote:
> >> +config SYS_CONFIG_NAME
> >> +  string "Board header file"
> >> +  help
> >> +This option should contain the base name of board header file.
> >> +The header file include/configs/.h
> >> +should be included from include/config.h.
> > 
> > I suspect we don't want this, since we're probing from DT. This option
> > should default to something like include/configs/nios2.h , no ?
> 
> This is needed as the Kconfig doesn't cover every config option yet. We
> still need a per board file. But this is supposed to be removed when
> Kconfig is done for every option.

Don't we support just nios2-generic board ?

> Now, the legacy board header, defconfig and dts are all that we need to
> add a new board to nios2. I should add a README.nios2 after I finished
> the conversion of altera_tse to driver model.

Yeah :) Thanks!

[...]

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


Re: [U-Boot] usb start crashing on arndale

2015-10-18 Thread Simon Glass
Hi,

On 5 April 2014 at 06:50, armdev  wrote:
> Dear batao / Inderpal,
>
> ping works only a few times after a number of usb reset / start attempts.
> We are using linux 3.13 (exynos_defconfig) and rootfs linaro saucy server.
>
> Upon linux boot there is only lo in ifconfig.
> lsusb results in -99 error, similar to the on reported by batao in
>
> https://bugs.launchpad.net/linaro-stable-kernel/+bug/1301727
>
> Can you suggest anything which we can try / test at our end to solve the
> ethernet issue with uboot/linux

Somehow I found this thread. It is OK for the GPIO to be missing - the
code should check it if is valid before using it.

Since this was 18 months ago I hope you were able to fix it :-)

>
> Best Regards,
>
> On 12-Mar-2014, at 11:59 am, armdev  wrote:
>
> Dear Inderpal,
>
> Thanks for helping us, we were able to test ethernet over usb.
> It breaks often but it works with the return -1 patch.
> The following error is observed most of the time
> EHCI timed out on TD - token=0x8008d80
>
> -Regards
> armdev team
>
> On 12-Mar-2014, at 9:48 am, Inderpal Singh 
> wrote:
>
> Hi,
>
>
> On 11 March 2014 20:25, armdev  wrote:
>>
>> Adding Inderpal singh and Trini. Please help
>>
>> On 11-Mar-2014, at 12:27 pm, armdev  wrote:
>>
>> > Hi,
>> >
>> > We have recently started working on arndale and running u-boot head on
>> > it. Seems like it is crashing on our setup with a data abort on usb start.
>> > Can anyone please confirm and suggest a fix / solution
>> >
>> > U-Boot 2014.04-rc1-00486-geeb72e6 (Mar 11 2014 - 11:44:32) for ARNDALE
>> >
>> > CPU:Exynos5250@1000MHz
>> >
>> > Board: Arndale
>> > I2C:   i2c_init: failed to init bus 0 for speed = 10
>> > ready
>> > DRAM:  2 GiB
>> > trace: copying 00084f98 bytes of early data from 5000 to beff
>> > trace: enabled
>> > WARNING: Caches not enabled
>> > MMC:   EXYNOS DWMMC: 0, EXYNOS DWMMC: 1
>> > i2c_init: failed to init bus 0 for speed = 10
>> > In:serial
>> > Out:   serial
>> > Err:   serial
>> > Net:   Net Initialization Skipped
>> > No ethernet found.
>> > Hit any key to stop autoboot:  0
>> > ARNDALE # usb start
>> > (Re)start USB...
>> > USB0:   data abort
>> > pc : []  lr : []
>> > sp : beb5f9c0  ip : 0003 fp : 
>> > r10:   r9 : beb62ecc r8 : befbcc80
>> > r7 : befbcc84  r6 :  r5 : 00ff  r4 : 0001
>> > r3 :   r2 : 0001 r1 : 00ff  r0 : 
>> > Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
>> > Resetting CPU ...
>> >
>> >
>
>
> I was able to reproduce the issue and git bisect tells me that it started
> happening after the commit "8475c86 s5p: gpio: change gpio coding method for
> s5p gpio".
>
> Upon debugging further I figured out that it happens because the function
> fdtdec_setup_gpio returns success even if there is no gpio defined. Since no
> error is returned the exynos ehci driver goes ahead to setup the gpio and
> data abort happens. If I return failure from this function it works well.
>
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 1fecab3..b1c4e92 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -526,7 +526,7 @@ int fdtdec_setup_gpio(struct fdt_gpio_state *gpio)
>  * optional GPIOs)
>  */
> if (!fdt_gpio_isvalid(gpio))
> -   return 0;
> +   return -1;
>
>
> I am not sure of the objective to return success if there is no gpio
> defined.
> Simon, could you please suggest where do we need to fix it ? the above
> function or gpio driver ?
>
> Thanks,
> Inder
>
>
>
>>
>> > Thanks and Regards
>> > Armdev@FTM Team
>> >
>>
>
>
>

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


Re: [U-Boot] [PATCH 3/4] x86: fsp: Make hob command a sub-command to fsp

2015-10-18 Thread Simon Glass
On 10 October 2015 at 02:47, Bin Meng  wrote:
> Introduce a new fsp command and make the existing hob command a
> sub-command to fsp for future extension. Also move cmd_hob.c to
> the dedicated fsp sub-directory in arch/x86/lib.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/lib/Makefile |  1 -
>  arch/x86/lib/fsp/Makefile |  1 +
>  arch/x86/lib/{cmd_hob.c => fsp/cmd_fsp.c} | 33 
> +--
>  doc/README.x86|  5 ++---
>  4 files changed, 30 insertions(+), 10 deletions(-)
>  rename arch/x86/lib/{cmd_hob.c => fsp/cmd_fsp.c} (65%)

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


Re: [U-Boot] [PATCH 1/4] x86: fsp: Compact the output of hob command

2015-10-18 Thread Simon Glass
Hi Bin,

On 10 October 2015 at 05:01, Bin Meng  wrote:
> On Sat, Oct 10, 2015 at 4:47 PM, Bin Meng  wrote:
>> Compact hob command output, especially by making hob type string a
>> little bit shorter so that we can leave room for future extension.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/lib/cmd_hob.c | 28 ++--
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/lib/cmd_hob.c b/arch/x86/lib/cmd_hob.c
>> index 915746a..6ff321a 100644
>> --- a/arch/x86/lib/cmd_hob.c
>> +++ b/arch/x86/lib/cmd_hob.c
>> @@ -14,16 +14,16 @@ DECLARE_GLOBAL_DATA_PTR;
>>  static char *hob_type[] = {
>> "reserved",
>> "Hand-off",
>> -   "Memory Allocation",
>> -   "Resource Descriptor",
>> -   "GUID Extension",
>> -   "Firmware Volume",
>> +   "Mem Alloc",
>> +   "Res Desc",
>> +   "GUID Ext",
>> +   "FV",
>> "CPU",
>> -   "Memory Pool",
>> +   "Mem Pool",
>> "reserved",
>> -   "Firmware Volume 2",
>> -   "Load PEIM Unused",
>> -   "UEFI Capsule",
>> +   "FV2",
>> +   "Load PEIM",
>> +   "Capsule",
>>  };
>>
>>  int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>> @@ -37,20 +37,20 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * 
>> const argv[])
>>
>> printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
>>
>> -   printf("No. | Address  | Type| Length in Bytes\n");
>> -   printf("|--|-|\n");
>> +   printf("#  | Address  | Type  | Len\n");
>> +   printf("---|--|---|-\n");
>> while (!end_of_hob(hdr)) {
>> -   printf("%-3d | %08x | ", i, (unsigned int)hdr);
>> +   printf("%-2d | %08x | ", i, (unsigned int)hdr);
>> type = hdr->type;
>> if (type == HOB_TYPE_UNUSED)
>> desc = "*Unused*";
>> else if (type == HOB_TYPE_EOH)
>> -   desc = "*END OF HOB*";
>> +   desc = "*EOH*";
>> else if (type >= 0 && type <= ARRAY_SIZE(hob_type))
>> desc = hob_type[type];
>> else
>> -   desc = "*Invalid Type*";
>> -   printf("%-19s | %-15d\n", desc, hdr->len);
>> +   desc = "*Invalid*";
>> +   printf("%-9s | %-4d\n", desc, hdr->len);
>
> Looks like I should change %-4d to %-5d as on BayTrail some HOB length
> would be quite large.
>

I think it is better to use hex. U-Boot uses hex for most output.

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


Re: [U-Boot] [PATCH v2 02/13] x86: fsp: Report correct number of E820 table entries

2015-10-18 Thread Simon Glass
Hi Tom,

On 18 October 2015 at 09:55, Tom Rini  wrote:
> On Sun, Oct 18, 2015 at 06:58:51AM -0600, Simon Glass wrote:
>> Hi Tom,
>>
>> On 28 September 2015 at 22:52, Simon Glass  wrote:
>> > On 28 September 2015 at 03:11, Bin Meng  wrote:
>> >> The logic to calculate the number of E820 table entries is wrong
>> >> when walking through the FSP HOB tables. Fix it.
>> >>
>> >> Signed-off-by: Bin Meng 
>> >> Tested-by: Jian Luo 
>> >>
>> >> ---
>> >> Simon, I think we need get this fix in v2015.10 release.
>> >>
>> >> Changes in v2: None
>> >>
>> >>  arch/x86/lib/fsp/fsp_dram.c | 3 ++-
>> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > Acked-by: Simon Glass 
>>
>> Are you able to pick this one up if it is not too late?
>
> Is this the only x86 patch that should come in?

Yes, that's it.

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


Re: [U-Boot] [PATCH 1/4] x86: fsp: Compact the output of hob command

2015-10-18 Thread Simon Glass
On 10 October 2015 at 02:47, Bin Meng  wrote:
> Compact hob command output, especially by making hob type string a
> little bit shorter so that we can leave room for future extension.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/lib/cmd_hob.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)

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


Re: [U-Boot] [PATCH v3 2/8] board_init_f_mem(): Don't require memset()

2015-10-18 Thread Simon Glass
Hi Albert,

On 18 October 2015 at 10:28, Albert ARIBAUD  wrote:
> Hello Simon,
>
> On Sat, 17 Oct 2015 15:06:55 -0600, Simon Glass 
> wrote:
>> Unfortunately memset() is not always available, so provide a substitute when
>> needed.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v3: None
>> Changes in v2:
>> - Add comments as to why this is needed, deal with arch-specific memset()
>>
>>  common/init/board_init.c | 18 ++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/common/init/board_init.c b/common/init/board_init.c
>> index e7ebca7..c113a80 100644
>> --- a/common/init/board_init.c
>> +++ b/common/init/board_init.c
>> @@ -11,6 +11,16 @@
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> +/*
>> + * It isn't trivial to figure out whether memcpy() exists. The arch-specific
>> + * memcpy() is not normally available in SPL due to code size.
>> + */
>> +#if !defined(CONFIG_SPL_BUILD) || \
>> + (defined(CONFIG_SPL_LIBGENERIC_SUPPORT) && \
>> + !defined(CONFIG_USE_ARCH_MEMSET))
>> +#define _USE_MEMCPY
>> +#endif
>> +
>>  /* Unfortunately x86 can't compile this code as gd cannot be assigned */
>>  #ifndef CONFIG_X86
>>  __weak void arch_setup_gd(struct global_data *gd_ptr)
>> @@ -22,6 +32,9 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
>>  ulong board_init_f_mem(ulong top)
>>  {
>>   struct global_data *gd_ptr;
>> +#ifndef _USE_MEMCPY
>> + int *ptr, *end;
>> +#endif
>>
>>   /* Leave space for the stack we are running with now */
>>   top -= 0x40;
>> @@ -29,7 +42,12 @@ ulong board_init_f_mem(ulong top)
>>   top -= sizeof(struct global_data);
>>   top = ALIGN(top, 16);
>>   gd_ptr = (struct global_data *)top;
>> +#ifdef _USE_MEMCPY
>>   memset(gd_ptr, '\0', sizeof(*gd));
>> +#else
>> + for (ptr = (int *)gd_ptr, end = (int *)(gd_ptr + 1); ptr < end; )
>
> Nitpick here: There is little point in naming a variable just for
> it to be set and used once. Without 'end', the compiler will be just as
> fine if ptr is directly tested against (int *)(gd_ptr + 1), and human
> readers won't wonder why 'end' was created.

Well it makes it clear that the ptr goes from the start to the end.
But it's probably clear enough just doing what you suggest, so I can
change it.

>
>> + *ptr++ = 0;
>> +#endif
>>   arch_setup_gd(gd_ptr);
>>
>>  #if defined(CONFIG_SYS_MALLOC_F)
>> --
>> 2.6.0.rc2.230.g3dd15c0
>
> Amicalement,
> --
> Albert.

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


Re: [U-Boot] [PATCH v3 7/8] zynq: Move SPL console init out of board_init_f()

2015-10-18 Thread Simon Glass
Hi Albert,

On 18 October 2015 at 10:36, Albert ARIBAUD  wrote:
> Hello Simon,
>
> On Sat, 17 Oct 2015 15:07:00 -0600, Simon Glass 
> wrote:
>> We should not init the console this early and there is no need to. If we want
>> to do early init it can be done in spl_board_init(). Move the
>> preloader_console_init() call from board_init_f() to board_init_r().
>>
>> Signed-off-by: Simon Glass 
>> Tested-by: Masahiro Yamada 
>> Tested-by: Michal Simek 
>
> I personally think that we should, almost must in fact, initialize the
> console as early as possible.
>
> What exactly is the drawaback of initializing the console here?

This is described in the README now for SPL. The console is not
available until driver model is ready, which cannot be before
global_data is ready.

My second zynq series removes the next few lines from board_init_f(),
so in effect there is very little difference in timing - the console
still is set up very early. It is just that we must not set it up
before driver model is running.

There is also a debug UART which can be used to make printf() work
before global_data is available. But I'm trying to remove the
global_data hacks that exist in early board code.

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


Re: [U-Boot] [PATCH 26/28] input: Convert i8042 to driver model

2015-10-18 Thread Simon Glass
Hi Bin,

On 18 October 2015 at 17:17, Simon Glass  wrote:
> Hi Bin,
>
> On 15 September 2015 at 00:12, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>>> Adjust this driver to support driver model. The only users are x86 boards
>>> so this should be safe.
>>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>
>> After updating QEMU to use the DM i8042 driver below:
>>
>> diff --git a/arch/x86/dts/qemu-x86_i440fx.dts 
>> b/arch/x86/dts/qemu-x86_i440fx.dts
>> index fc74cd0..14782b3 100644
>> --- a/arch/x86/dts/qemu-x86_i440fx.dts
>> +++ b/arch/x86/dts/qemu-x86_i440fx.dts
>> @@ -11,6 +11,7 @@
>>  /include/ "skeleton.dtsi"
>>  /include/ "serial.dtsi"
>>  /include/ "rtc.dtsi"
>> +/include/ "keyboard.dtsi"
>>
>>  / {
>> model = "QEMU x86 (I440FX)";
>> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
>> index 1b544c1..9daf943 100644
>> --- a/include/configs/qemu-x86.h
>> +++ b/include/configs/qemu-x86.h
>> @@ -30,7 +30,7 @@
>>
>>  #define CONFIG_PCI_PNP
>>
>> -#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,vga\0" \
>> +#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,i8042-kbd\0" \
>> "stdout=serial,vga\0" \
>> "stderr=serial,vga\0"
>>
>>
>> The i8042 still does not work. I've applied the same changes to Crown
>> Bay. i8042 does not work either. Could you please have a look?
>>
>
> It's hard for me to debug this on hardware. I should be able to use
> qemu though. Is there anything special needed to make it use that
> keyboard?

Actually it works for me with qemu.

However it is intermittent, as it was before my series. So there is
something else going on.

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


Re: [U-Boot] [PATCH 26/28] input: Convert i8042 to driver model

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 7:17 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 15 September 2015 at 00:12, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass  wrote:
>>> Adjust this driver to support driver model. The only users are x86 boards
>>> so this should be safe.
>>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>
>> After updating QEMU to use the DM i8042 driver below:
>>
>> diff --git a/arch/x86/dts/qemu-x86_i440fx.dts 
>> b/arch/x86/dts/qemu-x86_i440fx.dts
>> index fc74cd0..14782b3 100644
>> --- a/arch/x86/dts/qemu-x86_i440fx.dts
>> +++ b/arch/x86/dts/qemu-x86_i440fx.dts
>> @@ -11,6 +11,7 @@
>>  /include/ "skeleton.dtsi"
>>  /include/ "serial.dtsi"
>>  /include/ "rtc.dtsi"
>> +/include/ "keyboard.dtsi"
>>
>>  / {
>> model = "QEMU x86 (I440FX)";
>> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
>> index 1b544c1..9daf943 100644
>> --- a/include/configs/qemu-x86.h
>> +++ b/include/configs/qemu-x86.h
>> @@ -30,7 +30,7 @@
>>
>>  #define CONFIG_PCI_PNP
>>
>> -#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,vga\0" \
>> +#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,i8042-kbd\0" \
>> "stdout=serial,vga\0" \
>> "stderr=serial,vga\0"
>>
>>
>> The i8042 still does not work. I've applied the same changes to Crown
>> Bay. i8042 does not work either. Could you please have a look?
>>
>
> It's hard for me to debug this on hardware. I should be able to use
> qemu though. Is there anything special needed to make it use that
> keyboard?
>

I will have another try (and debug if it is needed) on Crown Bay when
you send the v2 series.

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


Re: [U-Boot] [PATCH 2/6] video: vesa_fb: Fix wrong return value check of pci_find_class()

2015-10-18 Thread Simon Glass
On 7 October 2015 at 12:40, Anatolij Gustschin  wrote:
> On Thu,  1 Oct 2015 00:36:00 -0700
> Bin Meng  wrote:
>
>> When pci_find_class() fails to find a device, it returns -ENODEV.
>> But now we check the return value against -1. Fix it.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  drivers/video/vesa_fb.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Anatolij Gustschin 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Remove sparc archiecture?

2015-10-18 Thread Daniel Hellstrom

On 10/18/2015 05:20 PM, Masahiro Yamada wrote:

(+CC Francois)


2015-10-18 21:24 GMT+09:00 Tom Rini :

On Sun, Oct 18, 2015 at 06:19:16AM -0600, Simon Glass wrote:


Hi,

It looks like sparc has no maintainer and has not been converted to
generic board. Should we remove it?

Well, not quite "no maintainer", but... Daniel?  SPARC is in need of
some work (and possibly a new toolchain too, I stopped building it all
the time due to a false positive warning the 3.4.4 toolchain I have
gives).  Thanks!

--
Tom


I see generic board work for SPARC

http://patchwork.ozlabs.org/patch/404616/
http://patchwork.ozlabs.org/patch/404618/
http://patchwork.ozlabs.org/patch/404617/
http://patchwork.ozlabs.org/patch/404619/
http://patchwork.ozlabs.org/patch/404620/
http://patchwork.ozlabs.org/patch/404622/
http://patchwork.ozlabs.org/patch/404621/
http://patchwork.ozlabs.org/patch/404624/
http://patchwork.ozlabs.org/patch/404623/

but, Daniel was not responding...


Perhaps, replace the maintainer if Francois agrees?


I regret to say that I've been too busy last two years and I don't see a 
change during 2015 either.


I would not like to see the SPARC port removed now that the LEON 
community grows as new LEON3 and LEON4 chips comes to market. WIth 
multi-core and higher frequency there is a growing interest in u-boot 
from the LEON community.


Nowadays there are LEON GCC targets mcpu=leon,leon3,leon3v7 so it should 
be possible to setup a working toolchain based on GCC-4.9 which we use 
for Linux and RTEMS. In the past I've used a GCC-4.4 toolchain from 
Cobham Gaisler.


If Francois agrees it is probably a good idea to let him take over the 
SPARC as he has put work into both BSP and architecture. Although I 
would like to acknowledge my interest in u-boot and I hope and believe 
that my efforts will be resumed in the future. Francois, if you feel it 
is too much a temporary replacement could also be an option if the 
u-boot project allows it.


Best Regards,
Daniel Hellstrom

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


Re: [U-Boot] [PATCH 1/6] pci: Set PCI_COMMAND_IO bit for VGA device

2015-10-18 Thread Simon Glass
On 3 October 2015 at 08:29, Simon Glass  wrote:
> On 1 October 2015 at 08:35, Bin Meng  wrote:
>> PCI_COMMAND_IO bit must be set for VGA device as it needs to respond
>> to legacy VGA IO address.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  drivers/pci/pci_auto.c | 6 ++
>>  1 file changed, 6 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/3] x86: spi: Add support for Wildcat Point

2015-10-18 Thread Simon Glass
On 12 October 2015 at 15:18, George McCollister
 wrote:
> Add the Wildcat Point ID so Broadwell U based boards can use SPI.
>
> Signed-off-by: George McCollister 
> Reviewed-by: Bin Meng 
> ---
> Changes for V2:
>  Add Reviewed-by: Bin Meng
>
>  drivers/spi/ich.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] x86: pci: Add PCI IDs for Wildcat Point

2015-10-18 Thread Simon Glass
On 12 October 2015 at 15:18, George McCollister
 wrote:
> Add Wildcat Point AHCI and LPC PCI IDs which are present on Broadwell U
> based (and possibly other) boards.
>
> Signed-off-by: George McCollister 
> Reviewed-by: Bin Meng 
> ---
> Changes for V2:
>  Add simple sentence as the commit message
>  Add Reviewed-by: Bin Meng
>
>  include/pci_ids.h | 2 ++
>  1 file changed, 2 insertions(+)

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] pci: Fix expansion ROM programming for multi-function devices

2015-10-18 Thread Simon Glass
On 8 October 2015 at 18:30, Bin Meng  wrote:
> Hi Simon,
>
> On Fri, Oct 9, 2015 at 2:10 AM, Simon Glass  wrote:
>> Hi Bin,
>>
>> On 8 October 2015 at 19:07, Simon Glass  wrote:
>>> On 7 October 2015 at 10:13, Bin Meng  wrote:
 PCI_HEADER_TYPE register (offset 0x0e) bit 7 is an indicator
 for multi-function devices. We should mask it off before using
 it as the header type.

 Signed-off-by: Bin Meng 
 ---

  drivers/pci/pci_auto.c | 1 +
  1 file changed, 1 insertion(+)
>>>
>>> Acked-by: Simon Glass 
>>
>> I'm not sure if this fix actually fixes anything for existing boards,
>> but I'll pick it up.
>>
>
> Yes, it fixes the Crown Bay board where Topcliff PCI device D0:F0 is a
> multi-function device and has a ROM.
>
>> Is there anything else I have missed?
>>
>
> So far I believe everything for this release is in. Thanks!
>
> Regards,
> Bin

Applied to u-boot-x86, and now in mainline.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/9] rtc: mc146818: Use probe() to set up the device

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 10:26 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 18 October 2015 at 20:22, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Mon, Oct 19, 2015 at 5:55 AM, Simon Glass  wrote:
>>> At present this driver uses bind() to set up the device. The bind() method
>>> should not touch the hardware, so move the init code to probe().
>>>
>>
>> I think RTC should be initialized anyway. If moving it to probe, it
>> may not be initialized by U-Boot before jumping to kernel.
>
> That's fine, but the correct way to do this is to probe the device,
> not put the init code into the bind() method.

Yes, I agree. So maybe we explicitly trigger the probe somewhere in
the initialization path?

>
>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>>
>>>  drivers/rtc/mc146818.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c
>>> index 9e94a80..da804d5 100644
>>> --- a/drivers/rtc/mc146818.c
>>> +++ b/drivers/rtc/mc146818.c
>>> @@ -225,7 +225,7 @@ static int rtc_mc146818_write8(struct udevice *dev, 
>>> unsigned int reg, int val)
>>> return 0;
>>>  }
>>>
>>> -static int rtc_mc146818_bind(struct udevice *dev)
>>> +static int rtc_mc146818_probe(struct udevice *dev)
>>>  {
>>> mc146818_init();
>>>
>>> @@ -249,7 +249,7 @@ U_BOOT_DRIVER(rtc_mc146818) = {
>>> .name = "rtc_mc146818",
>>> .id = UCLASS_RTC,
>>> .of_match = rtc_mc146818_ids,
>>> -   .bind = rtc_mc146818_bind,
>>> +   .probe = rtc_mc146818_probe,
>>> .ops = _mc146818_ops,
>>>  };
>>>
>>> --
>>

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


Re: [U-Boot] [PATCH 11/13] x86: baytrail: Issue full system reset in reset_cpu()

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 10:24 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 18 October 2015 at 20:01, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Mon, Oct 19, 2015 at 4:27 AM, Simon Glass  wrote:
>>> Hi Bin,
>>>
>>> On 11 October 2015 at 22:37, Bin Meng  wrote:
 With MRC cache enabled, when typing 'reset' in the U-Boot shell,
 BayTrail FSP initialization hangs at "Configuring Memory Start":

   Setting BootMode to 0
   Install PPI: 1F4C6F90-B06B-48D8-A201-BAE5F1CD7D56
   Register PPI Notify: F894643D-C449-42D1-8EA8-85BDD8C65BDE
   About to call MrcInit();
   BayleyBay Platform Type
   CurrentMrcData.BootMode = 4
   Taking Fastboot path!
   Configuring Memory Start...

 Changing reset_cpu() to do a full system reset fixes this issue.

 Signed-off-by: Bin Meng 
 ---

  arch/x86/cpu/baytrail/valleyview.c | 6 ++
  1 file changed, 6 insertions(+)
>>>
>>> Acked-by: Simon Glass 
>>>

 diff --git a/arch/x86/cpu/baytrail/valleyview.c 
 b/arch/x86/cpu/baytrail/valleyview.c
 index 215e0d0..a009c14 100644
 --- a/arch/x86/cpu/baytrail/valleyview.c
 +++ b/arch/x86/cpu/baytrail/valleyview.c
 @@ -65,3 +65,9 @@ int reserve_arch(void)
  #endif
  }
  #endif
 +
 +void reset_cpu(ulong addr)
 +{
 +   /* cold reset */
 +   x86_full_reset();
 +}
 --
 1.8.2.1

>>>
>>> Actually on Minnowmax this doesn't fix the hang.
>>
>> That's strange. As full reset indicates a complete power cycle. Does
>> MinnowMax boot with MRC cache enabled?
>
> It's hard to tell because the UART does not work that early. I wish we
> could fix that. I thought I did have it running at one point, but I
> may have imagined it.

We need figure out where the hang happens. Is it in FSP, or in U-Boot?
You can use a debug version of FSP (the gold4 release includes a debug
version FSP) to see where the FSP hangs if it is the FSP hang case.

>
> Re the hang, I'm not sure - it seems to have stopped happening, so
> let's not worry about it for now.
>
>
>>>
>>> Also I don't see any speed-up from using the cache on Minnowmax.
>>
>> On Galileo, I did not see any speed-up either. I think it is because
>> on MinnowMax and Galileo they both uses memory-down configuration. The
>> speed-up seems only helpful for DIMMs (on Intel Bayley Bay)
>
> So what is the point of enabling the MRC cache?
>

On Bayley Bay it indeed improves the boot time. So, maybe we can just
leave this option unselected by the defconfig files for Chromebook and
Galileo?

One thing I noticed that on Chromebook the memory SPD is passed by
device tree. Is there any DIMM on the Chromebook and the SPD in device
tree is just a short-cut for the MRC? If we let MRC reads the SPD,
does MRC cache help?

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


Re: [U-Boot] [RFC PATCH] x86: Support booting SeaBIOS

2015-10-18 Thread Simon Glass
Hi Bin,

On 10 October 2015 at 02:57, Bin Meng  wrote:
> Hi Simon,
>
> On Sat, Oct 3, 2015 at 10:29 PM, Simon Glass  wrote:
>> Hi Bin,
>>
>> On 29 September 2015 at 11:17, Bin Meng  wrote:
>>> SeaBIOS is an open source implementation of a 16-bit X86 BIOS.
>>> It can run in an emulator or natively on X86 hardware with the
>>> use of coreboot. With SeaBIOS's help, we can boot some OSes
>>> that require 16-bit BIOS services like Windows/DOS.
>>>
>>> As U-Boot, we have to manually create a table where SeaBIOS gets
>>> system information (eg: E820) from. The table unfortunately has
>>> to follow the coreboot table format as SeaBIOS currently supports
>>> booting as a coreboot payload. No U-Boot native support there.
>>>
>>> Booting SeaBIOS is done via U-Boot's bootelf command.
>>>
>>> This is the initial attempt to support booting SeaBIOS from U-Boot.
>>> If the basic concept is good, I can spend time working on follow-on
>>> patches to enable BIOS tables as well as graphics support. One issue
>>> is that U-Boot x86 does not has a ROM file system like coreboot.
>>> This brings difficulities to pass PCI option ROM to SeaBIOS, if we
>>> don't modify SeaBIOS's source codes. Maybe we should promote CBFS
>>> in U-Boot x86?
>>>
>>> This is tested on an Intel Crown Bay board with VGA card, booting
>>> SeaBIOS then chain loading a GRUB on a USB drive, then Linux kernel
>>> finally.
>>
>> Looks good to me. I think it is OK to use CBFS if needed - are you
>> thinking of an option to build u-boot.rom as a CBFS filesystem?
>
> If using CBFS, that means we may have to abandon ifdtool? Or maybe
> mixed usage of both tools?

So far I'm not sure of the best approach. At present we have the ROM
offsets stored mostly in Kconfig, with the MRC area in the SPI flash
device tree node. The environment is also in Kconfig.

What sort of option ROMs do you want to support? What other options
does seabios provide?

What does SEA stand for?

[snip]

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


Re: [U-Boot] [PATCH 1/3] x86: ivybridge: Fix saving mrc cache and enable it

2015-10-18 Thread Simon Glass
Hi Bin,

On 18 October 2015 at 20:44, Bin Meng  wrote:
> Hi Simon,
>
> On Mon, Oct 19, 2015 at 4:27 AM, Simon Glass  wrote:
>> Hi Bin,
>>
>> On 12 October 2015 at 02:30, Bin Meng  wrote:
>>> Currently sdram_initialise() saves pei_data->mrc_output directly to
>>> gd->arch.mrc_output. This is incorrect as pei_data->mrc_output points
>>> to an address on the stack whose content is no longer valid when we
>>> call mrccache_reserve(). To fix this, save it on the heap instead.
>>>
>>> Signed-off-by: Bin Meng 
>>> ---
>>>
>>>  arch/x86/cpu/ivybridge/sdram.c | 20 ++--
>>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
>>> index fc66a3c..f3d97ca 100644
>>> --- a/arch/x86/cpu/ivybridge/sdram.c
>>> +++ b/arch/x86/cpu/ivybridge/sdram.c
>>> @@ -151,14 +151,8 @@ static int prepare_mrc_cache(struct pei_data *pei_data)
>>> if (!mrc_cache)
>>> return -ENOENT;
>>>
>>> -   /*
>>> -* TODO(s...@chromium.org): Skip this for now as it causes boot
>>> -* problems
>>> -*/
>>> -   if (0) {
>>> -   pei_data->mrc_input = mrc_cache->data;
>>> -   pei_data->mrc_input_len = mrc_cache->data_size;
>>> -   }
>>> +   pei_data->mrc_input = mrc_cache->data;
>>> +   pei_data->mrc_input_len = mrc_cache->data_size;
>>> debug("%s: at %p, size %x checksum %04x\n", __func__,
>>>   pei_data->mrc_input, pei_data->mrc_input_len,
>>>   mrc_cache->checksum);
>>> @@ -289,6 +283,7 @@ int sdram_initialise(struct pei_data *pei_data)
>>> unsigned version;
>>> const char *data;
>>> uint16_t done;
>>> +   char *cache;
>>> int ret;
>>>
>>> report_platform_info();
>>> @@ -386,8 +381,13 @@ int sdram_initialise(struct pei_data *pei_data)
>>>  * This will be copied to SDRAM in reserve_arch(), then 
>>> written
>>>  * to SPI flash in mrccache_save()
>>>  */
>>> -   gd->arch.mrc_output = (char *)pei_data->mrc_output;
>>> -   gd->arch.mrc_output_len = pei_data->mrc_output_len;
>>> +   cache = malloc(pei_data->mrc_output_len);
>>> +   if (cache) {
>>> +   memcpy(cache, pei_data->mrc_output,
>>> +  pei_data->mrc_output_len);
>>> +   gd->arch.mrc_output = cache;
>>> +   gd->arch.mrc_output_len = pei_data->mrc_output_len;
>>> +   }
>>
>> This isn't really any better than what is there. The malloc() region
>> is in CAR memory, just a different part of it. The function
>> reserve_arch() copies it to SDRAM.
>
> So where does this pei_data->mrc_input point to? Is it some place that
> is malloced by the MRC itself and in a place that does not get
> overwritten?

I think it points into the part of CAR that is reserved for use by the MRC.

>
>>
>> I think with FSP this does not work but for ivybridge it seems OK.
>>
>> I'll resend your patch with this part removed. Your comments spurred
>> me to take another look at why MRC was broken on ivybridge, and I
>> found that car_uninit() was wrong. I'll send a series to fix it.
>>
>>> ret = write_seeds_to_cmos(pei_data);
>>> if (ret)
>>> debug("Failed to write seeds to CMOS: %d\n", ret);
>>> --
>>> 1.8.2.1
>>>

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


[U-Boot] [PATCH v2 04/28] input: Add the keycode translation tables separately

2015-10-18 Thread Simon Glass
Require the caller to add the keycode translation tables separately so that
it can select which ones to use. In a later patch we will add the option to
add German tables.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add error checking to input_add_tables()

 board/kosagi/novena/novena.c |  1 +
 drivers/input/cros_ec_keyb.c |  1 +
 drivers/input/input.c| 26 +-
 drivers/input/tegra-kbc.c|  1 +
 include/input.h  | 10 ++
 5 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 69f5be3..48cbb0f 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -88,6 +88,7 @@ int drv_keyboard_init(void)
debug("%s: Cannot set up input\n", __func__);
return -1;
}
+   input_add_tables(_input);
button_input.read_keys = novena_gpio_button_read_keys;
 
error = input_stdio_register();
diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
index a31aa77..eaab86f 100644
--- a/drivers/input/cros_ec_keyb.c
+++ b/drivers/input/cros_ec_keyb.c
@@ -255,6 +255,7 @@ int drv_keyboard_init(void)
return -1;
}
config.input.read_keys = cros_ec_kbc_check;
+   input_add_tables();
 
memset(, '\0', sizeof(dev));
strcpy(dev.name, "cros-ec-keyb");
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 9033935..82e8381 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -457,19 +457,27 @@ void input_set_delays(struct input_config *config, int 
repeat_delay_ms,
config->repeat_rate_ms = repeat_rate_ms;
 }
 
+int input_add_tables(struct input_config *config)
+{
+   int ret;
+
+   ret = input_add_table(config, -1, -1,
+ kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate));
+   if (ret)
+   return ret;
+   ret = input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
+ kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate));
+   if (ret)
+   return ret;
+
+   return input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
+  kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate));
+}
+
 int input_init(struct input_config *config, int leds)
 {
memset(config, '\0', sizeof(*config));
config->leds = leds;
-   if (input_add_table(config, -1, -1,
-   kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)) ||
-   input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
-   kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)) ||
-   input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
-   kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate))) {
-   debug("%s: Could not add modifier tables\n", __func__);
-   return -ENOSPC;
-   }
 
return 0;
 }
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
index c9c9fac..3310f84 100644
--- a/drivers/input/tegra-kbc.c
+++ b/drivers/input/tegra-kbc.c
@@ -355,6 +355,7 @@ int drv_keyboard_init(void)
return -1;
}
config.input.read_keys = tegra_kbc_check;
+   input_add_tables(input);
 
memset(, '\0', sizeof(dev));
strcpy(dev.name, "tegra-kbc");
diff --git a/include/input.h b/include/input.h
index 7bccc8e..71f3538 100644
--- a/include/input.h
+++ b/include/input.h
@@ -123,6 +123,16 @@ void input_set_delays(struct input_config *config, int 
repeat_delay_ms,
   int repeat_rate_ms);
 
 /**
+ * Set up the key map tables
+ *
+ * This must be called after input_init() or keycode decoding will not work.
+ *
+ * @param config   Input state
+ * @return 0 if ok, -1 on error
+ */
+int input_add_tables(struct input_config *config);
+
+/**
  * Set up the input handler with basic key maps.
  *
  * @param config   Input state
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 01/28] dm: input: Create a keyboard uclass

2015-10-18 Thread Simon Glass
Add a uclass for keyboard input, mirroring the existing stdio methods.
This is enabled by a new CONFIG_DM_KEYBOARD option.

Signed-off-by: Simon Glass 
Reviewed-by: Marek Vasut 
---

Changes in v2:
- Add more debug info to input_init() for when it fails
- Support driver's tstc() and getc() methods in the uclass
- Update the comment for the tstc() method to indicate that an error can occur

 common/usb_kbd.c|  6 ---
 drivers/input/Kconfig   |  9 
 drivers/input/Makefile  |  2 +
 drivers/input/keyboard-uclass.c | 91 +
 include/keyboard.h  | 79 +++
 5 files changed, 181 insertions(+), 6 deletions(-)
 create mode 100644 drivers/input/keyboard-uclass.c

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 9b8e11e..e37d223 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -649,12 +649,6 @@ U_BOOT_DRIVER(usb_kbd) = {
.probe = usb_kbd_probe,
 };
 
-/* TODO(s...@chromium.org): Move this into a common location */
-UCLASS_DRIVER(keyboard) = {
-   .id = UCLASS_KEYBOARD,
-   .name   = "keyboard",
-};
-
 static const struct usb_device_id kbd_id_table[] = {
{
.match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index bb00de7..447c4c3 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -1,3 +1,12 @@
+config DM_KEYBOARD
+   bool "Enable driver model keyboard support"
+   depends on DM
+   help
+ This adds a uclass for keyboards and implements keyboard support
+ using driver model. The API is implemented by keyboard.h and
+ includes methods to start/stop the device, check for available
+ input and update LEDs if the keyboard has them.
+
 config CROS_EC_KEYB
bool "Enable Chrome OS EC keyboard support"
help
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index b1161c5..9388dfe 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -5,6 +5,8 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+obj-$(CONFIG_DM_KEYBOARD) += keyboard-uclass.o
+
 obj-$(CONFIG_I8042_KBD) += i8042.o
 obj-$(CONFIG_TEGRA_KEYBOARD) += tegra-kbc.o
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
diff --git a/drivers/input/keyboard-uclass.c b/drivers/input/keyboard-uclass.c
new file mode 100644
index 000..4698773
--- /dev/null
+++ b/drivers/input/keyboard-uclass.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+static int keyboard_start(struct stdio_dev *sdev)
+{
+   struct udevice *dev = sdev->priv;
+   struct keyboard_ops *ops = keyboard_get_ops(dev);
+
+   if (ops->start)
+   return ops->start(dev);
+
+   return 0;
+}
+
+static int keyboard_stop(struct stdio_dev *sdev)
+{
+   struct udevice *dev = sdev->priv;
+   struct keyboard_ops *ops = keyboard_get_ops(dev);
+
+   if (ops->stop)
+   return ops->stop(dev);
+
+   return 0;
+}
+
+static int keyboard_tstc(struct stdio_dev *sdev)
+{
+   struct udevice *dev = sdev->priv;
+   struct keyboard_priv *priv = dev_get_uclass_priv(dev);
+   struct keyboard_ops *ops = keyboard_get_ops(dev);
+
+   /* Just get input to do this for us if we can */
+   if (priv->input.dev)
+   return input_tstc(>input);
+   else if (ops->tstc)
+   return ops->tstc(dev);
+
+   return -ENOSYS;
+}
+
+static int keyboard_getc(struct stdio_dev *sdev)
+{
+   struct udevice *dev = sdev->priv;
+   struct keyboard_priv *priv = dev_get_uclass_priv(dev);
+   struct keyboard_ops *ops = keyboard_get_ops(dev);
+
+   /* Just get input to do this for us if we can */
+   if (priv->input.dev)
+   return input_getc(>input);
+   else if (ops->getc)
+   return ops->getc(dev);
+
+   return -ENOSYS;
+}
+
+static int keyboard_pre_probe(struct udevice *dev)
+{
+   struct keyboard_priv *priv = dev_get_uclass_priv(dev);
+   struct stdio_dev *sdev = >sdev;
+   int ret;
+
+   strlcpy(sdev->name, dev->name, sizeof(sdev->name));
+   sdev->flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
+   sdev->getc = keyboard_getc;
+   sdev->tstc = keyboard_tstc;
+   sdev->start = keyboard_start;
+   sdev->stop = keyboard_stop;
+   sdev->priv = dev;
+   ret = input_init(>input, 0);
+   if (ret) {
+   debug("%s: Cannot set up input, ret=%d - please add DEBUG to 
drivers/input/input.c to figure out the cause\n",
+ __func__, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+UCLASS_DRIVER(keyboard) = {
+   .id = UCLASS_KEYBOARD,
+   .name   = "keyboard",
+   .pre_probe  = keyboard_pre_probe,
+   .per_device_auto_alloc_size = 

[U-Boot] [PATCH v2 00/28] dm: input: Move keyboard drivers to driver model

2015-10-18 Thread Simon Glass
This series adds a new uclass for keyboards and converts some drivers
over to use it.

This series includes some work to remove code duplication in the keyboard
drivers by updating them to use the input library (input.c). This unifies
the keycode decoding logic in one place. In order to do this some
enhancements are needed to the input library and these are also included.

The cros_ec and tegra_kbc drivers are converted to use driver model.

The i8042 driver is converted also, after various tidy-ups. The driver has
some strange interactions with the cfb_console driver. This is removed in
this series which is possible because the only user is x86. Some i8042
features have been dropped (the only deliberate one is the flashing cursor
which does not seem to be used by any board).

Also the i8042 driver currently has its own keycode-decoding logic. This
series removes it in favour of the input library. Therefore testing of this
new driver would be appreciated. So far I have only been able to test on
link, which does not have a full keyboard. Also, while German keyboard
support is implemented, I am unable to test that either.

These changes can be considered the first step towards moving stdio to
driver model. For that to be useful we need to convert LCD and video also.

Note: This series is missing the code to call the update_leds() method when
the LEDs change. This needs to be added to keyboard_tstc() and
keyboard_getc(). If someone is able to test this I can send a patch for that
also.

This series is available at u-boot-dm branch input-working.

Changes in v2:
- Add more debug info to input_init() for when it fails
- Support driver's tstc() and getc() methods in the uclass
- Update the comment for the tstc() method to indicate that an error can occur
- Add error checking to input_add_tables()
- Update commit message to explain what RTC means
- Fix extra space in commit message
- Update input_add_tables() to add error checking
- Convert two multi-line comments to single-line comments
- Correct call to input_init()
- Drop CONFIG_VGA_AS_SINGLE_DEVICE from all x86 board config files
- Use device tree to handle this quirk

Simon Glass (28):
  dm: input: Create a keyboard uclass
  input: Add a device pointer to the input config
  input: Return -ENOSPC when there is not space
  input: Add the keycode translation tables separately
  cros_ec: Use udevice instead of cros_ec_dev for keyboard functions
  dm: stdio: Plumb in the new keyboard uclass
  dm: tegra: Convert keyboard driver to driver model
  dm: cros_ec: Convert cros_ec keyboard driver to driver model
  video: Drop unused console functions
  i8042: Use functions to handle register access
  i8042: Adjust kbd_reset() to collect all failures
  i8042: Adjust keyboard init to assume success
  input: Correct keycode for Ctrl-Y
  input: Add a few more keyboard keycodes
  input: Add a function to add a keycode to the existing set
  input: Allow repeat filtering to be disabled
  input: Support the German keymap
  input: Adjust structure of code in process_modifier()
  input: Handle caps lock
  input: Allow updating of keyboard LEDs
  input: i8042: Convert to use the input library
  input: Add a Kconfig option for the i8042 keyboard
  x86: Add an i8042 device for boards that have it
  Drop CONFIG_ISA_KEYBOARD
  input: Convert i8042 to driver model
  i8042: Handle a duplicate power-on-reset response
  video: input: Clean up after i8042 conversion
  input: Convert 'keyboard' driver to use input library

 README   |  42 +-
 arch/arm/Kconfig |   1 +
 arch/arm/mach-tegra/Kconfig  |   1 +
 arch/sandbox/Kconfig |   3 +
 arch/x86/Kconfig |   6 +
 arch/x86/dts/bayleybay.dts   |   1 +
 arch/x86/dts/chromebook_link.dts |   5 +
 arch/x86/dts/keyboard.dtsi   |   5 +
 board/kosagi/novena/novena.c |   1 +
 board/mpl/pip405/README  |   4 -
 common/stdio.c   |  31 +-
 common/usb_kbd.c |   6 -
 doc/device-tree-bindings/input/i8042.txt |  10 +
 drivers/input/Kconfig|  19 +
 drivers/input/Makefile   |   4 +-
 drivers/input/cros_ec_keyb.c | 147 +++
 drivers/input/i8042.c| 647 ---
 drivers/input/input.c| 222 +--
 drivers/input/keyboard-uclass.c  |  91 +
 drivers/input/keyboard.c | 290 ++
 drivers/input/tegra-kbc.c| 242 ++--
 drivers/misc/cros_ec.c   |  14 +-
 drivers/video/cfb_console.c  |  82 +---
 include/configs/MIP405.h |   5 -
 include/configs/MPC8536DS.h  |   1 -
 include/configs/MPC8544DS.h  |   1 -
 include/configs/MPC8572DS.h  |   1 -
 include/configs/MPC8641HPCN.h|   1 -
 

[U-Boot] [PATCH v2 05/28] cros_ec: Use udevice instead of cros_ec_dev for keyboard functions

2015-10-18 Thread Simon Glass
In preparation for converting the cros_ec keyboard driver to driver model,
adjust the cros_ec functions it will use to use a normal struct udevice.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/input/cros_ec_keyb.c |  4 ++--
 drivers/misc/cros_ec.c   | 14 +-
 include/cros_ec.h|  4 ++--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
index eaab86f..88397b0 100644
--- a/drivers/input/cros_ec_keyb.c
+++ b/drivers/input/cros_ec_keyb.c
@@ -54,7 +54,7 @@ static int check_for_keys(struct keyb *config,
unsigned int row, col, bit, data;
int num_keys;
 
-   if (cros_ec_scan_keyboard(config->dev, )) {
+   if (cros_ec_scan_keyboard(config->dev->dev, )) {
debug("%s: keyboard scan failed\n", __func__);
return -EIO;
}
@@ -139,7 +139,7 @@ int cros_ec_kbc_check(struct input_config *input)
 * may return 0 before all keys have been read from the EC.
 */
do {
-   irq_pending = cros_ec_interrupt_pending(config.dev);
+   irq_pending = cros_ec_interrupt_pending(config.dev->dev);
if (irq_pending) {
num_keys = check_for_keys(, keys, KBC_MAX_KEYS,
  );
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index ba36795..e3229ef 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -358,9 +358,11 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
return len;
 }
 
-int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan)
+int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan)
 {
-   if (ec_command(dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan,
+   struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
+
+   if (ec_command(cdev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan,
   sizeof(scan->data)) != sizeof(scan->data))
return -1;
 
@@ -549,13 +551,15 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum 
ec_reboot_cmd cmd,
return 0;
 }
 
-int cros_ec_interrupt_pending(struct cros_ec_dev *dev)
+int cros_ec_interrupt_pending(struct udevice *dev)
 {
+   struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
+
/* no interrupt support : always poll */
-   if (!dm_gpio_is_valid(>ec_int))
+   if (!dm_gpio_is_valid(>ec_int))
return -ENOENT;
 
-   return dm_gpio_get_value(>ec_int);
+   return dm_gpio_get_value(>ec_int);
 }
 
 int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_mkbp_info *info)
diff --git a/include/cros_ec.h b/include/cros_ec.h
index b926934..5fa5f6f 100644
--- a/include/cros_ec.h
+++ b/include/cros_ec.h
@@ -81,7 +81,7 @@ int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int 
maxlen);
  * @param scan Place to put the scan results
  * @return 0 if ok, -1 on error
  */
-int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan);
+int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan);
 
 /**
  * Read which image is currently running on the CROS-EC device.
@@ -125,7 +125,7 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum 
ec_reboot_cmd cmd,
  * @param dev  CROS-EC device
  * @return 0 if no interrupt is pending
  */
-int cros_ec_interrupt_pending(struct cros_ec_dev *dev);
+int cros_ec_interrupt_pending(struct udevice *dev);
 
 enum {
CROS_EC_OK,
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 02/28] input: Add a device pointer to the input config

2015-10-18 Thread Simon Glass
The read_keys() method in input is passed a struct input_config. Add a
device pointer there so that we can find out the device that is referred
to with driver model.

Once all drivers are converted we can update the input structure to use
driver model instead.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 include/input.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/input.h b/include/input.h
index 26e2ad7..7bccc8e 100644
--- a/include/input.h
+++ b/include/input.h
@@ -36,6 +36,7 @@ struct input_key_xlate {
 };
 
 struct input_config {
+   struct udevice *dev;
uchar fifo[INPUT_BUFFER_LEN];
int fifo_in, fifo_out;
 
-- 
2.6.0.rc2.230.g3dd15c0

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


Re: [U-Boot] [PATCH v2 1/5] debug_uart: Adjust the declaration of debug_uart_init()

2015-10-18 Thread Bin Meng
Hi Simon,

On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass  wrote:
> We want to be able to add other common code to this function. So change the
> driver's version to have an underscore before it, just like
> _debug_uart_putc(). Define debug_uart_init() to call this version.
>
> Update all drivers to this new method.
>
> Signed-off-by: Simon Glass 
> ---

Reviewed-by: Bin Meng 

>
> Changes in v2:
> - Adjust all _debug_uart_init() declarations to be static inline
>
>  drivers/serial/ns16550.c| 2 +-
>  drivers/serial/serial_efi.c | 2 +-
>  drivers/serial/serial_s5p.c | 2 +-
>  include/debug_uart.h| 9 +++--
>  lib/efi/efi_stub.c  | 2 +-
>  5 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 6275a11..6433844 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -257,7 +257,7 @@ int NS16550_tstc(NS16550_t com_port)
> (1 << CONFIG_DEBUG_UART_SHIFT), \
> CONFIG_DEBUG_UART_SHIFT)
>
> -void debug_uart_init(void)
> +static inline void _debug_uart_init(void)
>  {
> struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
> int baud_divisor;
> diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c
> index cf57d89..ea25c25 100644
> --- a/drivers/serial/serial_efi.c
> +++ b/drivers/serial/serial_efi.c
> @@ -107,7 +107,7 @@ static int serial_efi_pending(struct udevice *dev, bool 
> input)
>   * There is nothing to init here since the EFI console is already running by
>   * the time we enter U-Boot.
>   */
> -void debug_uart_init(void)
> +static inline void _debug_uart_init(void)
>  {
>  }
>
> diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
> index 3f0b588..feba467 100644
> --- a/drivers/serial/serial_s5p.c
> +++ b/drivers/serial/serial_s5p.c
> @@ -207,7 +207,7 @@ U_BOOT_DRIVER(serial_s5p) = {
>
>  #include 
>
> -void debug_uart_init(void)
> +static inline void _debug_uart_init(void)
>  {
> struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
>
> diff --git a/include/debug_uart.h b/include/debug_uart.h
> index a75e377..257ba00 100644
> --- a/include/debug_uart.h
> +++ b/include/debug_uart.h
> @@ -38,7 +38,7 @@
>   * To enable the debug UART in your serial driver:
>   *
>   * - #include 
> - * - Define debug_uart_init(), trying to avoid using the stack
> + * - Define _debug_uart_init(), trying to avoid using the stack
>   * - Define _debug_uart_putc() as static inline (avoiding stack usage)
>   * - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
>   * functionality (printch(), etc.)
> @@ -132,6 +132,11 @@ void printhex8(uint value);
> void printhex8(uint value) \
> { \
> printhex(value, 8); \
> -   }
> +   } \
> +\
> +   void debug_uart_init(void) \
> +   { \
> +   _debug_uart_init(); \
> +   } \

I think the ending \ in the last line will cause problems.

>
>  #endif
> diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
> index d4d3e49..e138709 100644
> --- a/lib/efi/efi_stub.c
> +++ b/lib/efi/efi_stub.c
> @@ -59,7 +59,7 @@ struct __packed desctab_info {
>   * considering if we start needing more U-Boot functionality. Note that we
>   * could then move get_codeseg32() to arch/x86/cpu/cpu.c.
>   */
> -void debug_uart_init(void)
> +void _debug_uart_init(void)
>  {
>  }
>
> --

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


[U-Boot] [PATCH v2 11/28] i8042: Adjust kbd_reset() to collect all failures

2015-10-18 Thread Simon Glass
Rather than lots of 'return' statements, use goto to a single return.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 drivers/input/i8042.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index dbd4b00..4c887f4 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -485,30 +485,33 @@ static int kbd_reset(void)
 
/* controller self test */
if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK)
-   return -1;
+   goto err;
 
/* keyboard reset */
if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
kbd_read(I8042_DATA_REG) != KBD_ACK ||
kbd_read(I8042_DATA_REG) != KBD_POR)
-   return -1;
+   goto err;
 
/* set AT translation and disable irq */
config = kbd_cmd_read(CMD_RD_CONFIG);
if (config == -1)
-   return -1;
+   goto err;
 
config |= CONFIG_AT_TRANS;
config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
if (kbd_cmd_write(CMD_WR_CONFIG, config))
-   return -1;
+   goto err;
 
/* enable keyboard */
if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) ||
!kbd_input_empty())
-   return -1;
+   goto err;
 
return 0;
+err:
+   debug("%s: Keyboard failure\n", __func__);
+   return -1;
 }
 
 static int kbd_controller_present(void)
-- 
2.6.0.rc2.230.g3dd15c0

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


[U-Boot] [PATCH v2 03/28] input: Return -ENOSPC when there is not space

2015-10-18 Thread Simon Glass
Return a useful error instead of -1 when something goes wrong.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 drivers/input/input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 007b855..9033935 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -467,7 +468,7 @@ int input_init(struct input_config *config, int leds)
input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate))) {
debug("%s: Could not add modifier tables\n", __func__);
-   return -1;
+   return -ENOSPC;
}
 
return 0;
-- 
2.6.0.rc2.230.g3dd15c0

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


Re: [U-Boot] [PATCH 4/4] x86: fsp: Add a hdr sub-command to show header information

2015-10-18 Thread Simon Glass
On 18 October 2015 at 14:26, Simon Glass  wrote:
> On 10 October 2015 at 02:47, Bin Meng  wrote:
>> It would be helpful to have a command to show FSP header. So far
>> it only supports FSP header which conforms to FSP spec 1.0.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/lib/fsp/cmd_fsp.c | 32 +++-
>>  1 file changed, 31 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/13] x86: Add ENABLE_MRC_CACHE Kconfig option

2015-10-18 Thread Simon Glass
On 18 October 2015 at 14:26, Simon Glass  wrote:
> On 11 October 2015 at 22:37, Bin Meng  wrote:
>> Create a Kconfig option for enabling MRC cache.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/Kconfig | 8 
>>  1 file changed, 8 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] x86: fsp: Print GUID whenever applicable in the hob command output

2015-10-18 Thread Simon Glass
On 18 October 2015 at 14:26, Simon Glass  wrote:
> On 10 October 2015 at 02:47, Bin Meng  wrote:
>> When examining a HOB, it's useful to see which GUID this HOB
>> belongs to. Add GUID output in the hob command to aid this.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/lib/cmd_hob.c | 22 +++---
>>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/13] x86: Move mrccache.[c|h] to a common place

2015-10-18 Thread Simon Glass
On 18 October 2015 at 14:26, Simon Glass  wrote:
> On 11 October 2015 at 22:37, Bin Meng  wrote:
>> mrccache implementation can be common for all boards. Move it
>> from ivybridge cpu directory to the common lib directory.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/ivybridge/Makefile  | 1 -
>>  arch/x86/cpu/ivybridge/sdram.c   | 2 +-
>>  arch/x86/include/asm/{arch-ivybridge => }/mrccache.h | 0
>>  arch/x86/lib/Makefile| 1 +
>>  arch/x86/{cpu/ivybridge => lib}/mrccache.c   | 3 +--
>>  configs/chromebook_link_defconfig| 1 +
>>  configs/chromebox_panther_defconfig  | 1 +
>>  7 files changed, 5 insertions(+), 4 deletions(-)
>>  rename arch/x86/include/asm/{arch-ivybridge => }/mrccache.h (100%)
>>  rename arch/x86/{cpu/ivybridge => lib}/mrccache.c (98%)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   3   >