Re: [U-Boot] [PATCH 03/11 v2] drivers/net/vsc9953: Add default configuration for VSC9953 L2 Switch

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:26 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 03/11 v2] drivers/net/vsc9953: Add default
 configuration for VSC9953 L2 Switch
 
  diff --git a/drivers/net/vsc9953.c b/drivers/net/vsc9953.c index
  720ae47..9dec683 100644
  --- a/drivers/net/vsc9953.c
  +++ b/drivers/net/vsc9953.c
  @@ -1,5 +1,5 @@
   /*
  - *  Copyright 2014 Freescale Semiconductor, Inc.
  + *  Copyright 2014-2015 Freescale Semiconductor, Inc.
 
 This change should be moved to the last patch.
 
*
*  SPDX-License-Identifier:  GPL-2.0+
*
 
 snip
 
  diff --git a/include/vsc9953.h b/include/vsc9953.h index
  2b88c5c..bf81623 100644
  --- a/include/vsc9953.h
  +++ b/include/vsc9953.h
  @@ -7,7 +7,7 @@
*  terms of the GNU Public License, Version 2, incorporated
*  herein by reference.
*
  - * Copyright 2013  Freescale Semiconductor, Inc.
  + * Copyright 2013, 2015 Freescale Semiconductor, Inc.
 
 This change should be moved to the last patch.
 
*
*/
 
 
 snip

Ok, I will move these two changes in the last patch.

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


[U-Boot] [PATCH v2] ARM: UniPhier: drop special CONFIG_AUTOBOOT_ settings

2015-06-30 Thread Masahiro Yamada
There is no good reason to use a particular key to stop autobooting.
The default allows us to stop the autoboot with any key input.

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

Changes in v2:
  - Rebase on commit 7853d76b0

 configs/ph1_ld4_defconfig  | 4 
 configs/ph1_pro4_defconfig | 4 
 configs/ph1_sld8_defconfig | 4 
 3 files changed, 12 deletions(-)

diff --git a/configs/ph1_ld4_defconfig b/configs/ph1_ld4_defconfig
index 650201a..a71511c 100644
--- a/configs/ph1_ld4_defconfig
+++ b/configs/ph1_ld4_defconfig
@@ -7,10 +7,6 @@ CONFIG_DEFAULT_DEVICE_TREE=uniphier-ph1-ld4-ref
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_HUSH_PARSER=y
-CONFIG_AUTOBOOT_KEYED=y
-CONFIG_AUTOBOOT_PROMPT=Press SPACE to abort autoboot in %d seconds\n
-CONFIG_AUTOBOOT_DELAY_STR=d
-CONFIG_AUTOBOOT_STOP_STR= 
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_NAND=y
diff --git a/configs/ph1_pro4_defconfig b/configs/ph1_pro4_defconfig
index 7d8d9cc..d02712e 100644
--- a/configs/ph1_pro4_defconfig
+++ b/configs/ph1_pro4_defconfig
@@ -6,10 +6,6 @@ CONFIG_DEFAULT_DEVICE_TREE=uniphier-ph1-pro4-ref
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_HUSH_PARSER=y
-CONFIG_AUTOBOOT_KEYED=y
-CONFIG_AUTOBOOT_PROMPT=Press SPACE to abort autoboot in %d seconds\n
-CONFIG_AUTOBOOT_DELAY_STR=d
-CONFIG_AUTOBOOT_STOP_STR= 
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_NAND=y
diff --git a/configs/ph1_sld8_defconfig b/configs/ph1_sld8_defconfig
index 90c44ac..ee4cebc 100644
--- a/configs/ph1_sld8_defconfig
+++ b/configs/ph1_sld8_defconfig
@@ -7,10 +7,6 @@ CONFIG_DEFAULT_DEVICE_TREE=uniphier-ph1-sld8-ref
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_HUSH_PARSER=y
-CONFIG_AUTOBOOT_KEYED=y
-CONFIG_AUTOBOOT_PROMPT=Press SPACE to abort autoboot in %d seconds\n
-CONFIG_AUTOBOOT_DELAY_STR=d
-CONFIG_AUTOBOOT_STOP_STR= 
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_NAND=y
-- 
1.9.1

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


[U-Boot] git fsck errors with u-boot

2015-06-30 Thread Liam R. Howlett
Hello,

Since git 2.1, there have been a number of new fsck options added which
produce issues when I clone  fsck the repository
git://git.denx.de/u-boot.git

$ git fsck --full
Checking object directories: 100% (256/256), done.
error in tag eb394f56db3e05d00891d6dc36a00df0025cf255: unterminated
header
error in tag 9bf86baaa3b35b25baa2d664e2f7f6cafad689ee: unterminated
header
error in tag c7071e6d645a8e13adb0d4cea2caad27213fa62f: unterminated
header
Checking objects: 100% (325719/325719), done.
Checking connectivity: 325719, done.


These new tests are enabled by default when using git fsck.  I have been
testing with git version 2.4.4.409.g5b1d901 and thought you might want
to know so the error messages can be corrected.


I think these issues were already reported here:
https://www.mail-archive.com/u-boot@lists.denx.de/msg175411.html but
were not reproducible.   Can you see if they can be reproduced using a
newer git (2.4 or 2.3) and git fsck --full ?

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


Re: [U-Boot] [PATCH 06/11 v2] drivers/net/vsc9953: Add commands to enable/disable HW learning

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

I will make the changes you requested.

Thanks and best regards,
Codrin

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:38 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 06/11 v2] drivers/net/vsc9953: Add commands to
 enable/disable HW learning

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


[U-Boot] [PATCH] arm: convert am3517_crane and am3517_evm to generic boards

2015-06-30 Thread yegorslists
From: Yegor Yefremov yegorsli...@googlemail.com

Add CONFIG_SYS_GENERIC_BOARD to board's config header.

Boot-tested on am3517_evm board.

Signed-off-by: Yegor Yefremov yegorsli...@googlemail.com
---
 include/configs/am3517_crane.h |1 +
 include/configs/am3517_evm.h   |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h
index 2f4117d..6a0240b 100644
--- a/include/configs/am3517_crane.h
+++ b/include/configs/am3517_crane.h
@@ -19,6 +19,7 @@
 #define CONFIG_OMAP1   /* in a TI OMAP core */
 #define CONFIG_OMAP3_AM3517CRANE   1   /* working with CRANEBOARD */
 #define CONFIG_OMAP_COMMON
+#define CONFIG_SYS_GENERIC_BOARD
 /* Common ARM Erratas */
 #define CONFIG_ARM_ERRATA_454179
 #define CONFIG_ARM_ERRATA_430973
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index e5b4621..b90a60d 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -19,6 +19,7 @@
 #define CONFIG_OMAP1   /* in a TI OMAP core */
 #define CONFIG_OMAP3_AM3517EVM 1   /* working with AM3517EVM */
 #define CONFIG_OMAP_COMMON
+#define CONFIG_SYS_GENERIC_BOARD
 /* Common ARM Erratas */
 #define CONFIG_ARM_ERRATA_454179
 #define CONFIG_ARM_ERRATA_430973
-- 
1.7.7

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


Re: [U-Boot] [PATCH 05/11 v2] drivers/net/vsc9953: Add command to show/clear port counters

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

I will make the changes you requested.

Thanks and best regards,
Codrin

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:34 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 05/11 v2] drivers/net/vsc9953: Add command to
 show/clear port counters


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


Re: [U-Boot] FEL mode broken since sunxi: Move all boards to the driver-model

2015-06-30 Thread Ian Campbell
On Sun, 2015-06-28 at 17:28 +0200, Hans de Goede wrote:
 Right, that is expected, all the fel spl command does is load the
 spl, you need to do something like this to fel boot:

This worked, thanks. Couple of notes:

 
 sudo ~hans/bin/fel version
 echo Write SPL
 sudo ~hans/bin/fel spl u-boot-sunxi-with-spl.bin

FWIW also works with spl/sunxi-spl.bin.

 echo Exec SPL
 sudo ~hans/bin/fel exe 0x2000

Doesn't seem to be needed, it's done part of the above the above spl
command.

 sleep 0.5
 echo Write u-boot
 sudo ~hans/bin/fel write 0x4a00 u-boot-dtb.bin
 echo Exec u-boot
 sudo ~hans/bin/fel exe 0x4a00

I think it ought to be possible to update the usb-boot script to use
fel spl and relax the SPL size restriction in that script accordingly,
I'll take a look.

Ian.

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


Re: [U-Boot] [PATCH 03/11 v2] drivers/net/vsc9953: Add default configuration for VSC9953 L2 Switch

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

I removed the lines on which we agreed on...

   +   switch (mode) {
   +   case EGRESS_UNTAG_ALL:
   +   clrsetbits_le32(l2rew_reg-port[port_no].port_tag_cfg,
   +   CONFIG_VSC9953_TAG_CFG_MASK,
   +   CONFIG_VSC9953_TAG_CFG_NONE);
   +   break;
   +   case EGRESS_UNTAG_PVID_AND_ZERO:
   +   clrsetbits_le32(l2rew_reg-port[port_no].port_tag_cfg,
   +   CONFIG_VSC9953_TAG_CFG_MASK,
   +
   + CONFIG_VSC9953_TAG_CFG_ALL_PVID_ZERO);
 
  This seems like the naming is inverted. The enum value is called
  untag pvid and zero, but the config is called tag all pvid and
  zero. Is this a bug or just poorly named constants / enum values?
 
   +   break;
   +   case EGRESS_UNTAG_ZERO:
   +   clrsetbits_le32(l2rew_reg-port[port_no].port_tag_cfg,
   +   CONFIG_VSC9953_TAG_CFG_MASK,
   +   CONFIG_VSC9953_TAG_CFG_ALL_ZERO);
 
  Also here.
 
   +   break;
   +   case EGRESS_UNTAG_NONE:
   +   clrsetbits_le32(l2rew_reg-port[port_no].port_tag_cfg,
   +   CONFIG_VSC9953_TAG_CFG_MASK,
   +   CONFIG_VSC9953_TAG_CFG_ALL);
   +   break;
   +   default:
   +   printf(Unknown untag mode for port %d\n, port_no);
   +   }
 
  Yes, the naming is inverted. The main reason for this is that I
  couldn't find a short and easy to use command to configure a port's
  egress to send all frames VLAN tagged except when the VLAN ID equals the 
  Port
 VLAN ID.
  I decided to make a command to tell the switch for which VLAN ID's not
  to tag a frame (untag) instead of making a command to tell the switch
  for which VLAN IDs to tag the frame (tag). So, for example, the
  command ethsw [port port_no] tag all except pvid or ethsw [port
  port_no] tag !pvid became ethsw [port port_no] untagged pvid.
  If you think this is not intuitive for both users and developers, I
  will try to find something more appropriate.
 
 I don't have a problem with using the inverted logic if that's what typical 
 use-
 cases call for, what I was referring to was those two specific examples. The
 all and none seem correctly inverted.
 
 In the other 2 cases, the tag vs untag is inverted, but the subject is not
 PVID_AND_ZERO vs ALL_PVID_ZERO
 
 EGRESS_UNTAG_PVID_AND_ZERO -
 CONFIG_VSC9953_TAG_CFG_ALL_PVID_ZERO, for example. That's the discrepancy 
 I'm
 concerned about.

Ok, should I rename the constants to something like 
VSC9953_TAG_CFG_ALL_BUT_PRIV_ZERO instead of 
CONFIG_VSC9953_TAG_CFG_ALL_PVID_ZERO and VSC9953_TAG_CFG_ALL_BUT_ZERO instead 
of CONFIG_VSC9953_TAG_CFG_ALL_ZERO?

 
   +#define field_set(val, mask)   ((val) * ((mask)  ~((mask)  
   1)))
   +#define field_get(val, mask)   ((val) / ((mask)  ~((mask)  
   1)))
 
  I don't follow why this is unique to this chip? Also, get is never
  used. Is it just for completeness, I assume.
 
  I think you should either be using the functions in
  include/bitfield.h or you should be adding these there instead of
  here. If you decide to add them there, then naturally do it as a
  separate patch and with good comments and naming consistent with that
  file and as functions not macros. This method is nice in that you use
  the mask to define the shift instead of requiring it as a separate 
  constant.
 
  These are not unique to this chip. If you consider them useful, I will
  make a separate patch and add them (or something similar) to
  include/bitfield.h .
 
 I think this would be the best approach.

Ok, I will make another patch and add bitfield_set/get() inline functions in 
include/bitfield.h .

   +struct vsc9953_rew_common {
   +   u32 reserve[4];
   +   u32 dscp_remap_dp1_cfg[64];
   +   u32 dscp_remap_cfg[64];
   +};
   +
   +struct vsc9953_rew_reg {
   +   struct vsc9953_rew_port port[12];
   +   struct vsc9953_rew_common common; };
   +
   +/* END VSC9953 REW structure for T1040 U-boot*/
 
  These comments seem gratuitous and not particularly relevant (begin
  and end). Perhaps either remove them throughout the file or at least
  don't add more. At the very least, drop the  structure for T1040
  U-boot which isn't helpful or accurate.
 
 
  Yes, the  structure for T1040 U-boot seems irrelevant indeed. I will
  also remove the other comments if you consider them unnecessary. To me
  it looks like it groups the structures a bit and might help developers
  look for a specific register. I will remove them in the patch with the
  clean-up.
 
 If you think the bracketing of these structs adds clarity, then only remove 
 the
 trailing text. Otherwise remove all of them completely. Up to you; I'm fine 
 with
 either way.

Ok, I will remove the trailing text and I will see if the remaining comments 
make sense.

 
 Thanks,
 -Joe

Thanks 

Re: [U-Boot] [PATCH 1/8] JFFS2: Return early when file read not necessary

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

If a destination is not provided, jffs2_1pass_read_inode() only
returns the length of the file. In this case, avoid reading all
the data nodes, and return as soon as the length of the file is
known.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index b1d6470..2335db1 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -719,6 +719,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
}
put_fl_mem(jNode, pL-readbuf);
}
+   /* If no destination is provided, we are done.
+* Just return the total size.
+*/


please change this into

/*
 * If no destination is provided, we are done.
 * Just return the total size.
 */

to fit with Coding style.



+   if (!dest) {
+   return totalSize;
+   }


no {} needed

Beside of this:

Acked-by: Heiko Schocher h...@denx.de

bye,
Heiko

  #endif

for (b = pL-frag.listHead; b != NULL; b = b-next) {



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/8] JFFS2: Speed up and fix comparison functions

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

Copying complete nodes from flash can be slow if the flash is slow
to read. By only reading the data needed, the sorting operation can
be made much faster.

The directory entry comparison function also had a two bugs. First, it
did not ensure the name was copied, so the name comparison may have
been faulty (although it would have worked with NOR flash).  Second,
setting the ino to zero to ignore the entry did not work, since this
was either writing to a temporary buffer, or (for NOR flash) directly
to flash. Either way, the change was not remembered.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 82 ++
  1 file changed, 42 insertions(+), 40 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 2335db1..079bb73 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -598,14 +598,17 @@ insert_node(struct b_list *list, u32 offset)
   */
  static int compare_inodes(struct b_node *new, struct b_node *old)
  {
-   struct jffs2_raw_inode ojNew;
-   struct jffs2_raw_inode ojOld;
-   struct jffs2_raw_inode *jNew =
-   (struct jffs2_raw_inode *)get_fl_mem(new-offset, sizeof(ojNew), 
ojNew);
-   struct jffs2_raw_inode *jOld =
-   (struct jffs2_raw_inode *)get_fl_mem(old-offset, sizeof(ojOld), 
ojOld);
-
-   return jNew-version  jOld-version;
+   /* Only read in the version info from flash, not the entire inode.


please fix your comment style globally, thanks1


+* This can make a big difference to speed if flash is slow.
+*/
+   u32 new_version;
+   u32 old_version;
+   get_fl_mem(new-offset + offsetof(struct jffs2_raw_inode, version),
+  sizeof(new_version), new_version);
+   get_fl_mem(old-offset + offsetof(struct jffs2_raw_inode, version),
+  sizeof(old_version), old_version);
+
+   return new_version  old_version;
  }

  /* Sort directory entries so all entries in the same directory
@@ -615,42 +618,41 @@ static int compare_inodes(struct b_node *new, struct 
b_node *old)
   */
  static int compare_dirents(struct b_node *new, struct b_node *old)
  {
-   struct jffs2_raw_dirent ojNew;
-   struct jffs2_raw_dirent ojOld;
-   struct jffs2_raw_dirent *jNew =
-   (struct jffs2_raw_dirent *)get_fl_mem(new-offset, sizeof(ojNew), 
ojNew);
-   struct jffs2_raw_dirent *jOld =
-   (struct jffs2_raw_dirent *)get_fl_mem(old-offset, sizeof(ojOld), 
ojOld);
-   int cmp;
-
-   /* ascending sort by pino */
-   if (jNew-pino != jOld-pino)
-   return jNew-pino  jOld-pino;
-
-   /* pino is the same, so use ascending sort by nsize, so
-* we don't do strncmp unless we really must.
-*/
-   if (jNew-nsize != jOld-nsize)
-   return jNew-nsize  jOld-nsize;
-
-   /* length is also the same, so use ascending sort by name
-*/
-   cmp = strncmp((char *)jNew-name, (char *)jOld-name, jNew-nsize);
-   if (cmp != 0)
-   return cmp  0;
-
-   /* we have duplicate names in this directory, so use ascending
-* sort by version
+   /* Using NULL as the buffer for NOR flash prevents the entire node
+* being read. This makes most comparisons much quicker as only one
+* or two entries from the node will be used most of the time.
 */
-   if (jNew-version  jOld-version) {
-   /* since jNew is newer, we know jOld is not valid, so
-* mark it with inode 0 and it will not be used
+   struct jffs2_raw_dirent *jNew = get_node_mem(new-offset, NULL);
+   struct jffs2_raw_dirent *jOld = get_node_mem(old-offset, NULL);
+   int cmp;
+   int ret;
+
+   if (jNew-pino != jOld-pino) {
+   /* ascending sort by pino */
+   ret = jNew-pino  jOld-pino;
+   } else if (jNew-nsize != jOld-nsize) {
+   /* pino is the same, so use ascending sort by nsize, so
+* we don't do strncmp unless we really must.
 */
-   jOld-ino = 0;
-   return 1;
+   ret = jNew-nsize  jOld-nsize;
+   } else {
+   /* length is also the same, so use ascending sort by name
+*/
+   cmp = strncmp((char *)jNew-name, (char *)jOld-name,
+   jNew-nsize);
+   if (cmp != 0) {
+   ret = cmp  0;
+   } else {
+   /* we have duplicate names in this directory,
+* so use ascending sort by version
+*/
+   ret = jNew-version  jOld-version;
+   }
}
+   put_fl_mem(jNew, NULL);
+   put_fl_mem(jOld, NULL);

-   return 0;
+   return ret;
  }
  #endif


Reviewed-by: 

Re: [U-Boot] [PATCH 4/8] JFFS2: Improve speed reading flash files

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

jffs2_1pass_read_inode() would read the entire data for each node
in the filesystem, regardless of whether it was part of the file
to be loaded or not. By only reading the header data for an inode,
and then reading the data only when it is found to be part of the
file to be loaded, much copying of data is saved.

jffs2_1pass_list_inodes() read each inode for every file in the
directory into a buffer. By using NULL as a buffer pointer, NOR
flash simply returns a pointer, and therefore avoids a memory copy.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 25 +++--
  1 file changed, 19 insertions(+), 6 deletions(-)


Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 1f6eea7..80210be 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -730,8 +730,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
  #endif

