[U-Boot] [PATCH] colibri_vf: Fix bstlen field

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

Commit 3f353cecc ("vf610: refactor DDRMC code") changed the original
bstlen field from 3 to 0.

Restore the original value for proper behaviour.

Based on the patch from Anthony Felice 
for the vf610twr board.

Reported-by: Stefan Agner 
Signed-off-by: Fabio Estevam 
---
 board/toradex/colibri_vf/colibri_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/toradex/colibri_vf/colibri_vf.c 
b/board/toradex/colibri_vf/colibri_vf.c
index 39bf0ac..a6d1c5b 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -119,7 +119,7 @@ int dram_init(void)
.trcd_int  = 6,
.tras_lockout  = 0,
.tdal  = 12,
-   .bstlen= 0,
+   .bstlen= 3,
.tdll  = 512,
.trp_ab= 6,
.tref  = 3120,
-- 
1.9.1

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


[U-Boot] [PATCH] colibri_vf: Fix typo in DRAM init

2015-10-13 Thread Stefan Agner
From: Stefan Agner 

This commit fixes the same typo found in vf610twr DRAM init also for
colibri_vf DRAM init. This typo was introduced in commit 3f353cecc
(vf610: refactor DDRMC code).

Signed-off-by: Stefan Agner 
---
 board/toradex/colibri_vf/colibri_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/toradex/colibri_vf/colibri_vf.c 
b/board/toradex/colibri_vf/colibri_vf.c
index 39bf0ac..a6d1c5b 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -119,7 +119,7 @@ int dram_init(void)
.trcd_int  = 6,
.tras_lockout  = 0,
.tdal  = 12,
-   .bstlen= 0,
+   .bstlen= 3,
.tdll  = 512,
.trp_ab= 6,
.tref  = 3120,
-- 
2.6.1

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


Re: [U-Boot] Command to create a partition table?

2015-10-13 Thread Masahiro Yamada
2015-10-02 15:46 GMT+09:00 Masahiro Yamada :
> Hi guys,
>
>
> I am searching for a command to create
> a partition table (like fdisk command).
>
> I can create a partition table by PC
> for removable devics such as SD card,
> but I want U-boot to do that for on-board devices
> such as eMMC.
>
> Does U-boot have one?
>

"No reply" means "No, U-Boot does not support it", right?



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


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Stefan Agner
Hi Anthony,

Tested on a Tower, works for me.

Can you also fix the Colibri VF board? It seems to suffer the same
issue, introduced by the same commit...

--
Stefan

On 2015-10-09 13:38, Anthony Felice wrote:
> This commit fixes a typo in vf610twr DRAM init that was causing a hang in
> U-Boot for the Vybrid Tower. This typo was introduced in commit 3f353cecc
> (vf610: refactor DDRMC code).
> 
> Signed-off-by: Anthony Felice 
> ---
>  board/freescale/vf610twr/vf610twr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/freescale/vf610twr/vf610twr.c
> b/board/freescale/vf610twr/vf610twr.c
> index a78e9e6..fa0075c 100644
> --- a/board/freescale/vf610twr/vf610twr.c
> +++ b/board/freescale/vf610twr/vf610twr.c
> @@ -108,7 +108,7 @@ int dram_init(void)
>   .trcd_int  = 6,
>   .tras_lockout  = 0,
>   .tdal  = 12,
> - .bstlen= 0,
> + .bstlen= 3,
>   .tdll  = 512,
>   .trp_ab= 6,
>   .tref  = 3120,

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


[U-Boot] [PATCH] mtd: nand: vf610_nfc: resync with upstream Linux version

2015-10-13 Thread Stefan Agner
This resyncs the driver changes with the Linux version of the
driver. The driver received some feedback in the LKML and got
recently acceppted, the latest version can be found here:
https://lkml.org/lkml/2015/9/2/678

Notable changes are:
- On ECC error, reread OOB and count bit flips in OOB too.
  If flipped bits are below threshold, also return an empty
  OOB buffer.
- Return the amount of bit flips in vf610_nfc_read_page.
- Use endianness aware vf610_nfc_read to read ECC status.
- Do not enable IDLE IRQ (since we do not operate with an
  interrupt service routine).
- Use type safe struct for buffer variants (vf610_nfc_alt_buf).
- Renamed variables in struct vf610_nfc (column and page_sz)
  to reflect better what they really representing.

The U-Boot version currently does not support RAW NAND write
when using the HW ECC engine.

Signed-off-by: Bhuvanchandra DV 
Signed-off-by: Stefan Agner 
---
 drivers/mtd/nand/vf610_nfc.c | 247 ---
 1 file changed, 138 insertions(+), 109 deletions(-)

diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
index 5c11ac9..06266f3 100644
--- a/drivers/mtd/nand/vf610_nfc.c
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009-2014 Freescale Semiconductor, Inc. and others
+ * Copyright 2009-2015 Freescale Semiconductor, Inc. and others
  *
  * Description: MPC5125, VF610, MCF54418 and Kinetis K70 Nand driver.
  * Ported to U-Boot by Stefan Agner
@@ -19,9 +19,10 @@
  *
  * Limitations:
  * - Untested on MPC5125 and M54418.
- * - DMA not used.
+ * - DMA and pipelining not used.
  * - 2K pages or less.
- * - Only 2K page w. 64+OOB and hardware ECC.
+ * - HW ECC: Only 2K page with 64+ OOB.
+ * - HW ECC: Only 24 and 32-bit error correction implemented.
  */
 
 #include 
@@ -53,6 +54,7 @@
 
 #define PAGE_2K0x0800
 #define OOB_64 0x0040
+#define OOB_MAX0x0100
 
 /*
  * NFC_CMD2[CODE] values. See section:
@@ -127,32 +129,33 @@
 
 #define NFC_TIMEOUT(1000)
 
-/* ECC status placed at end of buffers. */
-#define ECC_SRAM_ADDR  ((PAGE_2K+256-8) >> 3)
-#define ECC_STATUS_MASK0x80
-#define ECC_ERR_COUNT  0x3F
-
 /*
- * ECC status is stored at NFC_CFG[ECCADD] +4 for little-endian
- * and +7 for big-endian SOC.
+ * ECC status - seems to consume 8 bytes (double word). The documented
+ * status byte is located in the lowest byte of the second word (which is
+ * the 4th or 7th byte depending on endianness).
+ * Calculate an offset to store the ECC status at the end of the buffer.
  */
-#ifdef CONFIG_VF610
-#define ECC_OFFSET 4
-#else
-#define ECC_OFFSET 7
-#endif
+#define ECC_SRAM_ADDR  (PAGE_2K + OOB_MAX - 8)
+
+#define ECC_STATUS 0x4
+#define ECC_STATUS_MASK0x80
+#define ECC_STATUS_ERR_COUNT   0x3F
+
+enum vf610_nfc_alt_buf {
+   ALT_BUF_DATA = 0,
+   ALT_BUF_ID = 1,
+   ALT_BUF_STAT = 2,
+   ALT_BUF_ONFI = 3,
+};
 
 struct vf610_nfc {
-   struct mtd_info   *mtd;
-   struct nand_chip   chip;
-   void __iomem  *regs;
-   uint   column;
+   struct mtd_info *mtd;
+   struct nand_chip chip;
+   void __iomem *regs;
+   uint buf_offset;
+   int write_sz;
/* Status and ID are in alternate locations. */
-   intalt_buf;
-#define ALT_BUF_ID   1
-#define ALT_BUF_STAT 2
-#define ALT_BUF_ONFI 3
-   struct clk*clk;
+   enum vf610_nfc_alt_buf alt_buf;
 };
 
 #define mtd_to_nfc(_mtd) \
@@ -170,8 +173,8 @@ static struct nand_ecclayout vf610_nfc_ecc = {
   48, 49, 50, 51, 52, 53, 54, 55,
   56, 57, 58, 59, 60, 61, 62, 63},
.oobfree = {
-   {.offset = 8,
-.length = 11} }
+   {.offset = 2,
+.length = 17} }
 };
 #elif defined(CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES)
 #define ECC_HW_MODE ECC_60_BYTE
@@ -226,8 +229,12 @@ static inline void vf610_nfc_set_field(struct mtd_info 
*mtd, u32 reg,
 static inline void vf610_nfc_memcpy(void *dst, const void *src, size_t n)
 {
/*
-* Use this accessor for the interal SRAM buffers. On ARM we can
-* treat the SRAM buffer as if its memory, hence use memcpy
+* Use this accessor for the internal SRAM buffers. On the ARM
+* Freescale Vybrid SoC it's known that the driver can treat
+* the SRAM buffer as if it's memory. Other platform might need
+* to treat the buffers differently.
+*
+* For the time being, use memcpy
 */
memcpy(dst, src, n);
 }
@@ -242,7 +249,7 @@ static inline void vf610_nfc_clear_status(void __iomem 
*regbase)
 }
 
 /* Wait for complete operation */
-static inline void vf610_nfc_done(struct mtd_info *mtd)
+static void vf610_nfc_done(struct mtd_info *mtd)
 {
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
   

[U-Boot] [PULL] Please pull u-boot-imx

2015-10-13 Thread Stefano Babic
Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit 7daaac5281db0788cde895a0add38ad5195b5be1:

  mx6sabre_common: Add DFU support (2015-10-02 10:51:20 +0200)

are available in the git repository at:

  git://www.denx.de/git/u-boot-imx.git master

for you to fetch changes up to 61903b759aa336d798da49d884467219796817ff:

  imximage: fix commands other than write_data (2015-10-07 13:43:15 +0200)


Troy Kisky (2):
  imximage: header.length of 4 is valid
  imximage: fix commands other than write_data

 tools/imximage.c | 81
++---
 tools/imximage.h |  8 ++--
 2 files changed, 64 insertions(+), 25 deletions(-)

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


Re: [U-Boot] [RFC] odroid DTB support

2015-10-13 Thread Guillaume Gardet



Le 12/10/2015 16:24, Tom Rini a écrit :

On Mon, Oct 12, 2015 at 10:54:04AM +0200, Guillaume Gardet wrote:

Hi,


Le 12/10/2015 01:45, Tom Rini a écrit :

On Fri, Oct 09, 2015 at 02:35:24PM +0200, Guillaume Gardet wrote:

Le 09/10/2015 14:23, Przemyslaw Marczak a écrit :

Hello Guillaume,

On 10/09/2015 02:11 PM, Guillaume Gardet wrote:

Hi Przemyslaw,

I would like to add DTB support for odroid board to be able to boot
upstream kernel easily.

I see 2 ways to do it:
* Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support to set 'board_rev'
and 'board_name' env vars. Then, you need a 'findfdt' script to check
'board_rev' and set fdtfile accordingly (as done for OMAP4 panda board)
* Set fdtfile name directly (as done for rpi or igep00x0).

What would you prefer?


Guillaume



Is, that the reason of adding the boot script by your last patches?

No, we need a boot script, because this is the way we boot our
openSUSE images (we boot with an initrd and some special bootargs).

Hang on, exynos stuff uses the generic distro hooks.  Can you take a
look at doc/README.distro and see what openSUSE can hook into / provide
some feedback on what needs doing?  Thanks!

This is true for odroid XU3 (Exynos5 based) but Odroid U3/X2 (Exynos4
based) has no generic distro hooks at the moment.

No, exynos-common pulls in generic distro.  And in the event of boards
that do not the answer is to pull in the generic distro framework.


It seems that exynos-common includes only "config_distro_defaults.h", not 
"config_distro_bootcmd.h".
And "config_distro_bootcmd.h" is needed for generic distro boot flow. Am I 
missing something?

Guillaume

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


[U-Boot] [PATCH] ARM: AM335x: mux: change mmc0 cd pinmux from mmc0_sdcd to gpio

2015-10-13 Thread Mugunthan V N
Currently omap_hsmmc driver doesn't use sdcd pin to detect
whether the card is present or not. Instead the same pin is used
as GPIO to detect card presence. So change the pin mux mode from
mmc0_sdcd to gpio0_6.

Signed-off-by: Mugunthan V N 
---
 board/ti/am335x/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index 680f656..e49fa0c 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -65,7 +65,7 @@ static struct module_pin_mux mmc0_pin_mux[] = {
{OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CLK */
{OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CMD */
{OFFSET(mcasp0_aclkr), (MODE(4) | RXACTIVE)},   /* MMC0_WP */
-   {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)},   /* MMC0_CD */
+   {OFFSET(spi0_cs1), (MODE(7) | RXACTIVE | PULLUP_EN)},   /* GPIO0_6 */
{-1},
 };
 
-- 
2.6.1.133.gf5b6079

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


[U-Boot] [PATCH] drivers: gpio: omap: add support for parsing additional gpio parameters

2015-10-13 Thread Mugunthan V N
With DM_GPIO, gpio parameters like ACTIVE_(LOW/HIGH) are to be
parsed in xlate gpio drivers-ops. Since xlate is not implemented
in omap_gpio driver, the driver considers all gpio to be
ACTIVE_HIGH which is the default case and fails to return actual
gpio status for ACTIVE_LOW gpios. So adding .xlate ops to
omap_gpio.

Signed-off-by: Mugunthan V N 
---
 drivers/gpio/omap_gpio.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index cd960dc..93d18e4 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -276,12 +277,22 @@ static int omap_gpio_get_function(struct udevice *dev, 
unsigned offset)
return GPIOF_INPUT;
 }
 
+static int omap_gpio_xlate(struct udevice *dev, struct gpio_desc *desc,
+  struct fdtdec_phandle_args *args)
+{
+   desc->offset = args->args[0];
+   desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0;
+
+   return 0;
+}
+
 static const struct dm_gpio_ops gpio_omap_ops = {
.direction_input= omap_gpio_direction_input,
.direction_output   = omap_gpio_direction_output,
.get_value  = omap_gpio_get_value,
.set_value  = omap_gpio_set_value,
.get_function   = omap_gpio_get_function,
+   .xlate  = omap_gpio_xlate,
 };
 
 static int omap_gpio_probe(struct udevice *dev)
-- 
2.6.1.133.gf5b6079

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


Re: [U-Boot] [RFC] odroid DTB support

2015-10-13 Thread Przemyslaw Marczak

Hi Tom, Guillaume,

On 10/13/2015 09:37 AM, Guillaume Gardet wrote:



Le 12/10/2015 16:24, Tom Rini a écrit :

On Mon, Oct 12, 2015 at 10:54:04AM +0200, Guillaume Gardet wrote:

Hi,


Le 12/10/2015 01:45, Tom Rini a écrit :

On Fri, Oct 09, 2015 at 02:35:24PM +0200, Guillaume Gardet wrote:

Le 09/10/2015 14:23, Przemyslaw Marczak a écrit :

Hello Guillaume,

On 10/09/2015 02:11 PM, Guillaume Gardet wrote:

Hi Przemyslaw,

I would like to add DTB support for odroid board to be able to boot
upstream kernel easily.

I see 2 ways to do it:
* Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support to set
'board_rev'
and 'board_name' env vars. Then, you need a 'findfdt' script to
check
'board_rev' and set fdtfile accordingly (as done for OMAP4 panda
board)
* Set fdtfile name directly (as done for rpi or igep00x0).

What would you prefer?


Guillaume



Is, that the reason of adding the boot script by your last patches?

No, we need a boot script, because this is the way we boot our
openSUSE images (we boot with an initrd and some special bootargs).

Hang on, exynos stuff uses the generic distro hooks.  Can you take a
look at doc/README.distro and see what openSUSE can hook into / provide
some feedback on what needs doing?  Thanks!

This is true for odroid XU3 (Exynos5 based) but Odroid U3/X2 (Exynos4
based) has no generic distro hooks at the moment.

No, exynos-common pulls in generic distro.  And in the event of boards
that do not the answer is to pull in the generic distro framework.


It seems that exynos-common includes only "config_distro_defaults.h",
not "config_distro_bootcmd.h".
And "config_distro_bootcmd.h" is needed for generic distro boot flow. Am
I missing something?

Guillaume




Tom,
it's true that, exynos5-common.h defines the CONFIG_EXTRA_ENV_SETTINGS, 
which provides "BOOTENV".
Odroid XU3 redefines CONFIG_EXTRA_ENV_SETTINGS, but in the fact it uses 
the same settings, appended by some private env variables.


Guillaume,
You're right, Exynos4 boards doesn't use the generic distro boot 
commands. And each board defines CONFIG_EXTRA_ENV_SETTINGS.


All boards works with the mainline kernel by default, so it's not a high 
priority for us to switch it to common env, but will do this soon.


You can check the bootscript example in the directory:
 board/samsung/common/bootscripts/

As temporary, your patch for Odroid can be applied to support the 
boot.scr, but anyway it support mainline kernel and probably can boot 
Ubuntu images.


Some mainline release of U-Boot is used for Arch Linux images for Odroid 
U3, you can check the changes for ARCH here:


https://github.com/archlinuxarm/PKGBUILDs/blob/master/alarm/uboot-odroid/0001-arch-linux-arm-modifications.patch

So if you need write custom boot.scr, maybe this will help you.

One more thing, if you need append the bootargs for your kernel, then 
you can set the $opts variable which is always appended to bootargs.


Best regards,
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] odroid DTB support

2015-10-13 Thread Guillaume Gardet

Hi Przemyslaw, Tom,


Le 13/10/2015 11:11, Przemyslaw Marczak a écrit :

Hi Tom, Guillaume,

On 10/13/2015 09:37 AM, Guillaume Gardet wrote:



Le 12/10/2015 16:24, Tom Rini a écrit :

On Mon, Oct 12, 2015 at 10:54:04AM +0200, Guillaume Gardet wrote:

Hi,


Le 12/10/2015 01:45, Tom Rini a écrit :

On Fri, Oct 09, 2015 at 02:35:24PM +0200, Guillaume Gardet wrote:

Le 09/10/2015 14:23, Przemyslaw Marczak a écrit :

Hello Guillaume,

On 10/09/2015 02:11 PM, Guillaume Gardet wrote:

Hi Przemyslaw,

I would like to add DTB support for odroid board to be able to boot
upstream kernel easily.

I see 2 ways to do it:
* Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support to set
'board_rev'
and 'board_name' env vars. Then, you need a 'findfdt' script to
check
'board_rev' and set fdtfile accordingly (as done for OMAP4 panda
board)
* Set fdtfile name directly (as done for rpi or igep00x0).

What would you prefer?


Guillaume



Is, that the reason of adding the boot script by your last patches?

No, we need a boot script, because this is the way we boot our
openSUSE images (we boot with an initrd and some special bootargs).

Hang on, exynos stuff uses the generic distro hooks.  Can you take a
look at doc/README.distro and see what openSUSE can hook into / provide
some feedback on what needs doing?  Thanks!

This is true for odroid XU3 (Exynos5 based) but Odroid U3/X2 (Exynos4
based) has no generic distro hooks at the moment.

No, exynos-common pulls in generic distro.  And in the event of boards
that do not the answer is to pull in the generic distro framework.


It seems that exynos-common includes only "config_distro_defaults.h",
not "config_distro_bootcmd.h".
And "config_distro_bootcmd.h" is needed for generic distro boot flow. Am
I missing something?

Guillaume




Tom,
it's true that, exynos5-common.h defines the CONFIG_EXTRA_ENV_SETTINGS, which provides 
"BOOTENV".
Odroid XU3 redefines CONFIG_EXTRA_ENV_SETTINGS, but in the fact it uses the 
same settings, appended by some private env variables.

Guillaume,
You're right, Exynos4 boards doesn't use the generic distro boot commands. And 
each board defines CONFIG_EXTRA_ENV_SETTINGS.


Thanks for clarification.



All boards works with the mainline kernel by default, so it's not a high 
priority for us to switch it to common env, but will do this soon.


ok.



You can check the bootscript example in the directory:
 board/samsung/common/bootscripts/


Here, if $fdtfile is not defined, then it boots without it. This won't work for 
us, since we need DTB (kernel multiplatform enabled).



As temporary, your patch for Odroid can be applied to support the boot.scr, but 
anyway it support mainline kernel and probably can boot Ubuntu images.


Yes, please apply it to get boot.scr support until odroid switch to generic 
boot system.



Some mainline release of U-Boot is used for Arch Linux images for Odroid U3, 
you can check the changes for ARCH here:

https://github.com/archlinuxarm/PKGBUILDs/blob/master/alarm/uboot-odroid/0001-arch-linux-arm-modifications.patch

So if you need write custom boot.scr, maybe this will help you.

Big patches! ^^ openSUSE workflow is different. We try to minimize source 
patches, upstream our patches and do our custom things in boot scripts which is 
much more flexible.
Our boot.scr is (nearly) ready. The only thing missing is the fdtfile 
definition (which is board dependent). We hardcoded it to U3 version for now to 
make tests but this should be fixed.


Guillaume




One more thing, if you need append the bootargs for your kernel, then you can 
set the $opts variable which is always appended to bootargs.

Best regards,


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


Re: [U-Boot] [PATCH V3 0/2] *Enhance Odroid board

2015-10-13 Thread Przemyslaw Marczak

Hello,

On 10/09/2015 02:26 PM, Guillaume GARDET wrote:

Those 2 patches enhances Odroid board support.
* First patch replace 'fatload' command by 'load', to be able to use EXT*
partitions while keeping FAT partition compatibility.
* Second patch adds boot script (boot.scr) support. If no boot script are
found, it boots as usual.

Changes in V3:
* Uses 'elif' version as requested by Przemyslaw Marczak

Changes in V2:
* Expand commit messages
* Better code consistency

Signed-off-by: Guillaume GARDET 
Cc: Przemyslaw Marczak 
Cc: Minkyu Kang 

---

Guillaume GARDET (2):
   odroid: replace 'fatload' with 'load' to be able to use EXT*
 partitions
   odroid: Add boot script (boot.scr) support

  include/configs/odroid.h | 16 
  1 file changed, 12 insertions(+), 4 deletions(-)



For the series:

Tested-by: Przemyslaw Marczak 
Acked-by: Przemyslaw Marczak 

Thanks!
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/8] ARM: hikey: Update README with various corrections

2015-10-13 Thread Peter Griffin
Hi Simon,


> On 17 September 2015 at 21:54, Simon Glass  wrote:
> >
> > Hi Peter,
> >
> > On 9 September 2015 at 15:13, Peter Griffin 
> wrote:
> > > The README had a few mistakes, and one of the URL's
> > > had changed. Also update the boot log with the latest
> > > boot trace from ATF, which now includes the mcuimage.bin.
> > >
> > > Signed-off-by: Peter Griffin 
> > > ---
> > >  board/hisilicon/hikey/README | 197
> ---
> > >  1 file changed, 147 insertions(+), 50 deletions(-)
> > >
> > > diff --git a/board/hisilicon/hikey/README
> b/board/hisilicon/hikey/README
> > > index 25c8143..36adbdb 100644
> > > --- a/board/hisilicon/hikey/README
> > > +++ b/board/hisilicon/hikey/README
> > > @@ -25,8 +25,12 @@ Currently the u-boot port supports: -
> > >  Compile u-boot
> > >  ==
> > >
> > > -make CROSS_COMPILE=aarch64-linux-gnu- hikey_config
> > > -make CROSS_COMPILE=aarch64-linux-gnu-
> > > +  > mkdir -p ./aarch64/bin
> > > +  > cd ./aarch64
> >
> > Do you really want the above? It seems odd that the 'cp' below expects
> > another level of subdir.
> >
> > > +  > git clone http://git.denx.de/u-boot.git
> > > +  > make CROSS_COMPILE=aarch64-linux-gnu- hikey_config
> > > +  > make CROSS_COMPILE=aarch64-linux-gnu-
> > > +  > cp u-boot.bin ./aarch64/bin/u-boot-hikey.bin
> > >
> > >  ARM Trusted Firmware (ATF) & l-loader
> > >  =
> > > @@ -34,27 +38,34 @@ ARM Trusted Firmware (ATF) & l-loader
> > >  This u-boot port has been tested with l-loader, booting ATF, which
> then boots
> > >  u-boot as the bl33.bin executable.
> > >
> > > +Get the BL30 mcu binary.
> > > +  > wget -P aarch64/bin
> https://builds.96boards.org/releases/hikey/linaro/binaries/15.05/mcuimage.bin
> > > +
> > >  1. Get ATF source code
> > > -git clone https://github.com/96boards/arm-trusted-firmware.git
> > > +  > cd ./aarch64
> > > +  > git clone https://github.com/96boards/arm-trusted-firmware.git
> > > +  > cd ./arm-trusted-firmware
> > >
> > > -2. Compile ATF I use the makefile here
> > > -
> http://people.linaro.org/~peter.griffin/hikey/hikey-u-boot-release_r1/build-tf.mak
> > > +2. Compile ATF, I use the build-tf.mak in the directory with this
> README, and copy it to ATF directory
> > > +  > cp ../u-boot/board/hisilicon/hikey/build-tf.mak .
> > > +  > make -f  build-tf.mak build
> > >
> > >  3. Get l-loader
> > > -git clone https://github.com/96boards/l-loader.git
> > > -
> > > -4. Make sym links to ATF bip / fip binaries
> > > -ln -s /home/griffinp/aarch64/bl1-hikey.bin bl1.bin
> > > -ln -s /home/griffinp/aarch64/fip-hikey.bin fip.bin
> > > +  > cd ../
> > > +  > git clone https://github.com/96boards/l-loader.git
> > > +  > cd ./l-loader
> > >
> > > -arm-linux-gnueabihf-gcc -c -o start.o start.S
> > > -arm-linux-gnueabihf-gcc -c -o debug.o debug.S
> > > -arm-linux-gnueabihf-ld -Bstatic -Tl-loader.lds -Ttext 0xf9800800
> start.o debug.o -o loader
> > > -arm-linux-gnueabihf-objcopy -O binary loader temp
> > > +4. Make sym links to ATF bl1 / fip binaries
> > > +  > ln -s ../bin/bl1-hikey.bin bl1.bin
> > > +  > ln -s ../bin/fip-hikey.bin fip.bin
> > >
> > > -python gen_loader.py -o l-loader.bin --img_loader=temp
> --img_bl1=bl1.bin
> > > -sudo bash -x generate_ptable.sh
> > > -python gen_loader.py -o ptable.img --img_prm_ptable=prm_ptable.img
> --img_sec_ptable=sec_ptable.img
> > > +  > arm-linux-gnueabihf-gcc -c -o start.o start.S
> > > +  > arm-linux-gnueabihf-gcc -c -o debug.o debug.S
> > > +  > arm-linux-gnueabihf-ld -Bstatic -Tl-loader.lds -Ttext 0xf9800800
> start.o debug.o -o loader
> > > +  > arm-linux-gnueabihf-objcopy -O binary loader temp
> > > +  > python gen_loader.py -o ../bin/l-loader.bin --img_loader=temp
> --img_bl1=bl1.bin
> > > +  > sudo bash -x generate_ptable.sh
> > > +  > python gen_loader.py -o ../bin/ptable.img
> --img_prm_ptable=./prm_ptable.img --img_sec_ptable=./sec_ptable.img
> > >
> > >  These instructions are adapted from
> > >  https://github.com/96boards/documentation/wiki/HiKeyUEFI
> > > @@ -62,37 +73,49 @@
> https://github.com/96boards/documentation/wiki/HiKeyUEFI
> > >  FLASHING
> > >  
> > >
> > > -1. Connect jumper J2 to go into recovery mode and flash l-loader.bin
> with
> > > -   fastboot using the hisi-idt.py utility
> > > +1. Connect the second jumper on J15 BOOT SEL, to go into recovery
> mode and flash l-loader.bin with
> > > +fastboot using the hisi-idt.py utility.
> > > +
> > > +  > cd ../
> > > +  > git clone https://github.com/96boards/burn-boot.git
> > >
> > > -> git clone https://github.com/96boards/burn-boot.git
> > > -> sudo python /home/griffinp/Software/hikey/burn-boot/hisi-idt.py -d
> /dev/ttyUSB0 --img1=/tmp/l-loader.bin
> > > +The command below assumes HiKey enumerated as the first USB serial
> port
> > > +  > sudo ./burn-boot/hisi-idt.py -d /dev/ttyUSB0
> --img1=./bin/l-loader.bin
> > >
> > > -2. Once LED 0 comes on solid, 

Re: [U-Boot] [RFC] odroid DTB support

2015-10-13 Thread Przemyslaw Marczak

Hello,

On 10/13/2015 11:33 AM, Guillaume Gardet wrote:

Hi Przemyslaw, Tom,


Le 13/10/2015 11:11, Przemyslaw Marczak a écrit :

Hi Tom, Guillaume,

On 10/13/2015 09:37 AM, Guillaume Gardet wrote:



Le 12/10/2015 16:24, Tom Rini a écrit :

On Mon, Oct 12, 2015 at 10:54:04AM +0200, Guillaume Gardet wrote:

Hi,


Le 12/10/2015 01:45, Tom Rini a écrit :

On Fri, Oct 09, 2015 at 02:35:24PM +0200, Guillaume Gardet wrote:

Le 09/10/2015 14:23, Przemyslaw Marczak a écrit :

Hello Guillaume,

On 10/09/2015 02:11 PM, Guillaume Gardet wrote:

Hi Przemyslaw,

I would like to add DTB support for odroid board to be able to
boot
upstream kernel easily.

I see 2 ways to do it:
* Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support to set
'board_rev'
and 'board_name' env vars. Then, you need a 'findfdt' script to
check
'board_rev' and set fdtfile accordingly (as done for OMAP4 panda
board)
* Set fdtfile name directly (as done for rpi or igep00x0).

What would you prefer?


Guillaume



Is, that the reason of adding the boot script by your last patches?

No, we need a boot script, because this is the way we boot our
openSUSE images (we boot with an initrd and some special bootargs).

Hang on, exynos stuff uses the generic distro hooks.  Can you take a
look at doc/README.distro and see what openSUSE can hook into /
provide
some feedback on what needs doing?  Thanks!

This is true for odroid XU3 (Exynos5 based) but Odroid U3/X2 (Exynos4
based) has no generic distro hooks at the moment.

No, exynos-common pulls in generic distro.  And in the event of boards
that do not the answer is to pull in the generic distro framework.


It seems that exynos-common includes only "config_distro_defaults.h",
not "config_distro_bootcmd.h".
And "config_distro_bootcmd.h" is needed for generic distro boot flow. Am
I missing something?

Guillaume




Tom,
it's true that, exynos5-common.h defines the
CONFIG_EXTRA_ENV_SETTINGS, which provides "BOOTENV".
Odroid XU3 redefines CONFIG_EXTRA_ENV_SETTINGS, but in the fact it
uses the same settings, appended by some private env variables.

Guillaume,
You're right, Exynos4 boards doesn't use the generic distro boot
commands. And each board defines CONFIG_EXTRA_ENV_SETTINGS.


Thanks for clarification.



All boards works with the mainline kernel by default, so it's not a
high priority for us to switch it to common env, but will do this soon.


ok.



You can check the bootscript example in the directory:
 board/samsung/common/bootscripts/


Here, if $fdtfile is not defined, then it boots without it. This won't
work for us, since we need DTB (kernel multiplatform enabled).



Right, because it supports both fdt and non-fdt kernel images, the 
second one is to support old Hardkernel zImages.


Odroid XU3 defines fdtfile in board config extra envs, but the U3 sets 
it automatically on boot, since it supports both X2 and U3, the name 
depends on the board detection. This part of code is in set_board_info() 
in board/samsung/common/misc.c.


This is working well, if you have a minimum files on the boot partition 
(mmc 0:1):

- zImage
- exynos4412-odroidu3.dtb

then you will see:
---

Hit any key to stop autoboot: 0
reading exynos4412-odroidu3.dtb
46356 bytes read in 415 ms (108.4KiB/s)
reading uInitrd
** Unable to read file uInitrd **
reading zImage
5161952 bytes read in 685 ms (7.2 MiB/s)
Kernel image @ 0x40007fc0 [ 0x00 - 0x4ec3e0]
## Flattened Device Tree blob at 4080
Booting using the fdt blob at 0x4080
Loading Device Tree to 4fff1000, end 4513 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

---

After apply your patches and put the menioned boot.scr I can see this:

---
Hit any key to stop autoboot:0
reading boot.scr
3034 bytes read in 312 ms (8.8 KiB/s)
## Executing script at 4200
Found kernel image: zImage
reading exynos4412-odroidu3.dtb
46356 bytes read in 415 ms (108.4 KiB/s)
Warning! Booting without RAMDISK: uInitrd!
reading zImage
5161952 bytes read in 686 ms (7.2 MiB/s)
Kernel image @ 0x40007fc0 [ 0x00 - 0x4ec3e0 ]
## Flattened Device Tree blob at 4080
 Booting using the fdt blob at 0x4080
 Loading Device Tree to 4fff1000, end 4513 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
---

So this works for my setup. Maybe you have a problem with the filesystem?

Please check it manual if you can load dtb file, if not, maybe you 
should do mkfs.ext4/vfat on your boot partition to clean in, and then 
check again.




As temporary, your patch for Odroid can be applied to support the
boot.scr, but anyway it support mainline kernel and probably can boot
Ubuntu images.


Yes, please apply it to get boot.scr support until odroid switch to
generic boot system.



Yes, I will ack 

Re: [U-Boot] [ELCE2015] Question about schedule

2015-10-13 Thread Bin Meng
Hi,

On Fri, Oct 2, 2015 at 6:34 AM, Tom Rini  wrote:
> On Thu, Oct 01, 2015 at 10:38:50AM +0200, Lukasz Majewski wrote:
>
>> Hi Tom,
>>
>> Is there any schedule for our ELCE2015 u-boot mini summit [1]?
>> To be more precise
>> - are know times when we will deliver our presentations?
>>
>>
>>
>> [1] - http://www.denx.de/wiki/U-Boot/SummitELCE2015
>
> So no, we don't have a formal schedule at this time.  My kind of plan at
> this point is to start off with the formal talks.  Then move into a
> "5 minute" status from the custodians present on where they're at in
> their area.  After that, sort out some priorities on Kconfig/DT.
>
> Oh, and I plan to try and have a Google Hangout up so that people that
> can't make it can at least watch and maybe chime in.
>
> --

Are there any slides presented in the summit available somewhere? Or
any video clips?

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


Re: [U-Boot] [PATCH v2] nios2: convert copy_exception_trampoline to use dm cpu data

2015-10-13 Thread Thomas Chou



On 10/06/2015 02:55 PM, Thomas Chou wrote:

Convert copy_exception_trampoline() to use dm cpu data.

Signed-off-by: Thomas Chou 
---
v2
   fix exception address references.

  arch/nios2/cpu/cpu.c   | 24 
  arch/nios2/cpu/start.S | 24 +---
  2 files changed, 25 insertions(+), 23 deletions(-)



Applied to u-boot-nios.


diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 229a07b..5403c0d 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -44,6 +44,27 @@ void dcache_disable(void)
flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
  }

+/*
+ * COPY EXCEPTION TRAMPOLINE -- copy the tramp to the
+ * exception address. Define CONFIG_ROM_STUBS to prevent
+ * the copy (e.g. exception in flash or in other
+ * softare/firmware component).
+ */
+#ifndef CONFIG_ROM_STUBS
+static void copy_exception_trampoline(void)
+{
+   extern int _except_start, _except_end;
+   void *except_target = (void *)gd->arch.exception_addr;
+
+   if (&_except_start != except_target) {
+   memcpy(except_target, &_except_start,
+  &_except_end - &_except_start);
+   flush_cache(gd->arch.exception_addr,
+   &_except_end - &_except_start);
+   }
+}
+#endif
+
  int arch_cpu_init_dm(void)
  {
struct udevice *dev;
@@ -56,6 +77,9 @@ int arch_cpu_init_dm(void)
return -ENODEV;

gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+#ifndef CONFIG_ROM_STUBS
+   copy_exception_trampoline();
+#endif

return 0;
  }
diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 6c7c777..90e0310 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -14,7 +14,7 @@
   /

.text
-   .global _start
+   .global _start, _except_start, _except_end

  _start:
wrctl   status, r0  /* Disable interrupts */
@@ -89,28 +89,6 @@ _cur:movhi   r5, %hi(_cur - _start)
jmp r4
  _reloc:

-   /* COPY EXCEPTION TRAMPOLINE -- copy the tramp to the
-* exception address. Define CONFIG_ROM_STUBS to prevent
-* the copy (e.g. exception in flash or in other
-* softare/firmware component).
-*/
-#if !defined(CONFIG_ROM_STUBS)
-   movhi   r4, %hi(_except_start)
-   ori r4, r4, %lo(_except_start)
-   movhi   r5, %hi(_except_end)
-   ori r5, r5, %lo(_except_end)
-   movhi   r6, %hi(CONFIG_SYS_EXCEPTION_ADDR)
-   ori r6, r6, %lo(CONFIG_SYS_EXCEPTION_ADDR)
-   beq r4, r6, 7f  /* Skip if at proper addr */
-
-6: ldwio   r7, 0(r4)
-   stwio   r7, 0(r6)
-   addir4, r4, 4
-   addir6, r6, 4
-   bne r4, r5, 6b
-7:
-#endif
-
/* STACK INIT -- zero top two words for call back chain.
 */
movhi   sp, %hi(CONFIG_SYS_INIT_SP)


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


Re: [U-Boot] [PATCH] mmc: omap_hsmmc: fix initialization order of mmc block devices

2015-10-13 Thread Tom Rini
On Tue, Oct 13, 2015 at 08:24:08AM -0500, Nishanth Menon wrote:
> On Tue, Oct 13, 2015 at 3:03 AM, Lokesh Vutla  wrote:
> >
> >
> > On Tuesday 13 October 2015 01:14 PM, Heiko Schocher wrote:
> >> Hello Lokesh,
> >>
> >> Am 13.10.2015 um 08:46 schrieb Lokesh Vutla:
> >>> +Nishanth,
> >>>
> >>> On Tuesday 13 October 2015 10:59 AM, Heiko Schocher wrote:
>  On embedded devices, often there is a combination of
>  removable mmc devices (e.g. MMC/SD cards) and hard
>  wired ones (e.g. eMMC). Depending on the hardware
>  configuration, the 'mmcblkN' node might change if
>  the removable device is available or not at boot time.
> 
>  E.g. if the removable device is attached at boot time,
>  it might become mmxblk0. And the hard wired one mmcblk1.
>  But if the removable device isn't there at boot time,
>  the hard wired one will become mmcblk0. This makes it
>  somehow difficult to hard code the root device to the
>  non-removable device and boot fast.
> >>>
> >>> Why not use "root=PARTUUID=${uuid}" option instead of relying on
> >>> mmcblk no?
> >>> U-Boot can easily detect your partuuid. Refer to [1] on how TI platforms
> >>> does this in u-boot.
> >>
> >> Good tip ... I do not know, if it is possible to update U-Boot
> >> on this boards...
> >>
> >> Current U-Boot says:
> >> U-Boot 2013.01.01_heads/master-gc7900a0 (2015-05-06 - 20:37:15)
> >>
> >> I2C:   ready
> >> DRAM:  512 MiB
> >> [...]
> >> U-Boot# mmc rescan
> >> U-Boot# mmc part
> >>
> >> Partition Map for MMC device 0  --   Partition Type: DOS
> >>
> >> PartStart SectorNum Sectors UUIDType
> >>   1 63  144522  000ce343-01 0e Boot
> >>   2 144585  659861  000ce343-02 83
> >> U-Boot# part uuid mmc 0:2 uuid
> >> Unknown command 'part' - try 'help'
> >> U-Boot#
> >>
> >> So, if this patch has no chance for mainline, please let me
> >> know it, thanks!
> >>
> >
> > IIRC, Nishanth had posted a patch something similar but got rejected for
> > some reason. Probably Nishanth can comment more here.
> >
> 
> overall the feedback I received was for block devices, there is
> already an unique method(PARTUUID/uuid) of referencing required device
> and mmcxblky aliasing was not really needed - hence dropped my patch
> and switched over to partuuid.

Not telling the kernel what to do here but root=PARTUUID=$x is the long
standing portable multi-architecture (and storage medium) way to have a
stable name for your root device.  The automatic way of digging this
information out in U-Boot is dates back to Sept 2012 in mainline.

-- 
Tom


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


Re: [U-Boot] [PATCH] nios2: clean up comments style in start.S

2015-10-13 Thread Thomas Chou



On 10/06/2015 03:30 PM, Thomas Chou wrote:

Clean up comments style in start.S.

Signed-off-by: Thomas Chou 
---
  arch/nios2/cpu/start.S | 21 +
  1 file changed, 13 insertions(+), 8 deletions(-)



Applied to u-boot-nios.


diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 90e0310..00cec40 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -18,7 +18,8 @@

  _start:
wrctl   status, r0  /* Disable interrupts */
-   /* ICACHE INIT -- only the icache line at the reset address
+   /*
+* ICACHE INIT -- only the icache line at the reset address
 * is invalidated at reset. So the init must stay within
 * the cache line size (8 words). If GERMS is used, we'll
 * just be invalidating the cache a second time. If cache
@@ -32,7 +33,8 @@ _start:
bgt r5, r0, 0b
br  _except_end /* Skip the tramp */

-   /* EXCEPTION TRAMPOLINE -- the following gets copied
+   /*
+* EXCEPTION TRAMPOLINE -- the following gets copied
 * to the exception address (below), but is otherwise at the
 * default exception vector offset (0x0020).
 */
@@ -42,12 +44,14 @@ _except_start:
jmp et
  _except_end:

-   /* INTERRUPTS -- for now, all interrupts masked and globally
+   /*
+* INTERRUPTS -- for now, all interrupts masked and globally
 * disabled.
 */
wrctl   ienable, r0 /* All disabled */

-   /* DCACHE INIT -- if dcache not implemented, initd behaves as
+   /*
+* DCACHE INIT -- if dcache not implemented, initd behaves as
 * nop.
 */
movhi   r4, %hi(CONFIG_SYS_DCACHELINE_SIZE)
@@ -59,7 +63,8 @@ _except_end:
add r6, r6, r4
bltur6, r5, 1b

-   /* RELOCATE CODE, DATA & COMMAND TABLE -- the following code
+   /*
+* RELOCATE CODE, DATA & COMMAND TABLE -- the following code
 * assumes code, data and the command table are all
 * contiguous. This lets us relocate everything as a single
 * block. Make sure the linker script matches this ;-)
@@ -89,8 +94,7 @@ _cur: movhi   r5, %hi(_cur - _start)
jmp r4
  _reloc:

-   /* STACK INIT -- zero top two words for call back chain.
-*/
+   /* STACK INIT -- zero top two words for call back chain. */
movhi   sp, %hi(CONFIG_SYS_INIT_SP)
ori sp, sp, %lo(CONFIG_SYS_INIT_SP)
addisp, sp, -8
@@ -116,7 +120,8 @@ _reloc:
ori r2, r2, %lo(board_init_f@h)
callr   r2

-   /* NEVER RETURNS -- but branch to the _start just
+   /*
+* NEVER RETURNS -- but branch to the _start just
 * in case ;-)
 */
br  _start


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


Re: [U-Boot] [PATCH] nios2: zap initdram

2015-10-13 Thread Thomas Chou



On 10/09/2015 03:10 PM, Thomas Chou wrote:

Zap initdram(), as it is not used.

Signed-off-by: Thomas Chou 
---
  board/altera/nios2-generic/nios2-generic.c | 5 -
  1 file changed, 5 deletions(-)



Applied to u-boot-nios.



diff --git a/board/altera/nios2-generic/nios2-generic.c 
b/board/altera/nios2-generic/nios2-generic.c
index 1f10821..e7fecd2 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -44,11 +44,6 @@ int checkboard(void)
return 0;
  }

-phys_size_t initdram(int board_type)
-{
-   return 0;
-}
-
  #ifdef CONFIG_CMD_NET
  int board_eth_init(bd_t *bis)
  {


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


Re: [U-Boot] [PATCH] serial: remove altera serial initializations

2015-10-13 Thread Thomas Chou



On 10/05/2015 08:51 AM, Thomas Chou wrote:

Both altera_jtag_serial_initialize() and
altera_serial_initialize() are no longer used after
they are converted to driver model.

Signed-off-by: Thomas Chou 
---
  drivers/serial/serial.c | 4 
  include/serial.h| 2 --
  2 files changed, 6 deletions(-)



Applied to u-boot-nios.


diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 699c410..422d3ae 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -109,8 +109,6 @@ U_BOOT_ENV_CALLBACK(baudrate, on_baudrate);
void name(void) \
__attribute__((weak, alias("serial_null")));

-serial_initfunc(altera_jtag_serial_initialize);
-serial_initfunc(altera_serial_initialize);
  serial_initfunc(amirix_serial_initialize);
  serial_initfunc(arc_serial_initialize);
  serial_initfunc(arm_dcc_initialize);
@@ -202,8 +200,6 @@ void serial_register(struct serial_device *dev)
   */
  void serial_initialize(void)
  {
-   altera_jtag_serial_initialize();
-   altera_serial_initialize();
amirix_serial_initialize();
arc_serial_initialize();
arm_dcc_initialize();
diff --git a/include/serial.h b/include/serial.h
index de40e94..e490f9a 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -164,8 +164,6 @@ struct serial_dev_priv {
  /* Access the serial operations for a device */
  #define serial_get_ops(dev)   ((struct dm_serial_ops *)(dev)->driver->ops)

-void altera_jtag_serial_initialize(void);
-void altera_serial_initialize(void);
  void amirix_serial_initialize(void);
  void arc_serial_initialize(void);
  void arm_dcc_initialize(void);


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


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

2015-10-13 Thread Thomas Chou



On 10/10/2015 05:07 PM, Thomas Chou wrote:

Implement a Miscellaneous uclass with generic read or
write operations. This class is used only for those
do not fit other more general classes.

Signed-off-by: Thomas Chou 
Acked-by: Simon Glass 
---
v2
   add missing misc.h.
v3
   no change.
v4
   add ioctl and comments as Simon suggested.
v5
   no change.
v6
   replace DM_MISC to MISC.

  drivers/misc/Kconfig   |  9 ++
  drivers/misc/Makefile  |  1 +
  drivers/misc/misc-uclass.c | 51 ++
  include/dm/uclass-id.h |  1 +
  include/misc.h | 79 ++
  5 files changed, 141 insertions(+)
  create mode 100644 drivers/misc/misc-uclass.c
  create mode 100644 include/misc.h



Applied to u-boot-nios.

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


Re: [U-Boot] [PATCH v8 3/3] nios2: convert altera timer to driver model

2015-10-13 Thread Thomas Chou



On 10/10/2015 03:16 PM, Thomas Chou wrote:

Convert altera timer to driver model.

Signed-off-by: Thomas Chou 
Acked-by: Chin Liang See 
---
v2
   fix coding style.
v3
   doc dts binding.
v4
   no change.
v5
   revert to get_rate and use uclass priv to store the clock_rate.
v6
   rename to CONFIG_TIMER as Simon suggested.
v7
   fix string replacement error in v6.
v8
   replace all dm_timer with timer.

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



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


Re: [U-Boot] [PATCH v6 2/2] nios2: convert altera sysid to driver model

2015-10-13 Thread Thomas Chou



On 10/10/2015 05:07 PM, Thomas Chou wrote:

Convert altera sysid to driver model with misc uclass.

Signed-off-by: Thomas Chou 
Acked-by: Chin Liang See 
Reviewed-by: Simon Glass 
---
v2
   fix coding style.
v3
   doc dts binding.
v4
   no change.
v5
   sort headers inclusion as Simon suggested.
   add display_sysid() to asm/system.h.
v6
   replace DM_MISC to MISC.

  arch/nios2/cpu/Makefile|   2 +-
  arch/nios2/cpu/cpu.c   |  13 +---
  arch/nios2/cpu/sysid.c |  46 -
  arch/nios2/dts/3c120_devboard.dts  |   6 ++
  arch/nios2/include/asm/system.h|   2 +
  board/altera/nios2-generic/nios2-generic.c |   5 +-
  configs/nios2-generic_defconfig|   2 +
  drivers/misc/Kconfig   |   7 ++
  drivers/misc/Makefile  |   1 +
  drivers/misc/altera_sysid.c| 101 +
  include/configs/nios2-generic.h|   2 +-
  11 files changed, 127 insertions(+), 60 deletions(-)
  delete mode 100644 arch/nios2/cpu/sysid.c
  create mode 100644 drivers/misc/altera_sysid.c



Applied to u-boot-nios.

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


Re: [U-Boot] [PATCH] nios2: zap cache status enable and disable functions

2015-10-13 Thread Thomas Chou



On 10/09/2015 11:32 AM, Thomas Chou wrote:

As the icache and dcache of nios2 are always enabled, the
cmd_cache is no of use and the cache status, enable and
disable functions can be removed.

Signed-off-by: Thomas Chou 
---
  arch/nios2/cpu/cpu.c | 15 ---
  1 file changed, 15 deletions(-)



Applied to u-boot-nios.

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


Re: [U-Boot] [PATCH v2] nios2: set default cache configuration in start.S

2015-10-13 Thread Thomas Chou



On 10/09/2015 08:11 PM, Thomas Chou wrote:

Set default icache and dcache configuration for start.S.

We want to remove the CONFIG_SYS_{I,D}CACHE_SIZE...
configuration macros. As we are just barely starting from
reset, there is no luxury of device tree.

We will set some maximum cache configuration so that it will
work for most configurations. This is used only in this
start.S. The speed penalty is only once here.

After start up, during board initialization, cpu information
will be extracted from device tree. Then cache flush operations
will have correct cache configurations.

Signed-off-by: Thomas Chou 
---
v2
   change commit message.

  arch/nios2/cpu/start.S | 22 +++---
  1 file changed, 15 insertions(+), 7 deletions(-)



Applied to u-boot-nios.

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


[U-Boot] [PATCH v2] pci: pcie_imx: Fix hang on mx6qp

2015-10-13 Thread Fabio Estevam
PCI driver currently hangs on mx6qp.

Toggle the reset bit with the appropriate timings to fix the issue.

Based on the FSL kernel driver implementation.

Signed-off-by: Fabio Estevam 
---
Changes since v1:
- Rearrange the code to avoid explicit delay (Marek)

 arch/arm/include/asm/arch-mx6/iomux.h | 2 ++
 drivers/pci/pcie_imx.c| 9 +
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/iomux.h 
b/arch/arm/include/asm/arch-mx6/iomux.h
index 9b3a91f..e3ef59f 100644
--- a/arch/arm/include/asm/arch-mx6/iomux.h
+++ b/arch/arm/include/asm/arch-mx6/iomux.h
@@ -18,6 +18,8 @@
 #define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
 #define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
 
+#define IOMUXC_GPR1_PCIE_SW_RST(1 << 29)
+
 /*
  * IOMUXC_GPR5 bit fields
  */
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 1568f20..40f2e6a 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define PCI_ACCESS_READ  0
 #define PCI_ACCESS_WRITE 1
@@ -430,6 +431,10 @@ static int imx_pcie_write_config(struct pci_controller 
*hose, pci_dev_t d,
 static int imx6_pcie_assert_core_reset(void)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   if (is_mx6dqp())
+   setbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
 #if defined(CONFIG_MX6SX)
struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
 
@@ -536,6 +541,10 @@ static int imx6_pcie_deassert_core_reset(void)
 
enable_pcie_clock();
 
+
+   if (is_mx6dqp())
+   clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
/*
 * Wait for the clock to settle a bit, when the clock are sourced
 * from the CPU, we need about 30 ms to settle.
-- 
1.9.1

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


Re: [U-Boot] [PATCH] nios2: remove asm/psr.h

2015-10-13 Thread Thomas Chou



On 10/07/2015 08:56 PM, Thomas Chou wrote:

Remove asm/psr.h, which is not used.
Also clean up asm/sections.h and unaligned.h.

Signed-off-by: Thomas Chou 
---
  arch/nios2/include/asm/psr.h   | 12 
  arch/nios2/include/asm/sections.h  | 10 --
  arch/nios2/include/asm/unaligned.h |  5 -
  3 files changed, 27 deletions(-)
  delete mode 100644 arch/nios2/include/asm/psr.h



Applied to u-boot-nios.


diff --git a/arch/nios2/include/asm/psr.h b/arch/nios2/include/asm/psr.h
deleted file mode 100644
index 3ebb2a0..000
--- a/arch/nios2/include/asm/psr.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation 
- * Scott McNutt 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#ifndef __ASM_NIOS2_PSR_H_
-#define __ASM_NIOS2_PSR_H_
-
-
-#endif /* __ASM_NIOS2_PSR_H_ */
diff --git a/arch/nios2/include/asm/sections.h 
b/arch/nios2/include/asm/sections.h
index f0da75d..2b8c516 100644
--- a/arch/nios2/include/asm/sections.h
+++ b/arch/nios2/include/asm/sections.h
@@ -1,11 +1 @@
-/*
- * Copyright (c) 2012 The Chromium OS Authors.
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#ifndef __ASM_NIOS2_SECTIONS_H
-#define __ASM_NIOS2_SECTIONS_H
-
  #include 
-
-#endif
diff --git a/arch/nios2/include/asm/unaligned.h 
b/arch/nios2/include/asm/unaligned.h
index 779117c..6cecbbb 100644
--- a/arch/nios2/include/asm/unaligned.h
+++ b/arch/nios2/include/asm/unaligned.h
@@ -1,6 +1 @@
-#ifndef _ASM_NIOS2_UNALIGNED_H
-#define _ASM_NIOS2_UNALIGNED_H
-
  #include 
-
-#endif /* _ASM_NIOS2_UNALIGNED_H */


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


Re: [U-Boot] [PATCH] nios2: convert do_reset to use dm cpu data

2015-10-13 Thread Thomas Chou



On 10/05/2015 11:00 AM, Thomas Chou wrote:

Convert do_reset to use dm cpu data.

Signed-off-by: Thomas Chou 
---
  arch/nios2/cpu/cpu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)



Applied to u-boot-nios.


diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 106f0bf..229a07b 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -25,7 +25,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
  {
disable_interrupts();
/* indirect call to go beyond 256MB limitation of toolchain */
-   nios2_callr(CONFIG_SYS_RESET_ADDR);
+   nios2_callr(gd->arch.reset_addr);
return 0;
  }



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


Re: [U-Boot] [PATCH v8 2/3] timer: start a new timer after relocation

2015-10-13 Thread Thomas Chou



On 10/10/2015 03:16 PM, Thomas Chou wrote:

Start a new timer after relocation, just in case the
timer has been used in per-relocation.

Signed-off-by: Thomas Chou 
Acked-by: Simon Glass 
---
v6
   rename to CONFIG_TIMER as Simon suggested.
v7
   fix string replacement error in v6
v8
   replace all dm_timer with timer.

  common/board_r.c | 3 +++
  1 file changed, 3 insertions(+)



Applied to u-boot-nios.



diff --git a/common/board_r.c b/common/board_r.c
index f8c1baa..d22118b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -290,6 +290,9 @@ static int initr_dm(void)
/* Save the pre-reloc driver model and start a new one */
gd->dm_root_f = gd->dm_root;
gd->dm_root = NULL;
+#ifdef CONFIG_TIMER
+   gd->timer = NULL;
+#endif
return dm_init_and_scan(false);
  }
  #endif


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


Re: [U-Boot] [PATCH v8 1/3] dm: implement a Timer uclass

2015-10-13 Thread Thomas Chou



On 10/10/2015 03:16 PM, Thomas Chou wrote:

Implement a Timer uclass to work with lib/time.c.

Signed-off-by: Thomas Chou 
Acked-by: Simon Glass 
---
v2
   fix coding style.
v3
   add description to Kconfig as Simon suggested.
   move timer.c code to lib/time.c.
   add dm_timer dev to global data.
   remove timer_init().
   change API name get_clock.
v4
   add comment about timer hardware.
v5
   revert to get_rate and use uclass priv to store the clock_rate.
   split gd->dm_timer renewal to anohter patch.
v6
   rename to CONFIG_TIMER as Simon suggested.
v7
   fix string replacement error in v6
v8
   replace all dm_timer with timer.

  drivers/Kconfig   |  2 ++
  drivers/Makefile  |  1 +
  drivers/timer/Kconfig | 12 +
  drivers/timer/Makefile|  7 ++
  drivers/timer/timer-uclass.c  | 42 +++
  include/asm-generic/global_data.h |  3 +++
  include/dm/uclass-id.h|  1 +
  include/timer.h   | 52 +++
  lib/time.c| 49 
  9 files changed, 169 insertions(+)
  create mode 100644 drivers/timer/Kconfig
  create mode 100644 drivers/timer/Makefile
  create mode 100644 drivers/timer/timer-uclass.c
  create mode 100644 include/timer.h



Applied to u-boot-nios.

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


Re: [U-Boot] [PATCH] mmc: omap_hsmmc: fix initialization order of mmc block devices

2015-10-13 Thread Nishanth Menon
On Tue, Oct 13, 2015 at 3:03 AM, Lokesh Vutla  wrote:
>
>
> On Tuesday 13 October 2015 01:14 PM, Heiko Schocher wrote:
>> Hello Lokesh,
>>
>> Am 13.10.2015 um 08:46 schrieb Lokesh Vutla:
>>> +Nishanth,
>>>
>>> On Tuesday 13 October 2015 10:59 AM, Heiko Schocher wrote:
 On embedded devices, often there is a combination of
 removable mmc devices (e.g. MMC/SD cards) and hard
 wired ones (e.g. eMMC). Depending on the hardware
 configuration, the 'mmcblkN' node might change if
 the removable device is available or not at boot time.

 E.g. if the removable device is attached at boot time,
 it might become mmxblk0. And the hard wired one mmcblk1.
 But if the removable device isn't there at boot time,
 the hard wired one will become mmcblk0. This makes it
 somehow difficult to hard code the root device to the
 non-removable device and boot fast.
>>>
>>> Why not use "root=PARTUUID=${uuid}" option instead of relying on
>>> mmcblk no?
>>> U-Boot can easily detect your partuuid. Refer to [1] on how TI platforms
>>> does this in u-boot.
>>
>> Good tip ... I do not know, if it is possible to update U-Boot
>> on this boards...
>>
>> Current U-Boot says:
>> U-Boot 2013.01.01_heads/master-gc7900a0 (2015-05-06 - 20:37:15)
>>
>> I2C:   ready
>> DRAM:  512 MiB
>> [...]
>> U-Boot# mmc rescan
>> U-Boot# mmc part
>>
>> Partition Map for MMC device 0  --   Partition Type: DOS
>>
>> PartStart SectorNum Sectors UUIDType
>>   1 63  144522  000ce343-01 0e Boot
>>   2 144585  659861  000ce343-02 83
>> U-Boot# part uuid mmc 0:2 uuid
>> Unknown command 'part' - try 'help'
>> U-Boot#
>>
>> So, if this patch has no chance for mainline, please let me
>> know it, thanks!
>>
>
> IIRC, Nishanth had posted a patch something similar but got rejected for
> some reason. Probably Nishanth can comment more here.
>

overall the feedback I received was for block devices, there is
already an unique method(PARTUUID/uuid) of referencing required device
and mmcxblky aliasing was not really needed - hence dropped my patch
and switched over to partuuid.

CC Tom and u-boot list as well.
for reference the current thread: http://marc.info/?t=14447142172=1=2
-- 
---
Regards,
Nishanth Menon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] pci: pcie_imx: Fix hang on mx6qp

2015-10-13 Thread Bin Meng
Hi Fabio,

On Tue, Oct 13, 2015 at 9:37 PM, Fabio Estevam
 wrote:
> PCI driver currently hangs on mx6qp.
>
> Toggle the reset bit with the appropriate timings to fix the issue.
>
> Based on the FSL kernel driver implementation.
>
> Signed-off-by: Fabio Estevam 
> ---
> Changes since v1:
> - Rearrange the code to avoid explicit delay (Marek)
>
>  arch/arm/include/asm/arch-mx6/iomux.h | 2 ++
>  drivers/pci/pcie_imx.c| 9 +
>  2 files changed, 11 insertions(+)
>
> diff --git a/arch/arm/include/asm/arch-mx6/iomux.h 
> b/arch/arm/include/asm/arch-mx6/iomux.h
> index 9b3a91f..e3ef59f 100644
> --- a/arch/arm/include/asm/arch-mx6/iomux.h
> +++ b/arch/arm/include/asm/arch-mx6/iomux.h
> @@ -18,6 +18,8 @@
>  #define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
>  #define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
>
> +#define IOMUXC_GPR1_PCIE_SW_RST(1 << 29)
> +
>  /*
>   * IOMUXC_GPR5 bit fields
>   */
> diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
> index 1568f20..40f2e6a 100644
> --- a/drivers/pci/pcie_imx.c
> +++ b/drivers/pci/pcie_imx.c
> @@ -19,6 +19,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #define PCI_ACCESS_READ  0
>  #define PCI_ACCESS_WRITE 1
> @@ -430,6 +431,10 @@ static int imx_pcie_write_config(struct pci_controller 
> *hose, pci_dev_t d,
>  static int imx6_pcie_assert_core_reset(void)
>  {
> struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +
> +   if (is_mx6dqp())
> +   setbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
> +
>  #if defined(CONFIG_MX6SX)
> struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
>
> @@ -536,6 +541,10 @@ static int imx6_pcie_deassert_core_reset(void)
>
> enable_pcie_clock();
>
> +

nits: this blank line can be avoided, no?

> +   if (is_mx6dqp())
> +   clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
> +
> /*
>  * Wait for the clock to settle a bit, when the clock are sourced
>  * from the CPU, we need about 30 ms to settle.
> --

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


[U-Boot] [PATCH v3] pci: pcie_imx: Fix hang on mx6qp

2015-10-13 Thread Fabio Estevam
PCI driver currently hangs on mx6qp.

Toggle the reset bit with the appropriate timings to fix the issue.

Based on the FSL kernel driver implementation.


Signed-off-by: Fabio Estevam 
---
Changes since v2:
- Remove unneeded blank line (Bin)

 arch/arm/include/asm/arch-mx6/iomux.h | 2 ++
 drivers/pci/pcie_imx.c| 8 
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/iomux.h 
b/arch/arm/include/asm/arch-mx6/iomux.h
index 9b3a91f..907cb40 100644
--- a/arch/arm/include/asm/arch-mx6/iomux.h
+++ b/arch/arm/include/asm/arch-mx6/iomux.h
@@ -18,6 +18,8 @@
 #define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
 #define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
 
+#define IOMUXC_GPR1_PCIE_SW_RST(1 << 29)
+
 /*
  * IOMUXC_GPR5 bit fields
  */
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 1568f20..f1e189e 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define PCI_ACCESS_READ  0
 #define PCI_ACCESS_WRITE 1
@@ -430,6 +431,10 @@ static int imx_pcie_write_config(struct pci_controller 
*hose, pci_dev_t d,
 static int imx6_pcie_assert_core_reset(void)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   if (is_mx6dqp())
+   setbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
 #if defined(CONFIG_MX6SX)
struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
 
@@ -536,6 +541,9 @@ static int imx6_pcie_deassert_core_reset(void)
 
enable_pcie_clock();
 
+   if (is_mx6dqp())
+   clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
/*
 * Wait for the clock to settle a bit, when the clock are sourced
 * from the CPU, we need about 30 ms to settle.
-- 
1.9.1

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


Re: [U-Boot] [ELCE2015] Question about schedule

2015-10-13 Thread Lukasz Majewski
Hi Bin,

> Hi,
> 
> On Fri, Oct 2, 2015 at 6:34 AM, Tom Rini  wrote:
> > On Thu, Oct 01, 2015 at 10:38:50AM +0200, Lukasz Majewski wrote:
> >
> >> Hi Tom,
> >>
> >> Is there any schedule for our ELCE2015 u-boot mini summit [1]?
> >> To be more precise
> >> - are know times when we will deliver our presentations?
> >>
> >>
> >>
> >> [1] - http://www.denx.de/wiki/U-Boot/SummitELCE2015
> >
> > So no, we don't have a formal schedule at this time.  My kind of
> > plan at this point is to start off with the formal talks.  Then
> > move into a "5 minute" status from the custodians present on where
> > they're at in their area.  After that, sort out some priorities on
> > Kconfig/DT.
> >
> > Oh, and I plan to try and have a Google Hangout up so that people
> > that can't make it can at least watch and maybe chime in.
> >
> > --
> 
> Are there any slides presented in the summit available somewhere? Or
> any video clips?

I'm going to upload my slides to the Mini-Summit webpage.

> 
> Regards,
> Bin



-- 
Best regards,

Lukasz Majewski

Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/4] exynos: be more verbose in process_nodes()

2015-10-13 Thread Minkyu Kang
On 05/10/15 20:47, Tobias Jakobi wrote:
> In case sdhci_get_config() or do_sdhci_init() fail, show
> the error code that was returned.
> 
> Acked-by: Przemyslaw Marczak 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/mmc/s5p_sdhci.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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


Re: [U-Boot] [PATCH V3 0/2] *Enhance Odroid board

2015-10-13 Thread Minkyu Kang
Dear Guillaume GARDET,

On 13/10/15 19:16, Przemyslaw Marczak wrote:
> Hello,
> 
> On 10/09/2015 02:26 PM, Guillaume GARDET wrote:
>> Those 2 patches enhances Odroid board support.
>> * First patch replace 'fatload' command by 'load', to be able to use EXT*
>> partitions while keeping FAT partition compatibility.
>> * Second patch adds boot script (boot.scr) support. If no boot script are
>> found, it boots as usual.
>>
>> Changes in V3:
>> * Uses 'elif' version as requested by Przemyslaw Marczak
>>
>> Changes in V2:
>> * Expand commit messages
>> * Better code consistency
>>
>> Signed-off-by: Guillaume GARDET 
>> Cc: Przemyslaw Marczak 
>> Cc: Minkyu Kang 
>>
>> ---
>>
>> Guillaume GARDET (2):
>>odroid: replace 'fatload' with 'load' to be able to use EXT*
>>  partitions
>>odroid: Add boot script (boot.scr) support
>>
>>   include/configs/odroid.h | 16 
>>   1 file changed, 12 insertions(+), 4 deletions(-)
>>
> 
> For the series:
> 
> Tested-by: Przemyslaw Marczak 
> Acked-by: Przemyslaw Marczak 
> 
> Thanks!

applied to u-boot-samsung.

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


Re: [U-Boot] [PATCH v3 4/4] exynos: more debug and cleanup in do_sdhci_init()

2015-10-13 Thread Minkyu Kang
On 05/10/15 20:47, Tobias Jakobi wrote:
> Add more debug printfs in do_sdhci_init() for calls
> that can potentially fail.
> 
> Acked-by: Przemyslaw Marczak 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/mmc/s5p_sdhci.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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


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

2015-10-13 Thread Przemyslaw Marczak

Hello Simon,

On 10/03/2015 04:28 PM, Simon Glass wrote:

Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

This commit adds driver for Exynos54xx ADC subsystem.

The driver is implemented using driver model,
amd provides ADC uclass's operations:
- adc_init()
- adc_data()

This driver uses sdelay() function on pooling, so it can
be used before the delay timer is inited.
The basic parameters of ADC conversion, are:
- sample rate: 600KSPS
- output the data as average of 8 time conversion

ADC features:
- sample rate: 600KSPS
- resolution: 12-bit
- channels: 10 (analog multiplexer)

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- new commit - move previous adc driver from SoC directory to drivers/adc
---
  arch/arm/mach-exynos/include/mach/adc.h |  45 ++
  drivers/adc/Kconfig |   9 +++
  drivers/adc/Makefile|   1 +
  drivers/adc/exynos-adc.c| 102 
  4 files changed, 157 insertions(+)
  create mode 100644 drivers/adc/exynos-adc.c

diff --git a/arch/arm/mach-exynos/include/mach/adc.h 
b/arch/arm/mach-exynos/include/mach/adc.h
index a0e26d7..228acf4 100644
--- a/arch/arm/mach-exynos/include/mach/adc.h
+++ b/arch/arm/mach-exynos/include/mach/adc.h
@@ -9,6 +9,38 @@
  #ifndef __ASM_ARM_ARCH_ADC_H_
  #define __ASM_ARM_ARCH_ADC_H_

+#define ADC_V2_CON1_SOFT_RESET (0x2 << 1)
+#define ADC_V2_CON1_STC_EN (0x1)


No need for brackets on these simple ones



Okay, I will remove them.


+
+#define ADC_V2_CON2_OSEL(x)(((x) & 0x1) << 10)
+#define OSEL_2S(0x0)
+#define OSEL_BINARY(0x1)
+#define ADC_V2_CON2_ESEL(x)(((x) & 0x1) << 9)
+#define ESEL_ADC_EVAL_TIME_40CLK   (0x0)
+#define ESEL_ADC_EVAL_TIME_20CLK   (0x1)
+#define ADC_V2_CON2_HIGHF(x)   (((x) & 0x1) << 8)
+#define HIGHF_CONV_RATE_30KSPS (0x0)
+#define HIGHF_CONV_RATE_600KSPS(0x1)
+#define ADC_V2_CON2_C_TIME(x)  (((x) & 0x7) << 4)
+#define ADC_V2_CON2_CHAN_SEL(x)((x) & 0xf)
+
+#define ADC_V2_GET_STATUS_FLAG(x)  (((x) >> 2) & 0x1)
+#define FLAG_CONV_END  (0x1)
+
+#define ADC_V2_INT_DISABLE (0x0)
+#define ADC_V2_INT_ENABLE  (0x1)
+#define INT_NOT_GENERATED  (0x0)
+#define INT_GENERATED  (0x1)
+
+#define ADC_V2_VERSION (0x8008)
+
+#define ADC_V2_MAX_CHANNEL (9)
+
+/* For default 8 time convertion with sample rate 600 kSPS - 15us timeout */
+#define ADC_V2_CONV_TIMEOUT_US (15)
+
+#define ADC_V2_DAT_MASK(0xfff)
+
  #ifndef __ASSEMBLY__
  struct s5p_adc {
 unsigned int adccon;
@@ -21,6 +53,19 @@ struct s5p_adc {
 unsigned int adcmux;
 unsigned int adcclrintpndnup;
  };
+
+struct exynos_adc_v2 {
+   unsigned int con1;
+   unsigned int con2;
+   unsigned int status;
+   unsigned int dat;
+   unsigned int int_en;
+   unsigned int int_status;
+   unsigned int reserved[2];
+   unsigned int version;
+};
+
+int exynos_adc_read_channel(int channel);
  #endif

  #endif /* __ASM_ARM_ARCH_ADC_H_ */
diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
index 1cb1a8d..8ee6531 100644
--- a/drivers/adc/Kconfig
+++ b/drivers/adc/Kconfig
@@ -6,3 +6,12 @@ config ADC
   - device enable
   - conversion init
   - conversion start and return data with data mask
+
+config ADC_EXYNOS
+   bool "Enable Exynos 54xx ADC driver"
+   help
+ This enables basic driver for Exynos ADC compatible with Exynos54xx.
+ It provides:
+ - 10 analog input channels
+ - 12-bit resolution
+ - 600 KSPS of sample rate


Great help!



Thanks:)


diff --git a/drivers/adc/Makefile b/drivers/adc/Makefile
index c4d9618..eb85b8b 100644
--- a/drivers/adc/Makefile
+++ b/drivers/adc/Makefile
@@ -6,3 +6,4 @@
  #

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


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



Ok, will move this. And yes, the problem is with too late timer init.
I saw the work for timer uclass, however I would prefer just use this 
function. It can be 

Re: [U-Boot] [PATCH v3 2/4] exynos: Fix passing of errors in exynos_mmc_init()

2015-10-13 Thread Minkyu Kang
On 05/10/15 20:47, Tobias Jakobi wrote:
> exynos_mmc_init() always returns zero, so for the caller
> it looks like it never fails.
> 
> Correct this by returning the error code of process_nodes().
> For process_nodes() do something similar and return early
> when do_sdhci_init() fails.
> 
> v2: Only fail in process_nodes() if we fail on all
> available nodes.
> 
> Acked-by: Przemyslaw Marczak 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/mmc/s5p_sdhci.c | 18 --
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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


Re: [U-Boot] [PATCH v3 1/4] exynos: Properly zero initialize host in s5p_sdhci_init()

2015-10-13 Thread Minkyu Kang
On 05/10/15 20:47, Tobias Jakobi wrote:
> This makes sure that setting the host_caps in s5p_sdhci_core_init()
> doesn't operate on potentially uninitialized memory.
> 
> Acked-by: Lukasz Majewski 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/mmc/s5p_sdhci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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


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

2015-10-13 Thread Przemyslaw Marczak

Hello Simon,

On 10/03/2015 04:28 PM, Simon Glass wrote:

Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

This commit adds additional file with implementation of board
detection code for Odroid-XU3/XU4.

The detection depends on compatible found in fdt:
- "samsung,exynos5" - uses Exynos5 generic code
- "samsung,odroidxu3" - try detect XU3 revision

There are few revisions of Odroid XU3/XU4, each can be detected
by checking the value of channel 9 of built-in ADC:
  Rev   ADC  Board
  0.1 0  XU3 0.1
  0.2   372  XU3 0.2 | XU3L - no DISPLAYPORT
  0.3  1280  XU4 0.1

The detection code depends on the ADC+10% value.

Implementation of functions:
- set_board_type() - read ADC and set type
- get_board_rev()  - returns board revision: 1..3
- get_board_type() - returns board type string

Additional functions with return values of bool:
- board_is_generic()   - true if found compatible "samsung,exynos5"
  but not "samsung,odroidxu3"
- board_is_odroidxu3() - true if found compatible "samsung,odroidxu3"
  and one of XU3 revision.
- board_is_odroidxu4() - true if found compatible "samsung,odroidxu3"
  and XU4 revision.

After I2C controller init, the get_board_type() can check
if the XU3 board is a "Lite" variant, by probing chip
0x40 on I2C0 (INA231 - exists only on non-lite).
This is useful for setting fdt file name at misc_init_r().

Enabled configs:
- CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
- CONFIG_ODROID_REV_AIN
- CONFIG_REVISION_TAG
- CONFIG_BOARD_TYPES

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- move detection code from exynos5-dt.c to exynos5-dt-types.c
- add header with board type function declarations
- check for compatible before do the detection
- update the ADC max values with 20% tolerance
- fix XU4 adc value, related to mistake from table in XU4 schematic
- return "Not supported" for XU4 when calls one of:
   --dfu_get_alt_boot()
   --dfu_get_alt_system()
- extend ${dfu_alt_system} by strings:
   -- 'exynos5422-odroidxu3-lite.dtb'
   -- 'exynos5422-odroidxu4.dtb' - allows prepare card on XU3
---
  board/samsung/common/Makefile   |   5 +-
  board/samsung/common/exynos5-dt-types.c | 196 
  board/samsung/common/exynos5-dt.c   |  12 ++
  configs/odroid-xu3_defconfig|   2 +
  include/configs/odroid_xu3.h|  12 ++
  include/samsung/exynos5-dt-types.h  |  27 +
  6 files changed, 253 insertions(+), 1 deletion(-)
  create mode 100644 board/samsung/common/exynos5-dt-types.c
  create mode 100644 include/samsung/exynos5-dt-types.h


Reviewed-by: Simon Glass 

See nits below.



Ok.



diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 6cbd906..ef1a8f3 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -11,5 +11,8 @@ obj-$(CONFIG_MISC_COMMON) += misc.o

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

Re: [U-Boot] [RFC] odroid DTB support

2015-10-13 Thread Tom Rini
On Tue, Oct 13, 2015 at 09:37:04AM +0200, Guillaume Gardet wrote:
> 
> 
> Le 12/10/2015 16:24, Tom Rini a écrit :
> >On Mon, Oct 12, 2015 at 10:54:04AM +0200, Guillaume Gardet wrote:
> >>Hi,
> >>
> >>
> >>Le 12/10/2015 01:45, Tom Rini a écrit :
> >>>On Fri, Oct 09, 2015 at 02:35:24PM +0200, Guillaume Gardet wrote:
> Le 09/10/2015 14:23, Przemyslaw Marczak a écrit :
> >Hello Guillaume,
> >
> >On 10/09/2015 02:11 PM, Guillaume Gardet wrote:
> >>Hi Przemyslaw,
> >>
> >>I would like to add DTB support for odroid board to be able to boot
> >>upstream kernel easily.
> >>
> >>I see 2 ways to do it:
> >>* Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support to set 'board_rev'
> >>and 'board_name' env vars. Then, you need a 'findfdt' script to check
> >>'board_rev' and set fdtfile accordingly (as done for OMAP4 panda board)
> >>* Set fdtfile name directly (as done for rpi or igep00x0).
> >>
> >>What would you prefer?
> >>
> >>
> >>Guillaume
> >>
> >>
> >Is, that the reason of adding the boot script by your last patches?
> No, we need a boot script, because this is the way we boot our
> openSUSE images (we boot with an initrd and some special bootargs).
> >>>Hang on, exynos stuff uses the generic distro hooks.  Can you take a
> >>>look at doc/README.distro and see what openSUSE can hook into / provide
> >>>some feedback on what needs doing?  Thanks!
> >>This is true for odroid XU3 (Exynos5 based) but Odroid U3/X2 (Exynos4
> >>based) has no generic distro hooks at the moment.
> >No, exynos-common pulls in generic distro.  And in the event of boards
> >that do not the answer is to pull in the generic distro framework.
> 
> It seems that exynos-common includes only "config_distro_defaults.h",
> not "config_distro_bootcmd.h".
> And "config_distro_bootcmd.h" is needed for generic distro boot flow.
> Am I missing something?

Ah, good point, OK, thanks.  Yes, instead of introducing more changes,
all of these boards should be migrated to config_distro_bootcmd so that
they just work in openSUSE or Arch or Ubuntu or Fedora or whatever.

-- 
Tom


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


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

2015-10-13 Thread Przemyslaw Marczak

Hello,

On 10/03/2015 04:30 PM, Simon Glass wrote:

Hi Przemyslaw,

On 1 October 2015 at 12:07, Przemyslaw Marczak  wrote:

Hello,


On 09/21/2015 02:26 PM, Przemyslaw Marczak wrote:


This patchset adds:
- CPU model in dts for Chromebook Peach Pi as Exynos5800
- set the cpu id of Exynos5422 to 0x5422
- S2MPS11 PMIC I/O driver
- Exynos5420-compatible (9-channel, 12-bit) ADC driver
- new file for Exynos5: exynos5-dt-types.c
- board detection for Odroid XU3 / XU3lite / XU4
- fixed ADC val for XU4

This was tested on Odroid XU3 and XU3 Lite, without the XU4,
but I'm waiting for reply from the Odroid forum users.

Tested with buildman for samsung.

Available on github:
https://github.com/bobenstein/u-boot/tree/xu3-detect-patchset-v1
https://github.com/bobenstein/u-boot/tree/xu3-detect-patchset-v2

Przemyslaw Marczak (11):
samsung: board/misc: check returned pointer for get_board_type() calls
s5p: cpu_info: print "cpu-model" if exists in dts
Peach-Pi: dts: add cpu-model string
Exynos5422/5800: set cpu id to 0x5422
dm: pmic: add s2mps11 PMIC I/O driver
dm: adc: add simple ADC uclass implementation
dm: adc: add Exynos54xx compatible ADC driver
Odroid-XU3: enable s2mps11 PMIC support
Exynos54xx: dts: add ADC node
Odroid-XU3: dts: enable ADC, with request for pre-reloc bind
exynos5-dt-types: add board detection for Odroid XU3/XU3L/XU4.

   arch/arm/cpu/armv7/s5p-common/cpu_info.c  |  14 ++-
   arch/arm/dts/exynos5422-odroidxu3.dts |  12 ++
   arch/arm/dts/exynos54xx.dtsi  |   7 ++
   arch/arm/dts/exynos5800-peach-pi.dts  |   1 +
   arch/arm/mach-exynos/clock.c  |  16 +--
   arch/arm/mach-exynos/clock_init_exynos5.c |   2 +-
   arch/arm/mach-exynos/common_setup.h   |   4 +-
   arch/arm/mach-exynos/include/mach/adc.h   |  45 +++
   arch/arm/mach-exynos/include/mach/cpu.h   |   6 +-
   arch/arm/mach-exynos/include/mach/gpio.h  |   4 +-
   arch/arm/mach-exynos/pinmux.c |   2 +-
   arch/arm/mach-exynos/power.c  |   2 +-
   board/samsung/common/Makefile |   5 +-
   board/samsung/common/board.c  |   4 +-
   board/samsung/common/exynos5-dt-types.c   | 196
++
   board/samsung/common/exynos5-dt.c |  12 ++
   board/samsung/common/misc.c   |   3 +
   configs/odroid-xu3_defconfig  |   5 +
   doc/device-tree-bindings/pmic/s2mps11.txt |  17 +++
   drivers/Kconfig   |   2 +
   drivers/Makefile  |   1 +
   drivers/adc/Kconfig   |  17 +++
   drivers/adc/Makefile  |   9 ++
   drivers/adc/adc-uclass.c  |  76 
   drivers/adc/exynos-adc.c  | 102 
   drivers/power/pmic/Kconfig|  14 +++
   drivers/power/pmic/Makefile   |   1 +
   drivers/power/pmic/s2mps11.c  |  60 +
   include/adc.h |  88 ++
   include/configs/odroid_xu3.h  |  12 ++
   include/dm/uclass-id.h|   1 +
   include/power/s2mps11.h   | 109 +
   include/samsung/exynos5-dt-types.h|  27 
   33 files changed, 854 insertions(+), 22 deletions(-)
   create mode 100644 board/samsung/common/exynos5-dt-types.c
   create mode 100644 doc/device-tree-bindings/pmic/s2mps11.txt
   create mode 100644 drivers/adc/Kconfig
   create mode 100644 drivers/adc/Makefile
   create mode 100644 drivers/adc/adc-uclass.c
   create mode 100644 drivers/adc/exynos-adc.c
   create mode 100644 drivers/power/pmic/s2mps11.c
   create mode 100644 include/adc.h
   create mode 100644 include/power/s2mps11.h
   create mode 100644 include/samsung/exynos5-dt-types.h



Simon,
Are you going to to review this patchset or can I update it and ask Minkyu
for taking it?


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

Regards,
Simon



Ok. I will prepare the V3 and notify you.

Best regards,
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 01/16] spi: Add zynq qspi controller driver

2015-10-13 Thread Hannes Schmelzer

Hi there,

i am currently debugging on my zynq zc702 board and therefore i have to 
study the qspi-driver :-)


i've some questions about the implementation details.

On 01.09.2015 08:11, Jagan Teki wrote:

Added zynq qspi controller driver for Xilinx Zynq APSOC,
this driver is driver-model driven with devicetree support.

()

+static void zynq_qspi_fill_tx_fifo(struct zynq_qspi_priv *priv, u32 size)
+{
+   u32 data = 0;
+   u32 fifocount = 0;
+   unsigned len, offset;
+   struct zynq_qspi_regs *regs = priv->regs;
+   static const unsigned offsets[4] = {
+   ZYNQ_QSPI_TXD_00_00_OFFSET, ZYNQ_QSPI_TXD_00_01_OFFSET,
+   ZYNQ_QSPI_TXD_00_10_OFFSET, ZYNQ_QSPI_TXD_00_11_OFFSET };
+
+   while ((fifocount < size) &&
+   (priv->bytes_to_transfer > 0)) {
+   if (priv->bytes_to_transfer >= 4) {
+   if (priv->tx_buf) {
+   memcpy(, priv->tx_buf, 4);
+   priv->tx_buf += 4;
+   } else {
+   data = 0;
+   }
+   writel(data, >txd0r);
+   priv->bytes_to_transfer -= 4;
+   fifocount++;
+   } else {
+   /* Write TXD1, TXD2, TXD3 only if TxFIFO is empty. */
+   if (!(readl(>isr)
+   & ZYNQ_QSPI_IXR_TXOW_MASK) &&
+   !priv->rx_buf)
+   return;
+   len = priv->bytes_to_transfer;
+   zynq_qspi_write_data(priv, , len);
+   offset = (priv->rx_buf) ? offsets[0] : offsets[len];
+   writel(data, >cr + (offset / 4));
I do not understand "offset / 4", if priv->rx_buf == NULL we have an 
offset of 0x1C / 4 --> 7, this end in a write to an unaligned register 
address.

What is the purpose of this ?

+   }
+   }
+}
+

best regards,
Hannes

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


Re: [U-Boot] [PULL] Please pull u-boot-imx

2015-10-13 Thread Tom Rini
On Tue, Oct 13, 2015 at 10:16:12AM +0200, Stefano Babic wrote:

> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> The following changes since commit 7daaac5281db0788cde895a0add38ad5195b5be1:
> 
>   mx6sabre_common: Add DFU support (2015-10-02 10:51:20 +0200)
> 
> are available in the git repository at:
> 
>   git://www.denx.de/git/u-boot-imx.git master
> 
> for you to fetch changes up to 61903b759aa336d798da49d884467219796817ff:
> 
>   imximage: fix commands other than write_data (2015-10-07 13:43:15 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


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

2015-10-13 Thread Przemyslaw Marczak

Hello Simon,

On 10/03/2015 04:28 PM, Simon Glass wrote:

Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

This platform is based on Exynos5800 but the cpu id is 0x5422.
This doesn't fit the common Exynos SoC name convention, so now,
the CPU name is defined by device tree string, to be printed
properly.

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- move cpu name from config to dts
---
  arch/arm/dts/exynos5800-peach-pi.dts | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/exynos5800-peach-pi.dts 
b/arch/arm/dts/exynos5800-peach-pi.dts
index 1d7ff23..76826dc 100644
--- a/arch/arm/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/dts/exynos5800-peach-pi.dts
@@ -12,6 +12,7 @@

  / {
 model = "Samsung/Google Peach Pi board based on Exynos5800";
+   cpu-model = "Exynos5800";

 compatible = "google,pit-rev#", "google,pit",
 "google,peach", "samsung,exynos5800", "samsung,exynos5";
--
1.9.1



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

Regards,
Simon



No, it's not standard. I will add binding info.

Best regards
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2015-10-13 Thread Przemyslaw Marczak

Hello Simon,

On 10/03/2015 04:28 PM, Simon Glass wrote:

Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

This commit adds:
- new uclass id: UCLASS_ADC
- new uclass driver: drivers/adc/adc-uclass.c

The uclass's implementation is as simple as needed and provides functions:
- adc_init() - init ADC conversion
- adc_data() - convert and return data
- adc_data_mask() - return ADC data mask
- adc_channel_single_shot() - function for single ADC convertion

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- new commit - introduce ADC uclass driver
---
  drivers/Kconfig  |  2 ++
  drivers/Makefile |  1 +
  drivers/adc/Kconfig  |  8 +
  drivers/adc/Makefile |  8 +
  drivers/adc/adc-uclass.c | 76 +
  include/adc.h| 88 
  include/dm/uclass-id.h   |  1 +
  7 files changed, 184 insertions(+)
  create mode 100644 drivers/adc/Kconfig
  create mode 100644 drivers/adc/Makefile
  create mode 100644 drivers/adc/adc-uclass.c
  create mode 100644 include/adc.h


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



Yes, ok.



diff --git a/drivers/Kconfig b/drivers/Kconfig
index 63c92c5..ad9ae3a 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -4,6 +4,8 @@ source "drivers/core/Kconfig"

  # types of drivers sorted in alphabetical order

+source "drivers/adc/Kconfig"
+
  source "drivers/block/Kconfig"

  source "drivers/clk/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9d0a595..d7d5e9f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/

  else

+obj-y += adc/
  obj-$(CONFIG_DM_DEMO) += demo/
  obj-$(CONFIG_BIOSEMU) += bios_emulator/
  obj-y += block/
diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
new file mode 100644
index 000..1cb1a8d
--- /dev/null
+++ b/drivers/adc/Kconfig
@@ -0,0 +1,8 @@
+config ADC
+   bool "Enable ADC drivers using Driver Model"
+   help
+ This allows drivers to be provided for ADCs to drive their features,
+ trough simple ADC uclass driver interface, with operations:


through a simple



Ok.


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


Can we drop #define?



Don't you think, that single line initialization looks better than those 
with line breaks? This is the purpose of that define.



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


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

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

return ops->...



Ok, I will turn it.


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


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



Ok.


+
+   ret = uclass_get_device_by_name(UCLASS_ADC, name, );
+   if (ret)
+   return ret;
+
+   ret = adc_init(dev, channel);
+   if (ret)
+   return ret;
+
+   ret = adc_data(dev, data);
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+UCLASS_DRIVER(adc) = {
+   .id = UCLASS_ADC,
+   .name   = "adc",
+   .per_device_platdata_auto_alloc_size = ADC_UCLASS_PLATDATA_SIZE,
+};
diff --git a/include/adc.h b/include/adc.h
new file mode 100644
index 000..57b9281

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

2015-10-13 Thread Przemyslaw Marczak

Hi Simon,

On 10/03/2015 04:28 PM, Simon Glass wrote:

Hi Przemyslaw,

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

This driver allows I/O operations on the Samsung S2MPS11 PMIC,
which provides lots of LDO/BUCK outputs.

To enable it, update defconfig with:
- CONFIG_PMIC_S2MPS11
and additional, if were not defined:
- CONFIG_CMD_PMIC
- CONFIG_ERRNO_STR

The binding info: doc/device-tree-bindings/pmic/s2mps11.txt

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- remove "DM" prefix from config name
- fix word mistake in binding description
---
  doc/device-tree-bindings/pmic/s2mps11.txt |  17 +
  drivers/power/pmic/Kconfig|  14 
  drivers/power/pmic/Makefile   |   1 +
  drivers/power/pmic/s2mps11.c  |  60 
  include/power/s2mps11.h   | 109 ++
  5 files changed, 201 insertions(+)
  create mode 100644 doc/device-tree-bindings/pmic/s2mps11.txt
  create mode 100644 drivers/power/pmic/s2mps11.c
  create mode 100644 include/power/s2mps11.h


Reviewed-by: Simon Glass 

But please see nit below.



diff --git a/doc/device-tree-bindings/pmic/s2mps11.txt 
b/doc/device-tree-bindings/pmic/s2mps11.txt
new file mode 100644
index 000..422f14f
--- /dev/null
+++ b/doc/device-tree-bindings/pmic/s2mps11.txt
@@ -0,0 +1,17 @@
+SAMSUNG, S2MPS11 PMIC
+
+This file describes the binding info for the PMIC driver:
+- drivers/power/pmic/s2mps11.c
+
+Required properties:
+- compatible: "samsung,s2mps11-pmic"
+- reg = 0x66
+
+With those two properties, the pmic device can be used for read/write only.
+
+Example:
+
+s2mps11@66 {
+   compatible = "samsung,s2mps11-pmic";
+   reg = <0x66>;
+};
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 547fd1a..fb29843 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -33,6 +33,20 @@ config DM_PMIC_MAX77686
 This config enables implementation of driver-model pmic uclass features
 for PMIC MAX77686. The driver implements read/write operations.

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


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



Right, will fix.


+   }
+
+   return 0;
+}
+
+static int s2mps11_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+   if (dm_i2c_read(dev, reg, buff, len)) {
+   error("read error from device: %p register: %#x!", dev, reg);
+   return -EIO;
+   }
+
+   return 0;
+}
+
+static struct dm_pmic_ops s2mps11_ops = {
+   .reg_count = s2mps11_reg_count,
+   .read = s2mps11_read,
+   .write = s2mps11_write,
+};
+
+static const struct udevice_id s2mps11_ids[] = {
+   { .compatible = "samsung,s2mps11-pmic" },
+   { }
+};
+
+U_BOOT_DRIVER(pmic_s2mps11) = {
+   .name = "s2mps11_pmic",
+   .id = UCLASS_PMIC,
+   .of_match = s2mps11_ids,
+   .ops = _ops,
+};
diff --git a/include/power/s2mps11.h b/include/power/s2mps11.h
new file mode 100644
index 

Re: [U-Boot] [PATCH V2 02/11] s5p: cpu_info: print "cpu-model" if exists in dts

2015-10-13 Thread Przemyslaw Marczak

Hello Simon,

On 10/03/2015 04:27 PM, Simon Glass wrote:

On 21 September 2015 at 13:26, Przemyslaw Marczak  wrote:

The CPU name for Exynos was concatenated with cpu id,
but for new Exynos platforms, like Chromebook Peach Pi
based on Exynos5800, the name of SoC variant does not
include the real SoC cpu id (0x5422).

For such case, the CPU name should be defined in device tree.

This commit introduces new device-tree property for Exynos:
- "cpu-model" - with cpu name string
If defined, then the cpu id is not printed.

Signed-off-by: Przemyslaw Marczak 
---
Changes V2:
- new commit
---
  arch/arm/cpu/armv7/s5p-common/cpu_info.c | 14 +-
  1 file changed, 13 insertions(+), 1 deletion(-)



Reviewed-by: Simon Glass 

Please see nit below.


diff --git a/arch/arm/cpu/armv7/s5p-common/cpu_info.c 
b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
index 154d674..97d611f 100644
--- a/arch/arm/cpu/armv7/s5p-common/cpu_info.c
+++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
@@ -5,9 +5,12 @@
   * SPDX-License-Identifier:GPL-2.0+
   */
  #include 
+#include 
  #include 
  #include 

+DECLARE_GLOBAL_DATA_PTR;
+
  /* Default is s5pc100 */
  unsigned int s5p_cpu_id = 0xC100;
  /* Default is EVT1 */
@@ -30,7 +33,16 @@ u32 get_device_type(void)
  #ifdef CONFIG_DISPLAY_CPUINFO
  int print_cpuinfo(void)
  {
-   printf("CPU:   %s%X @ ", s5p_get_cpu_name(), s5p_cpu_id);
+   const char *cpu_model = NULL;
+   int len = 0;


No need to init these two variables.



Ok, will correct this.


+
+   /* For SoC with no real CPU ID in naming convention. */
+   cpu_model = fdt_getprop(gd->fdt_blob, 0, "cpu-model", );
+   if (cpu_model)
+   printf("CPU:   %.*s @ ", len, cpu_model);
+   else
+   printf("CPU:   %s%X @ ", s5p_get_cpu_name(), s5p_cpu_id);
+
 print_freq(get_arm_clk(), "\n");

 return 0;
--
1.9.1





Best regards,
--
Przemyslaw Marczak
Samsung R Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] nios2: convert ioremap to use dm cpu data

2015-10-13 Thread Thomas Chou



On 10/05/2015 10:38 AM, Thomas Chou wrote:

Convert ioremap() to use io_region_base in dm cpu global data.

Also remove three unused io functions, which have style issue
and are replaced by macros already.

Signed-off-by: Thomas Chou 
---
  arch/nios2/include/asm/io.h | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)



Applied to u-boot-nios.


diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index 2200dab..d0adf08 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -44,13 +44,10 @@ static inline phys_addr_t virt_to_phys(void * vaddr)

  static inline void *ioremap(unsigned long physaddr, unsigned long size)
  {
-   return (void *)(IO_REGION_BASE | physaddr);
+   DECLARE_GLOBAL_DATA_PTR;
+   return (void *)(gd->arch.io_region_base | physaddr);
  }

-extern unsigned char inb (unsigned char *port);
-extern unsigned short inw (unsigned short *port);
-extern unsigned inl (unsigned port);
-
  #define __raw_writeb(v,a)   (*(volatile unsigned char  *)(a) = (v))
  #define __raw_writew(v,a)   (*(volatile unsigned short *)(a) = (v))
  #define __raw_writel(v,a)   (*(volatile unsigned int   *)(a) = (v))


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


[U-Boot] [PATCH 1/3] part:efi: add GUID for linux file system data

2015-10-13 Thread Patrick Delaunay
>From f8bb9413dfb4252f203cc1f2013266b155208128 Mon Sep 17 00:00:00 2001
From: Patrick Delaunay 
Date: Tue, 13 Oct 2015 15:55:54 +0200
Subject: [PATCH 1/3] part:efi: add GUID for linux file system data

Previously, Linux used the same GUID for the data partitions as Windows
(Basic data partition: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7).
This created problems when dual-booting Linux and Windows in UEFI-GPT
Setup, so a new GUID (Linux filesystem data:
0FC63DAF-8483-4772-8E79-3D69D8477DE4)
was defined jointly by GPT fdisk and GNU Parted developers.

Signed-off-by: Patrick Delaunay 
---
see https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
and nota 9

 include/part_efi.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/part_efi.h b/include/part_efi.h
index 3012b91..c8fc873 100644
--- a/include/part_efi.h
+++ b/include/part_efi.h
@@ -43,6 +43,9 @@
 #define PARTITION_BASIC_DATA_GUID \
 EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \
 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7)
+#define PARTITION_LINUX_FILE_SYSTEM_DATA_GUID \
+EFI_GUID(0x0FC63DAF, 0x8483, 0x4772, \
+0x8E, 0x79, 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4)
 #define PARTITION_LINUX_RAID_GUID \
 EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \
 0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e)
-- 
1.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] pci: pcie_imx: Fix hang on mx6qp

2015-10-13 Thread Fabio Estevam
PCI driver currently hangs on mx6qp.

Toggle the reset bit with the appropriate timings to fix the issue.

Based on the FSL kernel driver implementation.

Signed-off-by: Fabio Estevam 
---
Changes since v3:
- Remove blank line from commit log
Changes since v2:
- Remove unneeded blank line (Bin)

 arch/arm/include/asm/arch-mx6/iomux.h | 2 ++
 drivers/pci/pcie_imx.c| 8 
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/iomux.h 
b/arch/arm/include/asm/arch-mx6/iomux.h
index 9b3a91f..907cb40 100644
--- a/arch/arm/include/asm/arch-mx6/iomux.h
+++ b/arch/arm/include/asm/arch-mx6/iomux.h
@@ -18,6 +18,8 @@
 #define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
 #define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
 
+#define IOMUXC_GPR1_PCIE_SW_RST(1 << 29)
+
 /*
  * IOMUXC_GPR5 bit fields
  */
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 1568f20..f1e189e 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define PCI_ACCESS_READ  0
 #define PCI_ACCESS_WRITE 1
@@ -430,6 +431,10 @@ static int imx_pcie_write_config(struct pci_controller 
*hose, pci_dev_t d,
 static int imx6_pcie_assert_core_reset(void)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   if (is_mx6dqp())
+   setbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
 #if defined(CONFIG_MX6SX)
struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
 
@@ -536,6 +541,9 @@ static int imx6_pcie_deassert_core_reset(void)
 
enable_pcie_clock();
 
+   if (is_mx6dqp())
+   clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
+
/*
 * Wait for the clock to settle a bit, when the clock are sourced
 * from the CPU, we need about 30 ms to settle.
-- 
1.9.1

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


Re: [U-Boot] [PATCH] vf610twr: Enable all masks of CCGRx registers.

2015-10-13 Thread Otavio Salvador
On Mon, Oct 12, 2015 at 5:36 PM, Stefan Agner  wrote:
> On 2015-10-08 12:32, Anthony Felice wrote:
>> The CCGRx registers, or clock gating registers, can be set to disable or 
>> enable
>> clocks for devices on the vf610twr platform. Enabling masks for all CCGRx
>> registers allows Linux drivers, like snvs_rtc, and also MQX applications, to
>> work out-of-the-box. There are no real downsides to enabling all clocks, and
>> this has been done in previous Freescale releases of U-Boot for the Vybrid
>> Tower.
>
> I don't really agree with this patch. Linux should handle clocks for
> snvs_rtc properly, if the necessary clocks are assigned. At least it
> seems to work on a recent mainline kernel.
>
> As far as I remember there is a clock tree driver for Vybrid in MQX too,
> so it should be able to handle clocks.
>
> And, there is a downside with this approach: It will consume more power.
> Although, Linux will automatically disable unused clocks, at least the
> gates which it knows of. Hence, this will lead to a higher power
> consumption not only during boot time, but also during run time.

Agreed; the clocks enabled in the U-Boot should be the bare minimal to
get the CPU in an usable form, and all the rest should be handled by
the loaded operating system. There is no reason to increase power
consumption for every user when the kernel can handle it.

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


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Otavio Salvador
On Fri, Oct 9, 2015 at 5:38 PM, Anthony Felice  wrote:
> This commit fixes a typo in vf610twr DRAM init that was causing a hang in
> U-Boot for the Vybrid Tower. This typo was introduced in commit 3f353cecc
> (vf610: refactor DDRMC code).
>
> Signed-off-by: Anthony Felice 

Seems fine for me. Stefano?

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


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Fabio Estevam
On Fri, Oct 9, 2015 at 5:38 PM, Anthony Felice  wrote:
> This commit fixes a typo in vf610twr DRAM init that was causing a hang in
> U-Boot for the Vybrid Tower. This typo was introduced in commit 3f353cecc
> (vf610: refactor DDRMC code).
>
> Signed-off-by: Anthony Felice 

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


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Fabio Estevam
On Tue, Oct 13, 2015 at 12:28 PM, Fabio Estevam  wrote:
> On Fri, Oct 9, 2015 at 5:38 PM, Anthony Felice  
> wrote:
>> This commit fixes a typo in vf610twr DRAM init that was causing a hang in
>> U-Boot for the Vybrid Tower. This typo was introduced in commit 3f353cecc
>> (vf610: refactor DDRMC code).
>>
>> Signed-off-by: Anthony Felice 
>
> Reviewed-by: Fabio Estevam 

Also, adding the author of 3f353cecc ("vf610: refactor DDRMC code")
and the i.MX/Vybrid maintainer.

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


[U-Boot] [PATCH 3/3] uuid: add shorcut for known GUID

2015-10-13 Thread Patrick Delaunay
guid shorcut can be used in gpt command with guid parameter
  partitions = name=boot,size=0x6bc00,guid=data; \
   name=root,size=0x7538ba00,guid=linux;
  gpt write mmc 0 $partitions

and they are used to display the type of partition in "part list" command

  Partition Map for MMC device 0  --   Partition Type: EFI

  PartStart LBAEnd LBAName
Attributes
Type GUID
Partition GUID
10x00220x037f"boot"
attrs:0x
type:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type:data
guid:d117f98e-6f2c-d04b-a5b2-331a19f91cb2
20x03800x003a9fdc"root"
attrs:0x
type:0fc63daf-8483-4772-8e79-3d69d8477de4
type:linux
guid:25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay 
---

 disk/part_efi.c |  4 
 include/uuid.h  |  4 
 lib/uuid.c  | 62
+++--
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 25bf8f9..9118be0 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -223,6 +223,10 @@ void print_part_efi(block_dev_desc_t * dev_desc)
 uuid_bin = (unsigned char *)gpt_pte[i].partition_type_guid.b;
 uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
 printf("\ttype:\t%s\n", uuid);
+#ifdef CONFIG_PARTITION_TYPE_GUID
+if (!uuid_guid_get_str(uuid_bin, uuid))
+printf("\ttype:\t%s\n", uuid);
+#endif
 uuid_bin = (unsigned char *)gpt_pte[i].unique_partition_guid.b;
 uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
 printf("\tguid:\t%s\n", uuid);
diff --git a/include/uuid.h b/include/uuid.h
index 93027c1..15a14cd 100644
--- a/include/uuid.h
+++ b/include/uuid.h
@@ -36,6 +36,10 @@ enum {
 int uuid_str_valid(const char *uuid);
 int uuid_str_to_bin(char *uuid_str, unsigned char *uuid_bin, int
str_format);
 void uuid_bin_to_str(unsigned char *uuid_bin, char *uuid_str, int
str_format);
+#ifdef CONFIG_PARTITION_TYPE_GUID
+int uuid_guid_get_bin(char *uuid_str, unsigned char *uuid_bin);
+int uuid_guid_get_str(unsigned char *uuid_bin, char *uuid_str);
+#endif
 void gen_rand_uuid(unsigned char *uuid_bin);
 void gen_rand_uuid_str(char *uuid_str, int str_format);
 #endif
diff --git a/lib/uuid.c b/lib/uuid.c
index f6b4423..9805aa0 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -80,10 +80,63 @@ int uuid_str_valid(const char *uuid)
 return 1;
 }

+#ifdef CONFIG_PARTITION_TYPE_GUID
+const struct {
+char *string;
+efi_guid_t guid;
+} shorcut_guid[8] = {
+{"system", PARTITION_SYSTEM_GUID},
+{"mbr", LEGACY_MBR_PARTITION_GUID},
+{"msft", PARTITION_MSFT_RESERVED_GUID},
+{"data", PARTITION_BASIC_DATA_GUID},
+{"linux", PARTITION_LINUX_FILE_SYSTEM_DATA_GUID},
+{"raid", PARTITION_LINUX_RAID_GUID},
+{"swap", PARTITION_LINUX_SWAP_GUID},
+{"lvm", PARTITION_LINUX_LVM_GUID}
+};
+
+/*
+ * uuid_guid_get_bin() - this function get GUID bin for GUID shorcut string
+ *
+ * @param uuid_str - pointer to allocated array [7B]
+ * @param uuid_bin - pointer to allocated array for big endian output [16B]
+ */
+int uuid_guid_get_bin(char *uuid_str, unsigned char *uuid_bin)
+{
+int i;
+for (i = 0; i < 8; i++) {
+if (!strcmp(shorcut_guid[i].string, uuid_str)) {
+memcpy(uuid_bin, _guid[i].guid, 16);
+return 0;
+}
+}
+return -ENODEV;
+}
+
+/*
+ * uuid_guid_get_str() - this function get GUID shortcut string for GUID.
+ *
+ * @param uuid_bin - pointer to allocated array for big endian output [16B]
+ * @param uuid_str - pointer to allocated array [7B]
+ */
+int uuid_guid_get_str(unsigned char *uuid_bin, char *uuid_str)
+{
+int i;
+*uuid_str = 0;
+for (i = 0; i < 8; i++) {
+if (!memcmp(shorcut_guid[i].guid.b, uuid_bin, 16)) {
+strcpy(uuid_str, shorcut_guid[i].string);
+return 0;
+}
+}
+return -ENODEV;
+}
+#endif
+
 /*
  * uuid_str_to_bin() - convert string UUID or GUID to big endian binary
data.
  *
- * @param uuid_str - pointer to UUID or GUID string [37B]
+ * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut
  * @param uuid_bin - pointer to allocated array for big endian output [16B]
  * @str_format - UUID string format: 0 - UUID; 1 - GUID
  */
@@ -93,8 +146,13 @@ int uuid_str_to_bin(char *uuid_str, unsigned char
*uuid_bin, int str_format)
 uint32_t tmp32;
 uint64_t tmp64;

-if (!uuid_str_valid(uuid_str))
+if (!uuid_str_valid(uuid_str)) {
+#ifdef CONFIG_PARTITION_TYPE_GUID
+if (!uuid_guid_get_bin(uuid_str, uuid_bin))
+return 0;
+#endif
 return -EINVAL;
+}

 if (str_format == UUID_STR_FORMAT_STD) {
 tmp32 = cpu_to_be32(simple_strtoul(uuid_str, NULL, 16));
-- 
1.9.1
___
U-Boot mailing list

[U-Boot] [PATCH 2/3] gpt: add optional parameter guid in gpt command

2015-10-13 Thread Patrick Delaunay
code under flag CONFIG_PARTITION_TYPE_GUID
add parameter guid to select partition type guid

example of use with gpt command :

  partitions = uuid_disk=${uuid_gpt_disk};name=boot,start=0x4400,
  size=0x6bc00,uuid=${uuid_gpt_boot};name=root,start=0x7,
  size=0x7538ba00,uuid=${uuid_gpt_root},
  guid=0fc63daf-8483-4772-8e79-3d69d8477de4;

  gpt write mmc 0 $partitions

Signed-off-by: Patrick Delaunay 
---

 common/cmd_gpt.c | 17 +
 disk/part.c  |  9 +
 disk/part_efi.c  | 25 +
 include/part.h   |  3 +++
 4 files changed, 54 insertions(+)

diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index c56fe15..1e8f927 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -218,6 +218,23 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
 strcpy((char *)parts[i].uuid, p);
 free(val);
 }
+#ifdef CONFIG_PARTITION_TYPE_GUID
+/* guid */
+val = extract_val(tok, "guid");
+if (val) {
+/* 'guid' is optional */
+if (extract_env(val, ))
+p = val;
+if (strlen(p) >= sizeof(parts[i].guid)) {
+printf("Wrong guid format for partition %d\n",
+   i);
+errno = -4;
+goto err;
+}
+strcpy((char *)parts[i].guid, p);
+free(val);
+}
+#endif
 /* name */
 val = extract_val(tok, "name");
 if (!val) { /* name is mandatory */
diff --git a/disk/part.c b/disk/part.c
index 43485c9..316454d 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -391,6 +391,9 @@ int get_partition_info(block_dev_desc_t *dev_desc, int
part,
 /* The common case is no UUID support */
 info->uuid[0] = 0;
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUIDS
+info->guid[0] = 0;
+#endif

 switch (dev_desc->part_type) {
 #ifdef CONFIG_MAC_PARTITION
@@ -526,6 +529,9 @@ int get_device_and_partition(const char *ifname, const
char *dev_part_str,
 #ifdef CONFIG_PARTITION_UUIDS
 info->uuid[0] = 0;
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUIDS
+info->guid[0] = 0;
+#endif

 return 0;
 }
@@ -610,6 +616,9 @@ int get_device_and_partition(const char *ifname, const
char *dev_part_str,
 #ifdef CONFIG_PARTITION_UUIDS
 info->uuid[0] = 0;
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUIDS
+info->guid[0] = 0;
+#endif

 ret = 0;
 goto cleanup;
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 15627f2..25bf8f9 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -283,6 +283,10 @@ int get_partition_info_efi(block_dev_desc_t *
dev_desc, int part,
 uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid,
 UUID_STR_FORMAT_GUID);
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUID
+uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, info->guid,
+UUID_STR_FORMAT_GUID);
+#endif

 debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s\n", __func__,
   info->start, info->size, info->name);
@@ -419,6 +423,10 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
 char *str_uuid;
 unsigned char *bin_uuid;
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUID
+char *str_guid;
+unsigned char *bin_guid;
+#endif

 for (i = 0; i < parts; i++) {
 /* partition starting lba */
@@ -445,9 +453,26 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
 else
 gpt_e[i].ending_lba = cpu_to_le64(offset - 1);

+#ifdef CONFIG_PARTITION_TYPE_GUID
+str_guid = partitions[i].guid;
+bin_guid = gpt_e[i].partition_type_guid.b;
+if (strlen(str_guid)) {
+if (uuid_str_to_bin(str_guid, bin_guid,
+UUID_STR_FORMAT_GUID)) {
+printf("Partition no. %d: invalid type guid: %s\n",
+   i, str_guid);
+return -1;
+}
+} else {
+/* default partition type GUID */
+memcpy(bin_guid,
+   _BASIC_DATA_GUID, 16);
+}
+#else
 /* partition type GUID */
 memcpy(gpt_e[i].partition_type_guid.b,
 _BASIC_DATA_GUID, 16);
+#endif

 #ifdef CONFIG_PARTITION_UUIDS
 str_uuid = partitions[i].uuid;
diff --git a/include/part.h b/include/part.h
index 8ea9b30..d57d284 100644
--- a/include/part.h
+++ b/include/part.h
@@ -93,6 +93,9 @@ typedef struct disk_partition {
 #ifdef CONFIG_PARTITION_UUIDS
 charuuid[37];/* filesystem UUID as string, if exists*/
 #endif
+#ifdef CONFIG_PARTITION_TYPE_GUID
+charguid[37];/* type GUID as string, if exists*/
+#endif
 } disk_partition_t;

 /* Misc _get_dev functions */
-- 
1.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Albert ARIBAUD
Bonjour Fabio,

Le Tue, 13 Oct 2015 12:30:47 -0300, Fabio Estevam 
a écrit :

> On Tue, Oct 13, 2015 at 12:28 PM, Fabio Estevam  wrote:
> > On Fri, Oct 9, 2015 at 5:38 PM, Anthony Felice  
> > wrote:
> >> This commit fixes a typo in vf610twr DRAM init that was causing a hang in
> >> U-Boot for the Vybrid Tower. This typo was introduced in commit 3f353cecc
> >> (vf610: refactor DDRMC code).
> >>
> >> Signed-off-by: Anthony Felice 
> >
> > Reviewed-by: Fabio Estevam 
> 
> Also, adding the author of 3f353cecc ("vf610: refactor DDRMC code")
> and the i.MX/Vybrid maintainer.
> 
> Thanks

Thanks to Anthony for spotting and fixing this!

Cordialement,
Albert ARIBAUD
3ADEV
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] vf610twr: Fix typo in DRAM init

2015-10-13 Thread Fabio Estevam
Hi Stefano,

On Tue, Oct 13, 2015 at 5:12 PM, Albert ARIBAUD  wrote:

> Thanks to Anthony for spotting and fixing this!

This one fixes a regression. Please consider applying it to 2015.10.

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


[U-Boot] [PATCH v3] nios2: convert cache flush to use dm cpu data

2015-10-13 Thread Thomas Chou
Convert cache flush to use dm cpu data.

The original cache flush functions are written in assembly
and use CONFIG_SYS_{I,D}CACHE_SIZE... macros. It is difficult
to convert to use cache configuration in dm cpu data which is
extracted from device tree.

The cacheflush.c of Linux nios2 arch uses cpuinfo structure,
which is very close to our dm cpu data. So we copy and modify
it to arch/nios2/lib/cache.c to replace the old cache.S.

Signed-off-by: Thomas Chou 
---
v2
  change commit message.
v3
  check initda instruction support.
  add invalidate_dcache_range().

 arch/nios2/include/asm/cache.h |  13 ++---
 arch/nios2/lib/bootm.c |   6 +--
 arch/nios2/lib/cache.S |  68 
 arch/nios2/lib/cache.c | 114 +
 4 files changed, 118 insertions(+), 83 deletions(-)
 delete mode 100644 arch/nios2/lib/cache.S
 create mode 100644 arch/nios2/lib/cache.c

diff --git a/arch/nios2/include/asm/cache.h b/arch/nios2/include/asm/cache.h
index 9b87c9f..dde43cd 100644
--- a/arch/nios2/include/asm/cache.h
+++ b/arch/nios2/include/asm/cache.h
@@ -8,18 +8,11 @@
 #ifndef __ASM_NIOS2_CACHE_H_
 #define __ASM_NIOS2_CACHE_H_
 
-extern void flush_dcache (unsigned long start, unsigned long size);
-extern void flush_icache (unsigned long start, unsigned long size);
-
 /*
- * Valid L1 data cache line sizes for the NIOS2 architecture are 4, 16, and 32
- * bytes.  If the board configuration has not specified one we default to the
- * largest of these values for alignment of DMA buffers.
+ * Valid L1 data cache line sizes for the NIOS2 architecture are 4,
+ * 16, and 32 bytes. We default to the largest of these values for
+ * alignment of DMA buffers.
  */
-#ifdef CONFIG_SYS_CACHELINE_SIZE
-#define ARCH_DMA_MINALIGN  CONFIG_SYS_CACHELINE_SIZE
-#else
 #define ARCH_DMA_MINALIGN  32
-#endif
 
 #endif /* __ASM_NIOS2_CACHE_H_ */
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index c730a3f..4e5c269 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -6,9 +6,6 @@
  */
 
 #include 
-#include 
-#include 
-#include 
 
 #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
 
@@ -40,8 +37,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
 
/* flushes data and instruction caches before calling the kernel */
disable_interrupts();
-   flush_dcache((ulong)kernel, CONFIG_SYS_DCACHE_SIZE);
-   flush_icache((ulong)kernel, CONFIG_SYS_ICACHE_SIZE);
+   flush_dcache_all();
 
debug("bootargs=%s @ 0x%lx\n", commandline, (ulong));
debug("initrd=0x%lx-0x%lx\n", (ulong)initrd_start, (ulong)initrd_end);
diff --git a/arch/nios2/lib/cache.S b/arch/nios2/lib/cache.S
deleted file mode 100644
index 683f005..000
--- a/arch/nios2/lib/cache.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation 
- * Scott McNutt 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-
-   .text
-
-   .global flush_dcache
-
-flush_dcache:
-   add r5, r5, r4
-   movhi   r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
-   ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
-0: flushd  0(r4)
-   add r4, r4, r8
-   bltur4, r5, 0b
-   ret
-
-
-   .global flush_icache
-
-flush_icache:
-   add r5, r5, r4
-   movhi   r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
-   ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
-1: flushi  r4
-   add r4, r4, r8
-   bltur4, r5, 1b
-   ret
-
-   .global flush_dcache_range
-
-flush_dcache_range:
-   movhi   r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
-   ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
-0: flushd  0(r4)
-   add r4, r4, r8
-   bltur4, r5, 0b
-   ret
-
-   .global flush_cache
-
-flush_cache:
-   add r5, r5, r4
-   mov r9, r4
-   mov r10, r5
-
-   movhi   r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
-   ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
-0: flushd  0(r4)
-   add r4, r4, r8
-   bltur4, r5, 0b
-
-   mov r4, r9
-   mov r5, r10
-   movhi   r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
-   ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
-1: flushi  r4
-   add r4, r4, r8
-   bltur4, r5, 1b
-
-   sync
-   flushp
-   ret
diff --git a/arch/nios2/lib/cache.c b/arch/nios2/lib/cache.c
new file mode 100644
index 000..1108055
--- /dev/null
+++ b/arch/nios2/lib/cache.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2015 Thomas Chou 
+ * Copyright (C) 2009, Wind River Systems Inc
+ * Implemented by fredrik.markst...@gmail.com and ivarholmqv...@gmail.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void __flush_dcache(unsigned long start, unsigned long end)
+{
+   unsigned long addr;
+
+  

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

2015-10-13 Thread Thomas Chou
Convert dma_alloc_coherent to use memalign.

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

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

diff --git a/arch/nios2/include/asm/dma-mapping.h 
b/arch/nios2/include/asm/dma-mapping.h
index 1350e3b..118f734 100644
--- a/arch/nios2/include/asm/dma-mapping.h
+++ b/arch/nios2/include/asm/dma-mapping.h
@@ -1,23 +1,21 @@
 #ifndef __ASM_NIOS2_DMA_MAPPING_H
 #define __ASM_NIOS2_DMA_MAPPING_H
 
-/* dma_alloc_coherent() return cache-line aligned allocation which is mapped
+#include 
+#include 
+
+/*
+ * dma_alloc_coherent() return cache-line aligned allocation which is mapped
  * to uncached io region.
- *
- * IO_REGION_BASE should be defined in board config header file
- *   0x8000 for nommu, 0xe000 for mmu
  */
-
 static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
-   void *addr = malloc(len + CONFIG_SYS_DCACHELINE_SIZE);
-   if (!addr)
-   return 0;
-   flush_dcache((unsigned long)addr, len + CONFIG_SYS_DCACHELINE_SIZE);
-   *handle = ((unsigned long)addr +
-  (CONFIG_SYS_DCACHELINE_SIZE - 1)) &
-   ~(CONFIG_SYS_DCACHELINE_SIZE - 1) & ~(IO_REGION_BASE);
-   return (void *)(*handle | IO_REGION_BASE);
+   *handle = (unsigned long)malloc_cache_aligned(len);
+   if (!*handle)
+   return NULL;
+   invalidate_dcache_range(*handle, *handle + len);
+
+   return ioremap(*handle, len);
 }
 
 #endif /* __ASM_NIOS2_DMA_MAPPING_H */
-- 
2.1.4

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


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

2015-10-13 Thread Thomas Chou

Hi Marek,


On 10/12/2015 06:32 PM, Marek Vasut wrote:

Wouldn't invalidate_dcache_range() be enough here ? You don't care
about
the data in the newly allocated area at this point I guess -- either
you
fill them in and then flush, for DMA from CPU to device OR you receive
data from device to CPU and then you invalidate this buffer again.


Thanks a lot for your suggestion. I added invalidate_dcache_range() 
which will check if the initda instruction is supported by the nios2 cpu.


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