Re: [U-Boot] [PATCH v3] dm: core: Enable optional use of fdt_translate_address()

2015-10-03 Thread Simon Glass
Hi Stefan,

On 1 October 2015 at 07:59, Stefan Roese  wrote:
> Hi Stephen,
>
>
> On 30.09.2015 18:13, Stephen Warren wrote:
>>
>> On 09/29/2015 11:00 PM, Stefan Roese wrote:
>>>
>>> The current "simple" address translation simple_bus_translate() is not
>>> working on some platforms (e.g. MVEBU). As here more complex "ranges"
>>> properties are used in many nodes (multiple tuples etc). This patch
>>> enables the optional use of the common fdt_translate_address() function
>>> which handles this translation correctly.
>>
>>
>> This change makes sense to me, but one comment:
>>
>>> diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
>>
>>
>>> +config OF_TRANSLATE
>>> +bool "Translate addresses using fdt_translate_address"
>>> +depends on DM && OF_CONTROL
>>> +default y
>>
>>
>> So this is on by default, which I think is correct since applying this
>> technique is required to parse DT correctly. However, ...
>>
>>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>>
>>
>>> +if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {
>>
>>
>>> +/*
>>> + * Use the full-fledged translate function for complex
>>> + * bus setups.
>>> + */
>>> +return fdt_translate_address((void *)gd->fdt_blob,
>>> + dev->of_offset, reg);
>>
>>
>> fdt_translate_address() is a simple wrapper around
>> __of_translate_address(), and that function calls fdt_parent_offset()
>> which is "slow" per Simon. Surely this patch will receive the same
>> objection as when I added a (single) call to fdt_parent_offset() into
>> the DT address parsing routine (and this patch is worse, since it adds a
>> call to fdt_parent_offset() for each level of DT sub-nodes).
>
>
> Yes, Simon already mentioned his speed related concerns. But I think
> I convinced him that calling this function once for each driver probe
> can't be that bad this in the v2 thread:
>
> https://patchwork.ozlabs.org/patch/514331/
>
> Simon, is this okay? Will you pull this patch after the v2015.10
> release?

It's not great but it is enabled by an option so I think it is OK for
now. We talked about the alternatives and they were not too great
either. Things like this suggest that we might move to an unflattened
device tree post-relocation one day.

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


Re: [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names

2015-10-03 Thread Chen-Yu Tsai
On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede  wrote:
> Stop prefixing the axp functions for setting voltages, etc. with the
> model number, there ever is only one pmic driver built into u-boot,
> this allows simplifying the callers.

Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
a subset of their LDOs share the same name, which would be a problem.

ChenYu

> Signed-off-by: Hans de Goede 
> ---
___
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-03 Thread Simon Glass
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 
___
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-03 Thread Simon Glass
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 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] malloc_simple: Add support for switching to DRAM heap

2015-10-03 Thread Simon Glass
On 22 September 2015 at 11:25, Hans de Goede  wrote:
> malloc_simple uses a part of the stack as heap, initially it uses
> SYS_MALLOC_F_LEN bytes which typically is quite small as the initial
> stacks sits in SRAM and we do not have that much SRAM to work with.
>
> When DRAM becomes available we may switch the stack from SRAM to DRAM
> to give use more room. This commit adds support for also switching to
> a new bigger malloc_simple heap located in the new stack.
>
> Note that this requires spl_init to be called before spl_relocate_stack_gd
> which in practice means that spl_init must be called from board_init_f.
>
> Signed-off-by: Hans de Goede 
> Reviewed-by: Tom Rini 
> ---
> Changes in v2:
> -Adjust for SPL_MALLOC_SIMPLE to SPL_SYS_MALLOC_SIMPLE rename
> ---
>  Kconfig  | 10 ++
>  common/spl/spl.c | 12 
>  2 files changed, 22 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 01/10] rockchip: rk3288: Add pinctrl support for the gmac ethernet interface

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Add support for the gmac ethernet interface to pinctrl. This hardcodes
> the setup to match that of the firefly and Radxa Rock2 boards, using the
> RGMII phy mode for gmac interface and GPIO4B0 as the phy reset GPIO.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  arch/arm/include/asm/arch-rockchip/grf_rk3288.h | 228 
> 
>  arch/arm/include/asm/arch-rockchip/periph.h |   1 +
>  drivers/pinctrl/rockchip/pinctrl_rk3288.c   | 102 +++
>  3 files changed, 331 insertions(+)
>
> diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3288.h 
> b/arch/arm/include/asm/arch-rockchip/grf_rk3288.h
> index 0117a17..b7dda47 100644
> --- a/arch/arm/include/asm/arch-rockchip/grf_rk3288.h
> +++ b/arch/arm/include/asm/arch-rockchip/grf_rk3288.h
> @@ -283,6 +283,163 @@ enum {
> GPIO3C0_EMMC_CMD,
>  };
>
> +/* GRF_GPIO3DL_IOMUX */
> +enum {
> +   GPIO3D3_SHIFT   = 12,
> +   GPIO3D3_MASK= 7,
> +   GPIO3D3_GPIO= 0,
> +   GPIO3D3_FLASH1_DATA3,
> +   GPIO3D3_HOST_DOUT3,
> +   GPIO3D3_MAC_RXD3,
> +   GPIO3D3_SDIO1_DATA3,
> +
> +   GPIO3D2_SHIFT   = 8,
> +   GPIO3D2_MASK= 7,
> +   GPIO3D2_GPIO= 0,
> +   GPIO3D2_FLASH1_DATA2,
> +   GPIO3D2_HOST_DOUT2,
> +   GPIO3D2_MAC_RXD2,
> +   GPIO3D2_SDIO1_DATA2,
> +
> +   GPIO3D1_SHIFT   = 4,
> +   GPIO3D1_MASK= 7,
> +   GPIO3D1_GPIO= 0,
> +   GPIO3DL1_FLASH1_DATA1,
> +   GPIO3D1_HOST_DOUT1,
> +   GPIO3D1_MAC_TXD3,
> +   GPIO3D1_SDIO1_DATA1,
> +
> +   GPIO3D0_SHIFT   = 0,
> +   GPIO3D0_MASK= 7,
> +   GPIO3D0_GPIO= 0,
> +   GPIO3D0_FLASH1_DATA0,
> +   GPIO3D0_HOST_DOUT0,
> +   GPIO3D0_MAC_TXD2,
> +   GPIO3D0_SDIO1_DATA0,
> +};
> +
> +/* GRF_GPIO3HL_IOMUX */
> +enum {
> +   GPIO3D7_SHIFT   = 12,
> +   GPIO3D7_MASK= 7,
> +   GPIO3D7_GPIO= 0,
> +   GPIO3D7_FLASH1_DATA7,
> +   GPIO3D7_HOST_DOUT7,
> +   GPIO3D7_MAC_RXD1,
> +   GPIO3D7_SDIO1_INTN,
> +
> +   GPIO3D6_SHIFT   = 8,
> +   GPIO3D6_MASK= 7,
> +   GPIO3D6_GPIO= 0,
> +   GPIO3D6_FLASH1_DATA6,
> +   GPIO3D6_HOST_DOUT6,
> +   GPIO3D6_MAC_RXD0,
> +   GPIO3D6_SDIO1_BKPWR,
> +
> +   GPIO3D5_SHIFT   = 4,
> +   GPIO3D5_MASK= 7,
> +   GPIO3D5_GPIO= 0,
> +   GPIO3D5_FLASH1_DATA5,
> +   GPIO3D5_HOST_DOUT5,
> +   GPIO3D5_MAC_TXD1,
> +   GPIO3D5_SDIO1_WRPRT,
> +
> +   GPIO3D4_SHIFT   = 0,
> +   GPIO3D4_MASK= 7,
> +   GPIO3D4_GPIO= 0,
> +   GPIO3D4_FLASH1_DATA4,
> +   GPIO3D4_HOST_DOUT4,
> +   GPIO3D4_MAC_TXD0,
> +   GPIO3D4_SDIO1_DETECTN,
> +};
> +
> +/* GRF_GPIO4AL_IOMUX */
> +enum {
> +   GPIO4A3_SHIFT   = 12,
> +   GPIO4A3_MASK= 7,
> +   GPIO4A3_GPIO= 0,
> +   GPIO4A3_FLASH1_ALE,
> +   GPIO4A3_HOST_DOUT9,
> +   GPIO4A3_MAC_CLK,
> +   GPIO4A3_FLASH0_CSN6,
> +
> +   GPIO4A2_SHIFT   = 8,
> +   GPIO4A2_MASK= 7,
> +   GPIO4A2_GPIO= 0,
> +   GPIO4A2_FLASH1_RDN,
> +   GPIO4A2_HOST_DOUT8,
> +   GPIO4A2_MAC_RXER,
> +   GPIO4A2_FLASH0_CSN5,
> +
> +   GPIO4A1_SHIFT   = 4,
> +   GPIO4A1_MASK= 7,
> +   GPIO4A1_GPIO= 0,
> +   GPIO4A1_FLASH1_WP,
> +   GPIO4A1_HOST_CKOUTN,
> +   GPIO4A1_MAC_TXDV,
> +   GPIO4A1_FLASH0_CSN4,
> +
> +   GPIO4A0_SHIFT   = 0,
> +   GPIO4A0_MASK= 3,
> +   GPIO4A0_GPIO= 0,
> +   GPIO4A0_FLASH1_RDY,
> +   GPIO4A0_HOST_CKOUTP,
> +   GPIO4A0_MAC_MDC,
> +};
> +
> +/* GRF_GPIO4AH_IOMUX */
> +enum {
> +   GPIO4A7_SHIFT   = 12,
> +   GPIO4A7_MASK= 7,
> +   GPIO4A7_GPIO= 0,
> +   GPIO4A7_FLASH1_CSN1,
> +   GPIO4A7_HOST_DOUT13,
> +   GPIO4A7_MAC_CSR,
> +   GPIO4A7_SDIO1_CLKOUT,
> +
> +   GPIO4A6_SHIFT   = 8,
> +   GPIO4A6_MASK= 7,
> +   GPIO4A6_GPIO= 0,
> +   GPIO4A6_FLASH1_CSN0,
> +   GPIO4A6_HOST_DOUT12,
> +   GPIO4A6_MAC_RXCLK,
> +   GPIO4A6_SDIO1_CMD,
> +
> +   GPIO4A5_SHIFT   = 4,
> +   GPIO4A5_MASK= 3,
> +   GPIO4A5_GPIO= 0,
> +   GPIO4A5_FLASH1_WRN,
> +   GPIO4A5_HOST_DOUT11,
> +   GPIO4A5_MAC_MDIO,
> +
> +   GPIO4A4_SHIFT   = 0,
> +   GPIO4A4_MASK= 7,
> +   GPIO4A4_GPIO= 0,
> +   GPIO4A4_FLASH1_CLE,
> +   GPIO4A4_HOST_DOUT10,
> +   GPIO4A4_MAC_TXEN,
> +   GPIO4A4_FLASH0_CSN7,
> +};
> +
> +/* GRF_GPIO4BL_IOMUX */
> +enum {
> +   GPIO4B1_SHIFT  

Re: [U-Boot] [PATCH v3 1/2] dm: implement a Timer uclass

2015-10-03 Thread Simon Glass
Hi Thomas,

On 3 October 2015 at 10:19, Thomas Chou  wrote:
> Implement a Timer uclass to work with lib/time.c.
>
> Signed-off-by: Thomas Chou 
> ---
> v2
>   fix coding style.
> v3
>   add description to Kconfig as Simon suggested.
>   move timer.c code to lib/time.c.
>   add dm_timer dev to global data.
>   remove timer_init().
>   change API name get_clock.
>
>  common/board_r.c  |  3 +++
>  drivers/Kconfig   |  2 ++
>  drivers/Makefile  |  1 +
>  drivers/timer/Kconfig | 11 
>  drivers/timer/Makefile|  7 +
>  drivers/timer/timer-uclass.c  | 35 +
>  include/asm-generic/global_data.h |  3 +++
>  include/dm/uclass-id.h|  1 +
>  include/timer.h   | 52 +
>  lib/time.c| 54 
> +++
>  10 files changed, 169 insertions(+)
>  create mode 100644 drivers/timer/Kconfig
>  create mode 100644 drivers/timer/Makefile
>  create mode 100644 drivers/timer/timer-uclass.c
>  create mode 100644 include/timer.h

Reviewed-by: Simon Glass 

Please see one nit below.

>
> diff --git a/common/board_r.c b/common/board_r.c
> index f8c1baa..aaf390e 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -290,6 +290,9 @@ static int initr_dm(void)
> /* Save the pre-reloc driver model and start a new one */
> gd->dm_root_f = gd->dm_root;
> gd->dm_root = NULL;
> +#ifdef CONFIG_DM_TIMER
> +   gd->dm_timer = NULL;
> +#endif
> return dm_init_and_scan(false);
>  }
>  #endif
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 63c92c5..f9496f7 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -56,6 +56,8 @@ source "drivers/spi/Kconfig"
>
>  source "drivers/thermal/Kconfig"
>
> +source "drivers/timer/Kconfig"
> +
>  source "drivers/tpm/Kconfig"
>
>  source "drivers/usb/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 9d0a595..692da78 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -48,6 +48,7 @@ obj-y += pcmcia/
>  obj-y += dfu/
>  obj-y += rtc/
>  obj-y += sound/
> +obj-y += timer/
>  obj-y += tpm/
>  obj-y += twserial/
>  obj-y += video/
> diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
> new file mode 100644
> index 000..5228e26
> --- /dev/null
> +++ b/drivers/timer/Kconfig
> @@ -0,0 +1,11 @@
> +menu "Timer Support"
> +
> +config DM_TIMER
> +   bool "Enable Driver Model for Timer drivers"
> +   depends on DM
> +   help
> + Enable driver model for Timer access. It uses the same API as
> + lib/time.c. But now implemented by the uclass. The first timer
> + will be used.
> +
> +endmenu
> diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
> new file mode 100644
> index 000..a24179a
> --- /dev/null
> +++ b/drivers/timer/Makefile
> @@ -0,0 +1,7 @@
> +#
> +# Copyright (C) 2015 Thomas Chou 
> +#
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +
> +obj-$(CONFIG_DM_TIMER) += timer-uclass.o
> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
> new file mode 100644
> index 000..8071fcc
> --- /dev/null
> +++ b/drivers/timer/timer-uclass.c
> @@ -0,0 +1,35 @@
> +/*
> + * Copyright (C) 2015 Thomas Chou 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +int timer_get_count(struct udevice *dev, unsigned long *count)
> +{
> +   const struct dm_timer_ops *ops = device_get_ops(dev);
> +
> +   if (!ops->get_count)
> +   return -ENOSYS;
> +
> +   return ops->get_count(dev, count);

I'm not too keen on get_count(). Isn't this required to be in
milliiseconds now? If so, how about get_ms()?

> +}
> +
> +int timer_get_clock(struct udevice *dev, unsigned long *freq)
> +{
> +   const struct dm_timer_ops *ops = device_get_ops(dev);
> +
> +   if (!ops->get_clock)
> +   return -ENOSYS;
> +
> +   return ops->get_clock(dev, freq);

Isn't this always 1000?

> +}
> +
> +UCLASS_DRIVER(timer) = {
> +   .id = UCLASS_TIMER,
> +   .name   = "timer",
> +};
> diff --git a/include/asm-generic/global_data.h 
> b/include/asm-generic/global_data.h
> index 2155265..ebecb5f 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -69,6 +69,9 @@ typedef struct global_data {
> struct udevice  *dm_root_f; /* Pre-relocation root instance */
> struct list_head uclass_root;   /* Head of core tree */
>  #endif
> +#ifdef CONFIG_DM_TIMER
> +   struct udevice  *dm_timer;  /* Timer instance for Driver Model */
> +#endif
>
> const void *fdt_blob;   /* Our device tree, NULL if none */
> void *new_fdt;  /* Relocated FDT */
> diff --git 

Re: [U-Boot] [PATCH 02/10] rockchip: rk3288: Add clock support for the gmac ethernet interface

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Setup the clocks for the gmac ethernet interface. This assumes the mac
> clock is fed by an external clock which is common on RK3288 based
> devices.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  arch/arm/include/asm/arch-rockchip/cru_rk3288.h | 17 +
>  drivers/clk/clk_rk3288.c| 16 
>  2 files changed, 33 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] [RFC PATCH] x86: Support booting SeaBIOS

2015-10-03 Thread Simon Glass
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?

>
> Signed-off-by: Bin Meng 
>
> ---
>
>  arch/x86/Kconfig  | 10 ++
>  arch/x86/include/asm/tables.h | 29 +
>  arch/x86/lib/tables.c | 39 +++
>  3 files changed, 78 insertions(+)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 5e42d7d..b432ff8 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -401,6 +401,16 @@ 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 SEABIOS
> +   bool "Support booting SeaBIOS"
> +   help
> + 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/U-Boot. By turning on this option, U-Boot prepares
> + all the configuration tables that are necessary to boot SeaBIOS.
> +
> + Check http://www.seabios.org/SeaBIOS for details.
> +
>  source "arch/x86/lib/efi/Kconfig"
>
>  endmenu
> diff --git a/arch/x86/include/asm/tables.h b/arch/x86/include/asm/tables.h
> index 0aa6d9b..a083cac 100644
> --- a/arch/x86/include/asm/tables.h
> +++ b/arch/x86/include/asm/tables.h
> @@ -7,6 +7,32 @@
>  #ifndef _X86_TABLES_H_
>  #define _X86_TABLES_H_
>
> +#ifdef CONFIG_SEABIOS
> +
> +#define CB_TAG_MEMORY  1
> +
> +struct cb_header {
> +   u8 signature[4];
> +   u32 header_bytes;
> +   u32 header_checksum;
> +   u32 table_bytes;
> +   u32 table_checksum;
> +   u32 table_entries;
> +};
> +
> +struct cb_memory_range {
> +   u64 start;
> +   u64 size;
> +   u32 type;
> +};
> +
> +struct cb_memory {
> +   u32 tag;
> +   u32 size;
> +   struct cb_memory_range map[0];
> +};
> +#endif
> +
>  /*
>   * All x86 tables happen to like the address range from 0xf to 0x10.
>   * We use 0xf as the starting address to store those tables, including
> @@ -14,6 +40,9 @@
>   */
>  #define ROM_TABLE_ADDR 0xf
>
> +/* SeaBIOS expects coreboot tables at address range 0x-0x1000 */
> +#define CB_TABLE_ADDR  0x800
> +
>  /**
>   * table_compute_checksum() - Compute a table checksum
>   *
> diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c
> index f15b2e2..5849b2f 100644
> --- a/arch/x86/lib/tables.c
> +++ b/arch/x86/lib/tables.c
> @@ -9,6 +9,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  u8 table_compute_checksum(void *v, int len)
>  {
> @@ -36,6 +37,41 @@ void table_fill_string(char *dest, const char *src, size_t 
> n, char pad)
> dest[i] = pad;
>  }
>
> +#ifdef CONFIG_SEABIOS
> +static u32 write_cb_tables(u32 addr)
> +{
> +   struct cb_header *cbh = (struct cb_header *)addr;
> +   struct cb_memory *mem;
> +   struct cb_memory_range *map;
> +   struct e820entry entry[32];
> +   int num, i;
> +
> +   memset(cbh, 0, sizeof(struct cb_header));
> +   strncpy((char *)cbh->signature, "LBIO", 4);

memcpy()?

> +   cbh->header_bytes = sizeof(struct cb_header);
> +
> +   /* populate memory map table */
> +   mem = (struct cb_memory *)(cbh + 1);
> +   mem->tag = CB_TAG_MEMORY;
> +   map = mem->map;
> +   num = install_e820_map(32, entry);

ARRAY_SIZE(entry)

> +   for (i = 0; i < num; i++) {
> +   map->start = entry[i].addr;
> +   map->size = entry[i].size;
> +   map->type = entry[i].type;
> +   map++;
> +   }
> +   mem->size = num * sizeof(struct cb_memory_range) + 

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

2015-10-03 Thread Simon Glass
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 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2015-10-03 Thread Simon Glass
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
___
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-03 Thread Simon Glass
On 1 October 2015 at 08:36, 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: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 1/4] fdtdec: fix parsing 'reg' property with zero value in '#size-cells'

2015-10-03 Thread Simon Glass
On 30 September 2015 at 12:14, Przemyslaw Marczak  wrote:
> After rework of lib/fdtdec.c by:
>
> commit: 02464e3 fdt: add new fdt address parsing functions
>
> the function fdtdec_get_addr() doesn't work as previous,
> because the implementation assumes that properties '#address-cells'
> and '#size-cells' are equal to 1, which can be not true sometimes.
>
> The new API introduced fdtdec_get_addr_size_auto_parent() for the 'reg'
> property parsing, but the implementation assumes, that #size-cells
> can't be less than 1.
>
> This causes that the following children's 'reg' property can't be reached:
>
> parent@0x0 {
>  #address-cells = <1>;
>  #size-cells = <0>;
>  children@0x100 {
>  reg = < 0x100 >;
>  };
> };
>
> Change the condition value from '1' to '0', which allows parsing property
> with at least zero #size-cells, fixes the issue.
>
> Now, fdtdec_get_addr_size_auto_parent() works properly.
>
> Tested on: Odroid U3/X2, Trats, Trats2, Odroid XU3, Snow (by Simon).
>
> Signed-off-by: Przemyslaw Marczak 
> Acked-by: Stephen Warren 
> Acked-by: Simon Glass 
> Tested-by: Simon Glass 
> ---
> Changes V2:
> - cleanup commit message
> - add acked-by
> Changes V3:
> - add acked-by and tested-by Simon
> ---
>  lib/fdtdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-fdt, 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-03 Thread Simon Glass
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 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] rockchip: Reconfigure the malloc based to point to system memory

2015-10-03 Thread Sjoerd Simons
When malloc_base initially gets setup in the SPL it is based on the
current (early) stack pointer, which for rockchip is pointing into SRAM.
This means simple memory allocations happen in SRAM space, which is
somewhat unfortunate. Specifically a bounce buffer for the mmc allocated
in SRAM space seems to cause the mmc engine to stall/fail causing
timeouts and a failure to load the main u-boot image.

To resolve this, reconfigure the malloc_base to start at the relocated
stack pointer after DRAM  has been setup.

For reference, things did work fine on rockchip before 596380db was
merged to fix memalign_simple due to a combination of rockchip SDRAM
starting at address 0 and the dw_mmc driver not checking errors from
bounce_buffer_start. As a result, when a bounce buffer needed to be
allocated mem_align simple would fail and return NULL. The mmc driver
ignored the error and happily continued with the bounce buffer address
being set to 0, which just happened to work fine..

Signed-off-by: Sjoerd Simons 
Reviewed-by: Hans de Goede 
Acked-by: Simon Glass 

---
A better fix for this issue would be to reconfigure the
malloc_base in spl_relocate_stack_gd following the same steps as is done
for the initial setup (for which Hans de Goede already posted some
patches). However at this point in the release cycle i preferred to do a
minimal rockchip only fix (so those boards become bootable again) for
this issue to minimize the potential impact on other boards.

Changes in v3:
- Fixing coding style for the comment block

Changes in v2:
- Also gd->malloc_ptr to 0 to not waste any potential space

 arch/arm/mach-rockchip/board-spl.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-rockchip/board-spl.c 
b/arch/arm/mach-rockchip/board-spl.c
index a241d96..28c3949 100644
--- a/arch/arm/mach-rockchip/board-spl.c
+++ b/arch/arm/mach-rockchip/board-spl.c
@@ -217,6 +217,13 @@ void board_init_f(ulong dummy)
debug("DRAM init failed: %d\n", ret);
return;
}
+
+   /*
+* Now that DRAM is initialized setup base pointer for simple malloc
+* into RAM.
+*/
+   gd->malloc_base = CONFIG_SPL_STACK_R_ADDR;
+   gd->malloc_ptr = 0;
 }
 
 static int setup_led(void)
-- 
2.5.3

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


Re: [U-Boot] [PATCH v3] rockchip: Reconfigure the malloc based to point to system memory