for (b = pL-frag.listHead; b != NULL; b = b-next) {
-   jNode = (struct jffs2_raw_inode *) get_node_mem(b-offset,
-   pL-readbuf);
+   /* Copy just the node and not the data at this point,
+* since we don't yet know if we need this data.
+*/
+   jNode = (struct jffs2_raw_inode *)get_fl_mem(b-offset,
+   sizeof(struct jffs2_raw_inode),
+   pL-readbuf);
if (inode == jNode-ino) {
  #if 0
putLabeledWord(\r\n\r\nread_inode: totlen = , 
jNode-totlen);
@@ -755,7 +759,14 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
  #endif

if(dest) {
-   src = ((uchar *) jNode) + sizeof(struct 
jffs2_raw_inode);
+   /* Now that the inode has been checked,
+* read the entire inode, including data.
+*/
+   put_fl_mem(jNode, pL-readbuf);
+   jNode = (struct jffs2_raw_inode *)
+   get_node_mem(b-offset, pL-readbuf);
+   src = ((uchar *)jNode) +
+   sizeof(struct jffs2_raw_inode);
/* ignore data behind latest known EOF */
if (jNode-offset  totalSize) {
put_fl_mem(jNode, pL-readbuf);
@@ -962,7 +973,6 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
pL-readbuf);
if (pino == jDir-pino) {
u32 i_version = 0;
-   struct jffs2_raw_inode ojNode;
struct jffs2_raw_inode *jNode, *i = NULL;
struct b_node *b2;

@@ -997,8 +1007,10 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)

for (b2 = pL-frag.listHead; b2; b2 = b2-next) {
jNode = (struct jffs2_raw_inode *)
-   get_fl_mem(b2-offset, sizeof(ojNode), 
ojNode);
-   if (jNode-ino == jDir-ino  jNode-version 
= i_version) {
+   get_fl_mem(b2-offset, sizeof(*jNode),
+  NULL);
+   if (jNode-ino == jDir-ino 
+   jNode-version = i_version) {
i_version = jNode-version;
if (i)
put_fl_mem(i, NULL);
@@ -1011,6 +1023,7 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
   sizeof(*i),
   NULL);
}
+   put_fl_mem(jNode, NULL);
}

dump_inode(pL, jDir, i);



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/8] JFFS2: Only list each directory entry once

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

If multiple versions of a file exist, only the most recent version
should be used. The scheme to write 0 for the inode in older versions
did not work, since this would have required writing to flash.

The only time this caused an issue was listing a directory, where older
versions of the file would still be seen. Since the directory entries
are sorted, just look at the next entry in the list, and if it's the same
move to that entry instead.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 37 -
  1 file changed, 32 insertions(+), 5 deletions(-)


Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 079bb73..1f6eea7 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -840,7 +840,6 @@ jffs2_1pass_find_inode(struct b_lists * pL, const char 
*name, u32 pino)
jDir = (struct jffs2_raw_dirent *) get_node_mem(b-offset,
pL-readbuf);
if ((pino == jDir-pino)  (len == jDir-nsize) 
-   (jDir-ino)/* 0 for unlink */
(!strncmp((char *)jDir-name, name, len))) { /* a match 
*/
if (jDir-version  version) {
put_fl_mem(jDir, pL-readbuf);
@@ -961,13 +960,42 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
for (b = pL-dir.listHead; b; b = b-next) {
jDir = (struct jffs2_raw_dirent *) get_node_mem(b-offset,
pL-readbuf);
-   if ((pino == jDir-pino)  (jDir-ino)) { /* ino=0 - unlink */
+   if (pino == jDir-pino) {
u32 i_version = 0;
struct jffs2_raw_inode ojNode;
struct jffs2_raw_inode *jNode, *i = NULL;
-   struct b_node *b2 = pL-frag.listHead;
+   struct b_node *b2;

-   while (b2) {
+#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
+   /* Check for more recent versions of this file */
+   int match;
+   do {
+   struct b_node *next = b-next;
+   struct jffs2_raw_dirent *jDirNext;
+   if (!next)
+   break;
+   jDirNext = (struct jffs2_raw_dirent *)
+   get_node_mem(next-offset, NULL);
+   match = jDirNext-pino == jDir-pino 
+   jDirNext-nsize == jDir-nsize 
+   strncmp((char *)jDirNext-name,
+   (char *)jDir-name,
+   jDir-nsize) == 0;
+   if (match) {
+   /* Use next. It is more recent */
+   b = next;
+   /* Update buffer with the new info */
+   *jDir = *jDirNext;
+   put_fl_mem(jDirNext, NULL);
+   }
+   } while (match);
+#endif
+   if (jDir-ino == 0) {
+   /* Deleted file */
+   continue;
+   }
+
+   for (b2 = pL-frag.listHead; b2; b2 = b2-next) {
jNode = (struct jffs2_raw_inode *)
get_fl_mem(b2-offset, sizeof(ojNode), 
ojNode);
if (jNode-ino == jDir-ino  jNode-version 
= i_version) {
@@ -983,7 +1011,6 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
   sizeof(*i),
   NULL);
}
-   b2 = b2-next;
}

dump_inode(pL, jDir, i);



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/11 v2] drivers/net/vsc9953: Refractor the parser for VSC9953 commands

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:31 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 04/11 v2] drivers/net/vsc9953: Refractor the 
 parser
 for VSC9953 commands
 
   static struct vsc9953_info vsc9953_l2sw = { @@ -575,6 +576,10 @@ void
  vsc9953_init(bd_t *bis)  }
 
   #ifdef CONFIG_VSC9953_CMD
 
 I'd like to see this moved to its own file in common... maybe
 common/cmd_ethsw.c. I'd also like to see this #define change to something 
 like
 CONFIG_CMD_ETHSW.
 
 These changes don't necessarily need to be part of this series, since it 
 already
 got in as is, but if you feel motivated, I would recommend you add a patch
 before this one that moves it.

I could move this parser in common/do_ethsw.c and rename the define. I guess 
this would imply that upcoming drivers for Ethernet L2 Switches could use the 
same commands while calling their specific functions.

  -/* function to interpret commands starting with ethsw  */ -static
  int do_ethsw(cmd_tbl_t *cmdtp, int flag, int argc, char * const
  argv[])
  +struct command_def {
  +   int cmd_to_keywords[VSC9953_MAX_CMD_PARAMS];
  +   int cmd_keywords_nr;
  +   int port;
  +   int err;
 
 Remove this. Just use a return value.

Ok, I will remove err and all the other references to it.

  +#define VSC9953_PORT_CONF_HELP [port port_no] { enable | disable |
  +show }  \
  +- enable/disable a port; show shows a port's configuration
 
 Probably better to define this down by the use.

Ok.

  return -1;
 
 Please use return CMD_RET_USAGE; from include/command.h.

Ok, I wasn't aware of these macros. I will make use them in this patch set when 
it's appropriate.

  +/* match optional keywords */
  +static void cmd_keywords_opt_check(struct command_def *parsed_cmd,
  +  int *argc_val) {
  +   int i, keyw_opt_id, argc_val_max;
 
 Use a single space. Put each var on a separate line.

Ok, I will make sure this applies throughout the whole patch set.

 
  +
  +   /* remember the best match */
  +   argc_val_max = *argc_val;
  +
  +   for (i = 0; i  ARRAY_SIZE(cmd_opt_def); i++) {
  +   keyw_opt_id = 0;
  +   while (keyw_opt_id + *argc_val 
  +   parsed_cmd-cmd_keywords_nr 
  +  cmd_opt_def[i].cmd_keyword[keyw_opt_id] != id_key_end
 
  +  parsed_cmd-cmd_to_keywords[keyw_opt_id + *argc_val] 
  ==
  +  cmd_opt_def[i].cmd_keyword[keyw_opt_id])
  +   keyw_opt_id++;
 
 It might help to break this up a bit and use some intermediate variables to 
 make
 the code more readable.

Ok.

 
  +   if (keyw_opt_id  keyw_opt_id + *argc_val =
  +  parsed_cmd-cmd_keywords_nr 
  +   cmd_opt_def[i].cmd_keyword[keyw_opt_id] == id_key_end 
  +   (*argc_val + keyw_opt_id  argc_val_max))
 
 This could benefit from a comment describing what you expect to be verified.

Ok.

  +
  +   for (i = 0; i  ARRAY_SIZE(cmd_def); i++) {
  +   keyword_id = 0;
  +   while (keyword_id + *argc_val  parsed_cmd-cmd_keywords_nr 
  
  +  cmd_def[i].cmd_keyword[keyword_id] != id_key_end 
  +  parsed_cmd-cmd_to_keywords[keyword_id + *argc_val] 
  ==
  + cmd_def[i].cmd_keyword[keyword_id])
  +   keyword_id++;
 
 It might help to break this up a bit and use some intermediate variables to 
 make
 the code more readable.

Ok.

 
  +   if (keyword_id  keyword_id + *argc_val ==
  + parsed_cmd-cmd_keywords_nr 
  +   cmd_def[i].cmd_keyword[keyword_id] == id_key_end)
  + {
 
 This could benefit from a comment describing what you expect to be verified.

Ok.

  +/* find all the keywords in the command */ static void
  +keywords_find(int argc, char * const argv[],
 
 Make this function return an int.

Ok. I will also make the changes along this patch to check it’s return code.

  +static void command_def_cleanup(struct command_def *parsed_cmd) {
  +   /* Nothing to do for now */
 
 Then why define it?

This function is populated later by another patch and it frees a dynamically 
allocated buffer. You suggested to use a static buffer instead, so I guess I 
will remove this functions since it's no longer needed.

  +   if (!parsed_cmd.cmd_function) {
  +   rc = -1;
  +   goto __ret_cmd_cleanup;
  +   }
 
 I think this whole if statement is unneeded since this same test already 
 exists
 in keywords_find().

Ok.


Thanks and best regards,
Codrin


___
U-Boot mailing list
U-Boot@lists.denx.de

Re: [U-Boot] [PATCH] imx: imximage: add new CHECK/CLR BIT command

2015-06-30 Thread Peng Fan
Hi Stefano,

On Sun, Jun 28, 2015 at 01:00:07PM +0200, Stefano Babic wrote:
Hi Peng,

On 14/06/2015 11:38, Peng Fan wrote:
 Since rom code supports the following commands, add new commands support in
 imximage.
 

It is better to explain here which i.MX are supporting this ROM (i.MX6
and i.MX7).

Ok. Will fix this.



 1. CHECK_BITS_SET 4 [address] [mask bit]
means:
while ((*address  mask) != mask);
 
 2. CHECK_BITS_CLR 4 [address] [mask bit]
means:
while ((*address  ~mask) != 0);
 
 2. CLR_BIT 4 [address] [mask bit]
means:
*address = *address  ~mask;

I understand that the command to be added is CHECK_DATA_COMMAND, as
reported by manual. The TAG for the command is the same (0xCF), that
means we have a single command with different parameters.
It is better to follow the same approach in the code, because it is easy
to find the relatd documentation in manual. In this patch, it looks like
we have different commands, but this is not true: there is one command
with different parameters.

Yeah, you are right. CHECK_BITS_SET/CLR corresponds to CHECK_DATA_COMMAND.
CLR_BIT corresponds to WRITE_DATA_COMMAND, with mask=1, set=0.

The reason to add different commands but not one CHECK_DATA_COMMAND is that
compatible with current implementation.
Current DCD supports DATA 4 addr value. If want to use one CHECK_DATA_COMMAND
to cover CHECK_BITS_SET/CLR, we need another entry, then commands like this:
CHECK_DATA 4 addr mask [SET or CLR], which will make code more complex. So,
I choose to make CHECK_BITS_SET/CLR different commands, but not one CHECK_DATA
command.

Since 4 is not used for V2, how about CHECK_DATA SET addr mask and
CHECK_DATA CLR addr mask?


 
 dcd_v2_t is redefined, because there may not be only one write data command,
 there may be many different commands like CHECK_BITS_SET, CHECK_BITS_CLR and
 CLR_BIT.

I disagree or maybe this is related to i.MX7, where I could not check
the documentation. Please explain here: I see only one command
(CHECK_DATA_COMMAND, Chapter 8.7.2.2 in i.MX6Q).

i.MX7 needs CHECK_DATA_COMMAND to wait some bits set, because CHECK_BITS_SET
is implemented, so I call it a command:)
Yeah, there is only one CHECK_DATA_COMMAND. I'll refine this piece commit msg.


 
 dcd_len is still leaved there, since changing it needs changes for dcd v1.
 For v2, we check whether dcd size is larger than MAX_DCD_SIZE_V2, but not
 dcd_len.

It is just a bit confusing, and these are details in implementation -
they are not related to the commit where you explain the new feature.
Move these comments inside the code where they belong to.

Ok. Will do.


 
 Signed-off-by: Peng Fan peng@freescale.com
 ---
  tools/imximage.c | 129 
 ++-
  tools/imximage.h |  24 +--
  2 files changed, 119 insertions(+), 34 deletions(-)
 
 diff --git a/tools/imximage.c b/tools/imximage.c
 index 6f469ae..1c0225d 100644
 --- a/tools/imximage.c
 +++ b/tools/imximage.c
 @@ -22,6 +22,9 @@ static table_entry_t imximage_cmds[] = {
  {CMD_BOOT_FROM, BOOT_FROM,boot command,   },
  {CMD_BOOT_OFFSET,   BOOT_OFFSET,  Boot offset,},
  {CMD_DATA,  DATA, Reg Write Data, },
 +{CMD_CLR_BIT,   CLR_BIT,  Reg clear bit,  },
 +{CMD_CHECK_BITS_SET,CHECK_BITS_SET,   Reg Check bits set, },
 +{CMD_CHECK_BITS_CLR,CHECK_BITS_CLR,   Reg Check bits clr, },

The table reflects Freescale's documentation. This has the big advantage
because there is no need to explain which command is supposed to do
because this is really well done by Freescale in the manuals. Here we
should have only an additional entry due to CHECK_DATA_COMMAND, exactly
what the SOC is able to do.

Back to the question, why I implemented CHECK_BITS_SET/CLR, but not
CHECK_DATA_COMMAND. I do not want to introduce more entry in one DCD entry
such as CHECK_DATA 4 addr mask [CLR/SET], so I use two software commands
to cover CHECK_DATA_COMMAND.


  {CMD_CSF,   CSF,   Command Sequence File, },
  {CMD_IMAGE_VERSION, IMAGE_VERSION,image version,  },
  {-1,, ,   },
 @@ -84,6 +87,7 @@ static set_imx_hdr_t set_imx_hdr;
  static uint32_t max_dcd_entries;
  static uint32_t *header_size_ptr;
  static uint32_t *csf_ptr;
 +static uint32_t dataindex;
  
  static uint32_t get_cfg_value(char *token, char *name,  int linenr)
  {
 @@ -129,7 +133,7 @@ static void err_imximage_version(int version)
  }
  
  static void set_dcd_val_v1(struct imx_header *imxhdr, char *name, int 
 lineno,
 -int fld, uint32_t value, uint32_t off)
 +   int fld, int cmd, uint32_t value, uint32_t off)
  {

Parameter list is becoming very long compared to first implementation.

Let's see what we can do. We have function pointers to override a
specific behaviour for a SOC (V1 or V2). 

Re: [U-Boot] [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

2015-06-30 Thread Kushwaha Prabhakar

 -Original Message-
 From: s...@google.com [mailto:s...@google.com] On Behalf Of Simon Glass
 Sent: Tuesday, June 30, 2015 8:28 PM
 To: Kushwaha Prabhakar-B32579
 Cc: Wood Scott-B07421; Sun York-R58495; tr...@konsulko.com; u-
 b...@lists.denx.de; Dharmakan Rohit-B30502
 Subject: Re: [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null-
 pointer-checks
 
 Hi,
 
 On 29 June 2015 at 22:18, Kushwaha Prabhakar prabha...@freescale.com
 wrote:
  Hi Simon, Tom,
 
  -fdelete-null-pointer-checks flag controls global dataflow analyses and
 eliminate useless checks for null pointers; It assume that if a pointer is
 checked after it has already been dereferenced, it cannot be null.  This flag 
 is
 enabled by default.
   gcc v4.9 has more optimizations added to this option. Hence it is very
 aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9
 release notes:
  https://gcc.gnu.org/gcc-4.9/porting_to.html
 
  There is possibility after moving to gcc-4.9 some platform may/may not
 work properly.
  I tested this patch for freescale powerpc platforms.
  But It may needs be taken care by all architecture like ARM, powerpc.
  If this is the case; this flag should be in top level Makefile (not
  sure)
 
 
 I suspect a top-level option would be best, perhaps near this one in Makefile:
 
 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
 

I agree to put it here. 

But how to test it against different platform supported by u-boot.  

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


Re: [U-Boot] [PATCH v6 1/5] dm: sf: Add Atmel DataFlash spi flash driver

2015-06-30 Thread Wang Haikun
On 6/30/2015 7:24 PM, Jagan Teki wrote:
 Hi Haikun,

 On 30 June 2015 at 04:48, Simon Glass s...@chromium.org wrote:
 Hi,

 On 26 June 2015 at 05:30, Haikun Wang haikun.w...@freescale.com wrote:
 Atmel DataFlash chips have commands different from common spi
 flash commands.
 Atmel DataFlash also have special page-size.
 This driver add support for accessing Atmel DataFlash.
 It is based on the Driver Model.
 Example:
 = sf probe 1:0
 SPI DataFlash: Detected AT45DB021B with page size 264 Bytes, erase size 264 
 Bytes, total 264 KiB, revision d
 = sf erase 0 42000
 SF: 270336 bytes @ 0x0 Erased: OK
 = mw.l 8200 45444342 2
 = sf write 8200 0 42000
 SF: 270336 bytes @ 0x0 Written: OK
 = sf read 8300 0 42000
 SF: 270336 bytes @ 0x0 Read: OK
 = cmp.b 8200 8300 42000
 Total of 270336 byte(s) were the same

 Signed-off-by: Haikun Wang haikun.w...@freescale.com

 Reviewed-by: Simon Glass s...@chromium.org

 The driver model stuff looks fine. But see some nits/suggestions below.

 Can you fix this and send a patch on top of master.
Hi Jagan,

You want me send a extra patch to fix those issues?


 ---
 Verified with AT45DB021B on LS1021AQDS.
 Changes in v6:
 - Add defconfig patch in this series

 Changes in v5:
 - Change CONFIG_DM_SF_DATAFLASH to CONFIG_SF_DATAFLASH

 Changes in v4:
 - Use dev_get_priv and dev_get_uclass_priv
 - Add test log to commit message

 Changes in v3:
 - 1. Rename file spi_dataflash.c to sf_dataflash.c
 - 2. Add comment for array dataflash_data

 Changes in v2:
 - 1. Correct comment style
 - 2. Use get_timer in dataflash_waitready to check whether timeout
 - 3. Remove struct spi_flash * in struct dataflash, and get it from 
 udevice-uclass_priv
 - 4. Replace spi_flash_write_common with spi_flash_cmd_write
 - 5. Replace spi_flash_read with spi_flash_cmd_read
 - 6. Change type of varible status form char to u8 in dataflash_status
 - 7. Change add_dataflash's argument type due to change 3
 - 8. Add claim_bus and release_bus in erase/write/read due to change 4  5

 Changes in v1: None
   drivers/mtd/spi/Makefile   |   1 +
   drivers/mtd/spi/sf_dataflash.c | 711 
 +
   2 files changed, 712 insertions(+)
   create mode 100644 drivers/mtd/spi/sf_dataflash.c

 diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
 index c61b784..87f20bc 100644
 --- a/drivers/mtd/spi/Makefile
 +++ b/drivers/mtd/spi/Makefile
 @@ -15,6 +15,7 @@ endif
   #ifndef CONFIG_DM_SPI
   obj-$(CONFIG_SPI_FLASH) += sf_probe.o
   #endif
 +obj-$(CONFIG_SF_DATAFLASH) += sf_dataflash.o
   obj-$(CONFIG_CMD_SF) += sf.o
   obj-$(CONFIG_SPI_FLASH) += sf_ops.o sf_params.o
   obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
 diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
 new file mode 100644
 index 000..d287db8
 --- /dev/null
 +++ b/drivers/mtd/spi/sf_dataflash.c
 @@ -0,0 +1,711 @@
 +/*
 + *
 + * Atmel DataFlash probing
 + *
 + * Copyright (C) 2004-2009, 2015 Freescale Semiconductor, Inc.
 + * Haikun Wang (haikun.w...@freescale.com)
 + *
 + * SPDX-License-Identifier:GPL-2.0+
 +*/
 +#include common.h
 +#include dm.h
 +#include errno.h
 +#include fdtdec.h
 +#include spi.h
 +#include spi_flash.h
 +#include div64.h
 +#include linux/err.h
 +#include linux/math64.h
 +
 +#include sf_internal.h
 +
 +/*
 + * DataFlash is a kind of SPI flash.  Most AT45 chips have two buffers in
 + * each chip, which may be used for double buffered I/O; but this driver
 + * doesn't (yet) use these for any kind of i/o overlap or prefetching.
 + *
 + * Sometimes DataFlash is packaged in MMC-format cards, although the
 + * MMC stack can't (yet?) distinguish between MMC and DataFlash
 + * protocols during enumeration.
 + */
 +
 +/* reads can bypass the buffers */
 +#define OP_READ_CONTINUOUS 0xE8
 +#define OP_READ_PAGE   0xD2
 +
 +/* group B requests can run even while status reports busy */
 +#define OP_READ_STATUS 0xD7/* group B */
 +
 +/* move data between host and buffer */
 +#define OP_READ_BUFFER10xD4/* group B */
 +#define OP_READ_BUFFER20xD6/* group B */
 +#define OP_WRITE_BUFFER1   0x84/* group B */
 +#define OP_WRITE_BUFFER2   0x87/* group B */
 +
 +/* erasing flash */
 +#define OP_ERASE_PAGE  0x81
 +#define OP_ERASE_BLOCK 0x50
 +
 +/* move data between buffer and flash */
 +#define OP_TRANSFER_BUF1   0x53
 +#define OP_TRANSFER_BUF2   0x55
 +#define OP_MREAD_BUFFER1   0xD4
 +#define OP_MREAD_BUFFER2   0xD6
 +#define OP_MWERASE_BUFFER1 0x83
 +#define OP_MWERASE_BUFFER2 0x86
 +#define OP_MWRITE_BUFFER1  0x88/* sector must be pre-erased */
 +#define OP_MWRITE_BUFFER2  0x89/* sector must be pre-erased */
 +
 +/* write to buffer, then write-erase to flash */
 +#define OP_PROGRAM_VIA_BUF10x82
 +#define OP_PROGRAM_VIA_BUF20x85
 +
 +/* compare buffer to flash */
 +#define OP_COMPARE_BUF10x60
 

Re: [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions

2015-06-30 Thread Josh Wu

Hi,

Any feedback for this series patch?

Best Regards,
Josh Wu

On 6/11/2015 1:21 PM, Josh Wu wrote:

This series is based on the patch I sent:
   http://patchwork.ozlabs.org/patch/481095/
As above introduces the default empty function for invalidate_dcache_range() 
flush_dcache_range() in arch/arm/lib/cache.c.
So in this series, we can drop the empty stubs in arch/arm/cpu/

Also this series introduces a default function for flush_cache().


Josh Wu (2):
   ARM: cache: drop the empty dcache functions as we have it in
 lib/cache.c
   ARM: cache: implement a default flush_cache() function

  arch/arm/cpu/arm1136/cpu.c | 17 -
  arch/arm/cpu/arm926ejs/cache.c | 17 -
  arch/arm/cpu/armv7/cache_v7.c  | 21 -
  arch/arm/cpu/armv8/cache_v8.c  | 16 
  arch/arm/lib/cache.c   | 26 +-
  5 files changed, 5 insertions(+), 92 deletions(-)



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


[U-Boot] [PATCH][v8] mpc85xx/T104xD4RDB: Add T104xD4RDB boards support

2015-06-30 Thread Priyanka Jain
T1040D4RDB is a Freescale reference board that hosts the T1040 SoC.
T1040D4RDB is re-designed T1040RDB board with following changes :
- Support of DDR4 memory
- Support of 0x66 serdes protocol which can support following interfaces
- 2 RGMII's on DTSEC4, DTSEC5
- 1 SGMII on DTSEC3
- Support of QE-TDM

Similarily T1042D4RDB is a Freescale reference board that hosts the T1040
SoC. T1042D4RDB is re-designed T1042RDB board with following changes :
- Support of DDR4 memory
- Support for 0x86 serdes protocol which can support following interfaces
- 2 RGMII's on DTSEC4, DTSEC5
- 3 SGMII on DTSEC1, DTSEC2  DTSEC3
- Support of DIU

Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Codrin Ciubotariu codrin.ciubota...@freescale.com
Signed-off-by: Wang Dongsheng dongsheng.w...@freescale.com
---
changes from v2:
 - adds SGMII suport using CPLD
 - removes extra endif
changes from v3:
 - removes checkpatch error
changes from v4:
 - wrong use of defined MACRO in eth.c file, adds macro properly
changes from v5:
 - updates README files, t1040d4_rcw.cfg and t1042d4_rcw.cfg 
 - update DDR settings
changes from v6:
 - update DDR settings, config files, cpld code, README
 - Add QGMII phy addr configs, update DIU_SEL value
changes from v7:
 - Add CONFIG_SPI_FLASH in config files to cater to recent
   changes in mainline code
 
 board/freescale/t104xrdb/MAINTAINERS |8 +++
 board/freescale/t104xrdb/README  |   87 -
 board/freescale/t104xrdb/cpld.c  |4 ++
 board/freescale/t104xrdb/cpld.h  |6 ++
 board/freescale/t104xrdb/ddr.c   |   10 
 board/freescale/t104xrdb/ddr.h   |9 +++-
 board/freescale/t104xrdb/eth.c   |   20 ++-
 board/freescale/t104xrdb/t1040d4_rcw.cfg |7 +++
 board/freescale/t104xrdb/t1042d4_rcw.cfg |7 +++
 board/freescale/t104xrdb/t104xrdb.c  |   32 +++
 configs/T1040D4RDB_NAND_defconfig|6 ++
 configs/T1040D4RDB_SDCARD_defconfig  |6 ++
 configs/T1040D4RDB_SPIFLASH_defconfig|6 ++
 configs/T1040D4RDB_defconfig |5 ++
 configs/T1042D4RDB_NAND_defconfig|6 ++
 configs/T1042D4RDB_SDCARD_defconfig  |6 ++
 configs/T1042D4RDB_SPIFLASH_defconfig|6 ++
 configs/T1042D4RDB_defconfig |5 ++
 include/configs/T104xRDB.h   |   64 ++
 19 files changed, 284 insertions(+), 16 deletions(-)
 create mode 100644 board/freescale/t104xrdb/t1040d4_rcw.cfg
 create mode 100644 board/freescale/t104xrdb/t1042d4_rcw.cfg
 create mode 100644 configs/T1040D4RDB_NAND_defconfig
 create mode 100644 configs/T1040D4RDB_SDCARD_defconfig
 create mode 100644 configs/T1040D4RDB_SPIFLASH_defconfig
 create mode 100644 configs/T1040D4RDB_defconfig
 create mode 100644 configs/T1042D4RDB_NAND_defconfig
 create mode 100644 configs/T1042D4RDB_SDCARD_defconfig
 create mode 100644 configs/T1042D4RDB_SPIFLASH_defconfig
 create mode 100644 configs/T1042D4RDB_defconfig

diff --git a/board/freescale/t104xrdb/MAINTAINERS 
b/board/freescale/t104xrdb/MAINTAINERS
index 13d9be9..32e044f 100644
--- a/board/freescale/t104xrdb/MAINTAINERS
+++ b/board/freescale/t104xrdb/MAINTAINERS
@@ -6,7 +6,13 @@ F: include/configs/T104xRDB.h
 F: configs/T1040RDB_defconfig
 F: configs/T1040RDB_NAND_defconfig
 F: configs/T1040RDB_SPIFLASH_defconfig
+F: configs/T1040D4RDB_defconfig
+F: configs/T1040D4RDB_NAND_defconfig
+F: configs/T1040D4RDB_SPIFLASH_defconfig
 F: configs/T1042RDB_defconfig
+F: configs/T1042D4RDB_defconfig
+F: configs/T1042D4RDB_NAND_defconfig
+F: configs/T1042D4RDB_SPIFLASH_defconfig
 F: configs/T1042RDB_PI_defconfig
 F: configs/T1042RDB_PI_NAND_defconfig
 F: configs/T1042RDB_PI_SPIFLASH_defconfig
@@ -15,6 +21,8 @@ T1040RDB_SDCARD BOARD
 #M:-
 S: Maintained
 F: configs/T1040RDB_SDCARD_defconfig
+F: configs/T1040D4RDB_SDCARD_defconfig
+F: configs/T1042D4RDB_SDCARD_defconfig
 F: configs/T1042RDB_PI_SDCARD_defconfig
 
 T1040RDB_SECURE_BOOT BOARD
diff --git a/board/freescale/t104xrdb/README b/board/freescale/t104xrdb/README
index ac95b5e..b9d2212 100644
--- a/board/freescale/t104xrdb/README
+++ b/board/freescale/t104xrdb/README
@@ -12,6 +12,17 @@ The T1042RDB_PI is a Freescale reference board that hosts 
the T1042 SoC.
 (a personality of T1040 SoC). The board is similar to T1040RDB but is
 designed specially with low power features targeted for Printing Image Market.
 
+The T1040D4RDB is a Freescale reference board that hosts the T1040 SoC.
+The board is re-designed T1040RDB board with following changes :
+- Support of DDR4 memory and some enhancements
+
+The T1042D4RDB is a Freescale reference board that hosts the T1042 SoC.
+The board is re-designed T1040RDB board with following changes :
+- Support of DDR4 memory
+- Support for 0x86 serdes protocol which can support 

[U-Boot] [PATCH 1/1] armv8: Add framework for CCN-504 interconnect configuration

2015-06-30 Thread Bhupesh Sharma
This patch adds a minimal framework for Dickens CCN-504
interconnect configuration - mainly related to adding Clusters/cores
to snoop/DVM domain and setting QoS of the RN-I ports.

LS2085A platform makes use of these configurations to support
better network data performance and to boot a SMP Linux.

Signed-off-by: Bhupesh Sharma bhupesh.sha...@freescale.com
---
 arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S  |   72 +++---
 arch/arm/include/asm/arch-fsl-lsch3/config.h |   11 
 arch/arm/lib/Makefile|1 +
 arch/arm/lib/ccn504.S|   61 ++
 4 files changed, 138 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/lib/ccn504.S

diff --git a/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S 
b/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
index 018c617..6b19d36 100644
--- a/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
+++ b/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
@@ -16,13 +16,71 @@ ENTRY(lowlevel_init)
mov x29, lr /* Save LR */
 
/* Add fully-coherent masters to DVM domain */
-   ldr x1, =CCI_MN_BASE
-   ldr x2, [x1, #CCI_MN_RNF_NODEID_LIST]
-   str x2, [x1, #CCI_MN_DVM_DOMAIN_CTL_SET]
-1: ldr x3, [x1, #CCI_MN_DVM_DOMAIN_CTL_SET]
-   mvn x0, x3
-   tst x0, x3  /* Wait for domain addition to complete */
-   b.ne1b
+   ldr x0, =CCI_MN_BASE
+   ldr x1, =CCI_MN_RNF_NODEID_LIST
+   ldr x2, =CCI_MN_DVM_DOMAIN_CTL_SET
+   bl  ccn504_add_masters_to_dvm
+
+   /* Set all RN-I ports to QoS of 15 */
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
 
/* Set the SMMU page size in the sACR register */
ldr x1, =SMMU_BASE
diff --git a/arch/arm/include/asm/arch-fsl-lsch3/config.h 
b/arch/arm/include/asm/arch-fsl-lsch3/config.h
index ca8d38c..c47950c 100644
--- a/arch/arm/include/asm/arch-fsl-lsch3/config.h
+++ b/arch/arm/include/asm/arch-fsl-lsch3/config.h
@@ -132,6 +132,17 @@
 #define CCI_MN_DVM_DOMAIN_CTL  0x200
 #define CCI_MN_DVM_DOMAIN_CTL_SET  0x210
 
+#define CCI_RN_I_0_BASE(CCI_MN_BASE + 0x80)
+#define CCI_RN_I_2_BASE(CCI_MN_BASE + 0x82)
+#define CCI_RN_I_6_BASE(CCI_MN_BASE + 0x86)
+#define CCI_RN_I_12_BASE   (CCI_MN_BASE + 0x8C)
+#define CCI_RN_I_16_BASE   (CCI_MN_BASE + 0x90)
+#define CCI_RN_I_20_BASE   (CCI_MN_BASE + 0x94)
+
+#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x10)
+#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x110)
+#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x210)
+
 /* Device Configuration */
 #define DCFG_BASE  0x01e0
 #define DCFG_PORSR10x000
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 31a5c8d..51497cc 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile

[U-Boot] scripts: RPi 2: only 1 out of 4 CPUs brought up

2015-06-30 Thread Jonas Jensen
Hello,

I have found the following issue with RPi 2:

Only 1 CPU is brought up when the kernel is started from script (see [1]).

All 4 CPUs are brought up if started manually typing in environment
variables from said script (see [2]).

U-Boot: 2015.04-rc5-gd6d345b
kernel: d9fa11803a0d2e3b1eaf4041ddd0ca5651300d96 branch rpi-4.1.y from
https://github.com/raspberrypi/linux

[1] Automatic boot: http://paste.debian.net/269052/
[2] Manual boot: http://paste.debian.net/269053/
[3] boot.scr.uimg: http://paste.debian.net/269066/
[4] environment variables: http://paste.debian.net/269067/

Example 1:

load mmc 0:1 ${scriptaddr} boot.scr.uimg; source ${scriptaddr}

.. result in linux bringing up only the first CPU

Example 2:

U-Boot setenv fdtfile bcm2709-rpi-2-b.dtb
U-Boot setenv bootargs earlyprintk console=tty0 console=ttyAMA0
root=/dev/mmcblk0p2 rootwait rw
U-Boot fatload mmc 0:1 ${kernel_addr_r} zImage
U-Boot fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
U-Boot bootz ${kernel_addr_r} - ${fdt_addr_r}

.. result in linux bringing up all four CPUs

#u-boot Marex_ suggested adding setenv fdt_high 0x and
adding sleep 1 between script commands none of which helped fix the
problem.

Is there a known fix or workaround?

I prefer something like boot.scr.uimg that can be added as a single
step enabling the correct environment.


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


Re: [U-Boot] [PATCH 03/22] usb: usb_setup_device: Drop unneeded portnr function argument

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:44, Simon Glass wrote:

Hi Hans.

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

Drop the unneeded portnr function argument, the portnr is part of the
usb_device struct which is passed via the dev argument.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  common/usb.c  | 10 +-
  drivers/usb/host/usb-uclass.c |  2 +-
  include/usb.h |  6 +++---
  3 files changed, 9 insertions(+), 9 deletions(-)


This was needed in the case where a fake usb_device was passed in. Has
your previous refactoring changed that?


The portnr is still passed but it is padded via the usb_device struct's
portnr member. When doing a CONFIG_DM_USB=y build the only call site of
usb_setup_device() is usb_scan_device() from drivers/usb/host/usb-uclass.c
which does:

udev-portnr = port;
debug(Calling usb_setup_device(), portnr=%d\n, udev-portnr);
parent_udev = device_get_uclass_id(parent) == UCLASS_USB_HUB ?
dev_get_parentdata(parent) : NULL;
ret = usb_setup_device(udev, priv-desc_before_addr, parent_udev);

So portnr is always set in the usb_device strict, and that is what gets
used after this patch.

Regards,

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


Re: [U-Boot] [PATCH 04/22] usb: Pass device instead of portnr to usb_legacy_port_reset

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:44, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

Pass the usb_device instead of the portnr to usb_legacy_port_reset and
rename it to usb_hub_port_reset as there is nothing legacy about it.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  common/usb.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)


Legacy as in not driver model.


Except that it gets used in both device-model and non device model
builds of the usb-stack.

Regards,

Hans

p.s.

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


Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:45, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

On an usb stop instead of leaving orphan usb devices behind simply remove


On a usb_stop()

or

On a 'usb stop' command  ?


My intention was for both, since I was under the assumption that usb stop
on the cmdline, was the only caller of usb_stop(), but a quick grep to the
sources show that I'm wrong ...


them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
usb_stop() when that is set.


This seems a little unfortunate. I can see the reasoning, but do you
think this is necessary? I suspect people chasing code size may remove
that option and still want to use USB properly.


This was mostly a result of my thinking that usb_stop() is only used
on usb stop at the cmdline, which I know realize is wrong.

However my quick grep has learned that we do really need CONFIG_DM_DEVICE_REMOVE
to properly implement usb_stop():

From common/bootm.c :

#if defined(CONFIG_CMD_USB)
/*
 * turn off USB to prevent the host controller from writing to the
 * SDRAM while Linux is booting. This could happen (at least for OHCI
 * controller), because the HCCA (Host Controller Communication Area)
 * lies within the SDRAM and the host controller writes continously to
 * this area (as busmaster!). The HccaFrameNumber is for example
 * updated every 1 ms within the HCCA structure in SDRAM! For more
 * details see the OpenHCI specification.
 */
usb_stop();
#endif

And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's remove
callback and thus do not properly stop the usb controller.

So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already exists
before this patch. If you want I can split out the adding of the #ifdef
in a separate commit, spelling out why usb_stop() MUST have
CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this all to
Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?







The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
instead, before this commit the output would be:

  usb [ + ]`-- sunxi-musb
  usb_hub [   ]|-- usb_hub
  usb_mass_st [   ]|   |-- usb_mass_storage
  usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
  usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes usb_get_dev_index
to return NULL when probing the first child, which results in the usb kbd
code not binding to the keyboard.


Although I suspect that could be fixed.


Right, but just removing the children is a much cleaner solution, and also
makes the output of dm tree properly reflect reality.





With this commit in place the output after swapping and usb reset is:

  usb [ + ]`-- sunxi-musb
  usb_dev_gen [ + ]`-- generic_bus_0_dev_1

As expected, and usb_get_dev_index works properly and the keyboard works.

After this commit usb_find_child() is only necessary for emulated usb
devices, so make its body #ifdef CONFIG_USB_EMUL.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/usb/host/usb-uclass.c | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index bce6cec..8f26e35 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -128,6 +128,7 @@ int usb_alloc_device(struct usb_device *udev)
 return ops-alloc_device(bus, udev);
  }

+#ifdef CONFIG_DM_DEVICE_REMOVE
  int usb_stop(void)
  {
 struct udevice *bus;
@@ -143,6 +144,12 @@ int usb_stop(void)
 uc_priv = uc-priv;

 uclass_foreach_dev(bus, uc) {
+   ret = device_chld_remove(bus);
+   if (ret  !err)
+   err = ret;
+   ret = device_chld_unbind(bus);
+   if (ret  !err)
+   err = ret;
 ret = device_remove(bus);
 if (ret  !err)
 err = ret;
@@ -166,6 +173,7 @@ int usb_stop(void)

 return err;
  }
+#endif

  static void usb_scan_bus(struct udevice *bus, bool recurse)
  {
@@ -491,6 +499,7 @@ static int usb_find_child(struct udevice *parent,
   struct usb_interface_descriptor *iface,
   struct udevice **devp)
  {
+#ifdef CONFIG_USB_EMUL /* Emulated devices are explictily bound */


explicitly


Ack.


Can you add a comment about this? It seems that we should rename this
function to usb_find_emul_child() and have it present only when
CONFIG_USB_EMUL is around?


Renaming it to usb_find_emul_child() and only defining the function when
CONFIG_USB_EMUL works for me I will do that for v2.


Also, why bother with the #ifdef 

Re: [U-Boot] [PATCH 0/8] JFFS2 fixes and performance improvements

2015-06-30 Thread Wolfgang Denk
Dear Mark,

In message 
1435554149-18042-1-git-send-email-mark.tomlin...@alliedtelesis.co.nz you 
wrote:
 These patches fix bugs and improve performance of JFFS2. Some of these
 improvements can already be found in old mailing lists, but for some
 reason they have not made their way into the u-boot source. I have the
 feeling that any one of these patches didn't show enough performance gain
 to warrant adding it to the source. I am hopeful that together, all these
 patches can be seen to make a big difference.

It would be a good thing to know where exactly these changes are
coming from?  Is this independent optoimization within U-Boot only, or
did you for example try to synchronize the U-Boot code against a
recent Linux kernel version?  I feel that would be a pretty useful
undertaking...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Bankers do it with interest (penalty for early withdrawal).
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 06/22] dm: Export device_chld_remove / device_chld_unbind

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:45, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

These functions are useful to remove all children from an usb bus before
rescanning the bus.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/core/device-remove.c | 18 ++
  include/dm/device-internal.h | 26 ++
  2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 6a16b4f..06de7e3 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -18,16 +18,7 @@
  #include dm/uclass-internal.h
  #include dm/util.h

-/**
- * device_chld_unbind() - Unbind all device's children from the device
- *
- * On error, the function continues to unbind all children, and reports the
- * first error.
- *
- * @dev:   The device that is to be stripped of its children
- * @return 0 on success, -ve on error
- */
-static int device_chld_unbind(struct udevice *dev)
+int device_chld_unbind(struct udevice *dev)


If we are exporting this can we give it a better name? Maybe
device_unbind_children()?


Will do for v2 of this set.

Regards,

Hans




  {
 struct udevice *pos, *n;
 int ret, saved_ret = 0;
@@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
 return saved_ret;
  }

-/**
- * device_chld_remove() - Stop all device's children
- * @dev:   The device whose children are to be removed
- * @return 0 on success, -ve on error
- */
-static int device_chld_remove(struct udevice *dev)
+int device_chld_remove(struct udevice *dev)
  {
 struct udevice *pos, *n;
 int ret;
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 687462b..6c8fe23 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
  static inline int device_unbind(struct udevice *dev) { return 0; }
  #endif

+/**
+ * device_chld_remove() - Stop all device's children
+ * @dev:   The device whose children are to be removed
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_chld_remove(struct udevice *dev);
+#else
+static inline int device_chld_remove(struct udevice *dev) { return 0; }
+#endif
+
+/**
+ * device_chld_unbind() - Unbind all device's children from the device
+ *
+ * On error, the function continues to unbind all children, and reports the
+ * first error.
+ *
+ * @dev:   The device that is to be stripped of its children
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_chld_unbind(struct udevice *dev);
+#else
+static inline int device_chld_unbind(struct udevice *dev) { return 0; }
+#endif
+
  #ifdef CONFIG_DM_DEVICE_REMOVE
  void device_free(struct udevice *dev);
  #else
--
2.4.3



Regards,
Simon


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


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 30-06-15 15:30, Ian Campbell wrote:

On Tue, 2015-06-30 at 15:11 +0200, Hans de Goede wrote:
[...]

The latest patch-series seems to do the exact reverse. More knowledge is
being moved away from a central place and into defconfig files. As said
ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
defconfig files need to set that explicitly.


CONFIG_DM* seems like the sort of thing which ought to be select'd not
default y'd


ACK. The problem is that there are some other not entirely clean
Kconfig bits un the u-boot tree which causes Kconfig to explain about
circular deps last time I tried to select them. Still I agree we need
to move to selecting these and fix any other issues this triggers.

Regards,

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


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 28-06-15 18:06, Tom Rini wrote:

On Sun, Jun 28, 2015 at 05:39:28PM +0200, Hans de Goede wrote:

Hi,

On 26-06-15 23:05, Tom Rini wrote:

On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:


Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

   Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

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

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

   sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)



NAK, this needs a rework now, sorry!  Joe's changes mean the new
defconfig needs updating.


Ugh, I'm somewhat surprised with these changes, both with the
contents of the changes, as with changes like these landing so
late in the cycle, esp. since these are not uncontroversial.

I've the feeling that these were merged without proper discussion
which is not good, and is esp. bad when it is done so late in the
cycle.


Yeah, it's a bit later than I'd have liked, but I asked Joe to get these
done because they help clean things up.  For example:


In essense these changes revert my earlier commit where I explictly added:

config CMD_SETEXPR
default y

config CMD_NET
default y


Right.  Your change kept sunxi boards from suddenly losing those
features to prevent breakage (which is good, and why I allowed it at the
time), but at the expense of adding lines to each of the sunxi defconfig
files (which is why these lines ended up in each of the sunxi defconfg
files, yes?)


That is not how I see it, with my change for sunxi boards the default for
these options was y, so they did not end up in the deconfigs with Joe's
recent changes removed the above 4 lines from board/sunxi/Kconfig now
all of a sudden all sunxi defconfig files need these lines, it is Joe's
changes which have caused a ton of extra lines to be added to the sunxi
defconfigs not mine, specifically this commit:

http://git.denx.de/?p=u-boot.git;a=commit;h=c9bb942e2f91d9f8e5f25ed1961eba2d64f65b8d

Which does:

--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -566,25 +566,4 @@ config GMAC_TX_DELAY
---help---
Set the GMAC Transmit Clock Delay Chain value.

-config SYS_MALLOC_CLEAR_ON_INIT
-   default n
-
-config NETDEVICES
-   default y
-
-config DM_ETH
-   default y
-
-config DM_SERIAL
-   default y
-
-config DM_USB
-   default y if !USB_MUSB_SUNXI
-
-config CMD_SETEXPR
-   default y
-
-config CMD_NET
-   default y
-
 endif

Which result in the following matching change for 60+ sunxi
defconfig's :
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -5,5 +5,13 @@ CONFIG_DRAM_CLK=480
 CONFIG_DRAM_EMR1=4
 CONFIG_SYS_CLK_FREQ=91200
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
 
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_NET=y
+CONFIG_DM_ETH=y
+CONFIG_NETDEVICES=y
+CONFIG_DM_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y

 and didn't help all of the other SoCs out.  What Joe's

changes do is remove them from the defconfig files under configs/ _and_
restore the original behaviour.


No what Joe's changes have them is ADD them to the defconfig files
under configs/ and force the new behavior of all things defaulting
to off unless explictly enabled in defconfig, resulting in 8 * 61 =
488 extra lines in sunxi defconfig's alone.

And for some reason Joe has not only done these change for CONFIG_CMD_*
but also for other unrelated options like CONFIG_DM_* which is really
BAD, as sunxi has been completely moved over to the device model and
simply will not build nor run when CONFIG_DM and friends are not set.


And not only does the just merged series revert these changes, to make
things worse it adds a whole lot more crap to the sunxi defconfigs.


It does in that it's now a direct translation of crap that used to be in
the config.h files (and done just once, true).  The next step is to
instead add smarts to the Kconfig logic so that if we don't have
NOR-style flash we don't ever ask about CMD_IMLS/CMD_FLASH and make
CMD_FPGA depend on FPGA being set.

We're trying to skip over the period of linux kernel history where the
defconfig files were hand-controlled files that had lots of
board-specific knowledge in them.  But at the same time, we can't kick
out nearly as much of that information as they were able to because...


The latest patch-series seems to do the exact reverse. More knowledge is
being moved away from a central place and into defconfig files. As said
ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
defconfig files need to set that explicitly.


Excuse my language but I've no other words for this, something which
we want 

Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Ian Campbell
On Tue, 2015-06-30 at 15:11 +0200, Hans de Goede wrote:
[...]
 The latest patch-series seems to do the exact reverse. More knowledge is
 being moved away from a central place and into defconfig files. As said
 ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
 defconfig files need to set that explicitly.

CONFIG_DM* seems like the sort of thing which ought to be select'd not
default y'd (it's never really an user option, it's something
something else needs), but the recent change seems like a step in the
wrong direction either way.

Ian.

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


Re: [U-Boot] [PATCH 07/11 v2] drivers/net/vsc9953: Add commands to manipulate the FDB for VSC9953

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:39 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 07/11 v2] drivers/net/vsc9953: Add commands to
 manipulate the FDB for VSC9953

  +   return !!timeout;
 
 Maybe return -EBUSY like suggested in previous patch.

Ok.

  +   /* write port and vid to get selected FDB entries */
  +   val = in_le32(l2ana_reg-ana.anag_efil);
  +   if (port_no != VSC9953_CMD_PORT_ALL) {
  +   val = (val  ~CONFIG_VSC9953_AGE_PORT_MASK) |
  +   CONFIG_VSC9953_AGE_PORT_EN |
  +   field_set(port_no,
  + CONFIG_VSC9953_AGE_PORT_MASK);
 
 Seems like a good place to use bitfield_replace() from
 include/bitfield.h (or a new one that you add that uses the mask for
 the shift).
 
  +   }
  +   if (vid != VSC9953_CMD_VLAN_ALL) {
  +   val = (val  ~CONFIG_VSC9953_AGE_VID_MASK) |
  +   CONFIG_VSC9953_AGE_VID_EN |
  +   field_set(vid, CONFIG_VSC9953_AGE_VID_MASK);
 
 Same here.

Ok.

  +   vlan = field_get(val  CONFIG_VSC9953_MAC_VID_MASK,
  +CONFIG_VSC9953_MAC_VID_MASK);
 
 It seems like masking off the val before shifting it would be better
 implemented inside the field_get function (renamed and moved to
 include/bitfield.h) instead of on each use.

Yes, something like #define field_set(val, mask)   (((val) * ((mask)  
~((mask)  1)))  mask) and
#define field_get(val, mask)   ((val  mask) / ((mask)  ~((mask)  
1))). 

  +   out_le32(l2ana_reg-ana_tables.mach_data,
  +(mac[0]  8) | (mac[1]  0) |
  +(field_set(vid, CONFIG_VSC9953_MACHDATA_VID_MASK) 
  +CONFIG_VSC9953_MACHDATA_VID_MASK));
 
 Why do you need to  with the mask again after field_set()?

To assure that the shifted vid value is not higher than its mask. Adding the 
mask to the macro/inline function as described above should assure this.

  +   /* check if the MAC address was indeed added */
  +   out_le32(l2ana_reg-ana_tables.mach_data,
  +(mac[0]  8) | (mac[1]  0) |
  +(field_set(vid, CONFIG_VSC9953_MACHDATA_VID_MASK) 
  +   CONFIG_VSC9953_MACHDATA_VID_MASK));
 
 Why do you need to  with the mask again after field_set()?

Same here.

  +   out_le32(l2ana_reg-ana_tables.mach_data,
  +(mac[0]  8) | (mac[1]  0) |
  +(field_set(vid, CONFIG_VSC9953_MACHDATA_VID_MASK) 
  + CONFIG_VSC9953_MACHDATA_VID_MASK));
 
 Why do you need to  with the mask again after field_set()?

Same here.

  +   out_le32(l2ana_reg-ana_tables.mach_data, (mac[0]  8) |
  +(mac[1]  0) |
  +(field_set(vid, CONFIG_VSC9953_MACHDATA_VID_MASK) 
  + CONFIG_VSC9953_MACHDATA_VID_MASK));
 
 Why do you need to  with the mask again after field_set()?

Same here.

  +   out_le32(l2ana_reg-ana_tables.mach_data, (mac[0]  8) |
  +(mac[1]  0) |
  +(field_set(vid, CONFIG_VSC9953_MACHDATA_VID_MASK) 
  + CONFIG_VSC9953_MACHDATA_VID_MASK));
 
 Why do you need to  with the mask again after field_set()?

Same here.

  +   val = in_le32(l2ana_reg-ana.anag_efil);
  +   if (port_no != VSC9953_CMD_PORT_ALL) {
  +   val = (val  ~CONFIG_VSC9953_AGE_PORT_MASK) |
  + CONFIG_VSC9953_AGE_PORT_EN |
  + field_set(port_no, CONFIG_VSC9953_AGE_PORT_MASK);
 
 Seems like a good place to use bitfield_replace() from
 include/bitfield.h (or a new one that you add that uses the mask for
 the shift).

Ok.

 
  +   }
  +
  +   if (vid != VSC9953_CMD_VLAN_ALL) {
  +   val = (val  ~CONFIG_VSC9953_AGE_VID_MASK) |
  + CONFIG_VSC9953_AGE_VID_EN |
  + field_set(vid, CONFIG_VSC9953_AGE_VID_MASK);
 
 Same here.

Ok.

  +   uchar *mac_addr;
 
 Use this:
 +   uchar ethaddr[6];
 I recently made a pass through U-Boot trying to standardize on that
 naming. Also, don't make it a pointer that has to be allocated. It is
 small and of known size.

Ok.

  +#define VSC9953_FDB_HELP ethsw [port port_no] [vlan vid] fdb  \
  +{ [help] | show | flush | { add | del } mac }  \
  +- Add/delete a mac entry in FDB; use show to see FDB entries;  \
  +if vlan vid is missing, will be used VID 1
 
 Please use this:
 +if vlan vid is missing, VID 1 will be used

Ok.

  +   /* check if MAC address is present */
  +   if (!parsed_cmd-mac_addr) {
 
 Use this:
 +   if (is_valid_ethaddr(parsed_cmd-mac_addr)) {

is_valid_ethaddr() returns false if the mac address is 00:00:00:00:00:00, but 
for the L2 Switch, this mac address 

Re: [U-Boot] [PATCH 7/8] JFFS2: Use CLEANMARKER to reduce scanning time

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

If a sector has a CLEANMARKER at the beginning, it indicates that the
entire sector has been erased. Therefore, if this is found, we can skip the
entire block. This was not being done before this patch.

The code now does the same as the kernel does when encountering a
CLEANMARKER. It still checks that the next few words are , and if
so, the block is assumed to be empty, and so is skipped.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 22 ++
  1 file changed, 22 insertions(+)


Beside of your comment style

Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index d78fb06..26a748f 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1520,6 +1520,8 @@ jffs2_1pass_build_lists(struct part_info * part)
uint32_t sumlen;
int ret;
  #endif
+   /* Indicates a sector with a CLEANMARKER was found */
+   int clean_sector = 0;

/* Set buf_size to maximum length */
buf_size = DEFAULT_EMPTY_SCAN_SIZE;
@@ -1643,6 +1645,13 @@ jffs2_1pass_build_lists(struct part_info * part)
ofs += 4;
}
/* Ran off end. */
+   /* If this sector had a clean marker at the
+* beginning, and immediately following this
+* have been a bunch of FF bytes, treat the
+* entire sector as empty.
+*/
+   if (clean_sector)
+   break;

/* See how much more there is to read in this
 * eraseblock...
@@ -1664,6 +1673,10 @@ jffs2_1pass_build_lists(struct part_info * part)
buf_ofs = ofs;
goto more_empty;
}
+   /* Found something not erased in the sector, so reset
+* the 'clean_sector' flag.
+*/
+   clean_sector = 0;
if (node-magic != JFFS2_MAGIC_BITMASK ||
!hdr_crc(node)) {
ofs += 4;
@@ -1745,6 +1758,15 @@ jffs2_1pass_build_lists(struct part_info * part)
%d != %zu\n,
node-totlen,
sizeof(struct 
jffs2_unknown_node));
+   if ((node-totlen ==
+sizeof(struct jffs2_unknown_node)) 
+   (ofs == sector_ofs)) {
+   /* Found a CLEANMARKER at the beginning
+* of the sector. It's in the correct
+* place with correct size and CRC.
+*/
+   clean_sector = 1;
+   }
break;
case JFFS2_NODETYPE_PADDING:
if (node-totlen  sizeof(struct 
jffs2_unknown_node))



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] JFFS2: Use merge sort when parsing filesystem

2015-06-30 Thread Heiko Schocher denx

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

When building the file system the existing code does an insertion into
a linked list. It attempts to speed this up by keeping a pointer to
where the last entry was inserted but it's still slow.

Now the nodes are just inserted into the list without searching
through for the correct place. This unsorted list is then sorted once
using mergesort after all the entries have been added to the list.
This speeds up the scanning of the flash file system considerably.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/Makefile|  1 +
  fs/jffs2/jffs2_1pass.c   | 47 
  fs/jffs2/jffs2_private.h |  4 +++
  fs/jffs2/mergesort.c | 70 
  4 files changed, 86 insertions(+), 36 deletions(-)
  create mode 100644 fs/jffs2/mergesort.c

diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile
index 4cb0600..90524ba 100644
--- a/fs/jffs2/Makefile
+++ b/fs/jffs2/Makefile
@@ -10,4 +10,5 @@ obj-y += compr_rtime.o
  obj-y += compr_rubin.o
  obj-y += compr_zlib.o
  obj-y += jffs2_1pass.o
+obj-y += mergesort.o
  obj-y += mini_inflate.o
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 26a748f..a456650 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -125,7 +125,6 @@

  #include jffs2_private.h

-


This change has nothing to do with your commit message ...


  #define   NODE_CHUNK  1024/* size of memory allocation chunk in 
b_nodes */
  #define   SPIN_BLKSIZE18  /* spin after having scanned 1BLKSIZE 
bytes */

@@ -545,49 +544,19 @@ static struct b_node *
  insert_node(struct b_list *list, u32 offset)
  {
struct b_node *new;
-#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-   struct b_node *b, *prev;
-#endif

if (!(new = add_node(list))) {
putstr(add_node failed!\r\n);
return NULL;
}
new-offset = offset;
+   new-next = NULL;

-#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-   if (list-listTail != NULL  list-listCompare(new, list-listTail))
-   prev = list-listTail;
-   else if (list-listLast != NULL  list-listCompare(new, 
list-listLast))
-   prev = list-listLast;
+   if (list-listTail != NULL)
+   list-listTail-next = new;
else
-   prev = NULL;
-
-   for (b = (prev ? prev-next : list-listHead);
-b != NULL  list-listCompare(new, b);
-prev = b, b = b-next) {
-   list-listLoops++;
-   }
-   if (b != NULL)
-   list-listLast = prev;
-
-   if (b != NULL) {
-   new-next = b;
-   if (prev != NULL)
-   prev-next = new;
-   else
-   list-listHead = new;
-   } else
-#endif
-   {
-   new-next = (struct b_node *) NULL;
-   if (list-listTail != NULL) {
-   list-listTail-next = new;
-   list-listTail = new;
-   } else {
-   list-listTail = list-listHead = new;
-   }
-   }
+   list-listHead = new;
+   list-listTail = new;

return new;
  }
@@ -1788,6 +1757,12 @@ jffs2_1pass_build_lists(struct part_info * part)
}

free(buf);
+#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS)
+   /* Sort the lists.
+*/
+   sort_list(pL-frag);
+   sort_list(pL-dir);
+#endif
putstr(\b\b done.\r\n); /* close off the dots */

/* We don't care if malloc failed - then each read operation will
diff --git a/fs/jffs2/jffs2_private.h b/fs/jffs2/jffs2_private.h
index 658b325..06b6ca2 100644
--- a/fs/jffs2/jffs2_private.h
+++ b/fs/jffs2/jffs2_private.h
@@ -98,4 +98,8 @@ data_crc(struct jffs2_raw_inode *node)
}
  }

+#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS)
+/* External merge sort. */
+int sort_list(struct b_list *list);
+#endif
  #endif /* jffs2_private.h */
diff --git a/fs/jffs2/mergesort.c b/fs/jffs2/mergesort.c
new file mode 100644
index 000..10ecc8d
--- /dev/null
+++ b/fs/jffs2/mergesort.c
@@ -0,0 +1,70 @@
+/*
+ * This file is copyright 2001 Simon Tatham.
+ * Rewritten from original source 2006 by Dan Merillat for use in u-boot.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT 

[U-Boot] [PATCH] ARM: UniPhier: add IDs for PH1-Pro5, ProXstream2, PH1-LD6b

2015-06-30 Thread Masahiro Yamada
This prepares for new SoCs support.

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

 arch/arm/mach-uniphier/cpu_info.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-uniphier/cpu_info.c 
b/arch/arm/mach-uniphier/cpu_info.c
index c4ba6d2..5d9ed84 100644
--- a/arch/arm/mach-uniphier/cpu_info.c
+++ b/arch/arm/mach-uniphier/cpu_info.c
@@ -34,6 +34,15 @@ int print_cpuinfo(void)
case 0x29:
puts(PH1-sLD8 (MN2WS0270));
break;
+   case 0x2A:
+   puts(PH1-Pro5 (MN2WS0300));
+   break;
+   case 0x2E:
+   puts(ProXstream2 (MN2WS0310));
+   break;
+   case 0x2F:
+   puts(PH1-LD6b (MN2WS0320));
+   break;
default:
printf(Unknown Processor ID (0x%x)\n, revision);
return -1;
-- 
1.9.1

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


Re: [U-Boot] [PATCH 7/8] JFFS2: Use CLEANMARKER to reduce scanning time

2015-06-30 Thread Heiko Schocher invitel

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

If a sector has a CLEANMARKER at the beginning, it indicates that the
entire sector has been erased. Therefore, if this is found, we can skip the
entire block. This was not being done before this patch.

The code now does the same as the kernel does when encountering a
CLEANMARKER. It still checks that the next few words are , and if
so, the block is assumed to be empty, and so is skipped.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 22 ++
  1 file changed, 22 insertions(+)


Beside of your comment style

Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index d78fb06..26a748f 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1520,6 +1520,8 @@ jffs2_1pass_build_lists(struct part_info * part)
uint32_t sumlen;
int ret;
  #endif
+   /* Indicates a sector with a CLEANMARKER was found */
+   int clean_sector = 0;

/* Set buf_size to maximum length */
buf_size = DEFAULT_EMPTY_SCAN_SIZE;
@@ -1643,6 +1645,13 @@ jffs2_1pass_build_lists(struct part_info * part)
ofs += 4;
}
/* Ran off end. */
+   /* If this sector had a clean marker at the
+* beginning, and immediately following this
+* have been a bunch of FF bytes, treat the
+* entire sector as empty.
+*/
+   if (clean_sector)
+   break;

/* See how much more there is to read in this
 * eraseblock...
@@ -1664,6 +1673,10 @@ jffs2_1pass_build_lists(struct part_info * part)
buf_ofs = ofs;
goto more_empty;
}
+   /* Found something not erased in the sector, so reset
+* the 'clean_sector' flag.
+*/
+   clean_sector = 0;
if (node-magic != JFFS2_MAGIC_BITMASK ||
!hdr_crc(node)) {
ofs += 4;
@@ -1745,6 +1758,15 @@ jffs2_1pass_build_lists(struct part_info * part)
%d != %zu\n,
node-totlen,
sizeof(struct 
jffs2_unknown_node));
+   if ((node-totlen ==
+sizeof(struct jffs2_unknown_node)) 
+   (ofs == sector_ofs)) {
+   /* Found a CLEANMARKER at the beginning
+* of the sector. It's in the correct
+* place with correct size and CRC.
+*/
+   clean_sector = 1;
+   }
break;
case JFFS2_NODETYPE_PADDING:
if (node-totlen  sizeof(struct 
jffs2_unknown_node))


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


Re: [U-Boot] [PATCH 6/8] JFFS2: Change scansize to match linux kernel

2015-06-30 Thread Heiko Schocher invitel

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

The scan code is similar to the linux kernel, but the kernel defines a much
smaller size to scan through before deciding a sector is blank. Assuming
that what is in the kernel is OK, make these two match.

On its own, this change makes no difference to scanning of any sectors
which have a clean marker at the beginning, since the entire sector is not
blank.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 10bd7be..d78fb06 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1472,7 +1472,7 @@ dump_dirents(struct b_lists *pL)
  }
  #endif

-#define DEFAULT_EMPTY_SCAN_SIZE4096
+#define DEFAULT_EMPTY_SCAN_SIZE256

  static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size)
  {


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


Re: [U-Boot] [PATCH 5/8] JFFS2: Optimize building lists during scan

2015-06-30 Thread Heiko Schocher invitel

Hello Mark,

please fix Tom rinis mail address globally for your patchset into

Tom Rini tr...@konsulko.com

I fixed it for my response manually, thanks!

BTW: You can use patman for creating patches/patchset.
Look into u-boot:tools/patman

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:

If the flash is slow, reading less from the flash into buffers makes
the process faster.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

  fs/jffs2/jffs2_1pass.c | 24 
  1 file changed, 20 insertions(+), 4 deletions(-)


Reviewed-by: Heiko Schocher h...@denx.de

bye,
Heiko


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 80210be..10bd7be 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1493,7 +1493,7 @@ jffs2_1pass_build_lists(struct part_info * part)
u32 counterF = 0;
u32 counterN = 0;
u32 max_totlen = 0;
-   u32 buf_size = DEFAULT_EMPTY_SCAN_SIZE;
+   u32 buf_size;
char *buf;

nr_sectors = lldiv(part-size, part-sector_size);
@@ -1505,7 +1505,7 @@ jffs2_1pass_build_lists(struct part_info * part)
/* if we are building a list we need to refresh the cache. */
jffs_init_1pass_list(part);
pL = (struct b_lists *)part-jffs2_priv;
-   buf = malloc(buf_size);
+   buf = malloc(DEFAULT_EMPTY_SCAN_SIZE);
puts (Scanning JFFS2 FS:   );

/* start at the beginning of the partition */
@@ -1521,6 +1521,8 @@ jffs2_1pass_build_lists(struct part_info * part)
int ret;
  #endif

+   /* Set buf_size to maximum length */
+   buf_size = DEFAULT_EMPTY_SCAN_SIZE;
WATCHDOG_RESET();

  #ifdef CONFIG_JFFS2_SUMMARY
@@ -1595,6 +1597,10 @@ jffs2_1pass_build_lists(struct part_info * part)

ofs += sector_ofs;
prevofs = ofs - 1;
+   /* Set buf_size down to the minimum size required.
+* This prevents reading in chunks of flash data unnecessarily.
+*/
+   buf_size = sizeof(union jffs2_node_union);

scan_more:
while (ofs  sector_ofs + part-sector_size) {
@@ -1675,13 +1681,18 @@ jffs2_1pass_build_lists(struct part_info * part)
case JFFS2_NODETYPE_INODE:
if (buf_ofs + buf_len  ofs + sizeof(struct
jffs2_raw_inode)) {
+   buf_len = min_t(uint32_t,
+   sizeof(struct 
jffs2_raw_inode),
+   sector_ofs +
+   part-sector_size -
+   ofs);
get_fl_mem((u32)part-offset + ofs,
   buf_len, buf);
buf_ofs = ofs;
node = (void *)buf;
}
-   if (!inode_crc((struct jffs2_raw_inode *) node))
-  break;
+   if (!inode_crc((struct jffs2_raw_inode *)node))
+   break;

if (insert_node(pL-frag, (u32) part-offset +
ofs) == NULL) {
@@ -1698,6 +1709,11 @@ jffs2_1pass_build_lists(struct part_info * part)
((struct
 jffs2_raw_dirent *)
node)-nsize) {
+   buf_len = min_t(uint32_t,
+   node-totlen,
+   sector_ofs +
+   part-sector_size -
+   ofs);
get_fl_mem((u32)part-offset + ofs,
   buf_len, buf);
buf_ofs = ofs;


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


Re: [U-Boot] [PATCH 08/11 v2] drivers/net/vsc9953: Add VLAN commands for VSC9953

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:41 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 08/11 v2] drivers/net/vsc9953: Add VLAN commands
 for VSC9953
 
  @@ -270,6 +270,31 @@ static void vsc9953_port_vlan_pvid_set(int port_no, int
 pvid)
  field_set(pvid,
 CONFIG_VSC9953_PORT_VLAN_CFG_VID_MASK));
   }
 
  +#ifdef CONFIG_VSC9953_CMD
 
 Why does this need to be defined outside of the #ifdef already at the
 bottom of the file?

I added it here so that vsc9953_port_vlan_pvid_get() could be next to its pair, 
vsc9953_port_vlan_pvid_set(). If you think that it should be at the bottom of 
the file I can move it.

  +   /* Administrative down */
  +   if ((!vsc9953_l2sw.port[port_nr].enabled)) {
 
 Why do you have double (( and ))?

By mistake, I will remove one pair.

  +#ifdef CONFIG_VSC9953_CMD
 
 Why does this need to be defined outside of the #ifdef already at the
 bottom of the file?

I did this so that similar get/set() functions to be close to one another. 
Also, the functions guarded by CONFIG_VSC9953_CMD are used only when the ethsw 
commands are enabled (CONFIG_VSC9953_CMD defined). If a user decides to use the 
driver for VSC9953, with the switch working in unmanaged state and he doesn't 
need the commands to configure the switch, he could compile u-boot with 
CONFIG_VSC9953_CMD undefined. In this case, some warnings will appear at 
compile time suggesting that functions like vsc9953_port_vlan_egr_untag_get() 
are defined but not used.

  +   /* Administrative down */
  +   if ((!vsc9953_l2sw.port[port_no].enabled)) {
 
 Why do you have double (( and ))?

By mistake, I will remove one pair.

  +/* Shiw egress tagging configuration for a VSC9953 port */
 
 Shiw - Show

Yes, it's a typo.

  +   if (!!(val  (field_set((1  port_no),
  +   CONFIG_VSC9953_VLAN_PORT_MASK
 
 There is no need for !! in an if statement. Drop it and the extra 
 parenthesis.

Ok.

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


Re: [U-Boot] [PATCH 09/11 v2] drivers/net/vsc9953: Add command for shared/private VLAN learning

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

I will make a v3 with your suggestions.

Thanks and best regards,
Codrin

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:41 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 09/11 v2] drivers/net/vsc9953: Add command for
 shared/private VLAN learning

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


[U-Boot] [RESEND PATCH 1/1] armv8: Add framework for CCN-504 interconnect configuration

2015-06-30 Thread Bhupesh Sharma
This patch adds a minimal framework for Dickens CCN-504
interconnect configuration - mainly related to adding Clusters/cores
to snoop/DVM domain and setting QoS of the RN-I ports.

LS2085A platform makes use of these configurations to support
better network data performance and to boot a SMP Linux.

Signed-off-by: Bhupesh Sharma bhupesh.sha...@freescale.com
---
 arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S  |   72 +++---
 arch/arm/include/asm/arch-fsl-lsch3/config.h |   11 
 arch/arm/lib/Makefile|1 +
 arch/arm/lib/ccn504.S|   61 ++
 4 files changed, 138 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/lib/ccn504.S

diff --git a/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S 
b/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
index 018c617..6b19d36 100644
--- a/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
+++ b/arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
@@ -16,13 +16,71 @@ ENTRY(lowlevel_init)
mov x29, lr /* Save LR */
 
/* Add fully-coherent masters to DVM domain */
-   ldr x1, =CCI_MN_BASE
-   ldr x2, [x1, #CCI_MN_RNF_NODEID_LIST]
-   str x2, [x1, #CCI_MN_DVM_DOMAIN_CTL_SET]
-1: ldr x3, [x1, #CCI_MN_DVM_DOMAIN_CTL_SET]
-   mvn x0, x3
-   tst x0, x3  /* Wait for domain addition to complete */
-   b.ne1b
+   ldr x0, =CCI_MN_BASE
+   ldr x1, =CCI_MN_RNF_NODEID_LIST
+   ldr x2, =CCI_MN_DVM_DOMAIN_CTL_SET
+   bl  ccn504_add_masters_to_dvm
+
+   /* Set all RN-I ports to QoS of 15 */
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(0)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(2)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(6)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(12)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(16)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+
+   ldr x0, =CCI_S0_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S1_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
+   ldr x0, =CCI_S2_QOS_CONTROL_BASE(20)
+   ldr x1, =0x00FF000C
+   bl  ccn504_set_qos
 
/* Set the SMMU page size in the sACR register */
ldr x1, =SMMU_BASE
diff --git a/arch/arm/include/asm/arch-fsl-lsch3/config.h 
b/arch/arm/include/asm/arch-fsl-lsch3/config.h
index ca8d38c..c47950c 100644
--- a/arch/arm/include/asm/arch-fsl-lsch3/config.h
+++ b/arch/arm/include/asm/arch-fsl-lsch3/config.h
@@ -132,6 +132,17 @@
 #define CCI_MN_DVM_DOMAIN_CTL  0x200
 #define CCI_MN_DVM_DOMAIN_CTL_SET  0x210
 
+#define CCI_RN_I_0_BASE(CCI_MN_BASE + 0x80)
+#define CCI_RN_I_2_BASE(CCI_MN_BASE + 0x82)
+#define CCI_RN_I_6_BASE(CCI_MN_BASE + 0x86)
+#define CCI_RN_I_12_BASE   (CCI_MN_BASE + 0x8C)
+#define CCI_RN_I_16_BASE   (CCI_MN_BASE + 0x90)
+#define CCI_RN_I_20_BASE   (CCI_MN_BASE + 0x94)
+
+#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x10)
+#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x110)
+#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x1)) + 0x210)
+
 /* Device Configuration */
 #define DCFG_BASE  0x01e0
 #define DCFG_PORSR10x000
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 31a5c8d..51497cc 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile

[U-Boot] [PATCH v2 8/8] JFFS2: Use merge sort when parsing filesystem

2015-06-30 Thread Mark Tomlinson
When building the file system the existing code does an insertion into
a linked list. It attempts to speed this up by keeping a pointer to
where the last entry was inserted but it's still slow.

Now the nodes are just inserted into the list without searching
through for the correct place. This unsorted list is then sorted once
using mergesort after all the entries have been added to the list.
This speeds up the scanning of the flash file system considerably.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Changed copyright notice to use SPDX-Licence-Identifier.
- Added URL to original mergesort code.
- Removed #ifdef, using Makefile change instead.

 fs/jffs2/Makefile|  1 +
 fs/jffs2/jffs2_1pass.c   | 47 +++
 fs/jffs2/jffs2_private.h |  4 
 fs/jffs2/mergesort.c | 52 
 4 files changed, 69 insertions(+), 35 deletions(-)
 create mode 100644 fs/jffs2/mergesort.c

diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile
index 4cb0600..3625d74 100644
--- a/fs/jffs2/Makefile
+++ b/fs/jffs2/Makefile
@@ -10,4 +10,5 @@ obj-y += compr_rtime.o
 obj-y += compr_rubin.o
 obj-y += compr_zlib.o
 obj-y += jffs2_1pass.o
+obj-$(CONFIG_SYS_JFFS2_SORT_FRAGMENTS) += mergesort.o
 obj-y += mini_inflate.o
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 4325792..64f5542 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -545,49 +545,19 @@ static struct b_node *
 insert_node(struct b_list *list, u32 offset)
 {
struct b_node *new;
-#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-   struct b_node *b, *prev;
-#endif
 
if (!(new = add_node(list))) {
putstr(add_node failed!\r\n);
return NULL;
}
new-offset = offset;
+   new-next = NULL;
 
-#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-   if (list-listTail != NULL  list-listCompare(new, list-listTail))
-   prev = list-listTail;
-   else if (list-listLast != NULL  list-listCompare(new, 
list-listLast))
-   prev = list-listLast;
+   if (list-listTail != NULL)
+   list-listTail-next = new;
else
-   prev = NULL;
-
-   for (b = (prev ? prev-next : list-listHead);
-b != NULL  list-listCompare(new, b);
-prev = b, b = b-next) {
-   list-listLoops++;
-   }
-   if (b != NULL)
-   list-listLast = prev;
-
-   if (b != NULL) {
-   new-next = b;
-   if (prev != NULL)
-   prev-next = new;
-   else
-   list-listHead = new;
-   } else
-#endif
-   {
-   new-next = (struct b_node *) NULL;
-   if (list-listTail != NULL) {
-   list-listTail-next = new;
-   list-listTail = new;
-   } else {
-   list-listTail = list-listHead = new;
-   }
-   }
+   list-listHead = new;
+   list-listTail = new;
 
return new;
 }
@@ -1800,6 +1770,13 @@ jffs2_1pass_build_lists(struct part_info * part)
}
 
free(buf);
+#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS)
+   /*
+* Sort the lists.
+*/
+   sort_list(pL-frag);
+   sort_list(pL-dir);
+#endif
putstr(\b\b done.\r\n);   /* close off the dots */
 
/* We don't care if malloc failed - then each read operation will
diff --git a/fs/jffs2/jffs2_private.h b/fs/jffs2/jffs2_private.h
index 658b325..06b6ca2 100644
--- a/fs/jffs2/jffs2_private.h
+++ b/fs/jffs2/jffs2_private.h
@@ -98,4 +98,8 @@ data_crc(struct jffs2_raw_inode *node)
}
 }
 
+#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS)
+/* External merge sort. */
+int sort_list(struct b_list *list);
+#endif
 #endif /* jffs2_private.h */
diff --git a/fs/jffs2/mergesort.c b/fs/jffs2/mergesort.c
new file mode 100644
index 000..6e633a1
--- /dev/null
+++ b/fs/jffs2/mergesort.c
@@ -0,0 +1,52 @@
+/*
+ * This file is copyright 2001 Simon Tatham.
+ * Rewritten from original source 2006 by Dan Merillat for use in u-boot.
+ *
+ * Original code can be found at:
+ * http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
+ *
+ * SPDX-License-Identifier:MIT
+ */
+
+#include common.h
+#include jffs2_private.h
+
+int sort_list(struct b_list *list)
+{
+   struct b_node *p, *q, *e, **tail;
+   int k, psize, qsize;
+
+   if (!list-listHead)
+   return 0;
+
+   for (k = 1; k  list-listCount; k *= 2) {
+   tail = list-listHead;
+   for (p = q = list-listHead; p; p = q) {
+   /* step 'k' places from p; */
+   for (psize = 0; q  psize  k; psize++)
+   q = q-next;
+   qsize = k;
+
+   /* two lists, merge them. */
+   

[U-Boot] [PATCH v2 3/8] JFFS2: Only list each directory entry once

2015-06-30 Thread Mark Tomlinson
If multiple versions of a file exist, only the most recent version
should be used. The scheme to write 0 for the inode in older versions
did not work, since this would have required writing to flash.

The only time this caused an issue was listing a directory, where older
versions of the file would still be seen. Since the directory entries
are sorted, just look at the next entry in the list, and if it's the same
move to that entry instead.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Fixed some missing calls to put_fl_mem().

 fs/jffs2/jffs2_1pass.c | 38 +-
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index aaeb522..346f3a1 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -845,7 +845,6 @@ jffs2_1pass_find_inode(struct b_lists * pL, const char 
*name, u32 pino)
jDir = (struct jffs2_raw_dirent *) get_node_mem(b-offset,
pL-readbuf);
if ((pino == jDir-pino)  (len == jDir-nsize) 
-   (jDir-ino)   /* 0 for unlink */
(!strncmp((char *)jDir-name, name, len))) {/* a 
match */
if (jDir-version  version) {
put_fl_mem(jDir, pL-readbuf);
@@ -966,13 +965,43 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
for (b = pL-dir.listHead; b; b = b-next) {
jDir = (struct jffs2_raw_dirent *) get_node_mem(b-offset,
pL-readbuf);
-   if ((pino == jDir-pino)  (jDir-ino)) { /* ino=0 - unlink */
+   if (pino == jDir-pino) {
u32 i_version = 0;
struct jffs2_raw_inode ojNode;
struct jffs2_raw_inode *jNode, *i = NULL;
-   struct b_node *b2 = pL-frag.listHead;
+   struct b_node *b2;
 
-   while (b2) {
+#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
+   /* Check for more recent versions of this file */
+   int match;
+   do {
+   struct b_node *next = b-next;
+   struct jffs2_raw_dirent *jDirNext;
+   if (!next)
+   break;
+   jDirNext = (struct jffs2_raw_dirent *)
+   get_node_mem(next-offset, NULL);
+   match = jDirNext-pino == jDir-pino 
+   jDirNext-nsize == jDir-nsize 
+   strncmp((char *)jDirNext-name,
+   (char *)jDir-name,
+   jDir-nsize) == 0;
+   if (match) {
+   /* Use next. It is more recent */
+   b = next;
+   /* Update buffer with the new info */
+   *jDir = *jDirNext;
+   }
+   put_fl_mem(jDirNext, NULL);
+   } while (match);
+#endif
+   if (jDir-ino == 0) {
+   /* Deleted file */
+   put_fl_mem(jDir, pL-readbuf);
+   continue;
+   }
+
+   for (b2 = pL-frag.listHead; b2; b2 = b2-next) {
jNode = (struct jffs2_raw_inode *)
get_fl_mem(b2-offset, sizeof(ojNode), 
ojNode);
if (jNode-ino == jDir-ino  jNode-version 
= i_version) {
@@ -988,7 +1017,6 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
   sizeof(*i),
   NULL);
}
-   b2 = b2-next;
}
 
dump_inode(pL, jDir, i);
-- 
1.9.1

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


[U-Boot] [PATCH v2 6/8] JFFS2: Change scansize to match linux kernel

2015-06-30 Thread Mark Tomlinson
The scan code is similar to the linux kernel, but the kernel defines a much
smaller size to scan through before deciding a sector is blank. Assuming
that what is in the kernel is OK, make these two match.

On its own, this change makes no difference to scanning of any sectors
which have a clean marker at the beginning, since the entire sector is not
blank.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz
---

Changes in v2: None

 fs/jffs2/jffs2_1pass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index f488537..c55d472 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1480,7 +1480,7 @@ dump_dirents(struct b_lists *pL)
 }
 #endif
 
-#define DEFAULT_EMPTY_SCAN_SIZE4096
+#define DEFAULT_EMPTY_SCAN_SIZE256
 
 static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size)
 {
-- 
1.9.1

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


[U-Boot] [PATCH v2 4/8] JFFS2: Improve speed reading flash files

2015-06-30 Thread Mark Tomlinson
jffs2_1pass_read_inode() would read the entire data for each node
in the filesystem, regardless of whether it was part of the file
to be loaded or not. By only reading the header data for an inode,
and then reading the data only when it is found to be part of the
file to be loaded, much copying of data is saved.

jffs2_1pass_list_inodes() read each inode for every file in the
directory into a buffer. By using NULL as a buffer pointer, NOR
flash simply returns a pointer, and therefore avoids a memory copy.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Change comment style

 fs/jffs2/jffs2_1pass.c | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 346f3a1..e58e7d2 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -735,8 +735,13 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
 #endif
 
for (b = pL-frag.listHead; b != NULL; b = b-next) {
-   jNode = (struct jffs2_raw_inode *) get_node_mem(b-offset,
-   pL-readbuf);
+   /*
+* Copy just the node and not the data at this point,
+* since we don't yet know if we need this data.
+*/
+   jNode = (struct jffs2_raw_inode *)get_fl_mem(b-offset,
+   sizeof(struct jffs2_raw_inode),
+   pL-readbuf);
if (inode == jNode-ino) {
 #if 0
putLabeledWord(\r\n\r\nread_inode: totlen = , 
jNode-totlen);
@@ -760,7 +765,15 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
 #endif
 
if(dest) {
-   src = ((uchar *) jNode) + sizeof(struct 
jffs2_raw_inode);
+   /*
+* Now that the inode has been checked,
+* read the entire inode, including data.
+*/
+   put_fl_mem(jNode, pL-readbuf);
+   jNode = (struct jffs2_raw_inode *)
+   get_node_mem(b-offset, pL-readbuf);
+   src = ((uchar *)jNode) +
+   sizeof(struct jffs2_raw_inode);
/* ignore data behind latest known EOF */
if (jNode-offset  totalSize) {
put_fl_mem(jNode, pL-readbuf);
@@ -967,7 +980,6 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
pL-readbuf);
if (pino == jDir-pino) {
u32 i_version = 0;
-   struct jffs2_raw_inode ojNode;
struct jffs2_raw_inode *jNode, *i = NULL;
struct b_node *b2;
 
@@ -1003,8 +1015,10 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
 
for (b2 = pL-frag.listHead; b2; b2 = b2-next) {
jNode = (struct jffs2_raw_inode *)
-   get_fl_mem(b2-offset, sizeof(ojNode), 
ojNode);
-   if (jNode-ino == jDir-ino  jNode-version 
= i_version) {
+   get_fl_mem(b2-offset, sizeof(*jNode),
+  NULL);
+   if (jNode-ino == jDir-ino 
+   jNode-version = i_version) {
i_version = jNode-version;
if (i)
put_fl_mem(i, NULL);
@@ -1017,6 +1031,7 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
   sizeof(*i),
   NULL);
}
+   put_fl_mem(jNode, NULL);
}
 
dump_inode(pL, jDir, i);
-- 
1.9.1

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


[U-Boot] [PATCH v2 0/8] JFFS2 fixes and performance improvements

2015-06-30 Thread Mark Tomlinson

In reply to comments from Wolfgang Denk and Heiko Schocher:

My aim was to optimize U-Boot's loading of a JFFS2 file, since we needed to
boot much more quickly on one of our devices than we currently were. We had
discussed the possibility of abandoning JFFS2 entirely, but chose to see
how quickly JFFS2 could be made to work. We also knew that Linux would
mount this file system much quicker than u-boot did, so knew that at least
some speed improvement was possible.

The improvments was from three sources: (1) searching U-Boot mailing list
archives, (2) looking at the linux kernel, and (3) our own measurements and
improvements. For example, the merge sort (before my modifications) can be
found here: http://lists.denx.de/pipermail/u-boot/2007-January/018777.html

Two of the patches were inspired from the Linux kernel: Changing scansize,
and recognising the CLEANMARKER. While trying to synchronize U-Boot code
with Linux sounds like a good idea, I think this wouldn't be the right way
to go, since Linux needs to also build lists of blocks which are empty, and
a list of blocks that still need to be erased. Stripping this out is more
work than just enhancing what U-Boot currently has.

=== Original cover message follows ===

These patches fix bugs and improve performance of JFFS2. Some of these
improvements can already be found in old mailing lists, but for some
reason they have not made their way into the u-boot source. I have the
feeling that any one of these patches didn't show enough performance gain
to warrant adding it to the source. I am hopeful that together, all these
patches can be seen to make a big difference.

One of these patches (Only list each directory entry once) is a bug fix,
all the rest are for performance. Although performance is not high on the
priority list for a bootloader, the length of time it was taking to scan
a JFFS2 filesystem was painfully slow.

The code for mergesort was found in an abandoned u-boot patch, although I
have refactored the code somewhat. The original author is still shown at
the top of that file.

The timings below are with jffs2_summary_support turned off. With these
improvements, summary support was no longer useful - most of our time is
now spent loading the actual release. Even without this feature turned on,
the code will still load from a filesystem that has summary nodes.

Due to not having other resources, I also have not done anything for NAND
flash. At least some of these changes will be directly applicable to NAND
as well as NOR.

My own testing is on a system with a 1GHz PowerPC, and 256MB of NOR Flash.
The flash accesses are slow compared with processing power and RAM, so
minimising the number of flash accesses makes a huge difference. Here are
the timing comparisons for three JFFS2 operations on this system:
1) Scanning the file system
2) Getting a director listing of the top level, and
3) Loading a 30MB file.

Times are in seconds, and the contribution from each patch has been
measured:

 ScanListLoadTotal
Original:   266.017.323.4   306.7
Speed up comparison: 52.317.323.493.0
List dir entries once:   52.311.023.486.7
Improve read speed:  52.3 0.8 5.458.5
Optimize building lists: 31.9 0.8 5.438.1
Change scansize: 30.8 0.8 5.437.0
Use cleanmarker: 16.0 0.8 5.422.2
Use mergesort:2.0 0.8 5.4 8.2

Note that List dir entries once is not a speed improvement as such, but
because old versions of a file and deleted files are no longer scanned,
there is an improvement on this filesystem (the flash is approx half full).

Also, change scansize appears to do very little in this benchmark list.
But without it, the use cleanmarker would not show as much improvement.

Changes in v2:
- Fix comment style
- Remove extra {} pair.
- Changed comment style.
- Fixed some missing calls to put_fl_mem().
- Change comment style
- Change comment style
- Changed comment style
- Changed copyright notice to use SPDX-Licence-Identifier.
- Added URL to original mergesort code.
- Removed #ifdef, using Makefile change instead.

Mark Tomlinson (8):
  JFFS2: Return early when file read not necessary
  JFFS2: Speed up and fix comparison functions
  JFFS2: Only list each directory entry once
  JFFS2: Improve speed reading flash files
  JFFS2: Optimize building lists during scan
  JFFS2: Change scansize to match linux kernel
  JFFS2: Use CLEANMARKER to reduce scanning time
  JFFS2: Use merge sort when parsing filesystem

 fs/jffs2/Makefile|   1 +
 fs/jffs2/jffs2_1pass.c   | 257 ++-
 fs/jffs2/jffs2_private.h |   4 +
 fs/jffs2/mergesort.c |  52 ++
 4 files changed, 223 insertions(+), 91 deletions(-)
 create mode 100644 fs/jffs2/mergesort.c

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de

[U-Boot] [PATCH v2 7/8] JFFS2: Use CLEANMARKER to reduce scanning time

2015-06-30 Thread Mark Tomlinson
If a sector has a CLEANMARKER at the beginning, it indicates that the
entire sector has been erased. Therefore, if this is found, we can skip the
entire block. This was not being done before this patch.

The code now does the same as the kernel does when encountering a
CLEANMARKER. It still checks that the next few words are , and if
so, the block is assumed to be empty, and so is skipped.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Changed comment style

 fs/jffs2/jffs2_1pass.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index c55d472..4325792 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1528,6 +1528,8 @@ jffs2_1pass_build_lists(struct part_info * part)
uint32_t sumlen;
int ret;
 #endif
+   /* Indicates a sector with a CLEANMARKER was found */
+   int clean_sector = 0;
 
/* Set buf_size to maximum length */
buf_size = DEFAULT_EMPTY_SCAN_SIZE;
@@ -1652,6 +1654,14 @@ jffs2_1pass_build_lists(struct part_info * part)
ofs += 4;
}
/* Ran off end. */
+   /*
+* If this sector had a clean marker at the
+* beginning, and immediately following this
+* have been a bunch of FF bytes, treat the
+* entire sector as empty.
+*/
+   if (clean_sector)
+   break;
 
/* See how much more there is to read in this
 * eraseblock...
@@ -1673,6 +1683,11 @@ jffs2_1pass_build_lists(struct part_info * part)
buf_ofs = ofs;
goto more_empty;
}
+   /*
+* Found something not erased in the sector, so reset
+* the 'clean_sector' flag.
+*/
+   clean_sector = 0;
if (node-magic != JFFS2_MAGIC_BITMASK ||
!hdr_crc(node)) {
ofs += 4;
@@ -1754,6 +1769,16 @@ jffs2_1pass_build_lists(struct part_info * part)
%d != %zu\n,
node-totlen,
sizeof(struct 
jffs2_unknown_node));
+   if ((node-totlen ==
+sizeof(struct jffs2_unknown_node)) 
+   (ofs == sector_ofs)) {
+   /*
+* Found a CLEANMARKER at the beginning
+* of the sector. It's in the correct
+* place with correct size and CRC.
+*/
+   clean_sector = 1;
+   }
break;
case JFFS2_NODETYPE_PADDING:
if (node-totlen  sizeof(struct 
jffs2_unknown_node))
-- 
1.9.1

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


[U-Boot] [PATCH v2 2/8] JFFS2: Speed up and fix comparison functions

2015-06-30 Thread Mark Tomlinson
Copying complete nodes from flash can be slow if the flash is slow
to read. By only reading the data needed, the sorting operation can
be made much faster.

The directory entry comparison function also had a two bugs. First, it
did not ensure the name was copied, so the name comparison may have
been faulty (although it would have worked with NOR flash).  Second,
setting the ino to zero to ignore the entry did not work, since this
was either writing to a temporary buffer, or (for NOR flash) directly
to flash. Either way, the change was not remembered.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Changed comment style.

 fs/jffs2/jffs2_1pass.c | 87 +++---
 1 file changed, 47 insertions(+), 40 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 2e569ff..aaeb522 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -598,14 +598,18 @@ insert_node(struct b_list *list, u32 offset)
  */
 static int compare_inodes(struct b_node *new, struct b_node *old)
 {
-   struct jffs2_raw_inode ojNew;
-   struct jffs2_raw_inode ojOld;
-   struct jffs2_raw_inode *jNew =
-   (struct jffs2_raw_inode *)get_fl_mem(new-offset, 
sizeof(ojNew), ojNew);
-   struct jffs2_raw_inode *jOld =
-   (struct jffs2_raw_inode *)get_fl_mem(old-offset, 
sizeof(ojOld), ojOld);
-
-   return jNew-version  jOld-version;
+   /*
+* Only read in the version info from flash, not the entire inode.
+* This can make a big difference to speed if flash is slow.
+*/
+   u32 new_version;
+   u32 old_version;
+   get_fl_mem(new-offset + offsetof(struct jffs2_raw_inode, version),
+  sizeof(new_version), new_version);
+   get_fl_mem(old-offset + offsetof(struct jffs2_raw_inode, version),
+  sizeof(old_version), old_version);
+
+   return new_version  old_version;
 }
 
 /* Sort directory entries so all entries in the same directory
@@ -615,42 +619,45 @@ static int compare_inodes(struct b_node *new, struct 
b_node *old)
  */
 static int compare_dirents(struct b_node *new, struct b_node *old)
 {
-   struct jffs2_raw_dirent ojNew;
-   struct jffs2_raw_dirent ojOld;
-   struct jffs2_raw_dirent *jNew =
-   (struct jffs2_raw_dirent *)get_fl_mem(new-offset, 
sizeof(ojNew), ojNew);
-   struct jffs2_raw_dirent *jOld =
-   (struct jffs2_raw_dirent *)get_fl_mem(old-offset, 
sizeof(ojOld), ojOld);
-   int cmp;
-
-   /* ascending sort by pino */
-   if (jNew-pino != jOld-pino)
-   return jNew-pino  jOld-pino;
-
-   /* pino is the same, so use ascending sort by nsize, so
-* we don't do strncmp unless we really must.
-*/
-   if (jNew-nsize != jOld-nsize)
-   return jNew-nsize  jOld-nsize;
-
-   /* length is also the same, so use ascending sort by name
-*/
-   cmp = strncmp((char *)jNew-name, (char *)jOld-name, jNew-nsize);
-   if (cmp != 0)
-   return cmp  0;
-
-   /* we have duplicate names in this directory, so use ascending
-* sort by version
+   /*
+* Using NULL as the buffer for NOR flash prevents the entire node
+* being read. This makes most comparisons much quicker as only one
+* or two entries from the node will be used most of the time.
 */
-   if (jNew-version  jOld-version) {
-   /* since jNew is newer, we know jOld is not valid, so
-* mark it with inode 0 and it will not be used
+   struct jffs2_raw_dirent *jNew = get_node_mem(new-offset, NULL);
+   struct jffs2_raw_dirent *jOld = get_node_mem(old-offset, NULL);
+   int cmp;
+   int ret;
+
+   if (jNew-pino != jOld-pino) {
+   /* ascending sort by pino */
+   ret = jNew-pino  jOld-pino;
+   } else if (jNew-nsize != jOld-nsize) {
+   /*
+* pino is the same, so use ascending sort by nsize,
+* so we don't do strncmp unless we really must.
 */
-   jOld-ino = 0;
-   return 1;
+   ret = jNew-nsize  jOld-nsize;
+   } else {
+   /*
+* length is also the same, so use ascending sort by name
+*/
+   cmp = strncmp((char *)jNew-name, (char *)jOld-name,
+   jNew-nsize);
+   if (cmp != 0) {
+   ret = cmp  0;
+   } else {
+   /*
+* we have duplicate names in this directory,
+* so use ascending sort by version
+*/
+   ret = jNew-version  jOld-version;
+   }
}
+   put_fl_mem(jNew, NULL);
+   put_fl_mem(jOld, NULL);
 
-   return 0;
+   return ret;
 }
 #endif
 
-- 
1.9.1


[U-Boot] [PATCH v2 5/8] JFFS2: Optimize building lists during scan

2015-06-30 Thread Mark Tomlinson
If the flash is slow, reading less from the flash into buffers makes
the process faster.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Change comment style

 fs/jffs2/jffs2_1pass.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index e58e7d2..f488537 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1501,7 +1501,7 @@ jffs2_1pass_build_lists(struct part_info * part)
u32 counterF = 0;
u32 counterN = 0;
u32 max_totlen = 0;
-   u32 buf_size = DEFAULT_EMPTY_SCAN_SIZE;
+   u32 buf_size;
char *buf;
 
nr_sectors = lldiv(part-size, part-sector_size);
@@ -1513,7 +1513,7 @@ jffs2_1pass_build_lists(struct part_info * part)
/* if we are building a list we need to refresh the cache. */
jffs_init_1pass_list(part);
pL = (struct b_lists *)part-jffs2_priv;
-   buf = malloc(buf_size);
+   buf = malloc(DEFAULT_EMPTY_SCAN_SIZE);
puts (Scanning JFFS2 FS:   );
 
/* start at the beginning of the partition */
@@ -1529,6 +1529,8 @@ jffs2_1pass_build_lists(struct part_info * part)
int ret;
 #endif
 
+   /* Set buf_size to maximum length */
+   buf_size = DEFAULT_EMPTY_SCAN_SIZE;
WATCHDOG_RESET();
 
 #ifdef CONFIG_JFFS2_SUMMARY
@@ -1603,6 +1605,11 @@ jffs2_1pass_build_lists(struct part_info * part)
 
ofs += sector_ofs;
prevofs = ofs - 1;
+   /*
+* Set buf_size down to the minimum size required.
+* This prevents reading in chunks of flash data unnecessarily.
+*/
+   buf_size = sizeof(union jffs2_node_union);
 
scan_more:
while (ofs  sector_ofs + part-sector_size) {
@@ -1683,13 +1690,18 @@ jffs2_1pass_build_lists(struct part_info * part)
case JFFS2_NODETYPE_INODE:
if (buf_ofs + buf_len  ofs + sizeof(struct
jffs2_raw_inode)) {
+   buf_len = min_t(uint32_t,
+   sizeof(struct 
jffs2_raw_inode),
+   sector_ofs +
+   part-sector_size -
+   ofs);
get_fl_mem((u32)part-offset + ofs,
   buf_len, buf);
buf_ofs = ofs;
node = (void *)buf;
}
-   if (!inode_crc((struct jffs2_raw_inode *) node))
-  break;
+   if (!inode_crc((struct jffs2_raw_inode *)node))
+   break;
 
if (insert_node(pL-frag, (u32) part-offset +
ofs) == NULL) {
@@ -1706,6 +1718,11 @@ jffs2_1pass_build_lists(struct part_info * part)
((struct
 jffs2_raw_dirent *)
node)-nsize) {
+   buf_len = min_t(uint32_t,
+   node-totlen,
+   sector_ofs +
+   part-sector_size -
+   ofs);
get_fl_mem((u32)part-offset + ofs,
   buf_len, buf);
buf_ofs = ofs;
-- 
1.9.1

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


[U-Boot] [PATCH v2 1/8] JFFS2: Return early when file read not necessary

2015-06-30 Thread Mark Tomlinson
If a destination is not provided, jffs2_1pass_read_inode() only
returns the length of the file. In this case, avoid reading all
the data nodes, and return as soon as the length of the file is
known.

Signed-off-by: Mark Tomlinson mark.tomlin...@alliedtelesis.co.nz

---

Changes in v2:
- Fix comment style
- Remove extra {} pair.

 fs/jffs2/jffs2_1pass.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index b1d6470..2e569ff 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -719,6 +719,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
}
put_fl_mem(jNode, pL-readbuf);
}
+   /*
+* If no destination is provided, we are done.
+* Just return the total size.
+*/
+   if (!dest)
+   return totalSize;
 #endif
 
for (b = pL-frag.listHead; b != NULL; b = b-next) {
-- 
1.9.1

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


Re: [U-Boot] GCC 5.x compile errors

2015-06-30 Thread Albert ARIBAUD
Hello ANDY,

On Tue, 30 Jun 2015 22:02:38 +, ANDY KENNEDY
andy.kenn...@adtran.com wrote:
 Attempted to build u-boot with gcc 5.x for mipsel 32.  Result was that
 I get brokenness around arch/mips/include/asm/io.h and
 arch/mips/include/asm/system.h.  The source lines all look something
 like:
 
 extern inline void func()
 {
   func text ;
 }
 
 Question:  Is that valid C text?  I have never seen such.  Also, what
 does this mean from a header file?  The way I read this is
 
 extern = the following declare exists in global space (no code here)
 
 inline = use this function definition in line in place of creating a
  text ref section
 
 I would expect these two to be mutually exclusive
 
 Please enlighten me!

Actually, extern vs static takes a meaning for inline functions
different from the one for traditional non-inline ones.

If you specify both inline and extern in the function
definition, then the definition is used only for inlining.
In no case is the function compiled on its own, not even
if you refer to its address explicitly. Such an address
becomes an external reference, as if you had only declared
the function, and had not defined it.

See https://gcc.gnu.org/onlinedocs/gcc/Inline.html for all the gory
details on inline functions (this is for the latest version; if you're
working with a specific, older, gcc version, look up the corresponding
page, in case subtle changes were introduced).

 Thanks,
 Andy

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


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Joe Hershberger
Hi Ian,

On Tue, Jun 30, 2015 at 8:30 AM, Ian Campbell i...@hellion.org.uk wrote:
 On Tue, 2015-06-30 at 15:11 +0200, Hans de Goede wrote:
 [...]
 The latest patch-series seems to do the exact reverse. More knowledge is
 being moved away from a central place and into defconfig files. As said
 ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
 defconfig files need to set that explicitly.

 CONFIG_DM* seems like the sort of thing which ought to be select'd not
 default y'd (it's never really an user option, it's something
 something else needs), but the recent change seems like a step in the
 wrong direction either way.

I agree that the DM configs should be selects where there is no other
option (that will usually, maybe always, be the case with those,
right?).

I can see where the recent changes appear to be a step in the wrong
direction, but I believe they are a step out of an unmanageable local
minima. We simply have to get away from defining configs in arch or
board Kconfigs. Unfortunately, the current mechanism for changing
defaults requires this.

I do not believe that we should do nothing further to improve the way
we use Kconfig, but I do believe strongly that we cannot allow this
approach to defaults to proliferate.

For your specific case, sunxi defconfigs should be no different if you
decide to select the DM options that always apply. Perhaps you
didn't look at the next patch which moved all default commands into
the Kconfig where those configs are actually defined?

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


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

2015-06-30 Thread Simon Glass
Hi Dennis,

On 27 June 2015 at 01:39, Dennis Gilmore den...@ausil.us wrote:
 On Sunday, June 07, 2015 06:55:36 PM Simon Glass wrote:
 Hi Tom,

 On 5 June 2015 at 16:27, Tom Warren twar...@nvidia.com wrote:
  Simon,
 
  Applied to u-boot-tegra/master, then I rebased against u-boot/master and
  uploaded it back to denx.de/u-boot-tegra/master.  ./MAKEALL -s tegra
  works OK. I didn't test on any real HW - my nyan-big system is offline
  temporarily.
 
  PTAL and let me know if it's working OK and I'll get a PR out to TomR
  first thing next week.
 Thanks - it seems to work fine for me.

 Trying to test this out and I think I am missing something in how to get it
 installed so it just works. is there some docs somewhere on how to get it
 installed?

This question was asked on IRC just recently.

According to this thread, Sjeord has it working:

https://www.marc.info/?l=u-bootm=142775949208335w=1

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


Re: [U-Boot] [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

2015-06-30 Thread Simon Glass
Hi,

On 29 June 2015 at 22:18, Kushwaha Prabhakar prabha...@freescale.com wrote:
 Hi Simon, Tom,

 -fdelete-null-pointer-checks flag controls global dataflow analyses and  
 eliminate useless checks for null pointers; It assume that if a pointer is  
 checked after it has already been dereferenced, it cannot be null.  This flag 
 is enabled by default.
  gcc v4.9 has more optimizations added to this option. Hence it is very  
 aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 
 release notes:
 https://gcc.gnu.org/gcc-4.9/porting_to.html

 There is possibility after moving to gcc-4.9 some platform may/may not work 
 properly.
 I tested this patch for freescale powerpc platforms.
 But It may needs be taken care by all architecture like ARM, powerpc. If this 
 is the case; this flag should be in top level Makefile (not sure)


I suspect a top-level option would be best, perhaps near this one in Makefile:

KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)

Regards,
Simon

 Regards,
 Prabhakar

 -Original Message-
 From: Wood Scott-B07421
 Sent: Wednesday, May 20, 2015 11:04 PM
 To: Sun York-R58495
 Cc: Kushwaha Prabhakar-B32579; u-boot@lists.denx.de; Dharmakan Rohit-
 B30502
 Subject: Re: [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null-
 pointer-checks

 On Wed, 2015-05-20 at 10:10 -0700, York Sun wrote:
  Scott,
 
  Please comment on this patch.
 
  York

 I think this should be set treewide (as Linux does), not just for mpc85xx.  
 But
 use cc-option to make sure that the compiler supports the option.

 -Scott

 
  On 05/06/2015 11:07 PM, Prabhakar Kushwaha wrote:
-fdelete-null-pointer-checks flag controls global dataflow analyses
   and  eliminate useless checks for null pointers; It assume that if a
   pointer is  checked after it has already been dereferenced, it cannot be
 null.
This flag is enabled by default.
  
gcc v4.9 has more optimizations added to this option. Hence it is
   very  aggressive with GCC v4.9 series. Add
   -fno-delete-null-pointer-checks to  disable the optimization
  
   Signed-off-by: Rohit Dharmakan rohitarul...@freescale.com
   Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
   ---
arch/powerpc/cpu/mpc85xx/config.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
  
   diff --git a/arch/powerpc/cpu/mpc85xx/config.mk
   b/arch/powerpc/cpu/mpc85xx/config.mk
   index 72c964c..2aedd24 100644
   --- a/arch/powerpc/cpu/mpc85xx/config.mk
   +++ b/arch/powerpc/cpu/mpc85xx/config.mk
   @@ -5,7 +5,8 @@
# SPDX-License-Identifier:   GPL-2.0+
#
  
   -PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
   +PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string \
   + -fno-delete-null-pointer-checks
  
# -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;  #
   see [PATCH,rs6000] make -mno-spe work as expected on
  


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


Re: [U-Boot] [PATCH v3 16/16] spi: Kconfig: Add Zynq SPI controller entry

2015-06-30 Thread Simon Glass
On 26 June 2015 at 13:21, Jagan Teki jt...@openedev.com wrote:
 Add Zynq SPI controller Kconfig entry.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Simon Glass s...@chromium.org
 Cc: Marek Vasut ma...@denx.de
 Cc: Michal Simek michal.si...@xilinx.com
 Cc: Siva Durga Prasad Paladugu siva...@xilinx.com
 ---
  drivers/spi/Kconfig | 8 
  1 file changed, 8 insertions(+)


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


[U-Boot] [PATCH] nitrogen6x: change maintainer

2015-06-30 Thread Eric Nelson
Troy Kisky will be maintaining the Nitrogen6x board going forward.

Signed-off-by: Eric Nelson eric.nel...@boundarydevices.com
---
 board/boundary/nitrogen6x/MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/MAINTAINERS 
b/board/boundary/nitrogen6x/MAINTAINERS
index cb06c03..1602d65 100644
--- a/board/boundary/nitrogen6x/MAINTAINERS
+++ b/board/boundary/nitrogen6x/MAINTAINERS
@@ -1,5 +1,5 @@
 NITROGEN6X BOARD
-M: Eric Nelson eric.nel...@boundarydevices.com
+M: Troy Kisky troy.ki...@boundarydevices.com
 S: Maintained
 F: board/boundary/nitrogen6x/
 F: include/configs/nitrogen6x.h
-- 
2.4.5

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


Re: [U-Boot] [PATCH] x86: baytrail: Configure FSP UPD from device tree

2015-06-30 Thread Simon Glass
+Bin

Hi Andrew,

On 29 June 2015 at 09:10, and...@bradfordembedded.com wrote:

 From: Andrew Bradford andrew.bradf...@kodakalaris.com

 Allow for configuration of FSP UPD from the device tree which will
 override any settings which the FSP was built with itself if the device
 tree settings exist, otherwise simply trust the FSP's defaults.

 Modifies the MinnowMax board to transfer the FSP UPD hard-coded settings
 to the MinnowMax dts.

 Signed-off-by: Andrew Bradford andrew.bradf...@kodakalaris.com
 ---
  arch/x86/cpu/baytrail/fsp_configs.c| 183 
 +
  arch/x86/dts/minnowmax.dts |  27 +++
  .../misc/intel,baytrail-fsp.txt| 113 +
  include/fdtdec.h   |   1 +
  lib/fdtdec.c   |   1 +
  5 files changed, 295 insertions(+), 30 deletions(-)
  create mode 100644 doc/device-tree-bindings/misc/intel,baytrail-fsp.txt

This is a big step forward in flexibility, thanks for sending this.


 diff --git a/arch/x86/cpu/baytrail/fsp_configs.c 
 b/arch/x86/cpu/baytrail/fsp_configs.c
 index 86b6926..fd07eca 100644
 --- a/arch/x86/cpu/baytrail/fsp_configs.c
 +++ b/arch/x86/cpu/baytrail/fsp_configs.c
 @@ -1,11 +1,13 @@
  /*
   * Copyright (C) 2013, Intel Corporation
   * Copyright (C) 2014, Bin Meng bmeng...@gmail.com
 + * Copyright (C) 2015, Kodak Alaris
   *
   * SPDX-License-Identifier:Intel
   */

  #include common.h
 +#include fdtdec.h
  #include asm/arch/fsp/azalia.h
  #include asm/fsp/fsp_support.h

 @@ -116,41 +118,162 @@ const struct pch_azalia_config azalia_config = {
 .reset_wait_timer_us = 300
  };

 +/**
 + * Update the FSP's UPD.  The FSP itself can be configured for defaults to
 + * store in UPD through Intel's GUI configurator but likely a specific board
 + * will want to update these from u-boot, so allow for that via device tree.
 + * If the device tree does not specify a setting, trust the FSP's default.
 + */
  void update_fsp_upd(struct upd_region *fsp_upd)
  {
 struct memory_down_data *mem;
 +   const void *blob = gd-fdt_blob;
 +   int node;

 -   /*
 -* Configure everything here to avoid the poor hard-pressed user
 -* needing to run Intel's binary configuration tool. It may also allow
 -* us to support the 1GB single core variant easily.
 -*
 -* TODO(s...@chromium.org): Move to device tree
 -*/
 -   fsp_upd-mrc_init_tseg_size = 8;
 -   fsp_upd-mrc_init_mmio_size = 0x800;
 -   fsp_upd-emmc_boot_mode = 0xff;
 -   fsp_upd-enable_sdio = 1;
 -   fsp_upd-enable_sdcard = 1;
 -   fsp_upd-enable_hsuart0 = 1;
 fsp_upd-azalia_config_ptr = (uint32_t)azalia_config;
 -   fsp_upd-enable_i2_c0 = 0;
 -   fsp_upd-enable_i2_c2 = 0;
 -   fsp_upd-enable_i2_c3 = 0;
 -   fsp_upd-enable_i2_c4 = 0;
 -   fsp_upd-enable_xhci = 0;
 -   fsp_upd-igd_render_standby = 1;
 +
 +   node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_BAYTRAIL_FSP);
 +   if (node  0) {
 +   debug(%s: Cannot find FSP node\n, __func__);
 +   /* TODO: change return type for error indication */
 +   return;
 +   }
 +
 +   fsp_upd-mrc_init_tseg_size = fdtdec_get_int(blob, node,
 +mrc_int_tseg_size,
 +
 fsp_upd-mrc_init_tseg_size);
 +   fsp_upd-mrc_init_mmio_size = fdtdec_get_int(blob, node,
 +mrc_init_mmio_size,
 +
 fsp_upd-mrc_init_mmio_size);
 +   fsp_upd-mrc_init_spd_addr1 = fdtdec_get_int(blob, node,
 +mrc_init_spd_addr1,
 +
 fsp_upd-mrc_init_spd_addr1);
 +   fsp_upd-mrc_init_spd_addr2 = fdtdec_get_int(blob, node,
 +mrc_init_spd_addr2,
 +
 fsp_upd-mrc_init_spd_addr2);
 +   fsp_upd-emmc_boot_mode = fdtdec_get_int(blob, node, emmc_boot_mode,
 +fsp_upd-emmc_boot_mode);
 +   fsp_upd-enable_sdio = fdtdec_get_int(blob, node, enable_sdio,
 + fsp_upd-enable_sdio);

Shouldn't these be booleans?

 +   fsp_upd-enable_sdcard = fdtdec_get_int(blob, node, enable_sdcard,
 +   fsp_upd-enable_sdcard);
 +   fsp_upd-enable_hsuart0 = fdtdec_get_int(blob, node, enable_hsuart0,
 +fsp_upd-enable_hsuart0);
 +   fsp_upd-enable_hsuart1 = fdtdec_get_int(blob, node, enable_hsuart1,
 +fsp_upd-enable_hsuart1);
 +   fsp_upd-enable_spi = fdtdec_get_int(blob, node, enable_spi,
 

Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 04:58 PM, Simon Glass wrote:

Hi Hans,

On 30 June 2015 at 06:54, Hans de Goede hdego...@redhat.com wrote:

Hi,

On 29-06-15 05:45, Simon Glass wrote:


Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:


On an usb stop instead of leaving orphan usb devices behind simply remove



On a usb_stop()

or

On a 'usb stop' command  ?



My intention was for both, since I was under the assumption that usb stop
on the cmdline, was the only caller of usb_stop(), but a quick grep to the
sources show that I'm wrong ...


them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
usb_stop() when that is set.



This seems a little unfortunate. I can see the reasoning, but do you
think this is necessary? I suspect people chasing code size may remove
that option and still want to use USB properly.



This was mostly a result of my thinking that usb_stop() is only used
on usb stop at the cmdline, which I know realize is wrong.

However my quick grep has learned that we do really need
CONFIG_DM_DEVICE_REMOVE
to properly implement usb_stop():

 From common/bootm.c :

#if defined(CONFIG_CMD_USB)
 /*
  * turn off USB to prevent the host controller from writing to the
  * SDRAM while Linux is booting. This could happen (at least for
OHCI
  * controller), because the HCCA (Host Controller Communication
Area)
  * lies within the SDRAM and the host controller writes continously
to
  * this area (as busmaster!). The HccaFrameNumber is for example
  * updated every 1 ms within the HCCA structure in SDRAM! For more
  * details see the OpenHCI specification.
  */
 usb_stop();
#endif

And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's remove
callback and thus do not properly stop the usb controller.

So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already exists
before this patch. If you want I can split out the adding of the #ifdef
in a separate commit, spelling out why usb_stop() MUST have
CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this all
to
Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?



I don't think that is necessary, it feels a bit too inflexible. But
perhaps you could add a comment to the Kconfig help for
CONFIG_DM_DEVICE_REMOVE?


Ok will do.


It is remove() that is needed, not unbind(). Actually I think it is
quite unfortunate to make usb_stop() call unbind. It is a waste of
time to do this just before booting the kernel - the current design
leaves all devices bound (but I hope we can remove() them at some
point).

Instead, I wonder if we can remove the children when we probe the bus?


That should work, but I do not really see any advantage in that,
removing the children is not that expensive and it feels like a
kludge.


Also, what happens to children that are in the device tree - i.e.
static USB devices like WiFi? The device tree might have parameters
for them. Still, that might not matter as I'm not sure that case is
handled correctly today.


AFAIK there is no such thing as usb devices in devicetree, which
makes sense as usb is a fully discoverable bus.












The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
instead, before this commit the output would be:

   usb [ + ]`-- sunxi-musb
   usb_hub [   ]|-- usb_hub
   usb_mass_st [   ]|   |-- usb_mass_storage
   usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
   usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes
usb_get_dev_index
to return NULL when probing the first child, which results in the usb kbd
code not binding to the keyboard.



Although I suspect that could be fixed.



Right, but just removing the children is a much cleaner solution, and also
makes the output of dm tree properly reflect reality.


True, although you also have 'usb tree' for that. Another option would
be to mark devices that were found and remove the others after the
scan.


That seems like needless complexity. I believe that simply removing + unbinding
the children on usb_stop is the right thing to do, and it also is the KISS
solution.

Regards,

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


Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Simon Glass
Hi Hans,

On 30 June 2015 at 09:54, Hans de Goede hdego...@redhat.com wrote:
 Hi,


 On 06/30/2015 04:58 PM, Simon Glass wrote:

 Hi Hans,

 On 30 June 2015 at 06:54, Hans de Goede hdego...@redhat.com wrote:

 Hi,

 On 29-06-15 05:45, Simon Glass wrote:


 Hi Hans,

 On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:


 On an usb stop instead of leaving orphan usb devices behind simply
 remove



 On a usb_stop()

 or

 On a 'usb stop' command  ?



 My intention was for both, since I was under the assumption that usb
 stop
 on the cmdline, was the only caller of usb_stop(), but a quick grep to
 the
 sources show that I'm wrong ...

 them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
 usb_stop() when that is set.



 This seems a little unfortunate. I can see the reasoning, but do you
 think this is necessary? I suspect people chasing code size may remove
 that option and still want to use USB properly.



 This was mostly a result of my thinking that usb_stop() is only used
 on usb stop at the cmdline, which I know realize is wrong.

 However my quick grep has learned that we do really need
 CONFIG_DM_DEVICE_REMOVE
 to properly implement usb_stop():

  From common/bootm.c :

 #if defined(CONFIG_CMD_USB)
  /*
   * turn off USB to prevent the host controller from writing to
 the
   * SDRAM while Linux is booting. This could happen (at least for
 OHCI
   * controller), because the HCCA (Host Controller Communication
 Area)
   * lies within the SDRAM and the host controller writes
 continously
 to
   * this area (as busmaster!). The HccaFrameNumber is for example
   * updated every 1 ms within the HCCA structure in SDRAM! For
 more
   * details see the OpenHCI specification.
   */
  usb_stop();
 #endif

 And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's
 remove
 callback and thus do not properly stop the usb controller.

 So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already
 exists
 before this patch. If you want I can split out the adding of the #ifdef
 in a separate commit, spelling out why usb_stop() MUST have
 CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this
 all
 to
 Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?


 I don't think that is necessary, it feels a bit too inflexible. But
 perhaps you could add a comment to the Kconfig help for
 CONFIG_DM_DEVICE_REMOVE?


 Ok will do.

 It is remove() that is needed, not unbind(). Actually I think it is
 quite unfortunate to make usb_stop() call unbind. It is a waste of
 time to do this just before booting the kernel - the current design
 leaves all devices bound (but I hope we can remove() them at some
 point).

 Instead, I wonder if we can remove the children when we probe the bus?


 That should work, but I do not really see any advantage in that,
 removing the children is not that expensive and it feels like a
 kludge.

That's how it currently works, from what I can see in the code. But
since there is a 'usb_started' boolean this is irrelevant.


 Also, what happens to children that are in the device tree - i.e.
 static USB devices like WiFi? The device tree might have parameters
 for them. Still, that might not matter as I'm not sure that case is
 handled correctly today.


 AFAIK there is no such thing as usb devices in devicetree, which
 makes sense as usb is a fully discoverable bus.

Sort-of. But as with PCI it is useful to be able to add settings for
the devices in some cases. You can match them using vendor/device or
interface IDs. Then the driver can access its settings.

That's why I'm suggesting we unbind the devices that are no-longer present.









 The result of this commit is best seen in the output of dm tree after
 plugging out an usb hub with 2 devices plugges in and plugging in a
 keyb.
 instead, before this commit the output would be:

usb [ + ]`-- sunxi-musb
usb_hub [   ]|-- usb_hub
usb_mass_st [   ]|   |-- usb_mass_storage
usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
usb_dev_gen [ + ]`-- generic_bus_0_dev_1

 Notice the non active usb_hub child and its 2 non active children. The
 first child being non-active as in this example also causes
 usb_get_dev_index
 to return NULL when probing the first child, which results in the usb
 kbd
 code not binding to the keyboard.



 Although I suspect that could be fixed.



 Right, but just removing the children is a much cleaner solution, and
 also
 makes the output of dm tree properly reflect reality.


 True, although you also have 'usb tree' for that. Another option would
 be to mark devices that were found and remove the others after the
 scan.


 That seems like needless complexity. I believe that simply removing +
 unbinding
 the children on usb_stop is the right thing to do, and it also is the KISS
 solution.

I'm good with the 

Re: [U-Boot] [PATCH] net: designware: fix driver name

2015-06-30 Thread Joe Hershberger
Hi Masahiro-san,

On Tue, Jun 30, 2015 at 12:20 AM, Masahiro Yamada
yamada.masah...@socionext.com wrote:
 Joe,

 Ping.

 2015-05-27 14:57 GMT+09:00 Masahiro Yamada yamada.masah...@socionext.com:
 It is working, but not nice...

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

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

 diff --git a/drivers/net/designware.c b/drivers/net/designware.c
 index ae51cf3..bfce218 100644
 --- a/drivers/net/designware.c
 +++ b/drivers/net/designware.c
 @@ -605,7 +605,7 @@ static const struct udevice_id designware_eth_ids[] = {
 { }
  };

 -U_BOOT_DRIVER(eth_sandbox) = {
 +U_BOOT_DRIVER(eth_designware) = {
 .name   = eth_designware,
 .id = UCLASS_ETH,
 .of_match = designware_eth_ids,
 --

Acked-by: Joe Hershberger joe.hershber...@ni.com

I'll pull this into u-boot-net/next, thanks!

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


Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Simon Glass
Hi Hans,

On 30 June 2015 at 06:54, Hans de Goede hdego...@redhat.com wrote:
 Hi,

 On 29-06-15 05:45, Simon Glass wrote:

 Hi Hans,

 On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

 On an usb stop instead of leaving orphan usb devices behind simply remove


 On a usb_stop()

 or

 On a 'usb stop' command  ?


 My intention was for both, since I was under the assumption that usb stop
 on the cmdline, was the only caller of usb_stop(), but a quick grep to the
 sources show that I'm wrong ...

 them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
 usb_stop() when that is set.


 This seems a little unfortunate. I can see the reasoning, but do you
 think this is necessary? I suspect people chasing code size may remove
 that option and still want to use USB properly.


 This was mostly a result of my thinking that usb_stop() is only used
 on usb stop at the cmdline, which I know realize is wrong.

 However my quick grep has learned that we do really need
 CONFIG_DM_DEVICE_REMOVE
 to properly implement usb_stop():

 From common/bootm.c :

 #if defined(CONFIG_CMD_USB)
 /*
  * turn off USB to prevent the host controller from writing to the
  * SDRAM while Linux is booting. This could happen (at least for
 OHCI
  * controller), because the HCCA (Host Controller Communication
 Area)
  * lies within the SDRAM and the host controller writes continously
 to
  * this area (as busmaster!). The HccaFrameNumber is for example
  * updated every 1 ms within the HCCA structure in SDRAM! For more
  * details see the OpenHCI specification.
  */
 usb_stop();
 #endif

 And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's remove
 callback and thus do not properly stop the usb controller.

 So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already exists
 before this patch. If you want I can split out the adding of the #ifdef
 in a separate commit, spelling out why usb_stop() MUST have
 CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this all
 to
 Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?


I don't think that is necessary, it feels a bit too inflexible. But
perhaps you could add a comment to the Kconfig help for
CONFIG_DM_DEVICE_REMOVE?

It is remove() that is needed, not unbind(). Actually I think it is
quite unfortunate to make usb_stop() call unbind. It is a waste of
time to do this just before booting the kernel - the current design
leaves all devices bound (but I hope we can remove() them at some
point).

Instead, I wonder if we can remove the children when we probe the bus?
Also, what happens to children that are in the device tree - i.e.
static USB devices like WiFi? The device tree might have parameters
for them. Still, that might not matter as I'm not sure that case is
handled correctly today.





 The result of this commit is best seen in the output of dm tree after
 plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
 instead, before this commit the output would be:

   usb [ + ]`-- sunxi-musb
   usb_hub [   ]|-- usb_hub
   usb_mass_st [   ]|   |-- usb_mass_storage
   usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
   usb_dev_gen [ + ]`-- generic_bus_0_dev_1

 Notice the non active usb_hub child and its 2 non active children. The
 first child being non-active as in this example also causes
 usb_get_dev_index
 to return NULL when probing the first child, which results in the usb kbd
 code not binding to the keyboard.


 Although I suspect that could be fixed.


 Right, but just removing the children is a much cleaner solution, and also
 makes the output of dm tree properly reflect reality.

True, although you also have 'usb tree' for that. Another option would
be to mark devices that were found and remove the others after the
scan.





 With this commit in place the output after swapping and usb reset is:

   usb [ + ]`-- sunxi-musb
   usb_dev_gen [ + ]`-- generic_bus_0_dev_1

 As expected, and usb_get_dev_index works properly and the keyboard works.

 After this commit usb_find_child() is only necessary for emulated usb
 devices, so make its body #ifdef CONFIG_USB_EMUL.

 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
   drivers/usb/host/usb-uclass.c | 10 ++
   1 file changed, 10 insertions(+)

 diff --git a/drivers/usb/host/usb-uclass.c
 b/drivers/usb/host/usb-uclass.c
 index bce6cec..8f26e35 100644
 --- a/drivers/usb/host/usb-uclass.c
 +++ b/drivers/usb/host/usb-uclass.c
 @@ -128,6 +128,7 @@ int usb_alloc_device(struct usb_device *udev)
  return ops-alloc_device(bus, udev);
   }

 +#ifdef CONFIG_DM_DEVICE_REMOVE
   int usb_stop(void)
   {
  struct udevice *bus;
 @@ -143,6 +144,12 @@ int usb_stop(void)
  uc_priv = uc-priv;

  uclass_foreach_dev(bus, uc) {
 +   ret = device_chld_remove(bus);
 

Re: [U-Boot] [PATCH 04/22] usb: Pass device instead of portnr to usb_legacy_port_reset

2015-06-30 Thread Simon Glass
Hi Hans,

On 30 June 2015 at 06:31, Hans de Goede hdego...@redhat.com wrote:
 Hi,


 On 29-06-15 05:44, Simon Glass wrote:

 Hi Hans,

 On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

 Pass the usb_device instead of the portnr to usb_legacy_port_reset and
 rename it to usb_hub_port_reset as there is nothing legacy about it.

 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
   common/usb.c | 8 
   1 file changed, 4 insertions(+), 4 deletions(-)


 Legacy as in not driver model.


 Except that it gets used in both device-model and non device model
 builds of the usb-stack.

Yes, and the non-driver-model stuff can presumably be considered
'legacy' at this point?

Acked-by: Simon Glass s...@chromium.org


 Regards,

 Hans

 p.s.

 Thanks for reviewing this largish series!

You're welcome. It's a lot easier than writing it :-)

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


Re: [U-Boot] [PATCH 10/11 v2] drivers/net/vsc9953: Add commands for VLAN ingress filtering

2015-06-30 Thread Codrin Constantin Ciubotariu
Hi Joe,

I will make a v3 with your suggestions.

Thanks and best regards,
Codrin

 -Original Message-
 From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
 Sent: Friday, June 26, 2015 1:42 AM
 To: Ciubotariu Codrin Constantin-B43658
 Cc: u-boot; Joe Hershberger; Sun York-R58495
 Subject: Re: [U-Boot] [PATCH 10/11 v2] drivers/net/vsc9953: Add commands for
 VLAN ingress filtering

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


Re: [U-Boot] [PATCH 03/22] usb: usb_setup_device: Drop unneeded portnr function argument

2015-06-30 Thread Simon Glass
Hi Hans,

On 30 June 2015 at 06:29, Hans de Goede hdego...@redhat.com wrote:
 Hi,


 On 29-06-15 05:44, Simon Glass wrote:

 Hi Hans.

 On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

 Drop the unneeded portnr function argument, the portnr is part of the
 usb_device struct which is passed via the dev argument.

 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
   common/usb.c  | 10 +-
   drivers/usb/host/usb-uclass.c |  2 +-
   include/usb.h |  6 +++---
   3 files changed, 9 insertions(+), 9 deletions(-)


 This was needed in the case where a fake usb_device was passed in. Has
 your previous refactoring changed that?


 The portnr is still passed but it is padded via the usb_device struct's
 portnr member. When doing a CONFIG_DM_USB=y build the only call site of
 usb_setup_device() is usb_scan_device() from drivers/usb/host/usb-uclass.c
 which does:

 udev-portnr = port;
 debug(Calling usb_setup_device(), portnr=%d\n, udev-portnr);
 parent_udev = device_get_uclass_id(parent) == UCLASS_USB_HUB ?
 dev_get_parentdata(parent) : NULL;
 ret = usb_setup_device(udev, priv-desc_before_addr, parent_udev);

 So portnr is always set in the usb_device strict, and that is what gets
 used after this patch.

OK thanks for explaining that.

Acked-by: Simon Glass s...@chromium.org

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


Re: [U-Boot] git fsck errors with u-boot

2015-06-30 Thread Liam R. Howlett
* Wolfgang Denk w...@denx.de [150630 07:29]:
 Dear Liam R. Howlett,
 
 In message 20150629173158.gd24...@yow-lhowlett-d0.wrs.com you wrote:
  
  Since git 2.1, there have been a number of new fsck options added which
  produce issues when I clone  fsck the repository
  git://git.denx.de/u-boot.git
 ...
  I think these issues were already reported here:
  https://www.mail-archive.com/u-boot@lists.denx.de/msg175411.html but
  were not reproducible.   Can you see if they can be reproduced using a
  newer git (2.4 or 2.3) and git fsck --full ?
 
 Indeed these have been reported before - see the full thread at [1]
 
 [1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/223976
 
 To summarize: there is no problem with the U-Boot repository, but a
 false positive in git; the git folks are working on it, and it will
 problebly be fixed in later versions of git.  There is no need for any
 action on our side.
 
 Best regards,
 
 Wolfgang Denk

Hello Wolfgang,

Thank you very much for the summary and the link.  I appreciate your
time on this matter.

Cheers,
Liam

 
 -- 
 DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
 :   I've tried (in vi) g/[a-z]\n[a-z]/s//_/...but that doesn't
 : cut it.  Any ideas?  (I take it that it may be a two-pass sort of solution).
 In the first pass, install perl. :-) Larry Wall 6...@jpl-devvax.jpl.nasa.gov
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread York Sun
Simon,

Does the dm force using device tree? I was reviewing a patch set regarding SPI
and found OF_CONTROL has to be selected in order to get the driver model happy.

My understanding of the driver model is both device tree and platform data are
allowed, like Linux. Is that still true?

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


Re: [U-Boot] [PATCH] x86: baytrail: Configure FSP UPD from device tree

2015-06-30 Thread Simon Glass
Hi Andrew,

On 30 June 2015 at 10:58, Andrew Bradford and...@bradfordembedded.com wrote:

 Hi Simon,

 On 06/30 09:29, Simon Glass wrote:
  +Bin
 
  Hi Andrew,
 
  On 29 June 2015 at 09:10, and...@bradfordembedded.com wrote:
  
   From: Andrew Bradford andrew.bradf...@kodakalaris.com
  
   Allow for configuration of FSP UPD from the device tree which will
   override any settings which the FSP was built with itself if the device
   tree settings exist, otherwise simply trust the FSP's defaults.
  
   Modifies the MinnowMax board to transfer the FSP UPD hard-coded settings
   to the MinnowMax dts.
  
   Signed-off-by: Andrew Bradford andrew.bradf...@kodakalaris.com
   ---
arch/x86/cpu/baytrail/fsp_configs.c| 183 
   +
arch/x86/dts/minnowmax.dts |  27 +++
.../misc/intel,baytrail-fsp.txt| 113 +
include/fdtdec.h   |   1 +
lib/fdtdec.c   |   1 +
5 files changed, 295 insertions(+), 30 deletions(-)
create mode 100644 doc/device-tree-bindings/misc/intel,baytrail-fsp.txt
 
  This is a big step forward in flexibility, thanks for sending this.
 
  
   diff --git a/arch/x86/cpu/baytrail/fsp_configs.c 
   b/arch/x86/cpu/baytrail/fsp_configs.c
   index 86b6926..fd07eca 100644
   --- a/arch/x86/cpu/baytrail/fsp_configs.c
   +++ b/arch/x86/cpu/baytrail/fsp_configs.c
   @@ -1,11 +1,13 @@
/*
 * Copyright (C) 2013, Intel Corporation
 * Copyright (C) 2014, Bin Meng bmeng...@gmail.com
   + * Copyright (C) 2015, Kodak Alaris
 *
 * SPDX-License-Identifier:Intel
 */
  
#include common.h
   +#include fdtdec.h
#include asm/arch/fsp/azalia.h
#include asm/fsp/fsp_support.h
  
   @@ -116,41 +118,162 @@ const struct pch_azalia_config azalia_config = {
   .reset_wait_timer_us = 300
};
  
   +/**
   + * Update the FSP's UPD.  The FSP itself can be configured for defaults 
   to
   + * store in UPD through Intel's GUI configurator but likely a specific 
   board
   + * will want to update these from u-boot, so allow for that via device 
   tree.
   + * If the device tree does not specify a setting, trust the FSP's 
   default.
   + */
void update_fsp_upd(struct upd_region *fsp_upd)
{
   struct memory_down_data *mem;
   +   const void *blob = gd-fdt_blob;
   +   int node;
  
   -   /*
   -* Configure everything here to avoid the poor hard-pressed user
   -* needing to run Intel's binary configuration tool. It may also 
   allow
   -* us to support the 1GB single core variant easily.
   -*
   -* TODO(s...@chromium.org): Move to device tree
   -*/
   -   fsp_upd-mrc_init_tseg_size = 8;
   -   fsp_upd-mrc_init_mmio_size = 0x800;
   -   fsp_upd-emmc_boot_mode = 0xff;
   -   fsp_upd-enable_sdio = 1;
   -   fsp_upd-enable_sdcard = 1;
   -   fsp_upd-enable_hsuart0 = 1;
   fsp_upd-azalia_config_ptr = (uint32_t)azalia_config;
   -   fsp_upd-enable_i2_c0 = 0;
   -   fsp_upd-enable_i2_c2 = 0;
   -   fsp_upd-enable_i2_c3 = 0;
   -   fsp_upd-enable_i2_c4 = 0;
   -   fsp_upd-enable_xhci = 0;
   -   fsp_upd-igd_render_standby = 1;
   +
   +   node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_BAYTRAIL_FSP);
   +   if (node  0) {
   +   debug(%s: Cannot find FSP node\n, __func__);
   +   /* TODO: change return type for error indication */
   +   return;
   +   }
   +
   +   fsp_upd-mrc_init_tseg_size = fdtdec_get_int(blob, node,
   +mrc_int_tseg_size,
   +
   fsp_upd-mrc_init_tseg_size);
   +   fsp_upd-mrc_init_mmio_size = fdtdec_get_int(blob, node,
   +mrc_init_mmio_size,
   +
   fsp_upd-mrc_init_mmio_size);
   +   fsp_upd-mrc_init_spd_addr1 = fdtdec_get_int(blob, node,
   +mrc_init_spd_addr1,
   +
   fsp_upd-mrc_init_spd_addr1);
   +   fsp_upd-mrc_init_spd_addr2 = fdtdec_get_int(blob, node,
   +mrc_init_spd_addr2,
   +
   fsp_upd-mrc_init_spd_addr2);
   +   fsp_upd-emmc_boot_mode = fdtdec_get_int(blob, node, 
   emmc_boot_mode,
   +fsp_upd-emmc_boot_mode);
   +   fsp_upd-enable_sdio = fdtdec_get_int(blob, node, enable_sdio,
   + fsp_upd-enable_sdio);
 
  Shouldn't these be booleans?

 Yes, probably all the enable elements should be booleans, I'll fix in
 v2.

 
   +   fsp_upd-enable_sdcard = fdtdec_get_int(blob, 

Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 10:48:20AM -0500, Joe Hershberger wrote:
 Hi Ian,
 
 On Tue, Jun 30, 2015 at 8:30 AM, Ian Campbell i...@hellion.org.uk wrote:
  On Tue, 2015-06-30 at 15:11 +0200, Hans de Goede wrote:
  [...]
  The latest patch-series seems to do the exact reverse. More knowledge is
  being moved away from a central place and into defconfig files. As said
  ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
  defconfig files need to set that explicitly.
 
  CONFIG_DM* seems like the sort of thing which ought to be select'd not
  default y'd (it's never really an user option, it's something
  something else needs), but the recent change seems like a step in the
  wrong direction either way.
 
 I agree that the DM configs should be selects where there is no other
 option (that will usually, maybe always, be the case with those,
 right?).
 
 I can see where the recent changes appear to be a step in the wrong
 direction, but I believe they are a step out of an unmanageable local
 minima. We simply have to get away from defining configs in arch or
 board Kconfigs. Unfortunately, the current mechanism for changing
 defaults requires this.

Both the Kconfig and DM transition mean that we'll probably end up with
some ugly bits for a while.  But I want to take a poke around again and
see if it can be a bit better now, today.

 I do not believe that we should do nothing further to improve the way
 we use Kconfig, but I do believe strongly that we cannot allow this
 approach to defaults to proliferate.
 
 For your specific case, sunxi defconfigs should be no different if you
 decide to select the DM options that always apply. Perhaps you
 didn't look at the next patch which moved all default commands into
 the Kconfig where those configs are actually defined?

No, checkout say configs/A10-OLinuXino-Lime_defconfig and see all of the
DM_* stuff that's in there.  Hans' point is that it shouldn't be since
they must be set.  Having them correct in the config files (IMHO) helps,
but Hans' point I believe (And I see the validity there, there's _60_
sunxi boards today and more every week practically) is that making each
new board set this is wrong on many levels.

-- 
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] dm-spi: spi_chip_select value

2015-06-30 Thread Jagan Teki
Hi Simon,

On 27 June 2015 at 04:32, Simon Glass s...@chromium.org wrote:
 Hi Jagan,

 On 26 June 2015 at 13:07, Jagan Teki jt...@openedev.com wrote:
 Hi Simon,

 On 26 June 2015 at 21:23, Simon Glass s...@chromium.org wrote:
 Hi Jagan,

 On 23 June 2015 at 15:03, Jagan Teki jt...@openedev.com wrote:
 Hi Simon,

 I'm calling spi_chip_select(bus) from set_speed or claim_bus
 to get the cs value from sf probe.

 Seems like it returns the maximum number as 254, when I debug
 further seems like slave_platdata returns NULL

 int spi_chip_select(struct udevice *dev)
 {
 struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
 / * this plat data returns NULL */

 return plat ? plat-cs : -ENOENT;
 }


 /**
  * spi_chip_select() - Get the chip select for a slave
  *
  * @return the chip select this slave is attached to
  */
 int spi_chip_select(struct udevice *slave);

 This function takes a slave device as a parameter, not a bus. Are you
 passing it a bus?

 So as it's a struct udevice - I have passed it from probe and store my cs.
 Seems like if you get the cs only if we call it from spi_xfer as it's slave
 is it right?

 Both the bus and the slave device are devices, and thus use struct udevice.

 I really don't understand what you are asking/saying. Please can you
 try to be more descriptive?

To finding out the cs number in spi driver, I'm trying to use spi_chip_select
from probe, but I couldn't find the valid cs number .

I got the valid cs number only when I call spi_chip_select from xfer(), is that
something like binding is properly done only when xfer() reaches?

 log:
 zynq-uboot sf probe 1:0
 zynq_spi_ofdata_to_platdata: regs=e0007000 max-frequency=16700
 zynq_spi_set_speed: cs 254
 zynq_spi_set_speed: regs=e0007000, mode=100
 zynq_spi_set_mode: regs=e0007000, mode=3
 zynq_spi_claim_bus: cs 254
 spi_xfer: bus:1 cs:254 bitlen:8 len:1 flags:1
 spi_xfer: Timeout! TX FIFO not full
 SF: Failed to get idcodes
 Failed to initialize SPI flash at 1:0 (error -1)

thanks!
-- 
Jagan | openedev.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] powerpc/mpc85xx:Add GCC flag -fno-delete-null-pointer-checks

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 08:58:26AM -0600, Simon Glass wrote:
 Hi,
 
 On 29 June 2015 at 22:18, Kushwaha Prabhakar prabha...@freescale.com wrote:
  Hi Simon, Tom,
 
  -fdelete-null-pointer-checks flag controls global dataflow analyses and  
  eliminate useless checks for null pointers; It assume that if a pointer is  
  checked after it has already been dereferenced, it cannot be null.  This 
  flag is enabled by default.
   gcc v4.9 has more optimizations added to this option. Hence it is very  
  aggressive with GCC v4.9 series. It is also well documented in the GCC v4.9 
  release notes:
  https://gcc.gnu.org/gcc-4.9/porting_to.html
 
  There is possibility after moving to gcc-4.9 some platform may/may not work 
  properly.
  I tested this patch for freescale powerpc platforms.
  But It may needs be taken care by all architecture like ARM, powerpc. If 
  this is the case; this flag should be in top level Makefile (not sure)
 
 
 I suspect a top-level option would be best, perhaps near this one in Makefile:
 
 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)

I also agree with Scott and Simon, default, top level, using cc-option
just like the Linux kernel please, 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] nitrogen6x: change maintainer

2015-06-30 Thread Troy Kisky
On 6/30/2015 7:48 AM, Eric Nelson wrote:
 Troy Kisky will be maintaining the Nitrogen6x board going forward.
 
 Signed-off-by: Eric Nelson eric.nel...@boundarydevices.com
 ---
  board/boundary/nitrogen6x/MAINTAINERS | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/board/boundary/nitrogen6x/MAINTAINERS 
 b/board/boundary/nitrogen6x/MAINTAINERS
 index cb06c03..1602d65 100644
 --- a/board/boundary/nitrogen6x/MAINTAINERS
 +++ b/board/boundary/nitrogen6x/MAINTAINERS
 @@ -1,5 +1,5 @@
  NITROGEN6X BOARD
 -M:   Eric Nelson eric.nel...@boundarydevices.com
 +M:   Troy Kisky troy.ki...@boundarydevices.com
  S:   Maintained
  F:   board/boundary/nitrogen6x/
  F:   include/configs/nitrogen6x.h
 
Acked-by: Troy Kisky troy.ki...@boundarydevices.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: baytrail: Configure FSP UPD from device tree

2015-06-30 Thread Andrew Bradford
Hi Simon,

On 06/30 09:29, Simon Glass wrote:
 +Bin
 
 Hi Andrew,
 
 On 29 June 2015 at 09:10, and...@bradfordembedded.com wrote:
 
  From: Andrew Bradford andrew.bradf...@kodakalaris.com
 
  Allow for configuration of FSP UPD from the device tree which will
  override any settings which the FSP was built with itself if the device
  tree settings exist, otherwise simply trust the FSP's defaults.
 
  Modifies the MinnowMax board to transfer the FSP UPD hard-coded settings
  to the MinnowMax dts.
 
  Signed-off-by: Andrew Bradford andrew.bradf...@kodakalaris.com
  ---
   arch/x86/cpu/baytrail/fsp_configs.c| 183 
  +
   arch/x86/dts/minnowmax.dts |  27 +++
   .../misc/intel,baytrail-fsp.txt| 113 +
   include/fdtdec.h   |   1 +
   lib/fdtdec.c   |   1 +
   5 files changed, 295 insertions(+), 30 deletions(-)
   create mode 100644 doc/device-tree-bindings/misc/intel,baytrail-fsp.txt
 
 This is a big step forward in flexibility, thanks for sending this.
 
 
  diff --git a/arch/x86/cpu/baytrail/fsp_configs.c 
  b/arch/x86/cpu/baytrail/fsp_configs.c
  index 86b6926..fd07eca 100644
  --- a/arch/x86/cpu/baytrail/fsp_configs.c
  +++ b/arch/x86/cpu/baytrail/fsp_configs.c
  @@ -1,11 +1,13 @@
   /*
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2014, Bin Meng bmeng...@gmail.com
  + * Copyright (C) 2015, Kodak Alaris
*
* SPDX-License-Identifier:Intel
*/
 
   #include common.h
  +#include fdtdec.h
   #include asm/arch/fsp/azalia.h
   #include asm/fsp/fsp_support.h
 
  @@ -116,41 +118,162 @@ const struct pch_azalia_config azalia_config = {
  .reset_wait_timer_us = 300
   };
 
  +/**
  + * Update the FSP's UPD.  The FSP itself can be configured for defaults to
  + * store in UPD through Intel's GUI configurator but likely a specific 
  board
  + * will want to update these from u-boot, so allow for that via device 
  tree.
  + * If the device tree does not specify a setting, trust the FSP's default.
  + */
   void update_fsp_upd(struct upd_region *fsp_upd)
   {
  struct memory_down_data *mem;
  +   const void *blob = gd-fdt_blob;
  +   int node;
 
  -   /*
  -* Configure everything here to avoid the poor hard-pressed user
  -* needing to run Intel's binary configuration tool. It may also 
  allow
  -* us to support the 1GB single core variant easily.
  -*
  -* TODO(s...@chromium.org): Move to device tree
  -*/
  -   fsp_upd-mrc_init_tseg_size = 8;
  -   fsp_upd-mrc_init_mmio_size = 0x800;
  -   fsp_upd-emmc_boot_mode = 0xff;
  -   fsp_upd-enable_sdio = 1;
  -   fsp_upd-enable_sdcard = 1;
  -   fsp_upd-enable_hsuart0 = 1;
  fsp_upd-azalia_config_ptr = (uint32_t)azalia_config;
  -   fsp_upd-enable_i2_c0 = 0;
  -   fsp_upd-enable_i2_c2 = 0;
  -   fsp_upd-enable_i2_c3 = 0;
  -   fsp_upd-enable_i2_c4 = 0;
  -   fsp_upd-enable_xhci = 0;
  -   fsp_upd-igd_render_standby = 1;
  +
  +   node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_BAYTRAIL_FSP);
  +   if (node  0) {
  +   debug(%s: Cannot find FSP node\n, __func__);
  +   /* TODO: change return type for error indication */
  +   return;
  +   }
  +
  +   fsp_upd-mrc_init_tseg_size = fdtdec_get_int(blob, node,
  +mrc_int_tseg_size,
  +
  fsp_upd-mrc_init_tseg_size);
  +   fsp_upd-mrc_init_mmio_size = fdtdec_get_int(blob, node,
  +mrc_init_mmio_size,
  +
  fsp_upd-mrc_init_mmio_size);
  +   fsp_upd-mrc_init_spd_addr1 = fdtdec_get_int(blob, node,
  +mrc_init_spd_addr1,
  +
  fsp_upd-mrc_init_spd_addr1);
  +   fsp_upd-mrc_init_spd_addr2 = fdtdec_get_int(blob, node,
  +mrc_init_spd_addr2,
  +
  fsp_upd-mrc_init_spd_addr2);
  +   fsp_upd-emmc_boot_mode = fdtdec_get_int(blob, node, 
  emmc_boot_mode,
  +fsp_upd-emmc_boot_mode);
  +   fsp_upd-enable_sdio = fdtdec_get_int(blob, node, enable_sdio,
  + fsp_upd-enable_sdio);
 
 Shouldn't these be booleans?

Yes, probably all the enable elements should be booleans, I'll fix in
v2.

 
  +   fsp_upd-enable_sdcard = fdtdec_get_int(blob, node, enable_sdcard,
  +   fsp_upd-enable_sdcard);
  +   fsp_upd-enable_hsuart0 = fdtdec_get_int(blob, node, 
  enable_hsuart0,
  +   

Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 03:11:02PM +0200, Hans de Goede wrote:

 Hi,
 
 On 28-06-15 18:06, Tom Rini wrote:
 On Sun, Jun 28, 2015 at 05:39:28PM +0200, Hans de Goede wrote:
 Hi,
 
 On 26-06-15 23:05, Tom Rini wrote:
 On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:
 
 Hi Tom,
 
 Please pull u-boot-sunxi/master into master for two bug-fixes,
 and one new board:
 
 The following changes since commit 
 325849ff3d4adeebb8f8f9bc5db950724df9bc21:
 
Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)
 
 are available in the git repository at:
 
http://git.denx.de/u-boot-sunxi.git master
 
 for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:
 
sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)
 
 
 NAK, this needs a rework now, sorry!  Joe's changes mean the new
 defconfig needs updating.
 
 Ugh, I'm somewhat surprised with these changes, both with the
 contents of the changes, as with changes like these landing so
 late in the cycle, esp. since these are not uncontroversial.
 
 I've the feeling that these were merged without proper discussion
 which is not good, and is esp. bad when it is done so late in the
 cycle.
 
 Yeah, it's a bit later than I'd have liked, but I asked Joe to get these
 done because they help clean things up.  For example:
 
 In essense these changes revert my earlier commit where I explictly added:
 
 config CMD_SETEXPR
 default y
 
 config CMD_NET
 default y
 
 Right.  Your change kept sunxi boards from suddenly losing those
 features to prevent breakage (which is good, and why I allowed it at the
 time), but at the expense of adding lines to each of the sunxi defconfig
 files (which is why these lines ended up in each of the sunxi defconfg
 files, yes?)
 
 That is not how I see it, with my change for sunxi boards the default for
 these options was y, so they did not end up in the deconfigs with Joe's
 recent changes removed the above 4 lines from board/sunxi/Kconfig now
 all of a sudden all sunxi defconfig files need these lines, it is Joe's
 changes which have caused a ton of extra lines to be added to the sunxi
 defconfigs not mine, specifically this commit:
 
 http://git.denx.de/?p=u-boot.git;a=commit;h=c9bb942e2f91d9f8e5f25ed1961eba2d64f65b8d
 
 Which does:
 
 --- a/board/sunxi/Kconfig
 +++ b/board/sunxi/Kconfig
 @@ -566,25 +566,4 @@ config GMAC_TX_DELAY
 ---help---
 Set the GMAC Transmit Clock Delay Chain value.
 
 -config SYS_MALLOC_CLEAR_ON_INIT
 -   default n
 -
 -config NETDEVICES
 -   default y
 -
 -config DM_ETH
 -   default y
 -
 -config DM_SERIAL
 -   default y
 -
 -config DM_USB
 -   default y if !USB_MUSB_SUNXI
 -
 -config CMD_SETEXPR
 -   default y
 -
 -config CMD_NET
 -   default y
 -
  endif
 
 Which result in the following matching change for 60+ sunxi
 defconfig's :
 --- a/configs/A10-OLinuXino-Lime_defconfig
 +++ b/configs/A10-OLinuXino-Lime_defconfig
 @@ -5,5 +5,13 @@ CONFIG_DRAM_CLK=480
  CONFIG_DRAM_EMR1=4
  CONFIG_SYS_CLK_FREQ=91200
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
 +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
  
 CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
 +CONFIG_CMD_SETEXPR=y
 +CONFIG_CMD_NET=y
 +CONFIG_DM_ETH=y
 +CONFIG_NETDEVICES=y
 +CONFIG_DM_SERIAL=y
 +CONFIG_USB=y
 +CONFIG_DM_USB=y

OK, I see part of the problem.  One part of the problem, and this
probably isn't just a sunxi thing, is that arch/arm/Kconfig::config
ARCH_SUNXI hasn't been getting updated with select's like it should.

If we do:
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..48319c1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -646,6 +646,9 @@ config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
select DM_GPIO
+   select DM_ETH
+   select DM_SERIAL
+   select DM_USB if USB_EHCI_HCD
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL

We get:
diff --git a/configs/A20-OLinuXino-Lime2_defconfig 
b/configs/A20-OLinuXino-Lime2_defconfig
index 6445b25..a8aa8d2 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -8,12 +8,10 @@ CONFIG_USB0_VBUS_DET=PH5
 CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-olinuxino-lime2
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_DM_SERIAL=y
 CONFIG_USB=y
-CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y

Which is much closer to what you were asking for, right Hans?  That
still leaves CONFIG_SYS_MALLOC_CLEAR_ON_INIT=n being added in each case
but that's a performance per-board tweak (and something that frankly 

Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread Simon Glass
Hi York,

On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
 Simon,

 Does the dm force using device tree? I was reviewing a patch set regarding SPI
 and found OF_CONTROL has to be selected in order to get the driver model 
 happy.

 My understanding of the driver model is both device tree and platform data are
 allowed, like Linux. Is that still true?

For buses you need device tree. I was rather hoping that we could
avoid platform data on platforms that have device tree. What is the
point?

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


Re: [U-Boot] dm-spi: spi_chip_select value

2015-06-30 Thread Simon Glass
Hi Jagan,

On 30 June 2015 at 11:48, Jagan Teki jt...@openedev.com wrote:
 Hi Simon,

 On 27 June 2015 at 04:32, Simon Glass s...@chromium.org wrote:
 Hi Jagan,

 On 26 June 2015 at 13:07, Jagan Teki jt...@openedev.com wrote:
 Hi Simon,

 On 26 June 2015 at 21:23, Simon Glass s...@chromium.org wrote:
 Hi Jagan,

 On 23 June 2015 at 15:03, Jagan Teki jt...@openedev.com wrote:
 Hi Simon,

 I'm calling spi_chip_select(bus) from set_speed or claim_bus
 to get the cs value from sf probe.

 Seems like it returns the maximum number as 254, when I debug
 further seems like slave_platdata returns NULL

 int spi_chip_select(struct udevice *dev)
 {
 struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
 / * this plat data returns NULL */

 return plat ? plat-cs : -ENOENT;
 }


 /**
  * spi_chip_select() - Get the chip select for a slave
  *
  * @return the chip select this slave is attached to
  */
 int spi_chip_select(struct udevice *slave);

 This function takes a slave device as a parameter, not a bus. Are you
 passing it a bus?

 So as it's a struct udevice - I have passed it from probe and store my cs.
 Seems like if you get the cs only if we call it from spi_xfer as it's slave
 is it right?

 Both the bus and the slave device are devices, and thus use struct udevice.

 I really don't understand what you are asking/saying. Please can you
 try to be more descriptive?

 To finding out the cs number in spi driver, I'm trying to use spi_chip_select
 from probe, but I couldn't find the valid cs number .

 I got the valid cs number only when I call spi_chip_select from xfer(), is 
 that
 something like binding is properly done only when xfer() reaches?

To get the chip select, you can use:

struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);

plat-cs

See the README also:

20. A little note about SPI uclass features:

The SPI uclass keeps some information about each device 'dev' on the bus:

   struct dm_spi_slave_platdata - this is device_get_parent_platdata(dev)
This is where the chip select number is stored, along with
the default bus speed and mode. It is automatically read
from the device tree in spi_child_post_bind(). It must not
be changed at run-time after being set up because platform
data is supposed to be immutable at run-time.
   struct spi_slave - this is device_get_parentdata(dev)
Already mentioned above. It holds run-time information about
the device.

There are also some SPI uclass methods that get called behind the scenes:

   spi_post_bind() - called when a new bus is bound
This scans the device tree for devices on the bus, and binds
each one. This in turn causes spi_child_post_bind() to be
called for each, which reads the device tree information
into the parent (per-child) platform data.
   spi_child_post_bind() - called when a new child is bound
As mentioned above this reads the device tree information
into the per-child platform data
   spi_child_pre_probe() - called before a new child is probed
This sets up the mode and speed in struct spi_slave by
copying it from the parent's platform data for this child.
It also sets the 'dev' pointer, needed to permit passing
'struct spi_slave' around the place without needing a
separate 'struct udevice' pointer.

The above housekeeping makes it easier to write your SPI driver.




 log:
 zynq-uboot sf probe 1:0
 zynq_spi_ofdata_to_platdata: regs=e0007000 max-frequency=16700
 zynq_spi_set_speed: cs 254
 zynq_spi_set_speed: regs=e0007000, mode=100
 zynq_spi_set_mode: regs=e0007000, mode=3
 zynq_spi_claim_bus: cs 254
 spi_xfer: bus:1 cs:254 bitlen:8 len:1 flags:1
 spi_xfer: Timeout! TX FIFO not full
 SF: Failed to get idcodes
 Failed to initialize SPI flash at 1:0 (error -1)

 thanks!
 --
 Jagan | openedev.

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


Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread York Sun


On 06/30/2015 11:33 AM, Simon Glass wrote:
 Hi York,
 
 On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
 Simon,

 Does the dm force using device tree? I was reviewing a patch set regarding 
 SPI
 and found OF_CONTROL has to be selected in order to get the driver model 
 happy.

 My understanding of the driver model is both device tree and platform data 
 are
 allowed, like Linux. Is that still true?
 
 For buses you need device tree. I was rather hoping that we could
 avoid platform data on platforms that have device tree. What is the
 point?
 

Simon,

It happens on a platform not using device tree, but DM will be used.

I prefer DM to have both, rather than being forced to use device tree, unless we
are going to enforce using device tree on all new platforms. Since device tree
is still an option, I feel it is best to support platform data, like Linux
drivers do.

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


Re: [U-Boot] [PATCH 18/20] spi: Kconfig: Add TEGRA114_SPI entry

2015-06-30 Thread Simon Glass
On 27 June 2015 at 12:14, Jagan Teki jt...@openedev.com wrote:
 Added TEGRA114_SPI entry on Kconfig with help description.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Tom Warren twar...@nvidia.com
 Cc: Stephen Warren swar...@nvidia.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/spi/Kconfig | 10 ++
  1 file changed, 10 insertions(+)


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


Re: [U-Boot] [PATCH 19/20] spi: Kconfig: Add TEGRA20_SFLASH entry

2015-06-30 Thread Simon Glass
On 27 June 2015 at 12:14, Jagan Teki jt...@openedev.com wrote:
 Added TEGRA20_SFLASH entry on Kconfig with help description.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Tom Warren twar...@nvidia.com
 Cc: Stephen Warren swar...@nvidia.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/spi/Kconfig | 7 +++
  1 file changed, 7 insertions(+)

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


Re: [U-Boot] [PATCH 17/20] spi: Kconfig: Add ICH_SPI entry

2015-06-30 Thread Simon Glass
On 27 June 2015 at 12:14, Jagan Teki jt...@openedev.com wrote:
 Added ICH_SPI entry on Kconfig with help description.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/spi/Kconfig | 7 +++
  1 file changed, 7 insertions(+)


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


Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread York Sun


On 06/30/2015 12:01 PM, Tom Rini wrote:
 On Tue, Jun 30, 2015 at 11:42:41AM -0700, York Sun wrote:


 On 06/30/2015 11:33 AM, Simon Glass wrote:
 Hi York,

 On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
 Simon,

 Does the dm force using device tree? I was reviewing a patch set regarding 
 SPI
 and found OF_CONTROL has to be selected in order to get the driver model 
 happy.

 My understanding of the driver model is both device tree and platform data 
 are
 allowed, like Linux. Is that still true?

 For buses you need device tree. I was rather hoping that we could
 avoid platform data on platforms that have device tree. What is the
 point?


 Simon,

 It happens on a platform not using device tree, but DM will be used.

 I prefer DM to have both, rather than being forced to use device tree, 
 unless we
 are going to enforce using device tree on all new platforms. Since device 
 tree
 is still an option, I feel it is best to support platform data, like Linux
 drivers do.
 
 Well, to what end?  My recollection is that in short, the kernel has
 both since platform data predates device tree (and converting platform
 data to device tree is still a thing that happens).  But we're trying to
 skip that intermediate step.  Are there platforms where you do not plan
 to use a device tree, ever?
 

Tom,

I am not against using device tree at all. It is more dynamic and flexible. But
I don't see any indication that we favor device tree over pdata (except in the
code). If we are skipping pdata for new drivers, a clear message will be
helpful. That's what I am trying to get clarification.

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


Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread Simon Glass
Hi Tom,

On 30 June 2015 at 14:31, Tom Rini tr...@konsulko.com wrote:
 On Tue, Jun 30, 2015 at 01:10:45PM -0700, York Sun wrote:


 On 06/30/2015 12:01 PM, Tom Rini wrote:
  On Tue, Jun 30, 2015 at 11:42:41AM -0700, York Sun wrote:
 
 
  On 06/30/2015 11:33 AM, Simon Glass wrote:
  Hi York,
 
  On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
  Simon,
 
  Does the dm force using device tree? I was reviewing a patch set 
  regarding SPI
  and found OF_CONTROL has to be selected in order to get the driver 
  model happy.
 
  My understanding of the driver model is both device tree and platform 
  data are
  allowed, like Linux. Is that still true?
 
  For buses you need device tree. I was rather hoping that we could
  avoid platform data on platforms that have device tree. What is the
  point?
 
 
  Simon,
 
  It happens on a platform not using device tree, but DM will be used.
 
  I prefer DM to have both, rather than being forced to use device tree, 
  unless we
  are going to enforce using device tree on all new platforms. Since device 
  tree
  is still an option, I feel it is best to support platform data, like Linux
  drivers do.
 
  Well, to what end?  My recollection is that in short, the kernel has
  both since platform data predates device tree (and converting platform
  data to device tree is still a thing that happens).  But we're trying to
  skip that intermediate step.  Are there platforms where you do not plan
  to use a device tree, ever?
 

 Tom,

 I am not against using device tree at all. It is more dynamic and flexible. 
 But
 I don't see any indication that we favor device tree over pdata (except in 
 the
 code). If we are skipping pdata for new drivers, a clear message will be
 helpful. That's what I am trying to get clarification.

 OK.  I think we'd agreed to that at ELC-E last year and it might have
 been in a few here-and-there emails but it's worth spelling out
 somewhere.

 Hey Simon?  doc/driver-model/README.txt has a pdata example, so maybe
 the answer here is it's time to update README.txt in a few ways :)

I'll prepare a patch.

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


Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 11:42:41AM -0700, York Sun wrote:
 
 
 On 06/30/2015 11:33 AM, Simon Glass wrote:
  Hi York,
  
  On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
  Simon,
 
  Does the dm force using device tree? I was reviewing a patch set regarding 
  SPI
  and found OF_CONTROL has to be selected in order to get the driver model 
  happy.
 
  My understanding of the driver model is both device tree and platform data 
  are
  allowed, like Linux. Is that still true?
  
  For buses you need device tree. I was rather hoping that we could
  avoid platform data on platforms that have device tree. What is the
  point?
  
 
 Simon,
 
 It happens on a platform not using device tree, but DM will be used.
 
 I prefer DM to have both, rather than being forced to use device tree, unless 
 we
 are going to enforce using device tree on all new platforms. Since device tree
 is still an option, I feel it is best to support platform data, like Linux
 drivers do.

Well, to what end?  My recollection is that in short, the kernel has
both since platform data predates device tree (and converting platform
data to device tree is still a thing that happens).  But we're trying to
skip that intermediate step.  Are there platforms where you do not plan
to use a device tree, ever?

-- 
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] x86: baytrail: Configure FSP UPD from device tree

2015-06-30 Thread Andrew Bradford
Hi Simon,

On 06/30 12:13, Simon Glass wrote:
 Hi Andrew,
 
 On 30 June 2015 at 10:58, Andrew Bradford and...@bradfordembedded.com wrote:
 
  Hi Simon,
 
  On 06/30 09:29, Simon Glass wrote:
   +Bin
  
   Hi Andrew,
  
   On 29 June 2015 at 09:10, and...@bradfordembedded.com wrote:
   
From: Andrew Bradford andrew.bradf...@kodakalaris.com
   
Allow for configuration of FSP UPD from the device tree which will
override any settings which the FSP was built with itself if the device
tree settings exist, otherwise simply trust the FSP's defaults.
   
Modifies the MinnowMax board to transfer the FSP UPD hard-coded settings
to the MinnowMax dts.
   
Signed-off-by: Andrew Bradford andrew.bradf...@kodakalaris.com
---
 arch/x86/cpu/baytrail/fsp_configs.c| 183 
+
 arch/x86/dts/minnowmax.dts |  27 +++
 .../misc/intel,baytrail-fsp.txt| 113 +
 include/fdtdec.h   |   1 +
 lib/fdtdec.c   |   1 +
 5 files changed, 295 insertions(+), 30 deletions(-)
 create mode 100644 doc/device-tree-bindings/misc/intel,baytrail-fsp.txt
  
   This is a big step forward in flexibility, thanks for sending this.
  
   
diff --git a/arch/x86/cpu/baytrail/fsp_configs.c 
b/arch/x86/cpu/baytrail/fsp_configs.c
index 86b6926..fd07eca 100644
--- a/arch/x86/cpu/baytrail/fsp_configs.c
+++ b/arch/x86/cpu/baytrail/fsp_configs.c
@@ -1,11 +1,13 @@
 /*
  * Copyright (C) 2013, Intel Corporation
  * Copyright (C) 2014, Bin Meng bmeng...@gmail.com
+ * Copyright (C) 2015, Kodak Alaris
  *
  * SPDX-License-Identifier:Intel
  */
   
 #include common.h
+#include fdtdec.h
 #include asm/arch/fsp/azalia.h
 #include asm/fsp/fsp_support.h
   
@@ -116,41 +118,162 @@ const struct pch_azalia_config azalia_config = {
.reset_wait_timer_us = 300
 };
   
+/**
+ * Update the FSP's UPD.  The FSP itself can be configured for 
defaults to
+ * store in UPD through Intel's GUI configurator but likely a specific 
board
+ * will want to update these from u-boot, so allow for that via device 
tree.
+ * If the device tree does not specify a setting, trust the FSP's 
default.
+ */
 void update_fsp_upd(struct upd_region *fsp_upd)
 {
struct memory_down_data *mem;
+   const void *blob = gd-fdt_blob;
+   int node;
   
-   /*
-* Configure everything here to avoid the poor hard-pressed user
-* needing to run Intel's binary configuration tool. It may 
also allow
-* us to support the 1GB single core variant easily.
-*
-* TODO(s...@chromium.org): Move to device tree
-*/
-   fsp_upd-mrc_init_tseg_size = 8;
-   fsp_upd-mrc_init_mmio_size = 0x800;
-   fsp_upd-emmc_boot_mode = 0xff;
-   fsp_upd-enable_sdio = 1;
-   fsp_upd-enable_sdcard = 1;
-   fsp_upd-enable_hsuart0 = 1;
fsp_upd-azalia_config_ptr = (uint32_t)azalia_config;
-   fsp_upd-enable_i2_c0 = 0;
-   fsp_upd-enable_i2_c2 = 0;
-   fsp_upd-enable_i2_c3 = 0;
-   fsp_upd-enable_i2_c4 = 0;
-   fsp_upd-enable_xhci = 0;
-   fsp_upd-igd_render_standby = 1;
+
+   node = fdtdec_next_compatible(blob, 0, 
COMPAT_INTEL_BAYTRAIL_FSP);
+   if (node  0) {
+   debug(%s: Cannot find FSP node\n, __func__);
+   /* TODO: change return type for error indication */
+   return;
+   }
+
+   fsp_upd-mrc_init_tseg_size = fdtdec_get_int(blob, node,
+
mrc_int_tseg_size,
+
fsp_upd-mrc_init_tseg_size);
+   fsp_upd-mrc_init_mmio_size = fdtdec_get_int(blob, node,
+
mrc_init_mmio_size,
+
fsp_upd-mrc_init_mmio_size);
+   fsp_upd-mrc_init_spd_addr1 = fdtdec_get_int(blob, node,
+
mrc_init_spd_addr1,
+
fsp_upd-mrc_init_spd_addr1);
+   fsp_upd-mrc_init_spd_addr2 = fdtdec_get_int(blob, node,
+
mrc_init_spd_addr2,
+
fsp_upd-mrc_init_spd_addr2);
+   fsp_upd-emmc_boot_mode = fdtdec_get_int(blob, node, 
emmc_boot_mode,
+
fsp_upd-emmc_boot_mode);
+   fsp_upd-enable_sdio = fdtdec_get_int(blob, node, enable_sdio,
+ 

Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 06:07 PM, Simon Glass wrote:

snip


Instead, I wonder if we can remove the children when we probe the bus?



That should work, but I do not really see any advantage in that,
removing the children is not that expensive and it feels like a
kludge.


That's how it currently works, from what I can see in the code. But
since there is a 'usb_started' boolean this is irrelevant.




Also, what happens to children that are in the device tree - i.e.
static USB devices like WiFi? The device tree might have parameters
for them. Still, that might not matter as I'm not sure that case is
handled correctly today.



AFAIK there is no such thing as usb devices in devicetree, which
makes sense as usb is a fully discoverable bus.


Sort-of. But as with PCI it is useful to be able to add settings for
the devices in some cases. You can match them using vendor/device or
interface IDs. Then the driver can access its settings.


AFAIK there is not a single example of having settings in devicetree
for an usb device, since usb-devices are always 100% self describing
since usb is a bus designed for hot(un)plug from the outset.


That's why I'm suggesting we unbind the devices that are no-longer present.


You're asking to make the code more complicated here using a what if
reasoning with a what if which is likely to never happen.
















The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a
keyb.
instead, before this commit the output would be:

usb [ + ]`-- sunxi-musb
usb_hub [   ]|-- usb_hub
usb_mass_st [   ]|   |-- usb_mass_storage
usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes
usb_get_dev_index
to return NULL when probing the first child, which results in the usb
kbd
code not binding to the keyboard.




Although I suspect that could be fixed.




Right, but just removing the children is a much cleaner solution, and
also
makes the output of dm tree properly reflect reality.



True, although you also have 'usb tree' for that. Another option would
be to mark devices that were found and remove the others after the
scan.



That seems like needless complexity. I believe that simply removing +
unbinding
the children on usb_stop is the right thing to do, and it also is the KISS
solution.


I'm good with the remove(), but less sure about the unbind().


The unbind is necessary for usb_get_dev_index() to work properly,
which is necessary for proper output of usb tree and for driver
binding to work properly, without the unbind usb-keyboards will e.g.
not work in certain circumstances.


The
state of 'dm tree' does not bother me,


The state if dm tree is what usb_get_dev_index() works from, so if
it is not in a good state, then usb_get_dev_index() will not work.


and I worry that we then limit
our ability to use usb_find_child() to locate a device's parameters
(i.e. support for more complex devices which need settings might be
harder).


Again this is a what if reasoning for a hypothetical future problem
which will likely never happen, where as the broken state of the
dm tree after a usb reset is causing real problems.


For now, can we just leave this alone? I really don't want to re-visit
this later.


Nope we cannot leave this alone, without unbinding usb devices which
no longer exist, the dm tree will be broken and with it
usb_get_dev_index() and through usb_get_dev_index() the keyboard
driver.

Regards,

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


Re: [U-Boot] [PATCH] sunxi: Select a bunch of CONFIG_foo options from ARCH_SUNXI

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 10:33:17PM +0200, Hans de Goede wrote:

 Select a bunch of CONFIG_foo options from ARCH_SUNXI, instead of having
 them set to y  in every single sunxi defconfig.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com

Ug, sorry, I was waiting for some build results to come out before
posting my version of this.

To update the USB side:
$ for F in `git grep -l SYS_EXTRA.*USB_EHCI`;do sed -i -e 's/,USB_EHCI//'
-e 's/USB_EHCI,//' $F  echo CONFIG_USB_EHCI_HCD=y  $F;done

And was there a reason you didn't include a 'select DM_SERIAL' in yours?

[snip]
 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
 index 0829235..6c4d138 100644
 --- a/arch/arm/Kconfig
 +++ b/arch/arm/Kconfig
 @@ -645,10 +645,13 @@ config ARCH_SOCFPGA
  config ARCH_SUNXI
   bool Support sunxi (Allwinner) SoCs
   select DM
 + select DM_ETH
   select DM_GPIO
 + select DM_USB if !USB_MUSB_SUNXI
   select OF_CONTROL
   select OF_SEPARATE
   select SPL_DISABLE_OF_CONTROL
 + select USB

We really don't want to leave USB as a board choice?

-- 
Tom


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


[U-Boot] [PATCH] sunxi: Update selects in arch/arm/Kconfig for DM conversions

2015-06-30 Thread Tom Rini
With certain features being convert to DM now we want sunxi to default
to having DM enabled for ETH/SERIAL and USB in some cases.

Cc: Hans de Goede hdego...@redhat.com
Cc: Ian Campbell i...@hellion.org.uk
Signed-off-by: Tom Rini tr...@konsulko.com
---
 arch/arm/Kconfig |3 +++
 configs/A10-OLinuXino-Lime_defconfig |6 ++
 configs/A10s-OLinuXino-M_defconfig   |6 ++
 configs/A13-OLinuXinoM_defconfig |6 ++
 configs/A13-OLinuXino_defconfig  |6 ++
 configs/A20-OLinuXino-Lime2_defconfig|6 ++
 configs/A20-OLinuXino-Lime_defconfig |6 ++
 configs/A20-OLinuXino_MICRO_defconfig|6 ++
 configs/Ainol_AW1_defconfig  |2 --
 configs/Ampe_A76_defconfig   |2 --
 configs/Auxtek-T004_defconfig|6 ++
 configs/Bananapi_defconfig   |6 ++
 configs/Bananapro_defconfig  |6 ++
 configs/CSQ_CS908_defconfig  |6 ++
 configs/Chuwi_V7_CW0825_defconfig|2 --
 configs/Colombus_defconfig   |6 ++
 configs/Cubieboard2_defconfig|6 ++
 configs/Cubieboard_defconfig |6 ++
 configs/Cubietruck_defconfig |6 ++
 configs/Et_q8_v1_6_defconfig |2 --
 configs/Hummingbird_A31_defconfig|6 ++
 configs/Hyundai_A7HD_defconfig   |2 --
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig |2 --
 configs/Ippo_q8h_v1_2_defconfig  |2 --
 configs/Ippo_q8h_v5_defconfig|2 --
 configs/Linksprite_pcDuino3_Nano_defconfig   |6 ++
 configs/Linksprite_pcDuino3_defconfig|6 ++
 configs/Linksprite_pcDuino_defconfig |6 ++
 configs/MK808C_defconfig |6 ++
 configs/MSI_Primo73_defconfig|2 --
 configs/MSI_Primo81_defconfig|2 --
 configs/Marsboard_A10_defconfig  |6 ++
 configs/Mele_A1000G_quad_defconfig   |6 ++
 configs/Mele_A1000_defconfig |6 ++
 configs/Mele_I7_defconfig|6 ++
 configs/Mele_M3_defconfig|6 ++
 configs/Mele_M5_defconfig|6 ++
 configs/Mele_M9_defconfig|6 ++
 configs/Merrii_A80_Optimus_defconfig |2 --
 configs/Mini-X_defconfig |6 ++
 configs/Orangepi_defconfig   |6 ++
 configs/Orangepi_mini_defconfig  |6 ++
 configs/TZX-Q8-713B7_defconfig   |2 --
 configs/UTOO_P66_defconfig   |1 -
 configs/Wexler_TAB7200_defconfig |6 ++
 configs/Wits_Pro_A20_DKT_defconfig   |6 ++
 configs/Yones_Toptech_BD1078_defconfig   |2 --
 configs/ba10_tv_box_defconfig|6 ++
 configs/forfun_q88db_defconfig   |2 --
 configs/ga10h_v1_1_defconfig |2 --
 configs/i12-tvbox_defconfig  |6 ++
 configs/iNet_3F_defconfig|2 --
 configs/iNet_3W_defconfig|2 --
 configs/iNet_86VS_defconfig  |2 --
 configs/jesurun_q5_defconfig |6 ++
 configs/mixtile_loftq_defconfig  |6 ++
 configs/mk802_a10s_defconfig |6 ++
 configs/mk802_defconfig  |4 +---
 configs/mk802ii_defconfig|6 ++
 configs/r7-tv-dongle_defconfig   |6 ++
 configs/sunxi_Gemei_G9_defconfig |6 ++
 61 files changed, 84 insertions(+), 200 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..48319c1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -646,6 +646,9 @@ config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
select DM_GPIO
+   select DM_ETH
+   select DM_SERIAL
+   select DM_USB if USB_EHCI_HCD
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index 87ade90..7e357a3 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -7,11 +7,9 @@ CONFIG_SYS_CLK_FREQ=91200
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
-CONFIG_DM_SERIAL=y
 CONFIG_USB=y
-CONFIG_DM_USB=y

Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 07:52 PM, Tom Rini wrote:

On Tue, Jun 30, 2015 at 03:11:02PM +0200, Hans de Goede wrote:


Hi,

On 28-06-15 18:06, Tom Rini wrote:

On Sun, Jun 28, 2015 at 05:39:28PM +0200, Hans de Goede wrote:

Hi,

On 26-06-15 23:05, Tom Rini wrote:

On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:


Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

   Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

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

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

   sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)



NAK, this needs a rework now, sorry!  Joe's changes mean the new
defconfig needs updating.


Ugh, I'm somewhat surprised with these changes, both with the
contents of the changes, as with changes like these landing so
late in the cycle, esp. since these are not uncontroversial.

I've the feeling that these were merged without proper discussion
which is not good, and is esp. bad when it is done so late in the
cycle.


Yeah, it's a bit later than I'd have liked, but I asked Joe to get these
done because they help clean things up.  For example:


In essense these changes revert my earlier commit where I explictly added:

config CMD_SETEXPR
default y

config CMD_NET
default y


Right.  Your change kept sunxi boards from suddenly losing those
features to prevent breakage (which is good, and why I allowed it at the
time), but at the expense of adding lines to each of the sunxi defconfig
files (which is why these lines ended up in each of the sunxi defconfg
files, yes?)


That is not how I see it, with my change for sunxi boards the default for
these options was y, so they did not end up in the deconfigs with Joe's
recent changes removed the above 4 lines from board/sunxi/Kconfig now
all of a sudden all sunxi defconfig files need these lines, it is Joe's
changes which have caused a ton of extra lines to be added to the sunxi
defconfigs not mine, specifically this commit:

http://git.denx.de/?p=u-boot.git;a=commit;h=c9bb942e2f91d9f8e5f25ed1961eba2d64f65b8d

Which does:

--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -566,25 +566,4 @@ config GMAC_TX_DELAY
 ---help---
 Set the GMAC Transmit Clock Delay Chain value.

-config SYS_MALLOC_CLEAR_ON_INIT
-   default n
-
-config NETDEVICES
-   default y
-
-config DM_ETH
-   default y
-
-config DM_SERIAL
-   default y
-
-config DM_USB
-   default y if !USB_MUSB_SUNXI
-
-config CMD_SETEXPR
-   default y
-
-config CMD_NET
-   default y
-
  endif

Which result in the following matching change for 60+ sunxi
defconfig's :
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -5,5 +5,13 @@ CONFIG_DRAM_CLK=480
  CONFIG_DRAM_EMR1=4
  CONFIG_SYS_CLK_FREQ=91200
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
  
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_NET=y
+CONFIG_DM_ETH=y
+CONFIG_NETDEVICES=y
+CONFIG_DM_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y


OK, I see part of the problem.  One part of the problem, and this
probably isn't just a sunxi thing, is that arch/arm/Kconfig::config
ARCH_SUNXI hasn't been getting updated with select's like it should.

If we do:
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..48319c1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -646,6 +646,9 @@ config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
select DM_GPIO
+   select DM_ETH
+   select DM_SERIAL
+   select DM_USB if USB_EHCI_HCD
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL

We get:
diff --git a/configs/A20-OLinuXino-Lime2_defconfig 
b/configs/A20-OLinuXino-Lime2_defconfig
index 6445b25..a8aa8d2 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -8,12 +8,10 @@ CONFIG_USB0_VBUS_DET=PH5
  CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-olinuxino-lime2
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)
  # CONFIG_CMD_IMLS is not set
  # CONFIG_CMD_FLASH is not set
  # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
  CONFIG_ETH_DESIGNWARE=y
-CONFIG_DM_SERIAL=y
  CONFIG_USB=y
-CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y

Which is much closer to what you were asking for, right Hans?  That
still leaves CONFIG_SYS_MALLOC_CLEAR_ON_INIT=n being added in each case
but that's a performance per-board tweak (and something that frankly we
need to pencil in making a 

Re: [U-Boot] [PATCH v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread Tom Rini
On Tue, Jun 30, 2015 at 01:10:45PM -0700, York Sun wrote:
 
 
 On 06/30/2015 12:01 PM, Tom Rini wrote:
  On Tue, Jun 30, 2015 at 11:42:41AM -0700, York Sun wrote:
 
 
  On 06/30/2015 11:33 AM, Simon Glass wrote:
  Hi York,
 
  On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
  Simon,
 
  Does the dm force using device tree? I was reviewing a patch set 
  regarding SPI
  and found OF_CONTROL has to be selected in order to get the driver model 
  happy.
 
  My understanding of the driver model is both device tree and platform 
  data are
  allowed, like Linux. Is that still true?
 
  For buses you need device tree. I was rather hoping that we could
  avoid platform data on platforms that have device tree. What is the
  point?
 
 
  Simon,
 
  It happens on a platform not using device tree, but DM will be used.
 
  I prefer DM to have both, rather than being forced to use device tree, 
  unless we
  are going to enforce using device tree on all new platforms. Since device 
  tree
  is still an option, I feel it is best to support platform data, like Linux
  drivers do.
  
  Well, to what end?  My recollection is that in short, the kernel has
  both since platform data predates device tree (and converting platform
  data to device tree is still a thing that happens).  But we're trying to
  skip that intermediate step.  Are there platforms where you do not plan
  to use a device tree, ever?
  
 
 Tom,
 
 I am not against using device tree at all. It is more dynamic and flexible. 
 But
 I don't see any indication that we favor device tree over pdata (except in the
 code). If we are skipping pdata for new drivers, a clear message will be
 helpful. That's what I am trying to get clarification.

OK.  I think we'd agreed to that at ELC-E last year and it might have
been in a few here-and-there emails but it's worth spelling out
somewhere.

Hey Simon?  doc/driver-model/README.txt has a pdata example, so maybe
the answer here is it's time to update README.txt in a few ways :)

-- 
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 v3 00/54] dm: Introduce new driver model uclasses

2015-06-30 Thread Jagan Teki
On 1 July 2015 at 00:12, York Sun york...@freescale.com wrote:


 On 06/30/2015 11:33 AM, Simon Glass wrote:
 Hi York,

 On 30 June 2015 at 10:08, York Sun york...@freescale.com wrote:
 Simon,

 Does the dm force using device tree? I was reviewing a patch set regarding 
 SPI
 and found OF_CONTROL has to be selected in order to get the driver model 
 happy.

 My understanding of the driver model is both device tree and platform data 
 are
 allowed, like Linux. Is that still true?

 For buses you need device tree. I was rather hoping that we could
 avoid platform data on platforms that have device tree. What is the
 point?


 Simon,

 It happens on a platform not using device tree, but DM will be used.

 I prefer DM to have both, rather than being forced to use device tree, unless 
 we
 are going to enforce using device tree on all new platforms. Since device tree
 is still an option, I feel it is best to support platform data, like Linux
 drivers do.

I can understand your concern about pdata, but the dts is more dynamic approach
to get the device data and at least some of the architecture in u-boot
had a support
for it. And if we start with dts boards will turn it on to use dts
instead of going back to
use legacy pdata which is so called static approach (which might
increase the board
code, some times increasing configs)

Using/adding/going by dts support is more generic and dynamic instead
of static, IMHO

thanks!
-- 
Jagan | openedev.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] sunxi: Select a bunch of CONFIG_foo options from ARCH_SUNXI

2015-06-30 Thread Hans de Goede
Select a bunch of CONFIG_foo options from ARCH_SUNXI, instead of having
them set to y  in every single sunxi defconfig.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/Kconfig | 3 +++
 configs/A10-OLinuXino-Lime_defconfig | 3 ---
 configs/A10s-OLinuXino-M_defconfig   | 3 ---
 configs/A13-OLinuXinoM_defconfig | 3 ---
 configs/A13-OLinuXino_defconfig  | 3 ---
 configs/A20-OLinuXino-Lime2_defconfig| 3 ---
 configs/A20-OLinuXino-Lime_defconfig | 3 ---
 configs/A20-OLinuXino_MICRO_defconfig| 3 ---
 configs/Ainol_AW1_defconfig  | 1 -
 configs/Ampe_A76_defconfig   | 1 -
 configs/Auxtek-T004_defconfig| 3 ---
 configs/Bananapi_defconfig   | 3 ---
 configs/Bananapro_defconfig  | 3 ---
 configs/CSQ_CS908_defconfig  | 3 ---
 configs/Chuwi_V7_CW0825_defconfig| 1 -
 configs/Colombus_defconfig   | 3 ---
 configs/Cubieboard2_defconfig| 3 ---
 configs/Cubieboard_defconfig | 3 ---
 configs/Cubietruck_defconfig | 3 ---
 configs/Et_q8_v1_6_defconfig | 1 -
 configs/Hummingbird_A31_defconfig| 3 ---
 configs/Hyundai_A7HD_defconfig   | 1 -
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig | 1 -
 configs/Ippo_q8h_v1_2_defconfig  | 1 -
 configs/Ippo_q8h_v5_defconfig| 1 -
 configs/Linksprite_pcDuino3_Nano_defconfig   | 3 ---
 configs/Linksprite_pcDuino3_defconfig| 3 ---
 configs/Linksprite_pcDuino_defconfig | 3 ---
 configs/MK808C_defconfig | 3 ---
 configs/MSI_Primo73_defconfig| 3 ---
 configs/MSI_Primo81_defconfig| 2 --
 configs/Marsboard_A10_defconfig  | 3 ---
 configs/Mele_A1000G_quad_defconfig   | 3 ---
 configs/Mele_A1000_defconfig | 3 ---
 configs/Mele_I7_defconfig| 3 ---
 configs/Mele_M3_defconfig| 3 ---
 configs/Mele_M5_defconfig| 3 ---
 configs/Mele_M9_defconfig| 3 ---
 configs/Merrii_A80_Optimus_defconfig | 3 ---
 configs/Mini-X_defconfig | 3 ---
 configs/Orangepi_defconfig   | 3 ---
 configs/Orangepi_mini_defconfig  | 3 ---
 configs/Sinlinx_SinA33_defconfig | 3 ---
 configs/TZX-Q8-713B7_defconfig   | 1 -
 configs/UTOO_P66_defconfig   | 1 -
 configs/Wexler_TAB7200_defconfig | 3 ---
 configs/Wits_Pro_A20_DKT_defconfig   | 3 ---
 configs/Yones_Toptech_BD1078_defconfig   | 1 -
 configs/ba10_tv_box_defconfig| 3 ---
 configs/forfun_q88db_defconfig   | 1 -
 configs/ga10h_v1_1_defconfig | 1 -
 configs/i12-tvbox_defconfig  | 3 ---
 configs/iNet_3F_defconfig| 1 -
 configs/iNet_3W_defconfig| 1 -
 configs/iNet_86VS_defconfig  | 1 -
 configs/jesurun_q5_defconfig | 3 ---
 configs/mixtile_loftq_defconfig  | 3 ---
 configs/mk802_a10s_defconfig | 3 ---
 configs/mk802_defconfig  | 3 ---
 configs/mk802ii_defconfig| 3 ---
 configs/r7-tv-dongle_defconfig   | 3 ---
 configs/sunxi_Gemei_G9_defconfig | 3 ---
 62 files changed, 3 insertions(+), 150 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..6c4d138 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -645,10 +645,13 @@ config ARCH_SOCFPGA
 config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
+   select DM_ETH
select DM_GPIO
+   select DM_USB if !USB_MUSB_SUNXI
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
+   select USB
 
 config TARGET_SNOWBALL
bool Support snowball
diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index 87ade90..78e799f 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -11,7 +11,4 @@ 
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
 CONFIG_DM_SERIAL=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
diff --git a/configs/A10s-OLinuXino-M_defconfig 
b/configs/A10s-OLinuXino-M_defconfig
index 5a450af..26fadcb 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -13,7 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS=AXP152_POWER,SUNXI_EMAC,USB_EHCI
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
 CONFIG_DM_SERIAL=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
diff --git a/configs/A13-OLinuXinoM_defconfig 

Re: [U-Boot] [PATCH 20/20] spi: Kconfig: Add TEGRA20_SLINK entry

2015-06-30 Thread Simon Glass
On 27 June 2015 at 12:14, Jagan Teki jt...@openedev.com wrote:
 Added TEGRA20_SLINK entry on Kconfig with help description.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Tom Warren twar...@nvidia.com
 Cc: Stephen Warren swar...@nvidia.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/spi/Kconfig | 7 +++
  1 file changed, 7 insertions(+)

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


Re: [U-Boot] [PATCH 16/20] spi: Kconfig: Add EXYNOS_SPI entry

2015-06-30 Thread Simon Glass
On 27 June 2015 at 12:13, Jagan Teki jt...@openedev.com wrote:
 Added EXYNOS_SPI entry on Kconfig with help description.

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/spi/Kconfig | 7 +++
  1 file changed, 7 insertions(+)

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


Re: [U-Boot] [PATCH 07/20] sf: Kconfig: Add SPI_FLASH_DATAFLASH entry

2015-06-30 Thread Simon Glass
Hi Jagan,

On 27 June 2015 at 12:13, Jagan Teki jt...@openedev.com wrote:
 Added SPI_FLASH_DATAFLASH entry on Kconfig with help description

 Signed-off-by: Jagan Teki jt...@openedev.com
 Cc: Haikun Wang haikun.w...@freescale.com
 Cc: Simon Glass s...@chromium.org
 ---
  drivers/mtd/spi/Kconfig | 8 
  1 file changed, 8 insertions(+)

Reviewed-by: Simon Glass s...@chromium.org


 diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
 index 217e4d7..6b38ffc 100644
 --- a/drivers/mtd/spi/Kconfig
 +++ b/drivers/mtd/spi/Kconfig
 @@ -35,6 +35,14 @@ config SPI_FLASH

   If unsure, say N

 +config SPI_FLASH_DATAFLASH
 +   bool AT45xxx DataFlash support
 +   depends on SPI_FLASH  DM_SPI_FLASH
 +   help
 + Enable the access for SPI Flash based AT45xxx DataFlash chips.

nit: SPI-flash-based

You could talk a little more about the chips capabilities? Normally we
try to have 4 lines here.

 +
 + If unsure, say N
 +
  config SPI_FLASH_MTD
 bool SPI Flash MTD support
 depends on SPI_FLASH
 --
 1.9.1


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


Re: [U-Boot] Marvell Armada XP SATA support

2015-06-30 Thread Stefan Roese

Hi Anton,

On 29.06.2015 19:01, Anton Schubert wrote:

2015-06-23 14:38 GMT+02:00 Stefan Roese s...@denx.de mailto:s...@denx.de:

Hi Anton,

On 23.06.2015 13:23, Bin Meng wrote:

On Tue, Jun 23, 2015 at 5:35 PM, Anton Schubert
anton.schub...@gmx.de mailto:anton.schub...@gmx.de wrote


but noticed that there doesn't seem to be a driver for the SATA
controller.
Are there any plans to support SATA on Armada XP or is our
only option to
migrate the old driver?


Is the Marvell SATA controller AHCI compatible? If yes, U-Boot
has the
AHCI driver which should work.


No, the AXP SATA controller is unfortunately not AHCI compatible
(the A38x seems to be though). The mvsata driver
(drivers/block/mvsata_ide.c) might be a pretty good start for the
AXP though (I didn't check this closely).


Hi,
many thanks for your hints.

I managed to get ide_ident working with mvsata_ide.c by setting the Sata
address windows (using mbus.c analogous to the mvneta driver). But I'm
kind of stuck now as ATA reads will just result in timeouts:

ide_read dev 0 start 0, blocks 1 buffer at 7FBA9C60
ide_outb (dev= 0, port= 0x118, val= 0xe0) : @ 0xf10a2118
ide_inb (dev= 0, port= 0x11c) : @ 0xf10a211c - 0x50
ide_outb (dev= 0, port= 0x11c, val= 0xe5) : @ 0xf10a211c
ide_inb (dev= 0, port= 0x11c) : @ 0xf10a211c - 0x50
ide_inb (dev= 0, port= 0x108) : @ 0xf10a2108 - 0xff
Powersaving FF
ide_inb (dev= 0, port= 0x11c) : @ 0xf10a211c - 0x50
ide_outb (dev= 0, port= 0x108, val= 0x01) : @ 0xf10a2108
ide_outb (dev= 0, port= 0x10c, val= 0x00) : @ 0xf10a210c
ide_outb (dev= 0, port= 0x110, val= 0x00) : @ 0xf10a2110
ide_outb (dev= 0, port= 0x114, val= 0x00) : @ 0xf10a2114
ide_outb (dev= 0, port= 0x118, val= 0xe0) : @ 0xf10a2118
ide_outb (dev= 0, port= 0x11c, val= 0x20) : @ 0xf10a211c
ide_inb (dev= 0, port= 0x11c) : @ 0xf10a211c - 0xd0
ide_inb (dev= 0, port= 0x11c) : @ 0xf10a211c - 0x51
Error (no IRQ) dev 0 blk 0: status 0x51


This is my current ide config:
#define __io
#define CONFIG_IDE_PREINIT
#define CONFIG_MVSATA_IDE

/* Needs byte-swapping for ATA data register */
#define CONFIG_IDE_SWAP_IO

#define CONFIG_SYS_ATA_REG_OFFSET0x0100  /* Offset for
normal register accesses*/
#define CONFIG_SYS_ATA_DATA_OFFSET0x0100  /* Offset for data I/O */
#define CONFIG_SYS_ATA_ALT_OFFSET0x0100  /* Offset for data
I/O */

/* Each 8-bit ATA register is aligned to a 4-bytes address */
#define CONFIG_SYS_ATA_STRIDE4

/* CONFIG_CMD_IDE requires some #defines for ATA registers */
#define CONFIG_SYS_IDE_MAXBUS  2
#define CONFIG_SYS_IDE_MAXDEVICE   2

/* ATA registers base is at SATA controller base */
#define CONFIG_SYS_ATA_BASE_ADDRMVEBU_SATA_BASE /* 0xA */
#define CONFIG_SYS_ATA_IDE0_OFFSET0x2000

#define CONFIG_DOS_PARTITION

I would be grateful for any pointers.


Just send me the missing code (mbus address window setup etc) and I'll 
give it a try on my DB-MV784MP-GP board.


Thanks,
Stefan

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


Re: [U-Boot] [v3 08/10] spi: cadence_qspi: get sram size from device tree

2015-06-30 Thread Jagan Teki
On 30 June 2015 at 02:19, Vikas Manocha vikas.mano...@st.com wrote:
 sram size could be different on different socs, e.g. on stv0991 it is 256 
 while
 on altera platform it is 128. It is better to receive it from device tree.

 Signed-off-by: Vikas Manocha vikas.mano...@st.com

Still have an issue - unable to apply.

 Tested-by: Stefan Roese s...@denx.de
 ---

 Changes in v3: Rebased to spi-next-dev
 Changes in v2: None

  arch/arm/dts/socfpga.dtsi  |1 +
  arch/arm/dts/stv0991.dts   |1 +
  drivers/spi/cadence_qspi.c |1 +
  drivers/spi/cadence_qspi.h |1 +
  drivers/spi/cadence_qspi_apb.c |6 +-
  5 files changed, 5 insertions(+), 5 deletions(-)

 diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi
 index bf791c5..9b12420 100644
 --- a/arch/arm/dts/socfpga.dtsi
 +++ b/arch/arm/dts/socfpga.dtsi
 @@ -639,6 +639,7 @@
 ext-decoder = 0;  /* external decoder */
 num-cs = 4;
 fifo-depth = 128;
 +   sram-size = 128;
 bus-num = 2;
 status = disabled;
 };
 diff --git a/arch/arm/dts/stv0991.dts b/arch/arm/dts/stv0991.dts
 index 3b1efca..556df82 100644
 --- a/arch/arm/dts/stv0991.dts
 +++ b/arch/arm/dts/stv0991.dts
 @@ -35,6 +35,7 @@
 ext-decoder = 0; /* external decoder */
 num-cs = 4;
 fifo-depth = 256;
 +   sram-size = 256;
 bus-num = 0;
 status = okay;

 diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
 index a75fc46..34a0f46 100644
 --- a/drivers/spi/cadence_qspi.c
 +++ b/drivers/spi/cadence_qspi.c
 @@ -309,6 +309,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice 
 *bus)
 plat-tsd2d_ns = fdtdec_get_int(blob, subnode, tsd2d-ns, 255);
 plat-tchsh_ns = fdtdec_get_int(blob, subnode, tchsh-ns, 20);
 plat-tslch_ns = fdtdec_get_int(blob, subnode, tslch-ns, 20);
 +   plat-sram_size = fdtdec_get_int(blob, node, sram-size, 128);

 debug(%s: regbase=%p ahbbase=%p max-frequency=%d page-size=%d\n,
   __func__, plat-regbase, plat-ahbbase, plat-max_hz,
 diff --git a/drivers/spi/cadence_qspi.h b/drivers/spi/cadence_qspi.h
 index c9a6142..98e57aa 100644
 --- a/drivers/spi/cadence_qspi.h
 +++ b/drivers/spi/cadence_qspi.h
 @@ -25,6 +25,7 @@ struct cadence_spi_platdata {
 u32 tsd2d_ns;
 u32 tchsh_ns;
 u32 tslch_ns;
 +   u32 sram_size;
  };

  struct cadence_spi_priv {
 diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
 index f2c22af..cbf0d42 100644
 --- a/drivers/spi/cadence_qspi_apb.c
 +++ b/drivers/spi/cadence_qspi_apb.c
 @@ -36,9 +36,6 @@

  #define CQSPI_FIFO_WIDTH   (4)

 -/* Controller sram size in word */
 -#define CQSPI_REG_SRAM_SIZE_WORD   (128)
 -#define CQSPI_REG_SRAM_PARTITION_RD(CQSPI_REG_SRAM_SIZE_WORD/2)
  #define CQSPI_REG_SRAM_THRESHOLD_WORDS (50)

  /* Transfer mode */
 @@ -536,8 +533,7 @@ void cadence_qspi_apb_controller_init(struct 
 cadence_spi_platdata *plat)
 writel(0, plat-regbase + CQSPI_REG_REMAP);

 /* Indirect mode configurations */
 -   writel(CQSPI_REG_SRAM_PARTITION_RD,
 -   plat-regbase + CQSPI_REG_SRAMPARTITION);
 +   writel((plat-sram_size/2), plat-regbase + CQSPI_REG_SRAMPARTITION);

 /* Disable all interrupts */
 writel(0, plat-regbase + CQSPI_REG_IRQMASK);
 --
 1.7.9.5

thanks!
-- 
Jagan | openedev.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [v3 10/10] spi: cadence_qspi: add device tree binding doc

2015-06-30 Thread Jagan Teki
On 30 June 2015 at 02:19, Vikas Manocha vikas.mano...@st.com wrote:
 This patch adds the device tree binding doc for the cadence qspi controller 
 also removes the not needed properties from the device trees using this
 controller.

 Signed-off-by: Vikas Manocha vikas.mano...@st.com
 ---

 Changes in v3: added new

  arch/arm/dts/socfpga.dtsi|3 ---
  arch/arm/dts/socfpga_cyclone5_socrates.dts   |1 -
  arch/arm/dts/stv0991.dts |4 
  doc/device-tree-bindings/spi/spi-cadence.txt |   28 
 ++
  4 files changed, 28 insertions(+), 8 deletions(-)
  create mode 100644 doc/device-tree-bindings/spi/spi-cadence.txt

 diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi
 index 9b12420..35e6561 100644
 --- a/arch/arm/dts/socfpga.dtsi
 +++ b/arch/arm/dts/socfpga.dtsi
 @@ -636,9 +636,6 @@
 0xffa0 0x1000;
 interrupts = 0 151 4;
 clocks = qspi_clk;
 -   ext-decoder = 0;  /* external decoder */
 -   num-cs = 4;
 -   fifo-depth = 128;
 sram-size = 128;
 bus-num = 2;
 status = disabled;
 diff --git a/arch/arm/dts/socfpga_cyclone5_socrates.dts 
 b/arch/arm/dts/socfpga_cyclone5_socrates.dts
 index ea30483..557787b 100644
 --- a/arch/arm/dts/socfpga_cyclone5_socrates.dts
 +++ b/arch/arm/dts/socfpga_cyclone5_socrates.dts
 @@ -56,7 +56,6 @@
 m25p,fast-read;
 page-size = 256;
 block-size = 16; /* 2^16, 64KB */
 -   read-delay = 4;  /* delay value in read data capture 
 register */
 tshsl-ns = 50;
 tsd2d-ns = 50;
 tchsh-ns = 4;
 diff --git a/arch/arm/dts/stv0991.dts b/arch/arm/dts/stv0991.dts
 index 556df82..601148e 100644
 --- a/arch/arm/dts/stv0991.dts
 +++ b/arch/arm/dts/stv0991.dts
 @@ -32,9 +32,6 @@
 reg = 0x80203000 0x100,
 0x4000 0x100;
 clocks = 375;
 -   ext-decoder = 0; /* external decoder */
 -   num-cs = 4;
 -   fifo-depth = 256;
 sram-size = 256;
 bus-num = 0;
 status = okay;
 @@ -48,7 +45,6 @@
 m25p,fast-read;
 page-size = 256;
 block-size = 16;  /* 2^16, 64KB */
 -   read-delay = 4;   /* delay value in 
 read data capture register */
 tshsl-ns = 50;
 tsd2d-ns = 50;
 tchsh-ns = 4;
 diff --git a/doc/device-tree-bindings/spi/spi-cadence.txt 
 b/doc/device-tree-bindings/spi/spi-cadence.txt
 new file mode 100644
 index 000..c1e2233
 --- /dev/null
 +++ b/doc/device-tree-bindings/spi/spi-cadence.txt
 @@ -0,0 +1,28 @@
 +Cadence QSPI controller device tree bindings
 +
 +
 +Required properties:
 +- compatible   : should be cadence,qspi.
 +- reg  : 1.Physical base address and size of SPI registers 
 map.
 + 2. Physical base address  size of NOR Flash.
 +- clocks   : Clock phandles (see clock bindings for details).
 +- sram-size: spi controller sram size.

? bus-num

 +- status   : enable in requried dts.
 +
 +connected flash properties
 +--
 +
 +- spi-max-frequency: Max supported spi frequency.
 +- page-size: Flash page size.
 +- block-size   : Flash memory block size.
 +- tshsl-ns : Added delay in master reference clocks (ref_clk) for
 + the length that the master mode chip select outputs
 + are de-asserted between transactions.
 +- tsd2d-ns : Delay in master reference clocks (ref_clk) between 
 one
 + chip select being de-activated and the activation of
 + another.
 +- tchsh-ns : Delay in master reference clocks between last bit of
 + current transaction and de-asserting the device chip
 + select (n_ss_out).
 +- tslch-ns : Delay in master reference clocks between setting
 + n_ss_out low and first bit transfer
 --

thanks!
-- 
Jagan | openedev.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Marvell Armada XP SATA support

2015-06-30 Thread Anton Schubert
That should be it. Although it's probably a good idea to do this in cpu.c
as you did with your a38x ahci support.
Thanks for your help.

Anton

---
 arch/arm/mach-mvebu/include/mach/soc.h |  1 +
 drivers/block/mvsata_ide.c | 46
++
 include/configs/db-mv784mp-gp.h| 29 +
 3 files changed, 76 insertions(+)

diff --git a/arch/arm/mach-mvebu/include/mach/soc.h
b/arch/arm/mach-mvebu/include/mach/soc.h
index 0a9307c..2a8234d 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -51,6 +51,7 @@
 #define MVEBU_REG_PCIE_BASE(MVEBU_REGISTER(0x4))
 #define MVEBU_EGIGA0_BASE(MVEBU_REGISTER(0x7))
 #define MVEBU_EGIGA1_BASE(MVEBU_REGISTER(0x74000))
+#define MVEBU_SATA_BASE(MVEBU_REGISTER(0xA))

 #define SDRAM_MAX_CS4
 #define SDRAM_ADDR_MASK0xFF00
diff --git a/drivers/block/mvsata_ide.c b/drivers/block/mvsata_ide.c
index e54d564..ace061a 100644
--- a/drivers/block/mvsata_ide.c
+++ b/drivers/block/mvsata_ide.c
@@ -13,6 +13,8 @@
 #include asm/arch/orion5x.h
 #elif defined(CONFIG_KIRKWOOD)
 #include asm/arch/soc.h
+#elif defined(CONFIG_ARMADA_XP)
+#include linux/mbus.h
 #endif

 /* SATA port registers */
@@ -90,6 +92,46 @@ struct mvsata_port_registers {
 #define MVSATA_STATUS_TIMEOUT-1

 /*
+ * Registers for SATA MBUS memory windows
+ */
+
+#define MVSATA_WIN_CONTROL(w)(MVEBU_SATA_BASE + 0x30 + ((w)  4))
+#define MVSATA_WIN_BASE(w)(MVEBU_SATA_BASE + 0x34 + ((w)  4))
+
+/*
+ * Initialize SATA memory windows for Armada XP
+ */
+
+#ifdef CONFIG_ARMADA_XP
+static void mvsata_ide_conf_mbus_windows(void)
+{
+const struct mbus_dram_target_info *dram;
+int i;
+
+dram = mvebu_mbus_dram_info();
+
+/* Disable windows, Set Size/Base to 0  */
+for (i = 0; i  4; i++) {
+writel(0, MVSATA_WIN_CONTROL(i));
+writel(0, MVSATA_WIN_BASE(i));
+}
+
+for (i = 0; i  dram-num_cs; i++) {
+const struct mbus_dram_window *cs = dram-cs + i;
+
+printf(%s: sata window %d\n, __func__, i);
+printf(%s: size %04x, attr %02x, target %01x\n, __func__,
cs-size, cs-mbus_attr, dram-mbus_dram_target_id);
+printf(%s: base %04x\n\n, __func__, cs-base);
+
+writel(((cs-size - 1)  0x) | (cs-mbus_attr  8) |
+(dram-mbus_dram_target_id  4) | 1,
+MVSATA_WIN_CONTROL(i));
+writel(cs-base  0x, MVSATA_WIN_BASE(i));
+}
+}
+#endif
+
+/*
  * Initialize one MVSATAHC port: set SControl's IPM to always active
  * and DET to reset, then wait for SStatus's DET to become device and
  * comm ok (or time out after 50 us if no device), then set SControl's
@@ -137,6 +179,10 @@ int ide_preinit(void)
 int ret = MVSATA_STATUS_TIMEOUT;
 int status;

+#ifdef CONFIG_ARMADA_XP
+mvsata_ide_conf_mbus_windows();
+#endif
+
 /* Enable ATA port 0 (could be SATA port 0 or 1) if declared */
 #if defined(CONFIG_SYS_ATA_IDE0_OFFSET)
 status = mvsata_ide_initialize_port(
diff --git a/include/configs/db-mv784mp-gp.h
b/include/configs/db-mv784mp-gp.h
index c33a588..299bc82 100644
--- a/include/configs/db-mv784mp-gp.h
+++ b/include/configs/db-mv784mp-gp.h
@@ -32,6 +32,8 @@
 #define CONFIG_CMD_SPI
 #define CONFIG_CMD_TFTPPUT
 #define CONFIG_CMD_TIME
+#define CONFIG_CMD_BOOTZ
+#define CONFIG_CMD_IDE

 /* I2C */
 #define CONFIG_SYS_I2C
@@ -60,6 +62,33 @@
 #define CONFIG_SYS_CONSOLE_INFO_QUIET/* don't print console @ startup
*/
 #define CONFIG_SYS_ALT_MEMTEST

+/* IDE/ATA/SATA */
+#ifdef CONFIG_CMD_IDE
+#define __io
+#define CONFIG_IDE_PREINIT
+#define CONFIG_MVSATA_IDE
+
+/* Needs byte-swapping for ATA data register */
+#define CONFIG_IDE_SWAP_IO
+
+#define CONFIG_SYS_ATA_REG_OFFSET0x0100  /* Offset for normal
register accesses*/
+#define CONFIG_SYS_ATA_DATA_OFFSET0x0100  /* Offset for data I/O */
+#define CONFIG_SYS_ATA_ALT_OFFSET0x0100  /* Offset for data I/O */
+
+/* Each 8-bit ATA register is aligned to a 4-bytes address */
+#define CONFIG_SYS_ATA_STRIDE4
+
+/* CONFIG_CMD_IDE requires some #defines for ATA registers */
+#define CONFIG_SYS_IDE_MAXBUS  2
+#define CONFIG_SYS_IDE_MAXDEVICE   2
+
+/* ATA registers base is at SATA controller base */
+#define CONFIG_SYS_ATA_BASE_ADDRMVEBU_SATA_BASE
+#define CONFIG_SYS_ATA_IDE0_OFFSET0x2000
+
+#define CONFIG_DOS_PARTITION
+#endif /* CONFIG_CMD_IDE */
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
-- 
2.3.6


2015-06-30 8:57 GMT+02:00 Stefan Roese s...@denx.de:

 Hi Anton,

 On 29.06.2015 19:01, Anton Schubert wrote:

 2015-06-23 14:38 GMT+02:00 Stefan Roese s...@denx.de mailto:s...@denx.de:

 Hi Anton,

 On 23.06.2015 13:23, Bin Meng wrote:

 On Tue, Jun 23, 2015 at 5:35 PM, Anton Schubert
 anton.schub...@gmx.de mailto:anton.schub...@gmx.de wrote



 but noticed that there doesn't seem 

[U-Boot] [PATCH 2/2] ARM: dts: UniPhier: re-license device tree files under GPLv2+/X11

2015-06-30 Thread Masahiro Yamada
The current GPL only licensing on the device trees makes it very
impractical for other software components licensed under another
license.

To make it easier to reuse them, the device trees for UniPhier
SoCs and boards have already been dual-licensed in Linux.

Follow this trend in U-boot too.

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

 arch/arm/dts/uniphier-ph1-ld4-ref.dts   | 2 +-
 arch/arm/dts/uniphier-ph1-ld4.dtsi  | 2 +-
 arch/arm/dts/uniphier-ph1-pro4-ref.dts  | 2 +-
 arch/arm/dts/uniphier-ph1-pro4.dtsi | 2 +-
 arch/arm/dts/uniphier-ph1-sld3-ref.dts  | 2 +-
 arch/arm/dts/uniphier-ph1-sld3.dtsi | 2 +-
 arch/arm/dts/uniphier-ph1-sld8-ref.dts  | 2 +-
 arch/arm/dts/uniphier-ph1-sld8.dtsi | 2 +-
 arch/arm/dts/uniphier-ref-daughter.dtsi | 6 ++
 9 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/arm/dts/uniphier-ph1-ld4-ref.dts 
b/arch/arm/dts/uniphier-ph1-ld4-ref.dts
index d972c02..25e487a 100644
--- a/arch/arm/dts/uniphier-ph1-ld4-ref.dts
+++ b/arch/arm/dts/uniphier-ph1-ld4-ref.dts
@@ -5,7 +5,7 @@
  * Copyright (C) 2015  Socionext Inc.
  *   Author: Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /dts-v1/;
diff --git a/arch/arm/dts/uniphier-ph1-ld4.dtsi 
b/arch/arm/dts/uniphier-ph1-ld4.dtsi
index c355395..39d7b24 100644
--- a/arch/arm/dts/uniphier-ph1-ld4.dtsi
+++ b/arch/arm/dts/uniphier-ph1-ld4.dtsi
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /include/ skeleton.dtsi
diff --git a/arch/arm/dts/uniphier-ph1-pro4-ref.dts 
b/arch/arm/dts/uniphier-ph1-pro4-ref.dts
index f6d03e3..b4b7f61 100644
--- a/arch/arm/dts/uniphier-ph1-pro4-ref.dts
+++ b/arch/arm/dts/uniphier-ph1-pro4-ref.dts
@@ -5,7 +5,7 @@
  * Copyright (C) 2015  Socionext Inc.
  *   Author: Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /dts-v1/;
diff --git a/arch/arm/dts/uniphier-ph1-pro4.dtsi 
b/arch/arm/dts/uniphier-ph1-pro4.dtsi
index 5c82df7..f06906c 100644
--- a/arch/arm/dts/uniphier-ph1-pro4.dtsi
+++ b/arch/arm/dts/uniphier-ph1-pro4.dtsi
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /include/ skeleton.dtsi
diff --git a/arch/arm/dts/uniphier-ph1-sld3-ref.dts 
b/arch/arm/dts/uniphier-ph1-sld3-ref.dts
index d9616f6..9dc9296 100644
--- a/arch/arm/dts/uniphier-ph1-sld3-ref.dts
+++ b/arch/arm/dts/uniphier-ph1-sld3-ref.dts
@@ -5,7 +5,7 @@
  * Copyright (C) 2015  Socionext Inc.
  *   Author: Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /dts-v1/;
diff --git a/arch/arm/dts/uniphier-ph1-sld3.dtsi 
b/arch/arm/dts/uniphier-ph1-sld3.dtsi
index 1f93bb9..2fa42a6 100644
--- a/arch/arm/dts/uniphier-ph1-sld3.dtsi
+++ b/arch/arm/dts/uniphier-ph1-sld3.dtsi
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /include/ skeleton.dtsi
diff --git a/arch/arm/dts/uniphier-ph1-sld8-ref.dts 
b/arch/arm/dts/uniphier-ph1-sld8-ref.dts
index 69e9bfa..2d1359c 100644
--- a/arch/arm/dts/uniphier-ph1-sld8-ref.dts
+++ b/arch/arm/dts/uniphier-ph1-sld8-ref.dts
@@ -5,7 +5,7 @@
  * Copyright (C) 2015  Socionext Inc.
  *   Author: Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /dts-v1/;
diff --git a/arch/arm/dts/uniphier-ph1-sld8.dtsi 
b/arch/arm/dts/uniphier-ph1-sld8.dtsi
index 4f291f7..15df50f 100644
--- a/arch/arm/dts/uniphier-ph1-sld8.dtsi
+++ b/arch/arm/dts/uniphier-ph1-sld8.dtsi
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 /include/ skeleton.dtsi
diff --git a/arch/arm/dts/uniphier-ref-daughter.dtsi 
b/arch/arm/dts/uniphier-ref-daughter.dtsi
index aca9f58..84b2206 100644
--- a/arch/arm/dts/uniphier-ref-daughter.dtsi
+++ b/arch/arm/dts/uniphier-ref-daughter.dtsi
@@ -1,11 +1,9 @@
 /*
  * Device Tree Source for UniPhier Reference Daughter Board
  *
- * Copyright (C) 2014-2015 Panasonic Corporation
- * Copyright (C) 2015  Socionext Inc.
- *   Author: Masahiro Yamada yamada.masah...@socionext.com
+ * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier:GPL-2.0+X11
  */
 
 i2c0 {
-- 
1.9.1


[U-Boot] [PATCH 1/2] ARM: dts: UniPhier: sync device trees with the Linux kernel

2015-06-30 Thread Masahiro Yamada
This makes code diff much easier.

Device trees describe hardware attributes, which are independent
of software architecture.  It generally makes sense to synchronize
them beyond software projects.

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

 arch/arm/dts/uniphier-ph1-ld4.dtsi  | 47 +---
 arch/arm/dts/uniphier-ph1-pro4.dtsi | 48 ++---
 arch/arm/dts/uniphier-ph1-sld3.dtsi | 48 ++---
 arch/arm/dts/uniphier-ph1-sld8.dtsi | 47 +---
 4 files changed, 178 insertions(+), 12 deletions(-)

diff --git a/arch/arm/dts/uniphier-ph1-ld4.dtsi 
b/arch/arm/dts/uniphier-ph1-ld4.dtsi
index c200838..c355395 100644
--- a/arch/arm/dts/uniphier-ph1-ld4.dtsi
+++ b/arch/arm/dts/uniphier-ph1-ld4.dtsi
@@ -1,9 +1,7 @@
 /*
  * Device Tree Source for UniPhier PH1-LD4 SoC
  *
- * Copyright (C) 2014-2015 Panasonic Corporation
- * Copyright (C) 2015  Socionext Inc.
- *   Author: Masahiro Yamada yamada.masah...@socionext.com
+ * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
@@ -24,11 +22,26 @@
};
};
 
+   clocks {
+   arm_timer_clk: arm_timer_clk {
+   #clock-cells = 0;
+   compatible = fixed-clock;
+   clock-frequency = 5000;
+   };
+   };
+
soc {
compatible = simple-bus;
#address-cells = 1;
#size-cells = 1;
ranges;
+   interrupt-parent = intc;
+
+   extbus: extbus {
+   compatible = simple-bus;
+   #address-cells = 2;
+   #size-cells = 1;
+   };
 
uart0: serial@54006800 {
compatible = socionext,uniphier-uart;
@@ -94,6 +107,12 @@
status = disabled;
};
 
+   system-bus-controller-misc@5980 {
+   compatible = 
socionext,uniphier-system-bus-controller-misc,
+syscon;
+   reg = 0x5980 0x2000;
+   };
+
usb0: usb@5a800100 {
compatible = socionext,uniphier-ehci, generic-ehci;
status = disabled;
@@ -112,6 +131,28 @@
reg = 0x5a820100 0x100;
};
 
+   timer@6200 {
+   compatible = arm,cortex-a9-global-timer;
+   reg = 0x6200 0x20;
+   interrupts = 1 11 0x104;
+   clocks = arm_timer_clk;
+   };
+
+   timer@6600 {
+   compatible = arm,cortex-a9-twd-timer;
+   reg = 0x6600 0x20;
+   interrupts = 1 13 0x104;
+   clocks = arm_timer_clk;
+   };
+
+   intc: interrupt-controller@60001000 {
+   compatible = arm,cortex-a9-gic;
+   #interrupt-cells = 3;
+   interrupt-controller;
+   reg = 0x60001000 0x1000,
+ 0x6100 0x100;
+   };
+
nand: nand@6800 {
compatible = denali,denali-nand-dt;
reg = 0x6800 0x20, 0x6810 0x1000;
diff --git a/arch/arm/dts/uniphier-ph1-pro4.dtsi 
b/arch/arm/dts/uniphier-ph1-pro4.dtsi
index 8195266..5c82df7 100644
--- a/arch/arm/dts/uniphier-ph1-pro4.dtsi
+++ b/arch/arm/dts/uniphier-ph1-pro4.dtsi
@@ -1,9 +1,7 @@
 /*
  * Device Tree Source for UniPhier PH1-Pro4 SoC
  *
- * Copyright (C) 2014-2015 Panasonic Corporation
- * Copyright (C) 2015  Socionext Inc.
- *   Author: Masahiro Yamada yamada.masah...@socionext.com
+ * Copyright (C) 2014-2015 Masahiro Yamada yamada.masah...@socionext.com
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
@@ -16,6 +14,7 @@
cpus {
#address-cells = 1;
#size-cells = 0;
+   enable-method = socionext,uniphier-smp;
 
cpu@0 {
device_type = cpu;
@@ -30,11 +29,26 @@
};
};
 
+   clocks {
+   arm_timer_clk: arm_timer_clk {
+   #clock-cells = 0;
+   compatible = fixed-clock;
+   clock-frequency = 5000;
+   };
+   };
+
soc {
compatible = simple-bus;
#address-cells = 1;
#size-cells = 1;
ranges;
+   interrupt-parent = intc;
+
+   extbus: extbus {
+   compatible = simple-bus;
+   #address-cells = 2;
+   #size-cells = 1;
+   };
 

Re: [U-Boot] [PATCH v2] spi: cf_qspi: fix clamp macro type check compilation warnings

2015-06-30 Thread Angelo Dureghello

Hi Jagan,

On 29/06/2015 22:00, Jagan Teki wrote:

On 22 June 2015 at 12:49, Angelo Dureghello ang...@sysam.it wrote:



On 22/06/2015 08:44, Jagan Teki wrote:


On 22 June 2015 at 03:10, Angelo Dureghello ang...@sysam.it wrote:


Fix compilation warnings for redefined 'clamp' macro and non-uniform
clamp macro types.

Signed-off-by: Angelo Dureghello ang...@sysam.it
---
   drivers/spi/cf_qspi.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/cf_qspi.c b/drivers/spi/cf_qspi.c
index 834c5bd..e57e63e 100644
--- a/drivers/spi/cf_qspi.c
+++ b/drivers/spi/cf_qspi.c
@@ -19,7 +19,6 @@

   DECLARE_GLOBAL_DATA_PTR;

-#define clamp(x, low, high) (min(max(low, x), high))
   #define to_cf_qspi_slave(s) container_of(s, struct cf_qspi_slave,
slave)

   struct cf_qspi_slave {
@@ -120,7 +119,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus,
unsigned int cs,
  dev-qmr = 2u;
  else /* Get the closest baud rate */
  dev-qmr = clamp(((gd-bus_clk  2) + max_hz -
1)/max_hz,
-   2u, 255u);
+   2lu, 255lu);


replacing u with lu - any reason?


Compiling this file you will get compilation warnings.
The reason is that the unnecessary type check throws the warnings 
since clamp (and so included min max) uses different types.


u is unsigned int
lu uniforms types to  gd-bus_clk, that is unsigned long.


Best regards
Angelo Dureghello






Any Tested-by ?



Hi Jagan,

i am supposing there are no issues here, since 2 and 255 are inside the
8-bit range, and they was unsigned int instead of unsigned long so the
change gives no effect to the clamp.

I am still waiting the hardware here for proper mcf / qspi-testing. Will
test it then.


thanks!




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


Re: [U-Boot] [PATCH v6 1/5] dm: sf: Add Atmel DataFlash spi flash driver

2015-06-30 Thread Jagan Teki
Hi Haikun,

On 30 June 2015 at 04:48, Simon Glass s...@chromium.org wrote:
 Hi,

 On 26 June 2015 at 05:30, Haikun Wang haikun.w...@freescale.com wrote:
 Atmel DataFlash chips have commands different from common spi
 flash commands.
 Atmel DataFlash also have special page-size.
 This driver add support for accessing Atmel DataFlash.
 It is based on the Driver Model.
 Example:
 = sf probe 1:0
 SPI DataFlash: Detected AT45DB021B with page size 264 Bytes, erase size 264 
 Bytes, total 264 KiB, revision d
 = sf erase 0 42000
 SF: 270336 bytes @ 0x0 Erased: OK
 = mw.l 8200 45444342 2
 = sf write 8200 0 42000
 SF: 270336 bytes @ 0x0 Written: OK
 = sf read 8300 0 42000
 SF: 270336 bytes @ 0x0 Read: OK
 = cmp.b 8200 8300 42000
 Total of 270336 byte(s) were the same

 Signed-off-by: Haikun Wang haikun.w...@freescale.com

 Reviewed-by: Simon Glass s...@chromium.org

 The driver model stuff looks fine. But see some nits/suggestions below.

Can you fix this and send a patch on top of master.


 ---
 Verified with AT45DB021B on LS1021AQDS.
 Changes in v6:
 - Add defconfig patch in this series

 Changes in v5:
 - Change CONFIG_DM_SF_DATAFLASH to CONFIG_SF_DATAFLASH

 Changes in v4:
 - Use dev_get_priv and dev_get_uclass_priv
 - Add test log to commit message

 Changes in v3:
 - 1. Rename file spi_dataflash.c to sf_dataflash.c
 - 2. Add comment for array dataflash_data

 Changes in v2:
 - 1. Correct comment style
 - 2. Use get_timer in dataflash_waitready to check whether timeout
 - 3. Remove struct spi_flash * in struct dataflash, and get it from 
 udevice-uclass_priv
 - 4. Replace spi_flash_write_common with spi_flash_cmd_write
 - 5. Replace spi_flash_read with spi_flash_cmd_read
 - 6. Change type of varible status form char to u8 in dataflash_status
 - 7. Change add_dataflash's argument type due to change 3
 - 8. Add claim_bus and release_bus in erase/write/read due to change 4  5

 Changes in v1: None
  drivers/mtd/spi/Makefile   |   1 +
  drivers/mtd/spi/sf_dataflash.c | 711 
 +
  2 files changed, 712 insertions(+)
  create mode 100644 drivers/mtd/spi/sf_dataflash.c

 diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
 index c61b784..87f20bc 100644
 --- a/drivers/mtd/spi/Makefile
 +++ b/drivers/mtd/spi/Makefile
 @@ -15,6 +15,7 @@ endif
  #ifndef CONFIG_DM_SPI
  obj-$(CONFIG_SPI_FLASH) += sf_probe.o
  #endif
 +obj-$(CONFIG_SF_DATAFLASH) += sf_dataflash.o
  obj-$(CONFIG_CMD_SF) += sf.o
  obj-$(CONFIG_SPI_FLASH) += sf_ops.o sf_params.o
  obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
 diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
 new file mode 100644
 index 000..d287db8
 --- /dev/null
 +++ b/drivers/mtd/spi/sf_dataflash.c
 @@ -0,0 +1,711 @@
 +/*
 + *
 + * Atmel DataFlash probing
 + *
 + * Copyright (C) 2004-2009, 2015 Freescale Semiconductor, Inc.
 + * Haikun Wang (haikun.w...@freescale.com)
 + *
 + * SPDX-License-Identifier:GPL-2.0+
 +*/
 +#include common.h
 +#include dm.h
 +#include errno.h
 +#include fdtdec.h
 +#include spi.h
 +#include spi_flash.h
 +#include div64.h
 +#include linux/err.h
 +#include linux/math64.h
 +
 +#include sf_internal.h
 +
 +/*
 + * DataFlash is a kind of SPI flash.  Most AT45 chips have two buffers in
 + * each chip, which may be used for double buffered I/O; but this driver
 + * doesn't (yet) use these for any kind of i/o overlap or prefetching.
 + *
 + * Sometimes DataFlash is packaged in MMC-format cards, although the
 + * MMC stack can't (yet?) distinguish between MMC and DataFlash
 + * protocols during enumeration.
 + */
 +
 +/* reads can bypass the buffers */
 +#define OP_READ_CONTINUOUS 0xE8
 +#define OP_READ_PAGE   0xD2
 +
 +/* group B requests can run even while status reports busy */
 +#define OP_READ_STATUS 0xD7/* group B */
 +
 +/* move data between host and buffer */
 +#define OP_READ_BUFFER10xD4/* group B */
 +#define OP_READ_BUFFER20xD6/* group B */
 +#define OP_WRITE_BUFFER1   0x84/* group B */
 +#define OP_WRITE_BUFFER2   0x87/* group B */
 +
 +/* erasing flash */
 +#define OP_ERASE_PAGE  0x81
 +#define OP_ERASE_BLOCK 0x50
 +
 +/* move data between buffer and flash */
 +#define OP_TRANSFER_BUF1   0x53
 +#define OP_TRANSFER_BUF2   0x55
 +#define OP_MREAD_BUFFER1   0xD4
 +#define OP_MREAD_BUFFER2   0xD6
 +#define OP_MWERASE_BUFFER1 0x83
 +#define OP_MWERASE_BUFFER2 0x86
 +#define OP_MWRITE_BUFFER1  0x88/* sector must be pre-erased */
 +#define OP_MWRITE_BUFFER2  0x89/* sector must be pre-erased */
 +
 +/* write to buffer, then write-erase to flash */
 +#define OP_PROGRAM_VIA_BUF10x82
 +#define OP_PROGRAM_VIA_BUF20x85
 +
 +/* compare buffer to flash */
 +#define OP_COMPARE_BUF10x60
 +#define OP_COMPARE_BUF20x61
 +
 +/* read flash to buffer, then write-erase to flash */
 +#define 

Re: [U-Boot] [PATCH][v7] mpc85xx/T104xD4RDB: Add T104xD4RDB boards support

2015-06-30 Thread Priyanka Jain
Hello York,

This patch is not dependent on New SPI driver .

I have analysed the compilation error issue.
There has been some recent changes related to SPI_FLASH config which has caused 
the compilation error.
I will send the next version of the patch.

Regards
Priyanka

-Original Message-
From: Sun York-R58495 
Sent: Tuesday, June 30, 2015 4:58 AM
To: Jain Priyanka-B32167; u-boot@lists.denx.de
Cc: Ciubotariu Codrin Constantin-B43658; Wang Dongsheng-B40534
Subject: Re: [PATCH][v7] mpc85xx/T104xD4RDB: Add T104xD4RDB boards support



On 06/05/2015 02:59 AM, Priyanka Jain wrote:
 T1040D4RDB is a Freescale reference board that hosts the T1040 SoC.
 T1040D4RDB is re-designed T1040RDB board with following changes :
 - Support of DDR4 memory
 - Support of 0x66 serdes protocol which can support following interfaces
 - 2 RGMII's on DTSEC4, DTSEC5
 - 1 SGMII on DTSEC3
 - Support of QE-TDM
 
 Similarily T1042D4RDB is a Freescale reference board that hosts the T1040
 SoC. T1042D4RDB is re-designed T1042RDB board with following changes :
 - Support of DDR4 memory
 - Support for 0x86 serdes protocol which can support following interfaces
 - 2 RGMII's on DTSEC4, DTSEC5
 - 3 SGMII on DTSEC1, DTSEC2  DTSEC3
 - Support of DIU
 
 Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
 Signed-off-by: Codrin Ciubotariu codrin.ciubota...@freescale.com
 Signed-off-by: Wang Dongsheng dongsheng.w...@freescale.com

Does your patch depend on the new SPI flash driver under review? I got 
compiling error for undefined reference to spi_flash_probe, spi_flash_free.

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


Re: [U-Boot] git fsck errors with u-boot

2015-06-30 Thread Wolfgang Denk
Dear Liam R. Howlett,

In message 20150629173158.gd24...@yow-lhowlett-d0.wrs.com you wrote:
 
 Since git 2.1, there have been a number of new fsck options added which
 produce issues when I clone  fsck the repository
 git://git.denx.de/u-boot.git
...
 I think these issues were already reported here:
 https://www.mail-archive.com/u-boot@lists.denx.de/msg175411.html but
 were not reproducible.   Can you see if they can be reproduced using a
 newer git (2.4 or 2.3) and git fsck --full ?

Indeed these have been reported before - see the full thread at [1]

[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/223976

To summarize: there is no problem with the U-Boot repository, but a
false positive in git; the git folks are working on it, and it will
problebly be fixed in later versions of git.  There is no need for any
action on our side.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
:   I've tried (in vi) g/[a-z]\n[a-z]/s//_/...but that doesn't
: cut it.  Any ideas?  (I take it that it may be a two-pass sort of solution).
In the first pass, install perl. :-) Larry Wall 6...@jpl-devvax.jpl.nasa.gov
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >