Re: [U-Boot] [PATCH 1/6] usb: dwc2: Add support for v3 snpsid value

2015-05-13 Thread Peter Griffin
Hi Marek,

On Tue, 12 May 2015, Marek Vasut wrote:

 On Tuesday, May 12, 2015 at 03:38:27 PM, Peter Griffin wrote:
  This has been tested to the extent that I can enumerate
  a asix usb networking adapter and boot a kernel over usb
  on the 96boards hikey u-boot port I'm currently doing.
  
  Signed-off-by: Peter Griffin peter.grif...@linaro.org
  ---
   drivers/usb/host/dwc2.c | 3 ++-
   drivers/usb/host/dwc2.h | 1 +
   2 files changed, 3 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
  index e8142ac..19a6007 100644
  --- a/drivers/usb/host/dwc2.c
  +++ b/drivers/usb/host/dwc2.c
  @@ -1015,7 +1015,8 @@ int usb_lowlevel_init(int index, enum usb_init_type
  init, void **controller) snpsid = readl(regs-gsnpsid);
  printf(Core Release: %x.%03x\n, snpsid  12  0xf, snpsid  0xfff);
  
  -   if ((snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx) {
  +   if ((snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx 
  +   (snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_3xx) {
 
 Isn't this then a DWC3 controller instead ?

No I don't believe so. dwc3 is a usb3 controller with different register set 
AFAIK.

I believe this piece of code is replicating what the Linux
driver does here: -

http://lxr.free-electrons.com/source/drivers/usb/dwc2/core.c#L2664

Also see here for the various different sub core revisions within 2.xx and 3.xx
which are supported by the dwc2 Linux driver
http://lxr.free-electrons.com/source/drivers/usb/dwc2/core.h#L625.

This also matches up with the available datasheet here
https://github.com/96boards/documentation/blob/master/hikey/
Hi6220V100_Multi-Mode_Application_Processor_Function_Description.pdf on page 219
which states it is a USB2 OTG controller, but near the bottom of the page also
tates: -

The USB core used in Hi6220 is build from Synopsys IP(3.00a)..

I just checked through the DWC_otg_databook.odf, and these revision numbers 
also match up
with the Revision History changes in the document. So it all ties together.

It is worth highlighting at this point that not bailing here (along with 
setting up
the appropriate clocks to the IP) was enough for me to get a DWC2 core rev 
3.00a 
enumerating a ASIX networking adapter and tftp a kernel into DDR. However there 
maybe
some other changes required to fully support the 3.00a hardware version. 
There is of
course the problem I mentioned in the cover letter regarding enumerating mass 
storage
devices which may or may not be related to this.

Although a quick grep of the Linux driver only gets three hits

git grep DWC2_CORE_REV_3_00a
core.h:#define DWC2_CORE_REV_3_00a  0x4f54300a
core_intr.c:if (hsotg-hw_params.snpsid = DWC2_CORE_REV_3_00a)
hcd.c:  if (hsotg-hw_params.snpsid = DWC2_CORE_REV_3_00a) {

Neither of which seem relevant to the mass storage device problem (one adds a 
delay in
the irq handler, and the other sets a bit when freeing the hcd.

kind regards,

Peter.



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


[U-Boot] [PATCH v2] arc: use more universal prefix for default CROSS_COMPILE

2015-05-13 Thread Masahiro Yamada
As doc/README.ARC says, pre-build ARC toolchains are available at
the Synopsys GitHub page.

The bin files are prefixed with arc(eb)-buildroot-linux- for earlier
releases, but with arc(eb)-snps-linux- for the latest releases.

The symbolic links prefixed with arc(eb)-linux- are also available
for all the release, so those prefixes can be used as the default
CROSS_COMPILE regardless of the toolchains version/variants.

Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
---

Changes in v2:
  - Use arc(eb)-linux- rather than arc(eb)-linux-uclibc-

 arch/arc/config.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index 04c034b..74943d9 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -11,13 +11,13 @@ CONFIG_SYS_BIG_ENDIAN = 1
 endif
 
 ifdef CONFIG_SYS_LITTLE_ENDIAN
-ARC_CROSS_COMPILE := arc-buildroot-linux-uclibc-
+ARC_CROSS_COMPILE := arc-linux-
 PLATFORM_LDFLAGS += -EL
 PLATFORM_CPPFLAGS += -mlittle-endian
 endif
 
 ifdef CONFIG_SYS_BIG_ENDIAN
-ARC_CROSS_COMPILE := arceb-buildroot-linux-uclibc-
+ARC_CROSS_COMPILE := arceb-linux-
 PLATFORM_LDFLAGS += -EB
 PLATFORM_CPPFLAGS += -mbig-endian
 endif
-- 
1.9.1

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


[U-Boot] [PATCH V2 06/13] common: cmd regulator: command cleanup

2015-05-13 Thread Przemyslaw Marczak
This commit cleanups the regulator command.
The first change, is adjusting regulator dev command to use
regulator-name constraint, for setting the operating device.
Thanks to this, the regulator_get() function is removed.

This also updates do_list() function, with loop over uclass_find_*
function calls, to prevent probe of all listed regulators.

This also cleanups the printing in command.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- none
---
 common/cmd_regulator.c | 239 +
 1 file changed, 122 insertions(+), 117 deletions(-)

diff --git a/common/cmd_regulator.c b/common/cmd_regulator.c
index b1b9e87..6149d1e 100644
--- a/common/cmd_regulator.c
+++ b/common/cmd_regulator.c
@@ -10,98 +10,70 @@
 #include dm/uclass-internal.h
 #include power/regulator.h
 
-#define LIMIT_SEQ  3
 #define LIMIT_DEVNAME  20
-#define LIMIT_OFNAME   20
-#define LIMIT_INFO 16
+#define LIMIT_OFNAME   32
+#define LIMIT_INFO 18
 
 static struct udevice *currdev;
 
-static int failed(const char *getset, const char *thing,
- const char *for_dev, int ret)
+static int failure(int ret)
 {
-   printf(Can't %s %s %s.\nError: %d (%s)\n, getset, thing, for_dev,
-   ret, errno_str(ret));
-   return CMD_RET_FAILURE;
-}
-
-static int regulator_get(bool list_only, int get_seq, struct udevice **devp)
-{
-   struct dm_regulator_uclass_platdata *uc_pdata;
-   struct udevice *dev;
-   int ret;
-
-   if (devp)
-   *devp = NULL;
-
-   for (ret = uclass_first_device(UCLASS_REGULATOR, dev); dev;
-ret = uclass_next_device(dev)) {
-   if (list_only) {
-   uc_pdata = dev_get_uclass_platdata(dev);
-   printf(|%*d | %*.*s @ %-*.*s| %s @ %s\n,
-  LIMIT_SEQ, dev-seq,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, dev-name,
-  LIMIT_OFNAME, LIMIT_OFNAME, uc_pdata-name,
-  dev-parent-name,
-  dev_get_uclass_name(dev-parent));
-   continue;
-   }
-
-   if (dev-seq == get_seq) {
-   if (devp)
-   *devp = dev;
-   else
-   return -EINVAL;
-
-   return 0;
-   }
-   }
-
-   if (list_only)
-   return ret;
+   printf(Error: %d (%s)\n, ret, errno_str(ret));
 
-   return -ENODEV;
+   return CMD_RET_FAILURE;
 }
 
 static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
struct dm_regulator_uclass_platdata *uc_pdata;
-   int seq, ret = -ENXIO;
+   const char *name;
+   int ret = -ENXIO;
 
switch (argc) {
case 2:
-   seq = simple_strtoul(argv[1], NULL, 0);
-   ret = uclass_get_device_by_seq(UCLASS_REGULATOR, seq, currdev);
-   if (ret  (ret = regulator_get(false, seq, currdev)))
-   goto failed;
+   name = argv[1];
+   ret = regulator_get_by_platname(name, currdev);
+   if (ret) {
+   printf(Can't get the regulator: %s!\n, name);
+   return failure(ret);
+   }
case 1:
+   if (!currdev) {
+   printf(Regulator device is not set!\n\n);
+   return CMD_RET_USAGE;
+   }
+
uc_pdata = dev_get_uclass_platdata(currdev);
-   if (!uc_pdata)
-   goto failed;
+   if (!uc_pdata) {
+   printf(%s: no regulator platform data!\n, 
currdev-name);
+   return failure(ret);
+   }
 
-   printf(dev: %d @ %s\n, currdev-seq, uc_pdata-name);
+   printf(dev: %s @ %s\n, uc_pdata-name, currdev-name);
}
 
return CMD_RET_SUCCESS;
-failed:
-   return failed(get, the, device, ret);
 }
 
-static int get_curr_dev_and_pl(struct udevice **devp,
-  struct dm_regulator_uclass_platdata **uc_pdata,
-  bool allow_type_fixed)
+static int curr_dev_and_platdata(struct udevice **devp,
+struct dm_regulator_uclass_platdata **uc_pdata,
+bool allow_type_fixed)
 {
*devp = NULL;
*uc_pdata = NULL;
 
-   if (!currdev)
-   return failed(get, current, device, -ENODEV);
+   if (!currdev) {
+   printf(First, set the regulator device!\n);
+   return CMD_RET_FAILURE;
+   }
 
*devp = currdev;
 
*uc_pdata = dev_get_uclass_platdata(*devp);
- 

[U-Boot] [PATCH V2 09/13] sandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulator

2015-05-13 Thread Przemyslaw Marczak
This commit adds emulation of sandbox PMIC device, which includes:
- PMIC I2C emulation driver
- PMIC I/O driver (UCLASS_PMIC)
- PMIC regulator driver (UCLASS_REGULATOR)

The sandbox PMIC has 12 significant registers and 4 as padding to 16 bytes,
which allows using 'i2c md' command with the default count (16).

The sandbox PMIC provides regulators:
- 2x BUCK
- 2x LDO

Each, with adjustable output:
- Enable state
- Voltage
- Current limit (LDO1/BUCK1 only)
- Operation mode (different for BUCK and LDO)

Each attribute has it's own register, beside the enable state, which depends
on operation mode.

The header file: sandbox_pmic.h includes PMIC's default register values,
which are set on i2c pmic emul driver's probe() method.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- pmic emul driver: get the default register settings from fdt
- cleanup of sandbox_pmic.h
---
 doc/device-tree-bindings/pmic/sandbox.txt  |  35 +++
 doc/device-tree-bindings/regulator/sandbox.txt |  45 
 drivers/power/pmic/Kconfig |  25 ++
 drivers/power/pmic/Makefile|   3 +-
 drivers/power/pmic/i2c_pmic_emul.c | 142 ++
 drivers/power/pmic/sandbox.c   |  79 ++
 drivers/power/regulator/Kconfig|  30 +++
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/sandbox.c  | 355 +
 include/power/sandbox_pmic.h   | 105 
 10 files changed, 819 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/pmic/sandbox.txt
 create mode 100644 doc/device-tree-bindings/regulator/sandbox.txt
 create mode 100644 drivers/power/pmic/i2c_pmic_emul.c
 create mode 100644 drivers/power/pmic/sandbox.c
 create mode 100644 drivers/power/regulator/sandbox.c
 create mode 100644 include/power/sandbox_pmic.h

diff --git a/doc/device-tree-bindings/pmic/sandbox.txt 
b/doc/device-tree-bindings/pmic/sandbox.txt
new file mode 100644
index 000..d84c977
--- /dev/null
+++ b/doc/device-tree-bindings/pmic/sandbox.txt
@@ -0,0 +1,35 @@
+Sandbox pmic
+
+This device uses two drivers:
+- drivers/power/pmic/sandbox.c (for parent device)
+- drivers/power/regulator/sandbox.c (for child regulators)
+
+This file describes the binding info for the PMIC driver.
+
+To bind the regulators, please read the regulator binding info:
+- doc/device-tree-bindings/regulator/sandbox.txt
+
+Required PMIC node properties:
+- compatible: sandbox,pmic
+- reg = 0x40
+
+Required PMIC's emul subnode,  with property:
+- compatible: sandbox,i2c-pmic
+
+With the above properties, the pmic device can be used for read/write only.
+To bind each regulator, the optional regulator subnodes should exists.
+
+Optional subnodes:
+- ldo/buck subnodes of each device's regulator (see regulator binding info)
+
+Example:
+
+sandbox_pmic {
+   compatible = sandbox,pmic;
+   reg = 0x40;
+
+   /* Mandatory for I/O */
+   emul {
+   compatible = sandbox,i2c-pmic;
+   };
+};
diff --git a/doc/device-tree-bindings/regulator/sandbox.txt 
b/doc/device-tree-bindings/regulator/sandbox.txt
new file mode 100644
index 000..d70494c
--- /dev/null
+++ b/doc/device-tree-bindings/regulator/sandbox.txt
@@ -0,0 +1,45 @@
+Sandbox, PMIC regulators
+
+This device uses two drivers:
+- drivers/power/pmic/sandbox.c (as parent I/O device)
+- drivers/power/regulator/sandbox.c (for child regulators)
+
+This file describes the binding info for the REGULATOR driver.
+
+First, please read the binding info for the PMIC:
+- doc/device-tree-bindings/pmic/sandbox.txt
+
+Required subnodes:
+- ldoN { };
+- buckN { };
+
+The sandbox PMIC can support: ldo1, ldo2, buck1, buck2.
+
+For each PMIC's regulator subnode, there is one required property:
+- regulator-name: used for regulator uclass platform data '.name'
+
+Optional:
+- regulator-min-microvolt: minimum allowed Voltage to set
+- regulator-max-microvolt: minimum allowed Voltage to set
+- regulator-min-microamps: minimum allowed Current limit to set (LDO1/BUCK1)
+- regulator-max-microamps: minimum allowed Current limit to set (LDO1/BUCK1)
+- regulator-always-on: regulator should be never disabled
+- regulator-boot-on: regulator should be enabled by the bootloader
+
+Example PMIC's regulator subnodes:
+
+ldo1 {
+   regulator-name = VDD_1.0V;
+   regulator-min-microvolt = 100;
+   regulator-max-microvolt = 120;
+   regulator-min-microamps = 10;
+   regulator-max-microamps = 40;
+   regulator-always-on;
+};
+
+buck2 {
+   regulator-name = VDD_1.8V;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   regulator-boot-on;
+};
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index d99d9e3..164f421 100644
--- a/drivers/power/pmic/Kconfig
+++ 

[U-Boot] [PATCH V2 07/13] doc: driver-model: pmic-framework.txt - cleanup

2015-05-13 Thread Przemyslaw Marczak
This commit cleanups the PMIC framework documentation.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- none
---
 doc/driver-model/pmic-framework.txt | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/doc/driver-model/pmic-framework.txt 
b/doc/driver-model/pmic-framework.txt
index cc82236..95b1a66 100644
--- a/doc/driver-model/pmic-framework.txt
+++ b/doc/driver-model/pmic-framework.txt
@@ -79,7 +79,7 @@ use pmic read/write directly.
 
 3. Pmic uclass
 ==
-The basic informations:
+The basic information:
 * Uclass:   'UCLASS_PMIC'
 * Header:   'include/power/pmic.h'
 * Core: 'drivers/power/pmic/pmic-uclass.c'
@@ -88,14 +88,13 @@ The basic informations:
   config:   'CONFIG_CMD_PMIC'
 * Example:  'drivers/power/pmic/max77686.c'
 
-This is still under the construction. So for the API description, please refer
-to the header file.
+For detailed API description, please refer to the header file.
 
 As an example of the pmic driver, please refer to the MAX77686 driver.
 
-Please pay attention for the driver's '.bind' method. Exactly the function 
call:
-'pmic_bind_childs()', which is used to bind the regulators by using the array 
of
-regulator's node, compatible prefixes.
+Please pay attention for the driver's bind() method. Exactly the function call:
+'pmic_bind_children()', which is used to bind the regulators by using the array
+of regulator's node, compatible prefixes.
 
 The 'pmic; command also supports the new API. So the pmic command can be 
enabled
 by adding CONFIG_CMD_PMIC.
@@ -108,11 +107,11 @@ The new pmic command allows to:
 This command can use only UCLASS_PMIC devices, since this uclass is designed
 for pmic I/O operations only.
 
-For more informations, please refer to the file: 'common/cmd_pmic.c'.
+For more information, please refer to the core file.
 
 4. Regulator uclass
 ===
-The basic informations:
+The basic information:
 * Uclass:  'UCLASS_REGULATOR'
 * Header:  'include/power/regulator.h'
 * Core:'drivers/power/regulator/regulator-uclass.c'
@@ -125,8 +124,7 @@ The basic informations:
 * Example: 'drivers/power/regulator/fixed.c'
   config  'CONFIG_DM_REGULATOR_FIXED'
 
-This is still under the construction. So for the API description, please refer
-to the header file.
+For detailed API description, please refer to the header file.
 
 For the example regulator driver, please refer to the MAX77686 regulator 
driver,
 but this driver can't operate without pmic's example driver, which provides an
@@ -139,4 +137,4 @@ The 'regulator' command also supports the new API. The 
command allow:
 - choose the current device (like the mmc command)
 - do all regulator-specific operations
 
-For more informations, please refer to the file: 'common/cmd_regulator.c'
+For more information, please refer to the command file.
-- 
1.9.1

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


[U-Boot] [PATCH V2 01/13] odroid: dts: add 'voltage-regulators' description to max77686 node

2015-05-13 Thread Przemyslaw Marczak
Adding regulators subnode to fdt max77686 node, allows properly init
regulators by the max77686 regulator driver. This enables the complete
functionality of the regulator command.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
 arch/arm/dts/exynos4412-odroid.dts | 253 +
 1 file changed, 253 insertions(+)

diff --git a/arch/arm/dts/exynos4412-odroid.dts 
b/arch/arm/dts/exynos4412-odroid.dts
index 5507d9a..415dfea 100644
--- a/arch/arm/dts/exynos4412-odroid.dts
+++ b/arch/arm/dts/exynos4412-odroid.dts
@@ -40,6 +40,259 @@
interrupts = 7 0;
reg = 0x09 0 0;
#clock-cells = 1;
+
+   voltage-regulators {
+   ldo1_reg: ldo1 {
+   regulator-compatible = LDO1;
+   regulator-name = VDD_ALIVE_1.0V;
+   regulator-min-microvolt = 100;
+   regulator-max-microvolt = 100;
+   };
+
+   ldo2_reg: ldo2 {
+   regulator-compatible = LDO2;
+   regulator-name = VDDQ_VM1M2_1.2V;
+   regulator-min-microvolt = 120;
+   regulator-max-microvolt = 120;
+   };
+
+   ldo3_reg: ldo3 {
+   regulator-compatible = LDO3;
+   regulator-name = VCC_1.8V_AP;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   };
+
+   ldo4_reg: ldo4 {
+   regulator-compatible = LDO4;
+   regulator-name = VDDQ_MMC2_2.8V;
+   regulator-min-microvolt = 280;
+   regulator-max-microvolt = 280;
+   };
+
+   ldo5_reg: ldo5 {
+   regulator-compatible = LDO5;
+   regulator-name = VDDQ_MMC0/1/3_1.8V;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   };
+
+   ldo6_reg: ldo6 {
+   regulator-compatible = LDO6;
+   regulator-name = VMPLL_1.0V;
+   regulator-min-microvolt = 110;
+   regulator-max-microvolt = 110;
+   };
+
+   ldo7_reg: ldo7 {
+   regulator-compatible = LDO7;
+   regulator-name = VPLL_1.1V;
+   regulator-min-microvolt = 110;
+   regulator-max-microvolt = 110;
+   };
+
+   ldo8_reg: ldo8 {
+   regulator-compatible = LDO8;
+   regulator-name = VDD_MIPI/HDMI_1.0V;
+   regulator-min-microvolt = 100;
+   regulator-max-microvolt = 100;
+   };
+
+   ldo9_reg: ldo9 {
+   regulator-compatible = LDO9;
+   regulator-name = nc;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   };
+
+   ldo10_reg: ldo10 {
+   regulator-compatible = LDO10;
+   regulator-name = VDD_MIPI/HDMI_1.8V;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   };
+
+   ldo11_reg: ldo11 {
+   regulator-compatible = LDO11;
+   regulator-name = VDD_ABB1_1.8V;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   };
+
+   ldo12_reg: ldo12 {
+ 

[U-Boot] [PATCH V2 04/13] dm: regulator: uclass driver code cleanup

2015-05-13 Thread Przemyslaw Marczak
This cleanup includes:
- remove of the preprocessor macros which pointed to long name functions
- update of the names of some regulator uclass driver functions
- cleanup of the function regulator_autoset()
- reword of some comments of regulator uclass header file
- regulator_get_by_platname: check error for uclass_find_* function calls
- add function: regulator_name_is_unique
- regulator post_bind(): check regulator name uniqueness
- fix mistakes in: regulator/Kconfig
- regulator.h: update comments
- odroid u3: cleanup the regulator calls

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- odroid u3: cleanup the regulator calls
---
 board/samsung/odroid/odroid.c  |   9 +--
 drivers/power/regulator/Kconfig|   2 +-
 drivers/power/regulator/regulator-uclass.c | 104 +-
 include/power/regulator.h  | 116 +++--
 4 files changed, 132 insertions(+), 99 deletions(-)

diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 29de325..32155f1 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -37,6 +37,7 @@ static const char *mmc_regulators[] = {
VDDQ_EMMC_1.8V,
VDDQ_EMMC_2.8V,
TFLASH_2.8V,
+   NULL,
 };
 
 void set_board_type(void)
@@ -427,9 +428,7 @@ int exynos_init(void)
 
 int exynos_power_init(void)
 {
-   int list_count = ARRAY_SIZE(mmc_regulators);
-
-   if (regulator_list_autoset(mmc_regulators, list_count, NULL, true))
+   if (regulator_list_autoset(mmc_regulators, NULL, true))
error(Unable to init all mmc regulators);
 
return 0;
@@ -441,7 +440,7 @@ static int s5pc210_phy_control(int on)
struct udevice *dev;
int ret;
 
-   ret = regulator_by_platname(VDD_UOTG_3.0V, dev);
+   ret = regulator_get_by_platname(VDD_UOTG_3.0V, dev);
if (ret) {
error(Regulator get error: %d, ret);
return ret;
@@ -487,7 +486,7 @@ int board_usb_init(int index, enum usb_init_type init)
/* Power off and on BUCK8 for LAN9730 */
debug(LAN9730 - Turning power buck 8 OFF and ON.\n);
 
-   ret = regulator_by_platname(VCC_P3V3_2.85V, dev);
+   ret = regulator_get_by_platname(VCC_P3V3_2.85V, dev);
if (ret) {
error(Regulator get error: %d, ret);
return ret;
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 54ce188..fd3cf35 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -14,7 +14,7 @@ config DM_REGULATOR
It's important to call the device_bind() with the proper node offset,
when binding the regulator devices. The pmic_bind_childs() can be used
for this purpose if PMIC I/O driver is implemented or dm_scan_fdt_node()
-   otherwise. Detailed informations can be found in the header file.
+   otherwise. Detailed information can be found in the header file.
 
 config DM_REGULATOR_MAX77686
bool Enable Driver Model for REGULATOR MAX77686
diff --git a/drivers/power/regulator/regulator-uclass.c 
b/drivers/power/regulator/regulator-uclass.c
index 07ce286..31ffd44 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -108,16 +108,19 @@ int regulator_set_mode(struct udevice *dev, int mode)
return ops-set_mode(dev, mode);
 }
 
-int regulator_by_platname(const char *plat_name, struct udevice **devp)
+int regulator_get_by_platname(const char *plat_name, struct udevice **devp)
 {
struct dm_regulator_uclass_platdata *uc_pdata;
struct udevice *dev;
+   int ret;
 
*devp = NULL;
 
-   for (uclass_find_first_device(UCLASS_REGULATOR, dev);
-dev;
-uclass_find_next_device(dev)) {
+   for (ret = uclass_find_first_device(UCLASS_REGULATOR, dev); dev;
+ret = uclass_find_next_device(dev)) {
+   if (ret)
+   continue;
+
uc_pdata = dev_get_uclass_platdata(dev);
if (!uc_pdata || strcmp(plat_name, uc_pdata-name))
continue;
@@ -130,12 +133,12 @@ int regulator_by_platname(const char *plat_name, struct 
udevice **devp)
return -ENODEV;
 }
 
-int regulator_by_devname(const char *devname, struct udevice **devp)
+int regulator_get_by_devname(const char *devname, struct udevice **devp)
 {
return uclass_get_device_by_name(UCLASS_REGULATOR, devname, devp);
 }
 
-static int setting_failed(int ret, bool verbose, const char *fmt, ...)
+static int failed(int ret, bool verbose, const char *fmt, ...)
 {
va_list args;
char buf[64];
@@ -157,19 +160,18 @@ static int setting_failed(int ret, bool verbose, const 
char *fmt, ...)
return ret;
 }
 
-int 

[U-Boot] [PATCH V2 10/13] test: dm: add sandbox PMIC framework tests

2015-05-13 Thread Przemyslaw Marczak
This change adds new file to sandbox driver model test environment.
The file is: test/dm/power.c, and it includes tests for PMIC framework,
which includes PMIC uclass and REGULATOR uclass.

All tests are based od Sandbox PMIC emulated device. Some test constants for
this device are defined in the header: include/power/sandbox_pmic.h

PMIC tests includes:
- pmic get - tests, that pmic_get() returns the requested device
- pmic I/O - tests I/O by writing and reading some values to PMIC's registers
 and then compares, that the write/read values are equal.

The regulator tests includes:
- Regulator get by devname/platname
- Voltage set/get
- Current set/get
- Enable set/get
- Mode set/get
- Autoset
- List autoset

For the regulator 'get' test, the returned device pointers are compared,
and their names are also compared to the requested one.
Every other test, first sets the given attribute and next try to get it.
The test pass, when the set/get values are equal.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- test: dm: split power.c into pmic.c and regulator.c
- regulator tests: cleanup
---
 include/power/sandbox_pmic.h |  33 +
 test/dm/Makefile |   2 +
 test/dm/pmic.c   |  69 +
 test/dm/regulator.c  | 325 +++
 4 files changed, 429 insertions(+)
 create mode 100644 test/dm/pmic.c
 create mode 100644 test/dm/regulator.c

diff --git a/include/power/sandbox_pmic.h b/include/power/sandbox_pmic.h
index f317c3a..ae14292 100644
--- a/include/power/sandbox_pmic.h
+++ b/include/power/sandbox_pmic.h
@@ -102,4 +102,37 @@ enum {
 /* Operation mode id - register value conversion */
 #define OM2REG(x)  (x)
 
+/* Test data for: test/dm/power.c */
+
+/* BUCK names */
+#define SANDBOX_BUCK1_DEVNAME  buck1
+#define SANDBOX_BUCK1_PLATNAME SUPPLY_1.2V
+#define SANDBOX_BUCK2_DEVNAME  buck2
+#define SANDBOX_BUCK2_PLATNAME SUPPLY_3.3V
+/* LDO names */
+#define SANDBOX_LDO1_DEVNAME   ldo1
+#define SANDBOX_LDO1_PLATNAME  VDD_EMMC_1.8V
+#define SANDBOX_LDO2_DEVNAME   ldo2
+#define SANDBOX_LDO2_PLATNAME  VDD_LCD_3.3V
+
+/*
+ * Expected regulators setup after call of:
+ * - regulator_autoset()
+ * - regulator_list_autoset()
+ */
+
+/* BUCK1: for testing regulator_autoset() */
+#define SANDBOX_BUCK1_AUTOSET_EXPECTED_UV  120
+#define SANDBOX_BUCK1_AUTOSET_EXPECTED_UA  20
+#define SANDBOX_BUCK1_AUTOSET_EXPECTED_ENABLE  true
+
+/* LDO1/2 for testing regulator_list_autoset() */
+#define SANDBOX_LDO1_AUTOSET_EXPECTED_UV   180
+#define SANDBOX_LDO1_AUTOSET_EXPECTED_UA   10
+#define SANDBOX_LDO1_AUTOSET_EXPECTED_ENABLE   true
+
+#define SANDBOX_LDO2_AUTOSET_EXPECTED_UV   300
+#define SANDBOX_LDO2_AUTOSET_EXPECTED_UA   -ENOSYS
+#define SANDBOX_LDO2_AUTOSET_EXPECTED_ENABLE   false
+
 #endif
diff --git a/test/dm/Makefile b/test/dm/Makefile
index fd9e29f..444b24e 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -24,4 +24,6 @@ obj-$(CONFIG_DM_PCI) += pci.o
 obj-$(CONFIG_DM_SPI_FLASH) += sf.o
 obj-$(CONFIG_DM_SPI) += spi.o
 obj-$(CONFIG_DM_USB) += usb.o
+obj-$(CONFIG_DM_PMIC) += pmic.o
+obj-$(CONFIG_DM_REGULATOR) += regulator.o
 endif
diff --git a/test/dm/pmic.c b/test/dm/pmic.c
new file mode 100644
index 000..e9c904c
--- /dev/null
+++ b/test/dm/pmic.c
@@ -0,0 +1,69 @@
+/*
+ * Tests for the driver model pmic API
+ *
+ * Copyright (c) 2015 Samsung Electronics
+ * Przemyslaw Marczak p.marc...@samsung.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include errno.h
+#include dm.h
+#include fdtdec.h
+#include malloc.h
+#include dm/device-internal.h
+#include dm/root.h
+#include dm/ut.h
+#include dm/util.h
+#include dm/test.h
+#include dm/uclass-internal.h
+#include power/pmic.h
+#include power/sandbox_pmic.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Test PMIC get method */
+static int dm_test_power_pmic_get(struct dm_test_state *dms)
+{
+   const char *name = sandbox_pmic;
+   struct udevice *dev;
+
+   ut_assertok(pmic_get(name, dev));
+   ut_assertnonnull(dev);
+
+   /* Check PMIC's name */
+   ut_asserteq_str(name, dev-name);
+
+   return 0;
+}
+DM_TEST(dm_test_power_pmic_get, DM_TESTF_SCAN_FDT);
+
+/* Test PMIC I/O */
+static int dm_test_power_pmic_io(struct dm_test_state *dms)
+{
+   const char *name = sandbox_pmic;
+   uint8_t out_buffer, in_buffer;
+   struct udevice *dev;
+   int reg_count, i;
+
+   ut_assertok(pmic_get(name, dev));
+
+   reg_count = pmic_reg_count(dev);
+   ut_asserteq(reg_count, SANDBOX_PMIC_REG_COUNT);
+
+   /*
+* Test PMIC I/O - write and read a loop counter.
+* usually we can't write to all PMIC's registers in the real hardware,
+* but we can to the sandbox pmic.
+*/
+   for (i = 0; i  reg_count; i++) {
+   

[U-Boot] [PATCH V2 05/13] common: cmd pmic: command cleanup

2015-05-13 Thread Przemyslaw Marczak
This commit cleanups the use of function: failed().
The new function name is: failure(), and it is used
for print errno and the errno-related message only.

The second change is choosing PMIC device by it's name,
instead of seq number. Thanks to this change, for set
the current device, call of pmic_get() is enough.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- none
---
 common/cmd_pmic.c | 131 +++---
 1 file changed, 55 insertions(+), 76 deletions(-)

diff --git a/common/cmd_pmic.c b/common/cmd_pmic.c
index bd88d68..970767c 100644
--- a/common/cmd_pmic.c
+++ b/common/cmd_pmic.c
@@ -10,75 +10,41 @@
 #include dm/uclass-internal.h
 #include power/pmic.h
 
-#define LIMIT_SEQ  3
-#define LIMIT_DEVNAME  20
+#define LIMIT_DEV  32
+#define LIMIT_PARENT   20
 
 static struct udevice *currdev;
 
-static int failed(const char *getset, const char *thing,
- const char *for_dev, int ret)
+static int failure(int ret)
 {
-   printf(Can't %s %s %s.\nError: %d (%s)\n, getset, thing, for_dev,
-   ret, errno_str(ret));
-   return CMD_RET_FAILURE;
-}
-
-static int pmic_dev_get(bool list_only, int get_seq, struct udevice **devp)
-{
-   struct udevice *dev;
-   int ret;
-
-   if (devp)
-   *devp = NULL;
-
-   for (ret = uclass_first_device(UCLASS_PMIC, dev); dev;
-ret = uclass_next_device(dev)) {
-   if (list_only) {
-   printf(|%*d | %-*.*s| %-*.*s| %s @ %d\n,
-  LIMIT_SEQ, dev-seq,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, dev-name,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, dev-parent-name,
-  dev_get_uclass_name(dev-parent),
-  dev-parent-seq);
-   continue;
-   }
+   printf(Error: %d (%s)\n, ret, errno_str(ret));
 
-   if (dev-seq == get_seq) {
-   if (devp)
-   *devp = dev;
-   else
-   return -EINVAL;
-
-   return 0;
-   }
-   }
-
-   if (list_only)
-   return ret;
-
-   return -ENODEV;
+   return CMD_RET_FAILURE;
 }
 
 static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   int seq, ret = -ENODEV;
+   char *name;
+   int ret = -ENODEV;
 
switch (argc) {
case 2:
-   seq = simple_strtoul(argv[1], NULL, 0);
-   ret = uclass_get_device_by_seq(UCLASS_PMIC, seq, currdev);
-   if (ret  (ret = pmic_dev_get(false, seq, currdev)))
-   goto failed;
+   name = argv[1];
+   ret = pmic_get(name, currdev);
+   if (ret) {
+   printf(Can't get PMIC: %s!\n, name);
+   return failure(ret);
+   }
case 1:
-   if (!currdev)
-   goto failed;
+   if (!currdev) {
+   printf(PMIC device is not set!\n\n);
+   return CMD_RET_USAGE;
+   }
 
printf(dev: %d @ %s\n, currdev-seq, currdev-name);
}
 
return CMD_RET_SUCCESS;
-failed:
-   return failed(get, the, device, ret);
 }
 
 static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -86,18 +52,19 @@ static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
struct udevice *dev;
int ret;
 
-   printf(|%*s | %-*.*s| %-*.*s| %s @ %s\n,
-  LIMIT_SEQ, Seq,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, Name,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, Parent name,
+   printf(| %-*.*s| %-*.*s| %s @ %s\n,
+  LIMIT_DEV, LIMIT_DEV, Name,
+  LIMIT_PARENT, LIMIT_PARENT, Parent name,
   Parent uclass, seq);
 
for (ret = uclass_first_device(UCLASS_PMIC, dev); dev;
 ret = uclass_next_device(dev)) {
-   printf(|%*d | %-*.*s| %-*.*s| %s @ %d\n,
-  LIMIT_SEQ, dev-seq,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, dev-name,
-  LIMIT_DEVNAME, LIMIT_DEVNAME, dev-parent-name,
+   if (ret)
+   continue;
+
+   printf(| %-*.*s| %-*.*s| %s @ %d\n,
+  LIMIT_DEV, LIMIT_DEV, dev-name,
+  LIMIT_PARENT, LIMIT_PARENT, dev-parent-name,
   dev_get_uclass_name(dev-parent), dev-parent-seq);
}
 
@@ -114,8 +81,10 @@ static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
uint reg;
int ret;
 
-   if (!currdev)
-   

[U-Boot] [PATCH V2 08/13] sandbox: i2c: search child emul dev and check its uclass id

2015-05-13 Thread Przemyslaw Marczak
The function get_emul() in sandbox i2c bus driver, always returns
first child as i2c emul device. This may only work for i2c devices
with a single child, which is an only i2c emul device.

In case when i2c device has more than one child (e.g. PMIC), and
one is i2c emul, then the function should search it by check uclass
id for each child. This patch add this change to the get_emul().

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Cc: Simon Glass s...@chromium.org
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- none
---
 drivers/i2c/sandbox_i2c.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c
index d6adc0f..d4b543d 100644
--- a/drivers/i2c/sandbox_i2c.c
+++ b/drivers/i2c/sandbox_i2c.c
@@ -26,6 +26,7 @@ static int get_emul(struct udevice *dev, struct udevice 
**devp,
struct dm_i2c_ops **opsp)
 {
struct dm_i2c_chip *plat;
+   struct udevice *child;
int ret;
 
*devp = NULL;
@@ -37,9 +38,22 @@ static int get_emul(struct udevice *dev, struct udevice 
**devp,
if (ret)
return ret;
 
-   ret = device_get_child(dev, 0, plat-emul);
-   if (ret)
-   return ret;
+   for (device_find_first_child(dev, child); child;
+device_find_next_child(child)) {
+   if (device_get_uclass_id(child) != UCLASS_I2C_EMUL)
+   continue;
+
+   ret = device_probe(child);
+   if (ret)
+   return ret;
+
+   break;
+   }
+
+   if (child)
+   plat-emul = child;
+   else
+   return -ENODEV;
}
*devp = plat-emul;
*opsp = i2c_get_ops(plat-emul);
-- 
1.9.1

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


[U-Boot] [PATCH V2 03/13] dm: pmic: code cleanup of PMIC uclass driver

2015-05-13 Thread Przemyslaw Marczak
The cleanup includes:
- pmic.h - fix mistakes in a few comments
- pmic operations: value 'reg_count' - redefine as function call
- fix function name: pmic_bind_childs() - pmic_bind_children()
- pmic_bind_children: change the 'while' loop with the 'for'
- add implementation of pmic_reg_count() method
- pmic_bind_children() - update function call name
- Kconfig: add new line at the end of file
- Update MAX77686 driver code

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- cleanup of the pmic_bind_children() loop
- split with: dm: pmic: max77686: update driver code
---
 drivers/power/pmic/Kconfig   |  2 +-
 drivers/power/pmic/max77686.c| 15 ++-
 drivers/power/pmic/pmic-uclass.c | 31 +--
 include/power/pmic.h | 39 ---
 4 files changed, 40 insertions(+), 47 deletions(-)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index af68783..d99d9e3 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -15,4 +15,4 @@ config DM_PMIC_MAX77686
depends on DM_PMIC
---help---
This config enables implementation of driver-model pmic uclass features
-   for PMIC MAX77686. The driver implements read/write operations.
\ No newline at end of file
+   for PMIC MAX77686. The driver implements read/write operations.
diff --git a/drivers/power/pmic/max77686.c b/drivers/power/pmic/max77686.c
index e9503e2..3523b4a 100644
--- a/drivers/power/pmic/max77686.c
+++ b/drivers/power/pmic/max77686.c
@@ -16,12 +16,17 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct pmic_child_info pmic_childs_info[] = {
+static const struct pmic_child_info pmic_children_info[] = {
{ .prefix = ldo, .driver = MAX77686_LDO_DRIVER },
{ .prefix = buck, .driver = MAX77686_BUCK_DRIVER },
{ },
 };
 
+static int max77686_reg_count(struct udevice *dev)
+{
+   return MAX77686_NUM_OF_REGS;
+}
+
 static int max77686_write(struct udevice *dev, uint reg, const uint8_t *buff,
  int len)
 {
@@ -47,7 +52,7 @@ static int max77686_bind(struct udevice *dev)
 {
int regulators_node;
const void *blob = gd-fdt_blob;
-   int childs;
+   int children;
 
regulators_node = fdt_subnode_offset(blob, dev-of_offset,
 voltage-regulators);
@@ -59,8 +64,8 @@ static int max77686_bind(struct udevice *dev)
 
debug(%s: '%s' - found regulators subnode\n, __func__, dev-name);
 
-   childs = pmic_bind_childs(dev, regulators_node, pmic_childs_info);
-   if (!childs)
+   children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+   if (!children)
debug(%s: %s - no child found\n, __func__, dev-name);
 
/* Always return success for this device */
@@ -68,7 +73,7 @@ static int max77686_bind(struct udevice *dev)
 }
 
 static struct dm_pmic_ops max77686_ops = {
-   .reg_count = MAX77686_NUM_OF_REGS,
+   .reg_count = max77686_reg_count,
.read = max77686_read,
.write = max77686_write,
 };
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index d82d3da..812ac13 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -27,8 +27,8 @@ static ulong str_get_num(const char *ptr, const char *maxptr)
return simple_strtoul(ptr, NULL, 0);
 }
 
-int pmic_bind_childs(struct udevice *pmic, int offset,
-const struct pmic_child_info *child_info)
+int pmic_bind_children(struct udevice *pmic, int offset,
+  const struct pmic_child_info *child_info)
 {
const struct pmic_child_info *info;
const void *blob = gd-fdt_blob;
@@ -53,14 +53,10 @@ int pmic_bind_childs(struct udevice *pmic, int offset,
 node);
 
child = NULL;
-   info = child_info;
-   while (info-prefix) {
+   for (info = child_info; info-prefix  info-driver; info++) {
prefix_len = strlen(info-prefix);
-   if (strncasecmp(info-prefix, node_name, prefix_len) ||
-   !info-driver) {
-   info++;
+   if (strncasecmp(info-prefix, node_name, prefix_len))
continue;
-   }
 
debug(  - compatible prefix: '%s'\n, info-prefix);
 
@@ -110,16 +106,16 @@ int pmic_get(const char *name, struct udevice **devp)
 int pmic_reg_count(struct udevice *dev)
 {
const struct dm_pmic_ops *ops = dev_get_driver_ops(dev);
-   if (!ops)
+
+   if (!ops || !ops-reg_count)
return -ENOSYS;
 
-   return ops-reg_count;
+   return 

[U-Boot] [PATCH V2 00/13] PMIC/REGULATOR cleanup and Sandbox tests

2015-05-13 Thread Przemyslaw Marczak
Hello Simon,

This patchset fixes the build issues. It changes the last three
top commits of u-boot-dm/next. So it is rebased onto:
4e9a6eb dm: board:samsung: power_init_board: add requirement of CONFIG_DM_PMIC

The rebased version, can be fetched from:
https://github.com/bobenstein/u-boot.git
branch: dm-pmic-v5-sandbox

Best regards,
Przemyslaw Marczak

Przemyslaw Marczak (13):
  odroid: dts: add 'voltage-regulators' description to max77686 node
  odroid: enable driver model pmic/regulator API and MAX77686 drivers
  dm: pmic: code cleanup of PMIC uclass driver
  dm: regulator: uclass driver code cleanup
  common: cmd pmic: command cleanup
  common: cmd regulator: command cleanup
  doc: driver-model: pmic-framework.txt - cleanup
  sandbox: i2c: search child emul dev and check its uclass id
  sandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulator
  test: dm: add sandbox PMIC framework tests
  test: dm: test.dts - move to sandbox dts directory
  sandbox: dts: add sandbox_pmic.dtsi and include it to sandbox.dts and
test.dts
  sandbox: defconfig: enable support of sandbox PMIC drivers

 arch/arm/dts/exynos4412-odroid.dts | 253 ++
 arch/sandbox/dts/Makefile  |   1 +
 arch/sandbox/dts/sandbox.dts   |   4 +
 arch/sandbox/dts/sandbox_pmic.dtsi |  78 ++
 arch/sandbox/dts/test.dts  | 236 
 board/samsung/common/misc.c|   1 +
 board/samsung/odroid/odroid.c  |  76 +++---
 common/cmd_pmic.c  | 131 -
 common/cmd_regulator.c | 239 +
 configs/odroid_defconfig   |   8 +-
 configs/sandbox_defconfig  |   7 +
 doc/device-tree-bindings/pmic/sandbox.txt  |  35 +++
 doc/device-tree-bindings/regulator/sandbox.txt |  45 
 doc/driver-model/pmic-framework.txt|  20 +-
 drivers/i2c/sandbox_i2c.c  |  20 +-
 drivers/power/pmic/Kconfig |  27 +-
 drivers/power/pmic/Makefile|   3 +-
 drivers/power/pmic/i2c_pmic_emul.c | 142 ++
 drivers/power/pmic/max77686.c  |  15 +-
 drivers/power/pmic/pmic-uclass.c   |  31 +--
 drivers/power/pmic/sandbox.c   |  79 ++
 drivers/power/regulator/Kconfig|  32 ++-
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/regulator-uclass.c | 104 +---
 drivers/power/regulator/sandbox.c  | 355 +
 include/configs/odroid.h   |   5 -
 include/dt-bindings/pmic/sandbox_pmic.h|  35 +++
 include/power/pmic.h   |  39 +--
 include/power/regulator.h  | 116 
 include/power/sandbox_pmic.h   | 138 ++
 test/dm/.gitignore |   1 -
 test/dm/Makefile   |   2 +
 test/dm/pmic.c |  69 +
 test/dm/regulator.c| 325 ++
 test/dm/test-dm.sh |   3 +-
 test/dm/test-main.c|   3 +-
 test/dm/test.dts   | 230 
 37 files changed, 2287 insertions(+), 622 deletions(-)
 create mode 100644 arch/sandbox/dts/sandbox_pmic.dtsi
 create mode 100644 arch/sandbox/dts/test.dts
 create mode 100644 doc/device-tree-bindings/pmic/sandbox.txt
 create mode 100644 doc/device-tree-bindings/regulator/sandbox.txt
 create mode 100644 drivers/power/pmic/i2c_pmic_emul.c
 create mode 100644 drivers/power/pmic/sandbox.c
 create mode 100644 drivers/power/regulator/sandbox.c
 create mode 100644 include/dt-bindings/pmic/sandbox_pmic.h
 create mode 100644 include/power/sandbox_pmic.h
 delete mode 100644 test/dm/.gitignore
 create mode 100644 test/dm/pmic.c
 create mode 100644 test/dm/regulator.c
 delete mode 100644 test/dm/test.dts

-- 
1.9.1

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


[U-Boot] [PATCH V2 02/13] odroid: enable driver model pmic/regulator API and MAX77686 drivers

2015-05-13 Thread Przemyslaw Marczak
This change enables the configs required to init and setup max77686
regulator driver, using the new driver model pmic and regulator API.
And also changes the old pmic framework calls to the new ones.

This commits enables:
- CONFIG_ERRNO_STR
- CONFIG_DM_PMIC
- CONFIG_DM_PMIC_CMD
- CONFIG_DM_PMIC_MAX77686
- CONFIG_DM_REGULATOR
- CONFIG_DM_REGULATOR_CMD
- CONFIG_DM_REGULATOR_MAX77686

And removes the unused:
- CONFIG_DM_I2C_COMPAT
- CONFIG_POWER
- CONFIG_POWER_I2C
- CONFIG_POWER_MAX77686

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Change V2:
- split two commits for odroid into one
---
 board/samsung/common/misc.c   |  1 +
 board/samsung/odroid/odroid.c | 77 +--
 configs/odroid_defconfig  |  8 -
 include/configs/odroid.h  |  5 ---
 4 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 1a77c82..f0d69d4 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -16,6 +16,7 @@
 #include asm/arch/cpu.h
 #include asm/gpio.h
 #include linux/input.h
+#include dm.h
 #include power/pmic.h
 #include mmc.h
 
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index ae41c29..29de325 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -12,7 +12,9 @@
 #include asm/arch/gpio.h
 #include asm/gpio.h
 #include asm/arch/cpu.h
+#include dm.h
 #include power/pmic.h
+#include power/regulator.h
 #include power/max77686_pmic.h
 #include errno.h
 #include mmc.h
@@ -31,6 +33,12 @@ enum {
ODROID_TYPES,
 };
 
+static const char *mmc_regulators[] = {
+   VDDQ_EMMC_1.8V,
+   VDDQ_EMMC_2.8V,
+   TFLASH_2.8V,
+};
+
 void set_board_type(void)
 {
/* Set GPA1 pin 1 to HI - enable XCL205 output */
@@ -403,21 +411,6 @@ static void board_gpio_init(void)
 #endif
 }
 
-static int pmic_init_max77686(void)
-{
-   struct pmic *p = pmic_get(MAX77686_PMIC);
-
-   if (pmic_probe(p))
-   return -ENODEV;
-
-   /* Set LDO Voltage */
-   max77686_set_ldo_voltage(p, 20, 180);   /* LDO20 eMMC */
-   max77686_set_ldo_voltage(p, 21, 280);   /* LDO21 SD */
-   max77686_set_ldo_voltage(p, 22, 280);   /* LDO22 eMMC */
-
-   return 0;
-}
-
 int exynos_early_init_f(void)
 {
board_clock_init();
@@ -434,8 +427,10 @@ int exynos_init(void)
 
 int exynos_power_init(void)
 {
-   pmic_init(0);
-   pmic_init_max77686();
+   int list_count = ARRAY_SIZE(mmc_regulators);
+
+   if (regulator_list_autoset(mmc_regulators, list_count, NULL, true))
+   error(Unable to init all mmc regulators);
 
return 0;
 }
@@ -443,19 +438,20 @@ int exynos_power_init(void)
 #ifdef CONFIG_USB_GADGET
 static int s5pc210_phy_control(int on)
 {
-   struct pmic *p_pmic;
+   struct udevice *dev;
+   int ret;
 
-   p_pmic = pmic_get(MAX77686_PMIC);
-   if (!p_pmic)
-   return -ENODEV;
-
-   if (pmic_probe(p_pmic))
-   return -1;
+   ret = regulator_by_platname(VDD_UOTG_3.0V, dev);
+   if (ret) {
+   error(Regulator get error: %d, ret);
+   return ret;
+   }
 
if (on)
-   return max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
+   return regulator_set_mode(dev, OPMODE_ON);
else
-   return max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
+   return regulator_set_mode(dev, OPMODE_LPM);
+
 }
 
 struct s3c_plat_otg_data s5pc210_otg_data = {
@@ -472,7 +468,8 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
 int board_usb_init(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_CMD_USB
-   struct pmic *p_pmic;
+   struct udevice *dev;
+   int ret;
 
/* Set Ref freq 0 = 24MHz, 1 = 26MHz*/
/* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
@@ -490,14 +487,30 @@ int board_usb_init(int index, enum usb_init_type init)
/* Power off and on BUCK8 for LAN9730 */
debug(LAN9730 - Turning power buck 8 OFF and ON.\n);
 
-   p_pmic = pmic_get(MAX77686_PMIC);
-   if (p_pmic  !pmic_probe(p_pmic)) {
-   max77686_set_buck_voltage(p_pmic, 8, 75);
-   max77686_set_buck_voltage(p_pmic, 8, 330);
+   ret = regulator_by_platname(VCC_P3V3_2.85V, dev);
+   if (ret) {
+   error(Regulator get error: %d, ret);
+   return ret;
}
 
-#endif
+   ret = regulator_set_enable(dev, true);
+   if (ret) {
+   error(Regulator %s enable setting error: %d, dev-name, ret);
+   return ret;
+   }
 
+   ret = regulator_set_value(dev, 75);
+   if (ret) {
+   error(Regulator %s value setting error: %d, dev-name, ret);
+   return ret;
+   }
+
+   ret = regulator_set_value(dev, 330);
+   if (ret) {
+   

Re: [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input

2015-05-13 Thread Stefan Wahren
Hi Marek,

Am 13.05.2015 um 09:13 schrieb Marek Vasut:
 On Wednesday, May 13, 2015 at 08:02:21 AM, Stefan Wahren wrote:
 Hi,
 Hi,

 during the study of DC-DC handling in u-boot i noticed a possible bug.

 In case the DC-DC is already enabled the function returns without
 reenabling brown out detection. I don't think that's okay.
 A possible fix would be to do the check if DC-DC is already enabled before
 disabling brown out detection. This idea is
 attached as a draft. If it's acceptable i will send a proper patch.
 What exactly would happen if you enable DCDC converter while BO detection
 is already enabled ? It is possible, that enabling the DCDC would cause a
 dip on the power rail and cause in turn a BO, no ? IIRC, that is the reason
 why BO detection is disabled when enabling DCDC.

i think we're talking about different things. The patch won't touch this
necessary behaviour.

No, i think it's faulty to leave the function with BO detection disabled
in the case the DC-DC is already enabled:

if (xfer  (readl(power_regs-hw_power_5vctrl) 
POWER_5VCTRL_ENABLE_DCDC)) {
 return;
}


 Best regards,
 Marek Vasut

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


[U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input

2015-05-13 Thread Stefan Wahren
Hi,

during the study of DC-DC handling in u-boot i noticed a possible bug.

In case the DC-DC is already enabled the function returns without reenabling
brown out detection. I don't think that's okay.
A possible fix would be to do the check if DC-DC is already enabled before
disabling brown out detection. This idea is
attached as a draft. If it's acceptable i will send a proper patch.

Best regards
Stefan

---%-
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index c342217..42f3df2 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -332,6 +332,11 @@ static void mxs_enable_4p2_dcdc_input(int xfer)
 
debug(SPL: %s 4P2 DC-DC Input\n, xfer ? Enabling : Disabling);
 
+   if (xfer  (readl(power_regs-hw_power_5vctrl) 
+   POWER_5VCTRL_ENABLE_DCDC)) {
+   return;
+   }
+
prev_5v_brnout = readl(power_regs-hw_power_5vctrl) 
POWER_5VCTRL_PWDN_5VBRNOUT;
prev_5v_droop = readl(power_regs-hw_power_ctrl) 
@@ -343,11 +348,6 @@ static void mxs_enable_4p2_dcdc_input(int xfer)
 
clrbits_le32(power_regs-hw_power_ctrl, POWER_CTRL_ENIRQ_VDD5V_DROOP);
 
-   if (xfer  (readl(power_regs-hw_power_5vctrl) 
-   POWER_5VCTRL_ENABLE_DCDC)) {
-   return;
-   }
-
/*
 * Recording orignal values that will be modified temporarlily
 * to handle a chip bug. See chip errata for CQ ENGR00115837
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] arc: use more universal prefix for default CROSS_COMPILE

2015-05-13 Thread Alexey Brodkin
Hello Masahiro-san,

On Wed, 2015-05-13 at 18:49 +0900, Masahiro Yamada wrote:
 As doc/README.ARC says, pre-build ARC toolchains are available at
 the Synopsys GitHub page.
 
 The bin files are prefixed with arc(eb)-buildroot-linux- for earlier
 releases, but with arc(eb)-snps-linux- for the latest releases.
 
 The symbolic links prefixed with arc(eb)-linux- are also available
 for all the release, so those prefixes can be used as the default
 CROSS_COMPILE regardless of the toolchains version/variants.
 
 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
 ---
 
 Changes in v2:
   - Use arc(eb)-linux- rather than arc(eb)-linux-uclibc-

Applied!

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


Re: [U-Boot] [U-Boot,1/3] ARM: at91: remove non-generic boards

2015-05-13 Thread Andreas Bießmann
Dear Masahiro Yamada,

Masahiro Yamada yamada.masah...@socionext.com writes:
Remove board support for afeb9260, tny_a9260, and sbc35_a9g20.

They have not been converted into Generic Board yet.
See doc/README.generic-board for details.

Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
Cc: Sergey Lapin sla...@ossfans.org
Cc: Albin Tonnerre albin.tonne...@free-electrons.com
Cc: Andreas Bießmann andreas.de...@googlemail.com
---
 arch/arm/mach-at91/Kconfig |  15 --
 arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c |   2 +-
 board/afeb9260/Kconfig |   9 --
 board/afeb9260/MAINTAINERS |   6 -
 board/afeb9260/Makefile|  13 --
 board/afeb9260/afeb9260.c  | 159 ---
 board/afeb9260/config.mk   |   1 -
 board/afeb9260/partition.c |  21 ---
 board/calao/sbc35_a9g20/Kconfig|  12 --
 board/calao/sbc35_a9g20/MAINTAINERS|   7 -
 board/calao/sbc35_a9g20/Makefile   |  13 --
 board/calao/sbc35_a9g20/config.mk  |   1 -
 board/calao/sbc35_a9g20/sbc35_a9g20.c  | 155 ---
 board/calao/sbc35_a9g20/spi.c  |  41 -
 board/calao/tny_a9260/Kconfig  |  12 --
 board/calao/tny_a9260/MAINTAINERS  |   9 --
 board/calao/tny_a9260/Makefile |  13 --
 board/calao/tny_a9260/config.mk|   1 -
 board/calao/tny_a9260/spi.c|  34 -
 board/calao/tny_a9260/tny_a9260.c  |  85 ---
 configs/afeb9260_defconfig |   3 -
 configs/sbc35_a9g20_eeprom_defconfig   |   4 -
 configs/sbc35_a9g20_nandflash_defconfig|   4 -
 configs/tny_a9260_eeprom_defconfig |   4 -
 configs/tny_a9260_nandflash_defconfig  |   4 -
 configs/tny_a9g20_eeprom_defconfig |   4 -
 configs/tny_a9g20_nandflash_defconfig  |   4 -
 doc/README.scrapyard   |  19 ++-
 include/configs/afeb9260.h | 156 ---
 include/configs/sbc35_a9g20.h  | 169 -
 include/configs/tny_a9260.h| 150 --
 31 files changed, 12 insertions(+), 1118 deletions(-)
 delete mode 100644 board/afeb9260/Kconfig
 delete mode 100644 board/afeb9260/MAINTAINERS
 delete mode 100644 board/afeb9260/Makefile
 delete mode 100644 board/afeb9260/afeb9260.c
 delete mode 100644 board/afeb9260/config.mk
 delete mode 100644 board/afeb9260/partition.c
 delete mode 100644 board/calao/sbc35_a9g20/Kconfig
 delete mode 100644 board/calao/sbc35_a9g20/MAINTAINERS
 delete mode 100644 board/calao/sbc35_a9g20/Makefile
 delete mode 100644 board/calao/sbc35_a9g20/config.mk
 delete mode 100644 board/calao/sbc35_a9g20/sbc35_a9g20.c
 delete mode 100644 board/calao/sbc35_a9g20/spi.c
 delete mode 100644 board/calao/tny_a9260/Kconfig
 delete mode 100644 board/calao/tny_a9260/MAINTAINERS
 delete mode 100644 board/calao/tny_a9260/Makefile
 delete mode 100644 board/calao/tny_a9260/config.mk
 delete mode 100644 board/calao/tny_a9260/spi.c
 delete mode 100644 board/calao/tny_a9260/tny_a9260.c
 delete mode 100644 configs/afeb9260_defconfig
 delete mode 100644 configs/sbc35_a9g20_eeprom_defconfig
 delete mode 100644 configs/sbc35_a9g20_nandflash_defconfig
 delete mode 100644 configs/tny_a9260_eeprom_defconfig
 delete mode 100644 configs/tny_a9260_nandflash_defconfig
 delete mode 100644 configs/tny_a9g20_eeprom_defconfig
 delete mode 100644 configs/tny_a9g20_nandflash_defconfig
 delete mode 100644 include/configs/afeb9260.h
 delete mode 100644 include/configs/sbc35_a9g20.h
 delete mode 100644 include/configs/tny_a9260.h

applied to u-boot-atmel/master, thanks!

This patch was rebased on current u-boot/master
 before applying!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: at91: trival: fix typo for the nand partition name

2015-05-13 Thread Andreas Bießmann
Dear Wu, Josh,

Josh Wu josh...@atmel.com writes:
We should use 'env' to present environment instead of 'evn'

Signed-off-by: Josh Wu josh...@atmel.com
---

 include/configs/at91-sama5_common.h | 2 +-
 include/configs/at91sam9rlek.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2 11/13] test: dm: test.dts - move to sandbox dts directory

2015-05-13 Thread Przemyslaw Marczak
The file test.dts from driver model test directory,
was compiled by call dtc in script: test/dm/test-dm.sh.

This doesn't allow for including of dtsi files and using
of C preprocessor routines in this dts file.

Since the mentioned script builds U-Boot before tests,
then moving the test.dts file into sandbox dts directory
is reasonable.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- new commit
---
 arch/sandbox/dts/Makefile |   1 +
 arch/sandbox/dts/test.dts | 230 ++
 test/dm/.gitignore|   1 -
 test/dm/test-dm.sh|   3 +-
 test/dm/test-main.c   |   3 +-
 test/dm/test.dts  | 230 --
 6 files changed, 233 insertions(+), 235 deletions(-)
 create mode 100644 arch/sandbox/dts/test.dts
 delete mode 100644 test/dm/.gitignore
 delete mode 100644 test/dm/test.dts

diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
index a4c980b..562a078 100644
--- a/arch/sandbox/dts/Makefile
+++ b/arch/sandbox/dts/Makefile
@@ -1,4 +1,5 @@
 dtb-$(CONFIG_SANDBOX) += sandbox.dtb
+dtb-$(CONFIG_DM_TEST) += test.dtb
 
 targets += $(dtb-y)
 
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
new file mode 100644
index 000..d0c40be
--- /dev/null
+++ b/arch/sandbox/dts/test.dts
@@ -0,0 +1,230 @@
+/dts-v1/;
+
+/ {
+   model = sandbox;
+   compatible = sandbox;
+   #address-cells = 1;
+   #size-cells = 0;
+
+   aliases {
+   console = uart0;
+   i2c0 = /i2c@0;
+   spi0 = /spi@0;
+   pci0 = pci;
+   testfdt6 = /e-test;
+   testbus3 = /some-bus;
+   testfdt0 = /some-bus/c-test@0;
+   testfdt1 = /some-bus/c-test@1;
+   testfdt3 = /b-test;
+   testfdt5 = /some-bus/c-test@5;
+   testfdt8 = /a-test;
+   eth0 = /eth@10002000;
+   eth5 = eth_5;
+   usb0 = usb_0;
+   usb1 = usb_1;
+   usb2 = usb_2;
+   };
+
+   uart0: serial {
+   compatible = sandbox,serial;
+   u-boot,dm-pre-reloc;
+   };
+
+   a-test {
+   reg = 0;
+   compatible = denx,u-boot-fdt-test;
+   ping-expect = 0;
+   ping-add = 0;
+   u-boot,dm-pre-reloc;
+   test-gpios = gpio_a 1, gpio_a 4, gpio_b 5 0 3 2 1,
+   0, gpio_a 12;
+   test2-gpios = gpio_a 1, gpio_a 4, gpio_b 6 1 3 2 1,
+   gpio_b 7 2 3 2 1, gpio_b 8 4 3 2 1,
+   gpio_b 9 0xc 3 2 1;
+   };
+
+   junk {
+   reg = 1;
+   compatible = not,compatible;
+   };
+
+   no-compatible {
+   reg = 2;
+   };
+
+   b-test {
+   reg = 3;
+   compatible = denx,u-boot-fdt-test;
+   ping-expect = 3;
+   ping-add = 3;
+   };
+
+   some-bus {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = denx,u-boot-test-bus;
+   reg = 3;
+   ping-expect = 4;
+   ping-add = 4;
+   c-test@5 {
+   compatible = denx,u-boot-fdt-test;
+   reg = 5;
+   ping-expect = 5;
+   ping-add = 5;
+   };
+   c-test@0 {
+   compatible = denx,u-boot-fdt-test;
+   reg = 0;
+   ping-expect = 6;
+   ping-add = 6;
+   };
+   c-test@1 {
+   compatible = denx,u-boot-fdt-test;
+   reg = 1;
+   ping-expect = 7;
+   ping-add = 7;
+   };
+   };
+
+   d-test {
+   reg = 3;
+   ping-expect = 6;
+   ping-add = 6;
+   compatible = google,another-fdt-test;
+   };
+
+   e-test {
+   reg = 3;
+   ping-expect = 6;
+   ping-add = 6;
+   compatible = google,another-fdt-test;
+   };
+
+   f-test {
+   compatible = denx,u-boot-fdt-test;
+   };
+
+   g-test {
+   compatible = denx,u-boot-fdt-test;
+   };
+
+   gpio_a: base-gpios {
+   compatible = sandbox,gpio;
+   gpio-controller;
+   #gpio-cells = 1;
+   gpio-bank-name = a;
+   num-gpios = 20;
+   };
+
+   gpio_b: extra-gpios {
+   compatible = sandbox,gpio;
+   gpio-controller;
+   #gpio-cells = 5;
+   gpio-bank-name = b;
+   num-gpios = 10;
+   };
+
+   i2c@0 {
+   #address-cells 

[U-Boot] [PATCH V2 13/13] sandbox: defconfig: enable support of sandbox PMIC drivers

2015-05-13 Thread Przemyslaw Marczak
This commit enables:
- emulated i2c PMIC driver
- sandbox PMIC I/O driver
- sandbox PMIC's regulator driver

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- none
---
 configs/sandbox_defconfig | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 5de7fbe..236d106 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -26,3 +26,10 @@ CONFIG_TPM_TIS_SANDBOX=y
 CONFIG_SOUND=y
 CONFIG_CMD_SOUND=y
 CONFIG_SOUND_SANDBOX=y
+CONFIG_ERRNO_STR=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_SANDBOX=y
+CONFIG_CMD_PMIC=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_SANDBOX=y
+CONFIG_CMD_REGULATOR=y
-- 
1.9.1

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


[U-Boot] [PATCH V2 12/13] sandbox: dts: add sandbox_pmic.dtsi and include it to sandbox.dts and test.dts

2015-05-13 Thread Przemyslaw Marczak
This commit adds dtsi file for Sandbox PMIC.
It fully describes the PMIC by:
- i2c emul node - with a default settings of 16 registers
- 2x buck regulator nodes
- 2x ldo regulator nodes

The default register settings are set with preprocessor macros:
- VAL2REG(min[uV/uA], step[uV/uA], val[uV/uA])
- VAL2OMREG(mode id)
Both defined in file:
- include/dt-bindings/pmic/sandbox_pmic.h

The Voltage ranges of each regulator can be found in:
- include/power/sandbox_pmic.h

The new file is included into:
- sandbox.dts
- test.dts

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Simon Glass s...@chromium.org
Tested on sandbox:
Tested-by: Simon Glass s...@chromium.org
---
Changes V2:
- move sandbox PMIC node into sandbox_pmic.dtsi
- add sandbox_pmic.h into dt-bindings directory
- add pmic node to: sandbox.dts and test.dts
---
 arch/sandbox/dts/sandbox.dts|  4 ++
 arch/sandbox/dts/sandbox_pmic.dtsi  | 78 +
 arch/sandbox/dts/test.dts   |  6 +++
 include/dt-bindings/pmic/sandbox_pmic.h | 35 +++
 4 files changed, 123 insertions(+)
 create mode 100644 arch/sandbox/dts/sandbox_pmic.dtsi
 create mode 100644 include/dt-bindings/pmic/sandbox_pmic.h

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index efa2097..fd1e5dc 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -105,6 +105,9 @@
sandbox,size = 128;
};
};
+   sandbox_pmic: sandbox_pmic {
+   reg = 0x40;
+   };
};
 
spi@0 {
@@ -195,3 +198,4 @@
 };
 
 #include cros-ec-keyboard.dtsi
+#include sandbox_pmic.dtsi
diff --git a/arch/sandbox/dts/sandbox_pmic.dtsi 
b/arch/sandbox/dts/sandbox_pmic.dtsi
new file mode 100644
index 000..44a26b1
--- /dev/null
+++ b/arch/sandbox/dts/sandbox_pmic.dtsi
@@ -0,0 +1,78 @@
+/*
+ *  Sandbox PMIC dts node
+ *
+ *  Copyright (C) 2015 Samsung Electronics
+ *  Przemyslaw Marczak  p.marc...@samsung.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include dt-bindings/pmic/sandbox_pmic.h
+
+sandbox_pmic {
+   compatible = sandbox,pmic;
+
+   pmic_emul {
+   compatible = sandbox,i2c-pmic;
+
+   /*
+* Default PMICs register values are set by macro
+* VAL2REG(min, step, value) [uV/uA]
+* VAL2OMREG(mode id)
+* reg-defaults - byte array
+*/
+   reg-defaults = /bits/ 8 
+   /* BUCK1 */
+   VAL2REG(80, 25000, 100)
+   VAL2REG(15, 25000, 15)
+   VAL2OMREG(BUCK_OM_OFF)
+   /* BUCK2 */
+   VAL2REG(75, 5, 300)
+   VAL2REG(15, 25000, 15)
+   VAL2OMREG(0)
+   /* LDO1 */
+   VAL2REG(80, 25000, 160)
+   VAL2REG(10, 5, 15)
+   VAL2OMREG(LDO_OM_OFF)
+   /* LDO2 */
+   VAL2REG(75, 5, 300)
+   VAL2REG(15, 25000, 15)
+   VAL2OMREG(0)
+   /* reg[12:15] - not used */
+   0x00
+   0x00
+   0x00
+   0x00
+   ;
+   };
+
+   buck1 {
+   regulator-name = SUPPLY_1.2V;
+   regulator-min-microvolt = 120;
+   regulator-max-microvolt = 120;
+   regulator-min-microamp = 20;
+   regulator-max-microamp = 20;
+   regulator-always-on;
+   };
+
+   buck2 {
+   regulator-name = SUPPLY_3.3V;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   };
+
+   ldo1 {
+   regulator-name = VDD_EMMC_1.8V;
+   regulator-min-microvolt = 180;
+   regulator-max-microvolt = 180;
+   regulator-min-microamp = 10;
+   regulator-max-microamp = 10;
+   regulator-boot-on;
+   };
+
+   ldo2 {
+   regulator-name = VDD_LCD_3.3V;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   };
+};
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index d0c40be..1bc3ca0 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -139,6 +139,10 @@
sandbox,size = 256;
};
};
+
+   sandbox_pmic: sandbox_pmic {
+   reg = 0x40;
+   };
};
 
pci: pci-controller {
@@ -228,3 +232,5 @@
};
 
 };
+
+#include sandbox_pmic.dtsi
diff 

[U-Boot] [PATCH] net: phy: Add support for all targets which requires MANUAL_RELOC

2015-05-13 Thread Michal Simek
Targets with CONFIG_NEEDS_MANUAL_RELOC do not use REL/RELA
relocation (mostly only GOT) where functions aray are not
updated. This patch is fixing function pointers passed to phy_register
function.
This patch was tested on Microblaze architecture.

Signed-off-by: Michal Simek michal.si...@xilinx.com
---

 drivers/net/phy/phy.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f5221a3833fe..c8d08e8f4f1c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -21,6 +21,8 @@
 #include linux/err.h
 #include linux/compiler.h
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Generic PHY support and helper functions */
 
 /**
@@ -494,6 +496,20 @@ int phy_register(struct phy_driver *drv)
INIT_LIST_HEAD(drv-list);
list_add_tail(drv-list, phy_drivers);
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+   if (drv-probe)
+   drv-probe += gd-reloc_off;
+   if (drv-config)
+   drv-config += gd-reloc_off;
+   if (drv-startup)
+   drv-startup += gd-reloc_off;
+   if (drv-shutdown)
+   drv-shutdown += gd-reloc_off;
+   if (drv-readext)
+   drv-readext += gd-reloc_off;
+   if (drv-writeext)
+   drv-writeext += gd-reloc_off;
+#endif
return 0;
 }
 
-- 
2.3.5

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


Re: [U-Boot] [PATCH 01/24] usb: add device connection/disconnection detection

2015-05-13 Thread Simon Glass
On 4 May 2015 at 11:30, Simon Glass s...@chromium.org wrote:

 From: Vincent Palatin vpala...@chromium.org

 Provide a function to detect USB device insertion/removal in order to
 avoid having to do USB enumeration in a tight loop when trying to detect
 peripheral hotplugging.

 Signed-off-by: Vincent Palatin vpala...@chromium.org

 Reviewed-by: Stefan Reinauer reina...@chromium.org
 Tested-by: Stefan Reinauer reina...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org
 ---

  common/usb.c | 26 ++
  common/usb_hub.c |  2 +-
  include/usb.h|  2 ++
  3 files changed, 29 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH v1 0/3] New tag for Flattened Image Trees (FIT) - Booting Xen from a FIT.

2015-05-13 Thread Simon Glass
Hi,

On 11 May 2015 at 12:03, Karl Apsite karl.aps...@dornerworks.com wrote:

 The FIT config now supports a tag named loadables: which is a
 comma separated list.  Users can add any number of images to the list,
 and u-boot will move the selected binaries to their listed
 load_addresses. This allows u-boot to boot xen from using an FIT
 configuration.  Xen expects a kernel to be placed at a predetermined
 location, however the kernel field was already filled by xen itself.
 This change allows the user to move the required binary before xen
 boots, all within the FIT's configuration.


 Karl Apsite (3):
   add test for two 'loadables'
   mkimage will now report information about loadable
   add boot_get_loadables() to load listed images

  common/bootm.c| 22 +
  common/image-fit.c| 25 +-
  common/image.c| 93 
 +++
  doc/uImage.FIT/source_file_format.txt |  4 ++
  include/bootstage.h   |  1 +
  include/image.h   |  6 ++-
  test/image/test-fit.py| 73 +++
  7 files changed, 213 insertions(+), 11 deletions(-)

I don't think I received the patches, just this cover letter. Did you
send them do the mailing list? Or are they waiting on ML approval?

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


[U-Boot] [PATCH] arc: remove dummy target

2015-05-13 Thread Alexey Brodkin
TARGET_DUMMY was introduced to resolve the same problem as commit
arch: Make board selection choices optional
http://git.denx.de/?p=u-boot.git;a=commit;h=a26cd04920dc069fd6e91abb785426cf6c29f45f

Latter implementation is much cleaner and appropriate.

And anyways TARGET_DUMMY is no longer required.

Signed-off-by: Alexey Brodkin abrod...@synopsys.com
Cc: Joe Hershberger joe.hershber...@ni.com
---
 arch/arc/Kconfig | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 85fddd2..67d28d3 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -134,14 +134,6 @@ choice
prompt Target select
optional
 
-config TARGET_DUMMY
-   bool Dummy target
-   help
- Please select one of real target boards below!
- This target is only meant to force makedefconfig to put
- TARGET_xxx in defconfig even this is the first target from the list
- below.
-
 config TARGET_TB100
bool Support tb100
 
-- 
2.1.0

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


Re: [U-Boot] [PATCH] ARC: change the default CROSS_COMPILE for ARC

2015-05-13 Thread Alexey Brodkin
Hello Masahiro-san,

On Mon, 2015-05-11 at 19:42 +0900, Masahiro Yamada wrote:
 As doc/README.ARC says, pre-build ARC toolchains are available at
 the Synopsys GitHub page.
 
 The bin files are prefixed with arc(eb)-buildroot-linux- for earlier
 releases, but with arc(eb)-snps-linux- for the latest releases
 (arc_gnu_2014.12_prebuilt_*).
 
 For all the releases, the symbolic link, arc(eb)-linux-* is also
 prepared for each bin file, so it can be used as the default
 CROSS_COMPILE regardless of the toolchains version.
 
 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
 ---
 
  arch/arc/config.mk | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/arch/arc/config.mk b/arch/arc/config.mk
 index 04c034b..9aed147 100644
 --- a/arch/arc/config.mk
 +++ b/arch/arc/config.mk
 @@ -11,13 +11,13 @@ CONFIG_SYS_BIG_ENDIAN = 1
  endif
  
  ifdef CONFIG_SYS_LITTLE_ENDIAN
 -ARC_CROSS_COMPILE := arc-buildroot-linux-uclibc-
 +ARC_CROSS_COMPILE := arc-linux-uclibc-
  PLATFORM_LDFLAGS += -EL
  PLATFORM_CPPFLAGS += -mlittle-endian
  endif
  
  ifdef CONFIG_SYS_BIG_ENDIAN
 -ARC_CROSS_COMPILE := arceb-buildroot-linux-uclibc-
 +ARC_CROSS_COMPILE := arceb-linux-uclibc-
  PLATFORM_LDFLAGS += -EB
  PLATFORM_CPPFLAGS += -mbig-endian
  endif

I would propose to use even simpler and more universal prefix which
could be used with both ARC pre-built toolchains, your own toolchain
built by Buildroot or even pre-built Buildroot toolchain
(http://autobuild.buildroot.org/toolchains/tarballs/br-arcle-hs38-full-2015.02.tar.bz2):
 [1] arc-linux- for little-endian
 [2] arceb-linux-

Care to re-send your patch or I may do that change myself?

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


Re: [U-Boot] [PATCH] ARC: change the default CROSS_COMPILE for ARC

2015-05-13 Thread Masahiro Yamada
Hi Alexey,

2015-05-13 18:36 GMT+09:00 Alexey Brodkin alexey.brod...@synopsys.com:
 Hello Masahiro-san,

 On Mon, 2015-05-11 at 19:42 +0900, Masahiro Yamada wrote:
 As doc/README.ARC says, pre-build ARC toolchains are available at
 the Synopsys GitHub page.

 The bin files are prefixed with arc(eb)-buildroot-linux- for earlier
 releases, but with arc(eb)-snps-linux- for the latest releases
 (arc_gnu_2014.12_prebuilt_*).

 For all the releases, the symbolic link, arc(eb)-linux-* is also
 prepared for each bin file, so it can be used as the default
 CROSS_COMPILE regardless of the toolchains version.

 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com
 ---

  arch/arc/config.mk | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/arch/arc/config.mk b/arch/arc/config.mk
 index 04c034b..9aed147 100644
 --- a/arch/arc/config.mk
 +++ b/arch/arc/config.mk
 @@ -11,13 +11,13 @@ CONFIG_SYS_BIG_ENDIAN = 1
  endif

  ifdef CONFIG_SYS_LITTLE_ENDIAN
 -ARC_CROSS_COMPILE := arc-buildroot-linux-uclibc-
 +ARC_CROSS_COMPILE := arc-linux-uclibc-
  PLATFORM_LDFLAGS += -EL
  PLATFORM_CPPFLAGS += -mlittle-endian
  endif

  ifdef CONFIG_SYS_BIG_ENDIAN
 -ARC_CROSS_COMPILE := arceb-buildroot-linux-uclibc-
 +ARC_CROSS_COMPILE := arceb-linux-uclibc-
  PLATFORM_LDFLAGS += -EB
  PLATFORM_CPPFLAGS += -mbig-endian
  endif

 I would propose to use even simpler and more universal prefix which
 could be used with both ARC pre-built toolchains, your own toolchain
 built by Buildroot or even pre-built Buildroot toolchain
 (http://autobuild.buildroot.org/toolchains/tarballs/br-arcle-hs38-full-2015.02.tar.bz2):
  [1] arc-linux- for little-endian
  [2] arceb-linux-

 Care to re-send your patch or I may do that change myself?


I've posted v2.
Thanks for pointing this out!


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


[U-Boot] [PULL] u-boot-atmel/master - u-boot/master

2015-05-13 Thread Andreas Bießmann
Hi Tom,

please pull the following changes into u-boot/master.

The following changes since commit bd328eb38274ffaf04caaa8a6ecc09b7e19a650e:

  Clean all defconfigs with savedefconfig (2015-05-12 18:10:26 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-atmel.git master

for you to fetch changes up to 9aee8d835751773ad7a6b8d618566814c0a3205c:

  ARM: at91: trival: fix typo for the nand partition name (2015-05-13 13:01:28 
+0200)


Masahiro Yamada (1):
  ARM: at91: remove non-generic boards

Wu, Josh (1):
  ARM: at91: trival: fix typo for the nand partition name

 arch/arm/mach-at91/Kconfig |   15 --
 arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c |2 +-
 board/afeb9260/Kconfig |9 --
 board/afeb9260/MAINTAINERS |6 -
 board/afeb9260/Makefile|   13 --
 board/afeb9260/afeb9260.c  |  159 --
 board/afeb9260/config.mk   |1 -
 board/afeb9260/partition.c |   21 ---
 board/calao/sbc35_a9g20/Kconfig|   12 --
 board/calao/sbc35_a9g20/MAINTAINERS|7 -
 board/calao/sbc35_a9g20/Makefile   |   13 --
 board/calao/sbc35_a9g20/config.mk  |1 -
 board/calao/sbc35_a9g20/sbc35_a9g20.c  |  155 --
 board/calao/sbc35_a9g20/spi.c  |   41 -
 board/calao/tny_a9260/Kconfig  |   12 --
 board/calao/tny_a9260/MAINTAINERS  |9 --
 board/calao/tny_a9260/Makefile |   13 --
 board/calao/tny_a9260/config.mk|1 -
 board/calao/tny_a9260/spi.c|   34 
 board/calao/tny_a9260/tny_a9260.c  |   85 --
 configs/afeb9260_defconfig |3 -
 configs/sbc35_a9g20_eeprom_defconfig   |4 -
 configs/sbc35_a9g20_nandflash_defconfig|4 -
 configs/tny_a9260_eeprom_defconfig |4 -
 configs/tny_a9260_nandflash_defconfig  |4 -
 configs/tny_a9g20_eeprom_defconfig |4 -
 configs/tny_a9g20_nandflash_defconfig  |4 -
 doc/README.scrapyard   |   19 ++-
 include/configs/afeb9260.h |  156 --
 include/configs/at91-sama5_common.h|2 +-
 include/configs/at91sam9rlek.h |2 +-
 include/configs/sbc35_a9g20.h  |  169 
 include/configs/tny_a9260.h|  150 -
 33 files changed, 14 insertions(+), 1120 deletions(-)
 delete mode 100644 board/afeb9260/Kconfig
 delete mode 100644 board/afeb9260/MAINTAINERS
 delete mode 100644 board/afeb9260/Makefile
 delete mode 100644 board/afeb9260/afeb9260.c
 delete mode 100644 board/afeb9260/config.mk
 delete mode 100644 board/afeb9260/partition.c
 delete mode 100644 board/calao/sbc35_a9g20/Kconfig
 delete mode 100644 board/calao/sbc35_a9g20/MAINTAINERS
 delete mode 100644 board/calao/sbc35_a9g20/Makefile
 delete mode 100644 board/calao/sbc35_a9g20/config.mk
 delete mode 100644 board/calao/sbc35_a9g20/sbc35_a9g20.c
 delete mode 100644 board/calao/sbc35_a9g20/spi.c
 delete mode 100644 board/calao/tny_a9260/Kconfig
 delete mode 100644 board/calao/tny_a9260/MAINTAINERS
 delete mode 100644 board/calao/tny_a9260/Makefile
 delete mode 100644 board/calao/tny_a9260/config.mk
 delete mode 100644 board/calao/tny_a9260/spi.c
 delete mode 100644 board/calao/tny_a9260/tny_a9260.c
 delete mode 100644 configs/afeb9260_defconfig
 delete mode 100644 configs/sbc35_a9g20_eeprom_defconfig
 delete mode 100644 configs/sbc35_a9g20_nandflash_defconfig
 delete mode 100644 configs/tny_a9260_eeprom_defconfig
 delete mode 100644 configs/tny_a9260_nandflash_defconfig
 delete mode 100644 configs/tny_a9g20_eeprom_defconfig
 delete mode 100644 configs/tny_a9g20_nandflash_defconfig
 delete mode 100644 include/configs/afeb9260.h
 delete mode 100644 include/configs/sbc35_a9g20.h
 delete mode 100644 include/configs/tny_a9260.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 3/3] Remove the bootm_find_other() wrapper

2015-05-13 Thread Karl Apsite
The bootm_find_other() function was only called once, and ran a quick
check before it called bootm_find_images(). This wrapper function was
removed by moving the conditional to do_bootm_states (where find_other
was being called) and calling bootm_find_images directly.

Signed-off-by: Karl Apsite karl.aps...@dornerworks.com
---

 common/bootm.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index ae0d674..13f2bc9 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -241,19 +241,6 @@ int bootm_find_images(int flag, int argc, char * const 
argv[])
 
return 0;
 }
-
-static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
-   char * const argv[])
-{
-   if (((images.os.type == IH_TYPE_KERNEL) ||
-(images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
-(images.os.type == IH_TYPE_MULTI)) 
-   (images.os.os == IH_OS_LINUX ||
-images.os.os == IH_OS_VXWORKS))
-   return bootm_find_images(flag, argc, argv);
-
-   return 0;
-}
 #endif /* USE_HOSTC */
 
 /**
@@ -581,7 +568,15 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[],
ret = bootm_find_os(cmdtp, flag, argc, argv);
 
if (!ret  (states  BOOTM_STATE_FINDOTHER)) {
-   ret = bootm_find_other(cmdtp, flag, argc, argv);
+   if (((images.os.type == IH_TYPE_KERNEL) ||
+(images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
+(images.os.type == IH_TYPE_MULTI)) 
+   (images.os.os == IH_OS_LINUX ||
+images.os.os == IH_OS_VXWORKS))
+   ret = bootm_find_images(flag, argc, argv);
+   else
+   ret = 0;
+
argc = 0;   /* consume the args */
}
 
-- 
2.3.7

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


[U-Boot] [PATCH v1 2/3] Combine bootm_find_thing functions together

2015-05-13 Thread Karl Apsite
bootm_find_ramdisk_fdt() renamed to bootm_find_images() for readability.

The function bootm_find_ramdisk_fdt() appears to be a simple wrapper for
bootm_find_ramdisk(), bootm_find_fdt(), and now bootm_find_loadables().
I didn't see any other callers entering a bootm_findthing, so removing
the wrapper, and condensing these together hopefully makes the code a
little simpler.

Signed-off-by: Karl Apsite karl.aps...@dornerworks.com
---

 common/bootm.c | 37 ++---
 common/cmd_bootm.c |  4 ++--
 include/bootm.h|  2 +-
 3 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index f04e49b..ae0d674 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -206,7 +206,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int 
argc,
return 0;
 }
 
-static int bootm_find_ramdisk(int flag, int argc, char * const argv[])
+int bootm_find_images(int flag, int argc, char * const argv[])
 {
int ret;
 
@@ -218,14 +218,7 @@ static int bootm_find_ramdisk(int flag, int argc, char * 
const argv[])
return 1;
}
 
-   return 0;
-}
-
 #if defined(CONFIG_OF_LIBFDT)
-static int bootm_find_fdt(int flag, int argc, char * const argv[])
-{
-   int ret;
-
/* find flattened device tree */
ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, images,
   images.ft_addr, images.ft_len);
@@ -233,18 +226,10 @@ static int bootm_find_fdt(int flag, int argc, char * 
const argv[])
puts(Could not find a valid device tree\n);
return 1;
}
-
set_working_fdt_addr((ulong)images.ft_addr);
-
-   return 0;
-}
 #endif
 
 #if defined(CONFIG_FIT)
-static int bootm_find_loadables(int flag, int argc, char * const argv[])
-{
-   int ret;
-
/* find all of the loadables */
ret = boot_get_loadable(argc, argv, images, IH_ARCH_DEFAULT,
   NULL, NULL);
@@ -252,24 +237,6 @@ static int bootm_find_loadables(int flag, int argc, char * 
const argv[])
puts(Loadable(s) is corrupt or invalid\n);
return 1;
}
-
-   return 0;
-}
-#endif
-
-int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[])
-{
-   if (bootm_find_ramdisk(flag, argc, argv))
-   return 1;
-
-#if defined(CONFIG_OF_LIBFDT)
-   if (bootm_find_fdt(flag, argc, argv))
-   return 1;
-#endif
-
-#if defined(CONFIG_FIT)
-   if (bootm_find_loadables(flag, argc, argv))
-   return 1;
 #endif
 
return 0;
@@ -283,7 +250,7 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int 
argc,
 (images.os.type == IH_TYPE_MULTI)) 
(images.os.os == IH_OS_LINUX ||
 images.os.os == IH_OS_VXWORKS))
-   return bootm_find_ramdisk_fdt(flag, argc, argv);
+   return bootm_find_images(flag, argc, argv);
 
return 0;
 }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 6b6aca6..48738ac 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -580,7 +580,7 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
 * have a header that provide this informaiton.
 */
-   if (bootm_find_ramdisk_fdt(flag, argc, argv))
+   if (bootm_find_images(flag, argc, argv))
return 1;
 
return 0;
@@ -721,7 +721,7 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
 * have a header that provide this informaiton.
 */
-   if (bootm_find_ramdisk_fdt(flag, argc, argv))
+   if (bootm_find_images(flag, argc, argv))
return 1;
 
return 0;
diff --git a/include/bootm.h b/include/bootm.h
index 6181488..4981377 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -49,7 +49,7 @@ int boot_selected_os(int argc, char * const argv[], int state,
 ulong bootm_disable_interrupts(void);
 
 /* This is a special function used by booti/bootz */
-int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[]);
+int bootm_find_images(int flag, int argc, char * const argv[]);
 
 int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int states, bootm_headers_t *images, int boot_progress);
-- 
2.3.7

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


[U-Boot] [PATCH v1 1/3] add boot_get_loadables() to load listed images

2015-05-13 Thread Karl Apsite
From: Karl Apsite karl.aps...@dornerworks.com

Added a trimmed down instance of boot_get_thing() to satisfy the
minimum requierments of the added feature.  The function follows the
normal patterns set by other boot_getthing's, which should make it a
bit easier to combine them all together into one boot_get_image()
function in a later refactor.

Documentation for the new function can be found in source:
  common/image.c

Signed-off-by: Karl Apsite karl.aps...@dornerworks.com
---

 common/bootm.c  | 22 +
 common/image-fit.c  |  8 -
 common/image.c  | 93 +
 include/bootstage.h |  1 +
 include/image.h |  5 ++-
 5 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index 6842029..f04e49b 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -240,6 +240,23 @@ static int bootm_find_fdt(int flag, int argc, char * const 
argv[])
 }
 #endif
 
+#if defined(CONFIG_FIT)
+static int bootm_find_loadables(int flag, int argc, char * const argv[])
+{
+   int ret;
+
+   /* find all of the loadables */
+   ret = boot_get_loadable(argc, argv, images, IH_ARCH_DEFAULT,
+  NULL, NULL);
+   if (ret) {
+   puts(Loadable(s) is corrupt or invalid\n);
+   return 1;
+   }
+
+   return 0;
+}
+#endif
+
 int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[])
 {
if (bootm_find_ramdisk(flag, argc, argv))
@@ -250,6 +267,11 @@ int bootm_find_ramdisk_fdt(int flag, int argc, char * 
const argv[])
return 1;
 #endif
 
+#if defined(CONFIG_FIT)
+   if (bootm_find_loadables(flag, argc, argv))
+   return 1;
+#endif
+
return 0;
 }
 
diff --git a/common/image-fit.c b/common/image-fit.c
index 245264d..fe23c13 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1544,6 +1544,8 @@ static const char *fit_get_image_type_property(int type)
return FIT_RAMDISK_PROP;
case IH_TYPE_X86_SETUP:
return FIT_SETUP_PROP;
+   case IH_TYPE_LOADABLE:
+   return FIT_LOADABLE_PROP;
}
 
return unknown;
@@ -1661,7 +1663,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
os_ok = image_type == IH_TYPE_FLATDT ||
fit_image_check_os(fit, noffset, IH_OS_LINUX) ||
fit_image_check_os(fit, noffset, IH_OS_OPENRTOS);
-   if (!type_ok || !os_ok) {
+
+   /* If either of the checks fail, we should report an error, but
+* if the image type is coming from the loadables field, we
+* don't care about what it is */
+   if ((!type_ok || !os_ok)  image_type != IH_TYPE_LOADABLE) {
fit_image_get_os(fit, noffset, os);
printf(No %s %s %s Image\n,
   genimg_get_os_name(os),
diff --git a/common/image.c b/common/image.c
index fdec496..dc7e795 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1165,6 +1165,99 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch,
 #endif
 }
 
+/**
+ * boot_get_loadable - routine to load a list of binaries to memory
+ * @argc: Ignored Argument
+ * @argv: Ignored Argument
+ * @images: pointer to the bootm images structure
+ * @arch: expected architecture for the image
+ * @ld_start: Ignored Argument
+ * @ld_len: Ignored Argument
+ *
+ * boot_get_loadable() will take the given FIT configuration, and look
+ * for a field named loadables.  Loadables, is a list of elements in
+ * the FIT given as strings.  exe:
+ *   loadables = linux_kernel@1, fdt@2;
+ * this function will attempt to parse each string, and load the
+ * corresponding element from the FIT into memory.  Once placed,
+ * no aditional actions are taken.
+ *
+ * returns:
+ * 0, if only valid images or no images are found
+ * error code, if an error occurs during fit_image_load
+ */
+#if defined(CONFIG_FIT)
+int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
+   uint8_t arch, const ulong *ld_start, ulong * const ld_len)
+{
+   /*
+* These variabels are used to hold the current image location
+* in system memory.
+*/
+   ulong tmp_img_addr;
+   /* These are not used */
+   ulong img_data, img_len;
+   void *buf;
+   char *uname;
+   char *uname_end;
+   int len, fit_img_result;
+   /* Check to see if the images struct has a FIT configuration */
+   if (genimg_has_config(images)) {
+   /*
+* Obtain the os FIT header from the images struct
+* copy from dataflash if needed
+*/
+   tmp_img_addr = map_to_sysmem(images-fit_hdr_os);
+   tmp_img_addr = genimg_get_image(tmp_img_addr);
+   buf = map_sysmem(tmp_img_addr, 0);
+   /*
+* Check image type. For FIT images get FIT node
+* and attempt to locate a 

[U-Boot] [PATCH v1 0/3] New tag for Flattened Image Trees (FIT) - Booting Xen from a FIT.

2015-05-13 Thread Karl Apsite

The FIT config now supports a tag named loadables: which is a
comma separated list.  Users can add any number of images to the list,
and u-boot will move the selected binaries to their listed
load_addresses. This allows u-boot to boot xen from using an FIT
configuration.  Xen expects a kernel to be placed at a predetermined
location, however the kernel field was already filled by xen itself.
This change allows the user to move the required binary before xen
boots, all within the FIT's configuration.


Karl Apsite (3):
  add boot_get_loadables() to load listed images
  Combine bootm_find_thing functions together
  Remove the bootm_find_other() wrapper

 common/bootm.c  | 50 ++--
 common/cmd_bootm.c  |  4 +--
 common/image-fit.c  |  8 -
 common/image.c  | 93 +
 include/bootm.h |  2 +-
 include/bootstage.h |  1 +
 include/image.h |  5 ++-
 7 files changed, 125 insertions(+), 38 deletions(-)

-- 
2.3.7

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


[U-Boot] [PATCH v2 2/9] arm: spl: Add an API to detect when U-Boot is started from SPL

2015-05-13 Thread Simon Glass
For secure boot systems it is common to have a read-only U-Boot which starts
the machine and jumps to a read-write U-Boot for actual booting the OS. This
allows the read-write U-Boot to be upgraded without risk of permanently
bricking the machine. In the event that the read-write U-Boot is corrupted,
the read-only U-Boot can detect this with a checksum and boot into a
recovery flow.

To support this, add a way to detect when U-Boot is run from SPL as opposed
to some other method, such as booted directly (no SPL) or started from
another source (e.g. a primary U-Boot). This works by putting a special value
in r0.

For now we rely on board-specific code to actually check the register and
set a flag. At some point this could be generalised, perhaps by using a spare
register and passing a flag to _main and/or board_init_f().

This commit does not implement any feature, but merely provides the API for
boards to implement.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Clarify that this commit provides only the API, not the implementation
- Rename constant to UBOOT_NOT_LOADED_FROM_SPL

 include/spl.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/spl.h b/include/spl.h
index b2e5bf7..d19940f 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -11,6 +11,8 @@
 #include linux/compiler.h
 #include asm/spl.h
 
+/* Value in r0 indicates we booted from U-Boot */
+#define UBOOT_NOT_LOADED_FROM_SPL  0x13578642
 
 /* Boot type */
 #define MMCSD_MODE_UNDEFINED   0
@@ -82,4 +84,15 @@ int spl_load_image_ext_os(block_dev_desc_t *block_dev, int 
partition);
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void);
 #endif
+
+/**
+ * spl_was_boot_source() - check if U-Boot booted from SPL
+ *
+ * This will normally be true, but if U-Boot jumps to second U-Boot, it will
+ * be false. This should be implemented by board-specific code.
+ *
+ * @return true if U-Boot booted from SPL, else false
+ */
+bool spl_was_boot_source(void);
+
 #endif
-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH 18/20] Add Chrome OS config header

2015-05-13 Thread Simon Glass
Hi Stephen,

On 25 February 2015 at 16:28, Stephen Warren swar...@wwwdotorg.org wrote:

 On 02/17/2015 03:29 PM, Simon Glass wrote:

 From: Doug Anderson diand...@chromium.org

 This header includes useful scripts which can be used with any board that
 can boot Chrome OS.

 In particular, 'run nvboot' will boot a board without verified boot enabled.


 I think this needs a bit of minification for an upstream U-Boot. In 
 particular, many of the environment variables overlap semantically or by name 
 with those from include/config_distro_*.h, and I'd like to see any U-Boot for 
 the Tegra Chromebooks (at least) support booting both ChromeOS kernels and 
 arbitrary distros using the environment from config_distro_bootcmd.h.

That would be good. I think it is possible also, although I haven't
been able to make it work so far. I can get it to find the kernel,
although not the one that it needs and the U-Boot scripts are in a
different place on the disk in Chrome OS. Also the command line args
are wrong.

So I think for now we should either apply this as it is (since it
works) or wait until someone has time to rationalise things a bit and
figure out how to support Chrome OS booting in the distro stuff.


 diff --git a/include/configs/chromeos.h b/include/configs/chromeos.h


 +/* Stringify a token */
 +#ifndef STRINGIFY
 +#define _STRINGIFY(x)  #x
 +#define STRINGIFY(x)   _STRINGIFY(x)
 +#endif


 Shouldn't that be in some common header so it isn't ever duplicated?

Yes I'll drop it since U-Boot has its own now.


 +#define CONFIG_CROS_FULL


 There are a ton of macros in here without much in the way of explanation. 
 Shouldn't everything be documented in the README?

The documentation for these is at the top of the file:

+ * In anticipation of implementing early firmware selection, these defines
+ * signal the features that are required in U-Boot.
+ *
+ * The defines munging is thus kept to one Chrome OS-specific file. The
+ * upstream boards will define all features as normal for their platform.
+ *
+ * It is possible that these will be too broad for some platforms - e.g. we
+ * may have a platform which wants to use MMC in CONFIG_CROS_RO. However,
+ * we can deal with additional needs as we come to them.
+ *
+ * While it is something of an inconvenience, it may improve boot time on
+ * some platforms also.
+ *
+ *   CONFIG_CROS_LARGE
+ * - Full version as now with factory defined, all features enabled
+ * - This will operate as factory build, or verified boot
+ *
+ *   CONFIG_CROS_SMALL
+ * - Minimized for use only with verified boot
+ * - No command line, filesystems, LCD console, etc.
+ * - Still has all drivers enabled and can perform verified boot
+ *
+ *   CONFIG_CROS_RO
+ * - Requires CONFIG_CROS_SMALL. Will only support running RO firmware
+ * - Set up for running VbLoadFirmware() only
+ * - Minimal RAM, no display, no USB, no mass storage (SPI flash only)
+ * - Intended for running in SPL
+ *
+ *   CONFIG_CROS_RW
+ * - Requires CONFIG_CROS_SMALL. Will only support running RW firmware
+ * - Set up for running VbSelectAndLoadKernel() only

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


Re: [U-Boot] [PATCH] usb: kbd: Fix key repeat not always using

2015-05-13 Thread Hans de Goede

Hi,

On 12-05-15 21:30, Marek Vasut wrote:

On Tuesday, May 12, 2015 at 06:58:23 PM, Hans de Goede wrote:

The usb-kbd key repeat code assumes that reports get repeated every 40 ms,
this is never true when using CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP, and
does not always works for CONFIG_SYS_USB_EVENT_POLL and
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE since not all usb keyboards honor
the usb_set_idle() command.

For CONFIG_SYS_USB_EVENT_POLL we must use usb_set_idle() since we do a
blocking wait for the hid report, so if we do not tell the keyboard to send
a hid report every 40ms even if nothing changes then we will block u-boot
for 1s (the default u-boot usb interrupt packet timeout). Note that in this
case on keyboards which do not support usb_set_idle() we loose and we
actually get 1s latencies on other u-boot activities.

For the other poll-methods this commit stops using usb_set_idle() and
instead repeats the last received hid-report every 40 ms as long as no new
hid-report is received. This fixes key-repeat not working at all with
CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP and fixes it not working with
keyboards which do not implement usb_set_idle() when using
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE.

Signed-off-by: Hans de Goede hdego...@redhat.com


Looks reasonable, I don't really care about the ifdef indent, but the
data type for get_timer() should be fixed. Otherwise,


OK v2 with last_report changed to unsigned_long is coming up.


Reviewed-by: Marek Vasut ma...@denx.de

Would this finally be a patch to pick through the USB tree ? :b


Yes!  :)

Regards,

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


Re: [U-Boot] Patch to enable LEDs on sunxi/Cubietruck

2015-05-13 Thread Simon Glass
Hi Hans,

On 12 May 2015 at 09:15, Hans de Goede hdego...@redhat.com wrote:
 Hi,

 On 05/12/2015 03:39 PM, Prof. Dr. Gundolf Kiefer wrote:

 Dear developers,

 the attached patch adds LED support for the Cubietruck board.

 I found that the support for the onboard leds is missing for
 sunxi-based boards in the latest Debian unstable and perhaps
 upstream version of U-Boot. IMHO LEDs are very helpful for headless
 systems. Perhaps the patch can be helpful somehow.

 The code has basically been ported from the U-Boot version maintained at
 linux-sunxi.org. As in the sunxi version, the blue led is switched on
 by default.

 Kind regards,

 Gundolf Kiefer


 Thanks for the patch, but we really do not want to add new options to
 CONFIG_SYS_EXTRA_OPTIONS, at a minimum you need to add new Kconfig
 options for the leds, using gpio names for them, and sunxi_name_to_gpio
 in some place to translate to gpio numbers.

 But we really do not want that either for upstream u-boot master we've
 switched to using devicetree for all sunxi boards, and we really want
 to use devicetree for this, which already has the led info, rather then
 duplicating the led info in sunxi defconfig files.

 Simon, do we already have support for gpio-leds through devicetree
 in the device-model code somewhere?

No there is no driver at present. But given that we have
gpio_request_by_name() this should be pretty simple to implement (i.e.
the GPIO binding is already supported). I'm happy to help with
pointers/advice if you like.

Regards,
Simon


 Regards,

 Hans






 Begin forwarded message:

 Date: Tue, 05 May 2015 09:46:39 -0700
 From: Vagrant Cascadian vagr...@aikidev.net
 To: Prof. Dr. Gundolf Kiefer gundolf.kie...@hs-augsburg.de,
 783...@bugs.debian.org Subject: Re: Bug#783846: Patch to enable LEDs on
 sunix/Cubietruck


 On 2015-04-30, Prof. Dr. Gundolf Kiefer wrote:

 It seems that the support for the onboard leds is missing for
 sunxi-based boards even in the latest version (Debian unstable). IMHO
 LEDs are very helpful for headless systems.


 Thanks for the patches!

 If you could submit these patches to u-boot upstream, that would be
 best; we're trying to minimize the patches that are not already included
 upstream.


 live well,
vagrant



 ---
 Prof. Dr. Gundolf Kiefer
 Effiziente Eingebettete Systeme  -  Efficient Embedded Systems
 Fakultät für Informatik  -  Faculty of Computer Science
 Hochschule Augsburg - University of Applied Sciences
 http://www.hs-augsburg.de/~kiefer
 ---


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


[U-Boot] [PATCH v2 01/16] tegra: cros_ec: Add tegra support for Chrome OS EC

2015-05-13 Thread Simon Glass
This requires a change to stdin to include the 'cros-ec-keyb' input device.
Put this in the common file, enabled by the relevant CONFIG.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 include/configs/tegra-common-post.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index 46a155d..2de5d36 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -40,8 +40,14 @@
 #define STDOUT_LCD 
 #endif
 
+#ifdef CONFIG_CROS_EC_KEYB
+#define STDOUT_CROS_EC ,cros-ec-keyb
+#else
+#define STDOUT_CROS_EC 
+#endif
+
 #define TEGRA_DEVICE_SETTINGS \
-   stdin=serial STDIN_KBD_KBC STDIN_KBD_USB \0 \
+   stdin=serial STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC \0 \
stdout=serial STDOUT_LCD \0 \
stderr=serial STDOUT_LCD \0 \

-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 06/16] tegra: clock: Adjust PLL access to avoid a warning

2015-05-13 Thread Simon Glass
A harmless but confusing warning is displayed when looking up the
DisplayPort PLL. Correct this.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/mach-tegra/clock.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 5908260..24047b8 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -84,7 +84,7 @@ static struct clk_pll *get_pll(enum clock_id clkid)
 
assert(clock_id_is_pll(clkid));
if (clkid = (enum clock_id)TEGRA_CLK_PLLS) {
-   debug(%s: Invalid PLL\n, __func__);
+   debug(%s: Invalid PLL %d\n, __func__, clkid);
return NULL;
}
return clkrst-crc_pll[clkid];
@@ -120,9 +120,12 @@ int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 
*divn,
 unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
u32 divp, u32 cpcon, u32 lfcon)
 {
-   struct clk_pll *pll = get_pll(clkid);
+   struct clk_pll *pll = NULL;
u32 misc_data, data;
 
+   if (clkid  (enum clock_id)TEGRA_CLK_PLLS)
+   pll = get_pll(clkid);
+
/*
 * We cheat by treating all PLL (except PLLU) in the same fashion.
 * This works only because:
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 15/16] tegra: Replace 'Norrin' with 'Nyan-big' and fix typo

2015-05-13 Thread Simon Glass
With the rename the MAINTAINER file was not updated. Fix it and the
'Chrombook' typo in Kconfig.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/mach-tegra/tegra124/Kconfig | 2 +-
 board/nvidia/nyan-big/MAINTAINERS| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra124/Kconfig 
b/arch/arm/mach-tegra/tegra124/Kconfig
index 88f627c..0cdb933 100644
--- a/arch/arm/mach-tegra/tegra124/Kconfig
+++ b/arch/arm/mach-tegra/tegra124/Kconfig
@@ -7,7 +7,7 @@ config TARGET_JETSON_TK1
bool NVIDIA Tegra124 Jetson TK1 board
 
 config TARGET_NYAN_BIG
-   bool Google/NVIDIA Nyan-big Chrombook
+   bool Google/NVIDIA Nyan-big Chromebook
help
  Nyan Big is a Tegra124 clamshell board that is very similar
  to venice2, but it has a different panel, the sdcard CD and WP
diff --git a/board/nvidia/nyan-big/MAINTAINERS 
b/board/nvidia/nyan-big/MAINTAINERS
index ff74627..7790777 100644
--- a/board/nvidia/nyan-big/MAINTAINERS
+++ b/board/nvidia/nyan-big/MAINTAINERS
@@ -1,4 +1,4 @@
-NORRIN BOARD
+NYAN-BIG BOARD
 M: Allen Martin amar...@nvidia.com
 S: Maintained
 F: board/nvidia/nyan-big/
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 04/16] tegra: spi: Support slow SPI rates

2015-05-13 Thread Simon Glass
Use the oscillator as the source clock when we cannot achieve a low-enough
speed with the peripheral clock. This happens when we request 3MHz on a SPI
clock, for example.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 drivers/spi/tegra114_spi.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 0d69376..d7eecd5 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -144,6 +144,7 @@ static int tegra114_spi_probe(struct udevice *bus)
struct tegra_spi_platdata *plat = dev_get_platdata(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
struct spi_regs *regs;
+   ulong rate;
 
priv-regs = (struct spi_regs *)plat-base;
regs = priv-regs;
@@ -152,9 +153,20 @@ static int tegra114_spi_probe(struct udevice *bus)
priv-freq = plat-frequency;
priv-periph_id = plat-periph_id;
 
-   /* Change SPI clock to correct frequency, PLLP_OUT0 source */
-   clock_start_periph_pll(priv-periph_id, CLOCK_ID_PERIPH,
-  priv-freq);
+   /*
+* Change SPI clock to correct frequency, PLLP_OUT0 source, falling
+* back to the oscillator if that is too fast.
+*/
+   rate = clock_start_periph_pll(priv-periph_id, CLOCK_ID_PERIPH,
+ priv-freq);
+   if (rate  priv-freq + 10) {
+   rate = clock_start_periph_pll(priv-periph_id, CLOCK_ID_OSC,
+ priv-freq);
+   if (rate != priv-freq) {
+   printf(Warning: SPI '%s' requested clock %u, actual 
clock %lu\n,
+  bus-name, priv-freq, rate);
+   }
+   }
 
/* Clear stale status here */
setbits_le32(regs-fifo_status,
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 07/16] tegra: Introduce SRAM repair on tegra124

2015-05-13 Thread Simon Glass
This is required in order to avoid instability when running from caches
after the kernel starts.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra124/flow.h | 12 
 arch/arm/mach-tegra/powergate.c   | 20 +++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-tegra124/flow.h 
b/arch/arm/include/asm/arch-tegra124/flow.h
index 0db1881..ab5cd78 100644
--- a/arch/arm/include/asm/arch-tegra124/flow.h
+++ b/arch/arm/include/asm/arch-tegra124/flow.h
@@ -26,6 +26,12 @@ struct flow_ctlr {
u32 cpu_pwr_csr;/* offset 0x38 */
u32 mpid;   /* offset 0x3c */
u32 ram_repair; /* offset 0x40 */
+   u32 flow_dbg_sel;   /* offset 0x44 */
+   u32 flow_dbg_cnt0;  /* offset 0x48 */
+   u32 flow_dbg_cnt1;  /* offset 0x4c */
+   u32 flow_dbg_qual;  /* offset 0x50 */
+   u32 flow_ctlr_spare;/* offset 0x54 */
+   u32 ram_repair_cluster1;/* offset 0x58 */
 };
 
 /* HALT_COP_EVENTS_0, 0x04 */
@@ -37,4 +43,10 @@ struct flow_ctlr {
 /* FLOW_CTLR_CLUSTER_CONTROL_0 0x2c */
 #define ACTIVE_LP  (1  0)
 
+/* RAM_REPAIR, 0x40, 0x58 */
+enum {
+   RAM_REPAIR_REQ = 0x1  0,
+   RAM_REPAIR_STS = 0x1  1,
+};
+
 #endif /*  _TEGRA124_FLOW_H_ */
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 439cff3..7db348e 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -9,7 +9,7 @@
 
 #include asm/io.h
 #include asm/types.h
-
+#include asm/arch/flow.h
 #include asm/arch/powergate.h
 #include asm/arch/tegra.h
 
@@ -75,11 +75,29 @@ static int tegra_powergate_remove_clamping(enum 
tegra_powergate id)
return 0;
 }
 
+static void tegra_powergate_ram_repair(void)
+{
+#ifdef CONFIG_TEGRA124
+   struct flow_ctlr *flow = (struct flow_ctlr *)NV_PA_FLOW_BASE;
+
+   /* Request RAM repair for cluster 0 and wait until complete */
+   setbits_le32(flow-ram_repair, RAM_REPAIR_REQ);
+   while (!(readl(flow-ram_repair)  RAM_REPAIR_STS))
+   ;
+
+   /* Same for cluster 1 */
+   setbits_le32(flow-ram_repair_cluster1, RAM_REPAIR_REQ);
+   while (!(readl(flow-ram_repair_cluster1)  RAM_REPAIR_STS))
+   ;
+#endif
+}
+
 int tegra_powergate_sequence_power_up(enum tegra_powergate id,
  enum periph_id periph)
 {
int err;
 
+   tegra_powergate_ram_repair();
reset_set_enable(periph, 1);
 
err = tegra_powergate_power_on(id);
-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH 5/6] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller.

2015-05-13 Thread Peter Griffin
Hi Marek,

On Tue, 12 May 2015, Marek Vasut wrote:

 On Tuesday, May 12, 2015 at 03:38:31 PM, Peter Griffin wrote:
  This patch adds the glue code for hi6220 SoC which has 2x synopsis
  dw_mmc controllers. This will be used by the hikey board support
  in subsequent patches.
  
  Signed-off-by: Peter Griffin peter.grif...@linaro.org
 
 [...]
 
  diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c
  new file mode 100644
  index 000..a3880a3
  --- /dev/null
  +++ b/drivers/mmc/hi6220_dw_mmc.c
  @@ -0,0 +1,63 @@
  +/*
  + * (C) Copyright 2015 Linaro
  + * peter.griffin peter.grif...@linaro.org
  + *
  + * SPDX-License-Identifier:GPL-2.0+
  + */
  +
  +#include common.h
  +#include dwmmc.h
  +#include malloc.h
  +#include asm-generic/errno.h
  +
  +#defineDWMMC_MAX_CH_NUM4
  +
  +/*
  +#defineDWMMC_MAX_FREQ  5200
  +#defineDWMMC_MIN_FREQ  40
  +*/
 
 Please zap these dead macros.

Ok will fix in v2.
 
  +/*TODO we should probably use the frequencies above, but ATF uses
  +  the ones below so stick with that for the moment */
  +#defineDWMMC_MAX_FREQ  5000
  +#defineDWMMC_MIN_FREQ  378000
  +
  +/* Source clock is configured to 100Mhz by ATF bl1*/
  +#define MMC0_DEFAULT_FREQ  1
 
 [...]
 
  +int hi6220_dwmci_add_port(int index, u32 regbase, int bus_width)
  +{
  +   struct dwmci_host *host = NULL;
  +
  +   host = malloc(sizeof(struct dwmci_host));
 
 calloc(1, sizeof(...)) so the data are inited/zero'd out please.
 [...]

Ok will fix in v2

regards,

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


[U-Boot] [PATCH v2 00/16] tegra: Expand Nyan-big support

2015-05-13 Thread Simon Glass
This series expands Nyan-big support:

- Enable Chrome OS EC, so that the keyboard works
- Add some extra clock and pre-kernel init required for reliable operation
- Add Chrome OS environment variables, including 'run nvboot' to allow
booting Chrome OS more easily

Still missing are audio and USB.

Changes in v2:
- Use spi-max-frequency in both the bus and slave nodes
- Remove unnecessary ODMDATA mangling
- Use existing __stringify() macro
- Drop tegra timer patch as it is not needed
- Drop a few patches that have already been applied

Doug Anderson (1):
  Add Chrome OS config header

Simon Glass (15):
  tegra: cros_ec: Add tegra support for Chrome OS EC
  tegra: spi: Drop the claim_bus() method to correct delays
  dm: tegra: cros_ec: Enable Chrome OS EC on Nyan-big
  tegra: spi: Support slow SPI rates
  tegra: clock: Support enabling external clocks
  tegra: clock: Adjust PLL access to avoid a warning
  tegra: Introduce SRAM repair on tegra124
  tegra: Add missing tegra124 peripherals
  tegra: Increase maximum arguments to 32
  tegra: lcd: Tidy up clock init
  tegra: Allow board-specific init
  tegra: nyan-big: Add additional clock and kernel init
  tegra: config: Allow Chrome OS environment settings to be included
  tegra: Replace 'Norrin' with 'Nyan-big' and fix typo
  tegra: config: nyan-big: Add options required by Chrome OS boot

 arch/arm/dts/tegra124-nyan-big.dts|   3 +
 arch/arm/include/asm/arch-tegra/clock.h   |   8 +
 arch/arm/include/asm/arch-tegra/sys_proto.h   |   7 +
 arch/arm/include/asm/arch-tegra124/clock-tables.h |  12 +-
 arch/arm/include/asm/arch-tegra124/flow.h |  12 +
 arch/arm/mach-tegra/clock.c   |  24 +-
 arch/arm/mach-tegra/powergate.c   |  20 +-
 arch/arm/mach-tegra/tegra124/Kconfig  |   2 +-
 arch/arm/mach-tegra/tegra124/clock.c  |   2 +-
 board/nvidia/common/board.c   |   8 +-
 board/nvidia/nyan-big/MAINTAINERS |   2 +-
 board/nvidia/nyan-big/nyan-big.c  |  69 
 configs/nyan-big_defconfig|   5 +
 drivers/spi/tegra114_spi.c|  40 +-
 drivers/video/tegra124/tegra124-lcd.c |   4 +-
 include/configs/chromeos.h| 457 ++
 include/configs/nyan-big.h|   9 +
 include/configs/tegra-common-post.h   |  15 +-
 include/configs/tegra-common.h|   2 +-
 19 files changed, 663 insertions(+), 38 deletions(-)
 create mode 100644 include/configs/chromeos.h

-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH v5 15/15] sunxi: ohci: Add ohci usb host controller support

2015-05-13 Thread Hans de Goede

Hi,

On 13-05-15 00:39, Simon Glass wrote:

Hi Hans,

On 12 May 2015 at 01:23, Hans de Goede hdego...@redhat.com wrote:


Hi Simon,


On 12-05-15 00:37, Simon Glass wrote:


On 10 May 2015 at 06:10, Hans de Goede hdego...@redhat.com wrote:


This commit adds support for the OHCI companion controller, which makes
usb-1 devices directly plugged into to usb root port work.

Note for now this switches usb-keyboard support for sunxi back from int-queue
support to the old interrupt polling method. Adding int-queue support to the
ohci code and switching back to int-queue support is in the works.

Signed-off-by: Hans de Goede hdego...@redhat.com
Acked-by: Marek Vasut ma...@denx.de
Acked-by: Ian Campbell i...@hellion.org.uk
---
   arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   2 +
   arch/arm/include/asm/arch-sunxi/clock_sun6i.h |   2 +
   drivers/usb/host/Makefile |   1 +
   drivers/usb/host/ohci-sunxi.c | 104 
++
   include/configs/sunxi-common.h|   5 +-
   5 files changed, 113 insertions(+), 1 deletion(-)
   create mode 100644 drivers/usb/host/ohci-sunxi.c



Applied to u-boot-dm, thanks!



Thanks for merging this series!

Can you pick up these patches from yesterday too ? They have already
been reviewed and acked by Marek, and they sit on to of
this series :

http://patchwork.ozlabs.org/patch/471001/
http://patchwork.ozlabs.org/patch/471004/
http://patchwork.ozlabs.org/patch/471003/
http://patchwork.ozlabs.org/patch/471005/

Note the last one has queue misspelled (twice) in the commit
msg you may want to amend that.


I get a build error with M5485BFE. I stopped the build after that so
there may be others.

21: sunxi: Change usb-kbd interrupt polling to use an usb interrupt queue
   m68k:  +   M5485BFE
-make[2]: *** [drivers/usb/musb-new/musb_host.o] Interrupt
-make[1]: *** [drivers/usb/musb-new] Interrupt
-make: *** wait: No child processes.  Stop.
-make[2]: *** Deleting file `drivers/mmc/mmc.o'
-make[2]: *** [drivers/mmc/mmc.o] Interrupt
-make[1]: *** [drivers/mmc] Interrupt
+../drivers/usb/host/ohci-hcd.c:1637:46: error: 'struct usb_device'
has no member named 'dev'
+../drivers/usb/host/ohci-hcd.c: In function '_ohci_poll_int_queue':
+../drivers/usb/host/ohci-hcd.c:1683:46: error: 'struct usb_device'
has no member named 'dev'
+make[2]: *** [drivers/usb/host/ohci-hcd.o] Error 1
+make[1]: *** [drivers/usb/host] Error 2
+make: *** [sub-make] Error 2
w+../drivers/usb/host/ohci-hcd.c: In function '_ohci_create_int_queue':
w+../drivers/usb/host/ohci-hcd.c:1637:2: warning: implicit declaration
of function 'usb_get_bus' [-Wimplicit-function-declaration]

Actually, it found these also:

arm:  +   pm9g45 at91sam9g20ek_2mmc_nandflash
   m68k:  +   M5485BFE
powerpc:  +   PLU405 MPC8641HPCN_36BIT digsy_mtc_rev5 PMC440 yosemite

Am I missing a patch perhaps?


No, this is my bad, I did not test building with any configs which have
CONFIG_DM_USB=n

A v2 of this set with this fixed is coming up.

Regards,

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


[U-Boot] [PATCH v2] usb: kbd: Fix key repeat not always using

2015-05-13 Thread Hans de Goede
The usb-kbd key repeat code assumes that reports get repeated every 40 ms,
this is never true when using CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP, and
does not always works for CONFIG_SYS_USB_EVENT_POLL and
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE since not all usb keyboards honor
the usb_set_idle() command.

For CONFIG_SYS_USB_EVENT_POLL we must use usb_set_idle() since we do a
blocking wait for the hid report, so if we do not tell the keyboard to send
a hid report every 40ms even if nothing changes then we will block u-boot
for 1s (the default u-boot usb interrupt packet timeout). Note that in this
case on keyboards which do not support usb_set_idle() we loose and we actually
get 1s latencies on other u-boot activities.

For the other poll-methods this commit stops using usb_set_idle() and instead
repeats the last received hid-report every 40 ms as long as no new hid-report
is received. This fixes key-repeat not working at all with
CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP and fixes it not working with
keyboards which do not implement usb_set_idle() when using
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
Changes in v2:
-Change last_report type to unsigned long to match the get_timer return type
---
 common/usb_kbd.c | 22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 24a1a56..e8d108c 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -31,7 +31,7 @@ int overwrite_console(void)
 #endif
 
 /* Keyboard sampling rate */
-#define REPEAT_RATE(40 / 4)/* 40msec - 25cps */
+#define REPEAT_RATE40  /* 40msec - 25cps */
 #define REPEAT_DELAY   10  /* 10 x REPEAT_RATE = 400msec */
 
 #define NUM_LOCK   0x53
@@ -103,6 +103,7 @@ struct usb_kbd_pdata {
unsigned long   intpipe;
int intpktsize;
int intinterval;
+   unsigned long   last_report;
struct int_queue *intq;
 
uint32_trepeat_delay;
@@ -318,15 +319,16 @@ static inline void usb_kbd_poll_for_event(struct 
usb_device *dev)
   data-intinterval);
 
usb_kbd_irq_worker(dev);
-#elif  defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
+#else
+# if   defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
struct usb_interface *iface;
struct usb_kbd_pdata *data = dev-privptr;
iface = dev-config.if_desc[0];
usb_get_report(dev, iface-desc.bInterfaceNumber,
   1, 0, data-new, USB_KBD_BOOT_REPORT_SIZE);
-   if (memcmp(data-old, data-new, USB_KBD_BOOT_REPORT_SIZE))
+   if (memcmp(data-old, data-new, USB_KBD_BOOT_REPORT_SIZE)) {
usb_kbd_irq_worker(dev);
-#elif  defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
+# elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
struct usb_kbd_pdata *data = dev-privptr;
if (poll_int_queue(dev, data-intq)) {
usb_kbd_irq_worker(dev);
@@ -335,6 +337,13 @@ static inline void usb_kbd_poll_for_event(struct 
usb_device *dev)
data-intq = create_int_queue(dev, data-intpipe, 1,
  USB_KBD_BOOT_REPORT_SIZE, data-new,
  data-intinterval);
+# endif
+   data-last_report = get_timer(0);
+   /* Repeat last usb hid report every REPEAT_RATE ms for keyrepeat */
+   } else if (data-last_report != -1 
+  get_timer(data-last_report)  REPEAT_RATE) {
+   usb_kbd_irq_worker(dev);
+   data-last_report = get_timer(0);
}
 #endif
 }
@@ -445,12 +454,15 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned 
int ifnum)
data-intpktsize = min(usb_maxpacket(dev, data-intpipe),
   USB_KBD_BOOT_REPORT_SIZE);
data-intinterval = ep-bInterval;
+   data-last_report = -1;
 
/* We found a USB Keyboard, install it. */
usb_set_protocol(dev, iface-desc.bInterfaceNumber, 0);
 
+#ifdef CONFIG_SYS_USB_EVENT_POLL
debug(USB KBD: found set idle...\n);
-   usb_set_idle(dev, iface-desc.bInterfaceNumber, REPEAT_RATE, 0);
+   usb_set_idle(dev, iface-desc.bInterfaceNumber, REPEAT_RATE / 4, 0);
+#endif
 
debug(USB KBD: enable interrupt pipe...\n);
 #ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
-- 
2.4.0

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


[U-Boot] [PATCH v2 5/9] Remove typedefs from bmp_layout.h

2015-05-13 Thread Simon Glass
We try to avoid typedefs and these ones are easy enough to remove. Before
changing this header in the next patch, remove the typedefs.

Signed-off-by: Simon Glass s...@chromium.org
Suggested-by: Joe Hershberger joe.hershber...@gmail.com
---

Changes in v2:
- Add new patch to remove typedefs from bmp_layout.h

 common/cmd_bmp.c| 16 
 common/lcd.c| 10 +-
 drivers/video/atmel_lcdfb.c |  4 ++--
 drivers/video/bus_vcxk.c|  4 ++--
 drivers/video/cfb_console.c | 10 +-
 include/bmp_layout.h| 17 -
 6 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index cc904c2..cb1f071 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -34,12 +34,12 @@ static int bmp_info (ulong addr);
  * didn't contain a valid BMP signature.
  */
 #ifdef CONFIG_VIDEO_BMP_GZIP
-bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
-   void **alloc_addr)
+struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
+void **alloc_addr)
 {
void *dst;
unsigned long len;
-   bmp_image_t *bmp;
+   struct bmp_image *bmp;
 
/*
 * Decompress bmp image
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long 
*lenp,
bmp = dst;
 
/* align to 32-bit-aligned-address + 2 */
-   bmp = (bmp_image_t *)unsigned int)dst + 1)  ~3) + 2);
+   bmp = (struct bmp_image *)unsigned int)dst + 1)  ~3) + 2);
 
if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, len) != 
0) {
free(dst);
@@ -80,8 +80,8 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long 
*lenp,
return bmp;
 }
 #else
-bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
-   void **alloc_addr)
+struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
+void **alloc_addr)
 {
return NULL;
 }
@@ -187,7 +187,7 @@ U_BOOT_CMD(
  */
 static int bmp_info(ulong addr)
 {
-   bmp_image_t *bmp=(bmp_image_t *)addr;
+   struct bmp_image *bmp = (struct bmp_image *)addr;
void *bmp_alloc_addr = NULL;
unsigned long len;
 
@@ -224,7 +224,7 @@ static int bmp_info(ulong addr)
 int bmp_display(ulong addr, int x, int y)
 {
int ret;
-   bmp_image_t *bmp = (bmp_image_t *)addr;
+   struct bmp_image *bmp = (struct bmp_image *)addr;
void *bmp_alloc_addr = NULL;
unsigned long len;
 
diff --git a/common/lcd.c b/common/lcd.c
index 055c366..c7f2830 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -448,8 +448,8 @@ static void draw_encoded_bitmap(ushort **fbp, ushort c, int 
cnt)
 /*
  * Do not call this function directly, must be called from lcd_display_bitmap.
  */
-static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
-   int x_off, int y_off)
+static void lcd_display_rle8_bitmap(struct bmp_image *bmp, ushort *cmap,
+   uchar *fb, int x_off, int y_off)
 {
uchar *bmap;
ulong width, height;
@@ -548,10 +548,10 @@ __weak void fb_put_word(uchar **fb, uchar **from)
 }
 #endif /* CONFIG_BMP_16BPP */
 
-__weak void lcd_set_cmap(bmp_image_t *bmp, unsigned colors)
+__weak void lcd_set_cmap(struct bmp_image *bmp, unsigned colors)
 {
int i;
-   bmp_color_table_entry_t cte;
+   struct bmp_color_table_entry cte;
ushort *cmap = configuration_get_cmap();
 
for (i = 0; i  colors; ++i) {
@@ -572,7 +572,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
ushort *cmap_base = NULL;
ushort i, j;
uchar *fb;
-   bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
+   struct bmp_image *bmp = (struct bmp_image *)map_sysmem(bmp_image, 0);
uchar *bmap;
ushort padded_width;
unsigned long width, height, byte_width;
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 4ed3a49..d43d8a5 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -81,12 +81,12 @@ void lcd_setcolreg(ushort regno, ushort red, ushort green, 
ushort blue)
 #endif
 }
 
-void lcd_set_cmap(bmp_image_t *bmp, unsigned colors)
+void lcd_set_cmap(struct bmp_image *bmp, unsigned colors)
 {
int i;
 
for (i = 0; i  colors; ++i) {
-   bmp_color_table_entry_t cte = bmp-color_table[i];
+   struct bmp_color_table_entry cte = bmp-color_table[i];
lcd_setcolreg(i, cte.red, cte.green, cte.blue);
}
 }
diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c
index 60a5cc5..2f54d3d 100644
--- a/drivers/video/bus_vcxk.c
+++ b/drivers/video/bus_vcxk.c
@@ -358,7 +358,7 @@ void vcxk_draw_mono(unsigned char *dataptr, unsigned long 
linewidth,
 
 int vcxk_display_bitmap(ulong addr, int x, int y)
 {
-   bmp_image_t *bmp;
+  

[U-Boot] [PATCH v2 6/9] lcd: Support colour lookup table on 16bpp display in BMP images

2015-05-13 Thread Simon Glass
For 16-bit-per-pixel displays it is useful to support 8 bit-per-pixel
images to reduce image size. Add support for this when drawing BMP images.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 common/lcd.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index c7f2830..5a52fe4 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -578,6 +578,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long width, height, byte_width;
unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix;
+   int hdr_size;
+   struct bmp_color_table_entry *palette = bmp-color_table;
 
if (!bmp || !(bmp-header.signature[0] == 'B' 
bmp-header.signature[1] == 'M')) {
@@ -589,6 +591,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
width = get_unaligned_le32(bmp-header.width);
height = get_unaligned_le32(bmp-header.height);
bmp_bpix = get_unaligned_le16(bmp-header.bit_count);
+   hdr_size = get_unaligned_le16(bmp-header.size);
+   debug(hdr_size=%d, bmp_bpix=%d\n, hdr_size, bmp_bpix);
 
colors = 1  bmp_bpix;
 
@@ -613,8 +617,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1;
}
 
-   debug(Display-bmp: %d x %d  with %d colors\n,
-   (int)width, (int)height, (int)colors);
+   debug(Display-bmp: %d x %d  with %d colors, display %d\n,
+ (int)width, (int)height, (int)colors, 1  bpix);
 
if (bmp_bpix == 8)
lcd_set_cmap(bmp, colors);
@@ -641,6 +645,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
cmap_base = configuration_get_cmap();
 #ifdef CONFIG_LCD_BMP_RLE8
u32 compression = get_unaligned_le32(bmp-header.compression);
+   debug(compressed %d %d\n, compression, BMP_BI_RLE8);
if (compression == BMP_BI_RLE8) {
if (bpix != 16) {
/* TODO implement render code for bpix != 16 */
@@ -663,7 +668,19 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
if (bpix != 16) {
fb_put_byte(fb, bmap);
} else {
-   *(uint16_t *)fb = cmap_base[*(bmap++)];
+   struct bmp_color_table_entry *entry;
+   uint val;
+
+   if (cmap_base) {
+   val = cmap_base[*bmap];
+   } else {
+   entry = palette[*bmap];
+   val = entry-blue  3 |
+   entry-green  2  5 |
+   entry-red  3  11;
+   }
+   *(uint16_t *)fb = val;
+   bmap++;
fb += sizeof(uint16_t) / sizeof(*fb);
}
}
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 1/9] dm: usb: Implement usb_detect_change() for driver model

2015-05-13 Thread Simon Glass
Support this function with driver model also (CONFIG_DM_USB).

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Fix use of 'hub' instead of 'dev' in usb_detect_change()

 drivers/usb/host/usb-uclass.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 963464c..6e86f4a 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -628,6 +628,49 @@ int usb_scan_device(struct udevice *parent, int port,
return 0;
 }
 
+/*
+ * Detect if a USB device has been plugged or unplugged.
+ */
+int usb_detect_change(void)
+{
+   struct udevice *hub;
+   struct uclass *uc;
+   int change = 0;
+   int ret;
+
+   ret = uclass_get(UCLASS_USB_HUB, uc);
+   if (ret)
+   return ret;
+
+   uclass_foreach_dev(hub, uc) {
+   struct usb_device *udev;
+   struct udevice *dev;
+
+   if (!device_active(hub))
+   continue;
+   for (device_find_first_child(hub, dev);
+dev;
+device_find_next_child(dev)) {
+   struct usb_port_status status;
+
+   if (!device_active(dev))
+   continue;
+
+   udev = dev_get_parentdata(dev);
+   if (usb_get_port_status(udev, udev-portnr, status)
+0)
+   /* USB request failed */
+   continue;
+
+   if (le16_to_cpu(status.wPortChange) 
+   USB_PORT_STAT_C_CONNECTION)
+   change++;
+   }
+   }
+
+   return change;
+}
+
 int usb_child_post_bind(struct udevice *dev)
 {
struct usb_dev_platdata *plat = dev_get_parent_platdata(dev);
-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH 20/20] tegra: config: nyan-big: Add options required by Chrome OS boot

2015-05-13 Thread Simon Glass
Hi Stephen,

On 25 February 2015 at 16:31, Stephen Warren swar...@wwwdotorg.org wrote:
 On 02/17/2015 03:29 PM, Simon Glass wrote:

 We need to match the device tree in the FIT with the U-Boot model so we
 can automatically select the right device tree. Also adjust the load
 address
 so that the device tree is not in the way when a zImage kernel tries to
 extract itself.


 We don't tend to use LOADADDR in any of the default boot scripts any more.
 Rather, we explicitly load files to a semantic location indicated by one
 of the following variables in tegra124-common.h:

 #define MEM_LAYOUT_ENV_SETTINGS \
 scriptaddr=0x9000\0 \
 pxefile_addr_r=0x9010\0 \
 kernel_addr_r=0x8100\0 \
 fdt_addr_r=0x8200\0 \
 ramdisk_addr_r=0x8210\0

 Perhaps the ChromeOS boot scripts could be adjusted to use one/some of those
 variables?

 If the value of CONFIG_LOADADDR isn't appropriate, perhaps we should fix it
 for all Tegra SoCs/boards?

I forgot about this comment sorry. I had problems with the image
overwriting itself. It is a bzImage inside a FIT so doesn't use the
proper FIT decompression.

Anyway I'd like to clarify what is meant by kernel_addr_r. Is that
where the FIT is loaded or where the kernel will decompress to, or
something else?

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


Re: [U-Boot] [PATCH v2 8/9] tegra: nyan-big: Allow TPM on I2C

2015-05-13 Thread Simon Glass
Hi Stephen,

On 13 May 2015 at 07:53, Stephen Warren swar...@wwwdotorg.org wrote:
 On 05/13/2015 07:02 AM, Simon Glass wrote:

 Enable the I2C3 pins so that the TPM can be used.

 Note: There is an DP change also, caused by running board-to-uboot.py
 script in the latest tegra-pinmux-script tree.


 I didn't get the patch for tegra-pinmux-scripts. What was the send time/date
 and patch title?

It will be in the future :-) I need to transfer it via github as I
don't have a proper git mirror in-house.

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


[U-Boot] [PATCH v2 0/9] Collected fixes and improvements

2015-05-13 Thread Simon Glass
This series contains a hodge-podge of minor fixes and improvements in various
areas. They were found while adjusting mainline Nyan-big to work with
Chrome OS verified boot.

Rather than send a large number of individual patches I decide to collect
them into a series. They should all be independent so can be applied without
coordination.

Sample of areas covered:
- Detect a USB device being connected/disconnected
- TPM support with CONFIG_DM_I2C
- Detect when U-Boot is started from SPL
- ARM binary output and boot tweaks
- Small LCD BMP-drawing improvement
- Tegra removable MMC support
- Various small nits in driver model, sandbox, etc.

Changes in v2:
- Fix use of 'hub' instead of 'dev' in usb_detect_change()
- Clarify that this commit provides only the API, not the implementation
- Rename constant to UBOOT_NOT_LOADED_FROM_SPL
- Add new patch to remove typedefs from bmp_layout.h
- Rename constant to UBOOT_NOT_LOADED_FROM_SPL
- Use tegra-pinmux-scripts to update the pinmux
- Drop applied patches from the series

Simon Glass (9):
  dm: usb: Implement usb_detect_change() for driver model
  arm: spl: Add an API to detect when U-Boot is started from SPL
  arm: Allow cleanup_before_linux() without disabling caches
  sandbox: Add an implementation for cleanup_before_linux_select()
  Remove typedefs from bmp_layout.h
  lcd: Support colour lookup table on 16bpp display in BMP images
  tegra124: Implement spl_was_boot_source()
  tegra: nyan-big: Allow TPM on I2C
  tegra124: Expand SPL space by 8KB

 arch/arm/cpu/armv7/cpu.c   | 47 --
 arch/arm/mach-tegra/board.c| 16 +
 arch/sandbox/cpu/cpu.c |  5 +++
 board/nvidia/nyan-big/pinmux-config-nyan-big.h |  8 ++---
 common/cmd_bmp.c   | 16 -
 common/lcd.c   | 33 +-
 drivers/usb/host/usb-uclass.c  | 43 +++
 drivers/video/atmel_lcdfb.c|  4 +--
 drivers/video/bus_vcxk.c   |  4 +--
 drivers/video/cfb_console.c| 10 +++---
 include/bmp_layout.h   | 17 +-
 include/common.h   | 15 
 include/configs/tegra124-common.h  |  2 +-
 include/spl.h  | 13 +++
 14 files changed, 176 insertions(+), 57 deletions(-)

-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 7/9] tegra124: Implement spl_was_boot_source()

2015-05-13 Thread Simon Glass
Add an implementation of this function for Tegra.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Rename constant to UBOOT_NOT_LOADED_FROM_SPL

 arch/arm/mach-tegra/board.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
index 222de6a..a880a87 100644
--- a/arch/arm/mach-tegra/board.c
+++ b/arch/arm/mach-tegra/board.c
@@ -6,6 +6,7 @@
  */
 
 #include common.h
+#include spl.h
 #include asm/io.h
 #include asm/arch/clock.h
 #include asm/arch/funcmux.h
@@ -29,6 +30,21 @@ enum {
UART_COUNT = 5,
 };
 
+static bool from_spl __attribute__ ((section(.data)));
+
+#ifndef CONFIG_SPL_BUILD
+void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
+{
+   from_spl = r0 != UBOOT_NOT_LOADED_FROM_SPL;
+   save_boot_params_ret();
+}
+#endif
+
+bool spl_was_boot_source(void)
+{
+   return from_spl;
+}
+
 #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
 #if !defined(CONFIG_TEGRA124)
 #error tegra_cpu_is_non_secure has only been validated on Tegra124
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 4/9] sandbox: Add an implementation for cleanup_before_linux_select()

2015-05-13 Thread Simon Glass
Support this function so we can use Chrome OS verified boot with sandbox.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/sandbox/cpu/cpu.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index b6aae37..2c36f4b 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -50,6 +50,11 @@ int cleanup_before_linux(void)
return 0;
 }
 
+int cleanup_before_linux_select(int flags)
+{
+   return 0;
+}
+
 void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
 #ifdef CONFIG_PCI
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 3/9] arm: Allow cleanup_before_linux() without disabling caches

2015-05-13 Thread Simon Glass
This function is used before jumping to U-Boot, but in that case we don't
always want to disable caches.

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Vadim Bendebury vben...@chromium.org
---

Changes in v2: None

 arch/arm/cpu/armv7/cpu.c | 47 +--
 include/common.h | 15 +++
 2 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c
index c56417d..0b0e500 100644
--- a/arch/arm/cpu/armv7/cpu.c
+++ b/arch/arm/cpu/armv7/cpu.c
@@ -24,7 +24,7 @@
 
 void __weak cpu_cache_initialization(void){}
 
-int cleanup_before_linux(void)
+int cleanup_before_linux_select(int flags)
 {
/*
 * this function is called just before we call linux
@@ -42,24 +42,30 @@ int cleanup_before_linux(void)
icache_disable();
invalidate_icache_all();
 
-   /*
-* turn off D-cache
-* dcache_disable() in turn flushes the d-cache and disables MMU
-*/
-   dcache_disable();
-   v7_outer_cache_disable();
+   if (flags  CBL_DISABLE_CACHES) {
+   /*
+   * turn off D-cache
+   * dcache_disable() in turn flushes the d-cache and disables MMU
+   */
+   dcache_disable();
+   v7_outer_cache_disable();
 
-   /*
-* After D-cache is flushed and before it is disabled there may
-* be some new valid entries brought into the cache. We are sure
-* that these lines are not dirty and will not affect our execution.
-* (because unwinding the call-stack and setting a bit in CP15 SCTLR
-* is all we did during this. We have not pushed anything on to the
-* stack. Neither have we affected any static data)
-* So just invalidate the entire d-cache again to avoid coherency
-* problems for kernel
-*/
-   invalidate_dcache_all();
+   /*
+   * After D-cache is flushed and before it is disabled there may
+   * be some new valid entries brought into the cache. We are
+   * sure that these lines are not dirty and will not affect our
+   * execution. (because unwinding the call-stack and setting a
+   * bit in CP15 SCTRL is all we did during this. We have not
+   * pushed anything on to the stack. Neither have we affected
+   * any static data) So just invalidate the entire d-cache again
+   * to avoid coherency problems for kernel
+   */
+   invalidate_dcache_all();
+   } else {
+   flush_dcache_all();
+   invalidate_icache_all();
+   icache_enable();
+   }
 
/*
 * Some CPU need more cache attention before starting the kernel.
@@ -68,3 +74,8 @@ int cleanup_before_linux(void)
 
return 0;
 }
+
+int cleanup_before_linux(void)
+{
+   return cleanup_before_linux_select(CBL_ALL);
+}
diff --git a/include/common.h b/include/common.h
index d4d704a..1285f7d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -714,6 +714,21 @@ void   invalidate_dcache_range(unsigned long start, 
unsigned long stop);
 void   invalidate_dcache_all(void);
 void   invalidate_icache_all(void);
 
+enum {
+   /* Disable caches (else flush caches but leave them active) */
+   CBL_DISABLE_CACHES  = 1  0,
+   CBL_SHOW_BOOTSTAGE_REPORT   = 1  1,
+
+   CBL_ALL = 3,
+};
+
+/**
+ * Clean up ready for linux
+ *
+ * @param flagsFlags to control what is done
+ */
+int cleanup_before_linux_select(int flags);
+
 /* arch/$(ARCH)/lib/ticks.S */
 uint64_t get_ticks(void);
 void   wait_ticks(unsigned long);
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 9/9] tegra124: Expand SPL space by 8KB

2015-05-13 Thread Simon Glass
We are getting very close to running out of space in SPL, and with the
currently Chrome OS gcc 4.9 we exceed the limit. Add a litle more space.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Drop applied patches from the series

 include/configs/tegra124-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/tegra124-common.h 
b/include/configs/tegra124-common.h
index f2b3774..0347132 100644
--- a/include/configs/tegra124-common.h
+++ b/include/configs/tegra124-common.h
@@ -30,7 +30,7 @@
 /*---
  * Physical Memory Map
  */
-#define CONFIG_SYS_TEXT_BASE   0x8010E000
+#define CONFIG_SYS_TEXT_BASE   0x8011
 
 /*
  * Memory layout for where various images get loaded by boot scripts:
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 8/9] tegra: nyan-big: Allow TPM on I2C

2015-05-13 Thread Simon Glass
Enable the I2C3 pins so that the TPM can be used.

Note: There is an DP change also, caused by running board-to-uboot.py
script in the latest tegra-pinmux-script tree.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Use tegra-pinmux-scripts to update the pinmux

 board/nvidia/nyan-big/pinmux-config-nyan-big.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/nvidia/nyan-big/pinmux-config-nyan-big.h 
b/board/nvidia/nyan-big/pinmux-config-nyan-big.h
index 9c5fbaa..9c838ba 100644
--- a/board/nvidia/nyan-big/pinmux-config-nyan-big.h
+++ b/board/nvidia/nyan-big/pinmux-config-nyan-big.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
  *
  * SPDX-License-Identifier: GPL-2.0+
  */
@@ -234,8 +234,8 @@ static const struct pmux_pingrp_config nyan_big_pingrps[] = 
{
PINCFG(SDMMC4_DAT6_PAA6,   SDMMC4,  UP, NORMAL,   INPUT,   
DEFAULT, DEFAULT),
PINCFG(SDMMC4_DAT7_PAA7,   SDMMC4,  UP, NORMAL,   INPUT,   
DEFAULT, DEFAULT),
PINCFG(PBB0,   VGP6,DOWN,   TRISTATE, OUTPUT,  
DEFAULT, DEFAULT),
-   PINCFG(CAM_I2C_SCL_PBB1,   RSVD3,   DOWN,   TRISTATE, OUTPUT,  
DISABLE, DEFAULT),
-   PINCFG(CAM_I2C_SDA_PBB2,   RSVD3,   DOWN,   TRISTATE, OUTPUT,  
DISABLE, DEFAULT),
+   PINCFG(CAM_I2C_SCL_PBB1,   I2C3,NORMAL, NORMAL,   INPUT,   
ENABLE,  DEFAULT),
+   PINCFG(CAM_I2C_SDA_PBB2,   I2C3,NORMAL, NORMAL,   INPUT,   
ENABLE,  DEFAULT),
PINCFG(PBB3,   VGP3,DOWN,   TRISTATE, OUTPUT,  
DEFAULT, DEFAULT),
PINCFG(PBB4,   VGP4,DOWN,   TRISTATE, OUTPUT,  
DEFAULT, DEFAULT),
PINCFG(PBB5,   RSVD3,   DOWN,   TRISTATE, OUTPUT,  
DEFAULT, DEFAULT),
@@ -257,7 +257,7 @@ static const struct pmux_pingrp_config nyan_big_pingrps[] = 
{
PINCFG(HDMI_CEC_PEE3,  CEC, NORMAL, NORMAL,   INPUT,   
ENABLE,  DEFAULT),
PINCFG(SDMMC3_CLK_LB_OUT_PEE4, SDMMC3,  NORMAL, NORMAL,   OUTPUT,  
DEFAULT, DEFAULT),
PINCFG(SDMMC3_CLK_LB_IN_PEE5,  SDMMC3,  UP, NORMAL,   INPUT,   
DEFAULT, DEFAULT),
-   PINCFG(DP_HPD_PFF0,DP,  UP, NORMAL,   INPUT,   
DEFAULT, DEFAULT),
+   PINCFG(DP_HPD_PFF0,DP,  NORMAL, NORMAL,   INPUT,   
DEFAULT, DEFAULT),
PINCFG(USB_VBUS_EN2_PFF1,  RSVD2,   DOWN,   TRISTATE, OUTPUT,  
DISABLE, DEFAULT),
PINCFG(PFF2,   RSVD2,   DOWN,   TRISTATE, OUTPUT,  
DISABLE, DEFAULT),
PINCFG(CORE_PWR_REQ,   PWRON,   NORMAL, NORMAL,   OUTPUT,  
DEFAULT, DEFAULT),
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 05/16] tegra: clock: Support enabling external clocks

2015-05-13 Thread Simon Glass
Add a simple function to enable external clocks.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra/clock.h |  8 
 arch/arm/mach-tegra/clock.c | 17 +
 2 files changed, 25 insertions(+)

diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
b/arch/arm/include/asm/arch-tegra/clock.h
index 04011ae..f9dd3c8 100644
--- a/arch/arm/include/asm/arch-tegra/clock.h
+++ b/arch/arm/include/asm/arch-tegra/clock.h
@@ -336,4 +336,12 @@ void arch_timer_init(void);
 
 void tegra30_set_up_pllp(void);
 
+/**
+ * Enable output clock for external peripherals
+ *
+ * @param clk_id   Clock ID to output (1, 2 or 3)
+ * @return 0 if OK. -ve on error
+ */
+int clock_external_output(int clk_id);
+
 #endif  /* _TEGRA_CLOCK_H_ */
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index cdd5438..5908260 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -17,11 +17,13 @@
 /* Tegra SoC common clock control functions */
 
 #include common.h
+#include errno.h
 #include asm/io.h
 #include asm/arch/clock.h
 #include asm/arch/tegra.h
 #include asm/arch-tegra/ap.h
 #include asm/arch-tegra/clk_rst.h
+#include asm/arch-tegra/pmc.h
 #include asm/arch-tegra/timer.h
 #include div64.h
 #include fdtdec.h
@@ -702,3 +704,18 @@ void tegra30_set_up_pllp(void)
 
set_avp_clock_source(SCLK_SOURCE_PLLP_OUT4);
 }
+
+int clock_external_output(int clk_id)
+{
+   struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+
+   if (clk_id = 1  clk_id = 3) {
+   setbits_le32(pmc-pmc_clk_out_cntrl,
+1  (2 + (clk_id - 1) * 8));
+   } else {
+   printf(%s: Unknown output clock id %d\n, __func__, clk_id);
+   return -EINVAL;
+   }
+
+   return 0;
+}
-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH v2 8/9] tegra: nyan-big: Allow TPM on I2C

2015-05-13 Thread Stephen Warren

On 05/13/2015 07:02 AM, Simon Glass wrote:

Enable the I2C3 pins so that the TPM can be used.

Note: There is an DP change also, caused by running board-to-uboot.py
script in the latest tegra-pinmux-script tree.


I didn't get the patch for tegra-pinmux-scripts. What was the send 
time/date and patch title?

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


[U-Boot] [PATCH v2 10/16] tegra: lcd: Tidy up clock init

2015-05-13 Thread Simon Glass
Use the correct function for clock init.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 drivers/video/tegra124/tegra124-lcd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/tegra124/tegra124-lcd.c 
b/drivers/video/tegra124/tegra124-lcd.c
index 2733590..cfdc77f 100644
--- a/drivers/video/tegra124/tegra124-lcd.c
+++ b/drivers/video/tegra124/tegra124-lcd.c
@@ -51,15 +51,13 @@ static int tegra124_lcd_init(void *lcdbase)
int ret;
 
clock_set_up_plldp();
-   clock_adjust_periph_pll_div(PERIPH_ID_HOST1X, CLOCK_ID_PERIPH,
-   40800, NULL);
+   clock_start_periph_pll(PERIPH_ID_HOST1X, CLOCK_ID_PERIPH, 40800);
 
clock_enable(PERIPH_ID_HOST1X);
clock_enable(PERIPH_ID_DISP1);
clock_enable(PERIPH_ID_PWM);
clock_enable(PERIPH_ID_DPAUX);
clock_enable(PERIPH_ID_SOR0);
-
udelay(2);
 
reset_set_enable(PERIPH_ID_HOST1X, 0);
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 3/4] usb: ohci: Add support for interrupt queues

2015-05-13 Thread Hans de Goede
Add support for interrupt queues to the ohci hcd code, bringing it inline
with the ehci and musb-new(host) code.

Signed-off-by: Hans de Goede hdego...@redhat.com
Reviewed-by: Marek Vasut ma...@denx.de
---
Changes in v2:
-Fix building of non DM_USB configs
---
 drivers/usb/host/ohci-hcd.c | 132 
 1 file changed, 132 insertions(+)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 17f3ac6..691ed1c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1622,6 +1622,91 @@ static int submit_common_msg(ohci_t *ohci, struct 
usb_device *dev,
return 0;
 }
 
+#define MAX_INT_QUEUESIZE 8
+
+struct int_queue {
+   int queuesize;
+   int curr_urb;
+   urb_priv_t *urb[MAX_INT_QUEUESIZE];
+};
+
+static struct int_queue *_ohci_create_int_queue(ohci_t *ohci,
+   struct usb_device *udev, unsigned long pipe, int queuesize,
+   int elementsize, void *buffer, int interval)
+{
+   struct int_queue *queue;
+   ohci_dev_t *ohci_dev;
+   int i;
+
+   if (queuesize  MAX_INT_QUEUESIZE)
+   return NULL;
+
+   ohci_dev = ohci_get_ohci_dev(ohci, udev-devnum, 1);
+   if (!ohci_dev)
+   return NULL;
+
+   queue = malloc(sizeof(*queue));
+   if (!queue) {
+   printf(ohci: Error out of memory allocating int queue\n);
+   return NULL;
+   }
+
+   for (i = 0; i  queuesize; i++) {
+   queue-urb[i] = ohci_alloc_urb(udev, pipe,
+  buffer + i * elementsize,
+  elementsize, interval);
+   if (!queue-urb[i])
+   break;
+
+   if (sohci_submit_job(ohci, ohci_dev, queue-urb[i], NULL)) {
+   printf(ohci: Error submitting int queue job\n);
+   urb_free_priv(queue-urb[i]);
+   break;
+   }
+   }
+   if (i == 0) {
+   /* We did not succeed in submitting even 1 urb */
+   free(queue);
+   return NULL;
+   }
+
+   queue-queuesize = i;
+   queue-curr_urb = 0;
+
+   return queue;
+}
+
+static void *_ohci_poll_int_queue(ohci_t *ohci, struct usb_device *udev,
+ struct int_queue *queue)
+{
+   if (queue-curr_urb == queue-queuesize)
+   return NULL; /* Queue depleted */
+
+   if (hc_interrupt(ohci)  0)
+   return NULL;
+
+   if (queue-urb[queue-curr_urb]-finished) {
+   void *ret = queue-urb[queue-curr_urb]-transfer_buffer;
+   queue-curr_urb++;
+   return ret;
+   }
+
+   return NULL;
+}
+
+static int _ohci_destroy_int_queue(ohci_t *ohci, struct usb_device *dev,
+  struct int_queue *queue)
+{
+   int i;
+
+   for (i = 0; i  queue-queuesize; i++)
+   urb_free_priv(queue-urb[i]);
+
+   free(queue);
+
+   return 0;
+}
+
 #ifndef CONFIG_DM_USB
 /* submit routines called from usb.c */
 int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
@@ -1639,6 +1724,24 @@ int submit_int_msg(struct usb_device *dev, unsigned long 
pipe, void *buffer,
return submit_common_msg(gohci, dev, pipe, buffer, transfer_len, NULL,
interval);
 }
+
+struct int_queue *create_int_queue(struct usb_device *dev,
+   unsigned long pipe, int queuesize, int elementsize,
+   void *buffer, int interval)
+{
+   return _ohci_create_int_queue(gohci, dev, pipe, queuesize,
+ elementsize, buffer, interval);
+}
+
+void *poll_int_queue(struct usb_device *dev, struct int_queue *queue)
+{
+   return _ohci_poll_int_queue(gohci, dev, queue);
+}
+
+int destroy_int_queue(struct usb_device *dev, struct int_queue *queue)
+{
+   return _ohci_destroy_int_queue(gohci, dev, queue);
+}
 #endif
 
 static int _ohci_submit_control_msg(ohci_t *ohci, struct usb_device *dev,
@@ -2072,6 +2175,32 @@ static int ohci_submit_int_msg(struct udevice *dev, 
struct usb_device *udev,
 NULL, interval);
 }
 
+static struct int_queue *ohci_create_int_queue(struct udevice *dev,
+   struct usb_device *udev, unsigned long pipe, int queuesize,
+   int elementsize, void *buffer, int interval)
+{
+   ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
+
+   return _ohci_create_int_queue(ohci, udev, pipe, queuesize, elementsize,
+ buffer, interval);
+}
+
+static void *ohci_poll_int_queue(struct udevice *dev, struct usb_device *udev,
+struct int_queue *queue)
+{
+   ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
+
+   return _ohci_poll_int_queue(ohci, udev, queue);
+}
+
+static int ohci_destroy_int_queue(struct udevice *dev, 

[U-Boot] [PATCH v2 1/4] usb: ohci: Do not reuse ed for interrupt endpoints of different devices

2015-05-13 Thread Hans de Goede
When submitting interrupt packets to an endpoint we only link in the ed
once to avoid some races surrounding unlinking of periodic endpoints,
but we share one ohci_device struct / one set of ed-s for all devices,
which means that if we have an interrupt endpoint at endpoint 1 with one
device, and a non interrupt endpoint 1 with another device we end up
with the same ed linked into both the periodic and async lists, which is
not good (tm).

This commit switches over to using separate ohci_device structs, and thus
separate ed-s for devices with interrupt endpoints, fixing this.

This fixes e.g. matching a usb storage device and keyboard on the same
usb-1 hub not working.

Signed-off-by: Hans de Goede hdego...@redhat.com
Reviewed-by: Marek Vasut ma...@denx.de
---
 drivers/usb/host/ohci-hcd.c | 35 ++-
 drivers/usb/host/ohci.h |  4 
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 2f976d2..5364ced 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1478,6 +1478,31 @@ pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 
 /*-*/
 
+static ohci_dev_t *ohci_get_ohci_dev(ohci_t *ohci, int devnum, int intr)
+{
+   int i;
+
+   if (!intr)
+   return ohci-ohci_dev;
+
+   /* First see if we already have an ohci_dev for this dev. */
+   for (i = 0; i  NUM_INT_DEVS; i++) {
+   if (ohci-int_dev[i].devnum == devnum)
+   return ohci-int_dev[i];
+   }
+
+   /* If not then find a free one. */
+   for (i = 0; i  NUM_INT_DEVS; i++) {
+   if (ohci-int_dev[i].devnum == -1) {
+   ohci-int_dev[i].devnum = devnum;
+   return ohci-int_dev[i];
+   }
+   }
+
+   printf(ohci: Error out of ohci_devs for interrupt endpoints\n);
+   return NULL;
+}
+
 /* common code for handling submit messages - used for all but root hub */
 /* accesses. */
 static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
@@ -1488,6 +1513,7 @@ static int submit_common_msg(ohci_t *ohci, struct 
usb_device *dev,
int maxsize = usb_maxpacket(dev, pipe);
int timeout;
urb_priv_t *urb;
+   ohci_dev_t *ohci_dev;
 
urb = malloc(sizeof(urb_priv_t));
memset(urb, 0, sizeof(urb_priv_t));
@@ -1511,7 +1537,11 @@ static int submit_common_msg(ohci_t *ohci, struct 
usb_device *dev,
return -1;
}
 
-   if (sohci_submit_job(ohci, ohci-ohci_dev, urb, setup)  0) {
+   ohci_dev = ohci_get_ohci_dev(ohci, dev-devnum, usb_pipeint(pipe));
+   if (!ohci_dev)
+   return -ENOMEM;
+
+   if (sohci_submit_job(ohci, ohci_dev, urb, setup)  0) {
err(sohci_submit_job failed);
return -1;
}
@@ -1711,8 +1741,11 @@ static int hc_start(ohci_t *ohci)
 {
__u32 mask;
unsigned int fminterval;
+   int i;
 
ohci-disabled = 1;
+   for (i = 0; i  NUM_INT_DEVS; i++)
+   ohci-int_dev[i].devnum = -1;
 
/* Tell the controller where the control and bulk lists are
 * The lists are empty now. */
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 3f9869b..f1526d4 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -367,10 +367,13 @@ typedef struct
 
 #define NUM_TD 64  /* we need more TDs than EDs */
 
+#define NUM_INT_DEVS 8 /* num of ohci_dev structs for int endpoints */
+
 typedef struct ohci_device {
ed_t ed[NUM_EDS] __aligned(ED_ALIGNMENT);
td_t tds[NUM_TD] __aligned(TD_ALIGNMENT);
int ed_cnt;
+   int devnum;
 } ohci_dev_t;
 
 /*
@@ -384,6 +387,7 @@ typedef struct ohci_device {
 typedef struct ohci {
/* this allocates EDs for all possible endpoints */
struct ohci_device ohci_dev __aligned(TD_ALIGNMENT);
+   struct ohci_device int_dev[NUM_INT_DEVS] __aligned(TD_ALIGNMENT);
struct ohci_hcca *hcca; /* hcca */
/*dma_addr_t hcca_dma;*/
 
-- 
2.4.0

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


[U-Boot] [PATCH v2 2/4] usb: ohci: Add an ohci_alloc_urb() function

2015-05-13 Thread Hans de Goede
Add an ohci_alloc_urb() function, this is a preparation patch for adding
interrupt queue support.

Signed-off-by: Hans de Goede hdego...@redhat.com
Reviewed-by: Marek Vasut ma...@denx.de
---
 drivers/usb/host/ohci-hcd.c | 31 +++
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 5364ced..17f3ac6 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1505,6 +1505,26 @@ static ohci_dev_t *ohci_get_ohci_dev(ohci_t *ohci, int 
devnum, int intr)
 
 /* common code for handling submit messages - used for all but root hub */
 /* accesses. */
+static urb_priv_t *ohci_alloc_urb(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len, int interval)
+{
+   urb_priv_t *urb;
+
+   urb = calloc(1, sizeof(urb_priv_t));
+   if (!urb) {
+   printf(ohci: Error out of memory allocating urb\n);
+   return NULL;
+   }
+
+   urb-dev = dev;
+   urb-pipe = pipe;
+   urb-transfer_buffer = buffer;
+   urb-transfer_buffer_length = transfer_len;
+   urb-interval = interval;
+
+   return urb;
+}
+
 static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
unsigned long pipe, void *buffer, int transfer_len,
struct devrequest *setup, int interval)
@@ -1515,14 +1535,9 @@ static int submit_common_msg(ohci_t *ohci, struct 
usb_device *dev,
urb_priv_t *urb;
ohci_dev_t *ohci_dev;
 
-   urb = malloc(sizeof(urb_priv_t));
-   memset(urb, 0, sizeof(urb_priv_t));
-
-   urb-dev = dev;
-   urb-pipe = pipe;
-   urb-transfer_buffer = buffer;
-   urb-transfer_buffer_length = transfer_len;
-   urb-interval = interval;
+   urb = ohci_alloc_urb(dev, pipe, buffer, transfer_len, interval);
+   if (!urb)
+   return -ENOMEM;
 
 #ifdef DEBUG
urb-actual_length = 0;
-- 
2.4.0

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


[U-Boot] [PATCH v2 4/4] sunxi: Change usb-kbd interrupt polling to use an usb interrupt queue

2015-05-13 Thread Hans de Goede
Now that the ohci code supports usb interrupt queues we can switch (back)
to using an usb interrupt queue for usb-kbd interrupt polling. This
greatly reduces u-boot's latency when dealing with usb keyboards.

Signed-off-by: Hans de Goede hdego...@redhat.com
Acked-by: Ian Campbell i...@hellion.org.uk
Reviewed-by: Marek Vasut ma...@denx.de
---
Changes in v2:
-Fix a bunch of typos in the commit msg
---
 include/configs/sunxi-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 222e739..2d6b815 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -317,7 +317,7 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_PREBOOT
 #define CONFIG_SYS_STDIO_DEREGISTER
-#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
 #endif
 
 #if !defined CONFIG_ENV_IS_IN_MMC  \
-- 
2.4.0

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


Re: [U-Boot] Booting mx28 from battery

2015-05-13 Thread Fabio Estevam
Hi Marek,

On Wed, May 13, 2015 at 4:14 AM, Marek Vasut ma...@denx.de wrote:
 On Wednesday, May 13, 2015 at 05:10:39 AM, Fabio Estevam wrote:
 Hi,

 Hi,

 Has anyone tested booting U-boot on mx28 powered by a battery only?

 Yes, some time ago I tested this mode of operation on the M28EVK.
 It ought to work, so give it a whirl. It was before Graeme did his
 hacking on the power code though, so it is well possible it might
 have gotten broken recently.

Thanks for the confirmation!

Regards,

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


Re: [U-Boot] [PATCH 2/6] dm: gpio: hi6220: Add a hi6220 GPIO driver model driver.

2015-05-13 Thread Peter Griffin
Hi Marek,

Thanks for reviewing.

 
  This patch adds support for the GPIO perif found on hi6220
  SoC.
  
  Signed-off-by: Peter Griffin peter.grif...@linaro.org
  ---
   arch/arm/include/asm/arch-armv8/gpio.h | 47 +
   drivers/gpio/Makefile  |  2 +
   drivers/gpio/hi6220_gpio.c | 95
  ++ 3 files changed, 144 insertions(+)
   create mode 100644 arch/arm/include/asm/arch-armv8/gpio.h
   create mode 100644 drivers/gpio/hi6220_gpio.c
  
  diff --git a/arch/arm/include/asm/arch-armv8/gpio.h
  b/arch/arm/include/asm/arch-armv8/gpio.h new file mode 100644
  index 000..162c2d9
  --- /dev/null
  +++ b/arch/arm/include/asm/arch-armv8/gpio.h
  @@ -0,0 +1,47 @@
  +/*
  + * Copyright (C) 2015 Linaro
  + * Peter Griffin peter.grif...@linaro.org
  + *
  + * SPDX-License-Identifier:GPL-2.0+
  + */
  +
  +#ifndef _HI6220_GPIO_H_
  +#define _HI6220_GPIO_H_
  +
  +#define HI6220_GPIO0_BASE  (void *)0xf8011000
 
 You should drop the explicit cast, that's nasty.

If I drop the cast I get lots of 

include/asm/arch/gpio.h:11:32: warning: initialization makes pointer from 
integer
without a cast

compiler warnings.


 Also, why don't you define this as a HI6220_GPIO_BASE(bank) instead?
 That'd trim down the number of macros and from what I see, it should
 be rather easy to do ...
 
 #define HI6220_GPIO_BASE(bank)
   (((bank  4) ? 0xf8012000 : (0xf702 - 0x4000)) + (0x1000 * bank))

Yes good idea, I will do it like you suggest in V2. Currently I have

#define HI6220_GPIO_BASE(bank)  (void *)(((bank  4) ? 0xf8011000 : \
0xf702 - 0x4000) + (0x1000 * bank))

To avoid the warnings mentioned above.

snip
  +#define HI6220_GPIO17_BASE (void *)0xf702d000
  +#define HI6220_GPIO18_BASE (void *)0xf702e000
  +#define HI6220_GPIO19_BASE (void *)0xf702f000
 
 But are these even used in the driver anywhere ?

They are currently used in the hikey.c board file which defines the 
hikey_gpio_platdata structure.

Although thinking about it some more this should be moved from the hikey board
file to the driver as it is SoC specific rather than board specific.
 
  +#define BIT(x) (1  (x))
 
 This macro should be placed into common header files.
 
  +#define HI6220_GPIO_PER_BANK   8
  +#define HI6220_GPIO_DIR0x400
  +
  +struct gpio_bank {
  +   u8 *base;   /* address of registers in physical memory */
 
 Should be void __iomem *, no ?

Will fix in v2.

regards,

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


[U-Boot] [PATCH v2 03/16] dm: tegra: cros_ec: Enable Chrome OS EC on Nyan-big

2015-05-13 Thread Simon Glass
Enable the EC and keyboard, using the SPI bus.

The EC driver requires a particular format and a deactivation delay. Also
U-Boot does not support interrupts.

For now, adjust the device tree to comply. At some point we should tidy
this up to support interrupts and make tegra and exynos use the same setup.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Use spi-max-frequency in both the bus and slave nodes

 arch/arm/dts/tegra124-nyan-big.dts | 3 +++
 configs/nyan-big_defconfig | 5 +
 include/configs/nyan-big.h | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/arch/arm/dts/tegra124-nyan-big.dts 
b/arch/arm/dts/tegra124-nyan-big.dts
index 5a39e93..8be6adb 100644
--- a/arch/arm/dts/tegra124-nyan-big.dts
+++ b/arch/arm/dts/tegra124-nyan-big.dts
@@ -163,12 +163,15 @@
 
spi@7000d400 {
status = okay;
+   spi-deactivate-delay = 200;
+   spi-max-frequency = 300;
 
cros_ec: cros-ec@0 {
compatible = google,cros-ec-spi;
spi-max-frequency = 300;
interrupt-parent = gpio;
interrupts = TEGRA_GPIO(C, 7) IRQ_TYPE_LEVEL_LOW;
+   ec-interrupt = gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_LOW;
reg = 0;
 
google,cros-ec-spi-msg-delay = 2000;
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index d447ddc..4a94d7b 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -5,3 +5,8 @@ CONFIG_TARGET_NYAN_BIG=y
 CONFIG_DEFAULT_DEVICE_TREE=tegra124-nyan-big
 CONFIG_DISPLAY_PORT=y
 CONFIG_VIDEO_TEGRA124=y
+CONFIG_DM_CROS_EC=y
+CONFIG_CROS_EC=y
+CONFIG_CROS_EC_SPI=y
+CONFIG_CROS_EC_KEYB=y
+CONFIG_CMD_CROS_EC=y
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index caca98b..aae54f8 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -80,6 +80,8 @@
 #define CONFIG_FIT
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_KEYBOARD
+
 #include tegra-common-usb-gadget.h
 #include tegra-common-post.h
 
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 13/16] Add Chrome OS config header

2015-05-13 Thread Simon Glass
From: Doug Anderson diand...@chromium.org

This header includes useful scripts which can be used with any board that
can boot Chrome OS.

In particular, 'run nvboot' will boot a board without verified boot enabled.

Signed-off-by: Doug Anderson diand...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Use existing __stringify() macro

 include/configs/chromeos.h | 457 +
 1 file changed, 457 insertions(+)
 create mode 100644 include/configs/chromeos.h

diff --git a/include/configs/chromeos.h b/include/configs/chromeos.h
new file mode 100644
index 000..d91fd06
--- /dev/null
+++ b/include/configs/chromeos.h
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __configs_chromeos_h__
+#define __configs_chromeos_h__
+
+/*
+ * In anticipation of implementing early firmware selection, these defines
+ * signal the features that are required in U-Boot.
+ *
+ * The defines munging is thus kept to one Chrome OS-specific file. The
+ * upstream boards will define all features as normal for their platform.
+ *
+ * It is possible that these will be too broad for some platforms - e.g. we
+ * may have a platform which wants to use MMC in CONFIG_CROS_RO. However,
+ * we can deal with additional needs as we come to them.
+ *
+ * While it is something of an inconvenience, it may improve boot time on
+ * some platforms also.
+ *
+ *   CONFIG_CROS_LARGE
+ * - Full version as now with factory defined, all features enabled
+ * - This will operate as factory build, or verified boot
+ *
+ *   CONFIG_CROS_SMALL
+ * - Minimized for use only with verified boot
+ * - No command line, filesystems, LCD console, etc.
+ * - Still has all drivers enabled and can perform verified boot
+ *
+ *   CONFIG_CROS_RO
+ * - Requires CONFIG_CROS_SMALL. Will only support running RO firmware
+ * - Set up for running VbLoadFirmware() only
+ * - Minimal RAM, no display, no USB, no mass storage (SPI flash only)
+ * - Intended for running in SPL
+ *
+ *   CONFIG_CROS_RW
+ * - Requires CONFIG_CROS_SMALL. Will only support running RW firmware
+ * - Set up for running VbSelectAndLoadKernel() only
+ */
+
+/*
+ * This config file defines platform-independent settings that a verified boot
+ * firmware must have.
+ */
+
+/* Enable verified boot */
+#define CONFIG_CHROMEOS
+
+/* Enable test codes */
+#ifdef CONFIG_CROS_FULL
+#define CONFIG_CHROMEOS_TEST
+#endif /* VBOOT_DEBUG */
+
+/* Support constant vboot flag from fdt */
+#define CONFIG_CHROMEOS_CONST_FLAG
+
+/* Enable vboot twostop with SPI flash */
+#define CONFIG_CHROMEOS_SPI
+
+#define CONFIG_VBOOT_REGION_READ
+
+#ifndef CONFIG_CROS_RO
+#define CONFIG_CHROMEOS_DISPLAY
+
+/* Enable legacy vboot_twostop - crosbug.com/p/21810 */
+#define CONFIG_CROS_LEGACY_VBOOT
+#endif
+
+#ifndef CONFIG_CROS_FULL
+#undef CONFIG_CMDLINE
+#undef CONFIG_SYS_LONGHELP
+#undef CONFIG_SYS_CONSOLE_IS_IN_ENV
+#undef CONFIG_SYS_STDIO_DEREGISTER
+#undef CONFIG_SYS_HUSH_PARSER
+#undef CONFIG_CBMEM_CONSOLE
+#undef CONFIG_CMDLINE_EDITING
+#undef CONFIG_COMMAND_HISTORY
+#undef CONFIG_AUTOCOMPLETE
+#undef CONFIG_CONSOLE_MUX
+#undef CONFIG_SHOW_BOOT_PROGRESS
+
+#undef CONFIG_I8042_KBD
+#define CONFIG_VGA_AS_SINGLE_DEVICE
+#undef CONFIG_VIDEO_SW_CURSOR
+
+#undef CONFIG_SUPPORT_VFAT
+#undef CONFIG_ATAPI
+#undef CONFIG_EFI_PARTITION
+#undef CONFIG_DOS_PARTITION
+#undef CONFIG_MAC_PARTITION
+#undef CONFIG_ISO_PARTITION
+#undef CONFIG_PARTITION_UUIDS
+
+#undef CONFIG_CMD_PART
+#undef CONFIG_CMD_CBFS
+#undef CONFIG_CMD_EXT4
+#undef CONFIG_CMD_EXT4_WRITE
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_CRC32
+#undef CONFIG_CMD_CROS_EC
+
+#undef CONFIG_USB_HOST_ETHER
+#undef CONFIG_USB_ETHER_ASIX
+#undef CONFIG_USB_ETHER_SMSC95XX
+
+#undef CONFIG_GENERIC_MMC
+#undef CONFIG_MMC
+
+#define DYNAMIC_CRC_TABLE
+#undef CONFIG_BOOTDELAY
+
+#endif
+
+/* Enable graphics display */
+#ifdef CONFIG_CHROMEOS_DISPLAY
+#define CONFIG_LCD_BMP_RLE8
+#define CONFIG_LZMA
+#define CONFIG_VIDEO_NO_TEXT
+#else
+#undef CONFIG_LCD
+#undef CONFIG_EXYNOS_FB
+#undef CONFIG_EXYNOS_DP
+#undef CONFIG_VIDEO_ANALOGIX
+#undef CONFIG_VIDEO_PARADE
+#undef CONFIG_CMD_BMP
+#endif
+
+#ifdef CONFIG_CROS_RO
+#undef CONFIG_USB_EHCI
+#undef CONFIG_USB_EHCI_PCI
+#undef CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
+#undef CONFIG_USB_MAX_CONTROLLER_COUNT
+#undef CONFIG_USB_STORAGE
+#undef CONFIG_USB_KEYBOARD
+#undef CONFIG_SYS_USB_EVENT_POLL
+
+#undef CONFIG_CMD_USB
+#undef CONFIG_CMD_SOUND
+#undef CONFIG_SOUND_INTEL_HDA
+#undef CONFIG_CRC32_VERIFY
+#undef CONFIG_TPM
+#undef CONFIG_FIT
+#define CONFIG_CRC32
+#undef CONFIG_LZO
+
+/* Limited memory so use a smaller recorded console */
+#undef CONFIG_RECORDED_CONSOLE_SIZE
+#define CONFIG_RECORDED_CONSOLE_SIZE 3000
+
+#else
+/* USB is used in recovery mode */
+#define CONFIG_CHROMEOS_USB
+#endif
+
+/*
+ * Enable this feature to embed crossystem data into device tree before booting

[U-Boot] [PATCH v2 09/16] tegra: Increase maximum arguments to 32

2015-05-13 Thread Simon Glass
When setting up large environment variables we can exceed 16 arguemnts.
Increase this to avoid problems.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 include/configs/tegra-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index 2cf1f68..d3697d1 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -102,7 +102,7 @@
 /* Print Buffer Size */
 #define CONFIG_SYS_PBSIZE  (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_MAXARGS 16  /* max number of command args */
+#define CONFIG_SYS_MAXARGS 32  /* max number of command args */
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE(CONFIG_SYS_CBSIZE)
 
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 02/16] tegra: spi: Drop the claim_bus() method to correct delays

2015-05-13 Thread Simon Glass
At present the driver does not properly honour the requested SPI CS
deactivation delay since the SPI bus is changed in the claim_bus() method.

Everything the claim_bus() method does can be done when the device is probed
(setting the speed and mode) and at the start of a new transfer (where the
fifo_status is already cleared). So drop this method.

Also, until the delay is complete, we should not touch the bus, so make sure
that spi_cs_activate() is called before other things are done in the xfer()
method.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 drivers/spi/tegra114_spi.c | 26 +-
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 4bec663..0d69376 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -143,24 +143,18 @@ static int tegra114_spi_probe(struct udevice *bus)
 {
struct tegra_spi_platdata *plat = dev_get_platdata(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
+   struct spi_regs *regs;
 
priv-regs = (struct spi_regs *)plat-base;
+   regs = priv-regs;
 
priv-last_transaction_us = timer_get_us();
priv-freq = plat-frequency;
priv-periph_id = plat-periph_id;
 
-   return 0;
-}
-
-static int tegra114_spi_claim_bus(struct udevice *dev)
-{
-   struct udevice *bus = dev-parent;
-   struct tegra114_spi_priv *priv = dev_get_priv(bus);
-   struct spi_regs *regs = priv-regs;
-
/* Change SPI clock to correct frequency, PLLP_OUT0 source */
-   clock_start_periph_pll(priv-periph_id, CLOCK_ID_PERIPH, priv-freq);
+   clock_start_periph_pll(priv-periph_id, CLOCK_ID_PERIPH,
+  priv-freq);
 
/* Clear stale status here */
setbits_le32(regs-fifo_status,
@@ -175,9 +169,8 @@ static int tegra114_spi_claim_bus(struct udevice *dev)
 SPI_FIFO_STS_RX_FIFO_EMPTY);
debug(%s: FIFO STATUS = %08x\n, __func__, readl(regs-fifo_status));
 
-   /* Set master mode and sw controlled CS */
-   setbits_le32(regs-command1, SPI_CMD1_M_S | SPI_CMD1_CS_SW_HW |
-(priv-mode  SPI_CMD1_MODE_SHIFT));
+   setbits_le32(priv-regs-command1, SPI_CMD1_M_S | SPI_CMD1_CS_SW_HW |
+(priv-mode  SPI_CMD1_MODE_SHIFT) | SPI_CMD1_CS_SW_VAL);
debug(%s: COMMAND1 = %08x\n, __func__, readl(regs-command1));
 
return 0;
@@ -249,6 +242,9 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
 
ret = 0;
 
+   if (flags  SPI_XFER_BEGIN)
+   spi_cs_activate(dev);
+
/* clear all error status bits */
reg = readl(regs-fifo_status);
writel(reg, regs-fifo_status);
@@ -260,9 +256,6 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
/* set xfer size to 1 block (32 bits) */
writel(0, regs-dma_blk);
 
-   if (flags  SPI_XFER_BEGIN)
-   spi_cs_activate(dev);
-
/* handle data in 32-bit chunks */
while (num_bytes  0) {
int bytes;
@@ -385,7 +378,6 @@ static int tegra114_spi_set_mode(struct udevice *bus, uint 
mode)
 }
 
 static const struct dm_spi_ops tegra114_spi_ops = {
-   .claim_bus  = tegra114_spi_claim_bus,
.xfer   = tegra114_spi_xfer,
.set_speed  = tegra114_spi_set_speed,
.set_mode   = tegra114_spi_set_mode,
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 16/16] tegra: config: nyan-big: Add options required by Chrome OS boot

2015-05-13 Thread Simon Glass
We need to match the device tree in the FIT with the U-Boot model so we
can automatically select the right device tree. Also adjust the load address
so that the device tree is not in the way when a zImage kernel tries to
extract itself.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Drop tegra timer patch as it is not needed
- Drop a few patches that have already been applied

 include/configs/nyan-big.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index aae54f8..a30d68f 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -12,6 +12,8 @@
 
 #include tegra124-common.h
 
+#include configs/chromeos.h
+
 /* High-level configuration options */
 #define V_PROMPT   Tegra124 (Nyan-big) # 
 #define CONFIG_TEGRA_BOARD_STRING  Google/NVIDIA Nyan-big
@@ -47,6 +49,7 @@
 #define CONFIG_AS3722_POWER
 #define LCD_BPPLCD_COLOR16
 #define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CMD_BMP
 
 /* Align LCD to 1MB boundary */
 #define CONFIG_LCD_ALIGNMENT   MMU_SECTION_SIZE
@@ -78,10 +81,14 @@
 #define CONFIG_CMD_DHCP
 
 #define CONFIG_FIT
+#define CONFIG_FIT_BEST_MATCH
 #define CONFIG_OF_LIBFDT
 
 #define CONFIG_KEYBOARD
 
+#undef CONFIG_LOADADDR
+#define CONFIG_LOADADDR0x82408000
+
 #include tegra-common-usb-gadget.h
 #include tegra-common-post.h
 
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 08/16] tegra: Add missing tegra124 peripherals

2015-05-13 Thread Simon Glass
There are some missing entries in the tables. Add them.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra124/clock-tables.h | 12 ++--
 arch/arm/mach-tegra/tegra124/clock.c  |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra124/clock-tables.h 
b/arch/arm/include/asm/arch-tegra124/clock-tables.h
index 7005855..3c67e72 100644
--- a/arch/arm/include/asm/arch-tegra124/clock-tables.h
+++ b/arch/arm/include/asm/arch-tegra124/clock-tables.h
@@ -285,12 +285,12 @@ enum periph_id {
/* 184 */
PERIPH_ID_GPU,
PERIPH_ID_AMX1,
-   PERIPH_ID_X_RESERVED26,
-   PERIPH_ID_X_RESERVED27,
-   PERIPH_ID_X_RESERVED28,
-   PERIPH_ID_X_RESERVED29,
-   PERIPH_ID_X_RESERVED30,
-   PERIPH_ID_X_RESERVED31,
+   PERIPH_ID_AFC5,
+   PERIPH_ID_AFC4,
+   PERIPH_ID_AFC3,
+   PERIPH_ID_AFC2,
+   PERIPH_ID_AFC1,
+   PERIPH_ID_AFC0,
 
PERIPH_ID_COUNT,
PERIPH_ID_NONE = -1,
diff --git a/arch/arm/mach-tegra/tegra124/clock.c 
b/arch/arm/mach-tegra/tegra124/clock.c
index 2d17550..b955848 100644
--- a/arch/arm/mach-tegra/tegra124/clock.c
+++ b/arch/arm/mach-tegra/tegra124/clock.c
@@ -475,7 +475,7 @@ static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = {
PERIPHC_ACTMON,
 
/* 120 */
-   NONE(EXTPERIPH1),
+   PERIPHC_EXTPERIPH1,
NONE(EXTPERIPH2),
NONE(EXTPERIPH3),
NONE(OOB),
-- 
2.2.0.rc0.207.ga3a616c

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


Re: [U-Boot] [PATCH] serial: stm32: Automatically generate CR when LF is observed

2015-05-13 Thread Daniel Thompson

On 12/05/15 22:56, Tom Rini wrote:

On Tue, May 12, 2015 at 10:35:55PM +0200, Kamil Lulko wrote:


Strange, this was already posted by Kunhua Huang - then reverted in
commit 698a12bef9e782dcd99c555a739c16eec8669f14. Anyway, yes this
carriage return should be added there. I simply forgot it since I had
implicit CR for each LF turned on in my terminal. Never thought this
would cause so much havoc for users ;)


I reverted it since the author said it wasn't needed with the other
patch they did being applied.  Daniel, can you confirm the odd behavior
exists with top of tree? Thanks!


Yes, the odd behavior still exists with top of tree.

That said, I lucked out here.

In truth I had the problem because my git tree was slightly more out of 
date than I thought it was (and because a google search for serial 
u-boot stm32 before posting my patch didn't notice the code from Kunhua).


So... my patch won't apply to HEAD anyway but reverting the revert would 
be very welcome!



Daniel.

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


Re: [U-Boot] [PATCH v2 8/9] tegra: nyan-big: Allow TPM on I2C

2015-05-13 Thread Stephen Warren

On 05/13/2015 07:57 AM, Simon Glass wrote:

Hi Stephen,

On 13 May 2015 at 07:53, Stephen Warren swar...@wwwdotorg.org wrote:

On 05/13/2015 07:02 AM, Simon Glass wrote:


Enable the I2C3 pins so that the TPM can be used.

Note: There is an DP change also, caused by running board-to-uboot.py
script in the latest tegra-pinmux-script tree.


This also means that the version that got checked into U-Boot wasn't 
generated from the config file that first got checked into 
tegra-pinmux-scripts:-( Tomeu made this DP change when he submitted 
support to tegra-pinmux-scripts. We should make sure that boards are 
added to tegra-pinmux-scripts before sending U-Boot/kernel patches for a 
board to avoid this.



I didn't get the patch for tegra-pinmux-scripts. What was the send time/date
and patch title?


It will be in the future :-) I need to transfer it via github as I
don't have a proper git mirror in-house.


Ah, I should have looked at the email time; I didn't notice it'd only 
just arrived.


Assuming there are no objections to the tegra-pinmux-scripts patch and I 
apply it on Friday as I expect, then this patch looks fine too.


Acked-by: Stephen Warren swar...@nvidia.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] sunxi: Make dram odt-en configurable through Kconfig for A33 based boards

2015-05-13 Thread Hans de Goede
Some A33 based boards use odt, while others do not, so make this configurable.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c | 3 +--
 board/sunxi/Kconfig   | 8 
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c 
b/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
index 979bb3c..a7a0a2e 100644
--- a/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
+++ b/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
@@ -19,7 +19,6 @@
 #define DRAM_CLK_MUL 2
 #define DRAM_CLK_DIV 4
 #define DRAM_SIGMA_DELTA_ENABLE 1
-#define DRAM_ODT_EN 0
 
 struct dram_para {
u8 cs1;
@@ -215,7 +214,7 @@ static int mctl_channel_init(struct dram_para *para)
clrbits_le32(mctl_ctl-pgcr0, 0x3f  0);
 
/* Set ODT */
-   if ((CONFIG_DRAM_CLK  400)  DRAM_ODT_EN) {
+   if ((CONFIG_DRAM_CLK  400)  CONFIG_DRAM_ODT_EN) {
setbits_le32(DXnGCR0(0), 0x3  9);
setbits_le32(DXnGCR0(1), 0x3  9);
} else {
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 940b6c7..d4ae6c7 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -95,6 +95,14 @@ config DRAM_ZQ
---help---
Set the dram zq value.
 
+if MACH_SUN8I_A33
+config DRAM_ODT_EN
+   int sunxi dram odt enable
+   default 0
+   ---help---
+   Set this to 1 to enable dram odt (on die termination)
+endif
+
 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
 config DRAM_EMR1
int sunxi dram emr1 value
-- 
2.4.0

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


[U-Boot] [PATCH v2 14/16] tegra: config: Allow Chrome OS environment settings to be included

2015-05-13 Thread Simon Glass
Bring these in if they are provided by the board.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 include/configs/tegra-common-post.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index 2de5d36..a004b0b 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -56,13 +56,18 @@
 #define BOARD_EXTRA_ENV_SETTINGS
 #endif
 
+#ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
+#define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
TEGRA_DEVICE_SETTINGS \
MEM_LAYOUT_ENV_SETTINGS \
fdt_high=\0 \
initrd_high=\0 \
BOOTENV \
-   BOARD_EXTRA_ENV_SETTINGS
+   BOARD_EXTRA_ENV_SETTINGS \
+   CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
 
 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || 
defined(CONFIG_TEGRA114_SPI)
 #define CONFIG_TEGRA_SPI
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 12/16] tegra: nyan-big: Add additional clock and kernel init

2015-05-13 Thread Simon Glass
We need to turn on all audio-related clocks for the Chrome OS kernel to
boot. Otherwise it will hang when trying to enable audio.

Also for Linux set up graphics driver video protection.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Remove unnecessary ODMDATA mangling

 board/nvidia/nyan-big/nyan-big.c | 69 
 1 file changed, 69 insertions(+)

diff --git a/board/nvidia/nyan-big/nyan-big.c b/board/nvidia/nyan-big/nyan-big.c
index ae8874b..ba96401 100644
--- a/board/nvidia/nyan-big/nyan-big.c
+++ b/board/nvidia/nyan-big/nyan-big.c
@@ -8,7 +8,12 @@
 #include common.h
 #include errno.h
 #include asm/gpio.h
+#include asm/io.h
 #include asm/arch/pinmux.h
+#include asm/arch/clock.h
+#include asm/arch/mc.h
+#include asm/arch-tegra/clk_rst.h
+#include asm/arch-tegra/pmc.h
 #include power/as3722.h
 #include power/pmic.h
 #include pinmux-config-nyan-big.h
@@ -57,3 +62,67 @@ int tegra_lcd_pmic_init(int board_id)
 
return 0;
 }
+
+/* Setup required information for Linux kernel */
+static void setup_kernel_info(void)
+{
+   struct mc_ctlr *mc = (void *)NV_PA_MC_BASE;
+
+   /* The kernel graphics driver needs this region locked down */
+   writel(0, mc-mc_video_protect_bom);
+   writel(0, mc-mc_video_protect_size_mb);
+   writel(1, mc-mc_video_protect_reg_ctrl);
+}
+
+/*
+ * We need to take ALL audio devices conntected to AHUB (AUDIO, APBIF,
+ * I2S, DAM, AMX, ADX, SPDIF, AFC) out of reset and enable the clocks.
+ * Otherwise reading AHUB devices will hang when the kernel boots.
+ */
+static void enable_required_clocks(void)
+{
+   static enum periph_id ids[] = {
+   PERIPH_ID_I2S0,
+   PERIPH_ID_I2S1,
+   PERIPH_ID_I2S2,
+   PERIPH_ID_I2S3,
+   PERIPH_ID_I2S4,
+   PERIPH_ID_AUDIO,
+   PERIPH_ID_APBIF,
+   PERIPH_ID_DAM0,
+   PERIPH_ID_DAM1,
+   PERIPH_ID_DAM2,
+   PERIPH_ID_AMX0,
+   PERIPH_ID_AMX1,
+   PERIPH_ID_ADX0,
+   PERIPH_ID_ADX1,
+   PERIPH_ID_SPDIF,
+   PERIPH_ID_AFC0,
+   PERIPH_ID_AFC1,
+   PERIPH_ID_AFC2,
+   PERIPH_ID_AFC3,
+   PERIPH_ID_AFC4,
+   PERIPH_ID_AFC5,
+   PERIPH_ID_EXTPERIPH1
+   };
+   int i;
+
+   for (i = 0; i  ARRAY_SIZE(ids); i++)
+   clock_enable(ids[i]);
+   udelay(2);
+   for (i = 0; i  ARRAY_SIZE(ids); i++)
+   reset_set_enable(ids[i], 0);
+}
+
+int nvidia_board_init(void)
+{
+   clock_start_periph_pll(PERIPH_ID_EXTPERIPH1, CLOCK_ID_OSC, 1200);
+   clock_start_periph_pll(PERIPH_ID_I2S1, CLOCK_ID_OSC, 150);
+
+   /* For external MAX98090 audio codec */
+   clock_external_output(1);
+   setup_kernel_info();
+   enable_required_clocks();
+
+   return 0;
+}
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH v2 11/16] tegra: Allow board-specific init

2015-05-13 Thread Simon Glass
Add a hook to allows boards to add their own init to board_init().

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra/sys_proto.h | 7 +++
 board/nvidia/common/board.c | 8 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/sys_proto.h 
b/arch/arm/include/asm/arch-tegra/sys_proto.h
index 83f9f47..b64f9d8 100644
--- a/arch/arm/include/asm/arch-tegra/sys_proto.h
+++ b/arch/arm/include/asm/arch-tegra/sys_proto.h
@@ -25,4 +25,11 @@ int tegra_board_id(void);
  */
 int tegra_lcd_pmic_init(int board_id);
 
+/**
+ * nvidia_board_init() - perform any board-specific init
+ *
+ * @return 0 if OK, -ve on error
+ */
+int nvidia_board_init(void);
+
 #endif
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 131802a..ebcee4e 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -107,6 +107,11 @@ __weak int tegra_lcd_pmic_init(int board_it)
return 0;
 }
 
+__weak int nvidia_board_init(void)
+{
+   return 0;
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -180,8 +185,7 @@ int board_init(void)
/* prepare the WB code to LP0 location */
warmboot_prepare_code(TEGRA_LP0_ADDR, TEGRA_LP0_SIZE);
 #endif
-
-   return 0;
+   return nvidia_board_init();
 }
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
-- 
2.2.0.rc0.207.ga3a616c

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


[U-Boot] [PATCH 1/2] sunxi: Fix dram initialization not working on some a33 devices

2015-05-13 Thread Hans de Goede
When porting the allwinner dram init code to u-boot we missed some code
setting an extra bit when doing auto dram config.

This commits add this bit, fixing dram init not working on the ga10h
10 a33 tablet which I'm bringing up atm.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c 
b/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
index d03f00d..979bb3c 100644
--- a/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
+++ b/arch/arm/cpu/armv7/sunxi/dram_sun8i_a33.c
@@ -195,7 +195,7 @@ static int mctl_train_dram(struct dram_para *para)
(struct sunxi_mctl_ctl_reg *)SUNXI_DRAM_CTL0_BASE;
 
mctl_data_train_cfg(para);
-   mctl_set_pir(0x1f3);
+   mctl_set_pir(0x5f3);
 
return ((readl(mctl_ctl-pgsr0)  20)  0xff) ? -EIO : 0;
 }
-- 
2.4.0

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


Re: [U-Boot] [PATCH 1/3] net: Implement random ethaddr fallback in eth.c

2015-05-13 Thread Joe Hershberger
On Mon, May 4, 2015 at 2:55 PM, Joe Hershberger joe.hershber...@ni.com wrote:
 Implement the random ethaddr fallback in eth.c so it is in a common
 place and not reimplemented in each board or driver that wants this
 behavior.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com
 ---
 To function properly in the driver-model case, this patch requires that
 https://patchwork.ozlabs.org/patch/467418/ be applied.

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


Re: [U-Boot] [PATCH] env_mmc: avoid stack allocation for env

2015-05-13 Thread Tim Harvey
On Tue, May 12, 2015 at 8:14 AM, Tom Rini tr...@konsulko.com wrote:
 On Mon, May 11, 2015 at 12:08:25PM -0700, Tim Harvey wrote:
 On Fri, May 8, 2015 at 4:14 PM, Tom Rini tr...@konsulko.com wrote:
  On Sat, May 09, 2015 at 12:15:37AM +0200, Marek Vasut wrote:
  On Friday, May 08, 2015 at 11:51:36 PM, Tim Harvey wrote:
   Allocating space for temporary env on the stack makes 
   env_relocate_spec()
   unsuitable for SPL environments which have very little stack.
 
  Well yeah, but what if you don't have malloc area ? I'd expect that
  the be the case in SPL quite often.
 
  OK, hold up.  We went through this a while back which is why things are
  how they are today.  First, we have things setup today such that you can
  throw stack (at the point we do env in SPL) into DDR.  This means we can
  keep doing things the way they are.  You can take a look at
  include/configs/am335x_evm.h and where CONFIG_EMMC_BOOT is set, that's
  how we do what it looks like you're trying to do on imx6 but on TI
  am335x.

 Yes, I'm doing this on Gateworks Ventana (board/gateworks/gw_ventana)
 based on IMX6 which has a limmited stack size during SPL. I don't see
 anything magic in include/configs/am335x_evm.h that catches my
 attention. Do you know where the code is that lets you point the stack
 to DDR? It sounds like that's what I need.

 Ah oops.  Kconfig, we use Kconfig now :)
 configs/am335x_evm_defconfig:CONFIG_SPL_STACK_R=y
 configs/am335x_evm_defconfig:CONFIG_SPL_STACK_R_ADDR=0x8200

 That's moving stack to DDR and then grabbing 0x8200 for stack (base
 + 0x0200 which is not too high, not too low, not likely to stomp on
 the kernel).

thats strange... common/spl/spl.c uses CONFIG_SPL_STACK_R as the
address not CONFIG_SPL_STACK_R_ADDR - how can that even compile?

http://git.denx.de/?p=u-boot.git;a=blob;f=common/spl/spl.c;#l324


 This sounds like there could be some boards using nand that rely on
 malloc (that's where I got the inspiration from for this) and others
 using mmc that rely on a decent size stack. I wonder if there is a
 #define that we can base off of to provide the best of both? Its not
 that great having two env drivers that have opposite requirements but
 I certainly don't want to change one to make them consistent it it
 will break boards.

 My first guess is that NAND should also be converted to DDR not stack (I
 too found the NAND example, switched MMC to it, and then Wolfgang/others
 pointed out that really stack is where this kind of allocation should
 be, iirc, but then didn't get a chance to dig back at NAND).

You said that backwards right? You mean nand env should be converted
to stack not dram.

How do we do that without risking the chance of breaking boards that
don't have CONFIG_SPL_STACK_R? Wouldn't you need to implement both
around a #define to not cause breakage?

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


[U-Boot] [RFC PATCH 7/8] Move compression and UBI from include to defconfig

2015-05-13 Thread Joe Hershberger
Update the boards based on tools/moveconfig.py using these settings:

RBTREE bool n y
GZIP bool y y
BZIP2 bool n y
LZMA bool n y
LZO bool n y
CMD_UBI bool n y
UBI_SILENCE_MSG bool y y
CMD_UBIFS bool n y
UBIFS_SILENCE_MSG bool y y

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

 configs/MIP405T_defconfig   | 1 +
 configs/MIP405_defconfig| 1 +
 configs/O2D_defconfig   | 1 +
 configs/PIP405_defconfig| 1 +
 configs/PLU405_defconfig| 2 ++
 configs/VCMA9_defconfig | 4 
 configs/a3m071_defconfig| 2 ++
 configs/a4m2k_defconfig | 2 ++
 configs/am335x_boneblack_defconfig  | 1 +
 configs/am335x_boneblack_vboot_defconfig| 1 +
 configs/am335x_evm_defconfig| 1 +
 configs/am335x_evm_nor_defconfig| 1 +
 configs/am335x_evm_norboot_defconfig| 1 +
 configs/am335x_evm_spiboot_defconfig| 1 +
 configs/am335x_evm_usbspl_defconfig | 1 +
 configs/am335x_igep0033_defconfig   | 2 ++
 configs/apf27_defconfig | 2 ++
 configs/apx4devkit_defconfig| 2 ++
 configs/aristainetos_defconfig  | 2 ++
 configs/at91sam9x5ek_dataflash_defconfig| 2 ++
 configs/at91sam9x5ek_mmc_defconfig  | 2 ++
 configs/at91sam9x5ek_nandflash_defconfig| 2 ++
 configs/at91sam9x5ek_spiflash_defconfig | 2 ++
 configs/balloon3_defconfig  | 1 +
 configs/bf527-ezkit_defconfig   | 1 +
 configs/bf548-ezkit_defconfig   | 1 +
 configs/bf561-acvilon_defconfig | 1 +
 configs/birdland_bav335a_defconfig  | 1 +
 configs/birdland_bav335b_defconfig  | 1 +
 configs/cam_enc_4xx_defconfig   | 2 ++
 configs/chromebook_link_defconfig   | 2 ++
 configs/chromebox_panther_defconfig | 2 ++
 configs/cm-bf537e_defconfig | 1 +
 configs/cm-bf548_defconfig  | 2 ++
 configs/colibri_pxa270_defconfig| 1 +
 configs/colibri_vf_defconfig| 2 ++
 configs/coreboot-x86_defconfig  | 2 ++
 configs/crownbay_defconfig  | 2 ++
 configs/davinci_dm355evm_defconfig  | 1 +
 configs/davinci_dm355leopard_defconfig  | 1 +
 configs/davinci_dm365evm_defconfig  | 1 +
 configs/dig297_defconfig| 2 ++
 configs/digsy_mtc_RAMBOOT_defconfig | 1 +
 configs/digsy_mtc_defconfig | 1 +
 configs/digsy_mtc_rev5_RAMBOOT_defconfig| 1 +
 configs/digsy_mtc_rev5_defconfig| 1 +
 configs/dns325_defconfig| 2 ++
 configs/dockstar_defconfig  | 2 ++
 configs/ea20_defconfig  | 2 ++
 configs/eb_cpux9k2_defconfig| 2 ++
 configs/eb_cpux9k2_ram_defconfig| 2 ++
 configs/eco5pk_defconfig| 2 ++
 configs/enbw_cmc_defconfig  | 2 ++
 configs/ethernut5_defconfig | 2 ++
 configs/galileo_defconfig   | 2 ++
 configs/goflexhome_defconfig| 2 ++
 configs/guruplug_defconfig  | 4 
 configs/gwventana_defconfig | 2 ++
 configs/ib62x0_defconfig| 4 
 configs/iconnect_defconfig  | 4 
 configs/ids8313_defconfig   | 2 ++
 configs/ipam390_defconfig   | 2 ++
 configs/k2e_evm_defconfig   | 2 ++
 configs/k2hk_evm_defconfig  | 2 ++
 configs/k2l_evm_defconfig   | 2 ++
 configs/km_kirkwood_128m16_defconfig| 1 +
 configs/km_kirkwood_defconfig   | 1 +
 configs/km_kirkwood_pci_defconfig   | 1 +
 configs/kmcoge4_defconfig   | 1 +
 configs/kmcoge5ne_defconfig | 1 +
 configs/kmcoge5un_defconfig | 1 +
 configs/kmeter1_defconfig   | 1 +
 configs/kmlion1_defconfig   | 1 +
 configs/kmnusa_defconfig| 1 +
 configs/kmopti2_defconfig   | 1 +
 configs/kmsugp1_defconfig   | 1 +
 configs/kmsupx5_defconfig   | 1 +
 configs/kmsuv31_defconfig   | 1 +
 configs/kmvect1_defconfig   | 1 +
 configs/lp8x4x_defconfig| 1 +
 configs/m28evk_defconfig| 2 ++
 configs/m53evk_defconfig| 2 ++
 configs/mcx_defconfig   | 2 ++
 configs/mgcoge3ne_defconfig | 1 +
 configs/mgcoge3un_defconfig   

[U-Boot] [RFC PATCH 0/8] Complex config moves

2015-05-13 Thread Joe Hershberger
I made a pass at some of the configs that seem to be less straightforward
in the include configs. Especially the environment location a number of
boards select based on other variables. Blackfin even has its own
bootmode variable that it keys off of. This is of course simply set for
each board, so the actual resulting value is still singular per board.

How much of this sort of selection do we want to retain on these boards
vs. just resolving to what it ends up being for each board (which is
what tools/moveconfig.py does)?


Joe Hershberger (8):
  Add env persist location to Kconfig
  Move env location selection from include to defconfig
  Add RBTREE to Kconfig
  Add CMD_UBI to Kconfig
  Add decompression to Kconfig
  Add CMD_UBIFS to Kconfig
  Move compression and UBI from include to defconfig
  Move setexpr to Kconfig

 common/Kconfig | 126 +
 configs/A10-OLinuXino-Lime_defconfig   |   2 +
 configs/A10s-OLinuXino-M_defconfig |   2 +
 configs/A13-OLinuXinoM_defconfig   |   2 +
 configs/A13-OLinuXino_defconfig|   2 +
 configs/A20-OLinuXino-Lime2_defconfig  |   2 +
 configs/A20-OLinuXino-Lime_defconfig   |   2 +
 configs/A20-OLinuXino_MICRO_defconfig  |   2 +
 configs/Ainol_AW1_defconfig|   2 +
 configs/Ampe_A76_defconfig |   2 +
 configs/Astar_MID756_defconfig |   2 +
 configs/Auxtek-T004_defconfig  |   2 +
 configs/B4420QDS_NAND_defconfig|   2 +
 configs/B4420QDS_SPIFLASH_defconfig|   2 +
 configs/B4420QDS_defconfig |   1 +
 configs/B4860QDS_NAND_defconfig|   2 +
 configs/B4860QDS_SECURE_BOOT_defconfig |   1 +
 configs/B4860QDS_SPIFLASH_defconfig|   2 +
 configs/B4860QDS_SRIO_PCIE_BOOT_defconfig  |   2 +
 configs/B4860QDS_defconfig |   1 +
 configs/BSC9131RDB_NAND_SYSCLK100_defconfig|   2 +
 configs/BSC9131RDB_NAND_defconfig  |   2 +
 configs/BSC9131RDB_SPIFLASH_SYSCLK100_defconfig|   2 +
 configs/BSC9131RDB_SPIFLASH_defconfig  |   2 +
 configs/BSC9132QDS_NAND_DDRCLK100_SECURE_defconfig |   1 +
 configs/BSC9132QDS_NAND_DDRCLK100_defconfig|   2 +
 configs/BSC9132QDS_NAND_DDRCLK133_SECURE_defconfig |   1 +
 configs/BSC9132QDS_NAND_DDRCLK133_defconfig|   2 +
 configs/BSC9132QDS_NOR_DDRCLK100_SECURE_defconfig  |   1 +
 configs/BSC9132QDS_NOR_DDRCLK100_defconfig |   2 +
 configs/BSC9132QDS_NOR_DDRCLK133_SECURE_defconfig  |   1 +
 configs/BSC9132QDS_NOR_DDRCLK133_defconfig |   2 +
 .../BSC9132QDS_SDCARD_DDRCLK100_SECURE_defconfig   |   1 +
 configs/BSC9132QDS_SDCARD_DDRCLK100_defconfig  |   2 +
 .../BSC9132QDS_SDCARD_DDRCLK133_SECURE_defconfig   |   1 +
 configs/BSC9132QDS_SDCARD_DDRCLK133_defconfig  |   2 +
 .../BSC9132QDS_SPIFLASH_DDRCLK100_SECURE_defconfig |   1 +
 configs/BSC9132QDS_SPIFLASH_DDRCLK100_defconfig|   2 +
 .../BSC9132QDS_SPIFLASH_DDRCLK133_SECURE_defconfig |   1 +
 configs/BSC9132QDS_SPIFLASH_DDRCLK133_defconfig|   2 +
 configs/Bananapi_defconfig |   2 +
 configs/Bananapro_defconfig|   2 +
 configs/C29XPCIE_NAND_defconfig|   2 +
 configs/C29XPCIE_NOR_SECBOOT_defconfig |   1 +
 configs/C29XPCIE_SPIFLASH_SECBOOT_defconfig|   1 +
 configs/C29XPCIE_SPIFLASH_defconfig|   2 +
 configs/C29XPCIE_defconfig |   2 +
 configs/CPCI2DP_defconfig  |   1 +
 configs/CPCI4052_defconfig |   1 +
 configs/CSQ_CS908_defconfig|   2 +
 configs/Chuwi_V7_CW0825_defconfig  |   2 +
 configs/Colombus_defconfig |   2 +
 configs/Cubieboard2_defconfig  |   2 +
 configs/Cubieboard_defconfig   |   2 +
 configs/Cubietruck_defconfig   |   2 +
 configs/Hummingbird_A31_defconfig  |   2 +
 configs/Hyundai_A7HD_defconfig |   2 +
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig   |   2 +
 configs/Ippo_q8h_v1_2_defconfig|   2 +
 configs/Ippo_q8h_v5_defconfig  |   2 +
 configs/Linksprite_pcDuino3_Nano_defconfig |   2 +
 configs/Linksprite_pcDuino3_defconfig  |   2 +
 configs/Linksprite_pcDuino_defconfig   |   2 +
 configs/M5208EVBE_defconfig|   1 +
 configs/M52277EVB_defconfig|   1 +
 configs/M52277EVB_stmicro_defconfig|   1 +
 configs/M5235EVB_Flash32_defconfig |   1 +
 configs/M5235EVB_defconfig |   1 +
 configs/M5249EVB_defconfig |   1 +
 

[U-Boot] [RFC PATCH 1/8] Add env persist location to Kconfig

2015-05-13 Thread Joe Hershberger
All of the ENV_IS_IN_* configs moved to Kconfig.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com

---

 common/Kconfig | 85 ++
 1 file changed, 85 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index 15759f7..4397e69 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1,3 +1,88 @@
+menu Environment
+
+choice
+   prompt Environment location
+   default ENV_IS_NOWHERE
+   help
+ Select where the environment is persisted.
+
+config ENV_IS_IN_DATAFLASH
+   bool Data Flash
+   help
+ Select this if you have a DataFlash memory device which you
+ want to use for the environment.
+
+config ENV_IS_IN_EEPROM
+   bool EEPROM
+   help
+ Select this if you have an EEPROM or similar serial access
+ device and a driver for it.
+
+config ENV_IS_IN_FLASH
+   bool Flash
+   help
+ Select this if the environment is in flash memory.
+
+config ENV_IS_IN_MMC
+   bool MMC
+   help
+ Select this if you have an MMC device which you want to use
+ for the environment.
+
+config ENV_IS_IN_FAT
+   bool FAT
+   help
+ Select this if you want to use the FAT file system for the
+ environment.
+
+config ENV_IS_IN_NAND
+   bool NAND
+   help
+ Select this if you have a NAND device which you want to use
+ for the environment.
+
+config ENV_IS_IN_NVRAM
+   bool NVRAM
+   help
+ Select this if you have some non-volatile memory device
+ (NVRAM, battery buffered SRAM) which you want to use for the
+ environment.
+
+config ENV_IS_IN_ONENAND
+   bool OneNAND
+   help
+ Select this if you have a OneNAND device which you want to use
+ for the environment.
+
+config ENV_IS_IN_SPI_FLASH
+   bool SPI Flash
+   help
+ Select this if you have a SPI Flash memory device which you
+ want to use for the environment.
+
+config ENV_IS_IN_REMOTE
+   bool Remote
+   help
+ Select this if you have a remote memory space which you
+ want to use for the local device's environment.
+
+config ENV_IS_IN_UBI
+   bool UBI
+   help
+ Select this if you have an UBI volume that you want to use for
+ the environment.  This has the benefit of wear-leveling the
+ environment accesses, which is important on NAND.
+
+config ENV_IS_NOWHERE
+   bool Nowhere
+   help
+ Select this if there is no storage for the environment and
+ each boot U-Boot will use the default environment.
+
+endchoice
+
+endmenu
+
 menu Command line interface
 
 config HUSH_PARSER
-- 
1.7.11.5

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


[U-Boot] [RFC PATCH 4/8] Add CMD_UBI to Kconfig

2015-05-13 Thread Joe Hershberger
This command benefits from Kconfig auto-selecting-other-configs
capability.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

 common/Kconfig | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index 4397e69..619fc9d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -319,6 +319,24 @@ config CMD_FPGA
 
 endmenu
 
+menu Storage commands
+
+config CMD_UBI
+   bool ubi
+   select RBTREE
+   help
+ Adds commands for interacting with MTD partitions formatted
+ with the UBI flash translation layer
+
+config UBI_SILENCE_MSG
+   bool Silence UBI messages
+   default y if ENV_IS_IN_UBI
+   depends on CMD_UBI
+   help
+ Make the verbose messages from UBI stop printing. This leaves
+ warnings and errors enabled.
+
+endmenu
 
 menu Shell scripting commands
 
-- 
1.7.11.5

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


[U-Boot] [RFC PATCH 6/8] Add CMD_UBIFS to Kconfig

2015-05-13 Thread Joe Hershberger
This command benefits from Kconfig auto-selecting-other-configs
capability.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

 common/Kconfig | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index 619fc9d..cd24370 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -336,6 +336,21 @@ config UBI_SILENCE_MSG
  Make the verbose messages from UBI stop printing. This leaves
  warnings and errors enabled.
 
+config CMD_UBIFS
+   bool ubifs
+   select LZO
+   help
+ Adds commands for interacting with UBI volumes formatted as
+ UBIFS.  UBIFS is read-only in u-boot.
+
+config UBIFS_SILENCE_MSG
+   bool Silence UBIFS messages
+   default y if ENV_IS_IN_UBI
+   depends on CMD_UBIFS
+   help
+ Make the verbose messages from UBIFS stop printing. This
+ leaves warnings and errors enabled.
+
 endmenu
 
 menu Shell scripting commands
-- 
1.7.11.5

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


[U-Boot] [RFC PATCH 5/8] Add decompression to Kconfig

2015-05-13 Thread Joe Hershberger
Also add a new menu for all of the decompression options.

The CMD_UBIFS config needs to select the LZO config.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

 lib/Kconfig | 29 +
 1 file changed, 29 insertions(+)

diff --git a/lib/Kconfig b/lib/Kconfig
index b4a02b4..ead7fc0 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -50,6 +50,35 @@ config REGEX
  regex support to some commands, for example env grep and
  setexpr.
 
+menu Decompression Support
+
+config GZIP
+   bool gzip decompression support
+   default y
+   help
+ If this option is set, support for gzip compressed images is
+ included.
+
+config BZIP2
+   bool bzip2 decompression support
+   help
+ If this option is set, support for bzip2 compressed images is
+ included.
+
+config LZMA
+   bool LZMA decompression support
+   help
+ If this option is set, support for lzma compressed images is
+ included.
+
+config LZO
+   bool LZO decompression support
+   help
+ If this option is set, support for LZO compressed images is
+ included.
+
+endmenu
+
 source lib/rsa/Kconfig
 
 menu Hashing Support
-- 
1.7.11.5

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


Re: [U-Boot] [RFC PATCH 1/8] Add env persist location to Kconfig

2015-05-13 Thread Joe Hershberger
On Wed, May 13, 2015 at 11:29 PM, Joe Hershberger
joe.hershber...@ni.com wrote:
 All of the ENV_IS_IN_* configs moved to Kconfig.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com

 ---

  common/Kconfig | 85 
 ++
  1 file changed, 85 insertions(+)

 diff --git a/common/Kconfig b/common/Kconfig
 index 15759f7..4397e69 100644
 --- a/common/Kconfig
 +++ b/common/Kconfig
 @@ -1,3 +1,88 @@
 +menu Environment
 +
 +choice
 +   prompt Environment location
 +   default ENV_IS_NOWHERE
 +   help
 + Select where the environment is persisted.
 +
 +config ENV_IS_IN_DATAFLASH
 +   bool Data Flash
 +   help
 + Select this if you have a DataFlash memory device which you
 + want to use for the environment.
 +
 +config ENV_IS_IN_EEPROM
 +   bool EEPROM
 +   help
 + Select this if you have an EEPROM or similar serial access
 + device and a driver for it.
 +
 +config ENV_IS_IN_FLASH
 +   bool Flash
 +   help
 + Select this if the environment is in flash memory.
 +
 +config ENV_IS_IN_MMC
 +   bool MMC
 +   help
 + Select this if you have an MMC device which you want to use
 + for the environment.
 +
 +config ENV_IS_IN_FAT
 +   bool FAT
 +   help
 + Select this if you want to use the FAT file system for the
 + environment.
 +
 +config ENV_IS_IN_NAND
 +   bool NAND
 +   help
 + Select this if you have a NAND device which you want to use
 + for the environment.
 +
 +config ENV_IS_IN_NVRAM
 +   bool NVRAM
 +   help
 + Select this if you have some non-volatile memory device
 + (NVRAM, battery buffered SRAM) which you want to use for the
 + environment.
 +
 +config ENV_IS_IN_ONENAND
 +   bool OneNAND
 +   help
 + Select this if you have a OneNAND device which you want to use
 + for the environment.
 +
 +config ENV_IS_IN_SPI_FLASH
 +   bool SPI Flash
 +   help
 + Select this if you have a SPI Flash memory device which you
 + want to use for the environment.
 +
 +config ENV_IS_IN_REMOTE
 +   bool Remote
 +   help
 + Select this if you have a remote memory space which you
 + want to use for the local device's environment.
 +
 +config ENV_IS_IN_UBI
 +   bool UBI
 +   help
 + Select this if you have an UBI volume that you want to use for
 + the environment.  This has the benefit of wear-leveling the
 + environment accesses, which is important on NAND.
 +
 +config ENV_IS_NOWHERE
 +   bool Nowhere
 +   help
 + Select this if there is no storage for the environment and
 + each boot U-Boot will use the default environment.
 +
 +endchoice
 +
 +endmenu
 +
  menu Command line interface

  config HUSH_PARSER

This technically needs to be squashed with the patch that follows it
to preserve bisectability, but I wanted to post it separately to be
easier to look at.

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


Re: [U-Boot] [PATCH 3/3] net: Remove all calls to net_random_ethaddr()

2015-05-13 Thread Joe Hershberger
On Mon, May 4, 2015 at 2:55 PM, Joe Hershberger joe.hershber...@ni.com wrote:
 Remove the calls to net_random_ethaddr() that some boards and some
 drivers are calling. This is now implemented inside of net/eth.c

 Enable the feature for all boards that previously enabled it.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com
 ---

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


Re: [U-Boot] [PATCH 1/6] usb: dwc2: Add support for v3 snpsid value

2015-05-13 Thread Marek Vasut
On Wednesday, May 13, 2015 at 01:00:01 PM, Peter Griffin wrote:
 Hi Marek,
 
 On Tue, 12 May 2015, Marek Vasut wrote:
  On Tuesday, May 12, 2015 at 03:38:27 PM, Peter Griffin wrote:
   This has been tested to the extent that I can enumerate
   a asix usb networking adapter and boot a kernel over usb
   on the 96boards hikey u-boot port I'm currently doing.
   
   Signed-off-by: Peter Griffin peter.grif...@linaro.org
   ---
   
drivers/usb/host/dwc2.c | 3 ++-
drivers/usb/host/dwc2.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
   
   diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
   index e8142ac..19a6007 100644
   --- a/drivers/usb/host/dwc2.c
   +++ b/drivers/usb/host/dwc2.c
   @@ -1015,7 +1015,8 @@ int usb_lowlevel_init(int index, enum
   usb_init_type init, void **controller) snpsid = readl(regs-gsnpsid);
   
 printf(Core Release: %x.%03x\n, snpsid  12  0xf, snpsid 
 0xfff);
   
   - if ((snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx) {
   + if ((snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx 
   + (snpsid  DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_3xx) {
  
  Isn't this then a DWC3 controller instead ?
 
 No I don't believe so. dwc3 is a usb3 controller with different register
 set AFAIK.
 
 I believe this piece of code is replicating what the Linux
 driver does here: -
 
 http://lxr.free-electrons.com/source/drivers/usb/dwc2/core.c#L2664
 
 Also see here for the various different sub core revisions within 2.xx and
 3.xx which are supported by the dwc2 Linux driver
 http://lxr.free-electrons.com/source/drivers/usb/dwc2/core.h#L625.
 
 This also matches up with the available datasheet here
 https://github.com/96boards/documentation/blob/master/hikey/
 Hi6220V100_Multi-Mode_Application_Processor_Function_Description.pdf on
 page 219 which states it is a USB2 OTG controller, but near the bottom of
 the page also tates: -
 
 The USB core used in Hi6220 is build from Synopsys IP(3.00a)..
 
 I just checked through the DWC_otg_databook.odf, and these revision numbers
 also match up with the Revision History changes in the document. So it
 all ties together.
 
 It is worth highlighting at this point that not bailing here (along with
 setting up the appropriate clocks to the IP) was enough for me to get a
 DWC2 core rev 3.00a enumerating a ASIX networking adapter and tftp a
 kernel into DDR. However there maybe some other changes required to
 fully support the 3.00a hardware version. There is of course the problem
 I mentioned in the cover letter regarding enumerating mass storage devices
 which may or may not be related to this.
 
 Although a quick grep of the Linux driver only gets three hits
 
 git grep DWC2_CORE_REV_3_00a
 core.h:#define DWC2_CORE_REV_3_00a  0x4f54300a
 core_intr.c:if (hsotg-hw_params.snpsid = DWC2_CORE_REV_3_00a)
 hcd.c:  if (hsotg-hw_params.snpsid = DWC2_CORE_REV_3_00a) {
 
 Neither of which seem relevant to the mass storage device problem (one adds
 a delay in the irq handler, and the other sets a bit when freeing the hcd.

Ooh, I see. Thank you for the extensive explanation!

I picked this patch for u-boot-usb, so feel free to submit any improvements
for the 3.xx core as you cook them. Thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] armv8: caches: Added routine to set non cacheable region

2015-05-13 Thread Siva Durga Prasad Paladugu
Hi Mark,

 -Original Message-
 From: Mark Rutland [mailto:mark.rutl...@arm.com]
 Sent: Wednesday, May 13, 2015 11:01 PM
 To: Siva Durga Prasad Paladugu
 Cc: Michal Simek; u-boot@lists.denx.de; Albert Aribaud; Marek Vasut; Tom
 Rini; Varun Sethi; Thierry Reding; Arnab Basu; York Sun
 Subject: Re: [U-Boot] [PATCH v2] armv8: caches: Added routine to set non
 cacheable region
 
 On Tue, May 12, 2015 at 04:46:49AM +0100, Siva Durga Prasad Paladugu
 wrote:
  Hi Mark,
 
 
   -Original Message-
   From: Mark Rutland [mailto:mark.rutl...@arm.com]
   Sent: Wednesday, April 29, 2015 10:00 PM
   To: Michal Simek
   Cc: u-boot@lists.denx.de; Albert Aribaud; Marek Vasut; Tom Rini;
   Siva Durga Prasad Paladugu; Varun Sethi; Thierry Reding; Arnab Basu;
   York Sun
   Subject: Re: [U-Boot] [PATCH v2] armv8: caches: Added routine to set
   non cacheable region
  
   Hi Michal,
  
   On Wed, Apr 29, 2015 at 09:35:35AM +0100, Michal Simek wrote:
Added routine mmu_set_region_dcache_behaviour() to set a
particular region as non cacheable.
  
   What's the intended use of this?
  This is intended to mark a dynamically allocated region as non-cacheable
 region in runtime.
 
 Sure, but why does that region need to be non-cacheable?
 
 I assume you want to give the region to some device?
Yes, this is used for device.
 
 Do you ever hand the memory back (and hence need to make it cacehable
 again)?

No, In my case , I don't need to make it cacheable back...

 
  There is same kind of routine for armv7 but not for armv8. Do you think
 that the same functionality to be addressed for armv8 too?
 
  As per below comment, you are correct, this looks like to be more board
 specific.
 
 While the address of the tables might be board-specific I'd imagine that the
 manipulation routines can be shared.

Ok, I got it, I will check how to make these manipulation routines generic and 
will send v2.

Thanks,
Siva

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


[U-Boot] [PATCH v2 2/2] mx: mx6: display max cpu frequency in print_cpuinfo()

2015-05-13 Thread Tim Harvey
Display the max CPU frequency as well as the current running CPU frequency
if the max CPU frequency is available and differs from the current CPU
frequency.

Before:
CPU:   Freescale i.MX6Q rev1.2 at 792 MHz

After - using an 800MHz IMX6DL (running at its max)
CPU:   Freescale i.MX6DL rev1.1 at 792 MHz

After - using a 1GHz IMX6Q (not running at its max):
CPU:   Freescale i.MX6Q rev1.2 996 MHz (running at 792 MHz)

Signed-off-by: Tim Harvey thar...@gateworks.com
---
v2:
 - split out from patch that obtains the max cpu freq
 - add before/after example and more description of change

Signed-off-by: Tim Harvey thar...@gateworks.com
---
 arch/arm/imx-common/cpu.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 067d08f..6b20482 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -142,7 +142,7 @@ const char *get_imx_type(u32 imxtype)
 
 int print_cpuinfo(void)
 {
-   u32 cpurev;
+   u32 cpurev, max_freq;
 
 #if defined(CONFIG_MX6)  defined(CONFIG_IMX6_THERMAL)
struct udevice *thermal_dev;
@@ -151,11 +151,25 @@ int print_cpuinfo(void)
 
cpurev = get_cpu_rev();
 
+#if defined(CONFIG_MX6)
+   printf(CPU:   Freescale i.MX%s rev%d.%d,
+  get_imx_type((cpurev  0xFF000)  12),
+  (cpurev  0x000F0)  4,
+  (cpurev  0xF)  0);
+   max_freq = get_cpu_speed_grade_hz();
+   if (!max_freq || max_freq == mxc_get_clock(MXC_ARM_CLK)) {
+   printf( at %dMHz\n, mxc_get_clock(MXC_ARM_CLK) / 100);
+   } else {
+   printf( %d MHz (running at %d MHz)\n, max_freq / 100,
+  mxc_get_clock(MXC_ARM_CLK) / 100);
+   }
+#else
printf(CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n,
get_imx_type((cpurev  0xFF000)  12),
(cpurev  0x000F0)  4,
(cpurev  0xF)  0,
mxc_get_clock(MXC_ARM_CLK) / 100);
+#endif
 
 #if defined(CONFIG_MX6)  defined(CONFIG_IMX6_THERMAL)
ret = uclass_get_device(UCLASS_THERMAL, 0, thermal_dev);
-- 
1.9.1

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


[U-Boot] [PATCH v2 0/2]: imx: mx6: use OTP for freq grade

2015-05-13 Thread Tim Harvey
This is a second take on my last series to obtain and use CPU frequency
grade in print_cpuinfo().

Signed-off-by: Tim Harvey thar...@gateworks.com
--
v2:
 - split into two series: 1 for CPU frequency, other for Temperature grade

Tim Harvey (2):
  imx: mx6: add get_cpu_speed_grade_hz func to return MHz speed grade
from OTP
  mx: mx6: display max cpu frequency in print_cpuinfo()

 arch/arm/cpu/armv7/mx6/soc.c  | 41 +++
 arch/arm/imx-common/cpu.c | 16 +++-
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 3 files changed, 57 insertions(+), 1 deletion(-)

-- 
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/2] imx: mx6: add get_cpu_speed_grade_hz func to return MHz speed grade from OTP

2015-05-13 Thread Tim Harvey
The IMX6 has four different speed grades determined by eFUSE SPEED_GRADING
indicated by OCOTP_CFG3[17:16] which is at 0x440 in the Fusemap Description
Table. Return this frequency so that it can be used elsewhere.

Note that the IMX6SDLRM and the IMX6SXRM do not indicate this in the
their Fusemap Description Table however Freescale has confirmed that these
eFUSE bits match the description within the IMX6DQRM and that they will
be added to the next revision of the respective reference manuals.

These have been tested with IMX6 Quad/Solo/Dual-light 800Mhz and 1GHz grades.

Signed-off-by: Tim Harvey thar...@gateworks.com
---
 arch/arm/cpu/armv7/mx6/soc.c  | 41 +++
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 2 files changed, 42 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index dd34138..71fa1fb 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -83,6 +83,47 @@ u32 get_cpu_rev(void)
return (type  12) | (reg + 0x10);
 }
 
+/*
+ * OCOTP_CFG3[17:16] (see Fusemap Description Table offset 0x440)
+ * defines a 2-bit SPEED_GRADING
+ */
+#define OCOTP_CFG3_SPEED_SHIFT 16
+#define OCOTP_CFG3_SPEED_800MHZ0
+#define OCOTP_CFG3_SPEED_850MHZ1
+#define OCOTP_CFG3_SPEED_1GHZ  2
+#define OCOTP_CFG3_SPEED_1P2GHZ3
+
+u32 get_cpu_speed_grade_hz(void)
+{
+   struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+   struct fuse_bank *bank = ocotp-bank[0];
+   struct fuse_bank0_regs *fuse =
+   (struct fuse_bank0_regs *)bank-fuse_regs;
+   uint32_t val;
+
+   val = readl(fuse-cfg3);
+   val = OCOTP_CFG3_SPEED_SHIFT;
+   val = 0x3;
+
+   switch (val) {
+   /* Valid for IMX6DQ */
+   case OCOTP_CFG3_SPEED_1P2GHZ:
+   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+   return 12;
+   /* Valid for IMX6SX/IMX6SDL/IMX6DQ */
+   case OCOTP_CFG3_SPEED_1GHZ:
+   return 99600;
+   /* Valid for IMX6DQ */
+   case OCOTP_CFG3_SPEED_850MHZ:
+   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+   return 85200;
+   /* Valid for IMX6SX/IMX6SDL/IMX6DQ */
+   case OCOTP_CFG3_SPEED_800MHZ:
+   return 79200;
+   }
+   return 0;
+}
+
 #ifdef CONFIG_REVISION_TAG
 u32 __weak get_board_rev(void)
 {
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 28ba844..a2cd0a9 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -16,6 +16,7 @@
 
 u32 get_nr_cpus(void);
 u32 get_cpu_rev(void);
+u32 get_cpu_speed_grade_hz(void);
 
 /* returns MXC_CPU_ value */
 #define cpu_type(rev) (((rev)  12)0xff)
-- 
1.9.1

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


[U-Boot] [PATCH v2 0/4]: imx: mx6: use OTP for temperature grade info

2015-05-13 Thread Tim Harvey
This is a second take on my last series to obtain and use CPU temperature
grade in print_cpuinfo().

Signed-off-by: Tim Harvey thar...@gateworks.com
--
v2:
 - split into two series: 1 for CPU frequency, other for Temperature grade

Tim Harvey (4):
  mx6: add OTP bank1 registers
  imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
  imx: mx6: add display of CPU temperature grade in print_cpuinfo()
  thermal: imx_thermal: use CPU temperature grade for trip points

 arch/arm/cpu/armv7/mx6/soc.c  | 38 +++
 arch/arm/imx-common/cpu.c | 27 ++
 arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 drivers/thermal/imx_thermal.c | 29 +++
 include/imx_thermal.h |  6 +
 6 files changed, 106 insertions(+), 14 deletions(-)

-- 
1.9.1

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


[U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP

2015-05-13 Thread Tim Harvey
The MX6 has a temperature grade defined by OCOTP_MEM0[7:6] which is at 0x480
in the Fusemap Description Table in the reference manual. Return this value
as well as min/max temperature based on the value.

Note that the IMX6SDLRM and the IMX6SXRM do not indicate this in the
their Fusemap Description Table however Freescale has confirmed that these
eFUSE bits match the description within the IMX6DQRM and that they will
be added to the next revision of the respective reference manuals.

This has been tested with IMX6 Automative and Industrial parts.

Signed-off-by: Tim Harvey thar...@gateworks.com
---
v2:
 - split out adding get_cpu_temp_grade to its own patch
 - added note about support of MX6SDL and MX6SX

Signed-off-by: Tim Harvey thar...@gateworks.com
---
 arch/arm/cpu/armv7/mx6/soc.c  | 38 +++
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 include/imx_thermal.h |  6 +
 3 files changed, 45 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 71fa1fb..6f501ac 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -124,6 +124,44 @@ u32 get_cpu_speed_grade_hz(void)
return 0;
 }
 
+/*
+ * OCOTP_MEM0[7:6] (see Fusemap Description Table offset 0x480)
+ * defines a 2-bit Temperature Grade
+ *
+ * return temperature grade and min/max temperature in celcius
+ */
+#define OCOTP_MEM0_TEMP_SHIFT  6
+
+u32 get_cpu_temp_grade(int *minc, int *maxc)
+{
+   struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+   struct fuse_bank *bank = ocotp-bank[1];
+   struct fuse_bank1_regs *fuse =
+   (struct fuse_bank1_regs *)bank-fuse_regs;
+   uint32_t val;
+
+   val = readl(fuse-mem0);
+   val = OCOTP_MEM0_TEMP_SHIFT;
+   val = 0x3;
+
+   if (minc  maxc) {
+   if (val == TEMP_AUTOMOTIVE) {
+   *minc = -40;
+   *maxc = 125;
+   } else if (val == TEMP_INDUSTRIAL) {
+   *minc = -40;
+   *maxc = 105;
+   } else if (val == TEMP_EXTCOMMERCIAL) {
+   *minc = -20;
+   *maxc = 105;
+   } else {
+   *minc = 0;
+   *maxc = 95;
+   }
+   }
+   return val;
+}
+
 #ifdef CONFIG_REVISION_TAG
 u32 __weak get_board_rev(void)
 {
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index a2cd0a9..c583291 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -17,6 +17,7 @@
 u32 get_nr_cpus(void);
 u32 get_cpu_rev(void);
 u32 get_cpu_speed_grade_hz(void);
+u32 get_cpu_temp_grade(int *minc, int *maxc);
 
 /* returns MXC_CPU_ value */
 #define cpu_type(rev) (((rev)  12)0xff)
diff --git a/include/imx_thermal.h b/include/imx_thermal.h
index be13652..8ce333c 100644
--- a/include/imx_thermal.h
+++ b/include/imx_thermal.h
@@ -8,6 +8,12 @@
 #ifndef _IMX_THERMAL_H_
 #define _IMX_THERMAL_H_
 
+/* CPU Temperature Grades */
+#define TEMP_COMMERCIAL 0
+#define TEMP_EXTCOMMERCIAL  1
+#define TEMP_INDUSTRIAL 2
+#define TEMP_AUTOMOTIVE 3
+
 struct imx_thermal_plat {
void *regs;
int fuse_bank;
-- 
1.9.1

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


Re: [U-Boot] [PATCH 2/2] sunxi: Make dram odt-en configurable through Kconfig for A33 based boards

2015-05-13 Thread Ian Campbell
On Wed, 2015-05-13 at 17:09 +0200, Hans de Goede wrote:
 diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
 index 940b6c7..d4ae6c7 100644
 --- a/board/sunxi/Kconfig
 +++ b/board/sunxi/Kconfig
 @@ -95,6 +95,14 @@ config DRAM_ZQ
   ---help---
   Set the dram zq value.
  
 +if MACH_SUN8I_A33

Shouldn't this be a depends on MACH_SUN8I_A33 in the entry itself? I
see we use if a lot in this file, is there a reason for that or just how
it has been done?

In any case using if here is at least consistent so no strong objection
on that grounds.

 +config DRAM_ODT_EN
 + int sunxi dram odt enable
 + default 0
 + ---help---
 + Set this to 1 to enable dram odt (on die termination)

Why is this an int rather than a bool?


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


Re: [U-Boot] [PATCH 2/3] net: Remove all references to CONFIG_ETHADDR and friends

2015-05-13 Thread Joe Hershberger
On Mon, May 4, 2015 at 2:55 PM, Joe Hershberger joe.hershber...@ni.com wrote:
 We really don't want boards defining fixed MAC addresses in their config
 so we just remove the option to set it in a fixed way. If you must have
 a MAC address that was not provisioned, then use the random MAC address
 functionality.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com
 ---

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


Re: [U-Boot] [PATCH 2/6] dm: gpio: hi6220: Add a hi6220 GPIO driver model driver.

2015-05-13 Thread Marek Vasut
On Wednesday, May 13, 2015 at 02:00:13 PM, Peter Griffin wrote:
 Hi Marek,
 
 Thanks for reviewing.

Hi!

   +#ifndef _HI6220_GPIO_H_
   +#define _HI6220_GPIO_H_
   +
   +#define HI6220_GPIO0_BASE(void *)0xf8011000
  
  You should drop the explicit cast, that's nasty.
 
 If I drop the cast I get lots of
 
 include/asm/arch/gpio.h:11:32: warning: initialization makes pointer from
 integer without a cast
 
 compiler warnings.

But this is gpio.h header for your architecture, so maybe fix it there too?

  Also, why don't you define this as a HI6220_GPIO_BASE(bank) instead?
  That'd trim down the number of macros and from what I see, it should
  be rather easy to do ...
  
  #define HI6220_GPIO_BASE(bank)
  
  (((bank  4) ? 0xf8012000 : (0xf702 - 0x4000)) + (0x1000 * bank))
 
 Yes good idea, I will do it like you suggest in V2. Currently I have
 
 #define HI6220_GPIO_BASE(bank)(void *)(((bank  4) ? 0xf8011000 : \
   0xf702 - 0x4000) + (0x1000 * bank))
 
 To avoid the warnings mentioned above.

Yup, or maybe even make it an inline function so you get proper typechecking?

 snip
 
   +#define HI6220_GPIO17_BASE   (void *)0xf702d000
   +#define HI6220_GPIO18_BASE   (void *)0xf702e000
   +#define HI6220_GPIO19_BASE   (void *)0xf702f000
  
  But are these even used in the driver anywhere ?
 
 They are currently used in the hikey.c board file which defines the
 hikey_gpio_platdata structure.
 
 Although thinking about it some more this should be moved from the hikey
 board file to the driver as it is SoC specific rather than board specific.

This is specific to the CPU, so this should be in arch-something .

   +#define BIT(x)   (1  (x))
  
  This macro should be placed into common header files.
  
   +#define HI6220_GPIO_PER_BANK 8
   +#define HI6220_GPIO_DIR  0x400
   +
   +struct gpio_bank {
   + u8 *base;   /* address of registers in physical memory */
  
  Should be void __iomem *, no ?
 
 Will fix in v2.

Thanks! Also, please wait a bit for other reviews before sending V2 :)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] sunxi: Fix dram initialization not working on some a33 devices

2015-05-13 Thread Ian Campbell
On Wed, 2015-05-13 at 17:09 +0200, Hans de Goede wrote:
 When porting the allwinner dram init code to u-boot we missed some code
 setting an extra bit when doing auto dram config.
 
 This commits add this bit, fixing dram init not working on the ga10h
 10 a33 tablet which I'm bringing up atm.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Acked-by: Ian Campbell i...@hellion.org.uk


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


Re: [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input

2015-05-13 Thread Marek Vasut
On Wednesday, May 13, 2015 at 10:14:19 AM, Stefan Wahren wrote:
 Hi Marek,
 
 Am 13.05.2015 um 09:13 schrieb Marek Vasut:
  On Wednesday, May 13, 2015 at 08:02:21 AM, Stefan Wahren wrote:
  Hi,
  
  Hi,
  
  during the study of DC-DC handling in u-boot i noticed a possible bug.
  
  In case the DC-DC is already enabled the function returns without
  reenabling brown out detection. I don't think that's okay.
  A possible fix would be to do the check if DC-DC is already enabled
  before disabling brown out detection. This idea is
  attached as a draft. If it's acceptable i will send a proper patch.
  
  What exactly would happen if you enable DCDC converter while BO detection
  is already enabled ? It is possible, that enabling the DCDC would cause a
  dip on the power rail and cause in turn a BO, no ? IIRC, that is the
  reason why BO detection is disabled when enabling DCDC.
 
 i think we're talking about different things. The patch won't touch this
 necessary behaviour.
 
 No, i think it's faulty to leave the function with BO detection disabled
 in the case the DC-DC is already enabled:
 
 if (xfer  (readl(power_regs-hw_power_5vctrl) 
 POWER_5VCTRL_ENABLE_DCDC)) {
  return;
 }

Uh uh, I'm an idiot and I was probably half asleep when I blurted this last
mail, sorry.

Obviously, enabling the BO properly makes sense.

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


  1   2   >