2015-10-03 Thread Simon Glass
On 3 October 2015 at 12:25, Sjoerd Simons  wrote:
>
> When malloc_base initially gets setup in the SPL it is based on the
> current (early) stack pointer, which for rockchip is pointing into SRAM.
> This means simple memory allocations happen in SRAM space, which is
> somewhat unfortunate. Specifically a bounce buffer for the mmc allocated
> in SRAM space seems to cause the mmc engine to stall/fail causing
> timeouts and a failure to load the main u-boot image.
>
> To resolve this, reconfigure the malloc_base to start at the relocated
> stack pointer after DRAM  has been setup.
>
> For reference, things did work fine on rockchip before 596380db was
> merged to fix memalign_simple due to a combination of rockchip SDRAM
> starting at address 0 and the dw_mmc driver not checking errors from
> bounce_buffer_start. As a result, when a bounce buffer needed to be
> allocated mem_align simple would fail and return NULL. The mmc driver
> ignored the error and happily continued with the bounce buffer address
> being set to 0, which just happened to work fine..
>
> Signed-off-by: Sjoerd Simons 
> Reviewed-by: Hans de Goede 
> Acked-by: Simon Glass 
>
> ---
> A better fix for this issue would be to reconfigure the
> malloc_base in spl_relocate_stack_gd following the same steps as is done
> for the initial setup (for which Hans de Goede already posted some
> patches). However at this point in the release cycle i preferred to do a
> minimal rockchip only fix (so those boards become bootable again) for
> this issue to minimize the potential impact on other boards.
>
> Changes in v3:
> - Fixing coding style for the comment block
>
> Changes in v2:
> - Also gd->malloc_ptr to 0 to not waste any potential space
>
>  arch/arm/mach-rockchip/board-spl.c | 7 +++
>  1 file changed, 7 insertions(+)

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] serial: rockchip: make ROCKCHIP_SERIAL depend on ARCH_ROCKCHIP

2015-10-03 Thread Simon Glass
On 29 September 2015 at 05:57, Simon Glass  wrote:
> On 28 September 2015 at 21:32, Masahiro Yamada
>  wrote:
>> It looks like this line was copy-pasted, but not modified.
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  drivers/serial/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Thanks!
>
> Acked-by: Simon Glass 

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


Re: [U-Boot] [PATCH v2] nios2: add clear and set bits macros

2015-10-03 Thread Thomas Chou



On 09/30/2015 09:32 PM, Thomas Chou wrote:

These macros can be used to clear and set multiple bits
in a register using a single call.

Signed-off-by: Thomas Chou 
Reviewed-by: Marek Vasut 
---
v2
   remove unsupported 64 btis macros as Chin Liang suggested.

  arch/nios2/include/asm/io.h | 55 +
  1 file changed, 55 insertions(+)



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


[U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig

2015-10-03 Thread Hans de Goede
On boards with axp221/223 pmic-s we already allow configuring most
voltages. Make the Kconfig options for these also apply to boards with
axp152 / axp209 pmic-s and extend them to configure all voltages.

The Kconfig defaults are chosen so that this commit does not introduce any
functional changes.

Signed-off-by: Hans de Goede 
---
 board/sunxi/board.c  |  48 -
 configs/CSQ_CS908_defconfig  |   4 +-
 configs/Colombus_defconfig   |   4 +-
 configs/Hummingbird_A31_defconfig|   2 +-
 configs/MSI_Primo81_defconfig|   2 +-
 configs/Mele_A1000G_quad_defconfig   |   8 +-
 configs/Mele_I7_defconfig|   8 +-
 configs/Mele_M9_defconfig|   8 +-
 configs/Sinlinx_SinA33_defconfig |   2 +-
 configs/ga10h_v1_1_defconfig |   4 +-
 configs/gt90h_v4_defconfig   |   6 +-
 configs/mixtile_loftq_defconfig  |   2 +-
 configs/q8_a23_tablet_800x480_defconfig  |   4 +-
 configs/q8_a33_tablet_1024x600_defconfig |   4 +-
 configs/q8_a33_tablet_800x480_defconfig  |   4 +-
 drivers/power/Kconfig| 174 +++
 16 files changed, 185 insertions(+), 99 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 1b90678..bc0376b 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -444,36 +444,36 @@ void sunxi_board_init(void)
 
 #ifdef CONFIG_AXP152_POWER
power_failed = axp152_init();
-   power_failed |= axp152_set_dcdc2(1400);
-   power_failed |= axp152_set_dcdc3(1500);
-   power_failed |= axp152_set_dcdc4(1250);
-   power_failed |= axp152_set_ldo2(3000);
+   power_failed |= axp152_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+   power_failed |= axp152_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+   power_failed |= axp152_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
+   power_failed |= axp152_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
 #endif
 #ifdef CONFIG_AXP209_POWER
power_failed |= axp209_init();
-   power_failed |= axp209_set_dcdc2(1400);
-   power_failed |= axp209_set_dcdc3(1250);
-   power_failed |= axp209_set_ldo2(3000);
-   power_failed |= axp209_set_ldo3(2800);
-   power_failed |= axp209_set_ldo4(2800);
+   power_failed |= axp209_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+   power_failed |= axp209_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+   power_failed |= axp209_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
+   power_failed |= axp209_set_ldo3(CONFIG_AXP_ALDO3_VOLT);
+   power_failed |= axp209_set_ldo4(CONFIG_AXP_ALDO4_VOLT);
 #endif
 #ifdef CONFIG_AXP221_POWER
power_failed = axp221_init();
-   power_failed |= axp221_set_dcdc1(CONFIG_AXP221_DCDC1_VOLT);
-   power_failed |= axp221_set_dcdc2(CONFIG_AXP221_DCDC2_VOLT);
-   power_failed |= axp221_set_dcdc3(1200); /* VDD-CPU */
-#ifdef CONFIG_MACH_SUN6I
-   power_failed |= axp221_set_dcdc4(1200); /* A31:VDD-SYS */
-#else
-   power_failed |= axp221_set_dcdc4(0);/* A23:unused */
-#endif
-   power_failed |= axp221_set_dcdc5(1500); /* VCC-DRAM */
-   power_failed |= axp221_set_dldo1(CONFIG_AXP221_DLDO1_VOLT);
-   power_failed |= axp221_set_dldo4(CONFIG_AXP221_DLDO4_VOLT);
-   power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT);
-   power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT);
-   power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT);
-   power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT);
+   power_failed |= axp221_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
+   power_failed |= axp221_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+   power_failed |= axp221_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+   power_failed |= axp221_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
+   power_failed |= axp221_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
+   power_failed |= axp221_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
+   power_failed |= axp221_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
+   power_failed |= axp221_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
+   power_failed |= axp221_set_dldo1(CONFIG_AXP_DLDO1_VOLT);
+   power_failed |= axp221_set_dldo2(CONFIG_AXP_DLDO2_VOLT);
+   power_failed |= axp221_set_dldo3(CONFIG_AXP_DLDO3_VOLT);
+   power_failed |= axp221_set_dldo4(CONFIG_AXP_DLDO4_VOLT);
+   power_failed |= axp221_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
+   power_failed |= axp221_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
+   power_failed |= axp221_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
 #endif
 
printf("DRAM:");
diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig
index 7c8eca8..3ffd34e 100644
--- a/configs/CSQ_CS908_defconfig
+++ b/configs/CSQ_CS908_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
 

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

2015-10-03 Thread Simon Glass
Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Fix missing 'depends on DM' left out of the v1 patch

 drivers/tpm/Kconfig  | 15 +++
 drivers/tpm/Makefile |  2 +-
 lib/Kconfig  |  1 +
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index 3ab652c..31b35f7 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -4,15 +4,6 @@
 
 menu "TPM support"
 
-config DM_TPM
-   bool "Enable driver model for Trusted Platform Module drivers"
-   depends on DM && TPM
-   help
-  Enable driver model for TPMs. The TIS interface (tis_open(),
- tis_sendrecv(), etc.) is then implemented by the TPM uclass. Note
- that even with driver model only a single TPM is currently
- supported, since the tpm library assumes this.
-
 config TPM_TIS_SANDBOX
bool "Enable sandbox TPM driver"
depends on SANDBOX
@@ -24,7 +15,7 @@ config TPM_TIS_SANDBOX
 
 config TPM_ATMEL_TWI
bool "Enable Atmel TWI TPM device driver"
-   depends on DM_TPM && DM_I2C
+   depends on TPM && DM_I2C
help
  This driver supports an Atmel TPM device connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
@@ -33,7 +24,7 @@ config TPM_ATMEL_TWI
 
 config TPM_TIS_INFINEON
bool "Enable support for Infineon SLB9635/45 TPMs on I2C"
-   depends on DM_TPM && DM_I2C
+   depends on TPM && DM_I2C
help
  This driver supports Infineon TPM devices connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
@@ -57,7 +48,7 @@ config TPM_TIS_I2C_BURST_LIMITATION_LEN
 
 config TPM_TIS_LPC
bool "Enable support for Infineon SLB9635/45 TPMs on LPC"
-   depends on DM_TPM && X86
+   depends on TPM && X86
help
  This driver supports Infineon TPM devices connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile
index 5748145..1d49e95 100644
--- a/drivers/tpm/Makefile
+++ b/drivers/tpm/Makefile
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-$(CONFIG_DM_TPM) += tpm-uclass.o
+obj-$(CONFIG_TPM) += tpm-uclass.o
 
 obj-$(CONFIG_TPM_ATMEL_TWI) += tpm_atmel_twi.o
 obj-$(CONFIG_TPM_TIS_INFINEON) += tpm_tis_infineon.o
diff --git a/lib/Kconfig b/lib/Kconfig
index 0673072..70ed20d 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -56,6 +56,7 @@ source lib/rsa/Kconfig
 
 config TPM
bool "Trusted Platform Module (TPM) Support"
+   depends on DM
help
  This enables support for TPMs which can be used to provide security
  features for your board. The TPM can be connected via LPC or I2C
-- 
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 03/10] net: designware: support phy reset device-tree bindings

2015-10-03 Thread Simon Glass
Hi Sjoerd,

On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Add support for the snps,reset-gpio, snps,reset-active-low (optional) and
> snps,reset-delays-us device-tree bindings. The combination of these
> three define how the PHY should be reset to ensure it's in a sane state.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  drivers/net/designware.c | 74 
> 
>  drivers/net/designware.h | 11 +++
>  2 files changed, 79 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 6433896..f9ceec2 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -28,7 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  static int dw_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)
>  {
> +#ifdef CONFIG_DM_ETH
> +   struct dw_eth_dev *priv = dev_get_priv((struct udevice *)bus->priv);
> +   struct eth_mac_regs *mac_p = priv->mac_regs_p;
> +#else
> struct eth_mac_regs *mac_p = bus->priv;
> +#endif
> ulong start;
> u16 miiaddr;
> int timeout = CONFIG_MDIO_TIMEOUT;
> @@ -51,7 +56,12 @@ static int dw_mdio_read(struct mii_dev *bus, int addr, int 
> devad, int reg)
>  static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
> u16 val)
>  {
> +#ifdef CONFIG_DM_ETH
> +   struct dw_eth_dev *priv = dev_get_priv((struct udevice *)bus->priv);
> +   struct eth_mac_regs *mac_p = priv->mac_regs_p;
> +#else
> struct eth_mac_regs *mac_p = bus->priv;
> +#endif
> ulong start;
> u16 miiaddr;
> int ret = -ETIMEDOUT, timeout = CONFIG_MDIO_TIMEOUT;
> @@ -74,7 +84,40 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, 
> int devad, int reg,
> return ret;
>  }
>
> -static int dw_mdio_init(const char *name, struct eth_mac_regs *mac_regs_p)
> +#if CONFIG_DM_ETH
> +static int dw_mdio_reset(struct mii_dev *bus)
> +{
> +   struct udevice *dev = bus->priv;
> +   struct dw_eth_pdata *pdata = dev_get_platdata(dev);
> +   int ret;
> +
> +   if (pdata->reset_gpio.dev == NULL)

!dm_gpio_is_valid(>reset_gpio)

> +   return 0;
> +
> +   /* reset the phy */
> +   ret = dm_gpio_set_value(>reset_gpio, 0);
> +   if (ret)
> +   return ret;
> +
> +   udelay(pdata->reset_delays[0]);
> +
> +   ret = dm_gpio_set_value(>reset_gpio, 1);
> +   if (ret)
> +   return ret;
> +
> +   udelay(pdata->reset_delays[1]);
> +
> +   ret = dm_gpio_set_value(>reset_gpio, 0);
> +   if (ret)
> +   return ret;
> +
> +   udelay(pdata->reset_delays[2]);
> +
> +   return 0;
> +}
> +#endif
> +
> +static int dw_mdio_init(const char *name, void *priv)
>  {
> struct mii_dev *bus = mdio_alloc();
>
> @@ -85,9 +128,12 @@ static int dw_mdio_init(const char *name, struct 
> eth_mac_regs *mac_regs_p)
>
> bus->read = dw_mdio_read;
> bus->write = dw_mdio_write;
> +#ifdef CONFIG_DM_ETH
> +   bus->reset = dw_mdio_reset;
> +#endif
> snprintf(bus->name, sizeof(bus->name), name);
>
> -   bus->priv = (void *)mac_regs_p;
> +   bus->priv = priv;
>
> return mdio_register(bus);
>  }
> @@ -604,7 +650,7 @@ static int designware_eth_probe(struct udevice *dev)
> priv->dma_regs_p = (struct eth_dma_regs *)(iobase + 
> DW_DMA_BASE_OFFSET);
> priv->interface = pdata->phy_interface;
>
> -   dw_mdio_init(dev->name, priv->mac_regs_p);
> +   dw_mdio_init(dev->name, dev);
> priv->bus = miiphy_get_dev_by_name(dev->name);
>
> ret = dw_phy_init(priv, dev);
> @@ -624,8 +670,11 @@ static const struct eth_ops designware_eth_ops = {
>
>  static int designware_eth_ofdata_to_platdata(struct udevice *dev)
>  {
> -   struct eth_pdata *pdata = dev_get_platdata(dev);
> +   struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev);
> +   struct eth_pdata *pdata = _pdata->eth_pdata;
> const char *phy_mode;
> +   int reset_flags = GPIOD_IS_OUT;
> +   int ret = 0;
>
> pdata->iobase = dev_get_addr(dev);
> pdata->phy_interface = -1;
> @@ -637,7 +686,20 @@ static int designware_eth_ofdata_to_platdata(struct 
> udevice *dev)
> return -EINVAL;
> }
>
> -   return 0;
> +   if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
> +   "snps,reset-active-low"))
> +   reset_flags |= GPIOD_ACTIVE_LOW;
> +
> +   ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
> +   _pdata->reset_gpio, reset_flags);

It's odd to put a probed gpio into platdata. Should you use private
data instead? (dev_get_priv())

> +   if (ret == 0) {
> +   ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
> +   "snps,reset-delays-us", dw_pdata->reset_delays, 3);
> +   } else if (ret == -ENOENT) {
> +  

Re: [U-Boot] [PATCH v3 1/2] dm: implement a Miscellaneous uclass

2015-10-03 Thread Simon Glass
Hi Thomas,

On 29 September 2015 at 12:59, Thomas Chou  wrote:
> Implement a Miscellaneous uclass with generic read or
> write operations. This class is used only for those
> do not fit other more general classes.
>
> Signed-off-by: Thomas Chou 
> ---
> v2
>   add missing misc.h.
> v3
>   no change.
>
>  drivers/misc/Kconfig   |  6 ++
>  drivers/misc/Makefile  |  1 +
>  drivers/misc/misc-uclass.c | 14 ++
>  include/dm/uclass-id.h |  1 +
>  include/misc.h | 22 ++
>  5 files changed, 44 insertions(+)
>  create mode 100644 drivers/misc/misc-uclass.c
>  create mode 100644 include/misc.h
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 8b38a84..51c2a08 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -4,6 +4,12 @@
>
>  menu "Multifunction device drivers"
>
> +config DM_MISC
> +   bool "Enable Driver Model for Misc drivers"
> +   depends on DM
> +   help
> + Enable driver model for miscellaneous devices.

Need to explain this a bit more! When do I use it, mention that it has
read and write.

I'm not sure about the name 'misc' but I suppose it makes sense. I
wonder if you should add 'ioctl' also?

> +
>  config CMD_CROS_EC
> bool "Enable crosec command"
> depends on CROS_EC
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 8d0fc3c..b285946 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -5,6 +5,7 @@
>  # SPDX-License-Identifier: GPL-2.0+
>  #
>
> +obj-$(CONFIG_DM_MISC) += misc-uclass.o
>  obj-$(CONFIG_ALI152X) += ali512x.o
>  obj-$(CONFIG_DS4510)  += ds4510.o
>  obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
> diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c
> new file mode 100644
> index 000..40fe947
> --- /dev/null
> +++ b/drivers/misc/misc-uclass.c
> @@ -0,0 +1,14 @@
> +/*
> + * Copyright (C) 2010 Thomas Chou 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +UCLASS_DRIVER(misc) = {
> +   .id = UCLASS_MISC,
> +   .name   = "misc",
> +};
> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
> index aff34a4..a6982ab 100644
> --- a/include/dm/uclass-id.h
> +++ b/include/dm/uclass-id.h
> @@ -39,6 +39,7 @@ enum uclass_id {
> UCLASS_LED, /* Light-emitting diode (LED) */
> UCLASS_LPC, /* x86 'low pin count' interface */
> UCLASS_MASS_STORAGE,/* Mass storage device */
> +   UCLASS_MISC,/* Miscellaneous device */
> UCLASS_MMC, /* SD / MMC card or chip */
> UCLASS_MOD_EXP, /* RSA Mod Exp device */
> UCLASS_PCH, /* x86 platform controller hub */
> diff --git a/include/misc.h b/include/misc.h
> new file mode 100644
> index 000..dfca41f
> --- /dev/null
> +++ b/include/misc.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2015 Thomas Chou 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef _DM_MISC_H_
> +#define _DM_MISC_H_
> +
> +/*
> + * struct dm_misc_ops - Driver model Misc operations
> + *
> + * The uclass interface is implemented by all miscellaneous devices which
> + * use driver model.
> + */
> +struct dm_misc_ops {
> +   int (*read)(struct udevice *dev, int offset, void *buf, int size);
> +   int (*write)(struct udevice *dev, int offset, const void *buf,
> +int size);

Method comments
> +};

Also don't you need to create misc_read() and misc_write() functions
so people can use it?

> +
> +#endif /* _DM_MISC_H_ */
> --
> 2.1.4
>

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


Re: [U-Boot] [PATCH V2 00/11] Add board detection for Odroid XU3 / XU3Lite / XU4

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 1 October 2015 at 12:07, Przemyslaw Marczak  wrote:
> Hello,
>
>
> On 09/21/2015 02:26 PM, Przemyslaw Marczak wrote:
>>
>> This patchset adds:
>> - CPU model in dts for Chromebook Peach Pi as Exynos5800
>> - set the cpu id of Exynos5422 to 0x5422
>> - S2MPS11 PMIC I/O driver
>> - Exynos5420-compatible (9-channel, 12-bit) ADC driver
>> - new file for Exynos5: exynos5-dt-types.c
>> - board detection for Odroid XU3 / XU3lite / XU4
>> - fixed ADC val for XU4
>>
>> This was tested on Odroid XU3 and XU3 Lite, without the XU4,
>> but I'm waiting for reply from the Odroid forum users.
>>
>> Tested with buildman for samsung.
>>
>> Available on github:
>> https://github.com/bobenstein/u-boot/tree/xu3-detect-patchset-v1
>> https://github.com/bobenstein/u-boot/tree/xu3-detect-patchset-v2
>>
>> Przemyslaw Marczak (11):
>>samsung: board/misc: check returned pointer for get_board_type() calls
>>s5p: cpu_info: print "cpu-model" if exists in dts
>>Peach-Pi: dts: add cpu-model string
>>Exynos5422/5800: set cpu id to 0x5422
>>dm: pmic: add s2mps11 PMIC I/O driver
>>dm: adc: add simple ADC uclass implementation
>>dm: adc: add Exynos54xx compatible ADC driver
>>Odroid-XU3: enable s2mps11 PMIC support
>>Exynos54xx: dts: add ADC node
>>Odroid-XU3: dts: enable ADC, with request for pre-reloc bind
>>exynos5-dt-types: add board detection for Odroid XU3/XU3L/XU4.
>>
>>   arch/arm/cpu/armv7/s5p-common/cpu_info.c  |  14 ++-
>>   arch/arm/dts/exynos5422-odroidxu3.dts |  12 ++
>>   arch/arm/dts/exynos54xx.dtsi  |   7 ++
>>   arch/arm/dts/exynos5800-peach-pi.dts  |   1 +
>>   arch/arm/mach-exynos/clock.c  |  16 +--
>>   arch/arm/mach-exynos/clock_init_exynos5.c |   2 +-
>>   arch/arm/mach-exynos/common_setup.h   |   4 +-
>>   arch/arm/mach-exynos/include/mach/adc.h   |  45 +++
>>   arch/arm/mach-exynos/include/mach/cpu.h   |   6 +-
>>   arch/arm/mach-exynos/include/mach/gpio.h  |   4 +-
>>   arch/arm/mach-exynos/pinmux.c |   2 +-
>>   arch/arm/mach-exynos/power.c  |   2 +-
>>   board/samsung/common/Makefile |   5 +-
>>   board/samsung/common/board.c  |   4 +-
>>   board/samsung/common/exynos5-dt-types.c   | 196
>> ++
>>   board/samsung/common/exynos5-dt.c |  12 ++
>>   board/samsung/common/misc.c   |   3 +
>>   configs/odroid-xu3_defconfig  |   5 +
>>   doc/device-tree-bindings/pmic/s2mps11.txt |  17 +++
>>   drivers/Kconfig   |   2 +
>>   drivers/Makefile  |   1 +
>>   drivers/adc/Kconfig   |  17 +++
>>   drivers/adc/Makefile  |   9 ++
>>   drivers/adc/adc-uclass.c  |  76 
>>   drivers/adc/exynos-adc.c  | 102 
>>   drivers/power/pmic/Kconfig|  14 +++
>>   drivers/power/pmic/Makefile   |   1 +
>>   drivers/power/pmic/s2mps11.c  |  60 +
>>   include/adc.h |  88 ++
>>   include/configs/odroid_xu3.h  |  12 ++
>>   include/dm/uclass-id.h|   1 +
>>   include/power/s2mps11.h   | 109 +
>>   include/samsung/exynos5-dt-types.h|  27 
>>   33 files changed, 854 insertions(+), 22 deletions(-)
>>   create mode 100644 board/samsung/common/exynos5-dt-types.c
>>   create mode 100644 doc/device-tree-bindings/pmic/s2mps11.txt
>>   create mode 100644 drivers/adc/Kconfig
>>   create mode 100644 drivers/adc/Makefile
>>   create mode 100644 drivers/adc/adc-uclass.c
>>   create mode 100644 drivers/adc/exynos-adc.c
>>   create mode 100644 drivers/power/pmic/s2mps11.c
>>   create mode 100644 include/adc.h
>>   create mode 100644 include/power/s2mps11.h
>>   create mode 100644 include/samsung/exynos5-dt-types.h
>>
>
> Simon,
> Are you going to to review this patchset or can I update it and ask Minkyu
> for taking it?

I thought Minkyu would take it as it seems to be exynos-specific.

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


Re: [U-Boot] [PATCH 07/10] rockchip: rk3288-firefly: Add gmac definition

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Add a definition for the gmac interface to the firefly device-tree.
> Copied verbatim from the linux kernel.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  arch/arm/dts/rk3288-firefly.dtsi | 16 
>  1 file changed, 16 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 08/10] rockchip: firefly: Enable networking support

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Enable the various configuration option required to get the ethernet
> interface up and running.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  configs/firefly-rk3288_defconfig | 5 +
>  include/configs/firefly-rk3288.h | 3 +++
>  2 files changed, 8 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 10/10] rockchip: Drop Ethernet from the TODO

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Now that ethernet support works, it can be dropped from the rockchip
> TODO
>
> Signed-off-by: Sjoerd Simons 
>
> ---
>
>  doc/README.rockchip | 1 -
>  1 file changed, 1 deletion(-)

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 09/10] rockchip: Add PXE and DHCP to the default boot targets

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Now that at least on the firefly board we have network support, enable
> PXE and DHCP boot targets by default.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  include/configs/rk3288_common.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

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


[U-Boot] Please pull u-boot-fdt

2015-10-03 Thread Simon Glass
Hi Tom,

Here are a few last-minute bug fixes mostly stemming from the
fdtdec_get_addr() change earlier.


The following changes since commit fbb0c7bd92255bfcb13826a8ac81be6e2f94ba48:

  Merge branch 'master' of git://git.denx.de/u-boot-tegra (2015-10-02
20:35:49 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-fdt.git

for you to fetch changes up to cce573e8d806fd430e7584b36bce6d62ae0430e8:

  trats: fdt: disable unused DW MMC (2015-10-03 14:39:19 +0100)


Przemyslaw Marczak (4):
  fdtdec: fix parsing 'reg' property with zero value in '#size-cells'
  gpio: s5p: call: dev_get_addr() instead of fdtdec_get_addr()
  mach-exynos: clock: restore calling dead exynos4_get_mmc_clk()
  trats: fdt: disable unused DW MMC

Simon Glass (1):
  dts: Add a comment about CONFIG_OF_EMBED being for local use

Stephen Warren (1):
  fdt: fix fdtdec_get_addr_size not to require any size cells

 arch/arm/dts/exynos4210-trats.dts |  4 
 arch/arm/mach-exynos/clock.c  | 10 --
 drivers/gpio/s5p_gpio.c   | 18 +++---
 dts/Kconfig   |  4 +++-
 lib/fdtdec.c  |  7 ---
 5 files changed, 26 insertions(+), 17 deletions(-)

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


Re: [U-Boot] [PATCH] ls102xa: Fix reset hang

2015-10-03 Thread Tom Rini
On Fri, Oct 02, 2015 at 04:42:14PM +0200, Wolfgang Denk wrote:
> Dear Fabio,
> 
> In message <1443792315-18997-1-git-send-email-feste...@gmail.com> you wrote:
> > 
> ...
> > Unlike i.MX and Vybrid, the watchdog controller on LS102x is big-endian.
> ...
> > +struct watchdog_regs {
> > +   u16 wcr;/* Control */
> > +   u16 wsr;/* Service */
> > +   u16 wrsr;   /* Reset Status */
> > +};
> > +
> > +#define WCR_SRS(1 << 4)
> 
> This belongs to some watchdog (or processor) related header file.
> 
> As is, it duplicates code from drivers/watchdog/imx_watchdog.c which
> is something we should not do.
> 
> > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> > index 9e9cb55..a007ae8 100644
> > --- a/drivers/watchdog/Makefile
> > +++ b/drivers/watchdog/Makefile
> > @@ -7,7 +7,7 @@
> >  
> >  obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
> >  obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
> > -ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610 ls102xa))
> > +ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610))
> 
> So this fixes the reset problem for now - but what happens when
> someone wants to use the watchdog for real?  Will we create a copy of
> drivers/watchdog/imx_watchdog.c  using big-endian accessors?  This
> cannot be right?

Fabio, can you do a v2 that makes the commit message a bit clearer that
this is a temporary work-around and that a proper solution to the
underlying problem is coming?  I think everyone that's reading this
thread knows this but we should make it clear to someone that just picks
up the code / commit (so maybe a comment block too) that we're making
things non-broken for the release but that's not the same thing as
making it correct for the long term.  Thanks!

-- 
Tom


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


[U-Boot] Please pull u-boot-sunxi master

2015-10-03 Thread Hans de Goede

Hi Tom,

Here is what is hopefully really the final sunxi pull-req for v2015.10.

This introduces just 1 new defconfig, we want this new defconfig in v2015.10
since it is a generic defconfig for so called q8 formfactor sunxi tablets,
and we want to replace all the PCB revision specific defconfigs with
a few generic ones since there are just too many variants.

So we want to have generic configs for a13 / a23 / a33 based q8 tablets,
current master already has them for a13 / a33, this commit makes the
set complete, which allows us to start dropping the pcb revision specific
ones in v2016.01.

The following changes since commit fbb0c7bd92255bfcb13826a8ac81be6e2f94ba48:

  Merge branch 'master' of git://git.denx.de/u-boot-tegra (2015-10-02 20:35:49 
-0400)

are available in the git repository at:

  http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to 97fec7105c6d31f52026921e669ec78e1b7ca623:

  sunxi: Add generic defconfigs for A23 Q8 tablets with 800x480 LCD (2015-10-03 
12:08:04 +0200)


Hans de Goede (1):
  sunxi: Add generic defconfigs for A23 Q8 tablets with 800x480 LCD

 arch/arm/dts/Makefile   |  3 +-
 arch/arm/dts/sun8i-a23-q8-tablet.dts| 65 +
 board/sunxi/MAINTAINERS |  1 +
 configs/q8_a23_tablet_800x480_defconfig | 25 +
 4 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/sun8i-a23-q8-tablet.dts
 create mode 100644 configs/q8_a23_tablet_800x480_defconfig

Regards,

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


Re: [U-Boot] [PATCH] net: Increase the size of the net_boot_file_name buffer

2015-10-03 Thread Stefan Bruens
On Thursday 01 October 2015 16:27:11 Wolfgang Denk wrote:
> Dear Jacob,
> 
> In message <1443622325-30792-1-git-send-email-j-stiff...@ti.com> you wrote:
> > The net_boot_file_name buffer is used as storage for the bootfilename
> > command line argument to network boot commands such as tftp and nfs.
> > 
> > Increase the size of this buffer to 1024 bytes as the current size of
> > 128 bytes is restrictive for arbitrary paths on the server.
> 
> According to RFC 2131, the boot file name has a fixed size of 128
> octets.

You can also put the file name into Option 67, which results in a length limit 
of 255 octets (DHCP option length limit).

I sent patches with several DHCP enhancements, including Option 67 support, to 
the ML a few weeks ago.

Kind regards,

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034 mobile: +49 151 50412019
work: +49 2405 49936-424
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER

2015-10-03 Thread Hans de Goede
Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER settings, removing
them from CONFIG_SYS_EXTRA_OPTIONS.

Note that sun5i boards can have either an AXP209 or an AXP152 pmic, so
there is no default for these in Kconfig, and the board-defconfig must
always select one (except on the rare pmic-less board).

Signed-off-by: Hans de Goede 
---
 configs/A10-OLinuXino-Lime_defconfig   |  2 +-
 configs/A10s-OLinuXino-M_defconfig |  3 ++-
 configs/A13-OLinuXino_defconfig|  3 ++-
 configs/A20-OLinuXino-Lime2_defconfig  |  2 +-
 configs/A20-OLinuXino-Lime_defconfig   |  2 +-
 configs/A20-OLinuXino_MICRO_defconfig  |  2 +-
 configs/A20-Olimex-SOM-EVB_defconfig   |  2 +-
 configs/Ainol_AW1_defconfig|  1 -
 configs/Ampe_A76_defconfig |  3 ++-
 configs/Auxtek-T003_defconfig  |  2 +-
 configs/Auxtek-T004_defconfig  |  2 +-
 configs/Bananapi_defconfig |  2 +-
 configs/Bananapro_defconfig|  2 +-
 configs/Chuwi_V7_CW0825_defconfig  |  1 -
 configs/Cubieboard2_defconfig  |  2 +-
 configs/Cubieboard_defconfig   |  2 +-
 configs/Cubietruck_defconfig   |  2 +-
 configs/Hyundai_A7HD_defconfig |  1 -
 configs/Linksprite_pcDuino3_Nano_defconfig |  2 +-
 configs/Linksprite_pcDuino3_defconfig  |  2 +-
 configs/Linksprite_pcDuino_defconfig   |  2 +-
 configs/MK808C_defconfig   |  1 -
 configs/MSI_Primo73_defconfig  |  1 -
 configs/Mele_A1000_defconfig   |  2 +-
 configs/Mele_M3_defconfig  |  2 +-
 configs/Mini-X_defconfig   |  1 -
 configs/Orangepi_defconfig |  2 +-
 configs/Orangepi_mini_defconfig|  2 +-
 configs/UTOO_P66_defconfig |  2 +-
 configs/Wexler_TAB7200_defconfig   |  1 -
 configs/Wits_Pro_A20_DKT_defconfig |  2 +-
 configs/Wobo_i5_defconfig  |  2 +-
 configs/Yones_Toptech_BD1078_defconfig |  1 -
 configs/ba10_tv_box_defconfig  |  2 +-
 configs/i12-tvbox_defconfig|  2 +-
 configs/iNet_3F_defconfig  |  1 -
 configs/iNet_3W_defconfig  |  1 -
 configs/iNet_86VS_defconfig|  2 +-
 configs/inet1_defconfig|  1 -
 configs/inet97fv2_defconfig|  1 -
 configs/inet98v_rev2_defconfig |  3 ++-
 configs/inet9f_rev03_defconfig |  1 -
 configs/jesurun_q5_defconfig   |  2 +-
 configs/mk802_a10s_defconfig   |  2 +-
 configs/mk802_defconfig|  1 +
 configs/mk802ii_defconfig  |  1 -
 configs/pov_protab2_ips9_defconfig |  1 -
 configs/q8_a13_tablet_defconfig|  3 ++-
 configs/r7-tv-dongle_defconfig |  2 +-
 configs/sunxi_Gemei_G9_defconfig   |  1 -
 drivers/power/Kconfig  | 15 +++
 51 files changed, 54 insertions(+), 49 deletions(-)

diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index f4ff7c5..b22fdb3 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -8,7 +8,7 @@ CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-olinuxino-lime"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/A10s-OLinuXino-M_defconfig 
b/configs/A10s-OLinuXino-M_defconfig
index 7783c7d..d9add78 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -9,8 +9,9 @@ CONFIG_USB1_VBUS_PIN="PB10"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-olinuxino-micro"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,SUNXI_EMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig
index 0645716..2edc0d2 100644
--- a/configs/A13-OLinuXino_defconfig
+++ b/configs/A13-OLinuXino_defconfig
@@ -14,9 +14,10 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_NAND_SUNXI=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/A20-OLinuXino-Lime2_defconfig 
b/configs/A20-OLinuXino-Lime2_defconfig
index c9d0f47..678132c 100644
--- 

[U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names

2015-10-03 Thread Hans de Goede
Stop prefixing the axp functions for setting voltages, etc. with the
model number, there ever is only one pmic driver built into u-boot,
this allows simplifying the callers.

Signed-off-by: Hans de Goede 
---
 arch/arm/cpu/armv7/sunxi/cpu_info.c |  4 +--
 arch/arm/cpu/armv7/sunxi/usb_phy.c  |  9 -
 board/sunxi/board.c | 70 +
 drivers/gpio/axp_gpio.c | 11 +-
 drivers/power/axp152.c  | 12 +++
 drivers/power/axp209.c  | 39 +
 drivers/power/axp221.c  | 35 +--
 drivers/video/sunxi_display.c   |  6 ++--
 include/axp152.h|  6 
 include/axp209.h|  9 -
 include/axp221.h| 16 -
 include/axp_pmic.h  | 37 
 12 files changed, 106 insertions(+), 148 deletions(-)
 create mode 100644 include/axp_pmic.h

diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c 
b/arch/arm/cpu/armv7/sunxi/cpu_info.c
index a276fad..05fef32 100644
--- a/arch/arm/cpu/armv7/sunxi/cpu_info.c
+++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #ifdef CONFIG_MACH_SUN6I
@@ -82,7 +82,7 @@ int print_cpuinfo(void)
 int sunxi_get_sid(unsigned int *sid)
 {
 #ifdef CONFIG_AXP221_POWER
-   return axp221_get_sid(sid);
+   return axp_get_sid(sid);
 #elif defined SUNXI_SID_BASE
int i;
 
diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c 
b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index b7ca5d4..19bb5a1 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -17,15 +17,6 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_AXP152_POWER
-#include 
-#endif
-#ifdef CONFIG_AXP209_POWER
-#include 
-#endif
-#ifdef CONFIG_AXP221_POWER
-#include 
-#endif
 
 #define SUNXI_USB_PMU_IRQ_ENABLE   0x800
 #ifdef CONFIG_MACH_SUN8I_A33
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index bc0376b..e99b2ba 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -13,15 +13,7 @@
 
 #include 
 #include 
-#ifdef CONFIG_AXP152_POWER
-#include 
-#endif
-#ifdef CONFIG_AXP209_POWER
-#include 
-#endif
-#ifdef CONFIG_AXP221_POWER
-#include 
-#endif
+#include 
 #include 
 #include 
 #include 
@@ -442,40 +434,42 @@ void sunxi_board_init(void)
int power_failed = 0;
unsigned long ramsize;
 
-#ifdef CONFIG_AXP152_POWER
-   power_failed = axp152_init();
-   power_failed |= axp152_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
-   power_failed |= axp152_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-   power_failed |= axp152_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
-   power_failed |= axp152_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
+#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined 
CONFIG_AXP221_POWER
+   power_failed = axp_init();
+
+#ifdef CONFIG_AXP221_POWER
+   power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
 #endif
-#ifdef CONFIG_AXP209_POWER
-   power_failed |= axp209_init();
-   power_failed |= axp209_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
-   power_failed |= axp209_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-   power_failed |= axp209_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
-   power_failed |= axp209_set_ldo3(CONFIG_AXP_ALDO3_VOLT);
-   power_failed |= axp209_set_ldo4(CONFIG_AXP_ALDO4_VOLT);
+   power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+   power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+#ifndef CONFIG_AXP209_POWER
+   power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
 #endif
 #ifdef CONFIG_AXP221_POWER
-   power_failed = axp221_init();
-   power_failed |= axp221_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
-   power_failed |= axp221_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
-   power_failed |= axp221_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-   power_failed |= axp221_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
-   power_failed |= axp221_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
-   power_failed |= axp221_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
-   power_failed |= axp221_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
-   power_failed |= axp221_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
-   power_failed |= axp221_set_dldo1(CONFIG_AXP_DLDO1_VOLT);
-   power_failed |= axp221_set_dldo2(CONFIG_AXP_DLDO2_VOLT);
-   power_failed |= axp221_set_dldo3(CONFIG_AXP_DLDO3_VOLT);
-   power_failed |= axp221_set_dldo4(CONFIG_AXP_DLDO4_VOLT);
-   power_failed |= axp221_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
-   power_failed |= axp221_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
-   power_failed |= axp221_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
+   power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
 #endif
 
+#ifdef CONFIG_AXP221_POWER
+   power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
+#endif
+   power_failed |= axp_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
+#ifndef CONFIG_AXP152_POWER
+   power_failed |= 

[U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V

2015-10-03 Thread Hans de Goede
On A23 / A33 boards aldo1 is used for VCC-IO and should be 3.0V, make this
the default.

Note that this does not cause any functional changes since all sun8i
board defconfig-s already contained: CONFIG_AXP_ALDO1_VOLT=3000 .

Signed-off-by: Hans de Goede 
---
 configs/Sinlinx_SinA33_defconfig | 1 -
 configs/ga10h_v1_1_defconfig | 1 -
 configs/gt90h_v4_defconfig   | 1 -
 configs/q8_a23_tablet_800x480_defconfig  | 1 -
 configs/q8_a33_tablet_1024x600_defconfig | 1 -
 configs/q8_a33_tablet_800x480_defconfig  | 1 -
 drivers/power/Kconfig| 3 ++-
 7 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/configs/Sinlinx_SinA33_defconfig b/configs/Sinlinx_SinA33_defconfig
index 79fa5bc..013c35e 100644
--- a/configs/Sinlinx_SinA33_defconfig
+++ b/configs/Sinlinx_SinA33_defconfig
@@ -9,4 +9,3 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP_ALDO1_VOLT=3000
diff --git a/configs/ga10h_v1_1_defconfig b/configs/ga10h_v1_1_defconfig
index b288e82..34e74af 100644
--- a/configs/ga10h_v1_1_defconfig
+++ b/configs/ga10h_v1_1_defconfig
@@ -22,6 +22,5 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/gt90h_v4_defconfig b/configs/gt90h_v4_defconfig
index e7347d8..a14de0d 100644
--- a/configs/gt90h_v4_defconfig
+++ b/configs/gt90h_v4_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a23_tablet_800x480_defconfig 
b/configs/q8_a23_tablet_800x480_defconfig
index 4993fa9..7391464 100644
--- a/configs/q8_a23_tablet_800x480_defconfig
+++ b/configs/q8_a23_tablet_800x480_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_1024x600_defconfig 
b/configs/q8_a33_tablet_1024x600_defconfig
index d427966..16f8600 100644
--- a/configs/q8_a33_tablet_1024x600_defconfig
+++ b/configs/q8_a33_tablet_1024x600_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_800x480_defconfig 
b/configs/q8_a33_tablet_800x480_defconfig
index 7f5cc47..6378918 100644
--- a/configs/q8_a33_tablet_800x480_defconfig
+++ b/configs/q8_a33_tablet_800x480_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index cedc36a..ba1af6c 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -90,7 +90,8 @@ config AXP_DCDC5_VOLT
 config AXP_ALDO1_VOLT
int "axp pmic (a)ldo1 voltage"
depends on AXP221_POWER
-   default 0
+   default 0 if MACH_SUN6I
+   default 3000 if MACH_SUN8I
---help---
Set the voltage (mV) to program the axp pmic aldo1 at, set to 0 to
disable aldo1.
-- 
2.5.0

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


[U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V

2015-10-03 Thread Hans de Goede
Change the axp223 dcdc2 / VDD-SYS default from 1.2V to 1.1V, 1.1V is the
value recommended by Allwinner and is what most fex files specify.

This has been tested on a number of A23/A33 tablets including on an
A23 Ippo-q8h-v1.2 PCB tablet which has a fex file which specifies 1.2V
(which is where our original 1.2V default comes from).

Signed-off-by: Hans de Goede 
---
 configs/gt90h_v4_defconfig | 1 -
 drivers/power/Kconfig  | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configs/gt90h_v4_defconfig b/configs/gt90h_v4_defconfig
index e6be718..e7347d8 100644
--- a/configs/gt90h_v4_defconfig
+++ b/configs/gt90h_v4_defconfig
@@ -20,7 +20,6 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP_DCDC2_VOLT=1100
 CONFIG_AXP_DLDO1_VOLT=3300
 CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 3a7b3f9..cedc36a 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -42,13 +42,14 @@ config AXP_DCDC2_VOLT
int "axp pmic dcdc2 voltage"
depends on AXP152_POWER || AXP209_POWER || AXP221_POWER
default 1400 if AXP152_POWER || AXP209_POWER
-   default 1200 if MACH_SUN6I || MACH_SUN8I
+   default 1200 if MACH_SUN6I
+   default 1100 if MACH_SUN8I
---help---
Set the voltage (mV) to program the axp pmic dcdc2 at, set to 0 to
disable dcdc2.
On A10(s) / A13 / A20 boards dcdc2 is VDD-CPU and should be 1.4V.
On A31 boards dcdc2 is used for VDD-GPU and should be 1.2V.
-   On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.2V.
+   On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.1V.
 
 config AXP_DCDC3_VOLT
int "axp pmic dcdc3 voltage"
-- 
2.5.0

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


[U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init()

2015-10-03 Thread Hans de Goede
The only thing axp221.c's axp_init() does which needs protection
against multiple calls is calling pmic_bus_init, and pmic_bus_init()
itself is already protected against being called multiple times.

Signed-off-by: Hans de Goede 
---
 drivers/power/axp221.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index d621f2a..65802e4 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -269,14 +269,9 @@ int axp_set_eldo(int eldo_num, unsigned int mvolt)
 
 int axp_init(void)
 {
-   /* This cannot be 0 because it is used in SPL before BSS is ready */
-   static int needs_init = 1;
u8 axp_chip_id;
int ret;
 
-   if (!needs_init)
-   return 0;
-
ret = pmic_bus_init();
if (ret)
return ret;
@@ -288,7 +283,6 @@ int axp_init(void)
if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
return -ENODEV;
 
-   needs_init = 0;
return 0;
 }
 
-- 
2.5.0

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


[U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver

2015-10-03 Thread Hans de Goede
Use the generic pmic_bus helpers for the axp152 / axp209 drivers,
rather then having them define their own register read / write
functions.

Signed-off-by: Hans de Goede 
---
 drivers/power/axp152.c | 28 +++-
 drivers/power/axp209.c | 36 +++-
 2 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
index c60e4d3..2972586 100644
--- a/drivers/power/axp152.c
+++ b/drivers/power/axp152.c
@@ -5,19 +5,9 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 #include 
-#include 
+#include 
 #include 
 
-static int axp152_write(enum axp152_reg reg, u8 val)
-{
-   return i2c_write(0x30, reg, 1, , 1);
-}
-
-static int axp152_read(enum axp152_reg reg, u8 *val)
-{
-   return i2c_read(0x30, reg, 1, val, 1);
-}
-
 static u8 axp152_mvolt_to_target(int mvolt, int min, int max, int div)
 {
if (mvolt < min)
@@ -36,13 +26,13 @@ int axp_set_dcdc2(unsigned int mvolt)
target = axp152_mvolt_to_target(mvolt, 700, 2275, 25);
 
/* Do we really need to be this gentle? It has built-in voltage slope */
-   while ((rc = axp152_read(AXP152_DCDC2_VOLTAGE, )) == 0 &&
+   while ((rc = pmic_bus_read(AXP152_DCDC2_VOLTAGE, )) == 0 &&
   current != target) {
if (current < target)
current++;
else
current--;
-   rc = axp152_write(AXP152_DCDC2_VOLTAGE, current);
+   rc = pmic_bus_write(AXP152_DCDC2_VOLTAGE, current);
if (rc)
break;
}
@@ -53,21 +43,21 @@ int axp_set_dcdc3(unsigned int mvolt)
 {
u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 50);
 
-   return axp152_write(AXP152_DCDC3_VOLTAGE, target);
+   return pmic_bus_write(AXP152_DCDC3_VOLTAGE, target);
 }
 
 int axp_set_dcdc4(unsigned int mvolt)
 {
u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 25);
 
-   return axp152_write(AXP152_DCDC4_VOLTAGE, target);
+   return pmic_bus_write(AXP152_DCDC4_VOLTAGE, target);
 }
 
 int axp_set_aldo2(unsigned int mvolt)
 {
u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 100);
 
-   return axp152_write(AXP152_LDO2_VOLTAGE, target);
+   return pmic_bus_write(AXP152_LDO2_VOLTAGE, target);
 }
 
 int axp_init(void)
@@ -75,7 +65,11 @@ int axp_init(void)
u8 ver;
int rc;
 
-   rc = axp152_read(AXP152_CHIP_VERSION, );
+   rc = pmic_bus_init();
+   if (rc)
+   return rc;
+
+   rc = pmic_bus_read(AXP152_CHIP_VERSION, );
if (rc)
return rc;
 
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index 91c35fa..bb5d08b 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -6,19 +6,9 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 
-static int axp209_write(enum axp209_reg reg, u8 val)
-{
-   return i2c_write(0x34, reg, 1, , 1);
-}
-
-static int axp209_read(enum axp209_reg reg, u8 *val)
-{
-   return i2c_read(0x34, reg, 1, val, 1);
-}
-
 static u8 axp209_mvolt_to_cfg(int mvolt, int min, int max, int div)
 {
if (mvolt < min)
@@ -37,14 +27,14 @@ int axp_set_dcdc2(unsigned int mvolt)
cfg = axp209_mvolt_to_cfg(mvolt, 700, 2275, 25);
 
/* Do we really need to be this gentle? It has built-in voltage slope */
-   while ((rc = axp209_read(AXP209_DCDC2_VOLTAGE, )) == 0 &&
+   while ((rc = pmic_bus_read(AXP209_DCDC2_VOLTAGE, )) == 0 &&
   current != cfg) {
if (current < cfg)
current++;
else
current--;
 
-   rc = axp209_write(AXP209_DCDC2_VOLTAGE, current);
+   rc = pmic_bus_write(AXP209_DCDC2_VOLTAGE, current);
if (rc)
break;
}
@@ -56,7 +46,7 @@ int axp_set_dcdc3(unsigned int mvolt)
 {
u8 cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
 
-   return axp209_write(AXP209_DCDC3_VOLTAGE, cfg);
+   return pmic_bus_write(AXP209_DCDC3_VOLTAGE, cfg);
 }
 
 int axp_set_aldo2(unsigned int mvolt)
@@ -66,13 +56,13 @@ int axp_set_aldo2(unsigned int mvolt)
 
cfg = axp209_mvolt_to_cfg(mvolt, 1800, 3300, 100);
 
-   rc = axp209_read(AXP209_LDO24_VOLTAGE, );
+   rc = pmic_bus_read(AXP209_LDO24_VOLTAGE, );
if (rc)
return rc;
 
/* LDO2 configuration is in upper 4 bits */
reg = (reg & 0x0f) | (cfg << 4);
-   return axp209_write(AXP209_LDO24_VOLTAGE, reg);
+   return pmic_bus_write(AXP209_LDO24_VOLTAGE, reg);
 }
 
 int axp_set_aldo3(unsigned int mvolt)
@@ -84,7 +74,7 @@ int axp_set_aldo3(unsigned int mvolt)
else
cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
 
-   return axp209_write(AXP209_LDO3_VOLTAGE, cfg);
+   return pmic_bus_write(AXP209_LDO3_VOLTAGE, cfg);
 }
 
 int axp_set_aldo4(unsigned int mvolt)

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

2015-10-03 Thread Simon Glass
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 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon

2015-10-03 Thread Simon Glass
On 20 September 2015 at 21:00, Christophe Ricard
 wrote:
> As there is no TCG specification or recommendation for i2c TPM 1.2,
> move tpm_tis_i2c driver to tpm_i2c_infineon. Other tpm vendors like Atmel
> or STMicroelectronics may have a different transport protocol for i2c.
>
> Signed-off-by: Christophe Ricard 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3:
> - Adding mention to Tom Rini review
>
>  README| 4 ++--
>  configs/nyan-big_defconfig| 2 +-
>  configs/peach-pi_defconfig| 2 +-
>  configs/peach-pit_defconfig   | 2 +-
>  configs/snow_defconfig| 2 +-
>  configs/spring_defconfig  | 2 +-
>  drivers/tpm/Kconfig   | 4 ++--
>  drivers/tpm/Makefile  | 2 +-
>  drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} | 4 ++--
>  drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} | 0
>  10 files changed, 12 insertions(+), 12 deletions(-)
>  rename drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} (99%)
>  rename drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} (100%)

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 0/4] Fix fdt 'reg' parsing and unbreak few Exynos4 boards

2015-10-03 Thread Simon Glass
Hi,

On 30 September 2015 at 19:30, Simon Glass  wrote:
> Hi Przemyslaw,
>
> On 30 September 2015 at 06:25, Przemyslaw Marczak  
> wrote:
>> Hello Tom, Simon,
>>
>>
>> On 09/30/2015 03:13 PM, Tom Rini wrote:
>>>
>>> On Wed, Sep 30, 2015 at 01:14:49PM +0200, Przemyslaw Marczak wrote:
>>>
 Booting of Odroid U3/X2 with SD card, ends with error:

 MMC:   EXYNOS DWMMC: 0
 Card did not respond to voltage select!
 *** Warning - MMC init failed, using default environment

 Generally this was broken, because of wrong addresses,
 assigned to GPIOs.
 The source of the problem was in rework of lib/fdtdec.c, after which
 function fdtdec_get_addr() doesn't work as previous and function
 dev_get_addr() doesn't works as expected.

 The code after rework in lib/fdtdec.c assumed, that #size-cells property,
 should be always greater or equal to 1, this was wrong, because it can be
 0.

 In case of debugging the issue, I found, that mmc clock was computed
 wrong,
 for Exynos4, because of function get_mmc_clk(), which always returns -1
 for
 this SoC.

 The patchset should fix booting on all Exynos4 boards, however it was
 tested
 on: Odroid X2 / U3 / XU3 and Trats / Trats2.

 Przemyslaw Marczak (4):
fdtdec: fix parsing 'reg' property with zero value in '#size-cells'
gpio: s5p: call: dev_get_addr() instead of fdtdec_get_addr()
mach-exynos: clock: restore calling dead exynos4_get_mmc_clk()
trats: fdt: disable unused DW MMC

   arch/arm/dts/exynos4210-trats.dts |  4 
   arch/arm/mach-exynos/clock.c  | 10 --
   drivers/gpio/s5p_gpio.c   | 18 +++---
   lib/fdtdec.c  |  2 +-
   4 files changed, 20 insertions(+), 14 deletions(-)
>>>
>>>
>>> Should I grab this directly or expect a PR from the DT or Samsung tree?
>>> Thanks!
>>>
>>
>> If this is not a problem for you, then it will be nice :)
>>
>> Simon,
>> Is that good to you?
>
> Yes, thank you both.

Hmm I'm going to pick this up for the DT tree as there's another patch
needed from Stephen also. Tom if you already have this locally let me
know.

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


Re: [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model

2015-10-03 Thread Simon Glass
On 20 September 2015 at 21:00, Christophe Ricard
 wrote:
> As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
> functions.
>
> This simplify a bit the code.
>
> Signed-off-by: Christophe Ricard 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
>
>  common/cmd_tpm.c   | 13 +
>  drivers/tpm/tpm_tis_infineon.c |  1 -
>  include/tis.h  | 60 
> --
>  include/tpm.h  |  6 -
>  lib/tpm.c  | 20 +++---
>  5 files changed, 4 insertions(+), 96 deletions(-)
>  delete mode 100644 include/tis.h

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 2/2] rockchip: firefly: Save the environment on SD card

2015-10-03 Thread Simon Glass
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 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM

2015-10-03 Thread Simon Glass
On 20 September 2015 at 21:00, Christophe Ricard
 wrote:
> Every TPM drivers should now depends on DM_TPM and not only TPM.
>
> Signed-off-by: Christophe Ricard 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
>
>  drivers/tpm/Kconfig | 6 +++---
>  1 file changed, 3 insertions(+), 3 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/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver

2015-10-03 Thread Simon Glass
On 20 September 2015 at 21:00, Christophe Ricard
 wrote:
> tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
>
> Signed-off-by: Christophe Ricard 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v3: None
>
>  drivers/tpm/Kconfig |  2 +-
>  drivers/tpm/tpm_atmel_twi.c | 74 
> -
>  2 files changed, 54 insertions(+), 22 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 V2 02/11] s5p: cpu_info: print "cpu-model" if exists in dts

2015-10-03 Thread Simon Glass
On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> The CPU name for Exynos was concatenated with cpu id,
> but for new Exynos platforms, like Chromebook Peach Pi
> based on Exynos5800, the name of SoC variant does not
> include the real SoC cpu id (0x5422).
>
> For such case, the CPU name should be defined in device tree.
>
> This commit introduces new device-tree property for Exynos:
> - "cpu-model" - with cpu name string
> If defined, then the cpu id is not printed.
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit
> ---
>  arch/arm/cpu/armv7/s5p-common/cpu_info.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 

Please see nit below.

> diff --git a/arch/arm/cpu/armv7/s5p-common/cpu_info.c 
> b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
> index 154d674..97d611f 100644
> --- a/arch/arm/cpu/armv7/s5p-common/cpu_info.c
> +++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
> @@ -5,9 +5,12 @@
>   * SPDX-License-Identifier:GPL-2.0+
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  /* Default is s5pc100 */
>  unsigned int s5p_cpu_id = 0xC100;
>  /* Default is EVT1 */
> @@ -30,7 +33,16 @@ u32 get_device_type(void)
>  #ifdef CONFIG_DISPLAY_CPUINFO
>  int print_cpuinfo(void)
>  {
> -   printf("CPU:   %s%X @ ", s5p_get_cpu_name(), s5p_cpu_id);
> +   const char *cpu_model = NULL;
> +   int len = 0;

No need to init these two variables.

> +
> +   /* For SoC with no real CPU ID in naming convention. */
> +   cpu_model = fdt_getprop(gd->fdt_blob, 0, "cpu-model", );
> +   if (cpu_model)
> +   printf("CPU:   %.*s @ ", len, cpu_model);
> +   else
> +   printf("CPU:   %s%X @ ", s5p_get_cpu_name(), s5p_cpu_id);
> +
> print_freq(get_arm_clk(), "\n");
>
> return 0;
> --
> 1.9.1
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 01/11] samsung: board/misc: check returned pointer for get_board_type() calls

2015-10-03 Thread Simon Glass
On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> The function get_board_type() is called in two places by common code,
> but the returned pointer was never check.
>
> This commit adds checking the returned pointer, before use it.
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit
> ---
>  board/samsung/common/board.c | 4 ++--
>  board/samsung/common/misc.c  | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH V2 10/11] Odroid-XU3: dts: enable ADC, with request for pre-reloc bind

2015-10-03 Thread Simon Glass
On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This ADC is required for Odroid's board revision detection.
> The pre-reloc request is enabled, since board detection will
> be done in one of early function call.
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit
> ---
>  arch/arm/dts/exynos5422-odroidxu3.dts | 5 +
>  1 file changed, 5 insertions(+)

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


Re: [U-Boot] [PATCH] net: Increase the size of the net_boot_file_name buffer

2015-10-03 Thread Otavio Salvador
On Sat, Oct 3, 2015 at 11:13 AM, Stefan Bruens
 wrote:
> On Thursday 01 October 2015 16:27:11 Wolfgang Denk wrote:
>> Dear Jacob,
>>
>> In message <1443622325-30792-1-git-send-email-j-stiff...@ti.com> you wrote:
>> > The net_boot_file_name buffer is used as storage for the bootfilename
>> > command line argument to network boot commands such as tftp and nfs.
>> >
>> > Increase the size of this buffer to 1024 bytes as the current size of
>> > 128 bytes is restrictive for arbitrary paths on the server.
>>
>> According to RFC 2131, the boot file name has a fixed size of 128
>> octets.
>
> You can also put the file name into Option 67, which results in a length limit
> of 255 octets (DHCP option length limit).
>
> I sent patches with several DHCP enhancements, including Option 67 support, to
> the ML a few weeks ago.

Has those patches been applied? otherwise it would be good to rebase
it and send them again as we are close of release and merge window
will soon open.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] nios2: convert altera timer to driver model

2015-10-03 Thread Thomas Chou
Convert altera timer to driver model.

Signed-off-by: Thomas Chou 
---
v2
  fix coding style.
v3
  doc dts binding.

 arch/nios2/cpu/Makefile |   2 +-
 arch/nios2/cpu/timer.c  |  65 --
 common/board_f.c|   3 +-
 configs/nios2-generic_defconfig |   2 +
 doc/device-tree-bindings/timer/altera_timer.txt |  19 
 drivers/timer/Kconfig   |   7 ++
 drivers/timer/Makefile  |   1 +
 drivers/timer/altera_timer.c| 110 
 include/configs/nios2-generic.h |   6 --
 9 files changed, 141 insertions(+), 74 deletions(-)
 delete mode 100644 arch/nios2/cpu/timer.c
 create mode 100644 doc/device-tree-bindings/timer/altera_timer.txt
 create mode 100644 drivers/timer/altera_timer.c

diff --git a/arch/nios2/cpu/Makefile b/arch/nios2/cpu/Makefile
index c85e261..3fe7847 100644
--- a/arch/nios2/cpu/Makefile
+++ b/arch/nios2/cpu/Makefile
@@ -7,5 +7,5 @@
 
 extra-y= start.o
 obj-y  = exceptions.o
-obj-y  += cpu.o interrupts.o sysid.o timer.o traps.o
+obj-y  += cpu.o interrupts.o sysid.o traps.o
 obj-y  += fdt.o
diff --git a/arch/nios2/cpu/timer.c b/arch/nios2/cpu/timer.c
deleted file mode 100644
index b8aa9dd..000
--- a/arch/nios2/cpu/timer.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- *
- * (C) Copyright 2004, Psyent Corporation 
- * Scott McNutt 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-
-struct nios_timer {
-   u32 status; /* Timer status reg */
-   u32 control;/* Timer control reg */
-   u32 periodl;/* Timeout period low */
-   u32 periodh;/* Timeout period high */
-   u32 snapl;  /* Snapshot low */
-   u32 snaph;  /* Snapshot high */
-};
-
-/* status register */
-#define NIOS_TIMER_TO  (1 << 0)/* Timeout */
-#define NIOS_TIMER_RUN (1 << 1)/* Timer running */
-
-/* control register */
-#define NIOS_TIMER_ITO (1 << 0)/* Timeout interrupt enable */
-#define NIOS_TIMER_CONT(1 << 1)/* Continuous mode */
-#define NIOS_TIMER_START   (1 << 2)/* Start timer */
-#define NIOS_TIMER_STOP(1 << 3)/* Stop timer */
-
-/*/
-unsigned long notrace timer_read_counter(void)
-{
-   struct nios_timer *tmr = (struct nios_timer *)CONFIG_SYS_TIMER_BASE;
-   u32 val;
-
-   /* Trigger update */
-   writel(0x0, >snapl);
-
-   /* Read timer value */
-   val = readl(>snapl) & 0x;
-   val |= (readl(>snaph) & 0x) << 16;
-
-   return ~val;
-}
-
-int timer_init(void)
-{
-   struct nios_timer *tmr = (struct nios_timer *)CONFIG_SYS_TIMER_BASE;
-
-   writel(0, >status);
-   writel(0, >control);
-   writel(NIOS_TIMER_STOP, >control);
-
-   writel(0x, >periodl);
-   writel(0x, >periodh);
-
-   writel(NIOS_TIMER_CONT | NIOS_TIMER_START, >control);
-
-   return 0;
-}
diff --git a/common/board_f.c b/common/board_f.c
index d0a9ff7..613332e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -795,8 +795,7 @@ static init_fnc_t init_sequence_f[] = {
init_timebase,
 #endif
 #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
-defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \
-defined(CONFIG_NIOS2)
+   defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
timer_init, /* initialize timer */
 #endif
 #ifdef CONFIG_SYS_ALLOC_DPRAM
diff --git a/configs/nios2-generic_defconfig b/configs/nios2-generic_defconfig
index 707ee33..dac0b62 100644
--- a/configs/nios2-generic_defconfig
+++ b/configs/nios2-generic_defconfig
@@ -18,3 +18,5 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ALTERA_PIO=y
 CONFIG_ALTERA_JTAG_UART=y
 CONFIG_ALTERA_JTAG_UART_BYPASS=y
+CONFIG_DM_TIMER=y
+CONFIG_ALTERA_TIMER=y
diff --git a/doc/device-tree-bindings/timer/altera_timer.txt 
b/doc/device-tree-bindings/timer/altera_timer.txt
new file mode 100644
index 000..904a584
--- /dev/null
+++ b/doc/device-tree-bindings/timer/altera_timer.txt
@@ -0,0 +1,19 @@
+Altera Timer
+
+Required properties:
+
+- compatible : should be "altr,timer-1.0"
+- reg : Specifies base physical address and size of the registers.
+- interrupt-parent: phandle of the interrupt controller
+- interrupts : Should contain the timer interrupt number
+- clock-frequency : The frequency of the clock that drives the counter, in Hz.
+
+Example:
+
+timer {
+   compatible = "altr,timer-1.0";
+   reg = <0x0040 0x0020>;
+   interrupt-parent = <>;
+   interrupts = <11>;
+   clock-frequency = <12500>;
+};
diff --git 

[U-Boot] [PATCH v3 1/2] dm: implement a Timer uclass

2015-10-03 Thread Thomas Chou
Implement a Timer uclass to work with lib/time.c.

Signed-off-by: Thomas Chou 
---
v2
  fix coding style.
v3
  add description to Kconfig as Simon suggested.
  move timer.c code to lib/time.c.
  add dm_timer dev to global data.
  remove timer_init().
  change API name get_clock.

 common/board_r.c  |  3 +++
 drivers/Kconfig   |  2 ++
 drivers/Makefile  |  1 +
 drivers/timer/Kconfig | 11 
 drivers/timer/Makefile|  7 +
 drivers/timer/timer-uclass.c  | 35 +
 include/asm-generic/global_data.h |  3 +++
 include/dm/uclass-id.h|  1 +
 include/timer.h   | 52 +
 lib/time.c| 54 +++
 10 files changed, 169 insertions(+)
 create mode 100644 drivers/timer/Kconfig
 create mode 100644 drivers/timer/Makefile
 create mode 100644 drivers/timer/timer-uclass.c
 create mode 100644 include/timer.h

diff --git a/common/board_r.c b/common/board_r.c
index f8c1baa..aaf390e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -290,6 +290,9 @@ static int initr_dm(void)
/* Save the pre-reloc driver model and start a new one */
gd->dm_root_f = gd->dm_root;
gd->dm_root = NULL;
+#ifdef CONFIG_DM_TIMER
+   gd->dm_timer = NULL;
+#endif
return dm_init_and_scan(false);
 }
 #endif
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 63c92c5..f9496f7 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -56,6 +56,8 @@ source "drivers/spi/Kconfig"
 
 source "drivers/thermal/Kconfig"
 
+source "drivers/timer/Kconfig"
+
 source "drivers/tpm/Kconfig"
 
 source "drivers/usb/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9d0a595..692da78 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -48,6 +48,7 @@ obj-y += pcmcia/
 obj-y += dfu/
 obj-y += rtc/
 obj-y += sound/
+obj-y += timer/
 obj-y += tpm/
 obj-y += twserial/
 obj-y += video/
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
new file mode 100644
index 000..5228e26
--- /dev/null
+++ b/drivers/timer/Kconfig
@@ -0,0 +1,11 @@
+menu "Timer Support"
+
+config DM_TIMER
+   bool "Enable Driver Model for Timer drivers"
+   depends on DM
+   help
+ Enable driver model for Timer access. It uses the same API as
+ lib/time.c. But now implemented by the uclass. The first timer
+ will be used.
+
+endmenu
diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
new file mode 100644
index 000..a24179a
--- /dev/null
+++ b/drivers/timer/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2015 Thomas Chou 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-$(CONFIG_DM_TIMER) += timer-uclass.o
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
new file mode 100644
index 000..8071fcc
--- /dev/null
+++ b/drivers/timer/timer-uclass.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 Thomas Chou 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int timer_get_count(struct udevice *dev, unsigned long *count)
+{
+   const struct dm_timer_ops *ops = device_get_ops(dev);
+
+   if (!ops->get_count)
+   return -ENOSYS;
+
+   return ops->get_count(dev, count);
+}
+
+int timer_get_clock(struct udevice *dev, unsigned long *freq)
+{
+   const struct dm_timer_ops *ops = device_get_ops(dev);
+
+   if (!ops->get_clock)
+   return -ENOSYS;
+
+   return ops->get_clock(dev, freq);
+}
+
+UCLASS_DRIVER(timer) = {
+   .id = UCLASS_TIMER,
+   .name   = "timer",
+};
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 2155265..ebecb5f 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -69,6 +69,9 @@ typedef struct global_data {
struct udevice  *dm_root_f; /* Pre-relocation root instance */
struct list_head uclass_root;   /* Head of core tree */
 #endif
+#ifdef CONFIG_DM_TIMER
+   struct udevice  *dm_timer;  /* Timer instance for Driver Model */
+#endif
 
const void *fdt_blob;   /* Our device tree, NULL if none */
void *new_fdt;  /* Relocated FDT */
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 1eeec74..aff34a4 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -56,6 +56,7 @@ enum uclass_id {
UCLASS_SPI_GENERIC, /* Generic SPI flash target */
UCLASS_SYSCON,  /* System configuration device */
UCLASS_THERMAL, /* Thermal sensor */
+   UCLASS_TIMER,   /* Timer device */
UCLASS_TPM, /* Trusted Platform Module TIS interface */
UCLASS_USB, /* USB bus */
UCLASS_USB_DEV_GENERIC, /* USB generic device */
diff --git 

Re: [U-Boot] Porting UBI fixes (specially fastmap's) to U-Boot

2015-10-03 Thread Richard Weinberger
Hi!

Am 03.10.2015 um 06:27 schrieb Heiko Schocher:
>>> According to Richard Weinberger, UBI fastmap is broken in U-Boot.
>>> There are plenty
>>> of fixes in Linux that we should pull in U-Boot to fix it.
> 
> Thanks for pointing!
> 
>> BTW: it is not broken in terms of you broke it.
> 
> Puuh ;-)
> 
> In what way is it broken? If we update to 4.1, will ubi work (mount
> an existing UBI partition with fastmap) on existing boards?

The on-flash layout did not change, so it should work.

The "old" fastmap code had a number of issues, mostly related to powercuts
and some logical issues.
In 4.1 it saw a huge amount of rework and fixes, including UBI core code.

>> It is just the old fastmap version. In v4.1 fastmap saw
>> a massive update. Sadly this changes are a way to big for the stable tree.
> 
> What do you mean with "for the stable tree" ?

I was under the assumption that you are porting all UBI fixes to u-boot which 
are marked for stable.
As the fastmap rework turned out to be much more than a few single fixes they 
are not
in the Linux stable tree.

>>> Maybe you are already aware of this and you have some work-in-progress
>>> patches to share?
>>> Otherwise, I might be able to spend some time working on this in the next 
>>> weeks.
>>
>> I'll happily help you!
> 
> I am next week in Dublin on the ELCE so I have no time to look into
> this issue ... maybe the week after ...

I'm also at ELCE, maybe we can discuss this also in person.

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


Re: [U-Boot] Please pull u-boot-sunxi master

2015-10-03 Thread Tom Rini
On Sat, Oct 03, 2015 at 02:01:53PM +0200, Hans de Goede wrote:

> Hi Tom,
> 
> Here is what is hopefully really the final sunxi pull-req for v2015.10.
> 
> This introduces just 1 new defconfig, we want this new defconfig in v2015.10
> since it is a generic defconfig for so called q8 formfactor sunxi tablets,
> and we want to replace all the PCB revision specific defconfigs with
> a few generic ones since there are just too many variants.
> 
> So we want to have generic configs for a13 / a23 / a33 based q8 tablets,
> current master already has them for a13 / a33, this commit makes the
> set complete, which allows us to start dropping the pcb revision specific
> ones in v2016.01.
> 
> The following changes since commit fbb0c7bd92255bfcb13826a8ac81be6e2f94ba48:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-tegra (2015-10-02 
> 20:35:49 -0400)
> 
> are available in the git repository at:
> 
>   http://git.denx.de/u-boot-sunxi.git master
> 
> for you to fetch changes up to 97fec7105c6d31f52026921e669ec78e1b7ca623:
> 
>   sunxi: Add generic defconfigs for A23 Q8 tablets with 800x480 LCD 
> (2015-10-03 12:08:04 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-sunxi master

2015-10-03 Thread Luc Verhaegen
On Sat, Oct 03, 2015 at 02:01:53PM +0200, Hans de Goede wrote:
>
> This introduces just 1 new defconfig, we want this new defconfig in v2015.10
> since it is a generic defconfig for so called q8 formfactor sunxi tablets,
> and we want to replace all the PCB revision specific defconfigs with
> a few generic ones since there are just too many variants.

Who is "We" in this sentence?

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


Re: [U-Boot] [PATCH V2 03/11] Peach-Pi: dts: add cpu-model string

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This platform is based on Exynos5800 but the cpu id is 0x5422.
> This doesn't fit the common Exynos SoC name convention, so now,
> the CPU name is defined by device tree string, to be printed
> properly.
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - move cpu name from config to dts
> ---
>  arch/arm/dts/exynos5800-peach-pi.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/dts/exynos5800-peach-pi.dts 
> b/arch/arm/dts/exynos5800-peach-pi.dts
> index 1d7ff23..76826dc 100644
> --- a/arch/arm/dts/exynos5800-peach-pi.dts
> +++ b/arch/arm/dts/exynos5800-peach-pi.dts
> @@ -12,6 +12,7 @@
>
>  / {
> model = "Samsung/Google Peach Pi board based on Exynos5800";
> +   cpu-model = "Exynos5800";
>
> compatible = "google,pit-rev#", "google,pit",
> "google,peach", "samsung,exynos5800", "samsung,exynos5";
> --
> 1.9.1
>

Is this defined by the standard binding? If not, can you add or change
the binding file?

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


Re: [U-Boot] [PATCH V2 06/11] dm: adc: add simple ADC uclass implementation

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This commit adds:
> - new uclass id: UCLASS_ADC
> - new uclass driver: drivers/adc/adc-uclass.c
>
> The uclass's implementation is as simple as needed and provides functions:
> - adc_init() - init ADC conversion
> - adc_data() - convert and return data
> - adc_data_mask() - return ADC data mask
> - adc_channel_single_shot() - function for single ADC convertion
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit - introduce ADC uclass driver
> ---
>  drivers/Kconfig  |  2 ++
>  drivers/Makefile |  1 +
>  drivers/adc/Kconfig  |  8 +
>  drivers/adc/Makefile |  8 +
>  drivers/adc/adc-uclass.c | 76 +
>  include/adc.h| 88 
> 
>  include/dm/uclass-id.h   |  1 +
>  7 files changed, 184 insertions(+)
>  create mode 100644 drivers/adc/Kconfig
>  create mode 100644 drivers/adc/Makefile
>  create mode 100644 drivers/adc/adc-uclass.c
>  create mode 100644 include/adc.h

Sorry I have quite a lot of questions and comments on this.

>
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 63c92c5..ad9ae3a 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -4,6 +4,8 @@ source "drivers/core/Kconfig"
>
>  # types of drivers sorted in alphabetical order
>
> +source "drivers/adc/Kconfig"
> +
>  source "drivers/block/Kconfig"
>
>  source "drivers/clk/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 9d0a595..d7d5e9f 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -35,6 +35,7 @@ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/
>
>  else
>
> +obj-y += adc/
>  obj-$(CONFIG_DM_DEMO) += demo/
>  obj-$(CONFIG_BIOSEMU) += bios_emulator/
>  obj-y += block/
> diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
> new file mode 100644
> index 000..1cb1a8d
> --- /dev/null
> +++ b/drivers/adc/Kconfig
> @@ -0,0 +1,8 @@
> +config ADC
> +   bool "Enable ADC drivers using Driver Model"
> +   help
> + This allows drivers to be provided for ADCs to drive their features,
> + trough simple ADC uclass driver interface, with operations:

through a simple

> + - device enable
> + - conversion init
> + - conversion start and return data with data mask
> diff --git a/drivers/adc/Makefile b/drivers/adc/Makefile
> new file mode 100644
> index 000..c4d9618
> --- /dev/null
> +++ b/drivers/adc/Makefile
> @@ -0,0 +1,8 @@
> +#
> +# Copyright (C) 2015 Samsung Electronics
> +# Przemyslaw Marczak 
> +#
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +
> +obj-$(CONFIG_ADC) += adc-uclass.o
> diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c
> new file mode 100644
> index 000..bb71b6e
> --- /dev/null
> +++ b/drivers/adc/adc-uclass.c
> @@ -0,0 +1,76 @@
> +/*
> + * Copyright (C) 2015 Samsung Electronics
> + * Przemyslaw Marczak 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define ADC_UCLASS_PLATDATA_SIZE   sizeof(struct adc_uclass_platdata)

Can we drop #define?

> +
> +int adc_init(struct udevice *dev, int channel)
> +{
> +   const struct adc_ops *ops = dev_get_driver_ops(dev);
> +
> +   if (ops->adc_init)
> +   return ops->adc_init(dev, channel);
> +
> +   return -ENOSYS;

Let's turn each of these around so that errors are the exception, not
the normal path.

if (!ops->adc_init)
   return -ENOSYS;

return ops->...

> +}
> +
> +int adc_data(struct udevice *dev, unsigned int *data)
> +{
> +   const struct adc_ops *ops = dev_get_driver_ops(dev);
> +
> +   *data = 0;
> +
> +   if (ops->adc_data)
> +   return ops->adc_data(dev, data);
> +
> +   return -ENOSYS;
> +}
> +
> +int adc_data_mask(struct udevice *dev)
> +{
> +   struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
> +
> +   if (uc_pdata)
> +   return uc_pdata->data_mask;
> +
> +   return -ENOSYS;
> +}
> +
> +int adc_channel_single_shot(const char *name, int channel, unsigned int 
> *data)
> +{
> +   struct udevice *dev;
> +   int ret;
> +
> +   *data = 0;

I don't think we need this assignment. This can be undefined if an
error is returned.

> +
> +   ret = uclass_get_device_by_name(UCLASS_ADC, name, );
> +   if (ret)
> +   return ret;
> +
> +   ret = adc_init(dev, channel);
> +   if (ret)
> +   return ret;
> +
> +   ret = adc_data(dev, data);
> +   if (ret)
> +   return ret;
> +
> +   return 0;
> +}
> +
> +UCLASS_DRIVER(adc) = {
> +   .id = UCLASS_ADC,
> +   .name   = "adc",
> +   .per_device_platdata_auto_alloc_size = ADC_UCLASS_PLATDATA_SIZE,
> +};
> diff --git a/include/adc.h 

Re: [U-Boot] [PATCH V2 05/11] dm: pmic: add s2mps11 PMIC I/O driver

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This driver allows I/O operations on the Samsung S2MPS11 PMIC,
> which provides lots of LDO/BUCK outputs.
>
> To enable it, update defconfig with:
> - CONFIG_PMIC_S2MPS11
> and additional, if were not defined:
> - CONFIG_CMD_PMIC
> - CONFIG_ERRNO_STR
>
> The binding info: doc/device-tree-bindings/pmic/s2mps11.txt
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - remove "DM" prefix from config name
> - fix word mistake in binding description
> ---
>  doc/device-tree-bindings/pmic/s2mps11.txt |  17 +
>  drivers/power/pmic/Kconfig|  14 
>  drivers/power/pmic/Makefile   |   1 +
>  drivers/power/pmic/s2mps11.c  |  60 
>  include/power/s2mps11.h   | 109 
> ++
>  5 files changed, 201 insertions(+)
>  create mode 100644 doc/device-tree-bindings/pmic/s2mps11.txt
>  create mode 100644 drivers/power/pmic/s2mps11.c
>  create mode 100644 include/power/s2mps11.h

Reviewed-by: Simon Glass 

But please see nit below.

>
> diff --git a/doc/device-tree-bindings/pmic/s2mps11.txt 
> b/doc/device-tree-bindings/pmic/s2mps11.txt
> new file mode 100644
> index 000..422f14f
> --- /dev/null
> +++ b/doc/device-tree-bindings/pmic/s2mps11.txt
> @@ -0,0 +1,17 @@
> +SAMSUNG, S2MPS11 PMIC
> +
> +This file describes the binding info for the PMIC driver:
> +- drivers/power/pmic/s2mps11.c
> +
> +Required properties:
> +- compatible: "samsung,s2mps11-pmic"
> +- reg = 0x66
> +
> +With those two properties, the pmic device can be used for read/write only.
> +
> +Example:
> +
> +s2mps11@66 {
> +   compatible = "samsung,s2mps11-pmic";
> +   reg = <0x66>;
> +};
> diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
> index 547fd1a..fb29843 100644
> --- a/drivers/power/pmic/Kconfig
> +++ b/drivers/power/pmic/Kconfig
> @@ -33,6 +33,20 @@ config DM_PMIC_MAX77686
> This config enables implementation of driver-model pmic uclass 
> features
> for PMIC MAX77686. The driver implements read/write operations.
>
> +config PMIC_S2MPS11
> +   bool "Enable Driver Model for PMIC Samsung S2MPS11"
> +   depends on DM_PMIC
> +   ---help---
> +   The Samsung S2MPS11 PMIC provides:
> +- 38 adjustable LDO regulators
> +- 9 High-Efficiency Buck Converters
> +- 1 BuckBoost Converter
> +- RTC with two alarms
> +- Backup battery charger
> +- I2C Configuration Interface
> +   This driver provides access to I/O interface only.
> +   Binding info: doc/device-tree-bindings/pmic/s2mps11.txt
> +
>  config DM_PMIC_SANDBOX
> bool "Enable Driver Model for emulated Sandbox PMIC "
> depends on DM_PMIC
> diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
> index 00fde71..91e78f8 100644
> --- a/drivers/power/pmic/Makefile
> +++ b/drivers/power/pmic/Makefile
> @@ -8,6 +8,7 @@
>  obj-$(CONFIG_DM_PMIC) += pmic-uclass.o
>  obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
>  obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze100.o
> +obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
>  obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o
>  obj-$(CONFIG_PMIC_ACT8846) += act8846.o
>  obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
> diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c
> new file mode 100644
> index 000..7e28402
> --- /dev/null
> +++ b/drivers/power/pmic/s2mps11.c
> @@ -0,0 +1,60 @@
> +/*
> + *  Copyright (C) 2015 Samsung Electronics
> + *  Przemyslaw Marczak  
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static int s2mps11_reg_count(struct udevice *dev)
> +{
> +   return S2MPS11_REG_COUNT;
> +}
> +
> +static int s2mps11_write(struct udevice *dev, uint reg, const uint8_t *buff,
> +int len)
> +{
> +   if (dm_i2c_write(dev, reg, buff, len)) {
> +   error("write error to device: %p register: %#x!", dev, reg);
> +   return -EIO;

Should return the value of dm_i2c_write(). Also below.

> +   }
> +
> +   return 0;
> +}
> +
> +static int s2mps11_read(struct udevice *dev, uint reg, uint8_t *buff, int 
> len)
> +{
> +   if (dm_i2c_read(dev, reg, buff, len)) {
> +   error("read error from device: %p register: %#x!", dev, reg);
> +   return -EIO;
> +   }
> +
> +   return 0;
> +}
> +
> +static struct dm_pmic_ops s2mps11_ops = {
> +   .reg_count = s2mps11_reg_count,
> +   .read = s2mps11_read,
> +   .write = s2mps11_write,
> +};
> +
> +static const struct udevice_id s2mps11_ids[] = {
> +   { .compatible = "samsung,s2mps11-pmic" },
> +   { }
> +};
> +
> +U_BOOT_DRIVER(pmic_s2mps11) = {
> +   

Re: [U-Boot] [PATCH] spi: ignore set speed and mode if not available

2015-10-03 Thread Simon Glass
Hi Thomas,

On 22 September 2015 at 08:41, Thomas Chou  wrote:
> Some cores, such as Altera SPI and QuadSPI, can not change
> speed and mode at runtime. Ignore the operation which is
> not available.
>
> Signed-off-by: Thomas Chou 
> ---
>  drivers/spi/spi-uclass.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)

This looks OK, but can you please update the method documentation for
set_speed() and set_mode() to indicate that they are optional in the
case where the hardware does not support it.

>
> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
> index d666272..5298073 100644
> --- a/drivers/spi/spi-uclass.c
> +++ b/drivers/spi/spi-uclass.c
> @@ -21,13 +21,11 @@ DECLARE_GLOBAL_DATA_PTR;
>  static int spi_set_speed_mode(struct udevice *bus, int speed, int mode)

Please add a comment to this function indicated that missing
set_speed() and set_mode() methods are OK.

>  {
> struct dm_spi_ops *ops;
> -   int ret;
> +   int ret = 0;
>
> ops = spi_get_ops(bus);
> if (ops->set_speed)
> ret = ops->set_speed(bus, speed);
> -   else
> -   ret = -EINVAL;
> if (ret) {
> printf("Cannot set speed (err=%d)\n", ret);
> return ret;
> @@ -35,8 +33,6 @@ static int spi_set_speed_mode(struct udevice *bus, int 
> speed, int mode)
>
> if (ops->set_mode)
> ret = ops->set_mode(bus, mode);
> -   else
> -   ret = -EINVAL;
> if (ret) {
> printf("Cannot set mode (err=%d)\n", ret);
> return ret;
> --
> 2.1.4
>

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


Re: [U-Boot] [PATCH V2 08/11] Odroid-XU3: enable s2mps11 PMIC support

2015-10-03 Thread Simon Glass
On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - none
> ---
>  arch/arm/dts/exynos5422-odroidxu3.dts | 7 +++
>  configs/odroid-xu3_defconfig  | 3 +++
>  2 files changed, 10 insertions(+)

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


Re: [U-Boot] [PATCH V2 09/11] Exynos54xx: dts: add ADC node

2015-10-03 Thread Simon Glass
On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This commit adds common ADC node, which is disabled as default.
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit
> ---
>  arch/arm/dts/exynos54xx.dtsi | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm/dts/exynos54xx.dtsi b/arch/arm/dts/exynos54xx.dtsi
> index bd3619d..daa6a33 100644
> --- a/arch/arm/dts/exynos54xx.dtsi
> +++ b/arch/arm/dts/exynos54xx.dtsi
> @@ -42,6 +42,13 @@
> xhci1 = "/xhci@1240";
> };

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


Re: [U-Boot] [PATCH V2 07/11] dm: adc: add Exynos54xx compatible ADC driver

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This commit adds driver for Exynos54xx ADC subsystem.
>
> The driver is implemented using driver model,
> amd provides ADC uclass's operations:
> - adc_init()
> - adc_data()
>
> This driver uses sdelay() function on pooling, so it can
> be used before the delay timer is inited.
> The basic parameters of ADC conversion, are:
> - sample rate: 600KSPS
> - output the data as average of 8 time conversion
>
> ADC features:
> - sample rate: 600KSPS
> - resolution: 12-bit
> - channels: 10 (analog multiplexer)
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - new commit - move previous adc driver from SoC directory to drivers/adc
> ---
>  arch/arm/mach-exynos/include/mach/adc.h |  45 ++
>  drivers/adc/Kconfig |   9 +++
>  drivers/adc/Makefile|   1 +
>  drivers/adc/exynos-adc.c| 102 
> 
>  4 files changed, 157 insertions(+)
>  create mode 100644 drivers/adc/exynos-adc.c
>
> diff --git a/arch/arm/mach-exynos/include/mach/adc.h 
> b/arch/arm/mach-exynos/include/mach/adc.h
> index a0e26d7..228acf4 100644
> --- a/arch/arm/mach-exynos/include/mach/adc.h
> +++ b/arch/arm/mach-exynos/include/mach/adc.h
> @@ -9,6 +9,38 @@
>  #ifndef __ASM_ARM_ARCH_ADC_H_
>  #define __ASM_ARM_ARCH_ADC_H_
>
> +#define ADC_V2_CON1_SOFT_RESET (0x2 << 1)
> +#define ADC_V2_CON1_STC_EN (0x1)

No need for brackets on these simple ones

> +
> +#define ADC_V2_CON2_OSEL(x)(((x) & 0x1) << 10)
> +#define OSEL_2S(0x0)
> +#define OSEL_BINARY(0x1)
> +#define ADC_V2_CON2_ESEL(x)(((x) & 0x1) << 9)
> +#define ESEL_ADC_EVAL_TIME_40CLK   (0x0)
> +#define ESEL_ADC_EVAL_TIME_20CLK   (0x1)
> +#define ADC_V2_CON2_HIGHF(x)   (((x) & 0x1) << 8)
> +#define HIGHF_CONV_RATE_30KSPS (0x0)
> +#define HIGHF_CONV_RATE_600KSPS(0x1)
> +#define ADC_V2_CON2_C_TIME(x)  (((x) & 0x7) << 4)
> +#define ADC_V2_CON2_CHAN_SEL(x)((x) & 0xf)
> +
> +#define ADC_V2_GET_STATUS_FLAG(x)  (((x) >> 2) & 0x1)
> +#define FLAG_CONV_END  (0x1)
> +
> +#define ADC_V2_INT_DISABLE (0x0)
> +#define ADC_V2_INT_ENABLE  (0x1)
> +#define INT_NOT_GENERATED  (0x0)
> +#define INT_GENERATED  (0x1)
> +
> +#define ADC_V2_VERSION (0x8008)
> +
> +#define ADC_V2_MAX_CHANNEL (9)
> +
> +/* For default 8 time convertion with sample rate 600 kSPS - 15us timeout */
> +#define ADC_V2_CONV_TIMEOUT_US (15)
> +
> +#define ADC_V2_DAT_MASK(0xfff)
> +
>  #ifndef __ASSEMBLY__
>  struct s5p_adc {
> unsigned int adccon;
> @@ -21,6 +53,19 @@ struct s5p_adc {
> unsigned int adcmux;
> unsigned int adcclrintpndnup;
>  };
> +
> +struct exynos_adc_v2 {
> +   unsigned int con1;
> +   unsigned int con2;
> +   unsigned int status;
> +   unsigned int dat;
> +   unsigned int int_en;
> +   unsigned int int_status;
> +   unsigned int reserved[2];
> +   unsigned int version;
> +};
> +
> +int exynos_adc_read_channel(int channel);
>  #endif
>
>  #endif /* __ASM_ARM_ARCH_ADC_H_ */
> diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
> index 1cb1a8d..8ee6531 100644
> --- a/drivers/adc/Kconfig
> +++ b/drivers/adc/Kconfig
> @@ -6,3 +6,12 @@ config ADC
>   - device enable
>   - conversion init
>   - conversion start and return data with data mask
> +
> +config ADC_EXYNOS
> +   bool "Enable Exynos 54xx ADC driver"
> +   help
> + This enables basic driver for Exynos ADC compatible with Exynos54xx.
> + It provides:
> + - 10 analog input channels
> + - 12-bit resolution
> + - 600 KSPS of sample rate

Great help!

> diff --git a/drivers/adc/Makefile b/drivers/adc/Makefile
> index c4d9618..eb85b8b 100644
> --- a/drivers/adc/Makefile
> +++ b/drivers/adc/Makefile
> @@ -6,3 +6,4 @@
>  #
>
>  obj-$(CONFIG_ADC) += adc-uclass.o
> +obj-$(CONFIG_ADC_EXYNOS) += exynos-adc.o
> diff --git a/drivers/adc/exynos-adc.c b/drivers/adc/exynos-adc.c
> new file mode 100644
> index 000..fdffea0
> --- /dev/null
> +++ b/drivers/adc/exynos-adc.c
> @@ -0,0 +1,102 @@
> +/*
> + * Copyright (C) 2015 Samsung Electronics
> + * Przemyslaw Marczak 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct exynos_adc_priv {
> +   struct exynos_adc_v2 *regs;
> +};
> +
> +extern void sdelay(unsigned long loops);

Can you put this include system.h for exynos, or similar? Also, I
think the problem is that timer_init() is called after initf_dm().
There is a patch to add timer support to driver model so perhaps that
will help?

> +
> +int 

Re: [U-Boot] [PATCH V2 11/11] exynos5-dt-types: add board detection for Odroid XU3/XU3L/XU4.

2015-10-03 Thread Simon Glass
Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:
> This commit adds additional file with implementation of board
> detection code for Odroid-XU3/XU4.
>
> The detection depends on compatible found in fdt:
> - "samsung,exynos5" - uses Exynos5 generic code
> - "samsung,odroidxu3" - try detect XU3 revision
>
> There are few revisions of Odroid XU3/XU4, each can be detected
> by checking the value of channel 9 of built-in ADC:
>  Rev   ADC  Board
>  0.1 0  XU3 0.1
>  0.2   372  XU3 0.2 | XU3L - no DISPLAYPORT
>  0.3  1280  XU4 0.1
>
> The detection code depends on the ADC+10% value.
>
> Implementation of functions:
> - set_board_type() - read ADC and set type
> - get_board_rev()  - returns board revision: 1..3
> - get_board_type() - returns board type string
>
> Additional functions with return values of bool:
> - board_is_generic()   - true if found compatible "samsung,exynos5"
>  but not "samsung,odroidxu3"
> - board_is_odroidxu3() - true if found compatible "samsung,odroidxu3"
>  and one of XU3 revision.
> - board_is_odroidxu4() - true if found compatible "samsung,odroidxu3"
>  and XU4 revision.
>
> After I2C controller init, the get_board_type() can check
> if the XU3 board is a "Lite" variant, by probing chip
> 0x40 on I2C0 (INA231 - exists only on non-lite).
> This is useful for setting fdt file name at misc_init_r().
>
> Enabled configs:
> - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> - CONFIG_ODROID_REV_AIN
> - CONFIG_REVISION_TAG
> - CONFIG_BOARD_TYPES
>
> Signed-off-by: Przemyslaw Marczak 
> ---
> Changes V2:
> - move detection code from exynos5-dt.c to exynos5-dt-types.c
> - add header with board type function declarations
> - check for compatible before do the detection
> - update the ADC max values with 20% tolerance
> - fix XU4 adc value, related to mistake from table in XU4 schematic
> - return "Not supported" for XU4 when calls one of:
>   --dfu_get_alt_boot()
>   --dfu_get_alt_system()
> - extend ${dfu_alt_system} by strings:
>   -- 'exynos5422-odroidxu3-lite.dtb'
>   -- 'exynos5422-odroidxu4.dtb' - allows prepare card on XU3
> ---
>  board/samsung/common/Makefile   |   5 +-
>  board/samsung/common/exynos5-dt-types.c | 196 
> 
>  board/samsung/common/exynos5-dt.c   |  12 ++
>  configs/odroid-xu3_defconfig|   2 +
>  include/configs/odroid_xu3.h|  12 ++
>  include/samsung/exynos5-dt-types.h  |  27 +
>  6 files changed, 253 insertions(+), 1 deletion(-)
>  create mode 100644 board/samsung/common/exynos5-dt-types.c
>  create mode 100644 include/samsung/exynos5-dt-types.h

Reviewed-by: Simon Glass 

See nits below.

>
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 6cbd906..ef1a8f3 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -11,5 +11,8 @@ obj-$(CONFIG_MISC_COMMON) += misc.o
>
>  ifndef CONFIG_SPL_BUILD
>  obj-$(CONFIG_BOARD_COMMON) += board.o
> -obj-$(CONFIG_EXYNOS5_DT)   += exynos5-dt.o
> +ifdef CONFIG_EXYNOS5_DT
> +obj-y += exynos5-dt.o
> +obj-$(CONFIG_BOARD_TYPES) += exynos5-dt-types.o
> +endif
>  endif
> diff --git a/board/samsung/common/exynos5-dt-types.c 
> b/board/samsung/common/exynos5-dt-types.c
> new file mode 100644
> index 000..1364e98
> --- /dev/null
> +++ b/board/samsung/common/exynos5-dt-types.c
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (C) 2015 Samsung Electronics
> + * Przemyslaw Marczak 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static const struct udevice_id board_ids[] = {
> +   { .compatible = "samsung,odroidxu3", .data = EXYNOS5_BOARD_ODROID_XU3 
> },
> +   { .compatible = "samsung,exynos5", .data = EXYNOS5_BOARD_GENERIC },
> +   { },
> +};
> +
> +/**
> + * Odroix XU3/4 board revisions:
> + * Rev   ADCmax  Board
> + * 0.1 0 XU3 0.1
> + * 0.2   410 XU3 0.2 | XU3L - no DISPLAYPORT (probe I2C0:0x40 / INA231)
> + * 0.3  1408 XU4 0.1
> + * Use +10 % for ADC value tolerance.
> + */
> +struct odroid_rev_info odroid_info[] = {
> +   { EXYNOS5_BOARD_ODROID_XU3_REV01, 1, 10, "xu3" },
> +   { EXYNOS5_BOARD_ODROID_XU3_REV02, 2, 410, "xu3" },
> +   { EXYNOS5_BOARD_ODROID_XU4_REV01, 1, 1408, "xu4" },
> +   { EXYNOS5_BOARD_ODROID_UNKNOWN, 0, 4095, "unknown" },
> +};
> +
> +static unsigned int odroid_get_rev(void)
> +{
> +   int i;
> +
> +   for (i = 0; i < ARRAY_SIZE(odroid_info); i++) {
> +   if (odroid_info[i].board_type == gd->board_type)
> +   return odroid_info[i].board_rev;
> +   }
> +
> +   return 0;
> +}
> +
> +static int odroid_get_board_type(void)
> 

Re: [U-Boot] [PATCH v2 1/2] malloc_simple: Add Kconfig option for using only malloc_simple in the SPL

2015-10-03 Thread Simon Glass
On 22 September 2015 at 11:25, Hans de Goede  wrote:
> common/dlmalloc.c is quite big, both in .text and .data usage, therefor
> on some boards the SPL is build to use only malloc_simple.c and not the
> dlmalloc.c code. This is done in various include/configs/foo.h with the
> following construct:
>
>  #ifdef CONFIG_SPL_BUILD
>  #define CONFIG_SYS_MALLOC_SIMPLE
>  #endif
>
> This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows
> selecting this functionality through Kconfig instead.
>
> Signed-off-by: Hans de Goede 
> ---
> Changes in v2:
> -Fix commit message wrt quoting lines starting with a #
> -Rename Kconfig option from SPL_MALLOC_SIMPLE to SPL_SYS_MALLOC_SIMPLE
> -Simplify the ifdef checks to #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
> ---
>  Kconfig| 10 ++
>  common/malloc_simple.c |  2 +-
>  include/_exports.h |  2 +-
>  include/exports.h  |  2 +-
>  include/malloc.h   |  2 +-
>  5 files changed, 14 insertions(+), 4 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 2/2] sunxi: Remove board defconfig-s for specific Q8 tablet PCB-s

2015-10-03 Thread Ian Campbell
On Sat, 2015-10-03 at 10:27 +0200, Hans de Goede wrote:
> > Sounds reasonable. both patches in this series:
> > Acked-by: Ian Campbell 
> 
> Thanks, I've taken the liberty of using your hellion email address for this
> instead.

Right, finger macros, sorry ;-)


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


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

2015-10-03 Thread Simon Glass
Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass 
---

 drivers/tpm/Kconfig  | 15 +++
 drivers/tpm/Makefile |  2 +-
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index 3ab652c..31b35f7 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -4,15 +4,6 @@
 
 menu "TPM support"
 
-config DM_TPM
-   bool "Enable driver model for Trusted Platform Module drivers"
-   depends on DM && TPM
-   help
-  Enable driver model for TPMs. The TIS interface (tis_open(),
- tis_sendrecv(), etc.) is then implemented by the TPM uclass. Note
- that even with driver model only a single TPM is currently
- supported, since the tpm library assumes this.
-
 config TPM_TIS_SANDBOX
bool "Enable sandbox TPM driver"
depends on SANDBOX
@@ -24,7 +15,7 @@ config TPM_TIS_SANDBOX
 
 config TPM_ATMEL_TWI
bool "Enable Atmel TWI TPM device driver"
-   depends on DM_TPM && DM_I2C
+   depends on TPM && DM_I2C
help
  This driver supports an Atmel TPM device connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
@@ -33,7 +24,7 @@ config TPM_ATMEL_TWI
 
 config TPM_TIS_INFINEON
bool "Enable support for Infineon SLB9635/45 TPMs on I2C"
-   depends on DM_TPM && DM_I2C
+   depends on TPM && DM_I2C
help
  This driver supports Infineon TPM devices connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
@@ -57,7 +48,7 @@ config TPM_TIS_I2C_BURST_LIMITATION_LEN
 
 config TPM_TIS_LPC
bool "Enable support for Infineon SLB9635/45 TPMs on LPC"
-   depends on DM_TPM && X86
+   depends on TPM && X86
help
  This driver supports Infineon TPM devices connected on the I2C bus.
  The usual tpm operations and the 'tpm' command can be used to talk
diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile
index 5748145..1d49e95 100644
--- a/drivers/tpm/Makefile
+++ b/drivers/tpm/Makefile
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-$(CONFIG_DM_TPM) += tpm-uclass.o
+obj-$(CONFIG_TPM) += tpm-uclass.o
 
 obj-$(CONFIG_TPM_ATMEL_TWI) += tpm_atmel_twi.o
 obj-$(CONFIG_TPM_TIS_INFINEON) += tpm_tis_infineon.o
-- 
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 v4] nios2 : convert altera_pio to driver model

2015-10-03 Thread Thomas Chou



On 09/30/2015 09:37 PM, Thomas Chou wrote:

Convert altera_pio to driver model.

Signed-off-by: Thomas Chou 
Acked-by: Chin Liang See 
---
v2
   fix ranges of pio in dts
   fix coding style as Marek suggested.
v3
   change gpio_count device tree binding.
v4
   change gpio width default to 32.
   doc dts binding.



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 04/10] net: designware: Export various functions/struct to allow subclassing

2015-10-03 Thread Simon Glass
On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> To allow other DM drivers to subclass the designware driver various
> functions and structures need to be exported. Export these.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  drivers/net/designware.c | 6 +++---
>  drivers/net/designware.h | 4 
>  2 files changed, 7 insertions(+), 3 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 05/10] net: designware: Add a post-started hook

2015-10-03 Thread Simon Glass
Hi Sjoerd,

On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Add the ability for e.g. drivers subclassing to register a function to
> be called after ethernet initialisation. This is useful if e.g. the
> driver needs to change configuration based on the negotiated speed.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  drivers/net/designware.c | 11 ++-
>  drivers/net/designware.h |  4 
>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 0b7adc9..da27041 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -564,8 +564,17 @@ int designware_initialize(ulong base_addr, u32 interface)
>  static int designware_eth_start(struct udevice *dev)
>  {
> struct eth_pdata *pdata = dev_get_platdata(dev);
> +   struct dw_eth_dev *priv = dev_get_priv(dev);
> +   int ret;
>
> -   return _dw_eth_init(dev->priv, pdata->enetaddr);
> +   ret = _dw_eth_init(priv, pdata->enetaddr);
> +   if (ret)
> +   return ret;
> +
> +   if (priv->started)
> +   ret = priv->started(dev);
> +
> +   return ret;
>  }
>
>  static int designware_eth_send(struct udevice *dev, void *packet, int length)
> diff --git a/drivers/net/designware.h b/drivers/net/designware.h
> index 47e727b..b45599b 100644
> --- a/drivers/net/designware.h
> +++ b/drivers/net/designware.h
> @@ -236,6 +236,10 @@ struct dw_eth_dev {
>  #endif
> struct phy_device *phydev;
> struct mii_dev *bus;
> +
> +#ifdef CONFIG_DM_ETH
> +   int (*started)(struct udevice *dev);
> +#endif

With driver model we should not need to add such hooks. is this needed
because we don't have a PHY uclass yet?

>  };
>
>  #ifdef CONFIG_DM_ETH
> --
> 2.5.3
>

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


Re: [U-Boot] [PATCH 06/10] net: gmac_rk3288: Add RK3288 GMAC driver

2015-10-03 Thread Simon Glass
Hi Sjoerd,

On 1 October 2015 at 10:48, Sjoerd Simons  wrote:
> Add a new driver for the GMAC ethernet interface present in Rockchip
> RK3288 SOCs. This driver subclasses the generic design-ware driver to
> add the glue needed specifically for Rockchip.
>
> Signed-off-by: Sjoerd Simons 
> ---
>
>  drivers/net/Kconfig   |   7 +++
>  drivers/net/Makefile  |   1 +
>  drivers/net/gmac_rk3288.c | 140 
> ++
>  3 files changed, 148 insertions(+)
>  create mode 100644 drivers/net/gmac_rk3288.c

Apart from Bin's nits:

Acked-by: Simon Glass 

>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index bbec6a6..312c660 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -92,4 +92,11 @@ config PCH_GBE
>   This MAC is present in Intel Platform Controller Hub EG20T. It
>   supports 10/100/1000 Mbps operation.
>
> +config GMAC_RK3288
> +   bool "Rockchip RK3288 Synopsys Designware Ethernet MAC"
> +   depends on DM_ETH && ETH_DESIGNWARE
> +   help
> + This driver provides Rockchip RK3288 network support based on the
> + Synopsys Designware driver.
> +
>  endif # NETDEVICES
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 150470c..f0a3992 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -32,6 +32,7 @@ obj-$(CONFIG_FTGMAC100) += ftgmac100.o
>  obj-$(CONFIG_FTMAC110) += ftmac110.o
>  obj-$(CONFIG_FTMAC100) += ftmac100.o
>  obj-$(CONFIG_GRETH) += greth.o
> +obj-$(CONFIG_GMAC_RK3288) += gmac_rk3288.o
>  obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o
>  obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o
>  obj-$(CONFIG_LAN91C96) += lan91c96.o
> diff --git a/drivers/net/gmac_rk3288.c b/drivers/net/gmac_rk3288.c
> new file mode 100644
> index 000..6e92c8e
> --- /dev/null
> +++ b/drivers/net/gmac_rk3288.c
> @@ -0,0 +1,140 @@
> +/*
> + * (C) Copyright 2015 Sjoerd Simons 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +/*
> + * Rockchip GMAC ethernet IP driver for U-Boot
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "designware.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +struct gmac_rk3288_platdata {
> +   struct dw_eth_pdata dw_eth_pdata;
> +   int tx_delay;
> +   int rx_delay;
> +};
> +
> +static int gmac_rk3288_ofdata_to_platdata(struct udevice *dev)
> +{
> +   struct gmac_rk3288_platdata *pdata = dev_get_platdata(dev);
> +
> +   pdata->tx_delay = fdtdec_get_int (gd->fdt_blob, dev->of_offset,
> +   "tx_delay", 0x30);
> +   pdata->rx_delay = fdtdec_get_int (gd->fdt_blob, dev->of_offset,
> +   "rx_delay", 0x10);
> +
> +   return designware_eth_ofdata_to_platdata(dev);
> +}
> +
> +static int gmac_rk3288_started(struct udevice *dev)
> +{
> +   struct rk3288_grf *grf;
> +   struct dw_eth_dev *priv = dev_get_priv(dev);
> +   int clk;
> +
> +   switch (priv->phydev->speed) {
> +   case 10:
> +   clk = GMAC_CLK_SEL_2_5M;
> +   break;
> +   case 100:
> +   clk = GMAC_CLK_SEL_25M;
> +   break;
> +   case 1000:
> +   clk = GMAC_CLK_SEL_125M;
> +   break;
> +   default:
> +   printf("Unknown phy speed: %d\n", priv->phydev->speed);
> +   return -EINVAL;
> +   }
> +
> +   grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> +
> +   rk_clrsetreg(>soc_con1,
> +GMAC_CLK_SEL_MASK << GMAC_CLK_SEL_SHIFT,
> +clk << GMAC_CLK_SEL_SHIFT);
> +
> +   return 0;
> +}
> +
> +static int gmac_rk3288_probe(struct udevice *dev)
> +{
> +   int ret;
> +   struct gmac_rk3288_platdata *pdata = dev_get_platdata(dev);
> +   struct dw_eth_dev *priv = dev_get_priv(dev);
> +   enum periph_id periph_id;
> +   struct udevice *pinctrl, *clk;
> +   struct rk3288_grf *grf;
> +
> +   ret = uclass_get_device(UCLASS_PINCTRL, 0, );
> +   if (ret)
> +   return ret;
> +
> +   ret  = pinctrl_get_periph_id(pinctrl, dev);
> +   if (ret < 0)
> +   return ret;
> +
> +   periph_id = ret;
> +   ret = pinctrl_request(pinctrl, periph_id, 0);
> +   if (ret)
> +   return ret;
> +
> +   ret = uclass_get_device(UCLASS_CLK, CLK_GENERAL, );
> +   if (ret)
> +   return ret;
> +
> +   ret = clk_set_periph_rate(clk, periph_id, 0);
> +   if (ret)
> +   return ret;
> +
> +   /* Set to RGMII mode */
> +   grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> +   rk_clrsetreg(>soc_con1,
> +RMII_MODE_MASK << RMII_MODE_SHIFT |
> +GMAC_PHY_INTF_SEL_MASK << GMAC_PHY_INTF_SEL_SHIFT,
> +

Re: [U-Boot] How do I tell buildman to use a /specific/ toolchain?

2015-10-03 Thread Simon Glass
Hi Stephen,

On 2 October 2015 at 00:27, Stephen Warren  wrote:
> On 10/01/2015 04:59 PM, Simon Glass wrote:
>>
>> Hi Stephen,
>>
>> On Wednesday, 23 September 2015, Stephen Warren 
>> wrote:
>>>
>>>
>>> Simon,
>>>
>>> I have 3 different ARM toolchains installed into /usr/bin via distro
>>> packages. How do I tell buildman which of those to use?
>>>
>>> I had originally thought that ~/.buildman's [toolchain] section contained
>>> CROSS_COMPILE-like values, so I tried:
>>>
 [toolchain]
 root: /
 arm0-not-installed: arm-none-gnueabi-
 arm1: arm-none-eabi-
 arm2: arm-linux-gnueabihf-
 arm3: arm-linux-gnueabi-
 arch64: aarch64-linux-gnu-

 [toolchain-alias]
 arm: arm1
 aarch64: aarch64
>>>
>>>
>>>
>>> (I intended to change the "arm: arm1" line to point at arm1/2/3 based on
>>> which I wanted to use at a particular time).
>>>
>>> However, running "buildman --list-toolchains" and re-reading the docs
>>> shows me that the [toolchain] values are absolute directories that buildman
>>> searches for files named *-gcc:
>>>
 - scanning path 'arm-none-gnueabi-'
- looking in 'arm-none-gnueabi-/.'
- looking in 'arm-none-gnueabi-/bin'
- looking in 'arm-none-gnueabi-/usr/bin'
>>>
>>>
>>>
>>> If buildman finds multiple toolchains, there doesn't seem to be a way to
>>> tell it which one to use. Am I missing something?
>>>
>>> I suppose a solution wouuld be to move the compiler binaries into
>>> different separate directories, and only list one of those directories in
>>> ~/.buildman. However, I can't do that for distro-packaged toolchains (well,
>>> I suppose I could manually mv everything all over the place, but that's
>>> really fragile since it'd break any time the package got upgraded or removed
>>> and re-installed).
>>>
>>> I think it makes sense to add new syntax into ~/.buildman to specify
>>> "don't do automagical searching, just use this CROSS_COMPILE value that I
>>> say". Does that sound reasonable? Automagic stuff makes for great defaults,
>>> but if it can't be overridden, it sucks when you actually know what you
>>> want.
>>
>>
>> Yes I think it would be fine to add an option to use CROSS_COMPILE (of
>> course it would fail if you tried to build the board with the wrong
>> arch).
>
>
> I wasn't necessarily looking for buildman to pick up the CROSS_COMPILE
> environment variable, although that would be a simple solution for
> single-arch builds at least. My mention of CROSS_COMPILE immediately above
> was re: using values that are formatted in the same way as the CROSS_COMPILE
> environment variable would be, rather than directory names, in the config
> file. In other words, the example content I showed above.
>
>> The option other option at present is -G which lets you use multiple
>> .buildman files. You could have one of these for each toolchain.
>
>
> I don't think that gets me what I want. As far as I can tell, the buildman
> config file contains a list directories to search within, yet if I have 3
> toolchains in a single directory, there's no way to select which one I want
> to use, is there?
>
> In other words, a config file that contains:
>
> [toolchain]
> distro-packages: /usr/bin
>
> ... finds the following toolchains:
>
> [swarren@swarren-lx1 u-boot]$ ./tools/buildman/buildman \
> --list-tool-chains
> Scanning for tool chains
>- scanning path '/usr/bin'
>   - looking in '/usr/bin/.'
>  - found '/usr/bin/./arm-linux-gnueabi-gcc'
>  - found '/usr/bin/./arm-linux-gnueabihf-gcc'
>  - found '/usr/bin/./arm-none-eabi-gcc'
> (That's 3 AArch32 toolchains found)
>  - found '/usr/bin/./winegcc'
>  - found '/usr/bin/./aarch64-linux-gnu-gcc'
>  - found '/usr/bin/./gcc'
>  - found '/usr/bin/./c89-gcc'
>  - found '/usr/bin/./x86_64-linux-gnu-gcc'
>  - found '/usr/bin/./i586-mingw32msvc-gcc'
>  - found '/usr/bin/./c99-gcc'
>   - looking in '/usr/bin/bin'
>   - looking in '/usr/bin/usr/bin'
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> Tool chain test:  OK
> List of available toolchains (7):
> aarch64   : /usr/bin/./aarch64-linux-gnu-gcc
> arm   : /usr/bin/./arm-linux-gnueabi-gcc
> (Buildman chose that one, and I think I have no control over that?)
> c89   : /usr/bin/./c89-gcc
> c99   : /usr/bin/./c99-gcc
> i586  : /usr/bin/./i586-mingw32msvc-gcc
> sandbox   : /usr/bin/./winegcc
> x86_64: /usr/bin/./x86_64-linux-gnu-gcc

I wonder if we need an option to specify the full path and avoid the search?

Maybe [toolchain-prefix] ?

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


Re: [U-Boot] [PATCH 2/2] test: fat: add test of non-contiguous file reads

2015-10-03 Thread Simon Glass
Hi Stephen,

On 2 October 2015 at 06:56, Stephen Warren  wrote:
> In my patch series to replace fs/fat with "ff.c", I enhanced ff.c to
> optimize file reading, so that reads of contiguous clusters are submitted
> to the IO device as a single read. This test attempts to torture-test
> edge-cases of that enhancement.
>
> BTW, the only way I found to validate that this script actually does
> create non-contiguous files was to manually inspect the FAT bitmap in a
> hex dump of the FAT image. hdparm --fibmap doesn't work on loop-mounted
> filesystems. filefrag -v -e seems to lie about files being contiguous
> when they aren't.
>
> Signed-off-by: Stephen Warren 
> ---
>  test/fs/fat-noncontig-test.sh | 52 
> +++
>  1 file changed, 52 insertions(+)
>  create mode 100755 test/fs/fat-noncontig-test.sh
>
> diff --git a/test/fs/fat-noncontig-test.sh b/test/fs/fat-noncontig-test.sh
> new file mode 100755
> index ..8153708bbf78
> --- /dev/null
> +++ b/test/fs/fat-noncontig-test.sh
> @@ -0,0 +1,52 @@
> +#!/bin/bash
> +

Can you add a comment explaining what this test does?

Also I get this:

mount: mount point /mnt/tmp does not exist
umount: /mnt/tmp: not found
mount: mount point /mnt/tmp does not exist
/usr/bin/crc32: No such file or directory
umount: /mnt/tmp: not found

so does it need some extra steps?

> +odir=sandbox
> +img=${odir}/fat.img
> +mnt=/mnt/tmp
> +fill=/dev/urandom
> +testfn=noncontig.img
> +mnttestfn=${mnt}/${testfn}
> +crcaddr=0
> +loadaddr=1000
> +
> +make O=${odir} -s sandbox_defconfig && make O=${odir} -s -j8
> +
> +if [ ! -f ${img} ]; then
> +fallocate -l 40M ${img}
> +mkfs -t fat ${img}
> +
> +sudo mount -o loop,uid=$(id -u) ${img} ${mnt}
> +
> +for ((sects=8; sects < 512; sects += 8)); do
> +fn=${mnt}/keep-${sects}.img
> +dd if=${fill} of=${fn} bs=512 count=${sects} >/dev/null 2>&1
> +fn=${mnt}/remove-${sects}.img
> +dd if=${fill} of=${fn} bs=512 count=${sects} >/dev/null 2>&1
> +done
> +
> +rm -f ${mnt}/remove-*.img
> +
> +# 511 deliberately to trigger a file size that's not a multiple of the
> +# sector size (ignoring sizes that are multiples of both).
> +dd if=${fill} of=${mnttestfn} bs=511 >/dev/null 2>&1
> +
> +sudo umount ${mnt}
> +fi
> +
> +sudo mount -o ro,loop,uid=$(id -u) ${img} ${mnt}
> +crc=0x`crc32 ${mnttestfn}`
> +sudo umount ${mnt}
> +
> +crc=`printf %02x%02x%02x%02x \
> +$((${crc} & 0xff)) \
> +$(((${crc} >> 8) & 0xff)) \
> +$(((${crc} >> 16) & 0xff)) \
> +$((${crc} >> 24))`
> +
> +./sandbox/u-boot << EOF
> +host bind 0 ${img}
> +load host 0:0 ${loadaddr} ${testfn}
> +crc32 ${loadaddr} \$filesize ${crcaddr}
> +if itest.l *${crcaddr} != ${crc}; then echo FAILURE; else echo PASS; fi
> +reset
> +EOF
> --
> 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] fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

2015-10-03 Thread Simon Glass
On 3 October 2015 at 00:44, Stephen Warren  wrote:
> From: Stephen Warren 
>
> PCI addresses are always represented as 3 cells in DT. (one cell for bus
> and device, and two cells for a 64-bit addres). This does not vary based
> on either the physical address size of the CPU, nor any #address-cells
> property in DT (or more precisely, #address-cells must be set to 3 in any
> PCIe controller's node).
>
> Fix fdtdec_get_pci_addr() to use conversion functions that operate on
> (fixed) cell-sized data rather than (varying) physical-address-sized
> data, so that the function works on 64-bit systems.
>
> Signed-off-by: Stephen Warren 
> ---
>  lib/fdtdec.c | 14 +++---
>  1 file changed, 7 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 v2] zynq-common: Define spi args offset and size

2015-10-03 Thread Simon Glass
Hi,

On 14 September 2015 at 09:49, Jagan Teki  wrote:
> Hi Simon,
>
> On 14 September 2015 at 14:06, Siva Durga Prasad Paladugu
>  wrote:
>> Hi Jagan,
>>
>>> -Original Message-
>>> From: Jagan Teki [mailto:jt...@openedev.com]
>>> Sent: Monday, September 14, 2015 1:06 PM
>>> To: Siva Durga Prasad Paladugu
>>> Cc: u-boot@lists.denx.de; Siva Durga Prasad Paladugu
>>> Subject: Re: [PATCH v2] zynq-common: Define spi args offset and size
>>>
>>> On 14 September 2015 at 11:32, Siva Durga Prasad Paladugu
>>>  wrote:
>>> > Define CONFIG_SYS_SPI_ARGS_OFFS, CONFIG_SYS_SPI_ARGS_SIZE and
>>> > CONFIG_SYS_SPI_KERNEL_OFFS which will be used in SPL spi mode. These
>>> > macros defines the device tree offset, size and the kernel image
>>> > offset in flash respectively.
>>> >
>>> > Signed-off-by: Siva Durga Prasad Paladugu 
>>> > ---
>>> > Changes for v2:
>>> > - Moved the configs under  SPI-SPL as per review comment.
>>> > - Updated the commit message with description of the configs.
>>> > - Placed the kernel offset at 0x20.
>>> > - This patch is based on u-boot-spi/master branch
>>> > ---
>>> >  include/configs/zynq-common.h |4 
>>> >  1 files changed, 4 insertions(+), 0 deletions(-)
>>> >
>>> > diff --git a/include/configs/zynq-common.h
>>> > b/include/configs/zynq-common.h index f6dd03b..45dafe2 100644
>>> > --- a/include/configs/zynq-common.h
>>> > +++ b/include/configs/zynq-common.h
>>> > @@ -355,6 +355,10 @@
>>> >  #define CONFIG_SPL_SPI_LOAD
>>> >  #define CONFIG_SPL_SPI_FLASH_SUPPORT
>>> >  #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x10
>>> > +#define CONFIG_SYS_SPI_ARGS_OFFS   0x20
>>> > +#define CONFIG_SYS_SPI_ARGS_SIZE   0x8
>>> > +#define CONFIG_SYS_SPI_KERNEL_OFFS
>>> (CONFIG_SYS_SPI_ARGS_OFFS + \
>>> > +CONFIG_SYS_SPI_ARGS_SIZE)
>>>
>>> Still got SPL build issue
>>>
>>> drivers/mtd/spi/sf_probe.c: In function 'spi_flash_std_probe':
>>> drivers/mtd/spi/sf_probe.c:480:2: error: dereferencing pointer to
>>> incomplete type
>>> make[3]: *** [spl/drivers/mtd/spi/sf_probe.o] Error 1
>>>
>>> Does this depends Simon, patches[1] you pointed earlier.
>>>
>>> [1] http://git.denx.de/?p=u-boot/u-boot-
>>> dm.git;a=shortlog;h=refs/heads/zynq-working
>>
>>
>> Yes it depends on Simon patches.
>
> Any plan to send a PR for this zynq-changes [1]
>
> [1] 
> http://git.denx.de/?p=u-boot/u-boot-dm.git;a=shortlog;h=refs/heads/zynq-working
>

I felt it was too late for this release. Is anything broken?

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


Re: [U-Boot] [PATCH 1/2] itest: make memory access work under sandbox

2015-10-03 Thread Simon Glass
On 2 October 2015 at 06:56, Stephen Warren  wrote:
> itest accesses memory, and hence must map/unmap it. Without doing so, it
> accesses invalid addresses and crashes.
>
> Signed-off-by: Stephen Warren 
> ---
>  common/cmd_itest.c | 21 -
>  1 file changed, 16 insertions(+), 5 deletions(-)

Reviewed-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 4/4] trats: fdt: disable unused DW MMC

2015-10-03 Thread Simon Glass
On 1 October 2015 at 08:22, Jaehoon Chung  wrote:
> Hi,
>
> On 10/01/2015 04:11 PM, Przemyslaw Marczak wrote:
>> Hello Jaehoon,
>>
>> On 10/01/2015 05:37 AM, Jaehoon Chung wrote:
>>> Hi, Przemyslaw.
>>>
>>> On 09/30/2015 08:14 PM, Przemyslaw Marczak wrote:
 This device uses SDHCI driver, for eMMC and SD cards.
 Trying bind the DW MMC driver with fdt node without all
 required properties, causes printing an error.

 This commit disables the DW MMC node.
>>>
>>> Why does it need?
>>> Trats board doesn't support the Designware IP, so i think right that it 
>>> shouldn't build.
>>>
>>> If needs to modify, exynos-common.h should be modified.
>>>
>>
>> I think, that some day, we will have a single config, for at least exynos5 
>> and exynos4 (if doesn't exceed the size limit), so using the generic 
>> configuration is reasonable here.
>
> Single config? Well, if do so, it will be great..not yet.
>
>>
>> Trats is based on Exynos4210, which supports this IP, and I checked the 
>> documentation, the address 0x1255 is proper - Mobile Storage Host.
>
> Sorry..I have confused with C110. :)
>
> Best Regards,
> Jaehoon Chung

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


Re: [U-Boot] [PATCH] fdt: fix fdtdec_get_addr_size not to require any size cells

2015-10-03 Thread Simon Glass
On 29 September 2015 at 05:33, Simon Glass  wrote:
> On 28 September 2015 at 04:41, Przemyslaw Marczak  
> wrote:
>> Hello Stephen,
>>
>>
>> On 09/25/2015 06:11 PM, Stephen Warren wrote:
>>>
>>> From: Stephen Warren 
>>>
>>> fdtdec_get_addr_size() may be used in two cases:
>>> a) With sizep supplied, in which case both an address and a size are
>>> parsed from DT. In this case, the DT property must be large enough to
>>> contain both values.
>>> b) With sizep NULL, in which case only an address is parsed from DT.
>>> In this case, the DT property only need be large enough to contain this
>>> address value. Commit 02464e386bb5 "fdt: add new fdt address parsing
>>> functions" broke this relaxed checking, and required the DT property to
>>> contain both an address and a size value in all cases.
>>>
>>> Fix fdtdec_get_addr_size() to vary ns based on whether the size value
>>> is being parsed from the DT or not. This is safe since the function only
>>> parses the first entry in the property, so the overall value of (na + ns)
>>> need not be accurate, since it is never used to step through the property
>>> data to find other entries. Besides, this fixed behaviour essentially
>>> matches the original behaviour before the patch this patch fixes. (The
>>> original code validated that the property was exactly the length of
>>> either na or (na + ns), whereas the current code only validates that the
>>> property is at least that long. For non-failure cases, the two behaviours
>>> are identical).
>>>
>>> Cc: Przemyslaw Marczak 
>>> Cc: Simon Glass 
>>> Cc: Thierry Reding 
>>> Cc: Bin Meng 
>>> Cc: Michal Suchanek 
>>> Fixes: 02464e386bb5 ("fdt: add new fdt address parsing functions")
>>> Reported-by: Przemyslaw Marczak 
>>> Signed-off-by: Stephen Warren 
>>> ---
>>>   lib/fdtdec.c | 5 +++--
>>>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> Acked-by: Simon Glass 

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


Re: [U-Boot] [PATCH V3 2/4] gpio: s5p: call: dev_get_addr() instead of fdtdec_get_addr()

2015-10-03 Thread Simon Glass
On 30 September 2015 at 12:14, Przemyslaw Marczak  wrote:
> After rework in lib/fdtdec.c, the function fdtdec_get_addr()
> doesn't work for nodes with #size-cells property set to 0.
>
> To get GPIO's 'reg' property, the code should use one of:
> fdtdec_get_addr_size_auto_no/parent() function.
>
> Fortunately dm core provides a function to get the property.
>
> This commit reworks function gpio_exynos_bind(), to properly
> use dev_get_addr() for GPIO device.
>
> This prevents setting a wrong base register for Exynos GPIOs.
>
> Tested on: Odroid U3/X2, Trats, Trats2, Odroid XU3, Snow (by Simon).
>
> Signed-off-by: Przemyslaw Marczak 
> Acked-by: Stephen Warren 
> Acked-by: Simon Glass 
> Tested-by: Simon Glass 
> ---
> Changes V2:
> - add acked-by
> Changes V3:
> - add acked-by and tested-by Simon
> ---
>  drivers/gpio/s5p_gpio.c | 18 +++---
>  1 file changed, 11 insertions(+), 7 deletions(-)

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


Re: [U-Boot] [PATCH V3 3/4] mach-exynos: clock: restore calling dead exynos4_get_mmc_clk()

2015-10-03 Thread Simon Glass
On 30 September 2015 at 12:14, Przemyslaw Marczak  wrote:
> After rework of code by:
>
> commit: d952796 Exynos5: Use clock_get_periph_rate generic API
>
> function get_mmc_clk() always returns -1 for Exynos 4.
>
> This was caused by omitting, that SDHCI driver for Exynos 4,
> calls get_mmc_clk(), with mmc device number as argument,
> instead of pinmux peripheral id, like DW MMC driver for Exynos 5.
>
> By this commit, the code directly calls a proper function
> to get mmc clock for Exynos 4, without checking the peripheral id.
>
> Tested on: Odroid U3/X2, Trats, Trats2, Odroid XU3, Snow (by Simon).
>
> Signed-off-by: Przemyslaw Marczak 
> Acked-by: Jaehoon Chung 
> Acked-by: Simon Glass 
> Tested-by: Simon Glass 
> ---
> Changes V2:
> - cleanup commit message
> Changes V3:
> - add acked-by: Simon and Jaehoon and tested-by: Simon
> ---
>  arch/arm/mach-exynos/clock.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)

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


Re: [U-Boot] [PATCH] dm: core: Enable optional use of fdt_translate_address()

2015-10-03 Thread Simon Glass
Hi Stephen,

On 21 September 2015 at 19:06, Stephen Warren  wrote:
> On 09/13/2015 11:25 PM, Stefan Roese wrote:
>>
>> Hi Stephen,
>>
>> On 11.09.2015 19:07, Stephen Warren wrote:
>>>
>>> On 09/09/2015 11:07 AM, Simon Glass wrote:

 +Stephen

 Hi Stefan,

 On Thursday, 3 September 2015, Stefan Roese  wrote:
>
>
> The current "simple" address translation simple_bus_translate() is not
> working on some platforms (e.g. MVEBU). As here more complex "ranges"
> properties are used in many nodes (multiple tuples etc). This patch
> enables the optional use of the common fdt_translate_address() function
> which handles this translation correctly.
>
> Signed-off-by: Stefan Roese 
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: Marek Vasut 
> Cc: Masahiro Yamada 
> ---
> v2:
> - Rework code a bit as suggested by Simon. Also added some comments
>to make the use of the code paths more clear.



 While this works I'm reluctant to commit it as is. The call to
 fdt_parent_offset() is very slow.

 I wonder if this code should be copied into a new file in
 drivers/core/, tidied up and updated to use dev->parent?

 Other options:
 - Add a library to unflatten the tree - but this would not be very
 useful in SPL or before relocation due to memory/speed constraints
 - Add a helper to find a node parent which uses a cached tree scan to
 build a table of previous nodes (or some other means to go backwards
 in the tree)
 - Worry about it later and go ahead with this patch
>>>
>>>
>>> I haven't looked at the code in detail, but I'm surprised there's a
>>> Kconfig option for this, for either SPL or main U-Boot. In general, this
>>> feature is simply a required part of parsing DT, so surely the code
>>> should always be enabled. Without it, we're only getting lucky if DT
>>> works (lucky the DT doesn't happen to contain a ranges property).
>>
>>
>> Yes. I was also a bit surprised, that this current (limited)
>> implementation to translate the address worked on the platforms using
>> this interface right now.
>>
>>> Sure
>>> the code does some searching through the DT, and that's slower than not
>>> doing it, but I don't see how we can support DT without parsing DT
>>> correctly. Now admittedly some platforms' DTs happen not to contain
>>> ranges that require this code in practice. However, I feel that's a bit
>>> of a micro-optimization, and a rather error-prone one at that. What if
>>> someone pulls a more complete DT into U-Boot and suddenly the code is
>>> required and they have to spend ages tracking down their problem to
>>> missing functionality in a core DT parsing API - something they'd be
>>> unlikely to initially suspect.
>>
>>
>> Ack. However, I definitely understand Simon's arguments about code size
>> here. On some platforms with limited RAM for SPL this additional code
>> for "correct" ranges parsing and address translation might break the
>> size limit. Not sure how to handle this. At least a comment in the code
>> would be helpful, explaining that simple_bus_translate() is limited here
>> in some aspects.
>
>
> So in my AArch64 build, fdt_translate_address is 0x270 bytes. I can see that
> might be pushing some extremely constrained binaries over a limit if that
> function isn't already included in the binary. However, if we are in that
> situation, I have a really hard time believing this one patch/function will
> be the only issue; we'll constantly be hitting a wall where we can't fix
> issues in DT parsing, DT handling, or other code in these binaries since the
> fix will bloat the binary too much.
>
> In those cases, I rather question whether DT support is the correct
> approach; completely dropping DT support from those binaries would likely
> remove large amounts of code and replace it with a tiny amount of constant
> data. It seems like that'd be the best approach all around since it'd head
> of the issue completely.

U-Boot is not Linux - code size is important. We can enable features
when needed. At present we can enable driver model and device tree
with a ~5KB binary hit including a small device tree. I'd like to keep
that down as low as possible. Otherwise we will end up with SPL being
unable to driver model / device tree on lots of platforms. As time
goes by and SoCs become more and more complex, this will be a pain.
We'll end up forking the driver model.

Of course trade-offs can change over time but that's the way I see it
at the moment.

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


Re: [U-Boot] [PATCH 2/2] gpio: tegra: use named constants

2015-10-03 Thread Simon Glass
Hi Stephen,

On 2 October 2015 at 00:29, Stephen Warren  wrote:
> On 10/01/2015 05:00 PM, Simon Glass wrote:
>>
>> On Friday, 25 September 2015, Stephen Warren 
>> wrote:
>>>
>>> From: Stephen Warren 
>>>
>>> In order to make it clear what the parameters to set_config() and
>>> set_direction() mean, and similarly for the return values from the
>>> respective get_*(), define named constants for these values.
>>>
>>> Disassembly shows no diff in the generated code, except that the
>>> order of the code in the branches of tegra_gpio_get_function() gets
>>> modified without affecting behaviour.
>
>
>>> diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
>
>
>>> +static const int CONFIG_SFIO = 0;
>>> +static const int CONFIG_GPIO = 1;
>>> +static const int DIRECTION_INPUT = 0;
>>> +static const int DIRECTION_OUTPUT = 1;
>>
>>
>> Why not use an enum?
>
>
> I don't think it gives any benefit does it?
>
> Doing so would entail 5 extra lines of overhead for the enum { and } lines.
> I'd want to define two separate enum blocks since I dislike putting
> logically unrelated enum values into a single enum definition. Even if I
> didn't do that, it's still 2 lines of useless overhead to add everything
> into a single enum.

It's just odd to use const int instead of enum I think. Particularly
as you are using capital letters.

Since it's Tegra code I'll leave it up to you.

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


Re: [U-Boot] Please pull u-boot-fdt

2015-10-03 Thread Tom Rini
On Sat, Oct 03, 2015 at 03:45:21PM +0100, Simon Glass wrote:

> Hi Tom,
> 
> Here are a few last-minute bug fixes mostly stemming from the
> fdtdec_get_addr() change earlier.
> 
> 
> The following changes since commit fbb0c7bd92255bfcb13826a8ac81be6e2f94ba48:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-tegra (2015-10-02
> 20:35:49 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-fdt.git
> 
> for you to fetch changes up to cce573e8d806fd430e7584b36bce6d62ae0430e8:
> 
>   trats: fdt: disable unused DW MMC (2015-10-03 14:39:19 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH v3 1/2] imx_watchdog: Add a header file for watchdog registers

2015-10-03 Thread Fabio Estevam
From: Fabio Estevam 

Create fsl_wdog.h to store the watchdog registers and bit fields.

This can be useful when accesses to the watchdog block are made from other
parts, such as arch/arm/ cpu code.

Signed-off-by: Fabio Estevam 
---
Changes since v2:
- None
Changes since v1:
- Newly introduced

 drivers/watchdog/imx_watchdog.c | 14 +-
 include/fsl_wdog.h  | 18 ++
 2 files changed, 19 insertions(+), 13 deletions(-)
 create mode 100644 include/fsl_wdog.h

diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 9a77a54..0d77595 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -8,19 +8,7 @@
 #include 
 #include 
 #include 
-
-struct watchdog_regs {
-   u16 wcr;/* Control */
-   u16 wsr;/* Service */
-   u16 wrsr;   /* Reset Status */
-};
-
-#define WCR_WDZST  0x01
-#define WCR_WDBG   0x02
-#define WCR_WDE0x04/* WDOG enable */
-#define WCR_WDT0x08
-#define WCR_SRS0x10
-#define SET_WCR_WT(x)  (x << 8)
+#include 
 
 #ifdef CONFIG_IMX_WATCHDOG
 void hw_watchdog_reset(void)
diff --git a/include/fsl_wdog.h b/include/fsl_wdog.h
new file mode 100644
index 000..d15a70c
--- /dev/null
+++ b/include/fsl_wdog.h
@@ -0,0 +1,18 @@
+/*
+ * (C) Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+struct watchdog_regs {
+   u16 wcr;/* Control */
+   u16 wsr;/* Service */
+   u16 wrsr;   /* Reset Status */
+};
+
+#define WCR_WDZST  0x01
+#define WCR_WDBG   0x02
+#define WCR_WDE0x04
+#define WCR_WDT0x08
+#define WCR_SRS0x10
+#define SET_WCR_WT(x)  (x << 8)
-- 
1.9.1

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


[U-Boot] [PATCH v3 2/2] ls102xa: Fix reset hang

2015-10-03 Thread Fabio Estevam
From: Fabio Estevam 

Since commit 623d96e89aca6("imx: wdog: correct wcr register settings")
issuing a 'reset' command causes the system to hang.

Unlike i.MX and Vybrid, the watchdog controller on LS102x is big-endian.

This means that the watchdog on LS1021 has been working by accident as
it does not use the big-endian accessors in drivers/watchdog/imx_watchdog.c.
Commit 623d96e89aca6("imx: wdog: correct wcr register settings") only
revelead the endianness problem on LS102x.

In order to fix the reset hang, introduce a reset_cpu() implementation that 
is specific for ls102x, which accesses the watchdog WCR register in big-endian
format. All that is required to reset LS102x is to clear the SRS bit.

This approach is a temporary workaround to avoid a regression for LS102x
in the 2015.10 release. The proper fix is to make the watchdog driver 
endian-aware, so that it can work for i.MX, Vybrid and LS102x.

Reported-by: Sinan Akman 
Tested-by: Sinan Akman 
Reviewed-by: Wolfgang Denk 
Signed-off-by: Fabio Estevam 
---
Changes since v2:
- Explain that this a temporary workaround (Tom)
Changes since v1:
- Do not add duplicate wdog struct (Wolfgang)

 arch/arm/cpu/armv7/ls102xa/cpu.c | 15 +++
 drivers/watchdog/Makefile|  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c
index 8dd95d9..e2eb5f3 100644
--- a/arch/arm/cpu/armv7/ls102xa/cpu.c
+++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
@@ -13,6 +13,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "fsl_epu.h"
 
@@ -354,3 +356,16 @@ void smp_kick_all_cpus(void)
asm volatile("sev");
 }
 #endif
+
+void reset_cpu(ulong addr)
+{
+   struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+
+   clrbits_be16(>wcr, WCR_SRS);
+
+   while (1) {
+   /*
+* Let the watchdog trigger
+*/
+   }
+}
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 9e9cb55..a007ae8 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -7,7 +7,7 @@
 
 obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
 obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
-ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610 ls102xa))
+ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610))
 obj-y += imx_watchdog.o
 endif
 obj-$(CONFIG_S5P)   += s5p_wdt.o
-- 
1.9.1

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


Re: [U-Boot] [PATCH 08/18] sandbox: Use the reset driver to handle reset

2015-10-03 Thread Simon Glass
Hi Stephen,

On 25 September 2015 at 06:32, Stephen Warren  wrote:
> On 09/24/2015 11:13 PM, Stephen Warren wrote:
>> On 08/10/2015 09:44 PM, Simon Glass wrote:
>>> Hi Stephen,
>>>
>>> On 10 August 2015 at 21:35, Stephen Warren  wrote:
 On 07/17/2015 05:58 PM, Simon Glass wrote:
> On 6 July 2015 at 12:54, Simon Glass  wrote:
>> Move sandbox over to use the reset uclass for reset, instead of a direct
>> call to do_reset(). This allows us to add tests.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/sandbox/cpu/cpu.c| 9 +
>>  arch/sandbox/dts/test.dts | 8 
>>  arch/sandbox/include/asm/u-boot-sandbox.h | 3 +++
>>  configs/sandbox_defconfig | 1 +
>>  4 files changed, 13 insertions(+), 8 deletions(-)
>
> Applied to u-boot-dm.

 This patch causes the reset command to stop working in sandbox. It now
 prints:

 => reset
 Reset not supported on this platform
 ### ERROR ### Please RESET the board ###

 Among other things, this causes ./test/fs/fs-test.sh to hang without any
 particular indication why. (In that test, running under expect/pyexpect
 might be nicer, so the user could see progress; the error above doesn't
 even show up in the test log files).
>>>
>>> Yes I noticed the reset problem recently but haven't got back to it
>>> yet sorry. Ctrl-C works if you are at the command line, but will not
>>> fix the test.
>>>
>>> One problem is that sandbox.dts needs a reset node, one of the ones
>>> from test.dts. Then at least 'u-boot -D' will work.
>>>
>>> The other is that we need a U_BOOT_DEVICE() declaration for the reset
>>> controller. This is how drivers/serial/sandbox.c gets around this
>>> problem.
>>>
>>> It would be good if we could run all the tests easily. At present it
>>> involves lots of steps and the method used to run each is different.
>>
>> Any update on this? I had forgotten about this issue and just debugged
>> the exact same problem again. Unfortunately, reverting this commit seems
>> to make U-Boot hang() at early init time now, so I can't work around the
>> issue either (unless I made a mistake implementing the revert; I'll try
>> again).
>
> The following hack makes reset work again. This sounds like something
> other than the issues you mentioned above?
>
>> https://github.com/swarren/u-boot/commit/2e41c317516e414326620374725a25b7b531d2e2
>
>> diff --git a/drivers/misc/reset_sandbox.c b/drivers/misc/reset_sandbox.c
>> index 917121bc5e80..0208e11dbf3a 100644
>> --- a/drivers/misc/reset_sandbox.c
>> +++ b/drivers/misc/reset_sandbox.c
>> @@ -40,8 +40,10 @@ static int sandbox_reset_request(struct udevice *dev, 
>> enum reset_t type)
>>  * (see the U_BOOT_DEVICE() declaration below) should not do 
>> anything.
>>  * If we are that device, return an error.
>>  */
>> +#if 0
>> if (gd->fdt_blob && dev->of_offset == -1)
>> return -ENODEV;
>> +#endif
>>
>> switch (type) {
>> case RESET_COLD:
>

I've sent a patch:

http://patchwork.ozlabs.org/patch/525967/

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


[U-Boot] [PATCH] sandbox: Correct operaion of 'reset' command

2015-10-03 Thread Simon Glass
Currently 'reset' only works with the test device tree. When run without a
device tree, or with the normal device tree, the following error is
displayed:

   Reset not supported on this platform

Fix the driver and the standard device tree to avoid this.

Signed-off-by: Simon Glass 
Reported-by: Stephen Warren 
---

 arch/sandbox/dts/sandbox.dts | 4 
 drivers/misc/reset_sandbox.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 65b9125..08f72ac 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -153,6 +153,10 @@
};
};
 
+   reset@1 {
+   compatible = "sandbox,reset";
+   };
+
spi@0 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/drivers/misc/reset_sandbox.c b/drivers/misc/reset_sandbox.c
index 917121b..2691bb0 100644
--- a/drivers/misc/reset_sandbox.c
+++ b/drivers/misc/reset_sandbox.c
@@ -40,7 +40,7 @@ static int sandbox_reset_request(struct udevice *dev, enum 
reset_t type)
 * (see the U_BOOT_DEVICE() declaration below) should not do anything.
 * If we are that device, return an error.
 */
-   if (gd->fdt_blob && dev->of_offset == -1)
+   if (state->fdt_fname && dev->of_offset == -1)
return -ENODEV;
 
switch (type) {
-- 
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] Don't wrap to negative after 2G sectors

2015-10-03 Thread Stefan Monnier
I haven't received any answer from anyone about my patch.
What am I doing wrong?


Stefan


> "Stefan" == Stefan Monnier  writes:

> Signed-off-by: Stefan Monnier 
> ---
>  disk/part_dos.c | 29 +
>  include/ide.h   |  8 
>  2 files changed, 21 insertions(+), 16 deletions(-)

> diff --git a/disk/part_dos.c b/disk/part_dos.c
> index cf1a36e..adde68a 100644
> --- a/disk/part_dos.c
> +++ b/disk/part_dos.c
> @@ -25,7 +25,7 @@
 
>  /* Convert char[4] in little endian format to the host format integer
>   */
> -static inline int le32_to_int(unsigned char *le32)
> +static inline unsigned int le32_to_int(unsigned char *le32)
>  {
>  return ((le32[3] << 24) +
>   (le32[2] << 16) +
> @@ -46,13 +46,14 @@ static inline int is_bootable(dos_partition_t *p)
>   return p->boot_ind == 0x80;
>  }
 
> -static void print_one_part(dos_partition_t *p, int ext_part_sector,
> +static void print_one_part(dos_partition_t *p, lbaint_t ext_part_sector,
>  int part_num, unsigned int disksig)
>  {
> - int lba_start = ext_part_sector + le32_to_int (p->start4);
> - int lba_size  = le32_to_int (p->size4);
> + lbaint_t lba_start = ext_part_sector + le32_to_int (p->start4);
> + lbaint_t lba_size  = le32_to_int (p->size4);
 
> - printf("%3d\t%-10d\t%-10d\t%08x-%02x\t%02x%s%s\n",
> + printf("%3d\t%-10" LBAFlength "u\t%-10" LBAFlength
> + "u\t%08x-%02x\t%02x%s%s\n",
>   part_num, lba_start, lba_size, disksig, part_num, p->sys_ind,
>   (is_extended(p->sys_ind) ? " Extd" : ""),
>   (is_bootable(p) ? " Boot" : ""));
> @@ -101,7 +102,8 @@ int test_part_dos (block_dev_desc_t *dev_desc)
>  /*  Print a partition that is relative to its Extended partition table
>   */
>  static void print_partition_extended(block_dev_desc_t *dev_desc,
> -  int ext_part_sector, int relative,
> +  lbaint_t ext_part_sector,
> +  lbaint_t relative,
>int part_num, unsigned int disksig)
>  {
>   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
> @@ -109,7 +111,7 @@ static void print_partition_extended(block_dev_desc_t 
> *dev_desc,
>   int i;
 
>   if (dev_desc->block_read(dev_desc->dev, ext_part_sector, 1, (ulong *) 
> buffer) != 1) {
> - printf ("** Can't read partition table on %d:%d **\n",
> + printf ("** Can't read partition table on %d:" LBAFU " **\n",
dev_desc-> dev, ext_part_sector);
>   return;
>   }
> @@ -148,7 +150,8 @@ static void print_partition_extended(block_dev_desc_t 
> *dev_desc,
>   pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
>   for (i = 0; i < 4; i++, pt++) {
>   if (is_extended (pt->sys_ind)) {
> - int lba_start = le32_to_int (pt->start4) + relative;
> + lbaint_t lba_start
> + = le32_to_int (pt->start4) + relative;
 
>   print_partition_extended(dev_desc, lba_start,
>   ext_part_sector == 0  ? lba_start : relative,
> @@ -162,8 +165,9 @@ static void print_partition_extended(block_dev_desc_t 
> *dev_desc,
 
>  /*  Print a partition that is relative to its Extended partition table
>   */
> -static int get_partition_info_extended (block_dev_desc_t *dev_desc, int 
> ext_part_sector,
> -  int relative, int part_num,
> +static int get_partition_info_extended (block_dev_desc_t *dev_desc,
> +  lbaint_t ext_part_sector,
> +  lbaint_t relative, int part_num,
>int which_part, disk_partition_t *info,
>unsigned int disksig)
>  {
> @@ -173,7 +177,7 @@ static int get_partition_info_extended (block_dev_desc_t 
> *dev_desc, int ext_part
>   int dos_type;
 
>   if (dev_desc->block_read (dev_desc->dev, ext_part_sector, 1, (ulong *) 
> buffer) != 1) {
> - printf ("** Can't read partition table on %d:%d **\n",
> + printf ("** Can't read partition table on %d:" LBAFU " **\n",
dev_desc-> dev, ext_part_sector);
>   return -1;
>   }
> @@ -249,7 +253,8 @@ static int get_partition_info_extended (block_dev_desc_t 
> *dev_desc, int ext_part
>   pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
>   for (i = 0; i < 4; i++, pt++) {
>   if (is_extended (pt->sys_ind)) {
> - int lba_start = le32_to_int (pt->start4) + relative;
> + lbaint_t lba_start
> + = le32_to_int (pt->start4) + relative;
 
>   return get_partition_info_extended (dev_desc, lba_start,
>ext_part_sector == 0 ? lba_start : relative,
> 

Re: [U-Boot] [PATCH] dm: core: Enable optional use of fdt_translate_address()

2015-10-03 Thread Stephen Warren
On 10/03/2015 06:50 AM, Simon Glass wrote:
> Hi Stephen,
> 
> On 21 September 2015 at 19:06, Stephen Warren  wrote:
>> On 09/13/2015 11:25 PM, Stefan Roese wrote:
>>>
>>> Hi Stephen,
>>>
>>> On 11.09.2015 19:07, Stephen Warren wrote:

 On 09/09/2015 11:07 AM, Simon Glass wrote:
>
> +Stephen
>
> Hi Stefan,
>
> On Thursday, 3 September 2015, Stefan Roese  wrote:
>>
>>
>> The current "simple" address translation simple_bus_translate() is not
>> working on some platforms (e.g. MVEBU). As here more complex "ranges"
>> properties are used in many nodes (multiple tuples etc). This patch
>> enables the optional use of the common fdt_translate_address() function
>> which handles this translation correctly.
>>
>> Signed-off-by: Stefan Roese 
>> Cc: Simon Glass 
>> Cc: Bin Meng 
>> Cc: Marek Vasut 
>> Cc: Masahiro Yamada 
>> ---
>> v2:
>> - Rework code a bit as suggested by Simon. Also added some comments
>>to make the use of the code paths more clear.
>
>
>
> While this works I'm reluctant to commit it as is. The call to
> fdt_parent_offset() is very slow.
>
> I wonder if this code should be copied into a new file in
> drivers/core/, tidied up and updated to use dev->parent?
>
> Other options:
> - Add a library to unflatten the tree - but this would not be very
> useful in SPL or before relocation due to memory/speed constraints
> - Add a helper to find a node parent which uses a cached tree scan to
> build a table of previous nodes (or some other means to go backwards
> in the tree)
> - Worry about it later and go ahead with this patch


 I haven't looked at the code in detail, but I'm surprised there's a
 Kconfig option for this, for either SPL or main U-Boot. In general, this
 feature is simply a required part of parsing DT, so surely the code
 should always be enabled. Without it, we're only getting lucky if DT
 works (lucky the DT doesn't happen to contain a ranges property).
>>>
>>>
>>> Yes. I was also a bit surprised, that this current (limited)
>>> implementation to translate the address worked on the platforms using
>>> this interface right now.
>>>
 Sure
 the code does some searching through the DT, and that's slower than not
 doing it, but I don't see how we can support DT without parsing DT
 correctly. Now admittedly some platforms' DTs happen not to contain
 ranges that require this code in practice. However, I feel that's a bit
 of a micro-optimization, and a rather error-prone one at that. What if
 someone pulls a more complete DT into U-Boot and suddenly the code is
 required and they have to spend ages tracking down their problem to
 missing functionality in a core DT parsing API - something they'd be
 unlikely to initially suspect.
>>>
>>>
>>> Ack. However, I definitely understand Simon's arguments about code size
>>> here. On some platforms with limited RAM for SPL this additional code
>>> for "correct" ranges parsing and address translation might break the
>>> size limit. Not sure how to handle this. At least a comment in the code
>>> would be helpful, explaining that simple_bus_translate() is limited here
>>> in some aspects.
>>
>>
>> So in my AArch64 build, fdt_translate_address is 0x270 bytes. I can see that
>> might be pushing some extremely constrained binaries over a limit if that
>> function isn't already included in the binary. However, if we are in that
>> situation, I have a really hard time believing this one patch/function will
>> be the only issue; we'll constantly be hitting a wall where we can't fix
>> issues in DT parsing, DT handling, or other code in these binaries since the
>> fix will bloat the binary too much.
>>
>> In those cases, I rather question whether DT support is the correct
>> approach; completely dropping DT support from those binaries would likely
>> remove large amounts of code and replace it with a tiny amount of constant
>> data. It seems like that'd be the best approach all around since it'd head
>> of the issue completely.
> 
> U-Boot is not Linux - code size is important. We can enable features
> when needed.

Only if they're not mandatory parts of other features that we've made an
arbitrary decision to use. Correctness trumps optimization in absolutely
all cases.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] gpio: tegra: use named constants

2015-10-03 Thread Stephen Warren
On 10/03/2015 08:14 AM, Simon Glass wrote:
> Hi Stephen,
> 
> On 2 October 2015 at 00:29, Stephen Warren  wrote:
>> On 10/01/2015 05:00 PM, Simon Glass wrote:
>>>
>>> On Friday, 25 September 2015, Stephen Warren 
>>> wrote:

 From: Stephen Warren 

 In order to make it clear what the parameters to set_config() and
 set_direction() mean, and similarly for the return values from the
 respective get_*(), define named constants for these values.

 Disassembly shows no diff in the generated code, except that the
 order of the code in the branches of tegra_gpio_get_function() gets
 modified without affecting behaviour.
>>
>>
 diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
>>
>>
 +static const int CONFIG_SFIO = 0;
 +static const int CONFIG_GPIO = 1;
 +static const int DIRECTION_INPUT = 0;
 +static const int DIRECTION_OUTPUT = 1;
>>>
>>>
>>> Why not use an enum?
>>
>>
>> I don't think it gives any benefit does it?
>>
>> Doing so would entail 5 extra lines of overhead for the enum { and } lines.
>> I'd want to define two separate enum blocks since I dislike putting
>> logically unrelated enum values into a single enum definition. Even if I
>> didn't do that, it's still 2 lines of useless overhead to add everything
>> into a single enum.
> 
> It's just odd to use const int instead of enum I think.

What makes it odd?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2 2/3] test: fat: add test of non-contiguous file reads

2015-10-03 Thread Stephen Warren
In my patch series to replace fs/fat with "ff.c", I enhanced ff.c to
optimize file reading, so that reads of contiguous clusters are submitted
to the IO device as a single read. This test attempts to torture-test
edge-cases of that enhancement.

BTW, the only way I found to validate that this script actually does
create non-contiguous files was to manually inspect the FAT bitmap in a
hex dump of the FAT image. hdparm --fibmap doesn't work on loop-mounted
filesystems. filefrag -v -e seems to lie about files being contiguous
when they aren't.

Signed-off-by: Stephen Warren 
---
v2:
* Check for missing pre-requisite binaries, and print an explicit error
  message if any are missing.
* Create mount-point rather than assuming it exists.
* Add a comment describing the script's operation.
---
 test/fs/fat-noncontig-test.sh | 113 ++
 1 file changed, 113 insertions(+)
 create mode 100755 test/fs/fat-noncontig-test.sh

diff --git a/test/fs/fat-noncontig-test.sh b/test/fs/fat-noncontig-test.sh
new file mode 100755
index ..f153c97bbf05
--- /dev/null
+++ b/test/fs/fat-noncontig-test.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+# (C) Copyright 2015 Stephen Warren
+#
+# SPDX-License-Identifier: GPL-2.0+
+
+# This script tests U-Boot's FAT filesystem code's ability to read non-
+# contiguous files.
+
+# When porting the ff.c FAT parsing code into U-Boot, it was found that ff.c
+# always reads files cluster-by-cluster, which results in poor performance.
+# This was solved by adding a patch to ff.c to coalesce reads of adjacent
+# clusters. Since this patch needed to correctly handle non-contiguous files,
+# this test was written to validate that.
+#
+# To execute the test, simply run it from the U-Boot source root directory:
+#
+#cd u-boot
+#./test/fs/fat-noncontig-test.sh
+#
+# The test will create a FAT filesystem image, record the CRC of a randomly
+# generated file in the image, build U-Boot sandbox, invoke U-Boot sandbox to
+# read the file and validate that the CRCs match. Expected output is shown
+# below. The important part of the log is the penultimate line that contains
+# either "PASS" or "FAILURE".
+#
+#mkfs.fat 3.0.26 (2014-03-07)
+#
+#
+#U-Boot 2015.10-rc4-00018-g4b22a3e5513f (Oct 03 2015 - 13:49:23 -0600)
+#
+#DRAM:  128 MiB
+#Using default environment
+#
+#In:serial
+#Out:   lcd
+#Err:   lcd
+#Net:   No ethernet found.
+#=> host bind 0 sandbox/fat-noncontig.img
+#=> load host 0:0 1000 noncontig.img
+#33584964 bytes read in 18 ms (1.7 GiB/s)
+#=> crc32 1000 $filesize 0
+#crc32 for 1000 ... 02008743 ==> 6a080523
+#=> if itest.l *0 != 2305086a; then echo FAILURE; else echo PASS; fi
+#PASS
+#=> reset
+#
+# All temporary files used by this script are created in ./sandbox to avoid
+# polluting the source tree. test/fs/fs-test.sh also uses this directory for
+# the same purpose.
+#
+# TODO: Integrate this (and many other corner-cases e.g. different types of
+# FAT) with fs-test.sh so that a single script tests everything filesystem-
+# related.
+
+odir=sandbox
+img=${odir}/fat-noncontig.img
+mnt=${odir}/mnt
+fill=/dev/urandom
+testfn=noncontig.img
+mnttestfn=${mnt}/${testfn}
+crcaddr=0
+loadaddr=1000
+
+for prereq in fallocate mkfs.fat dd crc32; do
+if [ ! -x "`which $prereq`" ]; then
+echo "Missing $prereq binary. Exiting!"
+exit 1
+fi
+done
+
+make O=${odir} -s sandbox_defconfig && make O=${odir} -s -j8
+
+mkdir -p ${mnt}
+if [ ! -f ${img} ]; then
+fallocate -l 40M ${img}
+mkfs.fat ${img}
+
+sudo mount -o loop,uid=$(id -u) ${img} ${mnt}
+
+for ((sects=8; sects < 512; sects += 8)); do
+fn=${mnt}/keep-${sects}.img
+dd if=${fill} of=${fn} bs=512 count=${sects} >/dev/null 2>&1
+fn=${mnt}/remove-${sects}.img
+dd if=${fill} of=${fn} bs=512 count=${sects} >/dev/null 2>&1
+done
+
+rm -f ${mnt}/remove-*.img
+
+# 511 deliberately to trigger a file size that's not a multiple of the
+# sector size (ignoring sizes that are multiples of both).
+dd if=${fill} of=${mnttestfn} bs=511 >/dev/null 2>&1
+
+sudo umount ${mnt}
+fi
+
+sudo mount -o ro,loop,uid=$(id -u) ${img} ${mnt}
+crc=0x`crc32 ${mnttestfn}`
+sudo umount ${mnt}
+
+crc=`printf %02x%02x%02x%02x \
+$((${crc} & 0xff)) \
+$(((${crc} >> 8) & 0xff)) \
+$(((${crc} >> 16) & 0xff)) \
+$((${crc} >> 24))`
+
+./sandbox/u-boot << EOF
+host bind 0 ${img}
+load host 0:0 ${loadaddr} ${testfn}
+crc32 ${loadaddr} \$filesize ${crcaddr}
+if itest.l *${crcaddr} != ${crc}; then echo FAILURE; else echo PASS; fi
+reset
+EOF
-- 
1.9.1

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


[U-Boot] [PATCH V2 3/3] fs-test.sh: fix pre-requisite detection

2015-10-03 Thread Stephen Warren
In the following snippet:

if [ ! -x `which $prereq` ]; then

When $prereq does not exist, `which $prereq` evaluates to the empty string,
which results in *no* argument being passed to the -x operator, which then
evaluates to true, which is the equivalent of the prereq having been found. In
order for this to fail as expected, we must pass an empty argument, which then
causes -x to fail. Do this by wrapping the `` in quotes so there's always an
argument to -x, even if the value of the argument is zero-length.

Signed-off-by: Stephen Warren 
---
v2: New patch.
---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index b88a67ca066d..a4200964355e 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -58,7 +58,7 @@ GB2p5="${MOUNT_DIR}/${BIG_FILE}"
 # Check if the prereq binaries exist, or exit
 function check_prereq() {
for prereq in $PREREQ_BINS; do
-   if [ ! -x `which $prereq` ]; then
+   if [ ! -x "`which $prereq`" ]; then
echo "Missing $prereq binary. Exiting!"
exit
fi
-- 
1.9.1

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


[U-Boot] [PATCH V2 1/3] itest: make memory access work under sandbox

2015-10-03 Thread Stephen Warren
itest accesses memory, and hence must map/unmap it. Without doing so, it
accesses invalid addresses and crashes.

Signed-off-by: Stephen Warren 
Reviewed-by: Simon Glass 
---
v2: No change.
---
 common/cmd_itest.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index 76af62b46ee2..596341c9635a 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -15,6 +15,9 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #define EQ 0
 #define NE 1
@@ -49,16 +52,24 @@ static const op_tbl_t op_table [] = {
 static long evalexp(char *s, int w)
 {
long l = 0;
-   long *p;
+   unsigned long addr;
+   void *buf;
 
/* if the parameter starts with a * then assume is a pointer to the 
value we want */
if (s[0] == '*') {
-   p = (long *)simple_strtoul([1], NULL, 16);
+   addr = simple_strtoul([1], NULL, 16);
+   buf = map_physmem(addr, w, MAP_WRBACK);
+   if (!buf) {
+   puts("Failed to map physical memory\n");
+   return 0;
+   }
switch (w) {
-   case 1: return((long)(*(unsigned char *)p));
-   case 2: return((long)(*(unsigned short *)p));
-   case 4: return(*p);
+   case 1: l = (long)(*(unsigned char *)buf);
+   case 2: l = (long)(*(unsigned short *)buf);
+   case 4: l = (long)(*(unsigned long *)buf);
}
+   unmap_physmem(buf, w);
+   return l;
} else {
l = simple_strtoul(s, NULL, 16);
}
-- 
1.9.1

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


Re: [U-Boot] [PATCHv2] Add support for LZ4 decompression algorithm

2015-10-03 Thread Simon Glass
Hi Julius,

On 3 October 2015 at 06:32, Julius Werner  wrote:
> This patch adds support for LZ4-compressed FIT image contents. This
> algorithm has a slightly worse compression ration than LZO while being
> nearly twice as fast to decompress. When loading images from a fast
> storage medium this usually results in a boot time win.
>
> Compile-tested only since I don't have a U-Boot development system set
> up right now. The code was imported unchanged from coreboot where it's
> proven to work, though. I'm mostly interested in getting this recognized
> by mkImage for use in a downstream project.
>
> Signed-off-by: Julius Werner 
> ---
>  common/bootm.c |   9 ++
>  common/image.c |   1 +
>  include/common.h   |   3 +
>  include/image.h|   1 +
>  lib/Kconfig|  18 
>  lib/Makefile   |   1 +
>  lib/lz4.c  | 243 
> +
>  lib/lz4_wrapper.c  | 137 ++
>  test/Kconfig   |   1 +
>  test/compression.c |  57 +
>  10 files changed, 471 insertions(+)
>  create mode 100644 lib/lz4.c
>  create mode 100644 lib/lz4_wrapper.c

Actually you should enable the option in configs/sandbox_defconfig,
not lib/Kconfig. See the condition used by compression.c:

obj-$(CONFIG_SANDBOX) += compression.o

Also, for me the test fails:

./b/sandbox/u-boot -c "ut_compression"
...
 testing lz4 ...
orig_size:350
compressed_size:276
uncompressed_size:350
compress does not overrun
Failed: ret != 0
 lz4: FAILED
ut_compression FAILED

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


[U-Boot] Please pull u-boot-rockchip.git

2015-10-03 Thread Simon Glass
Hi Tom,

A few final bug fixes.


The following changes since commit 996ec1dcc58a34b53891acde0ec5df9141b5fcc2:

  Merge branch 'master' of git://git.denx.de/u-boot-fdt (2015-10-03
10:48:06 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-rockchip.git

for you to fetch changes up to b1f492ca9e0c090209824ff36456d4f131843190:

  rockchip: Reconfigure the malloc based to point to system memory
(2015-10-03 10:24:33 -0600)


Masahiro Yamada (1):
  serial: rockchip: make ROCKCHIP_SERIAL depend on ARCH_ROCKCHIP

Sjoerd Simons (1):
  rockchip: Reconfigure the malloc based to point to system memory

 arch/arm/mach-rockchip/board-spl.c | 7 +++
 drivers/serial/Kconfig | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH] sandbox: Correct operaion of 'reset' command

2015-10-03 Thread Stephen Warren
On 10/03/2015 11:21 AM, Simon Glass wrote:
> Currently 'reset' only works with the test device tree. When run without a
> device tree, or with the normal device tree, the following error is
> displayed:
> 
>Reset not supported on this platform
> 
> Fix the driver and the standard device tree to avoid this.

Tested-by: Stephen Warren 

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


Re: [U-Boot] [PATCH V3 1/4] drivers: Introduce a simplified remoteproc framework

2015-10-03 Thread Simon Glass
On 1 October 2015 at 23:49, Simon Glass  wrote:
> Acked-by: Simon Glass 

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/4] remoteproc: Introduce a sandbox dummy driver

2015-10-03 Thread Simon Glass
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 3/4] sandbox: Introduce dummy remoteproc nodes

2015-10-03 Thread Simon Glass
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 5/5] sbc8641d: enable and test CONFIG_SYS_GENERIC_BOARD

2015-10-03 Thread Masahiro Yamada
Hi.


2015-09-02 23:05 GMT+09:00 Simon Glass :
> Hi Paul,
>
> On 2 September 2015 at 07:37, Paul Gortmaker
>  wrote:
>> On 2015-09-01 10:08 PM, York Sun wrote:
>>>
>>>
>>> On 08/24/2015 12:26 PM, Paul Gortmaker wrote:
 Tested on commit 3ea0953d36023d7e50fb00b2e258d8fb2828aeac
 ("dm: Move pre-reloc init earlier to cope with board_early_init_f()")
 since the commit after that ("Set up stdio earlier when using driver
 model") hangs this board at "Net:" init, just like it hangs the
 sbc8548 board[1].  So, until that is resolved, this will be the
 newest functional baseline for both boards.

>>> Paul,
>>>
>>> I can't test this patch. As the commit message said, it only works on an 
>>> ancient
>>> point. Even this patch is merged, you can use the top of tree anyway. Is 
>>> there
>>> any effort to find out why it is broken?
>>
>> Well, I was hoping to get more detailed suggestions from folks here,
>> now that we know it is not board specific and probably breaks a lot
>> of the older freescale boards - both the sbc8548 and sbc8641d were
>> close derivatives of their MPC8548CDS and HPCNET/8641D cousins, but
>> just targeting a smaller form factor.  I'm betting they are dead too.
>>
>> Maybe now that we know that, Simon [added to CC] can offer some more
>> detailed suggestions on what is going on, since I bisected it back
>> to his commit relating to uart init.
>>
>> http://marc.info/?l=u-boot=142715170512534
>>
>> I can test incremental changes on top of that last working baseline
>> easily enough, since the board has redundant flash (which let me
>> get that far).  But currently I've no clue where to start, since
>> the uart init breaking net init, or leaving a booby-trap such that
>> touching the net device hangs - doesn't really point to an obvious
>> starting point to test.  :(
>
> I don't have any good ideas, you could try these (with reference to my
> commit 294b91a5):
>
> 1. Move the initr_barrier()...initr_dm() code sequence back to its
> original place below initr_w83c553f(), and see if that fixes it. Then
> progressively move it earlier until you see a breakage.
>
> 2. Add another initr_barrier() in the original place
>
> 3. Comment out initr_dm()
>
> Since you are presumably not using driver model for serial yet you
> should be able to fiddling things around quite a bit without breaking
> anything. Once you narrow it down a fix may be obvious, or may need a
> bit of thought.
>


Any plan about this patch?

I think this is the last non-generic board for PowerPC architecture.

This board is still keeping us from removing arch/powerpc/lib/board.c



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


Re: [U-Boot] How do I tell buildman to use a /specific/ toolchain?

2015-10-03 Thread Stephen Warren
On 10/03/2015 08:30 AM, Simon Glass wrote:
> Hi Stephen,
> 
> On 2 October 2015 at 00:27, Stephen Warren  wrote:
>> On 10/01/2015 04:59 PM, Simon Glass wrote:
>>>
>>> Hi Stephen,
>>>
>>> On Wednesday, 23 September 2015, Stephen Warren 
>>> wrote:


 Simon,

 I have 3 different ARM toolchains installed into /usr/bin via distro
 packages. How do I tell buildman which of those to use?

 I had originally thought that ~/.buildman's [toolchain] section contained
 CROSS_COMPILE-like values, so I tried:

> [toolchain]
> root: /
> arm0-not-installed: arm-none-gnueabi-
> arm1: arm-none-eabi-
> arm2: arm-linux-gnueabihf-
> arm3: arm-linux-gnueabi-
> arch64: aarch64-linux-gnu-
>
> [toolchain-alias]
> arm: arm1
> aarch64: aarch64



 (I intended to change the "arm: arm1" line to point at arm1/2/3 based on
 which I wanted to use at a particular time).

 However, running "buildman --list-toolchains" and re-reading the docs
 shows me that the [toolchain] values are absolute directories that buildman
 searches for files named *-gcc:

> - scanning path 'arm-none-gnueabi-'
>- looking in 'arm-none-gnueabi-/.'
>- looking in 'arm-none-gnueabi-/bin'
>- looking in 'arm-none-gnueabi-/usr/bin'



 If buildman finds multiple toolchains, there doesn't seem to be a way to
 tell it which one to use. Am I missing something?

 I suppose a solution wouuld be to move the compiler binaries into
 different separate directories, and only list one of those directories in
 ~/.buildman. However, I can't do that for distro-packaged toolchains (well,
 I suppose I could manually mv everything all over the place, but that's
 really fragile since it'd break any time the package got upgraded or 
 removed
 and re-installed).

 I think it makes sense to add new syntax into ~/.buildman to specify
 "don't do automagical searching, just use this CROSS_COMPILE value that I
 say". Does that sound reasonable? Automagic stuff makes for great defaults,
 but if it can't be overridden, it sucks when you actually know what you
 want.
>>>
>>>
>>> Yes I think it would be fine to add an option to use CROSS_COMPILE (of
>>> course it would fail if you tried to build the board with the wrong
>>> arch).
>>
>>
>> I wasn't necessarily looking for buildman to pick up the CROSS_COMPILE
>> environment variable, although that would be a simple solution for
>> single-arch builds at least. My mention of CROSS_COMPILE immediately above
>> was re: using values that are formatted in the same way as the CROSS_COMPILE
>> environment variable would be, rather than directory names, in the config
>> file. In other words, the example content I showed above.
>>
>>> The option other option at present is -G which lets you use multiple
>>> .buildman files. You could have one of these for each toolchain.
>>
>>
>> I don't think that gets me what I want. As far as I can tell, the buildman
>> config file contains a list directories to search within, yet if I have 3
>> toolchains in a single directory, there's no way to select which one I want
>> to use, is there?
>>
>> In other words, a config file that contains:
>>
>> [toolchain]
>> distro-packages: /usr/bin
>>
>> ... finds the following toolchains:
>>
>> [swarren@swarren-lx1 u-boot]$ ./tools/buildman/buildman \
>> --list-tool-chains
>> Scanning for tool chains
>>- scanning path '/usr/bin'
>>   - looking in '/usr/bin/.'
>>  - found '/usr/bin/./arm-linux-gnueabi-gcc'
>>  - found '/usr/bin/./arm-linux-gnueabihf-gcc'
>>  - found '/usr/bin/./arm-none-eabi-gcc'
>> (That's 3 AArch32 toolchains found)
>>  - found '/usr/bin/./winegcc'
>>  - found '/usr/bin/./aarch64-linux-gnu-gcc'
>>  - found '/usr/bin/./gcc'
>>  - found '/usr/bin/./c89-gcc'
>>  - found '/usr/bin/./x86_64-linux-gnu-gcc'
>>  - found '/usr/bin/./i586-mingw32msvc-gcc'
>>  - found '/usr/bin/./c99-gcc'
>>   - looking in '/usr/bin/bin'
>>   - looking in '/usr/bin/usr/bin'
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> Tool chain test:  OK
>> List of available toolchains (7):
>> aarch64   : /usr/bin/./aarch64-linux-gnu-gcc
>> arm   : /usr/bin/./arm-linux-gnueabi-gcc
>> (Buildman chose that one, and I think I have no control over that?)
>> c89   : /usr/bin/./c89-gcc
>> c99   : /usr/bin/./c99-gcc
>> i586  : /usr/bin/./i586-mingw32msvc-gcc
>> sandbox   : /usr/bin/./winegcc
>> x86_64: /usr/bin/./x86_64-linux-gnu-gcc
> 
> I wonder if we need an option to specify the full path and avoid the search?
> 
> Maybe 

Re: [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names

2015-10-03 Thread Hans de Goede

Hi,

On 03-10-15 16:32, Chen-Yu Tsai wrote:

On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede  wrote:

Stop prefixing the axp functions for setting voltages, etc. with the
model number, there ever is only one pmic driver built into u-boot,
this allows simplifying the callers.


Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
a subset of their LDOs share the same name, which would be a problem.


My plan for that is to use a different function name for the ldo-s
on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
somesuch. Actually this patch should help adding support for the
other pmics since it will make it less of an #ifdef fest.

Regards,

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


Re: [U-Boot] [PATCH] Don't wrap to negative after 2G sectors

2015-10-03 Thread Fabio Estevam
On Sat, Oct 3, 2015 at 5:58 PM, Stefan Monnier  wrote:
> I haven't received any answer from anyone about my patch.
> What am I doing wrong?

I would suggest you to resend it and put Tom Rini on Cc.

Also, a commit log is always useful.

Regards,

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


  1   2   >