Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Miquel Raynal
Hi Jagan,

Jagan Teki  wrote on Fri, 28 Sep 2018
12:18:49 +0530:

> On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal  
> wrote:
> >
> > During the last months, Boris Brezillon shared his work to support
> > serial flashes within Linux. First, he delivered (and merged) a new
> > layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > same time a NAND core that would be shared with all NAND devices. Then,
> > he contributed a generic SPI-NAND driver, making use of this NAND core,
> > as well as some vendor code to drive a few chips.
> >
> > On top of this work, I made some cleanups in the MTD layer and added an
> > 'mtd' U-Boot command to handle all sort of MTD devices. This should
> > become the default command instead of having one per flash flavor
> > ('sf', 'nand', 'spi-nand' ?).
> >
> > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > featuring a Macronix SPI NAND chip.
> >
> > TL;DR: the series contains (stripped version since ~30 patches have
> > already been taken):
> > - Support for spi-nand devices in mtdparts.
> > - Generics mtdparts/mtdids parsers.
> > - A new 'mtd' command.
> > - A note to set mtdparts command legacy.
> >
> > To test your SPI-NAND device with U-Boot, you can test someting like:
> >  
> > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for this 
> > > device
> > > ubi part bar # create a static UBI volume in the bar partition
> > > mtd list # show the current MTD devices/partitions  
> >
> > Thanks,
> > Miquèl
> >
> >
> > NB1: If UBI refuses to attach, verify the partition is epty with
> >  # mtd erase bar
> >
> > NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
> >  don't forget to probe your device *first* (sf probe, ...).
> >
> >
> > Changes since v9:
> > -
> > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
> >   everybody wants to use mtdids).
> > * mtd_parse_partitions() is still in mtdparts.c because it depends on
> >   partitions support, but the header file declaring it
> >   (include/linux/mtd/partitions.h) also has a dummy function if
> >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > * Typo corrected in mtd_parse_partitions prototype
> >   (s/_nb_parts/_nparts/).
> > * Added Boris' R-b tags.
> >
> > Changes since v8 (called v7 by mistake):
> > 
> > * Moved most of the generic logic to the core (mtd_uboot.c) so that it
> >   can be reused by other parts of U-Boot without depending on anything
> >   else than the MTD core itself.
> > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls now
> >   that the code is in the core.
> > * Created an helper for partitions deletion (as there is one to
> >   parse/create partition objects).
> > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > * Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" to
> >   actually deprecate the command.

[...]

> > Miquel Raynal (7):
> >   mtd: uclass: add probe function
> >   mtd: mtdpart: add a generic mtdparts-like parser
> >   mtd: uboot: search for an equivalent MTD name with the mtdids
> >   mtd: mtdpart: implement proper partition handling
> >   cmd: mtd: add 'mtd' command
> >   cmd: ubi: clean the partition handling
> >   cmd: mtdparts: describe as legacy  
> 
> I didn't find this mtdparts fallback change[1] in v10? does this
> fallback issue fixed differently.
> 
> [1] 
> https://github.com/openedev/u-boot-amarula/commit/9edbc2be512c9bd572884c53b5f54b583e897e9b

Indeed, I dropped this patch on Boris advice: if we want to deprecate
this command, we should not add new features to it (see the above
changelog).

Thanks,
Miquèl
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v8 08/15] regmap: Add raw read/write functions

2018-09-28 Thread Mario Six
Hi Daniel,
On Thu, Sep 27, 2018 at 1:28 PM Daniel Schwierzeck
 wrote:
>
> Hi Mario,
>
> Am Do., 27. Sep. 2018 um 11:48 Uhr schrieb Mario Six :
> >
> > The regmap functions currently assume that all register map accesses
> > have a data width of 32 bits, but there are maps that have different
> > widths.
> >
> > To rectify this, implement the regmap_raw_read and regmap_raw_write
> > functions from the Linux kernel API that specify the width of a desired
> > read or write operation on a regmap.
> >
> > Implement the regmap_read and regmap_write functions using these raw
> > functions in a backwards-compatible manner.
> >
> > Reviewed-by: Anatolij Gustschin 
> > Signed-off-by: Mario Six 
> >
> > ---
> >
> > v7 -> v8:
> > No changes
> >
> > v6 -> v7:
> > * Fixed wrong variable type in 64-bit read (u32 -> u64)
> > * Added 64-bit case in write function
> >
> > v5 -> v6:
> > * Corrected format specifier
> > * Added support for 64-bit reads/writes
> >
> > v4 -> v5:
> > No changes
> >
> > v3 -> v4:
> > * Switched 'ranges[0] + offset' to 'ranges[0].start + offset'
> > * Explained the difference between the raw and non-raw read/write
> >   functions better in the docs
> >
> > v2 -> v3:
> > * Implement the "raw" functions from Linux instead of adding a size
> >   parameter to the regmap_{read,write} functions
> > * Fixed style violation
> > * Improved error handling
> >
> > v1 -> v2:
> > New in v2
> >
> > ---
> >  drivers/core/regmap.c | 64 
> > +--
> >  include/regmap.h  | 58 ++
> >  2 files changed, 115 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
> > index 154426269d9..1025099797f 100644
> > --- a/drivers/core/regmap.c
> > +++ b/drivers/core/regmap.c
> > @@ -188,22 +188,72 @@ int regmap_uninit(struct regmap *map)
> > return 0;
> >  }
> >
> > +int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t 
> > val_len)
> > +{
> > +   void *ptr;
> > +
> > +   ptr = map_physmem(map->ranges[0].start + offset, val_len, 
> > MAP_NOCACHE);
> > +
> > +   switch (val_len) {
> > +   case REGMAP_SIZE_8:
> > +   *((u8 *)valp) = in_8((u8 *)ptr);
> > +   break;
> > +   case REGMAP_SIZE_16:
> > +   *((u16 *)valp) = in_le16((u16 *)ptr);
> > +   break;
> > +   case REGMAP_SIZE_32:
> > +   *((u32 *)valp) = in_le32((u32 *)ptr);
> > +   break;
> > +#if defined(in_le64) && defined(readq)
> > +   case REGMAP_SIZE_64:
> > +   *((u64 *)valp) = in_le64((u64 *)ptr);
> > +   break;
> > +#endif
> > +   default:
> > +   debug("%s: regmap size %zu unknown\n", __func__, val_len);
> > +   return -EINVAL;
> > +   }
> > +   return 0;
> > +}
>
> I'm still not convinced why you want to enforce Little Endian here.
> This makes regmap unuseable on archs like MIPS or PowerPC.
>
> Typically a SoC with a MIPS CPU core can have an AMBA bus or other LE
> based sub-systems. Some SoCs can select the endianess of the CPU core
> via pin strapping. Normally the endianess conversion is automatically
> done in HW.
>
> So I suggest to simply use readl or __raw_readl to support native
> endianess as default. Later we could add a DT properties
> "native-endian", "big-endian" and "little-endian" like in the Linux
> implementation.
>
Ironically, we want to use the interface on a PowerPC platform :-) (for a
little-endian FPGA interface that's not auto-translating). But I do see your
point.

I just finished testing a v9 of this series that implements support for the
"native-endian", "big-endian", and "little-endian" DT properties (and uses
native-endian as the default). That way we can use the interface on our
platform, and native-endian is the default, so MIPS should be able to use
regmap too.

I think that should solve the problem adequately for everyone.

> --
> - Daniel
>
Best regards,
Mario
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Jagan Teki
On Fri, Sep 28, 2018 at 12:38 PM Miquel Raynal
 wrote:
>
> Hi Jagan,
>
> Jagan Teki  wrote on Fri, 28 Sep 2018
> 12:18:49 +0530:
>
> > On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal  
> > wrote:
> > >
> > > During the last months, Boris Brezillon shared his work to support
> > > serial flashes within Linux. First, he delivered (and merged) a new
> > > layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > > same time a NAND core that would be shared with all NAND devices. Then,
> > > he contributed a generic SPI-NAND driver, making use of this NAND core,
> > > as well as some vendor code to drive a few chips.
> > >
> > > On top of this work, I made some cleanups in the MTD layer and added an
> > > 'mtd' U-Boot command to handle all sort of MTD devices. This should
> > > become the default command instead of having one per flash flavor
> > > ('sf', 'nand', 'spi-nand' ?).
> > >
> > > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > featuring a Macronix SPI NAND chip.
> > >
> > > TL;DR: the series contains (stripped version since ~30 patches have
> > > already been taken):
> > > - Support for spi-nand devices in mtdparts.
> > > - Generics mtdparts/mtdids parsers.
> > > - A new 'mtd' command.
> > > - A note to set mtdparts command legacy.
> > >
> > > To test your SPI-NAND device with U-Boot, you can test someting like:
> > >
> > > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for this 
> > > > device
> > > > ubi part bar # create a static UBI volume in the bar partition
> > > > mtd list # show the current MTD devices/partitions
> > >
> > > Thanks,
> > > Miquèl
> > >
> > >
> > > NB1: If UBI refuses to attach, verify the partition is epty with
> > >  # mtd erase bar
> > >
> > > NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
> > >  don't forget to probe your device *first* (sf probe, ...).
> > >
> > >
> > > Changes since v9:
> > > -
> > > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
> > >   everybody wants to use mtdids).
> > > * mtd_parse_partitions() is still in mtdparts.c because it depends on
> > >   partitions support, but the header file declaring it
> > >   (include/linux/mtd/partitions.h) also has a dummy function if
> > >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > > * Typo corrected in mtd_parse_partitions prototype
> > >   (s/_nb_parts/_nparts/).
> > > * Added Boris' R-b tags.
> > >
> > > Changes since v8 (called v7 by mistake):
> > > 
> > > * Moved most of the generic logic to the core (mtd_uboot.c) so that it
> > >   can be reused by other parts of U-Boot without depending on anything
> > >   else than the MTD core itself.
> > > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls now
> > >   that the code is in the core.
> > > * Created an helper for partitions deletion (as there is one to
> > >   parse/create partition objects).
> > > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > > * Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" to
> > >   actually deprecate the command.
>
> [...]
>
> > > Miquel Raynal (7):
> > >   mtd: uclass: add probe function
> > >   mtd: mtdpart: add a generic mtdparts-like parser
> > >   mtd: uboot: search for an equivalent MTD name with the mtdids
> > >   mtd: mtdpart: implement proper partition handling
> > >   cmd: mtd: add 'mtd' command
> > >   cmd: ubi: clean the partition handling
> > >   cmd: mtdparts: describe as legacy
> >
> > I didn't find this mtdparts fallback change[1] in v10? does this
> > fallback issue fixed differently.
> >
> > [1] 
> > https://github.com/openedev/u-boot-amarula/commit/9edbc2be512c9bd572884c53b5f54b583e897e9b
>
> Indeed, I dropped this patch on Boris advice: if we want to deprecate
> this command, we should not add new features to it (see the above
> changelog).

OK.

Here are all spi-nand changes[2], I still find the build issues[3],
any dependencies other than these changes?

[2] https://github.com/openedev/u-boot-amarula/commits/wip-spi-nand
[3] https://travis-ci.org/openedev/u-boot-amarula/builds/434479310
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v9 03/16] regmap: Add documentation

2018-09-28 Thread Mario Six
Document the regmap_alloc() function.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 drivers/core/regmap.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 8e5c3bcf61b..77f6f520a06 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -17,6 +17,12 @@

 DECLARE_GLOBAL_DATA_PTR;

+/**
+ * regmap_alloc() - Allocate a regmap with a given number of ranges.
+ *
+ * @count: Number of ranges to be allocated for the regmap.
+ * Return: A pointer to the newly allocated regmap, or NULL on error.
+ */
 static struct regmap *regmap_alloc(int count)
 {
struct regmap *map;
--
2.11.0

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


[U-Boot] [PATCH v9 05/16] regmap: Introduce init_range

2018-09-28 Thread Mario Six
Both fdtdec_get_addr_size_fixed and of_address_to_resource can fail with
an error, which is not currently checked during regmap initialization.

Since the indentation depth is already quite deep, extract a new
'init_range' method to do the initialization.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
* Introduced else clause in of_live_active() if statement to make the
  distinction between live and non-live cases clearer

v2 -> v3:
New in v3

---
 drivers/core/regmap.c | 68 ++-
 1 file changed, 56 insertions(+), 12 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 4ebab233490..25c1ae5d7df 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -56,6 +56,58 @@ int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t 
*reg, int count,
return 0;
 }
 #else
+/**
+ * init_range() - Initialize a single range of a regmap
+ * @node: Device node that will use the map in question
+ * @range:Pointer to a regmap_range structure that will be initialized
+ * @addr_len: The length of the addr parts of the reg property
+ * @size_len: The length of the size parts of the reg property
+ * @index:The index of the range to initialize
+ *
+ * This function will read the necessary 'reg' information from the device tree
+ * (the 'addr' part, and the 'length' part), and initialize the range in
+ * quesion.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static int init_range(ofnode node, struct regmap_range *range, int addr_len,
+ int size_len, int index)
+{
+   fdt_size_t sz;
+   struct resource r;
+
+   if (of_live_active()) {
+   int ret;
+
+   ret = of_address_to_resource(ofnode_to_np(node),
+index, &r);
+   if (ret) {
+   debug("%s: Could not read resource of range %d (ret = 
%d)\n",
+ ofnode_get_name(node), index, ret);
+   return ret;
+   }
+
+   range->start = r.start;
+   range->size = r.end - r.start + 1;
+   } else {
+   int offset = ofnode_to_offset(node);
+
+   range->start = fdtdec_get_addr_size_fixed(gd->fdt_blob, offset,
+ "reg", index,
+ addr_len, size_len,
+ &sz, true);
+   if (range->start == FDT_ADDR_T_NONE) {
+   debug("%s: Could not read start of range %d\n",
+ ofnode_get_name(node), index);
+   return -EINVAL;
+   }
+
+   range->size = sz;
+   }
+
+   return 0;
+}
+
 int regmap_init_mem(ofnode node, struct regmap **mapp)
 {
struct regmap_range *range;
@@ -64,7 +116,6 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
int addr_len, size_len, both_len;
int len;
int index;
-   struct resource r;

addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
if (addr_len < 0) {
@@ -101,17 +152,10 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)

for (range = map->ranges, index = 0; count > 0;
 count--, range++, index++) {
-   fdt_size_t sz;
-   if (of_live_active()) {
-   of_address_to_resource(ofnode_to_np(node), index, &r);
-   range->start = r.start;
-   range->size = r.end - r.start + 1;
-   } else {
-   range->start = fdtdec_get_addr_size_fixed(gd->fdt_blob,
-   ofnode_to_offset(node), "reg", index,
-   addr_len, size_len, &sz, true);
-   range->size = sz;
-   }
+   int ret = init_range(node, range, addr_len, size_len, index);
+
+   if (ret)
+   return ret;
}

*mapp = map;
--
2.11.0

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


[U-Boot] [PATCH v9 04/16] regmap: Improve error handling

2018-09-28 Thread Mario Six
ofnode_read_simple_addr_cells may fail and return a negative error code.
Check for this when initializing regmaps.

Also check if both_len is zero, since this is perfectly possible, and
would lead to a division-by-zero further down the line.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 drivers/core/regmap.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 77f6f520a06..4ebab233490 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -67,8 +67,25 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
struct resource r;

addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
+   if (addr_len < 0) {
+   debug("%s: Error while reading the addr length (ret = %d)\n",
+ ofnode_get_name(node), addr_len);
+   return addr_len;
+   }
+
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
+   if (size_len < 0) {
+   debug("%s: Error while reading the size length: (ret = %d)\n",
+ ofnode_get_name(node), size_len);
+   return size_len;
+   }
+
both_len = addr_len + size_len;
+   if (!both_len) {
+   debug("%s: Both addr and size length are zero\n",
+ ofnode_get_name(node));
+   return -EINVAL;
+   }

len = ofnode_read_size(node, "reg");
if (len < 0)
--
2.11.0

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


[U-Boot] [PATCH v9 10/16] regmap: Define regmap_{get,set}

2018-09-28 Thread Mario Six
It would be convenient if one could use the regmap API in conjunction
with register maps defined as structs (i.e. structs that directly mirror
the memory layout of the registers in question). A similar approach was
planned with the regmap_write32/regmap_read32 macros, but was never
used.

Hence, implement regmap_set/regmap_range_set and
regmap_get/regmap_range_get macros, which, given a register map, a
struct describing the layout of the register map, and a member name
automatically produce regmap_read/regmap_write calls that access the
specified member in the register map.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
* Fixed style violations
* Added documentation

v1 -> v2:
New in v2

---
 include/regmap.h | 54 ++
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/include/regmap.h b/include/regmap.h
index eba300da29b..3b7eea5f493 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -146,11 +146,57 @@ int regmap_raw_write_range(struct regmap *map, uint 
range_num, uint offset,
 int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
  void *valp, size_t val_len);

-#define regmap_write32(map, ptr, member, val) \
-   regmap_write(map, (uint32_t *)(ptr)->member - (uint32_t *)(ptr), val)
+/**
+ * regmap_range_set() - Set a value in a regmap range described by a struct
+ * @map:Regmap in which a value should be set
+ * @range:  Range of the regmap in which a value should be set
+ * @type:   Structure type that describes the memory layout of the regmap range
+ * @member: Member of the describing structure that should be set in the regmap
+ *  range
+ * @val:Value which should be written to the regmap range
+ */
+#define regmap_range_set(map, range, type, member, val) \
+   do { \
+   typeof(((type *)0)->member) __tmp = val; \
+   regmap_raw_write_range(map, range, offsetof(type, member), \
+  &__tmp, sizeof(((type *)0)->member)); \
+   } while (0)
+
+/**
+ * regmap_set() - Set a value in a regmap described by a struct
+ * @map:Regmap in which a value should be set
+ * @type:   Structure type that describes the memory layout of the regmap
+ * @member: Member of the describing structure that should be set in the regmap
+ * @val:Value which should be written to the regmap
+ */
+#define regmap_set(map, type, member, val) \
+   regmap_range_set(map, 0, type, member, val)

-#define regmap_read32(map, ptr, member, valp) \
-   regmap_read(map, (uint32_t *)(ptr)->member - (uint32_t *)(ptr), valp)
+/**
+ * regmap_range_get() - Get a value from a regmap range described by a struct
+ * @map:Regmap from which a value should be read
+ * @range:  Range of the regmap from which a value should be read
+ * @type:   Structure type that describes the memory layout of the regmap
+ *  range
+ * @member: Member of the describing structure that should be read in the
+ *  regmap range
+ * @valp:   Variable that receives the value read from the regmap range
+ */
+#define regmap_range_get(map, range, type, member, valp) \
+   regmap_raw_read_range(map, range, offsetof(type, member), \
+ (void *)valp, sizeof(((type *)0)->member))
+
+/**
+ * regmap_get() - Get a value from a regmap described by a struct
+ * @map:Regmap from which a value should be read
+ * @type:   Structure type that describes the memory layout of the regmap
+ *  range
+ * @member: Member of the describing structure that should be read in the
+ *  regmap
+ * @valp:   Variable that receives the value read from the regmap
+ */
+#define regmap_get(map, type, member, valp) \
+   regmap_range_get(map, 0, type, member, valp)

 /**
  * regmap_update_bits() - Perform a read/modify/write using a mask
--
2.11.0

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


[U-Boot] [PATCH v9 08/16] regmap: Add raw read/write functions

2018-09-28 Thread Mario Six
The regmap functions currently assume that all register map accesses
have a data width of 32 bits, but there are maps that have different
widths.

To rectify this, implement the regmap_raw_read and regmap_raw_write
functions from the Linux kernel API that specify the width of a desired
read or write operation on a regmap.

Implement the regmap_read and regmap_write functions using these raw
functions in a backwards-compatible manner.

Reviewed-by: Anatolij Gustschin 
Signed-off-by: Mario Six 

---

v8 -> v9:
* Removed forgotten "fpgamap" in documentation

v7 -> v8:
No changes

v6 -> v7:
* Fixed wrong variable type in 64-bit read (u32 -> u64)
* Added 64-bit case in write function

v5 -> v6:
* Corrected format specifier
* Added support for 64-bit reads/writes

v4 -> v5:
No changes

v3 -> v4:
* Switched 'ranges[0] + offset' to 'ranges[0].start + offset'
* Explained the difference between the raw and non-raw read/write
  functions better in the docs

v2 -> v3:
* Implement the "raw" functions from Linux instead of adding a size
  parameter to the regmap_{read,write} functions
* Fixed style violation
* Improved error handling

v1 -> v2:
New in v2

---
 drivers/core/regmap.c | 64 +--
 include/regmap.h  | 58 ++
 2 files changed, 115 insertions(+), 7 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 154426269d9..1025099797f 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -188,22 +188,72 @@ int regmap_uninit(struct regmap *map)
return 0;
 }

+int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t 
val_len)
+{
+   void *ptr;
+
+   ptr = map_physmem(map->ranges[0].start + offset, val_len, MAP_NOCACHE);
+
+   switch (val_len) {
+   case REGMAP_SIZE_8:
+   *((u8 *)valp) = in_8((u8 *)ptr);
+   break;
+   case REGMAP_SIZE_16:
+   *((u16 *)valp) = in_le16((u16 *)ptr);
+   break;
+   case REGMAP_SIZE_32:
+   *((u32 *)valp) = in_le32((u32 *)ptr);
+   break;
+#if defined(in_le64) && defined(readq)
+   case REGMAP_SIZE_64:
+   *((u64 *)valp) = in_le64((u64 *)ptr);
+   break;
+#endif
+   default:
+   debug("%s: regmap size %zu unknown\n", __func__, val_len);
+   return -EINVAL;
+   }
+   return 0;
+}
+
 int regmap_read(struct regmap *map, uint offset, uint *valp)
 {
-   u32 *ptr = map_physmem(map->ranges[0].start + offset, 4, MAP_NOCACHE);
+   return regmap_raw_read(map, offset, valp, REGMAP_SIZE_32);
+}

-   *valp = le32_to_cpu(readl(ptr));
+int regmap_raw_write(struct regmap *map, uint offset, const void *val,
+size_t val_len)
+{
+   void *ptr;
+
+   ptr = map_physmem(map->ranges[0].start + offset, val_len, MAP_NOCACHE);
+
+   switch (val_len) {
+   case REGMAP_SIZE_8:
+   out_8((u8 *)ptr, *((u8 *)val));
+   break;
+   case REGMAP_SIZE_16:
+   out_le16((u16 *)ptr, *((u16 *)val));
+   break;
+   case REGMAP_SIZE_32:
+   out_le32((u32 *)ptr, *((u32 *)val));
+   break;
+#if defined(out_le64) && defined(writeq)
+   case REGMAP_SIZE_64:
+   out_le64((u64 *)ptr, *((u64 *)val));
+   break;
+#endif
+   default:
+   debug("%s: regmap size %zu unknown\n", __func__, val_len);
+   return -EINVAL;
+   }

return 0;
 }

 int regmap_write(struct regmap *map, uint offset, uint val)
 {
-   u32 *ptr = map_physmem(map->ranges[0].start + offset, 4, MAP_NOCACHE);
-
-   writel(cpu_to_le32(val), ptr);
-
-   return 0;
+   return regmap_raw_write(map, offset, &val, REGMAP_SIZE_32);
 }

 int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val)
diff --git a/include/regmap.h b/include/regmap.h
index 32f75e06f59..f23664e8ba1 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -8,6 +8,21 @@
 #define __REGMAP_H

 /**
+ * enum regmap_size_t - Access sizes for regmap reads and writes
+ *
+ * @REGMAP_SIZE_8: 8-bit read/write access size
+ * @REGMAP_SIZE_16: 16-bit read/write access size
+ * @REGMAP_SIZE_32: 32-bit read/write access size
+ * @REGMAP_SIZE_64: 64-bit read/write access size
+ */
+enum regmap_size_t {
+   REGMAP_SIZE_8 = 1,
+   REGMAP_SIZE_16 = 2,
+   REGMAP_SIZE_32 = 4,
+   REGMAP_SIZE_64 = 8,
+};
+
+/**
  * struct regmap_range - a register map range
  *
  * @start: Start address
@@ -41,6 +56,10 @@ struct regmap {
  * @offset:Offset in the regmap to write to
  * @val:   Data to write to the regmap at the specified offset
  *
+ * Note that this function will only write values of 32 bit width to the
+ * regmap; if the size of data to be read is different, the regmap_raw_write
+ * function can be used.
+ *
  * Return: 0 if OK, -ve on error
  */
 int regmap_write(struct 

[U-Boot] [PATCH v9 02/16] regmap: Fix documentation

2018-09-28 Thread Mario Six
The documentation in regmap.h is not in kernel-doc format. Correct this.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 include/regmap.h | 48 +++-
 1 file changed, 39 insertions(+), 9 deletions(-)

diff --git a/include/regmap.h b/include/regmap.h
index 6a574eaa412..32f75e06f59 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -21,8 +21,8 @@ struct regmap_range {
 /**
  * struct regmap - a way of accessing hardware/bus registers
  *
- * @range_count: Number of ranges available within the map
- * @ranges:Array of ranges
+ * @range_count:   Number of ranges available within the map
+ * @ranges:Array of ranges
  */
 struct regmap {
int range_count;
@@ -33,7 +33,28 @@ struct regmap {
  * Interface to provide access to registers either through a direct memory
  * bus or through a peripheral bus like I2C, SPI.
  */
+
+/**
+ * regmap_write() - Write a 32-bit value to a regmap
+ *
+ * @map:   Regmap to write to
+ * @offset:Offset in the regmap to write to
+ * @val:   Data to write to the regmap at the specified offset
+ *
+ * Return: 0 if OK, -ve on error
+ */
 int regmap_write(struct regmap *map, uint offset, uint val);
+
+/**
+ * regmap_read() - Read a 32-bit value from a regmap
+ *
+ * @map:   Regmap to read from
+ * @offset:Offset in the regmap to read from
+ * @valp:  Pointer to the buffer to receive the data read from the regmap
+ * at the specified offset
+ *
+ * Return: 0 if OK, -ve on error
+ */
 int regmap_read(struct regmap *map, uint offset, uint *valp);

 #define regmap_write32(map, ptr, member, val) \
@@ -49,31 +70,36 @@ int regmap_read(struct regmap *map, uint offset, uint 
*valp);
  * @offset:Offset of the memory
  * @mask:  Mask to apply to the read value
  * @val:   Value to apply to the value to write
+ * Return: 0 if OK, -ve on error
  */
 int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val);

 /**
  * regmap_init_mem() - Set up a new register map that uses memory access
  *
- * Use regmap_uninit() to free it.
- *
  * @node:  Device node that uses this map
  * @mapp:  Returns allocated map
+ * Return: 0 if OK, -ve on error
+ *
+ * Use regmap_uninit() to free it.
  */
 int regmap_init_mem(ofnode node, struct regmap **mapp);

 /**
- * regmap_init_mem_platdata() - Set up a new memory register map for 
of-platdata
+ * regmap_init_mem_platdata() - Set up a new memory register map for
+ * of-platdata
+ *
+ * @dev:   Device that uses this map
+ * @reg:   List of address, size pairs
+ * @count: Number of pairs (e.g. 1 if the regmap has a single entry)
+ * @mapp:  Returns allocated map
+ * Return: 0 if OK, -ve on error
  *
  * This creates a new regmap with a list of regions passed in, rather than
  * using the device tree. It only supports 32-bit machines.
  *
  * Use regmap_uninit() to free it.
  *
- * @dev:   Device that uses this map
- * @reg:   List of address, size pairs
- * @count: Number of pairs (e.g. 1 if the regmap has a single entry)
- * @mapp:  Returns allocated map
  */
 int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count,
 struct regmap **mapp);
@@ -83,11 +109,15 @@ int regmap_init_mem_platdata(struct udevice *dev, 
fdt_val_t *reg, int count,
  *
  * @map:   Regmap to query
  * @range_num: Range to look up
+ * Return: Pointer to the range in question if OK, NULL on error
  */
 void *regmap_get_range(struct regmap *map, unsigned int range_num);

 /**
  * regmap_uninit() - free a previously inited regmap
+ *
+ * @map:   Regmap to free
+ * Return: 0 if OK, -ve on error
  */
 int regmap_uninit(struct regmap *map);

--
2.11.0

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


[U-Boot] [PATCH v9 14/16] misc: Sort Makefile entries

2018-09-28 Thread Mario Six
Makefile entries should be sorted.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
Signed-off-by: Anatolij Gustschin 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
Drop re-ordered entries that are not in mainline
(e.g. CONFIG_GDSYS_IOEP, CONFIG_MPC83XX_SERDES, misc_sandbox.o)

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 drivers/misc/Makefile | 56 +--
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index da4666fdfcb..c4fff92f54e 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -4,11 +4,6 @@
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.

 obj-$(CONFIG_MISC) += misc-uclass.o
-obj-$(CONFIG_ALI152X) += ali512x.o
-obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
-obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
-obj-$(CONFIG_DS4510)  += ds4510.o
-obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_CROS_EC) += cros_ec.o
 obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o
@@ -16,43 +11,48 @@ obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o
 obj-$(CONFIG_CROS_EC_SANDBOX) += cros_ec_sandbox.o
 obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
 endif
-obj-$(CONFIG_FSL_IIM) += fsl_iim.o
-obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o
-obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
-obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
-obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o
-obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o
-obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o
-obj-$(CONFIG_NS87308) += ns87308.o
-obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o
 ifdef CONFIG_DM_I2C
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_SANDBOX) += i2c_eeprom_emul.o
 endif
 endif
-obj-$(CONFIG_SMSC_LPC47M) += smsc_lpc47m.o
-obj-$(CONFIG_SMSC_SIO1007) += smsc_sio1007.o
-obj-$(CONFIG_LED_STATUS) += status_led.o
-obj-$(CONFIG_SANDBOX) += swap_case.o
 ifdef CONFIG_SPL_OF_PLATDATA
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SANDBOX) += spltest_sandbox.o
 endif
 endif
-obj-$(CONFIG_SANDBOX) += syscon_sandbox.o misc_sandbox.o
-obj-$(CONFIG_TEGRA_CAR) += tegra_car.o
-obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o
-obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
+obj-$(CONFIG_ALI152X) += ali512x.o
+obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
+obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
+obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
+obj-$(CONFIG_DS4510)  += ds4510.o
+obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o
 obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
+obj-$(CONFIG_FSL_IIM) += fsl_iim.o
+obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o
+obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
+obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
+obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
+obj-$(CONFIG_LED_STATUS) += status_led.o
+obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o
+obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
+obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o
+obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o
+obj-$(CONFIG_NS87308) += ns87308.o
+obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o
 obj-$(CONFIG_PCA9551_LED) += pca9551_led.o
-obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o
-obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
+obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o
 obj-$(CONFIG_QFW) += qfw.o
 obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o
-obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
+obj-$(CONFIG_SANDBOX) += swap_case.o
+obj-$(CONFIG_SANDBOX) += syscon_sandbox.o misc_sandbox.o
+obj-$(CONFIG_SMSC_LPC47M) += smsc_lpc47m.o
+obj-$(CONFIG_SMSC_SIO1007) += smsc_sio1007.o
 obj-$(CONFIG_STM32MP_FUSE) += stm32mp_fuse.o
+obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
 obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
-obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
-obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
-obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
+obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o
+obj-$(CONFIG_TEGRA_CAR) += tegra_car.o
+obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
+obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
--
2.11.0

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


[U-Boot] [PATCH v9 07/16] mips: Implement {in, out}_{le, be}_{16, 32, 64} and {in, out}_8

2018-09-28 Thread Mario Six
MIPS is the only architecture currently supported by U-Boot that does
not implement any of the in/out register access functions.

To have a interface that is useable across architectures, add the
functions to the MIPS architecture (implemented using the __raw_write
and __raw_read functions).

Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
New in v6

---
 arch/mips/include/asm/io.h | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 957442effd2..7c40e415c74 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -547,6 +547,28 @@ __BUILD_CLRSETBITS(bwlq, sfx, end, type)
 #define __to_cpu(v)(v)
 #define cpu_to__(v)(v)

+#define out_arch(type, endian, a, v)   __raw_write##type(cpu_to_##endian(v),a)
+#define in_arch(type, endian, a)   endian##_to_cpu(__raw_read##type(a))
+
+#define out_le64(a, v) out_arch(q, le64, a, v)
+#define out_le32(a, v) out_arch(l, le32, a, v)
+#define out_le16(a, v) out_arch(w, le16, a, v)
+
+#define in_le64(a) in_arch(q, le64, a)
+#define in_le32(a) in_arch(l, le32, a)
+#define in_le16(a) in_arch(w, le16, a)
+
+#define out_be64(a, v) out_arch(q, be64, a, v)
+#define out_be32(a, v) out_arch(l, be32, a, v)
+#define out_be16(a, v) out_arch(w, be16, a, v)
+
+#define in_be64(a) in_arch(q, be64, a)
+#define in_be32(a) in_arch(l, be32, a)
+#define in_be16(a) in_arch(w, be16, a)
+
+#define out_8(a, v)__raw_writeb(v, a)
+#define in_8(a)__raw_readb(a)
+
 BUILD_CLRSETBITS(b, 8, _, u8)
 BUILD_CLRSETBITS(w, le16, le16, u16)
 BUILD_CLRSETBITS(w, be16, be16, u16)
--
2.11.0

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


[U-Boot] [PATCH v9 06/16] regmap: Add error output

2018-09-28 Thread Mario Six
Add some debug output in cases where the initialization of a regmap
fails.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 drivers/core/regmap.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 25c1ae5d7df..154426269d9 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -139,12 +139,18 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
}

len = ofnode_read_size(node, "reg");
-   if (len < 0)
+   if (len < 0) {
+   debug("%s: Error while reading reg size (ret = %d)\n",
+ ofnode_get_name(node), len);
return len;
+   }
len /= sizeof(fdt32_t);
count = len / both_len;
-   if (!count)
+   if (!count) {
+   debug("%s: Not enough data in reg property\n",
+ ofnode_get_name(node));
return -EINVAL;
+   }

map = regmap_alloc(count);
if (!map)
--
2.11.0

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


[U-Boot] [PATCH v9 11/16] test: regmap: Add test for regmap_{set, get}

2018-09-28 Thread Mario Six
Add test for regmap_{set,get} functions.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 test/dm/regmap.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index b28d6a6cd11..a8d7e6829ec 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -116,3 +116,31 @@ static int dm_test_regmap_rw(struct unit_test_state *uts)
 }

 DM_TEST(dm_test_regmap_rw, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Get/Set test */
+static int dm_test_regmap_getset(struct unit_test_state *uts)
+{
+   struct udevice *dev;
+   struct regmap *map;
+   uint reg;
+   struct layout {
+   u32 val0;
+   u32 val1;
+   u32 val2;
+   u32 val3;
+   };
+
+   ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
+   map = syscon_get_regmap(dev);
+   ut_assertok_ptr(map);
+
+   regmap_set(map, struct layout, val0, 0xcacafafa);
+   regmap_set(map, struct layout, val3, 0x55aa2211);
+
+   ut_assertok(regmap_get(map, struct layout, val0, ®));
+   ut_assertok(regmap_get(map, struct layout, val3, ®));
+
+   return 0;
+}
+
+DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
--
2.11.0

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


[U-Boot] [PATCH v9 12/16] regmap: Add endianness support

2018-09-28 Thread Mario Six
Add support for switching the endianness of regmap accesses via the
"little-endian", "big-endian", and "native-endian" boolean properties in
the device tree.

The default endianness is native endianness.

Signed-off-by: Mario Six 

---

v8 -> v9:
New in v9

---
 drivers/core/regmap.c | 130 ++
 include/regmap.h  |  14 ++
 2 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 761dc535ed8..da2a1d0b883 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -164,6 +164,15 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
return ret;
}

+   if (ofnode_read_bool(node, "little-endian"))
+   map->endianness = REGMAP_LITTLE_ENDIAN;
+   else if (ofnode_read_bool(node, "big-endian"))
+   map->endianness = REGMAP_BIG_ENDIAN;
+   else if (ofnode_read_bool(node, "native-endian"))
+   map->endianness = REGMAP_NATIVE_ENDIAN;
+   else /* Default: native endianness */
+   map->endianness = REGMAP_NATIVE_ENDIAN;
+
*mapp = map;

return 0;
@@ -188,6 +197,55 @@ int regmap_uninit(struct regmap *map)
return 0;
 }

+static inline u8 __read_8(u8 *addr, enum regmap_endianness_t endianness)
+{
+   return in_8(addr);
+}
+
+static inline u16 __read_16(u16 *addr, enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_LITTLE_ENDIAN:
+   return in_le16(addr);
+   case REGMAP_BIG_ENDIAN:
+   return in_be16(addr);
+   case REGMAP_NATIVE_ENDIAN:
+   return readw(addr);
+   }
+
+   return readw(addr);
+}
+
+static inline u32 __read_32(u32 *addr, enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_LITTLE_ENDIAN:
+   return in_le32(addr);
+   case REGMAP_BIG_ENDIAN:
+   return in_be32(addr);
+   case REGMAP_NATIVE_ENDIAN:
+   return readl(addr);
+   }
+
+   return readl(addr);
+}
+
+#if defined(in_le64) && defined(readq)
+static inline u64 __read_64(u64 *addr, enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_LITTLE_ENDIAN:
+   return in_le64(addr);
+   case REGMAP_BIG_ENDIAN:
+   return in_be64(addr);
+   case REGMAP_NATIVE_ENDIAN:
+   return readq(addr);
+   }
+
+   return readq(addr);
+}
+#endif
+
 int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
  void *valp, size_t val_len)
 {
@@ -210,17 +268,17 @@ int regmap_raw_read_range(struct regmap *map, uint 
range_num, uint offset,

switch (val_len) {
case REGMAP_SIZE_8:
-   *((u8 *)valp) = in_8((u8 *)ptr);
+   *((u8 *)valp) = __read_8(ptr, map->endianness);
break;
case REGMAP_SIZE_16:
-   *((u16 *)valp) = in_le16((u16 *)ptr);
+   *((u16 *)valp) = __read_16(ptr, map->endianness);
break;
case REGMAP_SIZE_32:
-   *((u32 *)valp) = in_le32((u32 *)ptr);
+   *((u32 *)valp) = __read_32(ptr, map->endianness);
break;
 #if defined(in_le64) && defined(readq)
case REGMAP_SIZE_64:
-   *((u64 *)valp) = in_le64((u64 *)ptr);
+   *((u64 *)valp) = __read_64(ptr, map->endianness);
break;
 #endif
default:
@@ -241,6 +299,62 @@ int regmap_read(struct regmap *map, uint offset, uint 
*valp)
return regmap_raw_read(map, offset, valp, REGMAP_SIZE_32);
 }

+static inline void __write_8(u8 *addr, const u8 *val,
+enum regmap_endianness_t endianness)
+{
+   out_8(addr, *val);
+}
+
+static inline void __write_16(u16 *addr, const u16 *val,
+ enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_NATIVE_ENDIAN:
+   writew(*val, addr);
+   break;
+   case REGMAP_LITTLE_ENDIAN:
+   out_le16(addr, *val);
+   break;
+   case REGMAP_BIG_ENDIAN:
+   out_be16(addr, *val);
+   break;
+   }
+}
+
+static inline void __write_32(u32 *addr, const u32 *val,
+ enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_NATIVE_ENDIAN:
+   writel(*val, addr);
+   break;
+   case REGMAP_LITTLE_ENDIAN:
+   out_le32(addr, *val);
+   break;
+   case REGMAP_BIG_ENDIAN:
+   out_be32(addr, *val);
+   break;
+   }
+}
+
+#if defined(out_le64) && defined(writeq)
+static inline void __write_64(u64 *addr, const u64 *val,
+ enum regmap_endianness_t endianness)
+{
+   switch (endianness) {
+   case REGMAP_NATIVE_ENDIAN:
+  

[U-Boot] [PATCH v9 13/16] regmap: Add overview documentation

2018-09-28 Thread Mario Six
Add some overview documentation that explains the purpose and some of
the features and limitations of the regmap interface.

Reviewed-by: Bin Meng 
Signed-off-by: Mario Six 

---

v8 -> v9:
* Amended for inclusion of endianness setting via DT

v7 -> v8:
New in v8

---
 include/regmap.h | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/include/regmap.h b/include/regmap.h
index 98860c27326..b2b733fda68 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -8,6 +8,33 @@
 #define __REGMAP_H

 /**
+ * DOC: Overview
+ *
+ * Regmaps are an abstraction mechanism that allows device drivers to access
+ * register maps irrespective of the underlying bus architecture. This entails
+ * that for devices that support multiple busses (e.g. I2C and SPI for a GPIO
+ * expander chip) only one driver has to be written. This driver will
+ * instantiate a regmap with a backend depending on the bus the device is
+ * attached to, and use the regmap API to access the register map through that
+ * bus transparently.
+ *
+ * Read and write functions are supplied, which can read/write data of
+ * arbitrary length from/to the regmap.
+ *
+ * The endianness of regmap accesses is selectable for each map through device
+ * tree settings via the boolean "little-endian", "big-endian", and
+ * "native-endian" properties.
+ *
+ * Furthermore, the register map described by a regmap can be split into
+ * multiple disjoint areas called ranges. In this way, register maps with
+ * "holes", i.e. areas of addressable memory that are not part of the register
+ * map, can be accessed in a concise manner.
+ *
+ * Currently, only a bare "mem" backend for regmaps is supported, which
+ * accesses the register map as regular IO-mapped memory.
+ */
+
+/**
  * enum regmap_size_t - Access sizes for regmap reads and writes
  *
  * @REGMAP_SIZE_8: 8-bit read/write access size
--
2.11.0

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


[U-Boot] [PATCH v9 01/16] test: regmap: Increase size of syscon0 memory

2018-09-28 Thread Mario Six
The upcoming changes to the regmap interface will contain a proper check
for plausibility when reading/writing from/to a register map. To still
have the current tests pass, increase the size of the memory region for
the syscon0 device, since one of the tests reads and writes beyond this
range.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
* Fix the test that checks the changed size

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
New in v3

---
 arch/sandbox/dts/test.dts | 2 +-
 test/dm/regmap.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 751c13b51da..93808309fdd 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -467,7 +467,7 @@

syscon@0 {
compatible = "sandbox,syscon0";
-   reg = <0x10 4>;
+   reg = <0x10 16>;
};

syscon@1 {
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index d4b86b3b03c..b28d6a6cd11 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -25,7 +25,7 @@ static int dm_test_regmap_base(struct unit_test_state *uts)
ut_assertok_ptr(map);
ut_asserteq(1, map->range_count);
ut_asserteq(0x10, map->ranges[0].start);
-   ut_asserteq(4, map->ranges[0].size);
+   ut_asserteq(16, map->ranges[0].size);
ut_asserteq(0x10, map_to_sysmem(regmap_get_range(map, 0)));

ut_assertok(uclass_get_device(UCLASS_SYSCON, 1, &dev));
--
2.11.0

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


[U-Boot] [PATCH v9 09/16] regmap: Support reading from specific range

2018-09-28 Thread Mario Six
It is useful to be able to treat the different ranges of a regmap
separately to be able to use distinct offset for them, but this is
currently not implemented in the regmap API.

To preserve backwards compatibility, add regmap_read_range and
regmap_write_range functions that take an additional parameter
'range_num' that identifies the range to operate on.

Reviewed-by: Anatolij Gustschin 
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
* Renamed the functions to regmap_{write,read}_range
* Added function comments
* Fixed style violations
* Improved error handling

v1 -> v2:
New in v2

---
 drivers/core/regmap.c | 49 -
 include/regmap.h  | 31 +++
 2 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 1025099797f..761dc535ed8 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -188,11 +188,25 @@ int regmap_uninit(struct regmap *map)
return 0;
 }

-int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t 
val_len)
+int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
+ void *valp, size_t val_len)
 {
+   struct regmap_range *range;
void *ptr;

-   ptr = map_physmem(map->ranges[0].start + offset, val_len, MAP_NOCACHE);
+   if (range_num >= map->range_count) {
+   debug("%s: range index %d larger than range count\n",
+ __func__, range_num);
+   return -ERANGE;
+   }
+   range = &map->ranges[range_num];
+
+   ptr = map_physmem(range->start + offset, val_len, MAP_NOCACHE);
+
+   if (offset + val_len > range->size) {
+   debug("%s: offset/size combination invalid\n", __func__);
+   return -ERANGE;
+   }

switch (val_len) {
case REGMAP_SIZE_8:
@@ -213,20 +227,39 @@ int regmap_raw_read(struct regmap *map, uint offset, void 
*valp, size_t val_len)
debug("%s: regmap size %zu unknown\n", __func__, val_len);
return -EINVAL;
}
+
return 0;
 }

+int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t 
val_len)
+{
+   return regmap_raw_read_range(map, 0, offset, valp, val_len);
+}
+
 int regmap_read(struct regmap *map, uint offset, uint *valp)
 {
return regmap_raw_read(map, offset, valp, REGMAP_SIZE_32);
 }

-int regmap_raw_write(struct regmap *map, uint offset, const void *val,
-size_t val_len)
+int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset,
+  const void *val, size_t val_len)
 {
+   struct regmap_range *range;
void *ptr;

-   ptr = map_physmem(map->ranges[0].start + offset, val_len, MAP_NOCACHE);
+   if (range_num >= map->range_count) {
+   debug("%s: range index %d larger than range count\n",
+ __func__, range_num);
+   return -ERANGE;
+   }
+   range = &map->ranges[range_num];
+
+   ptr = map_physmem(range->start + offset, val_len, MAP_NOCACHE);
+
+   if (offset + val_len > range->size) {
+   debug("%s: offset/size combination invalid\n", __func__);
+   return -ERANGE;
+   }

switch (val_len) {
case REGMAP_SIZE_8:
@@ -251,6 +284,12 @@ int regmap_raw_write(struct regmap *map, uint offset, 
const void *val,
return 0;
 }

+int regmap_raw_write(struct regmap *map, uint offset, const void *val,
+size_t val_len)
+{
+   return regmap_raw_write_range(map, 0, offset, val, val_len);
+}
+
 int regmap_write(struct regmap *map, uint offset, uint val)
 {
return regmap_raw_write(map, offset, &val, REGMAP_SIZE_32);
diff --git a/include/regmap.h b/include/regmap.h
index f23664e8ba1..eba300da29b 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -115,6 +115,37 @@ int regmap_raw_write(struct regmap *map, uint offset, 
const void *val,
 int regmap_raw_read(struct regmap *map, uint offset, void *valp,
size_t val_len);

+/**
+ * regmap_raw_write_range() - Write a value of specified length to a range of a
+ *   regmap
+ *
+ * @map:   Regmap to write to
+ * @range_num: Number of the range in the regmap to write to
+ * @offset:Offset in the regmap to write to
+ * @val:   Value to write to the regmap at the specified offset
+ * @val_len:   Length of the data to be written to the regmap
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset,
+  const void *val, size_t val_len);
+
+/**
+ * regmap_raw_read_range() - Read a value of specified length from a range of a
+ *  regmap
+ *

[U-Boot] [PATCH v9 16/16] misc: Add IHS FPGA driver

2018-09-28 Thread Mario Six
Add a driver for gdsys IHS (Integrated Hardware Systems) FPGAs, which
supports initialization of the FPGA, as well as information gathering.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
* Switched from 'res' as the name for return variables to 'ret'

v2 -> v3:
* Fixed style violations
* Added full documentation
* Extracted some magic numbers to constants
* Removed unnecessary includes
* Extracted wait_for_fpga_done
* Improved error handling and reporting
* Added device-tree-binding files
* Improved Kconfig entry

v1 -> v2:
New in v2

---
 .../devicetree/bindings/misc/gdsys,iocon_fpga.txt  |  19 +
 .../devicetree/bindings/misc/gdsys,iocpu_fpga.txt  |  19 +
 drivers/misc/Kconfig   |   9 +
 drivers/misc/Makefile  |   1 +
 drivers/misc/ihs_fpga.c| 867 +
 drivers/misc/ihs_fpga.h|  49 ++
 6 files changed, 964 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/gdsys,iocon_fpga.txt
 create mode 100644 Documentation/devicetree/bindings/misc/gdsys,iocpu_fpga.txt
 create mode 100644 drivers/misc/ihs_fpga.c
 create mode 100644 drivers/misc/ihs_fpga.h

diff --git a/Documentation/devicetree/bindings/misc/gdsys,iocon_fpga.txt 
b/Documentation/devicetree/bindings/misc/gdsys,iocon_fpga.txt
new file mode 100644
index 000..acd466fdc6d
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/gdsys,iocon_fpga.txt
@@ -0,0 +1,19 @@
+gdsys IHS FPGA for CON devices
+
+The gdsys IHS FPGA is the main FPGA on gdsys CON devices. This driver provides
+support for enabling and starting the FPGA, as well as verifying working bus
+communication.
+
+Required properties:
+- compatible: must be "gdsys,iocon_fpga"
+- reset-gpios: List of GPIOs controlling the FPGA's reset
+- done-gpios: List of GPIOs notifying whether the FPGA's reconfiguration is
+  done
+
+Example:
+
+FPGA0 {
+   compatible = "gdsys,iocon_fpga";
+   reset-gpios = <&PPCPCA 26 0>;
+   done-gpios = <&GPIO_VB0 19 0>;
+};
diff --git a/Documentation/devicetree/bindings/misc/gdsys,iocpu_fpga.txt 
b/Documentation/devicetree/bindings/misc/gdsys,iocpu_fpga.txt
new file mode 100644
index 000..819db22bf7d
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/gdsys,iocpu_fpga.txt
@@ -0,0 +1,19 @@
+gdsys IHS FPGA for CPU devices
+
+The gdsys IHS FPGA is the main FPGA on gdsys CPU devices. This driver provides
+support for enabling and starting the FPGA, as well as verifying working bus
+communication.
+
+Required properties:
+- compatible: must be "gdsys,iocpu_fpga"
+- reset-gpios: List of GPIOs controlling the FPGA's reset
+- done-gpios: List of GPIOs notifying whether the FPGA's reconfiguration is
+  done
+
+Example:
+
+FPGA0 {
+   compatible = "gdsys,iocpu_fpga";
+   reset-gpios = <&PPCPCA 26 0>;
+   done-gpios = <&GPIO_VB0 19 0>;
+};
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 4ae4e457c65..8530849df82 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -303,4 +303,13 @@ config GDSYS_SOC
  IHS (Integrated Hardware Systems) FPGA, which holds all devices whose
  register maps are contained within the FPGA's register map.

+config IHS_FPGA
+   bool "Enable IHS FPGA driver"
+   depends on MISC
+   help
+ Support IHS (Integrated Hardware Systems) FPGA, the main FPGAs on
+ gdsys devices, which supply the majority of the functionality offered
+ by the devices. This driver supports both CON and CPU variants of the
+ devices, depending on the device tree entry.
+
 endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 13ec6a4d661..a4b6587a7c6 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
 obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
 obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
 obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
+obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o
 obj-$(CONFIG_LED_STATUS) += status_led.o
 obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o
 obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
diff --git a/drivers/misc/ihs_fpga.c b/drivers/misc/ihs_fpga.c
new file mode 100644
index 000..f9e4b27a270
--- /dev/null
+++ b/drivers/misc/ihs_fpga.c
@@ -0,0 +1,867 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2017
+ * Mario Six,  Guntermann & Drunck GmbH, mario@gdsys.cc
+ *
+ * based on the ioep-fpga driver, which is
+ *
+ * (C) Copyright 2014
+ * Dirk Eibach,  Guntermann & Drunck GmbH, eib...@gdsys.de
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "ihs_fpga.h"
+
+/**
+ * struct ihs_fpga_priv - Private data structure for IHS FPGA driver
+ * @map:Register map for the FPGA's own register space
+ * @reset_gpio: G

[U-Boot] [PATCH v9 15/16] misc: Add gdsys_soc driver

2018-09-28 Thread Mario Six
This patch adds a driver for the bus associated with a IHS FPGA.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v8 -> v9:
No changes

v7 -> v8:
No changes

v6 -> v7:
No changes

v5 -> v6:
No changes

v4 -> v5:
No changes

v3 -> v4:
No changes

v2 -> v3:
* Fixed style violations
* Added bindings file
* Added more debug output in case of errors
* Switched all printfs to debug
* Documented the private data structure
* Formatted documentation as proper kernel-doc
* Expanded Kconfig description

v1 -> v2:
* Switched to correct uclass for IHS FPGA driver (now in MISC uclass)

---
 .../devicetree/bindings/misc/gdsys,soc.txt | 16 +
 drivers/misc/Kconfig   |  8 +++
 drivers/misc/Makefile  |  1 +
 drivers/misc/gdsys_soc.c   | 74 ++
 drivers/misc/gdsys_soc.h   | 23 +++
 5 files changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/gdsys,soc.txt
 create mode 100644 drivers/misc/gdsys_soc.c
 create mode 100644 drivers/misc/gdsys_soc.h

diff --git a/Documentation/devicetree/bindings/misc/gdsys,soc.txt 
b/Documentation/devicetree/bindings/misc/gdsys,soc.txt
new file mode 100644
index 000..278e935b166
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/gdsys,soc.txt
@@ -0,0 +1,16 @@
+gdsys soc bus driver
+
+This driver provides a simple interface for the busses associated with gdsys
+IHS FPGAs. The bus itself contains devices whose register maps are contained
+within the FPGA's register space.
+
+Required properties:
+- fpga: A phandle to the controlling IHS FPGA
+
+Example:
+
+FPGA0BUS: fpga0bus {
+   compatible = "gdsys,soc";
+   ranges = <0x0 0xe060 0x4000>;
+   fpga = <&FPGA0>;
+};
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index bfa5c916874..4ae4e457c65 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -295,4 +295,12 @@ config MPC83XX_SERDES
help
  Support for serdes found on MPC83xx SoCs.

+config GDSYS_SOC
+   bool "Enable gdsys SOC driver"
+   depends on MISC
+   help
+ Support for gdsys IHS SOC, a simple bus associated with each gdsys
+ IHS (Integrated Hardware Systems) FPGA, which holds all devices whose
+ register maps are contained within the FPGA's register map.
+
 endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c4fff92f54e..13ec6a4d661 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o
 obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
 obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
+obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
 obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
 obj-$(CONFIG_LED_STATUS) += status_led.o
 obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o
diff --git a/drivers/misc/gdsys_soc.c b/drivers/misc/gdsys_soc.c
new file mode 100644
index 000..94a21e08af7
--- /dev/null
+++ b/drivers/misc/gdsys_soc.c
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2017
+ * Mario Six,  Guntermann & Drunck GmbH, mario@gdsys.cc
+ */
+
+#include 
+#include 
+#include 
+
+#include "gdsys_soc.h"
+
+/**
+ * struct gdsys_soc_priv - Private data for gdsys soc bus
+ * @fpga: The gdsys IHS FPGA this bus is associated with
+ */
+struct gdsys_soc_priv {
+   struct udevice *fpga;
+};
+
+static const struct udevice_id gdsys_soc_ids[] = {
+   { .compatible = "gdsys,soc" },
+   { /* sentinel */ }
+};
+
+int gdsys_soc_get_fpga(struct udevice *child, struct udevice **fpga)
+{
+   struct gdsys_soc_priv *bus_priv;
+
+   if (!child->parent) {
+   debug("%s: Invalid parent\n", child->name);
+   return -EINVAL;
+   }
+
+   if (!device_is_compatible(child->parent, "gdsys,soc")) {
+   debug("%s: Not child of a gdsys soc\n", child->name);
+   return -EINVAL;
+   }
+
+   bus_priv = dev_get_priv(child->parent);
+
+   *fpga = bus_priv->fpga;
+
+   return 0;
+}
+
+static int gdsys_soc_probe(struct udevice *dev)
+{
+   struct gdsys_soc_priv *priv = dev_get_priv(dev);
+   struct udevice *fpga;
+   int res = uclass_get_device_by_phandle(UCLASS_MISC, dev, "fpga",
+  &fpga);
+   if (res == -ENOENT) {
+   debug("%s: Could not find 'fpga' phandle\n", dev->name);
+   return -EINVAL;
+   }
+
+   if (res == -ENODEV) {
+   debug("%s: Could not get FPGA device\n", dev->name);
+   return -EINVAL;
+   }
+
+   priv->fpga = fpga;
+
+   return 0;
+}
+
+U_BOOT_DRIVER(gdsys_soc_bus) = {
+   .name   = "gdsys_soc_bus",
+   .id = UCLASS_SIMPLE_BUS,
+   .of_match   = gdsys_soc_ids,
+   .probe  = gdsys_soc_probe,
+   .priv_auto_alloc_size

Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Miquel Raynal
Hi Jagan,

Jagan Teki  wrote on Fri, 28 Sep 2018
12:56:43 +0530:

> On Fri, Sep 28, 2018 at 12:38 PM Miquel Raynal
>  wrote:
> >
> > Hi Jagan,
> >
> > Jagan Teki  wrote on Fri, 28 Sep 2018
> > 12:18:49 +0530:
> >  
> > > On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal  
> > > wrote:  
> > > >
> > > > During the last months, Boris Brezillon shared his work to support
> > > > serial flashes within Linux. First, he delivered (and merged) a new
> > > > layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > > > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > > > same time a NAND core that would be shared with all NAND devices. Then,
> > > > he contributed a generic SPI-NAND driver, making use of this NAND core,
> > > > as well as some vendor code to drive a few chips.
> > > >
> > > > On top of this work, I made some cleanups in the MTD layer and added an
> > > > 'mtd' U-Boot command to handle all sort of MTD devices. This should
> > > > become the default command instead of having one per flash flavor
> > > > ('sf', 'nand', 'spi-nand' ?).
> > > >
> > > > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > > featuring a Macronix SPI NAND chip.
> > > >
> > > > TL;DR: the series contains (stripped version since ~30 patches have
> > > > already been taken):
> > > > - Support for spi-nand devices in mtdparts.
> > > > - Generics mtdparts/mtdids parsers.
> > > > - A new 'mtd' command.
> > > > - A note to set mtdparts command legacy.
> > > >
> > > > To test your SPI-NAND device with U-Boot, you can test someting like:
> > > >  
> > > > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for this 
> > > > > device
> > > > > ubi part bar # create a static UBI volume in the bar partition
> > > > > mtd list # show the current MTD devices/partitions  
> > > >
> > > > Thanks,
> > > > Miquèl
> > > >
> > > >
> > > > NB1: If UBI refuses to attach, verify the partition is epty with
> > > >  # mtd erase bar
> > > >
> > > > NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
> > > >  don't forget to probe your device *first* (sf probe, ...).
> > > >
> > > >
> > > > Changes since v9:
> > > > -
> > > > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
> > > >   everybody wants to use mtdids).
> > > > * mtd_parse_partitions() is still in mtdparts.c because it depends on
> > > >   partitions support, but the header file declaring it
> > > >   (include/linux/mtd/partitions.h) also has a dummy function if
> > > >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > > > * Typo corrected in mtd_parse_partitions prototype
> > > >   (s/_nb_parts/_nparts/).
> > > > * Added Boris' R-b tags.
> > > >
> > > > Changes since v8 (called v7 by mistake):
> > > > 
> > > > * Moved most of the generic logic to the core (mtd_uboot.c) so that it
> > > >   can be reused by other parts of U-Boot without depending on anything
> > > >   else than the MTD core itself.
> > > > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls now
> > > >   that the code is in the core.
> > > > * Created an helper for partitions deletion (as there is one to
> > > >   parse/create partition objects).
> > > > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > > > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > > > * Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" to
> > > >   actually deprecate the command.  
> >
> > [...]
> >  
> > > > Miquel Raynal (7):
> > > >   mtd: uclass: add probe function
> > > >   mtd: mtdpart: add a generic mtdparts-like parser
> > > >   mtd: uboot: search for an equivalent MTD name with the mtdids
> > > >   mtd: mtdpart: implement proper partition handling
> > > >   cmd: mtd: add 'mtd' command
> > > >   cmd: ubi: clean the partition handling
> > > >   cmd: mtdparts: describe as legacy  
> > >
> > > I didn't find this mtdparts fallback change[1] in v10? does this
> > > fallback issue fixed differently.
> > >
> > > [1] 
> > > https://github.com/openedev/u-boot-amarula/commit/9edbc2be512c9bd572884c53b5f54b583e897e9b
> > >   
> >
> > Indeed, I dropped this patch on Boris advice: if we want to deprecate
> > this command, we should not add new features to it (see the above
> > changelog).  
> 
> OK.
> 
> Here are all spi-nand changes[2], I still find the build issues[3],
> any dependencies other than these changes?
> 
> [2] https://github.com/openedev/u-boot-amarula/commits/wip-spi-nand

Seems good to me!

> [3] https://travis-ci.org/openedev/u-boot-amarula/builds/434479310

Indeed, builds are failing because of SZ_4K is not defined (mostly arm
boards). For an unknown reason it does not break with my setup (I'm on
mips right now).

Let me fix this, I'll keep you udpated.

Thanks,
Miquèl
___
U-Boot mailing list
U-

Re: [U-Boot] [PATCH v2] cmd: usb_mass_storage: add protection for block_dev

2018-09-28 Thread Patrick DELAUNAY
Hi,

> From: Marek Vasut 
> 
> On 09/26/2018 01:04 PM, Patrick Delaunay wrote:
> > solve data abort for the command "ums 0 ubi 0"
> > because result of case blk_get_device_part_str() result is OK but with
> > block_dev = 0 when CONFIG_CMD_UBIFS is activate and ubi volume is
> > mounted
> 
> I don't quite understand the commit message, can you reword it?

Ok, I prepare a V3 
 
> Also, when is this ever called with block_dev == NULL ? What's the condition 
> to
> trigger this and why ?

To reproduce the issue you need to have a ubifs  already mounted,
for example with the command:
ubi part UBI
ubifsmount ubi0:boot

I investigate the point, the call stack before the crash is  caused by the ubi 
support in 
./disk/part.c:425 =  blk_get_device_part_str()

Some part of code here are under CONFIG_CMD_UBIFS with the comment :
"ubi goes through a mtd, rathen then through a regular block device"

So the the function return a pointer to disk_partition_t :
info->type = BOOT_PART_TYPE
info->name =  "UBI"
 but without block device information !
*dev_desc = NULL

So the issue occurs because, when the ubifs volume is mounted,
The code in  cmd/usb_mass_storage.c

static int ums_init(const char *devtype, const char *devnums_part_str)
{
...
for (;;) {
...
partnum = blk_get_device_part_str(devtype, devnum_part_str,
&block_dev, &info, 1);

// With devnum_part_str  = "ubi 0"
// This function don't return a error and return a  valid partnum
// So the function continue until block_dev = NULL is used
.
if (partnum < 0)
goto cleanup;

/* Check if the argument is in legacy format. If yes,
 * expose all partitions by setting the partnum = 0
 * e.g. ums 0 mmc 0
 */
if (!strchr(devnum_part_str, ':'))
partnum = 0;

/* f_mass_storage.c assumes SECTOR_SIZE sectors */
if (block_dev->blksz != SECTOR_SIZE)
goto cleanup;

=> crash occur here (on my board) because block_dev = NULL

> > Signed-off-by: Patrick Delaunay 
> > ---
> > I check and the issue is still present on U-Boot v2018.09, on my board
> > stm32mp1 (with NAND device and UBI volume):
> >
> > STM32MP> ubi part UBI
> > STM32MP> ubifsmount ubi0:boot
> > STM32MP> ums 0 ubi 0
> > data abort
> > pc : []  lr : []
> > reloc pc : []lr : []
> > sp : fdc3e460  ip : fdc3e518 fp : fdcf06a8
> > r10: fdcf06b8  r9 : fdc4eed8 r8 : 
> > r7 : ffce3d84  r6 : fdcf0740 r5 : fdcf0740  r4 : ffce3d88
> > r3 :   r2 :  r1 : 003a  r0 : 
> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > Code: f04f4628 9b06fd2a bf082800 0800f04f (f5b3695b) Resetting CPU ...
> >
> > Even If the command is invalid (ums not allowed on ubi device), the
> > data abort can be avoid by this patch.
> >
> >
> > Changes in v2:
> > - Rebase on master branch
> >
> >  cmd/usb_mass_storage.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index
> > 26b41b4c4..a3a338c 100644
> > --- a/cmd/usb_mass_storage.c
> > +++ b/cmd/usb_mass_storage.c
> > @@ -85,7 +85,7 @@ static int ums_init(const char *devtype, const char
> *devnums_part_str)
> > partnum = 0;
> >
> > /* f_mass_storage.c assumes SECTOR_SIZE sectors */
> > -   if (block_dev->blksz != SECTOR_SIZE)
> > +   if (!block_dev || block_dev->blksz != SECTOR_SIZE)
> > goto cleanup;
> >
> > ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums));
> >
> 
> 
> --
> Best regards,
> Marek Vasut

Regards
Patrick
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Miquel Raynal
Hi Miquel,

Miquel Raynal  wrote on Fri, 28 Sep 2018
09:35:02 +0200:

> Hi Jagan,
> 
> Jagan Teki  wrote on Fri, 28 Sep 2018
> 12:56:43 +0530:
> 
> > On Fri, Sep 28, 2018 at 12:38 PM Miquel Raynal
> >  wrote:  
> > >
> > > Hi Jagan,
> > >
> > > Jagan Teki  wrote on Fri, 28 Sep 2018
> > > 12:18:49 +0530:
> > >
> > > > On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal 
> > > >  wrote:
> > > > >
> > > > > During the last months, Boris Brezillon shared his work to support
> > > > > serial flashes within Linux. First, he delivered (and merged) a new
> > > > > layer called spi-mem. He also initiated in Linux MTD subsystem the 
> > > > > move
> > > > > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > > > > same time a NAND core that would be shared with all NAND devices. 
> > > > > Then,
> > > > > he contributed a generic SPI-NAND driver, making use of this NAND 
> > > > > core,
> > > > > as well as some vendor code to drive a few chips.
> > > > >
> > > > > On top of this work, I made some cleanups in the MTD layer and added 
> > > > > an
> > > > > 'mtd' U-Boot command to handle all sort of MTD devices. This should
> > > > > become the default command instead of having one per flash flavor
> > > > > ('sf', 'nand', 'spi-nand' ?).
> > > > >
> > > > > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > > > featuring a Macronix SPI NAND chip.
> > > > >
> > > > > TL;DR: the series contains (stripped version since ~30 patches have
> > > > > already been taken):
> > > > > - Support for spi-nand devices in mtdparts.
> > > > > - Generics mtdparts/mtdids parsers.
> > > > > - A new 'mtd' command.
> > > > > - A note to set mtdparts command legacy.
> > > > >
> > > > > To test your SPI-NAND device with U-Boot, you can test someting like:
> > > > >
> > > > > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > > > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for 
> > > > > > this device
> > > > > > ubi part bar # create a static UBI volume in the bar 
> > > > > > partition
> > > > > > mtd list # show the current MTD devices/partitions
> > > > >
> > > > > Thanks,
> > > > > Miquèl
> > > > >
> > > > >
> > > > > NB1: If UBI refuses to attach, verify the partition is epty with
> > > > >  # mtd erase bar
> > > > >
> > > > > NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
> > > > >  don't forget to probe your device *first* (sf probe, ...).
> > > > >
> > > > >
> > > > > Changes since v9:
> > > > > -
> > > > > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
> > > > >   everybody wants to use mtdids).
> > > > > * mtd_parse_partitions() is still in mtdparts.c because it depends on
> > > > >   partitions support, but the header file declaring it
> > > > >   (include/linux/mtd/partitions.h) also has a dummy function if
> > > > >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > > > > * Typo corrected in mtd_parse_partitions prototype
> > > > >   (s/_nb_parts/_nparts/).
> > > > > * Added Boris' R-b tags.
> > > > >
> > > > > Changes since v8 (called v7 by mistake):
> > > > > 
> > > > > * Moved most of the generic logic to the core (mtd_uboot.c) so that it
> > > > >   can be reused by other parts of U-Boot without depending on anything
> > > > >   else than the MTD core itself.
> > > > > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls now
> > > > >   that the code is in the core.
> > > > > * Created an helper for partitions deletion (as there is one to
> > > > >   parse/create partition objects).
> > > > > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > > > > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > > > > * Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" to
> > > > >   actually deprecate the command.
> > >
> > > [...]
> > >
> > > > > Miquel Raynal (7):
> > > > >   mtd: uclass: add probe function
> > > > >   mtd: mtdpart: add a generic mtdparts-like parser
> > > > >   mtd: uboot: search for an equivalent MTD name with the mtdids
> > > > >   mtd: mtdpart: implement proper partition handling
> > > > >   cmd: mtd: add 'mtd' command
> > > > >   cmd: ubi: clean the partition handling
> > > > >   cmd: mtdparts: describe as legacy
> > > >
> > > > I didn't find this mtdparts fallback change[1] in v10? does this
> > > > fallback issue fixed differently.
> > > >
> > > > [1] 
> > > > https://github.com/openedev/u-boot-amarula/commit/9edbc2be512c9bd572884c53b5f54b583e897e9b
> > > > 
> > >
> > > Indeed, I dropped this patch on Boris advice: if we want to deprecate
> > > this command, we should not add new features to it (see the above
> > > changelog).
> > 
> > OK.
> > 
> > Here are all spi-nand changes[2], I still find the build issues[3],
> > any dependencies other than these changes?
> > 
> > [2] https://github.com/openedev/u-boot-amarula/commits/wip-spi-nand  
> 

[U-Boot] [PATCH v11] mtd: mtdpart: add a generic mtdparts-like parser

2018-09-28 Thread Miquel Raynal
The current parser is very specific to U-Boot mtdparts implementation.
It does not use MTD structures like mtd_info and mtd_partition. Copy
and adapt the current parser in drivers/mtd/mtd-uclass.c (to not break
the current use of mtdparts.c itself) and write some kind of a wrapper
around the current implementation to allow other commands to benefit
from this parsing in a user-friendly way.

This new function will allocate an mtd_partition array for each
successful call. This array must be freed after use by the caller.
The given 'mtdparts' buffer pointer will be moved forward to the next
MTD device (if any, it will point towards a '\0' character otherwise).

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---

Change since v10: When adding the parser, I checked a value agains
SZ_4K which is defined in . In my case (on a MIPS
platform), the main platform configuration header already included
this file, explaining why the error happened on a lot of ARM platforms
instead. Fix the build issue by including sizes.h in
drivers/mtd/mtdpart.c.

 drivers/mtd/mtdpart.c  | 210 +
 include/linux/mtd/partitions.h |  21 
 2 files changed, 231 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 9ccb1b3361..49353b038a 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "mtdcore.h"
 
@@ -76,6 +77,215 @@ char *kstrdup(const char *s, gfp_t gfp)
 }
 #endif
 
+#define MTD_SIZE_REMAINING (~0LLU)
+#define MTD_OFFSET_NOT_SPECIFIED   (~0LLU)
+
+/**
+ * mtd_parse_partition - Parse @mtdparts partition definition, fill @partition
+ *   with it and update the @mtdparts string pointer.
+ *
+ * The partition name is allocated and must be freed by the caller.
+ *
+ * This function is widely inspired from part_parse (mtdparts.c).
+ *
+ * @mtdparts: String describing the partition with mtdparts command syntax
+ * @partition: MTD partition structure to fill
+ *
+ * @return 0 on success, an error otherwise.
+ */
+static int mtd_parse_partition(const char **_mtdparts,
+  struct mtd_partition *partition)
+{
+   const char *mtdparts = *_mtdparts;
+   const char *name = NULL;
+   int name_len;
+   char *buf;
+
+   /* Ensure the partition structure is empty */
+   memset(partition, 0, sizeof(struct mtd_partition));
+
+   /* Fetch the partition size */
+   if (*mtdparts == '-') {
+   /* Assign all remaining space to this partition */
+   partition->size = MTD_SIZE_REMAINING;
+   mtdparts++;
+   } else {
+   partition->size = ustrtoull(mtdparts, (char **)&mtdparts, 0);
+   if (partition->size < SZ_4K) {
+   printf("Minimum partition size 4kiB, %lldB requested\n",
+  partition->size);
+   return -EINVAL;
+   }
+   }
+
+   /* Check for the offset */
+   partition->offset = MTD_OFFSET_NOT_SPECIFIED;
+   if (*mtdparts == '@') {
+   mtdparts++;
+   partition->offset = ustrtoull(mtdparts, (char **)&mtdparts, 0);
+   }
+
+   /* Now look for the name */
+   if (*mtdparts == '(') {
+   name = ++mtdparts;
+   mtdparts = strchr(name, ')');
+   if (!mtdparts) {
+   printf("No closing ')' found in partition name\n");
+   return -EINVAL;
+   }
+   name_len = mtdparts - name + 1;
+   if ((name_len - 1) == 0) {
+   printf("Empty partition name\n");
+   return -EINVAL;
+   }
+   mtdparts++;
+   } else {
+   /* Name will be of the form size@offset */
+   name_len = 22;
+   }
+
+   /* Check if the partition is read-only */
+   if (strncmp(mtdparts, "ro", 2) == 0) {
+   partition->mask_flags |= MTD_WRITEABLE;
+   mtdparts += 2;
+   }
+
+   /* Check for a potential next partition definition */
+   if (*mtdparts == ',') {
+   if (partition->size == MTD_SIZE_REMAINING) {
+   printf("No partitions allowed after a fill-up\n");
+   return -EINVAL;
+   }
+   ++mtdparts;
+   } else if ((*mtdparts == ';') || (*mtdparts == '\0')) {
+   /* NOP */
+   } else {
+   printf("Unexpected character '%c' in mtdparts\n", *mtdparts);
+   return -EINVAL;
+   }
+
+   /*
+* Allocate a buffer for the name and either copy the provided name or
+* auto-generate it with the form 'size@offset'.
+*/
+   buf = malloc(name_len);
+   if (!buf)
+   return -ENOMEM;
+
+   if (name)
+   

[U-Boot] [PATCH v11] cmd: mtd: add 'mtd' command

2018-09-28 Thread Miquel Raynal
There should not be a 'nand' command, a 'sf' command and certainly not
a new 'spi-nand' command. Write a 'mtd' command instead to manage all
MTD devices/partitions at once. This should be the preferred way to
access any MTD device.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---

Change since v10: cmd/mtd.c can be compiled without DM support. But it
wants to use mtd_probe()/mtd_probe_devices() functions that are
declared in include/mtd.h, so in this file, in order not to break the
build for platforms not selecting CONFIG_DM, we must include  so
that "struct uclass" and dev_get_uclass_priv() are defined.

 cmd/Kconfig |  10 +-
 cmd/Makefile|   1 +
 cmd/mtd.c   | 471 
 drivers/mtd/Makefile|   2 +-
 drivers/mtd/mtd_uboot.c | 153 -
 include/mtd.h   |   2 +
 6 files changed, 635 insertions(+), 4 deletions(-)
 create mode 100644 cmd/mtd.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index f97d3df328..b5bd978f6d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -854,6 +854,12 @@ config CMD_MMC_SWRITE
  Enable support for the "mmc swrite" command to write Android sparse
  images to eMMC.
 
+config CMD_MTD
+   bool "mtd"
+   select MTD_PARTITIONS
+   help
+ MTD commands support.
+
 config CMD_NAND
bool "nand"
default y if NAND_SUNXI
@@ -1678,14 +1684,14 @@ config CMD_MTDPARTS
 
 config MTDIDS_DEFAULT
string "Default MTD IDs"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD IDs list for use with MTD partitions in the
  Linux MTD command line partitions format.
 
 config MTDPARTS_DEFAULT
string "Default MTD partition scheme"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD partitioning scheme in the Linux MTD command
  line partitions format
diff --git a/cmd/Makefile b/cmd/Makefile
index 414187f073..8107cb0aa8 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -91,6 +91,7 @@ obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MMC) += mmc.o
 obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o
 obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_CMD_MTD) += mtd.o
 obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o
 obj-$(CONFIG_CMD_NAND) += nand.o
 obj-$(CONFIG_CMD_NET) += net.o
diff --git a/cmd/mtd.c b/cmd/mtd.c
new file mode 100644
index 00..559d6e6539
--- /dev/null
+++ b/cmd/mtd.c
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier:  GPL-2.0+
+/*
+ * mtd.c
+ *
+ * Generic command to handle basic operations on any memory device.
+ *
+ * Copyright: Bootlin, 2018
+ * Author: Miquèl Raynal 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static uint mtd_len_to_pages(struct mtd_info *mtd, u64 len)
+{
+   do_div(len, mtd->writesize);
+
+   return len;
+}
+
+static bool mtd_is_aligned_with_min_io_size(struct mtd_info *mtd, u64 size)
+{
+   return !do_div(size, mtd->writesize);
+}
+
+static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size)
+{
+   return !do_div(size, mtd->erasesize);
+}
+
+static void mtd_dump_buf(const u8 *buf, uint len, uint offset)
+{
+   int i, j;
+
+   for (i = 0; i < len; ) {
+   printf("0x%08x:\t", offset + i);
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf(" ");
+   i += 8;
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf("\n");
+   i += 8;
+   }
+}
+
+static void mtd_dump_device_buf(struct mtd_info *mtd, u64 start_off,
+   const u8 *buf, u64 len, bool woob)
+{
+   bool has_pages = mtd->type == MTD_NANDFLASH ||
+   mtd->type == MTD_MLCNANDFLASH;
+   int npages = mtd_len_to_pages(mtd, len);
+   uint page;
+
+   if (has_pages) {
+   for (page = 0; page < npages; page++) {
+   u64 data_off = page * mtd->writesize;
+
+   printf("\nDump %d data bytes from 0x%08llx:\n",
+  mtd->writesize, start_off + data_off);
+   mtd_dump_buf(&buf[data_off],
+mtd->writesize, start_off + data_off);
+
+   if (woob) {
+   u64 oob_off = page * mtd->oobsize;
+
+   printf("Dump %d OOB bytes from page at 
0x%08llx:\n",
+  mtd->oobsize, start_off + data_off);
+   mtd_dump_buf(&buf[len + oob_off],
+mtd->oobsize, 0);
+   }
+   }
+   } else {
+ 

[U-Boot] [PATCH 03/48] mpc83xx: Introduce ARCH_MPC832*

2018-09-28 Thread Mario Six
Replace CONFIG_MPC832* with proper CONFIG_ARCH_MPC832* Kconfig options.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig  |  7 +++
 arch/powerpc/cpu/mpc83xx/speed.c  | 10 +-
 arch/powerpc/include/asm/immap_83xx.h |  2 +-
 include/configs/MPC8323ERDB.h |  1 -
 include/configs/MPC832XEMDS.h |  1 -
 include/configs/km/km8321-common.h|  1 -
 include/linux/immap_qe.h  |  2 +-
 include/mpc83xx.h |  6 +++---
 8 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 20780ba68b..1b9402e024 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -40,9 +40,11 @@ config TARGET_MPC8315ERDB
 
 config TARGET_MPC8323ERDB
bool "Support MPC8323ERDB"
+   select ARCH_MPC832X
 
 config TARGET_MPC832XEMDS
bool "Support MPC832XEMDS"
+   select ARCH_MPC832X
select BOARD_EARLY_INIT_F
 
 config TARGET_MPC8349EMDS
@@ -82,11 +84,13 @@ config TARGET_SUVD3
bool "Support suvd3"
select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMTEGR1"
select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMVECT1"
+   select ARCH_MPC832X if SYS_EXTRA_OPTIONS="SUVD3"
imply CMD_CRAMFS
imply FS_CRAMFS
 
 config TARGET_TUXX1
bool "Support tuxx1"
+   select ARCH_MPC832X
imply CMD_CRAMFS
imply FS_CRAMFS
 
@@ -128,6 +132,9 @@ config ARCH_MPC8315
bool
select ARCH_MPC831X
 
+config ARCH_MPC832X
+   bool
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 9f09d2955f..ab025af70d 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -98,7 +98,7 @@ int get_clocks(void)
 #endif
u32 core_clk;
u32 i2c1_clk;
-#if !defined(CONFIG_MPC832x)
+#if !defined(CONFIG_ARCH_MPC832X)
u32 i2c2_clk;
 #endif
 #if defined(CONFIG_ARCH_MPC8315)
@@ -315,7 +315,7 @@ int get_clocks(void)
i2c1_clk = tsec2_clk;
 #elif defined(CONFIG_MPC8360)
i2c1_clk = csb_clk;
-#elif defined(CONFIG_MPC832x)
+#elif defined(CONFIG_ARCH_MPC832X)
i2c1_clk = enc_clk;
 #elif defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X)
i2c1_clk = enc_clk;
@@ -326,7 +326,7 @@ int get_clocks(void)
 #elif defined(CONFIG_ARCH_MPC8309)
i2c1_clk = csb_clk;
 #endif
-#if !defined(CONFIG_MPC832x)
+#if !defined(CONFIG_ARCH_MPC832X)
i2c2_clk = csb_clk; /* i2c-2 clk is equal to csb clk */
 #endif
 
@@ -467,7 +467,7 @@ int get_clocks(void)
 #endif
gd->arch.core_clk = core_clk;
gd->arch.i2c1_clk = i2c1_clk;
-#if !defined(CONFIG_MPC832x)
+#if !defined(CONFIG_ARCH_MPC832X)
gd->arch.i2c2_clk = i2c2_clk;
 #endif
 #if !defined(CONFIG_ARCH_MPC8309)
@@ -546,7 +546,7 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 #endif
printf("  I2C1:%-4s MHz\n",
   strmhz(buf, gd->arch.i2c1_clk));
-#if !defined(CONFIG_MPC832x)
+#if !defined(CONFIG_ARCH_MPC832X)
printf("  I2C2:%-4s MHz\n",
   strmhz(buf, gd->arch.i2c2_clk));
 #endif
diff --git a/arch/powerpc/include/asm/immap_83xx.h 
b/arch/powerpc/include/asm/immap_83xx.h
index d22d887bab..318b79d0b8 100644
--- a/arch/powerpc/include/asm/immap_83xx.h
+++ b/arch/powerpc/include/asm/immap_83xx.h
@@ -843,7 +843,7 @@ typedef struct immap {
u8  qe[0x10];   /* QE block */
 } immap_t;
 
-#elif defined(CONFIG_MPC832x)
+#elif defined(CONFIG_ARCH_MPC832X)
 typedef struct immap {
sysconf83xx_t   sysconf;/* System configuration */
wdt83xx_t   wdt;/* Watch Dog Timer (WDT) 
Registers */
diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h
index 85ea171175..0ef9dadd04 100644
--- a/include/configs/MPC8323ERDB.h
+++ b/include/configs/MPC8323ERDB.h
@@ -14,7 +14,6 @@
  */
 #define CONFIG_E3001   /* E300 family */
 #define CONFIG_QE  1   /* Has QE */
-#define CONFIG_MPC832x 1   /* MPC832x CPU specific */
 
 /*
  * System Clock Setup
diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h
index e92a8c0148..ff8692e9ca 100644
--- a/include/configs/MPC832XEMDS.h
+++ b/include/configs/MPC832XEMDS.h
@@ -11,7 +11,6 @@
  */
 #define CONFIG_E3001   /* E300 family */
 #define CONFIG_QE  1   /* Has QE */
-#define CONFIG_MPC832x 1   /* MPC832x CPU specific */
 #define CONFIG_MPC832XEMDS 1   /* MPC832XEMDS board specific */
 
 /*
diff --git a/include/configs/km/km8321-common.h 
b/include/configs/km/km8321-common.h
index 41b3ba2842..a121a445f7 100644
--- a/include/configs/km/km8321-common.h
+++ b/include/configs/km/km

[U-Boot] [PATCH 04/48] mpc83xx: Introduce ARCH_MPC834*

2018-09-28 Thread Mario Six
Replace CONFIG_MPC834* with proper CONFIG_ARCH_MPC834* Kconfig options.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig | 14 ++
 arch/powerpc/cpu/mpc83xx/cpu_init.c  |  2 +-
 arch/powerpc/cpu/mpc83xx/spd_sdram.c |  2 +-
 arch/powerpc/cpu/mpc83xx/speed.c | 22 +++---
 arch/powerpc/include/asm/arch-mpc83xx/gpio.h |  2 +-
 arch/powerpc/include/asm/fsl_lbc.h   |  8 
 arch/powerpc/include/asm/global_data.h   |  6 +++---
 arch/powerpc/include/asm/immap_83xx.h|  6 +++---
 arch/powerpc/include/asm/mpc8xxx_spi.h   |  2 +-
 drivers/pci/pci_auto.c   |  2 +-
 drivers/pci/pci_auto_old.c   |  2 +-
 include/configs/MPC8349EMDS.h|  2 --
 include/configs/MPC8349ITX.h |  3 ---
 include/configs/TQM834x.h|  2 --
 include/configs/sbc8349.h|  2 --
 include/configs/vme8349.h|  2 --
 include/mpc83xx.h| 18 +-
 include/usb/ehci-ci.h|  2 +-
 18 files changed, 51 insertions(+), 48 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 1b9402e024..2926472319 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -14,6 +14,7 @@ config TARGET_MPC8308_P1M
 
 config TARGET_SBC8349
bool "Support sbc8349"
+   select ARCH_MPC8349
 
 config TARGET_VE8313
bool "Support ve8313"
@@ -21,6 +22,7 @@ config TARGET_VE8313
 
 config TARGET_VME8349
bool "Support vme8349"
+   select ARCH_MPC8349
 
 config TARGET_MPC8308RDB
bool "Support MPC8308RDB"
@@ -49,6 +51,7 @@ config TARGET_MPC832XEMDS
 
 config TARGET_MPC8349EMDS
bool "Support MPC8349EMDS"
+   select ARCH_MPC8349
select BOARD_EARLY_INIT_F
select SYS_FSL_DDR
select SYS_FSL_DDR_BE
@@ -56,16 +59,19 @@ config TARGET_MPC8349EMDS
 
 config TARGET_MPC8349ITX
bool "Support MPC8349ITX"
+   select ARCH_MPC8349
imply CMD_IRQ
 
 config TARGET_MPC837XEMDS
bool "Support MPC837XEMDS"
+   select ARCH_MPC837X
select BOARD_EARLY_INIT_F
imply CMD_SATA
imply FSL_SATA
 
 config TARGET_MPC837XERDB
bool "Support MPC837XERDB"
+   select ARCH_MPC837X
select BOARD_EARLY_INIT_F
 
 config TARGET_IDS8313
@@ -96,6 +102,7 @@ config TARGET_TUXX1
 
 config TARGET_TQM834X
bool "Support TQM834x"
+   select ARCH_MPC8349
 
 config TARGET_HRCON
bool "Support hrcon"
@@ -135,6 +142,13 @@ config ARCH_MPC8315
 config ARCH_MPC832X
bool
 
+config ARCH_MPC834X
+   bool
+
+config ARCH_MPC8349
+   bool
+   select ARCH_MPC834X
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c 
b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index 7d8d5516b4..7c378671fe 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -240,7 +240,7 @@ void cpu_init_f (volatile immap_t * im)
 
/* System General Purpose Register */
 #ifdef CONFIG_SYS_SICRH
-#if defined(CONFIG_MPC834x) || defined(CONFIG_ARCH_MPC8313)
+#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC8313)
/* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
__raw_writel((im->sysconf.sicrh & 0x000C) | CONFIG_SYS_SICRH,
 &im->sysconf.sicrh);
diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c 
b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
index 3f18aadf19..b3cbf9f882 100644
--- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c
+++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
@@ -426,7 +426,7 @@ long int spd_sdram()
 
/*
 * Errata DDR6 work around: input enable 2 cycles earlier.
-* including MPC834x Rev1.0/1.1 and MPC8360 Rev1.1/1.2.
+* including MPC834X Rev1.0/1.1 and MPC8360 Rev1.1/1.2.
 */
if(PVR_MAJ(pvr) <= 1 && spd.mem_type == SPD_MEMTYPE_DDR){
if (caslat == 2)
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index ab025af70d..7cb6f3727d 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -86,14 +86,14 @@ int get_clocks(void)
 
u32 csb_clk;
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
u32 tsec1_clk;
u32 tsec2_clk;
u32 usbdr_clk;
 #elif defined(CONFIG_ARCH_MPC8309)
u32 usbdr_clk;
 #endif
-#ifdef CONFIG_MPC834x
+#ifdef CONFIG_ARCH_MPC834X
u32 usbmph_clk;
 #endif
u32 core_clk;
@@ -156,7 +156,7 @@ int get_clocks(void)
sccr = im->clk.sccr;
 
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MP

[U-Boot] [PATCH 05/48] mpc83xx: Introduce ARCH_MPC836*

2018-09-28 Thread Mario Six
Replace CONFIG_MPC836* with proper CONFIG_ARCH_MPC836* Kconfig options.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig   |  4 
 arch/powerpc/cpu/mpc83xx/speed.c   | 10 +-
 arch/powerpc/include/asm/fsl_lbc.h |  4 ++--
 arch/powerpc/include/asm/global_data.h |  4 ++--
 arch/powerpc/include/asm/immap_83xx.h  |  2 +-
 board/keymile/km83xx/km83xx.c  |  4 ++--
 drivers/ram/mpc83xx_sdram.c|  8 
 include/configs/km8360.h   |  1 -
 include/linux/immap_qe.h   |  2 +-
 include/mpc83xx.h  | 10 +-
 include/post.h |  2 +-
 11 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 2926472319..56a59ae4ef 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -82,6 +82,7 @@ config TARGET_IDS8313
 
 config TARGET_KM8360
bool "Support km8360"
+   select ARCH_MPC8360
imply CMD_CRAMFS
imply CMD_DIAG
imply FS_CRAMFS
@@ -149,6 +150,9 @@ config ARCH_MPC8349
bool
select ARCH_MPC834X
 
+config ARCH_MPC8360
+   bool
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 7cb6f3727d..ed77675a8e 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -113,7 +113,7 @@ int get_clocks(void)
u32 lbiu_clk;
u32 lclk_clk;
u32 mem_clk;
-#if defined(CONFIG_MPC8360)
+#if defined(CONFIG_ARCH_MPC8360)
u32 mem_sec_clk;
 #endif
 #if defined(CONFIG_QE)
@@ -313,7 +313,7 @@ int get_clocks(void)
 
 #if defined(CONFIG_ARCH_MPC834X)
i2c1_clk = tsec2_clk;
-#elif defined(CONFIG_MPC8360)
+#elif defined(CONFIG_ARCH_MPC8360)
i2c1_clk = csb_clk;
 #elif defined(CONFIG_ARCH_MPC832X)
i2c1_clk = enc_clk;
@@ -407,7 +407,7 @@ int get_clocks(void)
  (1 + ((im->clk.spmr & SPMR_DDRCM) >> SPMR_DDRCM_SHIFT));
corepll = (im->clk.spmr & SPMR_COREPLL) >> SPMR_COREPLL_SHIFT;
 
-#if defined(CONFIG_MPC8360)
+#if defined(CONFIG_ARCH_MPC8360)
mem_sec_clk = csb_clk * (1 +
   ((im->clk.spmr & SPMR_LBIUCM) >> SPMR_LBIUCM_SHIFT));
 #endif
@@ -476,7 +476,7 @@ int get_clocks(void)
gd->arch.lbiu_clk = lbiu_clk;
gd->arch.lclk_clk = lclk_clk;
gd->mem_clk = mem_clk;
-#if defined(CONFIG_MPC8360)
+#if defined(CONFIG_ARCH_MPC8360)
gd->arch.mem_sec_clk = mem_sec_clk;
 #endif
 #if defined(CONFIG_QE)
@@ -536,7 +536,7 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
printf("  Local Bus:   %-4s MHz\n",
   strmhz(buf, gd->arch.lclk_clk));
printf("  DDR: %-4s MHz\n", strmhz(buf, gd->mem_clk));
-#if defined(CONFIG_MPC8360)
+#if defined(CONFIG_ARCH_MPC8360)
printf("  DDR Secondary:   %-4s MHz\n",
   strmhz(buf, gd->arch.mem_sec_clk));
 #endif
diff --git a/arch/powerpc/include/asm/fsl_lbc.h 
b/arch/powerpc/include/asm/fsl_lbc.h
index 0ea4456033..3528acd627 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -43,10 +43,10 @@ void lbc_sdram_init(void);
 #define BR_MSEL0x00E0
 #define BR_MSEL_SHIFT  5
 #define BR_MS_GPCM 0x  /* GPCM */
-#if !defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_MPC8360)
+#if !defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_ARCH_MPC8360)
 #define BR_MS_FCM  0x0020  /* FCM */
 #endif
-#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC8360)
+#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC8360)
 #define BR_MS_SDRAM0x0060  /* SDRAM */
 #elif defined(CONFIG_MPC85xx)
 #define BR_MS_SDRAM0x  /* SDRAM */
diff --git a/arch/powerpc/include/asm/global_data.h 
b/arch/powerpc/include/asm/global_data.h
index cd0d76696d..cf3ba58822 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -61,9 +61,9 @@ struct arch_global_data {
 # if defined(CONFIG_MPC837x) || defined(CONFIG_ARCH_MPC8315)
u32 sata_clk;
 # endif
-# if defined(CONFIG_MPC8360)
+# if defined(CONFIG_ARCH_MPC8360)
u32 mem_sec_clk;
-# endif /* CONFIG_MPC8360 */
+# endif /* CONFIG_ARCH_MPC8360 */
 #endif
 #endif
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
diff --git a/arch/powerpc/include/asm/immap_83xx.h 
b/arch/powerpc/include/asm/immap_83xx.h
index bf7a4b9250..f6721e7b1d 100644
--- a/arch/powerpc/include/asm/immap_83xx.h
+++ b/arch/powerpc/include/asm/immap_83xx.h
@@ -803,7 +803,7 @@ typedef struct immap {
rom83xx_t   rom;/* On Chip ROM */
 } immap_t;
 
-#elif 

[U-Boot] [PATCH 00/48] mpc83xx: Kconfig migrations

2018-09-28 Thread Mario Six
This series converts the first bunch of legacy configuration options to
the Kconfig framework.

Functionality is preserved where possible, and setting configuration
options is made a comfortable as possible.

Mario Six (48):
  mpc83xx: Introduce ARCH_MPC830*
  mpc83xx: Introduce ARCH_MPC831*
  mpc83xx: Introduce ARCH_MPC832*
  mpc83xx: Introduce ARCH_MPC834*
  mpc83xx: Introduce ARCH_MPC836*
  mpc83xx: Introduce ARCH_MPC837X
  keymile: Make distinct kmtegr1, kmvect1, suvd3 configs
  keymile: Simplify kmtegr1, kmvect1, suvd3 configs
  keymile: Move config files
  keymile: Unroll includes
  keymile: Simplify config files
  keymile: Make distinct kmsupx5, tuge1, kmopti2, and kmtepr2 configs
  keymile: Simplify kmsupx5, tuge1, kmopti2, and kmtepr2 configs
  keymile: Unroll km/km83xx-common.h
  keymile: Simplify configs after include unroll
  keymile: Make distinct kmeter1, and kmcoge5ne configs
  keymile: Simplify kmcoge5ne, kmeter1 configs
  mpc83xx: Make distinct MPC8313ERDB targets
  mpc83xx: Simplify MPC8313ERDB configs
  VME8349: Migrate to CONFIG_TARGET_VME8349
  mpc83xx: Make distinct caddy2 config
  vme8349/caddy2: Simplify configs
  powerpc: Add LSDMR config values
  mpc83xx: Make distinct MPC8349EMDS_SDRAM board
  MPC8349EMDS: Simplify configs
  mpc8315erdb: Merge BR/OR settings
  ve8313: Merge BR/OR settings
  MPC832XEMDS: Migrate to CONFIG_TARGET_MPC832XEMDS
  MPC8349ITX: Migrate to CONFIG_TARGET_MPC8349ITX
  hrcom: Migrate to CONFIG_TARGET_HRCON
  strider: Migrate to CONFIG_TARGET_STRIDER
  MPC8313ERDB: Remove CONFIG_MPC8313ERDB
  MPC8315ERDB: Remove CONFIG_MPC8315ERDB
  MPC837XEMDS: Remove CONFIG_MPC837XEMDS
  MPC837XERDB: Remove CONFIG_MPC837XERDB
  mpc83xx: Migrate legacy PCI options to Kconfig
  mpc83xx: Replace CONFIG_83XX_CLKIN in calculations
  mpc83xx: Get rid of CONFIG_83XX_CLKIN
  mpc83xx: Kconfig: Migrate HRCW to Kconfig
  mpc83xx: pcie: Read the clock from registers
  powerpc: Migrate HIGH_BATS to Kconfig
  mpc83xx: Migrate BATS config to Kconfig
  mpc83xx: Migrate LBLAW_* to Kconfig
  mpc83xx: Normalize BR/OR option lines
  tqm834x: Expand CONFIG_SYS_OR_TIMING_FLASH macro
  mpc83xx: Simplify BR,OR lines
  sbc8349: Remove SDRAM functionality
  mpc83xx: Migrate CONFIG_SYS_{BR,OR}*_PRELIM to Kconfig

 Kconfig|2 +-
 arch/powerpc/Kconfig   |6 +
 arch/powerpc/cpu/mpc83xx/Kconfig   |  225 +++-
 arch/powerpc/cpu/mpc83xx/bats/Kconfig  | 1311 
 arch/powerpc/cpu/mpc83xx/bats/bats.h   |  223 
 arch/powerpc/cpu/mpc83xx/cpu.c |2 +-
 arch/powerpc/cpu/mpc83xx/cpu_init.c|7 +-
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig  |   32 +
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig.elbc0|  733 +++
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig.elbc1|  733 +++
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig.elbc2|  733 +++
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig.elbc3|  733 +++
 arch/powerpc/cpu/mpc83xx/elbc/Kconfig.elbc4|  733 +++
 arch/powerpc/cpu/mpc83xx/elbc/elbc.h   |  186 +++
 arch/powerpc/cpu/mpc83xx/fdt.c |6 +-
 arch/powerpc/cpu/mpc83xx/hrcw/Kconfig  |  816 
 arch/powerpc/cpu/mpc83xx/hrcw/hrcw.h   |   37 +
 arch/powerpc/cpu/mpc83xx/lblaw/Kconfig |  519 
 arch/powerpc/cpu/mpc83xx/lblaw/lblaw.h |   55 +
 arch/powerpc/cpu/mpc83xx/pcie.c|   39 +-
 arch/powerpc/cpu/mpc83xx/spd_sdram.c   |4 +-
 arch/powerpc/cpu/mpc83xx/speed.c   |  112 +-
 arch/powerpc/cpu/mpc83xx/spl_minimal.c |   11 +
 arch/powerpc/cpu/mpc83xx/start.S   |3 +
 arch/powerpc/cpu/mpc8xxx/fsl_lbc.c |4 +
 arch/powerpc/include/asm/arch-mpc83xx/gpio.h   |6 +-
 arch/powerpc/include/asm/fsl_lbc.h |   13 +-
 arch/powerpc/include/asm/global_data.h |   22 +-
 arch/powerpc/include/asm/immap_83xx.h  |   24 +-
 arch/powerpc/include/asm/mpc8xxx_spi.h |   10 +-
 board/esd/vme8349/Kconfig  |   13 +
 board/esd/vme8349/vme8349.c|8 +-
 board/freescale/common/pq-mds-pib.c|6 +-
 board/freescale/mpc8313erdb/Kconfig|   17 +-
 board/freescale/mpc8315erdb/MAINTAINERS|1 +
 board/freescale/mpc8349emds/Kconfig|   13 +
 board/freescale/mpc8349emds/MAINTAINERS|2 +
 board/freescale/mpc8349emds/pci.c  |   12 +-
 board/freescale/mpc8349itx/mpc8349itx.c|5 +-
 board/freescale/mpc837xemds/MAINTAINERS|1 +
 board/freescale/mpc837xerdb/MAINTAINERS|1 +
 board/gdsys/common/Makefile|6 +-
 board/gdsys/mpc8308/Makefile   |4 +-
 bo

[U-Boot] [PATCH 06/48] mpc83xx: Introduce ARCH_MPC837X

2018-09-28 Thread Mario Six
Replace CONFIG_MPC837x with a proper CONFIG_ARCH_MPC837X Kconfig option.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig |  3 +++
 arch/powerpc/cpu/mpc83xx/speed.c | 30 ++--
 arch/powerpc/include/asm/arch-mpc83xx/gpio.h |  2 +-
 arch/powerpc/include/asm/global_data.h   |  6 +++---
 arch/powerpc/include/asm/immap_83xx.h|  2 +-
 arch/powerpc/include/asm/mpc8xxx_spi.h   |  2 +-
 drivers/ram/mpc83xx_sdram.c  |  8 
 include/configs/MPC837XEMDS.h|  1 -
 include/configs/MPC837XERDB.h|  1 -
 include/mpc83xx.h| 24 +++---
 10 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 56a59ae4ef..e41f4d1f9a 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -153,6 +153,9 @@ config ARCH_MPC8349
 config ARCH_MPC8360
bool
 
+config ARCH_MPC837X
+   bool
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index ed77675a8e..668ed27862 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -86,7 +86,7 @@ int get_clocks(void)
 
u32 csb_clk;
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X)
u32 tsec1_clk;
u32 tsec2_clk;
u32 usbdr_clk;
@@ -123,11 +123,11 @@ int get_clocks(void)
u32 brg_clk;
 #endif
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC837X)
u32 pciexp1_clk;
u32 pciexp2_clk;
 #endif
-#if defined(CONFIG_MPC837x) || defined(CONFIG_ARCH_MPC8315)
+#if defined(CONFIG_ARCH_MPC837X) || defined(CONFIG_ARCH_MPC8315)
u32 sata_clk;
 #endif
 
@@ -156,7 +156,7 @@ int get_clocks(void)
sccr = im->clk.sccr;
 
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X)
switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) {
case 0:
tsec1_clk = 0;
@@ -177,7 +177,7 @@ int get_clocks(void)
 #endif
 
 #if defined(CONFIG_ARCH_MPC830X) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X)
switch ((sccr & SCCR_USBDRCM) >> SCCR_USBDRCM_SHIFT) {
case 0:
usbdr_clk = 0;
@@ -198,7 +198,7 @@ int get_clocks(void)
 #endif
 
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC8315) || \
-   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X)
switch ((sccr & SCCR_TSEC2CM) >> SCCR_TSEC2CM_SHIFT) {
case 0:
tsec2_clk = 0;
@@ -321,7 +321,7 @@ int get_clocks(void)
i2c1_clk = enc_clk;
 #elif defined(CONFIG_FSL_ESDHC)
i2c1_clk = sdhc_clk;
-#elif defined(CONFIG_MPC837x)
+#elif defined(CONFIG_ARCH_MPC837X)
i2c1_clk = enc_clk;
 #elif defined(CONFIG_ARCH_MPC8309)
i2c1_clk = csb_clk;
@@ -331,7 +331,7 @@ int get_clocks(void)
 #endif
 
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC837X)
switch ((sccr & SCCR_PCIEXP1CM) >> SCCR_PCIEXP1CM_SHIFT) {
case 0:
pciexp1_clk = 0;
@@ -369,7 +369,7 @@ int get_clocks(void)
}
 #endif
 
-#if defined(CONFIG_MPC837x) || defined(CONFIG_ARCH_MPC8315)
+#if defined(CONFIG_ARCH_MPC837X) || defined(CONFIG_ARCH_MPC8315)
switch ((sccr & SCCR_SATA1CM) >> SCCR_SATA1CM_SHIFT) {
case 0:
sata_clk = 0;
@@ -449,7 +449,7 @@ int get_clocks(void)
 
gd->arch.csb_clk = csb_clk;
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X)
gd->arch.tsec1_clk = tsec1_clk;
gd->arch.tsec2_clk = tsec2_clk;
gd->arch.usbdr_clk = usbdr_clk;
@@ -484,11 +484,11 @@ int get_clocks(void)
gd->arch.brg_clk = brg_clk;
 #endif
 #if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_ARCH_MPC831X) || \
-   defined(CONFIG_MPC837x)
+   defined(CONFIG_ARCH_MPC837X)
gd->arch.pciexp1_clk = pciexp1_clk;
gd->arch.pciexp2_clk = pciexp2_clk;
 #endif
-#if defined(CONFIG_MPC837x) || defined(CONFIG_ARCH_MPC8315)
+#if defined(CONFIG_ARCH_MPC837X) || defined(CONFIG_ARCH

[U-Boot] [PATCH 02/48] mpc83xx: Introduce ARCH_MPC831*

2018-09-28 Thread Mario Six
Replace CONFIG_MPC833* with proper CONFIG_ARCH_MPC833* Kconfig options.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig | 15 +++
 arch/powerpc/cpu/mpc83xx/cpu.c   |  2 +-
 arch/powerpc/cpu/mpc83xx/cpu_init.c  |  4 +--
 arch/powerpc/cpu/mpc83xx/fdt.c   |  6 ++---
 arch/powerpc/cpu/mpc83xx/spd_sdram.c |  2 +-
 arch/powerpc/cpu/mpc83xx/speed.c | 40 ++--
 arch/powerpc/include/asm/arch-mpc83xx/gpio.h |  4 +--
 arch/powerpc/include/asm/global_data.h   |  8 +++---
 arch/powerpc/include/asm/immap_83xx.h|  4 +--
 arch/powerpc/include/asm/mpc8xxx_spi.h   |  4 +--
 drivers/ram/mpc83xx_sdram.c  |  4 +--
 include/configs/MPC8313ERDB.h|  2 --
 include/configs/MPC8315ERDB.h|  2 --
 include/configs/ids8313.h|  3 ---
 include/configs/ve8313.h |  2 --
 include/mpc83xx.h| 20 +++---
 16 files changed, 64 insertions(+), 58 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 142b924786..20780ba68b 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -17,6 +17,7 @@ config TARGET_SBC8349
 
 config TARGET_VE8313
bool "Support ve8313"
+   select ARCH_MPC8313
 
 config TARGET_VME8349
bool "Support vme8349"
@@ -28,11 +29,13 @@ config TARGET_MPC8308RDB
 
 config TARGET_MPC8313ERDB
bool "Support MPC8313ERDB"
+   select ARCH_MPC8313
select BOARD_EARLY_INIT_F
select SUPPORT_SPL
 
 config TARGET_MPC8315ERDB
bool "Support MPC8315ERDB"
+   select ARCH_MPC8315
select BOARD_EARLY_INIT_F
 
 config TARGET_MPC8323ERDB
@@ -65,6 +68,7 @@ config TARGET_MPC837XERDB
 
 config TARGET_IDS8313
bool "Support ids8313"
+   select ARCH_MPC8313
select DM
imply CMD_DM
 
@@ -113,6 +117,17 @@ config ARCH_MPC8309
bool
select ARCH_MPC830X
 
+config ARCH_MPC831X
+   bool
+
+config ARCH_MPC8313
+   bool
+   select ARCH_MPC831X
+
+config ARCH_MPC8315
+   bool
+   select ARCH_MPC831X
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index b29f271e9b..8a88068fdb 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -18,7 +18,7 @@
 #include 
 #include 
 #include 
-#if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_MPC831x)
+#if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
 #include 
 #include 
 #endif
diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c 
b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index 1555205e06..7d8d5516b4 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -240,7 +240,7 @@ void cpu_init_f (volatile immap_t * im)
 
/* System General Purpose Register */
 #ifdef CONFIG_SYS_SICRH
-#if defined(CONFIG_MPC834x) || defined(CONFIG_MPC8313)
+#if defined(CONFIG_MPC834x) || defined(CONFIG_ARCH_MPC8313)
/* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
__raw_writel((im->sysconf.sicrh & 0x000C) | CONFIG_SYS_SICRH,
 &im->sysconf.sicrh);
@@ -312,7 +312,7 @@ void cpu_init_f (volatile immap_t * im)
im->gpio[1].dat = CONFIG_SYS_GPIO2_DAT;
im->gpio[1].dir = CONFIG_SYS_GPIO2_DIR;
 #endif
-#if defined(CONFIG_USB_EHCI_FSL) && defined(CONFIG_MPC831x)
+#if defined(CONFIG_USB_EHCI_FSL) && defined(CONFIG_ARCH_MPC831X)
uint32_t temp;
struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB1_ADDR;
 
diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c
index 0ecafd708f..cfd391b78a 100644
--- a/arch/powerpc/cpu/mpc83xx/fdt.c
+++ b/arch/powerpc/cpu/mpc83xx/fdt.c
@@ -16,7 +16,7 @@ extern void ft_qe_setup(void *blob);
 DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_BOOTCOUNT_LIMIT) && \
-   (defined(CONFIG_QE) && !defined(CONFIG_MPC831x))
+   (defined(CONFIG_QE) && !defined(CONFIG_ARCH_MPC831X))
 #include 
 
 void fdt_fixup_muram (void *blob)
@@ -52,7 +52,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
 defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
 defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5)
-#ifdef CONFIG_MPC8313
+#ifdef CONFIG_ARCH_MPC8313
/*
* mpc8313e erratum IPIC1 swapped TSEC interrupt ID numbers on rev. 1
* h/w (see AN3545).  The base device tree in use has rev. 1 ID numbers,
@@ -123,7 +123,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 
 #if defined(CONFIG_BOOTCOUNT_LIMIT) && \
-   (defined(CONFIG_QE) && !defined(CONFIG_MPC831x))
+   (defined(CONFIG_QE)

[U-Boot] [PATCH 09/48] keymile: Move config files

2018-09-28 Thread Mario Six
We want to unroll several include files, while keeping include
statements consistent.

To make it easier to not break the include statements, move the include
files to the main configs directory. All three include files moved will
be unrolled, so they won't pollute the directory for long.

Signed-off-by: Mario Six 
---
 include/configs/{km => }/km8309-common.h | 0
 include/configs/{km => }/km8321-common.h | 0
 include/configs/km8360.h | 2 +-
 include/configs/{km => }/km83xx-common.h | 4 ++--
 include/configs/kmtegr1.h| 4 ++--
 include/configs/kmvect1.h| 4 ++--
 include/configs/suvd3.h  | 4 ++--
 include/configs/tuxx1.h  | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)
 rename include/configs/{km => }/km8309-common.h (100%)
 rename include/configs/{km => }/km8321-common.h (100%)
 rename include/configs/{km => }/km83xx-common.h (99%)

diff --git a/include/configs/km/km8309-common.h 
b/include/configs/km8309-common.h
similarity index 100%
rename from include/configs/km/km8309-common.h
rename to include/configs/km8309-common.h
diff --git a/include/configs/km/km8321-common.h 
b/include/configs/km8321-common.h
similarity index 100%
rename from include/configs/km/km8321-common.h
rename to include/configs/km8321-common.h
diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 7857b83055..08d2ae0cbc 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -38,7 +38,7 @@
 #define CONFIG_QE  /* Has QE */
 
 /* include common defines/options for all 83xx Keymile boards */
-#include "km/km83xx-common.h"
+#include "km83xx-common.h"
 
 /*
  * System IO Setup
diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km83xx-common.h
similarity index 99%
rename from include/configs/km/km83xx-common.h
rename to include/configs/km83xx-common.h
index 3868d99b87..f817d978e7 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km83xx-common.h
@@ -8,8 +8,8 @@
 #define __CONFIG_KM83XX_H
 
 /* include common defines/options for all Keymile boards */
-#include "keymile-common.h"
-#include "km-powerpc.h"
+#include "km/keymile-common.h"
+#include "km/km-powerpc.h"
 
 /*
  * System Clock Setup
diff --git a/include/configs/kmtegr1.h b/include/configs/kmtegr1.h
index 69397ae5ae..95a131892d 100644
--- a/include/configs/kmtegr1.h
+++ b/include/configs/kmtegr1.h
@@ -20,7 +20,7 @@
  * High Level Configuration Options
  */
 
-/* This needs to be set prior to including km/km83xx-common.h */
+/* This needs to be set prior to including km83xx-common.h */
 
 #define CONFIG_HOSTNAME   "kmtegr1"
 #define CONFIG_KM_BOARD_NAME   "kmtegr1"
@@ -36,7 +36,7 @@
 #define NAND_MAX_CHIPS 1
 
 /* include common defines/options for all 8309 Keymile boards */
-#include "km/km8309-common.h"
+#include "km8309-common.h"
 /* must be after the include because KMBEC_FPGA is otherwise undefined */
 #define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
 
diff --git a/include/configs/kmvect1.h b/include/configs/kmvect1.h
index 178e769976..0bbf541aec 100644
--- a/include/configs/kmvect1.h
+++ b/include/configs/kmvect1.h
@@ -20,14 +20,14 @@
  * High Level Configuration Options
  */
 
-/* This needs to be set prior to including km/km83xx-common.h */
+/* This needs to be set prior to including km83xx-common.h */
 
 #define CONFIG_HOSTNAME"kmvect1"
 #define CONFIG_KM_BOARD_NAME   "kmvect1"
 /* at end of uboot partition, before env */
 #define CONFIG_SYS_QE_FW_ADDR   0xF00B
 /* include common defines/options for all 8309 Keymile boards */
-#include "km/km8309-common.h"
+#include "km8309-common.h"
 
 #define CONFIG_SYS_APP1_BASE   0xA000
 #define CONFIG_SYS_APP1_SIZE   256 /* Megabytes */
diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h
index 2a3f7ff526..98137392ed 100644
--- a/include/configs/suvd3.h
+++ b/include/configs/suvd3.h
@@ -20,12 +20,12 @@
  * High Level Configuration Options
  */
 
-/* This needs to be set prior to including km/km83xx-common.h */
+/* This needs to be set prior to including km83xx-common.h */
 
 #define CONFIG_HOSTNAME"suvd3"
 #define CONFIG_KM_BOARD_NAME   "suvd3"
 /* include common defines/options for all 8321 Keymile boards */
-#include "km/km8321-common.h"
+#include "km8321-common.h"
 
 #define CONFIG_SYS_APP1_BASE   0xA000
 #define CONFIG_SYS_APP1_SIZE   256 /* Megabytes */
diff --git a/include/configs/tuxx1.h b/include/configs/tuxx1.h
index f22d73b8d3..0b17084b05 100644
--- a/include/configs/tuxx1.h
+++ b/include/configs/tuxx1.h
@@ -43,7 +43,7 @@
 #endif
 
 /* include common defines/options for all 8321 Keymile boards */
-#include "km/km8321-common.h"
+#include "km8321-common.h"
 
 #define CONFIG_SYS_APP1_BASE   0xA000/* PAXG */
 #defineCONFIG_SYS_APP1_SIZE256 /* Megabytes */
-- 
2.16.4


[U-Boot] [PATCH 11/48] keymile: Simplify config files

2018-09-28 Thread Mario Six
Simplify the config files in which we recently unrolled the
km8309-common.h include file.

Signed-off-by: Mario Six 
---
 include/configs/kmtegr1.h | 13 -
 include/configs/kmvect1.h | 12 
 include/configs/suvd3.h   | 25 -
 include/configs/tuxx1.h   | 26 --
 4 files changed, 76 deletions(-)

diff --git a/include/configs/kmtegr1.h b/include/configs/kmtegr1.h
index e6ec3488dc..27e3905c2b 100644
--- a/include/configs/kmtegr1.h
+++ b/include/configs/kmtegr1.h
@@ -35,18 +35,6 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 #define NAND_MAX_CHIPS 1
 
-/* include common defines/options for all 8309 Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2012 Keymile AG
- *Gerlando Falauto 
- *
- * Based on km8321-common.h, see respective copyright notice for credits
- */
-
-#ifndef __CONFIG_KM8309_COMMON_H
-#define __CONFIG_KM8309_COMMON_H
-
 /*
  * High Level Configuration Options
  */
@@ -209,7 +197,6 @@
 #define CONFIG_SYS_DBAT7L  CONFIG_SYS_IBAT7L
 #define CONFIG_SYS_DBAT7U  CONFIG_SYS_IBAT7U
 
-#endif /* __CONFIG_KM8309_COMMON_H */
 /* must be after the include because KMBEC_FPGA is otherwise undefined */
 #define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
 
diff --git a/include/configs/kmvect1.h b/include/configs/kmvect1.h
index e549d20033..5a0fbccade 100644
--- a/include/configs/kmvect1.h
+++ b/include/configs/kmvect1.h
@@ -26,17 +26,6 @@
 #define CONFIG_KM_BOARD_NAME   "kmvect1"
 /* at end of uboot partition, before env */
 #define CONFIG_SYS_QE_FW_ADDR   0xF00B
-/* include common defines/options for all 8309 Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2012 Keymile AG
- *Gerlando Falauto 
- *
- * Based on km8321-common.h, see respective copyright notice for credits
- */
-
-#ifndef __CONFIG_KM8309_COMMON_H
-#define __CONFIG_KM8309_COMMON_H
 
 /*
  * High Level Configuration Options
@@ -200,7 +189,6 @@
 #define CONFIG_SYS_DBAT7L  CONFIG_SYS_IBAT7L
 #define CONFIG_SYS_DBAT7U  CONFIG_SYS_IBAT7U
 
-#endif /* __CONFIG_KM8309_COMMON_H */
 #define CONFIG_SYS_APP1_BASE   0xA000
 #define CONFIG_SYS_APP1_SIZE   256 /* Megabytes */
 #define CONFIG_SYS_APP2_BASE   0xB000
diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h
index d45d6779f4..5fe5f3cc23 100644
--- a/include/configs/suvd3.h
+++ b/include/configs/suvd3.h
@@ -24,30 +24,6 @@
 
 #define CONFIG_HOSTNAME"suvd3"
 #define CONFIG_KM_BOARD_NAME   "suvd3"
-/* include common defines/options for all 8321 Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2006 Freescale Semiconductor, Inc.
- *Dave Liu 
- *
- * Copyright (C) 2007 Logic Product Development, Inc.
- *Peter Barada 
- *
- * Copyright (C) 2007 MontaVista Software, Inc.
- *Anton Vorontsov 
- *
- * (C) Copyright 2008
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- *
- * (C) Copyright 2010
- * Lukas Roggli, KEYMILE Ltd, lukas.rog...@keymile.com
- *
- * (C) Copyright 2010-2011
- * Thomas Reufer, KEYMILE Ltd, thomas.reu...@keymile.com
- */
-
-#ifndef __CONFIG_KM8321_COMMON_H
-#define __CONFIG_KM8321_COMMON_H
 
 /*
  * High Level Configuration Options
@@ -163,7 +139,6 @@
 #define CONFIG_SYS_DBAT7L  CONFIG_SYS_IBAT7L
 #define CONFIG_SYS_DBAT7U  CONFIG_SYS_IBAT7U
 
-#endif /* __CONFIG_KM8321_COMMON_H */
 #define CONFIG_SYS_APP1_BASE   0xA000
 #define CONFIG_SYS_APP1_SIZE   256 /* Megabytes */
 #define CONFIG_SYS_APP2_BASE   0xB000
diff --git a/include/configs/tuxx1.h b/include/configs/tuxx1.h
index 8692989669..c031661830 100644
--- a/include/configs/tuxx1.h
+++ b/include/configs/tuxx1.h
@@ -42,31 +42,6 @@
 #error ("Board not supported")
 #endif
 
-/* include common defines/options for all 8321 Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2006 Freescale Semiconductor, Inc.
- *Dave Liu 
- *
- * Copyright (C) 2007 Logic Product Development, Inc.
- *Peter Barada 
- *
- * Copyright (C) 2007 MontaVista Software, Inc.
- *Anton Vorontsov 
- *
- * (C) Copyright 2008
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- *
- * (C) Copyright 2010
- * Lukas Roggli, KEYMILE Ltd, lukas.rog...@keymile.com
- *
- * (C) Copyright 2010-2011
- * Thomas Reufer, KEYMILE Ltd, thomas.reu...@keymile.com
- */
-
-#ifndef __CONFIG_KM8321_COMMON_H
-#define __CONFIG_KM8321_COMMON_H
-
 /*
  * High Level Configuration Options
  */
@@ -181,7 +156,6 @@
 #define CONFIG_SYS_DBAT7L  CONFIG_SYS_IBAT7L
 #define CONFIG_SYS_DBAT7U  CONFIG_SYS_IBAT7U
 
-#endif /* __CONFIG_KM8321_COMMON_H */
 #define CONFIG_SYS_APP1_BASE   0xA000/* PAXG */
 #defineCONFIG_SYS_APP1_SIZE256 /* Megabyte

[U-Boot] [PATCH 01/48] mpc83xx: Introduce ARCH_MPC830*

2018-09-28 Thread Mario Six
Replace CONFIG_MPC830* with proper CONFIG_ARCH_MPC830* Kconfig options.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig | 17 +
 arch/powerpc/cpu/mpc83xx/spd_sdram.c |  2 +-
 arch/powerpc/cpu/mpc83xx/speed.c | 38 ++--
 arch/powerpc/include/asm/arch-mpc83xx/gpio.h |  2 +-
 arch/powerpc/include/asm/fsl_lbc.h   |  2 +-
 arch/powerpc/include/asm/global_data.h   |  6 ++---
 arch/powerpc/include/asm/immap_83xx.h| 10 
 arch/powerpc/include/asm/mpc8xxx_spi.h   |  2 +-
 board/keymile/km83xx/km83xx.c|  2 +-
 drivers/qe/qe.c  |  2 +-
 drivers/ram/mpc83xx_sdram.c  |  4 +--
 include/configs/MPC8308RDB.h |  2 --
 include/configs/hrcon.h  |  2 --
 include/configs/km/km8309-common.h   |  2 --
 include/configs/km/km83xx-common.h   |  2 +-
 include/configs/mpc8308_p1m.h|  2 --
 include/configs/strider.h|  2 --
 include/linux/immap_qe.h |  2 +-
 include/mpc83xx.h| 24 +-
 19 files changed, 66 insertions(+), 59 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 571cf8fc2e..142b924786 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -10,6 +10,7 @@ choice
 
 config TARGET_MPC8308_P1M
bool "Support mpc8308_p1m"
+   select ARCH_MPC8308
 
 config TARGET_SBC8349
bool "Support sbc8349"
@@ -22,6 +23,7 @@ config TARGET_VME8349
 
 config TARGET_MPC8308RDB
bool "Support MPC8308RDB"
+   select ARCH_MPC8308
select SYS_FSL_ERRATUM_ESDHC111
 
 config TARGET_MPC8313ERDB
@@ -74,6 +76,8 @@ config TARGET_KM8360
 
 config TARGET_SUVD3
bool "Support suvd3"
+   select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMTEGR1"
+   select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMVECT1"
imply CMD_CRAMFS
imply FS_CRAMFS
 
@@ -87,15 +91,28 @@ config TARGET_TQM834X
 
 config TARGET_HRCON
bool "Support hrcon"
+   select ARCH_MPC8308
select SYS_FSL_ERRATUM_ESDHC111
 
 config TARGET_STRIDER
bool "Support strider"
+   select ARCH_MPC8308
select SYS_FSL_ERRATUM_ESDHC111
imply CMD_PCA953X
 
 endchoice
 
+config ARCH_MPC830X
+   bool
+
+config ARCH_MPC8308
+   bool
+   select ARCH_MPC830X
+
+config ARCH_MPC8309
+   bool
+   select ARCH_MPC830X
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c 
b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
index 328a018eb6..97ef77121b 100644
--- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c
+++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
@@ -31,7 +31,7 @@ void board_add_ram_info(int use_default)
printf(" (DDR%d", ((ddr->sdram_cfg & SDRAM_CFG_SDRAM_TYPE_MASK)
   >> SDRAM_CFG_SDRAM_TYPE_SHIFT) - 1);
 
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x)
+#if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_MPC831x)
if ((ddr->sdram_cfg & SDRAM_CFG_DBW_MASK) == SDRAM_CFG_DBW_16)
puts(", 16-bit");
else if ((ddr->sdram_cfg & SDRAM_CFG_DBW_MASK) == SDRAM_CFG_DBW_32)
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 39bc1c5340..d537af5130 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -85,12 +85,12 @@ int get_clocks(void)
u32 lcrr;
 
u32 csb_clk;
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
+#if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_MPC831x) || \
defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
u32 tsec1_clk;
u32 tsec2_clk;
u32 usbdr_clk;
-#elif defined(CONFIG_MPC8309)
+#elif defined(CONFIG_ARCH_MPC8309)
u32 usbdr_clk;
 #endif
 #ifdef CONFIG_MPC834x
@@ -107,7 +107,7 @@ int get_clocks(void)
 #if defined(CONFIG_FSL_ESDHC)
u32 sdhc_clk;
 #endif
-#if !defined(CONFIG_MPC8309)
+#if !defined(CONFIG_ARCH_MPC8309)
u32 enc_clk;
 #endif
u32 lbiu_clk;
@@ -122,7 +122,7 @@ int get_clocks(void)
u32 qe_clk;
u32 brg_clk;
 #endif
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
+#if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_MPC831x) || \
defined(CONFIG_MPC837x)
u32 pciexp1_clk;
u32 pciexp2_clk;
@@ -155,7 +155,7 @@ int get_clocks(void)
 
sccr = im->clk.sccr;
 
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
+#if defined(CONFIG_ARCH_MPC8308) || defined(CONFIG_MPC831x) || \
defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) {
case 0:
@@ -176,7 +176,7 @@ int get_clocks(void)
}
 #endif
 
-#if defined(CONFIG_MPC830x) ||

[U-Boot] [PATCH 10/48] keymile: Unroll includes

2018-09-28 Thread Mario Six
To further simplify config include files, unroll the km/km8309-common.h
and km/km8321-common.h include files.

Signed-off-by: Mario Six 
---
 include/configs/km8309-common.h | 174 ---
 include/configs/km8321-common.h | 139 ---
 include/configs/kmtegr1.h   | 175 +++-
 include/configs/kmvect1.h   | 174 ++-
 include/configs/suvd3.h | 139 ++-
 include/configs/tuxx1.h | 139 ++-
 6 files changed, 623 insertions(+), 317 deletions(-)
 delete mode 100644 include/configs/km8309-common.h
 delete mode 100644 include/configs/km8321-common.h

diff --git a/include/configs/km8309-common.h b/include/configs/km8309-common.h
deleted file mode 100644
index 3bd334c515..00
--- a/include/configs/km8309-common.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2012 Keymile AG
- *Gerlando Falauto 
- *
- * Based on km8321-common.h, see respective copyright notice for credits
- */
-
-#ifndef __CONFIG_KM8309_COMMON_H
-#define __CONFIG_KM8309_COMMON_H
-
-/*
- * High Level Configuration Options
- */
-#define CONFIG_E3001   /* E300 family */
-#define CONFIG_QE  1   /* Has QE */
-
-#define CONFIG_KM_DEF_ARCH "arch=ppc_82xx\0"
-
-/* include common defines/options for all 83xx Keymile boards */
-#include "km83xx-common.h"
-
-/* QE microcode/firmware address */
-#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
-/* between the u-boot partition and env */
-#ifndef CONFIG_SYS_QE_FW_ADDR
-#define CONFIG_SYS_QE_FW_ADDR   0xF00C
-#endif
-
-/*
- * System IO Config
- */
-/* 0x14000180 SICR_1 */
-#define CONFIG_SYS_SICRL (0\
-   | SICR_1_UART1_UART1RTS \
-   | SICR_1_I2C_CKSTOP \
-   | SICR_1_IRQ_A_IRQ  \
-   | SICR_1_IRQ_B_IRQ  \
-   | SICR_1_GPIO_A_GPIO\
-   | SICR_1_GPIO_B_GPIO\
-   | SICR_1_GPIO_C_GPIO\
-   | SICR_1_GPIO_D_GPIO\
-   | SICR_1_GPIO_E_GPIO\
-   | SICR_1_GPIO_F_GPIO\
-   | SICR_1_USB_A_UART2S   \
-   | SICR_1_USB_B_UART2RTS \
-   | SICR_1_FEC1_FEC1  \
-   | SICR_1_FEC2_FEC2  \
-   )
-
-/* 0x00080400 SICR_2 */
-#define CONFIG_SYS_SICRH (0\
-   | SICR_2_FEC3_FEC3  \
-   | SICR_2_HDLC1_A_HDLC1  \
-   | SICR_2_ELBC_A_LA  \
-   | SICR_2_ELBC_B_LCLK\
-   | SICR_2_HDLC2_A_HDLC2  \
-   | SICR_2_USB_D_GPIO \
-   | SICR_2_PCI_PCI\
-   | SICR_2_HDLC1_B_HDLC1  \
-   | SICR_2_HDLC1_C_HDLC1  \
-   | SICR_2_HDLC2_B_GPIO   \
-   | SICR_2_HDLC2_C_HDLC2  \
-   | SICR_2_QUIESCE_B  \
-   )
-
-/* GPR_1 */
-#define CONFIG_SYS_GPR1  0x50008060
-
-#define CONFIG_SYS_GP1DIR 0x
-#define CONFIG_SYS_GP1ODR 0x
-#define CONFIG_SYS_GP2DIR 0xFF00
-#define CONFIG_SYS_GP2ODR 0x
-
-/*
- * Hardware Reset Configuration Word
- */
-#define CONFIG_SYS_HRCW_LOW (\
-   HRCWL_LCL_BUS_TO_SCB_CLK_1X1 | \
-   HRCWL_DDR_TO_SCB_CLK_2X1 | \
-   HRCWL_CSB_TO_CLKIN_2X1 | \
-   HRCWL_CORE_TO_CSB_2X1 | \
-   HRCWL_CE_PLL_VCO_DIV_2 | \
-   HRCWL_CE_TO_PLL_1X3)
-
-#define CONFIG_SYS_HRCW_HIGH (\
-   HRCWH_PCI_AGENT | \
-   HRCWH_PCI_ARBITER_DISABLE | \
-   HRCWH_CORE_ENABLE | \
-   HRCWH_FROM_0X0100 | \
-   HRCWH_BOOTSEQ_DISABLE | \
-   HRCWH_SW_WATCHDOG_DISABLE | \
-   HRCWH_ROM_LOC_LOCAL_16BIT | \
-   HRCWH_BIG_ENDIAN | \
-   HRCWH_LALE_NORMAL)
-
-#define CONFIG_SYS_DDRCDR (\
-   DDRCDR_EN | \
-   DDRCDR_PZ_MAXZ | \
-   DDRCDR_NZ_MAXZ | \
-   DDRCDR_M_ODR)
-
-#define CONFIG_SYS_DDR_CS0_BNDS0x007f
-#define CONFIG_SYS_DDR_SDRAM_CFG   (SDRAM_CFG_SDRAM_TYPE_DDR2 | \
-SDRAM_CFG_32_BE | \
-SDRAM_CFG_SREN | \
-SDRAM_CFG_HSE)
-
-#define CONFIG_SYS_DDR_SDRAM_CFG2  0x00401000
-#define CONFIG_SYS_DDR_CLK_CNTL
(DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
-#define CONFIG_SYS_DDR_INTERVAL((0x064 << 
SDRAM_INTERVAL_BSTOPRE_SHIFT) | \
-(0x200 << SDRAM_INTERVAL_REFINT_SHIFT))
-
-#define CONFIG_SYS_DDR_CS0_CONFIG  (CSCONFIG_EN | CSCONFIG_AP | \
-CSCONFIG_ODT_RD_NEVER | \
-

[U-Boot] [PATCH 08/48] keymile: Simplify kmtegr1, kmvect1, suvd3 configs

2018-09-28 Thread Mario Six
The kmtegr1, kmvect1, and suvd3 boards now have separate config files,
which were all copied from the suvd3.

Unwind the #ifdef logic in these config files to only include the
options necessary for each board.

Signed-off-by: Mario Six 
---
 include/configs/kmtegr1.h | 90 -
 include/configs/kmvect1.h | 57 
 include/configs/suvd3.h   | 94 ---
 3 files changed, 241 deletions(-)

diff --git a/include/configs/kmtegr1.h b/include/configs/kmtegr1.h
index 3e88c9000c..69397ae5ae 100644
--- a/include/configs/kmtegr1.h
+++ b/include/configs/kmtegr1.h
@@ -22,21 +22,6 @@
 
 /* This needs to be set prior to including km/km83xx-common.h */
 
-#if defined(CONFIG_SUVD3)  /* SUVD3 board specific */
-#define CONFIG_HOSTNAME"suvd3"
-#define CONFIG_KM_BOARD_NAME   "suvd3"
-/* include common defines/options for all 8321 Keymile boards */
-#include "km/km8321-common.h"
-
-#elif defined(CONFIG_KMVECT1)   /* VECT1 board specific */
-#define CONFIG_HOSTNAME"kmvect1"
-#define CONFIG_KM_BOARD_NAME   "kmvect1"
-/* at end of uboot partition, before env */
-#define CONFIG_SYS_QE_FW_ADDR   0xF00B
-/* include common defines/options for all 8309 Keymile boards */
-#include "km/km8309-common.h"
-
-#elif defined(CONFIG_KMTEGR1)   /* TEGR1 board specific */
 #define CONFIG_HOSTNAME   "kmtegr1"
 #define CONFIG_KM_BOARD_NAME   "kmtegr1"
 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
@@ -55,10 +40,6 @@
 /* must be after the include because KMBEC_FPGA is otherwise undefined */
 #define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
 
-#else
-#error Supported boards are: SUVD3, KMVECT1, KMTEGR1
-#endif
-
 #define CONFIG_SYS_APP1_BASE   0xA000
 #define CONFIG_SYS_APP1_SIZE   256 /* Megabytes */
 #define CONFIG_SYS_APP2_BASE   0xB000
@@ -77,34 +58,6 @@
  *
  */
 
-#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
-/*
- * APP1 on the local bus CS2
- */
-#define CONFIG_SYS_LBLAWBAR2_PRELIMCONFIG_SYS_APP1_BASE
-#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
-
-#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_APP1_BASE | \
-BR_PS_16 | \
-BR_MS_UPMA | \
-BR_V)
-#define CONFIG_SYS_OR2_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP1_SIZE))
-
-#define CONFIG_SYS_BR3_PRELIM  (CONFIG_SYS_APP2_BASE | \
-BR_PS_16 | \
-BR_V)
-
-#define CONFIG_SYS_OR3_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP2_SIZE) | \
-OR_GPCM_CSNT | \
-OR_GPCM_ACS_DIV4 | \
-OR_GPCM_SCY_3 | \
-OR_GPCM_TRLX_SET)
-
-#define CONFIG_SYS_MAMR(MxMR_GPL_x4DIS | \
-0xc000 | \
-MxMR_WLFx_2X)
-
-#elif defined(CONFIG_KMTEGR1)
 #define CONFIG_SYS_BR3_PRELIM (CONFIG_SYS_APP2_BASE | \
 BR_PS_16 | \
 BR_MS_GPCM | \
@@ -115,31 +68,16 @@
 OR_GPCM_TRLX_CLEAR | \
 OR_GPCM_EHTR_CLEAR)
 
-#endif /* CONFIG_KMTEGR1 */
-
 #define CONFIG_SYS_LBLAWBAR3_PRELIMCONFIG_SYS_APP2_BASE
 #define CONFIG_SYS_LBLAWAR3_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
 
 /*
  * MMU Setup
  */
-#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
-/* APP1:  icache cacheable, but dcache-inhibit and guarded */
-#define CONFIG_SYS_IBAT5L  (CONFIG_SYS_APP1_BASE | BATL_PP_RW | \
-BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT5U  (CONFIG_SYS_APP1_BASE | BATU_BL_256M | \
-BATU_VS | BATU_VP)
-#define CONFIG_SYS_DBAT5L  (CONFIG_SYS_APP1_BASE | BATL_PP_RW | \
-BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
-#define CONFIG_SYS_DBAT5U  CONFIG_SYS_IBAT5U
-
-#elif defined(CONFIG_KMTEGR1)
 #define CONFIG_SYS_IBAT5L (0)
 #define CONFIG_SYS_IBAT5U (0)
 #define CONFIG_SYS_DBAT5L CONFIG_SYS_IBAT5L
 #define CONFIG_SYS_DBAT5U CONFIG_SYS_IBAT5U
-#endif /* CONFIG_KMTEGR1 */
-
 #define CONFIG_SYS_IBAT6L  (CONFIG_SYS_APP2_BASE | BATL_PP_RW | \
 BATL_MEMCOHERENCE)
 #define CONFIG_SYS_IBAT6U  (CONFIG_SYS_APP2_BASE | BATU_BL_256M | \
@@ -148,33 +86,6 @@
 BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
 #define CONFIG_SYS_DBAT6U  CONFIG_SYS_IBAT6U
 
-/*
- * QE UEC ethernet configuration
- */
-#if defined(CONFIG_KMVECT1)
-#define CONFIG_MV88E6352_SWITCH
-#define CONFIG_KM_MVEXTSW_ADDR 0x10
-
-/* ethernet port connected to simple switch 88e6122 (UEC0) */
-#define CONFIG_UEC_ETH1
-#define CONFIG_SYS_UEC1_UCC_NUM0   /* UCC1 */
-#define CONFIG_SYS_UEC1_RX_CLK QE_CLK9
-#define CONFIG

[U-Boot] [PATCH 16/48] keymile: Make distinct kmeter1, and kmcoge5ne configs

2018-09-28 Thread Mario Six
The kmeter1, and kmcoge5ne boards also build from the same config
file with #ifdef logic.

Create a separate include config for each board with the #ifdef logic
resolved as needed.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig  |  11 +-
 board/keymile/km83xx/Kconfig  |  17 +-
 board/keymile/km83xx/km83xx.c |   2 +-
 configs/kmcoge5ne_defconfig   |   3 +-
 configs/kmeter1_defconfig |   3 +-
 include/configs/{km8360.h => kmcoge5ne.h} |  10 +-
 include/configs/kmeter1.h | 557 ++
 7 files changed, 589 insertions(+), 14 deletions(-)
 rename include/configs/{km8360.h => kmcoge5ne.h} (98%)
 create mode 100644 include/configs/kmeter1.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 1ebb092f0b..29d84f363d 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -80,8 +80,15 @@ config TARGET_IDS8313
select DM
imply CMD_DM
 
-config TARGET_KM8360
-   bool "Support km8360"
+config TARGET_KMETER1
+   bool "Support kmeter1"
+   select ARCH_MPC8360
+   imply CMD_CRAMFS
+   imply CMD_DIAG
+   imply FS_CRAMFS
+
+config TARGET_KMCOGE5NE
+   bool "Support kmcoge5ne"
select ARCH_MPC8360
imply CMD_CRAMFS
imply CMD_DIAG
diff --git a/board/keymile/km83xx/Kconfig b/board/keymile/km83xx/Kconfig
index 0c4fa0b7fd..f17034 100644
--- a/board/keymile/km83xx/Kconfig
+++ b/board/keymile/km83xx/Kconfig
@@ -1,4 +1,4 @@
-if TARGET_KM8360
+if TARGET_KMETER1
 
 config SYS_BOARD
default "km83xx"
@@ -7,7 +7,20 @@ config SYS_VENDOR
default "keymile"
 
 config SYS_CONFIG_NAME
-   default "km8360"
+   default "kmeter1"
+
+endif
+
+if TARGET_KMCOGE5NE
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmcoge5ne"
 
 endif
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 12044ee0d7..1fd6f91901 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -271,7 +271,7 @@ int last_stage_init(void)
}
 #endif
 
-#if defined(CONFIG_KMCOGE5NE)
+#if defined(CONFIG_TARGET_KMCOGE5NE)
struct bfticu_iomap *base =
(struct bfticu_iomap *)CONFIG_SYS_BFTIC3_BASE;
u8 dip_switch = in_8((u8 *)&(base->mswitch)) & BFTICU_DIPSWITCH_MASK;
diff --git a/configs/kmcoge5ne_defconfig b/configs/kmcoge5ne_defconfig
index 941c1f0b72..649e07c5f4 100644
--- a/configs/kmcoge5ne_defconfig
+++ b/configs/kmcoge5ne_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_KM8360=y
+CONFIG_TARGET_KMCOGE5NE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="KMCOGE5NE"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/configs/kmeter1_defconfig b/configs/kmeter1_defconfig
index 2d5f284411..cbb74e0022 100644
--- a/configs/kmeter1_defconfig
+++ b/configs/kmeter1_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_KM8360=y
+CONFIG_TARGET_KMETER1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="KMETER1"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/include/configs/km8360.h b/include/configs/kmcoge5ne.h
similarity index 98%
rename from include/configs/km8360.h
rename to include/configs/kmcoge5ne.h
index b22345bcc2..29d977b901 100644
--- a/include/configs/km8360.h
+++ b/include/configs/kmcoge5ne.h
@@ -12,11 +12,11 @@
 #define CONFIG_SYS_KMBEC_FPGA_BASE 0xE800
 #define CONFIG_SYS_KMBEC_FPGA_SIZE 64
 
-#if defined CONFIG_KMETER1
+#if defined CONFIG_TARGET_KMETER1
 #define CONFIG_HOSTNAME"kmeter1"
 #define CONFIG_KM_BOARD_NAME   "kmeter1"
 #define CONFIG_KM_DEF_NETDEV   "netdev=eth2\0"
-#elif defined CONFIG_KMCOGE5NE
+#elif defined CONFIG_TARGET_KMCOGE5NE
 #define CONFIG_HOSTNAME"kmcoge5ne"
 #define CONFIG_KM_BOARD_NAME   "kmcoge5ne"
 #define CONFIG_KM_DEF_NETDEV   "netdev=eth1\0"
@@ -361,7 +361,7 @@
 
 #define CONFIG_SYS_DDR_SDRAM_CFG2  0x00401000
 
-#ifdef CONFIG_KMCOGE5NE
+#ifdef CONFIG_TARGET_KMCOGE5NE
 /**
  * KMCOGE5NE has 512 MB RAM
  */
@@ -457,7 +457,7 @@
OR_GPCM_TRLX | \
OR_GPCM_EAD)
 
-#ifdef CONFIG_KMCOGE5NE
+#ifdef CONFIG_TARGET_KMCOGE5NE
 /*
  * BFTIC3 on the local bus CS4
  */
@@ -502,7 +502,7 @@
 
 #define CONFIG_SYS_DBAT5U  CONFIG_SYS_IBAT5U
 
-#ifdef CONFIG_KMCOGE5NE
+#ifdef CONFIG_TARGET_KMCOGE5NE
 /* BFTIC3:  icache cacheable, but dcache-inhibit and guarded */
 #define CONFIG_SYS_IBAT6L (\
CONFIG_SYS_BFTIC3_BASE | \
diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h
new file mode 100644
index 00..00fb0e2f48
--- /dev/null
+++ b/include/configs/kmeter1.h
@@ -0,0 +1,557 

[U-Boot] [PATCH 07/48] keymile: Make distinct kmtegr1, kmvect1, suvd3 configs

2018-09-28 Thread Mario Six
The kmtegr1, kmvect1, and suvd3 boards all use the same config include
file with lots of #ifdefs in it.

The Kconfig migation will become easier if we get rid of these #ifdefs
first.

Hence, create distinct config include files for these boards. These
configs will be copies of the suvd3 for now; we will simplify them in
another patch.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig |  16 +++-
 board/keymile/km83xx/Kconfig |  26 ++
 configs/kmtegr1_defconfig|   2 +-
 configs/kmvect1_defconfig|   2 +-
 include/configs/kmtegr1.h| 190 +++
 include/configs/kmvect1.h| 190 +++
 6 files changed, 421 insertions(+), 5 deletions(-)
 create mode 100644 include/configs/kmtegr1.h
 create mode 100644 include/configs/kmvect1.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index e41f4d1f9a..59e0c9a8d0 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -89,9 +89,19 @@ config TARGET_KM8360
 
 config TARGET_SUVD3
bool "Support suvd3"
-   select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMTEGR1"
-   select ARCH_MPC8309 if SYS_EXTRA_OPTIONS="KMVECT1"
-   select ARCH_MPC832X if SYS_EXTRA_OPTIONS="SUVD3"
+   select ARCH_MPC832X
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
+config TARGET_KMVECT1
+   bool "Support kmvect1"
+   select ARCH_MPC8309
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
+config TARGET_KMTEGR1
+   bool "Support kmtegr1"
+   select ARCH_MPC8309
imply CMD_CRAMFS
imply FS_CRAMFS
 
diff --git a/board/keymile/km83xx/Kconfig b/board/keymile/km83xx/Kconfig
index d6c594c96a..d52ee9117b 100644
--- a/board/keymile/km83xx/Kconfig
+++ b/board/keymile/km83xx/Kconfig
@@ -11,6 +11,32 @@ config SYS_CONFIG_NAME
 
 endif
 
+if TARGET_KMVECT1
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmvect1"
+
+endif
+
+if TARGET_KMTEGR1
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmtegr1"
+
+endif
+
 if TARGET_SUVD3
 
 config SYS_BOARD
diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig
index a3325a7662..528380a110 100644
--- a/configs/kmtegr1_defconfig
+++ b/configs/kmtegr1_defconfig
@@ -1,7 +1,7 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_SUVD3=y
+CONFIG_TARGET_KMTEGR1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="KMTEGR1"
diff --git a/configs/kmvect1_defconfig b/configs/kmvect1_defconfig
index 927ef9d56e..94bd6ce055 100644
--- a/configs/kmvect1_defconfig
+++ b/configs/kmvect1_defconfig
@@ -1,7 +1,7 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_SUVD3=y
+CONFIG_TARGET_KMVECT1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="KMVECT1"
diff --git a/include/configs/kmtegr1.h b/include/configs/kmtegr1.h
new file mode 100644
index 00..3e88c9000c
--- /dev/null
+++ b/include/configs/kmtegr1.h
@@ -0,0 +1,190 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2006 Freescale Semiconductor, Inc.
+ *Dave Liu 
+ *
+ * Copyright (C) 2007 Logic Product Development, Inc.
+ *Peter Barada 
+ *
+ * Copyright (C) 2007 MontaVista Software, Inc.
+ *Anton Vorontsov 
+ *
+ * (C) Copyright 2010
+ * Heiko Schocher, DENX Software Engineering, h...@denx.de.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+
+/* This needs to be set prior to including km/km83xx-common.h */
+
+#if defined(CONFIG_SUVD3)  /* SUVD3 board specific */
+#define CONFIG_HOSTNAME"suvd3"
+#define CONFIG_KM_BOARD_NAME   "suvd3"
+/* include common defines/options for all 8321 Keymile boards */
+#include "km/km8321-common.h"
+
+#elif defined(CONFIG_KMVECT1)   /* VECT1 board specific */
+#define CONFIG_HOSTNAME"kmvect1"
+#define CONFIG_KM_BOARD_NAME   "kmvect1"
+/* at end of uboot partition, before env */
+#define CONFIG_SYS_QE_FW_ADDR   0xF00B
+/* include common defines/options for all 8309 Keymile boards */
+#include "km/km8309-common.h"
+
+#elif defined(CONFIG_KMTEGR1)   /* TEGR1 board specific */
+#define CONFIG_HOSTNAME   "kmtegr1"
+#define CONFIG_KM_BOARD_NAME   "kmtegr1"
+#define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
+#define CONFIG_KM_UBI_PARTITION_NAME_APP   "ubi1"
+
+#define CONFIG_ENV_ADDR0xF010
+#define CONFIG_ENV_OFFSET  0x10
+
+#define CONFIG_NAND_ECC_BCH
+#define CONFIG_NAND_KMETER1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define NAND_MAX_CHIPS 1
+
+/* include common defines/options for all 8309 Keymile boards */
+#include "km/km8309-common.h"
+/* must

[U-Boot] [PATCH 17/48] keymile: Simplify kmcoge5ne, kmeter1 configs

2018-09-28 Thread Mario Six
Simplify the kmcoge5ne and kmeter1 configs to only include the #ifdefs
necessary for each board.

Signed-off-by: Mario Six 
---
 include/configs/kmcoge5ne.h | 29 --
 include/configs/kmeter1.h   | 97 +
 2 files changed, 1 insertion(+), 125 deletions(-)

diff --git a/include/configs/kmcoge5ne.h b/include/configs/kmcoge5ne.h
index 29d977b901..87efaa4a7c 100644
--- a/include/configs/kmcoge5ne.h
+++ b/include/configs/kmcoge5ne.h
@@ -12,11 +12,6 @@
 #define CONFIG_SYS_KMBEC_FPGA_BASE 0xE800
 #define CONFIG_SYS_KMBEC_FPGA_SIZE 64
 
-#if defined CONFIG_TARGET_KMETER1
-#define CONFIG_HOSTNAME"kmeter1"
-#define CONFIG_KM_BOARD_NAME   "kmeter1"
-#define CONFIG_KM_DEF_NETDEV   "netdev=eth2\0"
-#elif defined CONFIG_TARGET_KMCOGE5NE
 #define CONFIG_HOSTNAME"kmcoge5ne"
 #define CONFIG_KM_BOARD_NAME   "kmcoge5ne"
 #define CONFIG_KM_DEF_NETDEV   "netdev=eth1\0"
@@ -28,9 +23,6 @@
 
 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
 #define CONFIG_KM_UBI_PARTITION_NAME_APP   "ubi1"
-#else
-#error ("Board not supported")
-#endif
 
 /*
  * High Level Configuration Options
@@ -169,10 +161,8 @@
 #define CONFIG_UEC_ETH
 #define CONFIG_ETHPRIME"UEC0"
 
-#if !defined(CONFIG_ARCH_MPC8309)
 #define CONFIG_UEC_ETH1/* GETH1 */
 #define UEC_VERBOSE_DEBUG  1
-#endif
 
 #ifdef CONFIG_UEC_ETH1
 #define CONFIG_SYS_UEC1_UCC_NUM3   /* UCC4 */
@@ -361,7 +351,6 @@
 
 #define CONFIG_SYS_DDR_SDRAM_CFG2  0x00401000
 
-#ifdef CONFIG_TARGET_KMCOGE5NE
 /**
  * KMCOGE5NE has 512 MB RAM
  */
@@ -372,12 +361,6 @@
CSCONFIG_BANK_BIT_3 | \
CSCONFIG_ROW_BIT_13 | \
CSCONFIG_COL_BIT_10)
-#else
-#define CONFIG_SYS_DDR_CS0_CONFIG  (CSCONFIG_EN | CSCONFIG_AP | \
-CSCONFIG_ROW_BIT_13 | \
-CSCONFIG_COL_BIT_10 | \
-CSCONFIG_ODT_WR_ONLY_CURRENT)
-#endif
 
 #define CONFIG_SYS_DDR_CLK_CNTL (\
DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
@@ -457,7 +440,6 @@
OR_GPCM_TRLX | \
OR_GPCM_EAD)
 
-#ifdef CONFIG_TARGET_KMCOGE5NE
 /*
  * BFTIC3 on the local bus CS4
  */
@@ -476,7 +458,6 @@
OR_GPCM_SCY_2 |\
OR_GPCM_TRLX |\
OR_GPCM_EAD)
-#endif
 
 /*
  * MMU Setup
@@ -502,7 +483,6 @@
 
 #define CONFIG_SYS_DBAT5U  CONFIG_SYS_IBAT5U
 
-#ifdef CONFIG_TARGET_KMCOGE5NE
 /* BFTIC3:  icache cacheable, but dcache-inhibit and guarded */
 #define CONFIG_SYS_IBAT6L (\
CONFIG_SYS_BFTIC3_BASE | \
@@ -542,15 +522,6 @@
 #define CONFIG_TESTPIN_REG  gprt3  /* for kmcoge5ne */
 #define CONFIG_TESTPIN_MASK 0x20   /* for kmcoge5ne */
 
-#else
-#define CONFIG_SYS_IBAT6L  (0)
-#define CONFIG_SYS_IBAT6U  (0)
-#define CONFIG_SYS_IBAT7L  (0)
-#define CONFIG_SYS_IBAT7U  (0)
-#define CONFIG_SYS_DBAT6L  CONFIG_SYS_IBAT6L
-#define CONFIG_SYS_DBAT6U  CONFIG_SYS_IBAT6U
-#endif
-
 #define CONFIG_SYS_DBAT7L  CONFIG_SYS_IBAT7L
 #define CONFIG_SYS_DBAT7U  CONFIG_SYS_IBAT7U
 
diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h
index 00fb0e2f48..b4cadd3e0f 100644
--- a/include/configs/kmeter1.h
+++ b/include/configs/kmeter1.h
@@ -12,25 +12,9 @@
 #define CONFIG_SYS_KMBEC_FPGA_BASE 0xE800
 #define CONFIG_SYS_KMBEC_FPGA_SIZE 64
 
-#if defined CONFIG_TARGET_KMETER1
 #define CONFIG_HOSTNAME"kmeter1"
 #define CONFIG_KM_BOARD_NAME   "kmeter1"
 #define CONFIG_KM_DEF_NETDEV   "netdev=eth2\0"
-#elif defined CONFIG_TARGET_KMCOGE5NE
-#define CONFIG_HOSTNAME"kmcoge5ne"
-#define CONFIG_KM_BOARD_NAME   "kmcoge5ne"
-#define CONFIG_KM_DEF_NETDEV   "netdev=eth1\0"
-#define CONFIG_NAND_ECC_BCH
-#define CONFIG_NAND_KMETER1
-#define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define NAND_MAX_CHIPS 1
-#define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
-
-#define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
-#define CONFIG_KM_UBI_PARTITION_NAME_APP   "ubi1"
-#else
-#error ("Board not supported")
-#endif
 
 /*
  * High Level Configuration Options
@@ -156,6 +140,7 @@
 /*
  * Serial Port
  */
+#define CONFIG_CONS_INDEX  1
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE1
 #define CONFIG_SYS_NS16550_CLK get_bus_freq(0)
@@ -169,10 +154,8 @@
 #define CONFIG_UEC_ETH
 #define CONFIG_ETHPRIME"UEC0"
 
-#if !defined(CONFIG_MPC8309)
 #define CONFIG_UEC_ETH1/* GETH1 */
 #define UEC_VERBOSE_DEBUG  1
-#endif
 
 #ifdef CONFIG_UEC_ETH1
 #define CONFIG_SYS_UEC1_UCC_NUM3   /* UCC4 */
@@ -361,23 +344,10 @@
 
 #define CONFIG_SYS_DDR_SDRAM_CFG2  0x00401000
 
-#ifdef CONFIG_TARGET_KMCOGE5NE
-/**
- * KMCOGE5NE has 512 MB RAM
- */
-#define CONFIG_SYS_DDR_CS0_CONFIG (\
-   CSCONFIG_EN | \
-   CSCONFIG_AP | \
-   CSCONFIG_ODT_WR_ONLY_CURRENT | \
-   CSCONFI

[U-Boot] [PATCH 18/48] mpc83xx: Make distinct MPC8313ERDB targets

2018-09-28 Thread Mario Six
MPC8313ERDB has the option of either enabling NOR or NAND boot in its
config file (by commenting out certain #ifdefs). To keep this ability
after migrating options to Kconfig, we introduce two MPC8313ERDB
configs: one for NOR, and one for NAND.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig   |  10 +-
 board/freescale/mpc8313erdb/Kconfig|  17 +-
 configs/MPC8313ERDB_33_defconfig   |   2 +-
 configs/MPC8313ERDB_66_defconfig   |   2 +-
 configs/MPC8313ERDB_NAND_33_defconfig  |   2 +-
 configs/MPC8313ERDB_NAND_66_defconfig  |   2 +-
 .../configs/{MPC8313ERDB.h => MPC8313ERDB_NAND.h}  |   0
 include/configs/MPC8313ERDB_NOR.h  | 652 +
 8 files changed, 679 insertions(+), 8 deletions(-)
 rename include/configs/{MPC8313ERDB.h => MPC8313ERDB_NAND.h} (100%)
 create mode 100644 include/configs/MPC8313ERDB_NOR.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 29d84f363d..ede98c70da 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -29,8 +29,14 @@ config TARGET_MPC8308RDB
select ARCH_MPC8308
select SYS_FSL_ERRATUM_ESDHC111
 
-config TARGET_MPC8313ERDB
-   bool "Support MPC8313ERDB"
+config TARGET_MPC8313ERDB_NOR
+   bool "Support MPC8313ERDB_NOR"
+   select ARCH_MPC8313
+   select BOARD_EARLY_INIT_F
+   select SUPPORT_SPL
+
+config TARGET_MPC8313ERDB_NAND
+   bool "Support MPC8313ERDB_NAND"
select ARCH_MPC8313
select BOARD_EARLY_INIT_F
select SUPPORT_SPL
diff --git a/board/freescale/mpc8313erdb/Kconfig 
b/board/freescale/mpc8313erdb/Kconfig
index 145608feab..b6332a1368 100644
--- a/board/freescale/mpc8313erdb/Kconfig
+++ b/board/freescale/mpc8313erdb/Kconfig
@@ -1,4 +1,4 @@
-if TARGET_MPC8313ERDB
+if TARGET_MPC8313ERDB_NOR
 
 config SYS_BOARD
default "mpc8313erdb"
@@ -7,6 +7,19 @@ config SYS_VENDOR
default "freescale"
 
 config SYS_CONFIG_NAME
-   default "MPC8313ERDB"
+   default "MPC8313ERDB_NOR"
+
+endif
+
+if TARGET_MPC8313ERDB_NAND
+
+config SYS_BOARD
+   default "mpc8313erdb"
+
+config SYS_VENDOR
+   default "freescale"
+
+config SYS_CONFIG_NAME
+   default "MPC8313ERDB_NAND"
 
 endif
diff --git a/configs/MPC8313ERDB_33_defconfig b/configs/MPC8313ERDB_33_defconfig
index ac60840371..e0cdd56273 100644
--- a/configs/MPC8313ERDB_33_defconfig
+++ b/configs/MPC8313ERDB_33_defconfig
@@ -1,7 +1,7 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_MPC83xx=y
-CONFIG_TARGET_MPC8313ERDB=y
+CONFIG_TARGET_MPC8313ERDB_NOR=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="SYS_33MHZ"
diff --git a/configs/MPC8313ERDB_66_defconfig b/configs/MPC8313ERDB_66_defconfig
index 8a0784dd2a..b232a3275c 100644
--- a/configs/MPC8313ERDB_66_defconfig
+++ b/configs/MPC8313ERDB_66_defconfig
@@ -1,7 +1,7 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_MPC83xx=y
-CONFIG_TARGET_MPC8313ERDB=y
+CONFIG_TARGET_MPC8313ERDB_NOR=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="SYS_66MHZ"
diff --git a/configs/MPC8313ERDB_NAND_33_defconfig 
b/configs/MPC8313ERDB_NAND_33_defconfig
index 141ecb843b..fa8321c587 100644
--- a/configs/MPC8313ERDB_NAND_33_defconfig
+++ b/configs/MPC8313ERDB_NAND_33_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYS_TEXT_BASE=0x0010
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_MPC83xx=y
-CONFIG_TARGET_MPC8313ERDB=y
+CONFIG_TARGET_MPC8313ERDB_NAND=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="SYS_33MHZ"
diff --git a/configs/MPC8313ERDB_NAND_66_defconfig 
b/configs/MPC8313ERDB_NAND_66_defconfig
index 5a3bde4de2..b468b0d34a 100644
--- a/configs/MPC8313ERDB_NAND_66_defconfig
+++ b/configs/MPC8313ERDB_NAND_66_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYS_TEXT_BASE=0x0010
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_MPC83xx=y
-CONFIG_TARGET_MPC8313ERDB=y
+CONFIG_TARGET_MPC8313ERDB_NAND=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="SYS_66MHZ"
diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB_NAND.h
similarity index 100%
rename from include/configs/MPC8313ERDB.h
rename to include/configs/MPC8313ERDB_NAND.h
diff --git a/include/configs/MPC8313ERDB_NOR.h 
b/include/configs/MPC8313ERDB_NOR.h
new file mode 100644
index 00..d522d21a74
--- /dev/null
+++ b/include/configs/MPC8313ERDB_NOR.h
@@ -0,0 +1,652 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) Freescale Semiconductor, Inc. 2006, 2010.
+ */
+/*
+ * mpc8313epb board configuration file
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_E3001
+#define CONFIG_MPC8313ERDB 1
+
+#ifdef CONFIG_NAND
+#define CONFIG_SPL_INIT_MINIMAL
+#define CONFIG_SPL_FLUSH_IMAGE
+#define CONFIG_SPL_TARGET  "u

[U-Boot] [PATCH 19/48] mpc83xx: Simplify MPC8313ERDB configs

2018-09-28 Thread Mario Six
Remove all options from the new MPC8313ERDB_{NOR,NAND} configs that are
not specific to NOR or NAND.

Signed-off-by: Mario Six 
---
 include/configs/MPC8313ERDB_NAND.h | 61 ---
 include/configs/MPC8313ERDB_NOR.h  | 74 +-
 2 files changed, 23 insertions(+), 112 deletions(-)

diff --git a/include/configs/MPC8313ERDB_NAND.h 
b/include/configs/MPC8313ERDB_NAND.h
index d522d21a74..e17c632f3a 100644
--- a/include/configs/MPC8313ERDB_NAND.h
+++ b/include/configs/MPC8313ERDB_NAND.h
@@ -15,7 +15,6 @@
 #define CONFIG_E3001
 #define CONFIG_MPC8313ERDB 1
 
-#ifdef CONFIG_NAND
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET  "u-boot-with-spl.bin"
@@ -40,8 +39,6 @@
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE_SPL /* start of 
monitor */
 #endif
 
-#endif /* CONFIG_NAND */
-
 #ifndef CONFIG_SYS_MONITOR_BASE
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE/* start of 
monitor */
 #endif
@@ -70,7 +67,7 @@
 
 #define CONFIG_SYS_IMMR0xE000
 
-#if defined(CONFIG_NAND) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_SPL_BUILD)
 #define CONFIG_DEFAULT_IMMRCONFIG_SYS_IMMR
 #endif
 
@@ -188,11 +185,11 @@
 #define CONFIG_SYS_FLASH_EMPTY_INFO/* display empty sectors */
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE  /* buffer up multiple bytes */
 
-#define CONFIG_SYS_NOR_BR_PRELIM   (CONFIG_SYS_FLASH_BASE \
+#define CONFIG_SYS_BR1_PRELIM  (CONFIG_SYS_FLASH_BASE \
| BR_PS_16  /* 16 bit port */ \
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_NOR_OR_PRELIM   (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
+#define CONFIG_SYS_OR1_PRELIM  (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
| OR_GPCM_XACS \
| OR_GPCM_SCY_9 \
| OR_GPCM_EHTR \
@@ -239,7 +236,7 @@
 #define CONFIG_SYS_LBC_MRTPR   0x2000  /*TODO */
 
 /* drivers/mtd/nand/nand.c */
-#if defined(CONFIG_NAND) && defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_SPL_BUILD)
 #define CONFIG_SYS_NAND_BASE   0xFFF0
 #else
 #define CONFIG_SYS_NAND_BASE   0xE280
@@ -252,12 +249,12 @@
 #define CONFIG_SYS_NAND_BLOCK_SIZE 16384
 #define CONFIG_SYS_NAND_WINDOW_SIZE (32 * 1024)
 
-#define CONFIG_SYS_NAND_BR_PRELIM  (CONFIG_SYS_NAND_BASE \
+#define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_NAND_BASE \
| BR_DECC_CHK_GEN   /* Use HW ECC */ \
| BR_PS_8   /* 8 bit port */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_NAND_OR_PRELIM  \
+#define CONFIG_SYS_OR0_PRELIM  \
(P2SZ_TO_AM(CONFIG_SYS_NAND_WINDOW_SIZE) \
| OR_FCM_CSCT \
| OR_FCM_CST \
@@ -267,17 +264,9 @@
| OR_FCM_EHTR)
/* 0x8396 */
 
-#ifdef CONFIG_NAND
-#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NAND_BR_PRELIM
-#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NAND_OR_PRELIM
-#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NOR_BR_PRELIM
-#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NOR_OR_PRELIM
-#else
-#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NOR_BR_PRELIM
-#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NOR_OR_PRELIM
-#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NAND_BR_PRELIM
-#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NAND_OR_PRELIM
-#endif
+/* Still needed for spl_minimal.c */
+#define CONFIG_SYS_NAND_BR_PRELIM CONFIG_SYS_BR0_PRELIM
+#define CONFIG_SYS_NAND_OR_PRELIM CONFIG_SYS_OR0_PRELIM
 
 #define CONFIG_SYS_LBLAWBAR1_PRELIMCONFIG_SYS_NAND_BASE
 #define CONFIG_SYS_LBLAWAR1_PRELIM (LBLAWAR_EN | LBLAWAR_32KB)
@@ -411,25 +400,12 @@
 /*
  * Environment
  */
-#if defined(CONFIG_NAND)
-   #define CONFIG_ENV_OFFSET   (512 * 1024)
-   #define CONFIG_ENV_SECT_SIZECONFIG_SYS_NAND_BLOCK_SIZE
-   #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
-   #define CONFIG_ENV_SIZE_REDUND  CONFIG_ENV_SIZE
-   #define CONFIG_ENV_RANGE(CONFIG_ENV_SECT_SIZE * 4)
-   #define CONFIG_ENV_OFFSET_REDUND\
-   (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)
-#elif !defined(CONFIG_SYS_RAMBOOT)
-   #define CONFIG_ENV_ADDR \
-   (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-   #define CONFIG_ENV_SECT_SIZE0x1 /* 64K(one sector) for env */
-   #define CONFIG_ENV_SIZE 0x2000
-
-/* Address and size of Redundant Environment Sector */
-#else
-   #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - 0x1000)
-   #d

[U-Boot] [PATCH 22/48] vme8349/caddy2: Simplify configs

2018-09-28 Thread Mario Six
Simplify the vme8349 and caddy2 configs by keeping only the options
necessary for each board.

Signed-off-by: Mario Six 
---
 include/configs/caddy2.h  | 29 -
 include/configs/vme8349.h | 29 -
 2 files changed, 58 deletions(-)

diff --git a/include/configs/caddy2.h b/include/configs/caddy2.h
index 4f2466eecf..1ca65f636c 100644
--- a/include/configs/caddy2.h
+++ b/include/configs/caddy2.h
@@ -17,13 +17,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/*
- * Top level Makefile configuration choices
- */
-#ifdef CONFIG_CADDY2
-#define VME_CADDY2
-#endif
-
 /*
  * High Level Configuration Options
  */
@@ -93,7 +86,6 @@
  */
 #define CONFIG_SYS_FLASH_CFI
 #define CONFIG_FLASH_CFI_DRIVER/* use the CFI 
driver */
-#ifdef VME_CADDY2
 #define CONFIG_SYS_FLASH_BASE  0xffc0  /* start of FLASH   */
 #define CONFIG_SYS_FLASH_SIZE  4   /* flash size in MB */
 #define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE | \
@@ -113,27 +105,6 @@
/* 0xffc06ff7 */
 #define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_4MB)
-#else
-#define CONFIG_SYS_FLASH_BASE  0xf800  /* start of FLASH   */
-#define CONFIG_SYS_FLASH_SIZE  128 /* flash size in MB */
-#define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE | \
-BR_PS_16 | /*  16bit */ \
-BR_MS_GPCM |   /*  MSEL = GPCM */ \
-BR_V)  /* valid */
-
-#define CONFIG_SYS_OR0_PRELIM  (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
-   | OR_GPCM_XAM \
-   | OR_GPCM_CSNT \
-   | OR_GPCM_ACS_DIV2 \
-   | OR_GPCM_XACS \
-   | OR_GPCM_SCY_15 \
-   | OR_GPCM_TRLX_SET \
-   | OR_GPCM_EHTR_SET \
-   | OR_GPCM_EAD)
-   /* 0xf8006ff7 */
-#define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
-#define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_128MB)
-#endif
 /* #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE */
 
 #define CONFIG_SYS_WINDOW1_BASE0xf000
diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h
index 4f2466eecf..d607806b96 100644
--- a/include/configs/vme8349.h
+++ b/include/configs/vme8349.h
@@ -17,13 +17,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/*
- * Top level Makefile configuration choices
- */
-#ifdef CONFIG_CADDY2
-#define VME_CADDY2
-#endif
-
 /*
  * High Level Configuration Options
  */
@@ -93,27 +86,6 @@
  */
 #define CONFIG_SYS_FLASH_CFI
 #define CONFIG_FLASH_CFI_DRIVER/* use the CFI 
driver */
-#ifdef VME_CADDY2
-#define CONFIG_SYS_FLASH_BASE  0xffc0  /* start of FLASH   */
-#define CONFIG_SYS_FLASH_SIZE  4   /* flash size in MB */
-#define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE | \
-BR_PS_16 | /*  16bit */ \
-BR_MS_GPCM |   /*  MSEL = GPCM */ \
-BR_V)  /* valid */
-
-#define CONFIG_SYS_OR0_PRELIM  (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
-   | OR_GPCM_XAM \
-   | OR_GPCM_CSNT \
-   | OR_GPCM_ACS_DIV2 \
-   | OR_GPCM_XACS \
-   | OR_GPCM_SCY_15 \
-   | OR_GPCM_TRLX_SET \
-   | OR_GPCM_EHTR_SET \
-   | OR_GPCM_EAD)
-   /* 0xffc06ff7 */
-#define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
-#define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_4MB)
-#else
 #define CONFIG_SYS_FLASH_BASE  0xf800  /* start of FLASH   */
 #define CONFIG_SYS_FLASH_SIZE  128 /* flash size in MB */
 #define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE | \
@@ -133,7 +105,6 @@
/* 0xf8006ff7 */
 #define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_128MB)
-#endif
 /* #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE */
 
 #define CONFIG_SYS_WINDOW1_BASE0xf000
-- 
2.16.4

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


[U-Boot] [PATCH 15/48] keymile: Simplify configs after include unroll

2018-09-28 Thread Mario Six
Simplify the keymile configs again after unrolling the km83xx-common.h
include file.

Signed-off-by: Mario Six 
---
 include/configs/km8360.h  | 11 ---
 include/configs/kmopti2.h | 13 -
 include/configs/kmsupx5.h | 13 -
 include/configs/kmtegr1.h | 18 --
 include/configs/kmtepr2.h | 13 -
 include/configs/kmvect1.h | 18 --
 include/configs/suvd3.h   | 15 ---
 include/configs/tuge1.h   | 13 -
 include/configs/tuxx1.h   | 13 -
 9 files changed, 127 deletions(-)

diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 0d082e6488..b22345bcc2 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -37,16 +37,6 @@
  */
 #define CONFIG_QE  /* Has QE */
 
-/* include common defines/options for all 83xx Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- */
-
-#ifndef __CONFIG_KM83XX_H
-#define __CONFIG_KM83XX_H
-
 /* include common defines/options for all Keymile boards */
 #include "km/keymile-common.h"
 #include "km/km-powerpc.h"
@@ -337,7 +327,6 @@
 #define CONFIG_HAS_ETH0
 #endif
 
-#endif /* __CONFIG_KM83XX_H */
 /*
  * System IO Setup
  */
diff --git a/include/configs/kmopti2.h b/include/configs/kmopti2.h
index 2533d290a1..60f7fd09d9 100644
--- a/include/configs/kmopti2.h
+++ b/include/configs/kmopti2.h
@@ -34,16 +34,6 @@
 
 #define CONFIG_KM_DEF_ARCH "arch=ppc_8xx\0"
 
-/* include common defines/options for all 83xx Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- */
-
-#ifndef __CONFIG_KM83XX_H
-#define __CONFIG_KM83XX_H
-
 /* include common defines/options for all Keymile boards */
 #include "km/keymile-common.h"
 #include "km/km-powerpc.h"
@@ -176,10 +166,8 @@
 #define CONFIG_UEC_ETH
 #define CONFIG_ETHPRIME"UEC0"
 
-#if !defined(CONFIG_ARCH_MPC8309)
 #define CONFIG_UEC_ETH1/* GETH1 */
 #define UEC_VERBOSE_DEBUG  1
-#endif
 
 #ifdef CONFIG_UEC_ETH1
 #define CONFIG_SYS_UEC1_UCC_NUM3   /* UCC4 */
@@ -334,7 +322,6 @@
 #define CONFIG_HAS_ETH0
 #endif
 
-#endif /* __CONFIG_KM83XX_H */
 /*
  * System IO Config
  */
diff --git a/include/configs/kmsupx5.h b/include/configs/kmsupx5.h
index 3dbd554303..4af2903ec2 100644
--- a/include/configs/kmsupx5.h
+++ b/include/configs/kmsupx5.h
@@ -34,16 +34,6 @@
 
 #define CONFIG_KM_DEF_ARCH "arch=ppc_8xx\0"
 
-/* include common defines/options for all 83xx Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- */
-
-#ifndef __CONFIG_KM83XX_H
-#define __CONFIG_KM83XX_H
-
 /* include common defines/options for all Keymile boards */
 #include "km/keymile-common.h"
 #include "km/km-powerpc.h"
@@ -176,10 +166,8 @@
 #define CONFIG_UEC_ETH
 #define CONFIG_ETHPRIME"UEC0"
 
-#if !defined(CONFIG_ARCH_MPC8309)
 #define CONFIG_UEC_ETH1/* GETH1 */
 #define UEC_VERBOSE_DEBUG  1
-#endif
 
 #ifdef CONFIG_UEC_ETH1
 #define CONFIG_SYS_UEC1_UCC_NUM3   /* UCC4 */
@@ -334,7 +322,6 @@
 #define CONFIG_HAS_ETH0
 #endif
 
-#endif /* __CONFIG_KM83XX_H */
 /*
  * System IO Config
  */
diff --git a/include/configs/kmtegr1.h b/include/configs/kmtegr1.h
index 27f8345708..c731c0666f 100644
--- a/include/configs/kmtegr1.h
+++ b/include/configs/kmtegr1.h
@@ -20,8 +20,6 @@
  * High Level Configuration Options
  */
 
-/* This needs to be set prior to including km83xx-common.h */
-
 #define CONFIG_HOSTNAME   "kmtegr1"
 #define CONFIG_KM_BOARD_NAME   "kmtegr1"
 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
@@ -43,16 +41,6 @@
 
 #define CONFIG_KM_DEF_ARCH "arch=ppc_82xx\0"
 
-/* include common defines/options for all 83xx Keymile boards */
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010
- * Heiko Schocher, DENX Software Engineering, h...@denx.de.
- */
-
-#ifndef __CONFIG_KM83XX_H
-#define __CONFIG_KM83XX_H
-
 /* include common defines/options for all Keymile boards */
 #include "km/keymile-common.h"
 #include "km/km-powerpc.h"
@@ -185,11 +173,6 @@
 #define CONFIG_UEC_ETH
 #define CONFIG_ETHPRIME"UEC0"
 
-#if !defined(CONFIG_ARCH_MPC8309)
-#define CONFIG_UEC_ETH1/* GETH1 */
-#define UEC_VERBOSE_DEBUG  1
-#endif
-
 #ifdef CONFIG_UEC_ETH1
 #define CONFIG_SYS_UEC1_UCC_NUM3   /* UCC4 */
 #define CONFIG_SYS_UEC1_RX_CLK QE_CLK_NONE /* not used in RMII Mode */
@@ -343,7 +326,6 @@
 #define CONFIG_HAS_ETH0
 #endif
 
-#endif /* __CONFIG_KM83XX_H */
 /* QE microcode/firmware address */
 #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
 /* between the u-boot partition and env */
diff --git a/include/configs/kmtepr2.h b/include/configs/kmtepr2.h
index ed70f884c8..ca7a1477e2 100644
--- a/include/configs/k

[U-Boot] [PATCH 13/48] keymile: Simplify kmsupx5, tuge1, kmopti2, and kmtepr2 configs

2018-09-28 Thread Mario Six
Simplify the kmsupx5, tuge1, kmopti2, and kmtepr2 config files to only
include the #ifdefs needed for each board.

Signed-off-by: Mario Six 
---
 include/configs/kmopti2.h | 73 ---
 include/configs/kmsupx5.h | 97 ---
 include/configs/kmtepr2.h | 72 ---
 include/configs/tuge1.h   | 97 ---
 include/configs/tuxx1.h   | 62 --
 5 files changed, 401 deletions(-)

diff --git a/include/configs/kmopti2.h b/include/configs/kmopti2.h
index 64d6f21514..0621be3928 100644
--- a/include/configs/kmopti2.h
+++ b/include/configs/kmopti2.h
@@ -23,24 +23,8 @@
 /*
  * High Level Configuration Options
  */
-#if defined(CONFIG_TARGET_KMSUPX5)
-#define CONFIG_KM_BOARD_NAME   "kmsupx5"
-#define CONFIG_HOSTNAME"kmsupx5"
-#elif defined(CONFIG_TARGET_TUGE1)
-#define CONFIG_KM_BOARD_NAME   "tuge1"
-#define CONFIG_HOSTNAME"tuge1"
-#elif defined(CONFIG_TARGET_TUXX1) /* TUXX1 board (tuxa1/tuda1) specific */
-#define CONFIG_KM_BOARD_NAME   "tuxx1"
-#define CONFIG_HOSTNAME"tuxx1"
-#elif defined(CONFIG_TARGET_KMOPTI2)
 #define CONFIG_KM_BOARD_NAME   "kmopti2"
 #define CONFIG_HOSTNAME"kmopti2"
-#elif defined(CONFIG_TARGET_KMTEPR2)
-#define CONFIG_KM_BOARD_NAME"kmtepr2"
-#define CONFIG_HOSTNAME "kmtepr2"
-#else
-#error ("Board not supported")
-#endif
 
 /*
  * High Level Configuration Options
@@ -158,10 +142,8 @@
 
 #define CONFIG_SYS_APP1_BASE   0xA000/* PAXG */
 #defineCONFIG_SYS_APP1_SIZE256 /* Megabytes */
-#if defined(CONFIG_TARGET_TUXX1) || defined(CONFIG_TARGET_KMOPTI2) || 
defined(CONFIG_TARGET_KMTEPR2)
 #define CONFIG_SYS_APP2_BASE   0xB000/* PINC3 */
 #defineCONFIG_SYS_APP2_SIZE256 /* Megabytes */
-#endif
 
 /*
  * Init Local Bus Memory Controller:
@@ -178,25 +160,6 @@
  *  3   Local   GPCM8 bit  256MB  TEP2 (16 bit)
  */
 
-#if defined(CONFIG_KMTEPRO2)
-/*
- * Configuration for C2 (NVRAM) on the local bus
- */
-#define CONFIG_SYS_LBLAWBAR2_PRELIMCONFIG_SYS_APP1_BASE
-#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
-#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_APP1_BASE | \
-   BR_PS_8 | \
-   BR_MS_GPCM | \
-   BR_V)
-#define CONFIG_SYS_OR2_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP1_SIZE) | \
-   OR_GPCM_CSNT | \
-   OR_GPCM_ACS_DIV2 | \
-   OR_GPCM_XACS | \
-   OR_GPCM_SCY_2 | \
-   OR_GPCM_TRLX_SET | \
-   OR_GPCM_EHTR_SET | \
-   OR_GPCM_EAD)
-#else
 /*
  * Configuration for C2 on the local bus
  */
@@ -217,35 +180,7 @@
 OR_GPCM_TRLX_SET | \
 OR_GPCM_EHTR_CLEAR | \
 OR_GPCM_EAD)
-#endif
-
-#if defined(CONFIG_TARGET_TUXX1)
-/*
- * Configuration for C3 on the local bus
- */
-/* Access window base at PINC3 base */
-#define CONFIG_SYS_LBLAWBAR3_PRELIMCONFIG_SYS_APP2_BASE
-/* Window size: 256 MB */
-#define CONFIG_SYS_LBLAWAR3_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
-
-#define CONFIG_SYS_BR3_PRELIM  (CONFIG_SYS_APP2_BASE | \
-BR_PS_8 |  \
-BR_MS_GPCM |   \
-BR_V)
-
-#define CONFIG_SYS_OR3_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP2_SIZE) | \
-OR_GPCM_CSNT | \
-OR_GPCM_ACS_DIV2 | \
-OR_GPCM_SCY_2 | \
-OR_GPCM_TRLX_SET | \
-OR_GPCM_EHTR_CLEAR)
 
-#define CONFIG_SYS_MAMR(MxMR_GPL_x4DIS | \
-0xc000 | \
-MxMR_WLFx_2X)
-#endif
-
-#if defined(CONFIG_TARGET_KMOPTI2) || defined(CONFIG_TARGET_KMTEPR2)
 /*
  * Configuration for C3 on the local bus
  */
@@ -259,8 +194,6 @@
 OR_GPCM_SCY_4 | \
 OR_GPCM_TRLX_CLEAR | \
 OR_GPCM_EHTR_CLEAR)
-#endif
-
 /*
  * MMU Setup
  */
@@ -279,11 +212,6 @@
 BATL_GUARDEDSTORAGE)
 #define CONFIG_SYS_DBAT5U  CONFIG_SYS_IBAT5U
 
-#if defined(CONFIG_TARGET_TUGE1) || defined(CONFIG_TARGET_KMSUPX5)
-#define CONFIG_SYS_IBAT6L  (0)
-#define CONFIG_SYS_IBAT6U  (0)
-#define CONFIG_SYS_DBAT6L  CONFIG_SYS_IBAT6L
-#else
 /* APP2:  icache cacheable, but dcache-inhibit and guarded */
 #define CONFIG_SYS_IBAT6L  (CONFIG_SYS_APP2_BASE | \
 BATL_PP_RW | \
@@ -296,7 +224,6 @@
 BATL_PP_RW | \

[U-Boot] [PATCH 20/48] VME8349: Migrate to CONFIG_TARGET_VME8349

2018-09-28 Thread Mario Six
CONFIG_TARGET_VME8349 can replace CONFIG_VME8349. Hence, replace
CONFIG_VME8349 with CONFIG_TARGET_VME8349, and remove CONFIG_VME8349.

Signed-off-by: Mario Six 
---
 drivers/pci/pci_auto.c | 2 +-
 drivers/pci/pci_auto_old.c | 2 +-
 include/configs/vme8349.h  | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index a673d8ae13..f5e46842bf 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -359,7 +359,7 @@ int dm_pciauto_config_device(struct udevice *dev)
  PCI_DEV(dm_pci_get_bdf(dev)));
break;
 #endif
-#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_VME8349)
+#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349)
case PCI_CLASS_BRIDGE_OTHER:
/*
 * The host/PCI bridge 1 seems broken in 8349 - it presents
diff --git a/drivers/pci/pci_auto_old.c b/drivers/pci/pci_auto_old.c
index 90c22a08cb..6ab1b3b43f 100644
--- a/drivers/pci/pci_auto_old.c
+++ b/drivers/pci/pci_auto_old.c
@@ -376,7 +376,7 @@ int pciauto_config_device(struct pci_controller *hose, 
pci_dev_t dev)
  PCI_DEV(dev));
break;
 #endif
-#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_VME8349)
+#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349)
case PCI_CLASS_BRIDGE_OTHER:
/*
 * The host/PCI bridge 1 seems broken in 8349 - it presents
diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h
index 00939d6d58..4f2466eecf 100644
--- a/include/configs/vme8349.h
+++ b/include/configs/vme8349.h
@@ -28,7 +28,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001   /* E300 Family */
-#define CONFIG_VME8349 1   /* ESD VME8349 board specific */
 
 /* Don't enable PCI2 on vme834x - it doesn't exist physically. */
 #undef CONFIG_MPC83XX_PCI2 /* support for 2nd PCI controller */
-- 
2.16.4

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


[U-Boot] [PATCH 14/48] keymile: Unroll km/km83xx-common.h

2018-09-28 Thread Mario Six
Simplify the keymile config files once more by unrolling the km/km83xx-common.h

Signed-off-by: Mario Six 
---
 include/configs/km8360.h  | 300 +-
 include/configs/kmopti2.h | 300 +-
 include/configs/kmsupx5.h | 300 +-
 include/configs/kmtegr1.h | 300 +-
 include/configs/kmtepr2.h | 300 +-
 include/configs/kmvect1.h | 300 +-
 include/configs/suvd3.h   | 300 +-
 include/configs/tuge1.h   | 300 +-
 include/configs/tuxx1.h   | 300 +-
 9 files changed, 2691 insertions(+), 9 deletions(-)

diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 08d2ae0cbc..0d082e6488 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -38,8 +38,306 @@
 #define CONFIG_QE  /* Has QE */
 
 /* include common defines/options for all 83xx Keymile boards */
-#include "km83xx-common.h"
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2010
+ * Heiko Schocher, DENX Software Engineering, h...@denx.de.
+ */
+
+#ifndef __CONFIG_KM83XX_H
+#define __CONFIG_KM83XX_H
+
+/* include common defines/options for all Keymile boards */
+#include "km/keymile-common.h"
+#include "km/km-powerpc.h"
+
+/*
+ * System Clock Setup
+ */
+#define CONFIG_83XX_CLKIN  6600
+#define CONFIG_SYS_CLK_FREQ6600
+#define CONFIG_83XX_PCICLK 6600
+
+/*
+ * IMMR new address
+ */
+#define CONFIG_SYS_IMMR0xE000
+
+/*
+ * Bus Arbitration Configuration Register (ACR)
+ */
+#define CONFIG_SYS_ACR_PIPE_DEP 3   /* pipeline depth 4 transactions */
+#define CONFIG_SYS_ACR_RPTCNT   3   /* 4 consecutive transactions */
+#define CONFIG_SYS_ACR_APARK0   /* park bus to master (below) */
+#define CONFIG_SYS_ACR_PARKM3   /* parking master = QuiccEngine */
+
+/*
+ * DDR Setup
+ */
+#define CONFIG_SYS_DDR_BASE0x /* DDR is system memory */
+#define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_BASE
+#define CONFIG_SYS_SDRAM_BASE2 (CONFIG_SYS_SDRAM_BASE + 0x1000) /* +256M */
+
+#define CONFIG_SYS_DDR_SDRAM_BASE  CONFIG_SYS_DDR_BASE
+#define CONFIG_SYS_DDR_SDRAM_CLK_CNTL  (DDR_SDRAM_CLK_CNTL_SS_EN | \
+   DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
+
+#define CFG_83XX_DDR_USES_CS0
+
+/*
+ * Manually set up DDR parameters
+ */
+#define CONFIG_DDR_II
+#define CONFIG_SYS_DDR_SIZE2048 /* MB */
+
+/*
+ * The reserved memory
+ */
+#define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE /* start of 
monitor */
+#define CONFIG_SYS_FLASH_BASE  0xF000
+
+#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
+#define CONFIG_SYS_RAMBOOT
+#endif
+
+/* Reserve 768 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN (768 * 1024)
+
+/*
+ * Initial RAM Base Address Setup
+ */
+#define CONFIG_SYS_INIT_RAM_LOCK
+#define CONFIG_SYS_INIT_RAM_ADDR   0xE600 /* Initial RAM address */
+#define CONFIG_SYS_INIT_RAM_SIZE   0x1000 /* End of used area in RAM */
+#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
+   GENERATED_GBL_DATA_SIZE)
+
+/*
+ * Init Local Bus Memory Controller:
+ *
+ * Bank Bus Machine PortSz  Size  Device
+ *  --- --- --  -  --
+ *  0   Local   GPCM16 bit  256MB FLASH
+ *  1   Local   GPCM 8 bit  128MB GPIO/PIGGY
+ *
+ */
+/*
+ * FLASH on the Local Bus
+ */
+#define CONFIG_SYS_FLASH_CFI   /* use the Common Flash Interface */
+#define CONFIG_FLASH_CFI_DRIVER/* use the CFI driver */
+#define CONFIG_SYS_FLASH_SIZE  256 /* max FLASH size is 256M */
+#define CONFIG_SYS_FLASH_PROTECTION
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+
+#define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
+
+#define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE | \
+   BR_PS_16 | /* 16 bit port size */ \
+   BR_MS_GPCM | /* MSEL = GPCM */ \
+   BR_V)
+
+#define CONFIG_SYS_OR0_PRELIM  (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) | \
+   OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 | \
+   OR_GPCM_SCY_5 | \
+   OR_GPCM_TRLX_SET | OR_GPCM_EAD)
+
+#define CONFIG_SYS_MAX_FLASH_BANKS 1   /* max num of flash banks   */
+#define CONFIG_SYS_MAX_FLASH_SECT  512 /* max num of sects on one chip */
+#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
+
+/*
+ * PRIO1/PIGGY on the local bus CS1
+ */
+/* Window base at flash base */
+#define 

[U-Boot] [PATCH 12/48] keymile: Make distinct kmsupx5, tuge1, kmopti2, and kmtepr2 configs

2018-09-28 Thread Mario Six
The kmsupx5, tuge1, kmopti2, and kmtepr2 boards all build from the same
include config file with lots of #ifdef logic.

To ease Kconfig migration, create new config include files for these
boards, and resolve the #ifdef logic as needed.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig |  24 +++
 board/keymile/km83xx/Kconfig |  52 +++
 configs/kmopti2_defconfig|   3 +-
 configs/kmsupx5_defconfig|   3 +-
 configs/kmtepr2_defconfig|   3 +-
 configs/tuge1_defconfig  |   3 +-
 configs/tuxx1_defconfig  |   1 -
 include/configs/kmopti2.h| 307 +++
 include/configs/kmsupx5.h| 307 +++
 include/configs/kmtepr2.h| 307 +++
 include/configs/tuge1.h  | 307 +++
 include/configs/tuxx1.h  |  18 +--
 12 files changed, 1317 insertions(+), 18 deletions(-)
 create mode 100644 include/configs/kmopti2.h
 create mode 100644 include/configs/kmsupx5.h
 create mode 100644 include/configs/kmtepr2.h
 create mode 100644 include/configs/tuge1.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 59e0c9a8d0..1ebb092f0b 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -111,6 +111,30 @@ config TARGET_TUXX1
imply CMD_CRAMFS
imply FS_CRAMFS
 
+config TARGET_KMSUPX5
+   bool "Support kmsupx5"
+   select ARCH_MPC832X
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
+config TARGET_TUGE1
+   bool "Support tuge1"
+   select ARCH_MPC832X
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
+config TARGET_KMOPTI2
+   bool "Support kmopti2"
+   select ARCH_MPC832X
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
+config TARGET_KMTEPR2
+   bool "Support kmtepr2"
+   select ARCH_MPC832X
+   imply CMD_CRAMFS
+   imply FS_CRAMFS
+
 config TARGET_TQM834X
bool "Support TQM834x"
select ARCH_MPC8349
diff --git a/board/keymile/km83xx/Kconfig b/board/keymile/km83xx/Kconfig
index d52ee9117b..0c4fa0b7fd 100644
--- a/board/keymile/km83xx/Kconfig
+++ b/board/keymile/km83xx/Kconfig
@@ -62,3 +62,55 @@ config SYS_CONFIG_NAME
default "tuxx1"
 
 endif
+
+if TARGET_KMSUPX5
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmsupx5"
+
+endif
+
+if TARGET_TUGE1
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "tuge1"
+
+endif
+
+if TARGET_KMOPTI2
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmopti2"
+
+endif
+
+if TARGET_KMTEPR2
+
+config SYS_BOARD
+   default "km83xx"
+
+config SYS_VENDOR
+   default "keymile"
+
+config SYS_CONFIG_NAME
+   default "kmtepr2"
+
+endif
diff --git a/configs/kmopti2_defconfig b/configs/kmopti2_defconfig
index 5f68f062dd..43b7e7c62f 100644
--- a/configs/kmopti2_defconfig
+++ b/configs/kmopti2_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_TUXX1=y
+CONFIG_TARGET_KMOPTI2=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="KMOPTI2"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/configs/kmsupx5_defconfig b/configs/kmsupx5_defconfig
index 98de2e873a..1b92c6e6a0 100644
--- a/configs/kmsupx5_defconfig
+++ b/configs/kmsupx5_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_TUXX1=y
+CONFIG_TARGET_KMSUPX5=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="KMSUPX5"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/configs/kmtepr2_defconfig b/configs/kmtepr2_defconfig
index 46dcb379cd..f62f7c2f3f 100644
--- a/configs/kmtepr2_defconfig
+++ b/configs/kmtepr2_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_TUXX1=y
+CONFIG_TARGET_KMTEPR2=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="KMTEPR2"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/configs/tuge1_defconfig b/configs/tuge1_defconfig
index 1c67bc0c15..e8603888d2 100644
--- a/configs/tuge1_defconfig
+++ b/configs/tuge1_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xF000
 CONFIG_MPC83xx=y
-CONFIG_TARGET_TUXX1=y
+CONFIG_TARGET_TUGE1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="TUGE1"
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_R=y
diff --git a/configs/tuxx1_defconfig b/configs/tuxx1_defconfig
index de22b0b5ea..40cfe71047 100644
--- a/configs/tuxx1_defconfig

[U-Boot] [PATCH 23/48] powerpc: Add LSDMR config values

2018-09-28 Thread Mario Six
The LSDMR_* macros are used to configure the system bus on MPC83xx.

A few of the possible LSDMR_* macros were never defined in the
respective include files. This renders the SDRAM support on the
MPC8349EMDS unusable, because it uses these undefined macros.

To make the SDRAM option work, introduce these macros into the proper
config file.

Signed-off-by: Mario Six 
---
 arch/powerpc/include/asm/fsl_lbc.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/fsl_lbc.h 
b/arch/powerpc/include/asm/fsl_lbc.h
index 3528acd627..bf352d9a56 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -428,14 +428,17 @@ void lbc_sdram_init(void);
 #define LSDMR_BSMA1516 (3 << (31 - 10))
 #define LSDMR_BSMA1617 (4 << (31 - 10))
 #define LSDMR_RFCR5(3 << (31 - 16))
+#define LSDMR_RFCR8 (5 << (31 - 16))
 #define LSDMR_RFCR16   (7 << (31 - 16))
 #define LSDMR_PRETOACT3 (3 << (31 - 19))
+#define LSDMR_PRETOACT6 (5 << (31 - 19))
 #define LSDMR_PRETOACT7(7 << (31 - 19))
 #define LSDMR_ACTTORW3 (3 << (31 - 22))
 #define LSDMR_ACTTORW7 (7 << (31 - 22))
 #define LSDMR_ACTTORW6 (6 << (31 - 22))
 #define LSDMR_BL8  (1 << (31 - 23))
 #define LSDMR_WRC2 (2 << (31 - 27))
+#define LSDMR_WRC3  (3 << (31 - 27))
 #define LSDMR_WRC4 (0 << (31 - 27))
 #define LSDMR_BUFCMD   (1 << (31 - 29))
 #define LSDMR_CL3  (3 << (31 - 31))
-- 
2.16.4

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


[U-Boot] [PATCH 25/48] MPC8349EMDS: Simplify configs

2018-09-28 Thread Mario Six
The SDRAM support now resides in a separate board variant. Hence, remove
the SDRAM option from the original board.

Signed-off-by: Mario Six 
---
 include/configs/MPC8349EMDS.h   | 76 -
 include/configs/MPC8349EMDS_SDRAM.h |  4 --
 2 files changed, 80 deletions(-)

diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h
index 2ceed48ff3..085b64a6f5 100644
--- a/include/configs/MPC8349EMDS.h
+++ b/include/configs/MPC8349EMDS.h
@@ -222,82 +222,6 @@
 #define CONFIG_SYS_LCRR_CLKDIV LCRR_CLKDIV_4
 #define CONFIG_SYS_LBC_LBCR0x
 
-/*
- * The MPC834xEA MDS for 834xE rev3.1 may not be assembled SDRAM memory.
- * if board has SRDAM on local bus, you can define CONFIG_SYS_LB_SDRAM
- */
-#undef CONFIG_SYS_LB_SDRAM
-
-#ifdef CONFIG_SYS_LB_SDRAM
-/* Local bus BR2, OR2 definition for SDRAM if soldered on the MDS board */
-/*
- * Base Register 2 and Option Register 2 configure SDRAM.
- * The SDRAM base address, CONFIG_SYS_LBC_SDRAM_BASE, is 0xf000.
- *
- * For BR2, need:
- *Base address of 0xf000 = BR[0:16] =     0
- *port-size = 32-bits = BR2[19:20] = 11
- *no parity checking = BR2[21:22] = 00
- *SDRAM for MSEL = BR2[24:26] = 011
- *Valid = BR[31] = 1
- *
- * 04812   16   20   24   28
- *     0001 1000 0110 0001 = F0001861
- */
-
-#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_LBC_SDRAM_BASE \
-   | BR_PS_32  /* 32-bit port */ \
-   | BR_MS_SDRAM   /* MSEL = SDRAM */ \
-   | BR_V) /* Valid */
-   /* 0xF0001861 */
-#define CONFIG_SYS_LBLAWBAR2_PRELIMCONFIG_SYS_LBC_SDRAM_BASE
-#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_64MB)
-
-/*
- * The SDRAM size in MB, CONFIG_SYS_LBC_SDRAM_SIZE, is 64.
- *
- * For OR2, need:
- *64MB mask for AM, OR2[0:7] =  1100
- * XAM, OR2[17:18] = 11
- *9 columns OR2[19-21] = 010
- *13 rows   OR2[23-25] = 100
- *EAD set for extra time OR[31] = 1
- *
- * 04812   16   20   24   28
- *  1100   0110 1001  0001 = FC006901
- */
-
-#define CONFIG_SYS_OR2_PRELIM  (OR_AM_64MB \
-   | OR_SDRAM_XAM \
-   | ((9 - OR_SDRAM_MIN_COLS) << OR_SDRAM_COLS_SHIFT) \
-   | ((13 - OR_SDRAM_MIN_ROWS) << OR_SDRAM_ROWS_SHIFT) \
-   | OR_SDRAM_EAD)
-   /* 0xFC006901 */
-
-   /* LB sdram refresh timer, about 6us */
-#define CONFIG_SYS_LBC_LSRT0x3200
-   /* LB refresh timer prescal, 266MHz/32 */
-#define CONFIG_SYS_LBC_MRTPR   0x2000
-
-#define CONFIG_SYS_LBC_LSDMR_COMMON(LSDMR_RFEN \
-   | LSDMR_BSMA1516\
-   | LSDMR_RFCR8   \
-   | LSDMR_PRETOACT6   \
-   | LSDMR_ACTTORW3\
-   | LSDMR_BL8 \
-   | LSDMR_WRC3\
-   | LSDMR_CL3)
-
-/*
- * SDRAM Controller configuration sequence.
- */
-#define CONFIG_SYS_LBC_LSDMR_1 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_PCHALL)
-#define CONFIG_SYS_LBC_LSDMR_2 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_ARFRSH)
-#define CONFIG_SYS_LBC_LSDMR_3 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_ARFRSH)
-#define CONFIG_SYS_LBC_LSDMR_4 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_MRW)
-#define CONFIG_SYS_LBC_LSDMR_5 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_NORMAL)
-#endif
-
 /*
  * Serial Port
  */
diff --git a/include/configs/MPC8349EMDS_SDRAM.h 
b/include/configs/MPC8349EMDS_SDRAM.h
index 2ceed48ff3..b7ed733f6c 100644
--- a/include/configs/MPC8349EMDS_SDRAM.h
+++ b/include/configs/MPC8349EMDS_SDRAM.h
@@ -224,11 +224,8 @@
 
 /*
  * The MPC834xEA MDS for 834xE rev3.1 may not be assembled SDRAM memory.
- * if board has SRDAM on local bus, you can define CONFIG_SYS_LB_SDRAM
  */
-#undef CONFIG_SYS_LB_SDRAM
 
-#ifdef CONFIG_SYS_LB_SDRAM
 /* Local bus BR2, OR2 definition for SDRAM if soldered on the MDS board */
 /*
  * Base Register 2 and Option Register 2 configure SDRAM.
@@ -296,7 +293,6 @@
 #define CONFIG_SYS_LBC_LSDMR_3 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_ARFRSH)
 #define CONFIG_SYS_LBC_LSDMR_4 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_MRW)
 #define CONFIG_SYS_LBC_LSDMR_5 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_NORMAL)
-#endif
 
 /*
  * Serial Port
-- 
2.16.4

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


[U-Boot] [PATCH 21/48] mpc83xx: Make distinct caddy2 config

2018-09-28 Thread Mario Six
vme8349.h contains two separate boards: The vme8349 itself, and the
caddy2 board. The caddy2 board is chosen by setting certain config
variables. Create a proper config file for the caddy2 board to make
Kconfig migration easier.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig |   4 +
 board/esd/vme8349/Kconfig|  13 +
 board/esd/vme8349/vme8349.c  |   8 +-
 configs/caddy2_defconfig |   3 +-
 drivers/pci/pci_auto.c   |   3 +-
 drivers/pci/pci_auto_old.c   |   3 +-
 include/configs/caddy2.h | 544 +++
 7 files changed, 570 insertions(+), 8 deletions(-)
 create mode 100644 include/configs/caddy2.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index ede98c70da..65f4583ffe 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -24,6 +24,10 @@ config TARGET_VME8349
bool "Support vme8349"
select ARCH_MPC8349
 
+config TARGET_CADDY2
+   bool "Support caddy2"
+   select ARCH_MPC8349
+
 config TARGET_MPC8308RDB
bool "Support MPC8308RDB"
select ARCH_MPC8308
diff --git a/board/esd/vme8349/Kconfig b/board/esd/vme8349/Kconfig
index b8d9432dcc..ef2af40f7e 100644
--- a/board/esd/vme8349/Kconfig
+++ b/board/esd/vme8349/Kconfig
@@ -10,3 +10,16 @@ config SYS_CONFIG_NAME
default "vme8349"
 
 endif
+
+if TARGET_CADDY2
+
+config SYS_BOARD
+   default "vme8349"
+
+config SYS_VENDOR
+   default "esd"
+
+config SYS_CONFIG_NAME
+   default "caddy2"
+
+endif
diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c
index 45ad3a83ee..a46d0b6da6 100644
--- a/board/esd/vme8349/vme8349.c
+++ b/board/esd/vme8349/vme8349.c
@@ -60,7 +60,7 @@ int dram_init(void)
 
 int checkboard(void)
 {
-#ifdef VME_CADDY2
+#ifdef CONFIG_TARGET_CADDY2
puts("Board: esd VME-CADDY/2\n");
 #else
puts("Board: esd VME-CPU/8349\n");
@@ -69,7 +69,7 @@ int checkboard(void)
return 0;
 }
 
-#ifdef VME_CADDY2
+#ifdef CONFIG_TARGET_CADDY2
 int board_eth_init(bd_t *bis)
 {
return pci_eth_init(bis);
@@ -102,7 +102,7 @@ int misc_init_r()
  * Provide SPD values for spd_sdram(). Both boards (VME-CADDY/2
  * and VME-CADDY/2) have different SDRAM configurations.
  */
-#ifdef VME_CADDY2
+#ifdef CONFIG_TARGET_CADDY2
 #define SMALL_RAM  0xff
 #define LARGE_RAM  0x00
 #else
@@ -165,7 +165,7 @@ static spd_eeprom_t default_spd_eeprom = {
SPD_VAL(0x7e, 0x1d),/* 63 */
{ 'e', 's', 'd', '-', 'g', 'm', 'b', 'h' },
SPD_VAL(0x00, 0x00),/* 72 */
-#ifdef VME_CADDY2
+#ifdef CONFIG_TARGET_CADDY2
{ "vme-caddy/2 ram   " }
 #else
{ "vme-cpu/2 ram " }
diff --git a/configs/caddy2_defconfig b/configs/caddy2_defconfig
index 4367ed0e6c..1dc30c39dd 100644
--- a/configs/caddy2_defconfig
+++ b/configs/caddy2_defconfig
@@ -1,10 +1,9 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFFF0
 CONFIG_MPC83xx=y
-CONFIG_TARGET_VME8349=y
+CONFIG_TARGET_CADDY2=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="CADDY2"
 CONFIG_BOOTDELAY=6
 CONFIG_MISC_INIT_R=y
 CONFIG_HUSH_PARSER=y
diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index f5e46842bf..1a3bf70834 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -359,7 +359,8 @@ int dm_pciauto_config_device(struct udevice *dev)
  PCI_DEV(dm_pci_get_bdf(dev)));
break;
 #endif
-#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349)
+#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349) && \
+   !defined(CONFIG_TARGET_CADDY2)
case PCI_CLASS_BRIDGE_OTHER:
/*
 * The host/PCI bridge 1 seems broken in 8349 - it presents
diff --git a/drivers/pci/pci_auto_old.c b/drivers/pci/pci_auto_old.c
index 6ab1b3b43f..b566705c9d 100644
--- a/drivers/pci/pci_auto_old.c
+++ b/drivers/pci/pci_auto_old.c
@@ -376,7 +376,8 @@ int pciauto_config_device(struct pci_controller *hose, 
pci_dev_t dev)
  PCI_DEV(dev));
break;
 #endif
-#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349)
+#if defined(CONFIG_ARCH_MPC834X) && !defined(CONFIG_TARGET_VME8349) && \
+   !defined(CONFIG_TARGET_CADDY2)
case PCI_CLASS_BRIDGE_OTHER:
/*
 * The host/PCI bridge 1 seems broken in 8349 - it presents
diff --git a/include/configs/caddy2.h b/include/configs/caddy2.h
new file mode 100644
index 00..4f2466eecf
--- /dev/null
+++ b/include/configs/caddy2.h
@@ -0,0 +1,544 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * esd vme8349 U-Boot configuration file
+ * Copyright (c) 2008, 2009 esd gmbh Hannover Germany
+ *
+ * (C) Copyright 2006-2010
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * reinhard.a...@esd-electronics.de
+ * Based on the MPC8349EMDS config.
+ */
+
+/*
+ * vme8349 board configuration file.

[U-Boot] [PATCH 24/48] mpc83xx: Make distinct MPC8349EMDS_SDRAM board

2018-09-28 Thread Mario Six
The MPC8349EMDS config file contains config options to enable SDRAM
support. To keep this ability after the Kconfig migration, create a new
MPC8349EMDS_SDRAM board that enables the SDRAM support.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig|   8 +
 board/freescale/mpc8349emds/Kconfig |  13 +
 configs/MPC8349EMDS_SDRAM_defconfig |  24 ++
 include/configs/MPC8349EMDS_SDRAM.h | 739 
 4 files changed, 784 insertions(+)
 create mode 100644 configs/MPC8349EMDS_SDRAM_defconfig
 create mode 100644 include/configs/MPC8349EMDS_SDRAM.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 65f4583ffe..0ce1aad6d0 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -67,6 +67,14 @@ config TARGET_MPC8349EMDS
select SYS_FSL_DDR_BE
select SYS_FSL_HAS_DDR2
 
+config TARGET_MPC8349EMDS_SDRAM
+   bool "Support MPC8349EMDS_SDRAM"
+   select ARCH_MPC8349
+   select BOARD_EARLY_INIT_F
+   select SYS_FSL_DDR
+   select SYS_FSL_DDR_BE
+   select SYS_FSL_HAS_DDR2
+
 config TARGET_MPC8349ITX
bool "Support MPC8349ITX"
select ARCH_MPC8349
diff --git a/board/freescale/mpc8349emds/Kconfig 
b/board/freescale/mpc8349emds/Kconfig
index 51f0b34f39..d154118079 100644
--- a/board/freescale/mpc8349emds/Kconfig
+++ b/board/freescale/mpc8349emds/Kconfig
@@ -10,3 +10,16 @@ config SYS_CONFIG_NAME
default "MPC8349EMDS"
 
 endif
+
+if TARGET_MPC8349EMDS_SDRAM
+
+config SYS_BOARD
+   default "mpc8349emds"
+
+config SYS_VENDOR
+   default "freescale"
+
+config SYS_CONFIG_NAME
+   default "MPC8349EMDS_SDRAM"
+
+endif
diff --git a/configs/MPC8349EMDS_SDRAM_defconfig 
b/configs/MPC8349EMDS_SDRAM_defconfig
new file mode 100644
index 00..8ec8740839
--- /dev/null
+++ b/configs/MPC8349EMDS_SDRAM_defconfig
@@ -0,0 +1,24 @@
+CONFIG_PPC=y
+CONFIG_SYS_TEXT_BASE=0xFE00
+CONFIG_MPC83xx=y
+CONFIG_TARGET_MPC8349EMDS_SDRAM=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_STDOUT_VIA_ALIAS=y
+CONFIG_BOOTDELAY=6
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_IMLS=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_DATE=y
+# CONFIG_MMC is not set
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_PHY_MARVELL=y
+CONFIG_NETDEVICES=y
+CONFIG_TSEC_ENET=y
+# CONFIG_PCI is not set
+CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
+CONFIG_MPC8XXX_SPI=y
+CONFIG_OF_LIBFDT=y
diff --git a/include/configs/MPC8349EMDS_SDRAM.h 
b/include/configs/MPC8349EMDS_SDRAM.h
new file mode 100644
index 00..2ceed48ff3
--- /dev/null
+++ b/include/configs/MPC8349EMDS_SDRAM.h
@@ -0,0 +1,739 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2006-2010
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ */
+
+/*
+ * mpc8349emds board configuration file
+ *
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_E3001   /* E300 Family */
+
+#define CONFIG_PCI_66M
+#ifdef CONFIG_PCI_66M
+#define CONFIG_83XX_CLKIN  6600/* in Hz */
+#else
+#define CONFIG_83XX_CLKIN  3300/* in Hz */
+#endif
+
+#ifdef CONFIG_PCISLAVE
+#define CONFIG_83XX_PCICLK /* in Hz */
+#endif /* CONFIG_PCISLAVE */
+
+#ifndef CONFIG_SYS_CLK_FREQ
+#ifdef CONFIG_PCI_66M
+#define CONFIG_SYS_CLK_FREQ6600
+#define HRCWL_CSB_TO_CLKIN HRCWL_CSB_TO_CLKIN_4X1
+#else
+#define CONFIG_SYS_CLK_FREQ3300
+#define HRCWL_CSB_TO_CLKIN HRCWL_CSB_TO_CLKIN_8X1
+#endif
+#endif
+
+#define CONFIG_SYS_IMMR0xE000
+
+#undef CONFIG_SYS_DRAM_TEST/* memory test, takes time */
+#define CONFIG_SYS_MEMTEST_START   0x  /* memtest region */
+#define CONFIG_SYS_MEMTEST_END 0x0010
+
+/*
+ * DDR Setup
+ */
+#define CONFIG_DDR_ECC /* support DDR ECC function */
+#define CONFIG_DDR_ECC_CMD /* use DDR ECC user commands */
+#define CONFIG_SPD_EEPROM  /* use SPD EEPROM for DDR setup*/
+
+/*
+ * SYS_FSL_DDR2 is selected in Kconfig to use unified DDR driver
+ * unselect it to use old spd_sdram.c
+ */
+#define CONFIG_SYS_SPD_BUS_NUM 0
+#define SPD_EEPROM_ADDRESS10x52
+#define SPD_EEPROM_ADDRESS20x51
+#define CONFIG_DIMM_SLOTS_PER_CTLR 2
+#define CONFIG_CHIP_SELECTS_PER_CTRL   (2 * CONFIG_DIMM_SLOTS_PER_CTLR)
+#define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
+#define CONFIG_MEM_INIT_VALUE  0xDeadBeef
+
+/*
+ * 32-bit data path mode.
+ *
+ * Please note that using this mode for devices with the real density of 64-bit
+ * effectively reduces the amount of available memory due to the effect of
+ * wrapping around while translating address to row/columns, for example in the
+ * 256MB module the upper 128MB get aliased with contents of the lower
+ * 128MB); normally this define should be used for devices with real 32-bit
+ * data path.
+ */
+#undef CONFIG_DDR_32BIT
+
+#define CONFIG_SYS_DDR_BASE0x0

[U-Boot] [PATCH 32/48] MPC8313ERDB: Remove CONFIG_MPC8313ERDB

2018-09-28 Thread Mario Six
CONFIG_MPC8313ERDB is unused, and
TARGET_MPC8313ERDB_NAND/TARGET_MPC8313ERDB_NOR Kconfig could replace it.

Hence, get rid of CONFIG_MPC8313ERDB.

Signed-off-by: Mario Six 
---
 include/configs/MPC8313ERDB_NAND.h | 1 -
 include/configs/MPC8313ERDB_NOR.h  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/configs/MPC8313ERDB_NAND.h 
b/include/configs/MPC8313ERDB_NAND.h
index e17c632f3a..d8d8c8e68a 100644
--- a/include/configs/MPC8313ERDB_NAND.h
+++ b/include/configs/MPC8313ERDB_NAND.h
@@ -13,7 +13,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001
-#define CONFIG_MPC8313ERDB 1
 
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
diff --git a/include/configs/MPC8313ERDB_NOR.h 
b/include/configs/MPC8313ERDB_NOR.h
index 8d8482d00f..03420a181c 100644
--- a/include/configs/MPC8313ERDB_NOR.h
+++ b/include/configs/MPC8313ERDB_NOR.h
@@ -13,7 +13,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001
-#define CONFIG_MPC8313ERDB 1
 
 #ifndef CONFIG_SYS_MONITOR_BASE
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE/* start of 
monitor */
-- 
2.16.4

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


[U-Boot] [PATCH 31/48] strider: Migrate to CONFIG_TARGET_STRIDER

2018-09-28 Thread Mario Six
Use the proper CONFIG_TARGET_STRIDER Kconfig option to replace the
CONFIG_STRIDER ad-hoc config option.

Signed-off-by: Mario Six 
---
 board/gdsys/common/Makefile  | 4 ++--
 board/gdsys/mpc8308/Makefile | 2 +-
 include/configs/strider.h| 1 -
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile
index 91d446741c..aa1219a2e2 100644
--- a/board/gdsys/common/Makefile
+++ b/board/gdsys/common/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o phy.o ch7301.o
 obj-$(CONFIG_DLVISION_10G) += osd.o dp501.o
 obj-$(CONFIG_CONTROLCENTERD) += dp501.o
 obj-$(CONFIG_TARGET_HRCON) += osd.o mclink.o dp501.o phy.o ioep-fpga.o 
fanctrl.o
-obj-$(CONFIG_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7301.o
-obj-$(CONFIG_STRIDER) += fanctrl.o
+obj-$(CONFIG_TARGET_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o 
ch7301.o
+obj-$(CONFIG_TARGET_STRIDER) += fanctrl.o
 obj-$(CONFIG_STRIDER_CON) += osd.o
 obj-$(CONFIG_STRIDER_CON_DP) += osd.o
diff --git a/board/gdsys/mpc8308/Makefile b/board/gdsys/mpc8308/Makefile
index f29376fc9e..dc579479f9 100644
--- a/board/gdsys/mpc8308/Makefile
+++ b/board/gdsys/mpc8308/Makefile
@@ -5,4 +5,4 @@
 
 obj-y := mpc8308.o sdram.o
 obj-$(CONFIG_TARGET_HRCON) += hrcon.o
-obj-$(CONFIG_STRIDER) += strider.o
+obj-$(CONFIG_TARGET_STRIDER) += strider.o
diff --git a/include/configs/strider.h b/include/configs/strider.h
index 9a025b255f..121edd7745 100644
--- a/include/configs/strider.h
+++ b/include/configs/strider.h
@@ -13,7 +13,6 @@
  */
 #define CONFIG_E3001 /* E300 family */
 #define CONFIG_MPC83xx 1 /* MPC83xx family */
-#define CONFIG_STRIDER 1 /* STRIDER board specific */
 
 #define CONFIG_SYS_FSL_ESDHC_ADDR  CONFIG_SYS_MPC83xx_ESDHC_ADDR
 
-- 
2.16.4

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


[U-Boot] [PATCH 30/48] hrcom: Migrate to CONFIG_TARGET_HRCON

2018-09-28 Thread Mario Six
Use the proper CONFIG_TARGET_HRCON Kconfig option to replace
the CONFIG_HRCON ad-hoc config option.

Signed-off-by: Mario Six 
---
 board/gdsys/common/Makefile  | 2 +-
 board/gdsys/mpc8308/Makefile | 2 +-
 include/configs/hrcon.h  | 1 -
 include/gdsys_fpga.h | 2 +-
 4 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile
index 698ea3b02b..91d446741c 100644
--- a/board/gdsys/common/Makefile
+++ b/board/gdsys/common/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_IO64) += miiphybb.o
 obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o phy.o ch7301.o
 obj-$(CONFIG_DLVISION_10G) += osd.o dp501.o
 obj-$(CONFIG_CONTROLCENTERD) += dp501.o
-obj-$(CONFIG_HRCON) += osd.o mclink.o dp501.o phy.o ioep-fpga.o fanctrl.o
+obj-$(CONFIG_TARGET_HRCON) += osd.o mclink.o dp501.o phy.o ioep-fpga.o 
fanctrl.o
 obj-$(CONFIG_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7301.o
 obj-$(CONFIG_STRIDER) += fanctrl.o
 obj-$(CONFIG_STRIDER_CON) += osd.o
diff --git a/board/gdsys/mpc8308/Makefile b/board/gdsys/mpc8308/Makefile
index 60d2232573..f29376fc9e 100644
--- a/board/gdsys/mpc8308/Makefile
+++ b/board/gdsys/mpc8308/Makefile
@@ -4,5 +4,5 @@
 # Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eib...@gdsys.cc
 
 obj-y := mpc8308.o sdram.o
-obj-$(CONFIG_HRCON) += hrcon.o
+obj-$(CONFIG_TARGET_HRCON) += hrcon.o
 obj-$(CONFIG_STRIDER) += strider.o
diff --git a/include/configs/hrcon.h b/include/configs/hrcon.h
index da0b0f5014..bcf5692578 100644
--- a/include/configs/hrcon.h
+++ b/include/configs/hrcon.h
@@ -13,7 +13,6 @@
  */
 #define CONFIG_E3001 /* E300 family */
 #define CONFIG_MPC83xx 1 /* MPC83xx family */
-#define CONFIG_HRCON   1 /* HRCON board specific */
 
 #define CONFIG_SYS_FSL_ESDHC_ADDR  CONFIG_SYS_MPC83xx_ESDHC_ADDR
 
diff --git a/include/gdsys_fpga.h b/include/gdsys_fpga.h
index db4424d3f8..e9fb4b88b5 100644
--- a/include/gdsys_fpga.h
+++ b/include/gdsys_fpga.h
@@ -161,7 +161,7 @@ struct ihs_fpga {
 };
 #endif
 
-#if defined(CONFIG_HRCON) || defined(CONFIG_STRIDER_CON_DP)
+#if defined(CONFIG_TARGET_HRCON) || defined(CONFIG_STRIDER_CON_DP)
 struct ihs_fpga {
u16 reflection_low; /* 0x */
u16 versions;   /* 0x0002 */
-- 
2.16.4

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


[U-Boot] [PATCH 28/48] MPC832XEMDS: Migrate to CONFIG_TARGET_MPC832XEMDS

2018-09-28 Thread Mario Six
Use the proper CONFIG_TARGET_MPC832XEMDS Kconfig option to replace the
CONFIG_MPC832XEMDS ad-hoc config option.

Signed-off-by: Mario Six 
---
 board/freescale/common/pq-mds-pib.c | 6 +++---
 include/configs/MPC832XEMDS.h   | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/board/freescale/common/pq-mds-pib.c 
b/board/freescale/common/pq-mds-pib.c
index d152a7821f..ae66039857 100644
--- a/board/freescale/common/pq-mds-pib.c
+++ b/board/freescale/common/pq-mds-pib.c
@@ -36,7 +36,7 @@ int pib_init(void)
i2c_write(0x26, 0x6, 1, &val8, 1);
val8 = 0x34;
i2c_write(0x26, 0x7, 1, &val8, 1);
-#if defined(CONFIG_MPC832XEMDS)
+#if defined(CONFIG_TARGET_MPC832XEMDS)
val8 = 0xf9;/* PMC2, PMC3 slot to PCI bus */
 #else
val8 = 0xf3;/* PMC1, PMC2, PMC3 slot to PCI bus */
@@ -55,7 +55,7 @@ int pib_init(void)
 
eieio();
 
-#if defined(CONFIG_MPC832XEMDS)
+#if defined(CONFIG_TARGET_MPC832XEMDS)
printf("PCI 32bit bus on PMC2 &PMC3\n");
 #else
printf("PCI 32bit bus on PMC1 & PMC2 &PMC3\n");
@@ -76,7 +76,7 @@ int pib_init(void)
eieio();
 
printf("QOC3 ATM card on PMC0\n");
-#elif defined(CONFIG_MPC832XEMDS)
+#elif defined(CONFIG_TARGET_MPC832XEMDS)
val8 = 0;
i2c_write(0x26, 0x7, 1, &val8, 1);
val8 = 0xf7;
diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h
index ff8692e9ca..a4047513d8 100644
--- a/include/configs/MPC832XEMDS.h
+++ b/include/configs/MPC832XEMDS.h
@@ -11,7 +11,6 @@
  */
 #define CONFIG_E3001   /* E300 family */
 #define CONFIG_QE  1   /* Has QE */
-#define CONFIG_MPC832XEMDS 1   /* MPC832XEMDS board specific */
 
 /*
  * System Clock Setup
-- 
2.16.4

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


[U-Boot] [PATCH 33/48] MPC8315ERDB: Remove CONFIG_MPC8315ERDB

2018-09-28 Thread Mario Six
CONFIG_MPC8315ERDB is unused, and TARGET_MPC8315ERDB could replace it.

Hence, get rid of CONFIG_MPC8315ERDB.

Signed-off-by: Mario Six 
---
 include/configs/MPC8315ERDB.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h
index 7607704411..dd60ce8538 100644
--- a/include/configs/MPC8315ERDB.h
+++ b/include/configs/MPC8315ERDB.h
@@ -22,7 +22,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001 /* E300 family */
-#define CONFIG_MPC8315ERDB 1 /* MPC8315ERDB board specific */
 
 /*
  * System Clock Setup
-- 
2.16.4

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


[U-Boot] [PATCH 47/48] sbc8349: Remove SDRAM functionality

2018-09-28 Thread Mario Six
The MPC8349EMDS configuration was the basis for the sbc8349, so it also
contains its SDRAM option.

Since
* the SDRAM has to be soldered onto the board,
* the sbc8349 never used the support, and
* the support never worked (see previous patch fixing it),

we can assume that the support on the sbc8349 is an artifact created by
copying the MPC8349EMDS config wholesome.

Hence, instead of creating a separate sbc8349 config that supports
SDRAM, we can remove the SDRAM option for this board.

Should it be needed in the future, it can be copied from the new
MPC8349EMDS_SDRAM board.

Signed-off-by: Mario Six 
---
 include/configs/sbc8349.h | 67 ---
 1 file changed, 67 deletions(-)

diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h
index 07241559f6..406b7ba63e 100644
--- a/include/configs/sbc8349.h
+++ b/include/configs/sbc8349.h
@@ -145,73 +145,6 @@
 
 #undef CONFIG_SYS_LB_SDRAM /* if board has SDRAM on local bus */
 
-#ifdef CONFIG_SYS_LB_SDRAM
-/* Local bus BR2, OR2 definition for SDRAM if soldered on the board*/
-/*
- * Base Register 2 and Option Register 2 configure SDRAM.
- * The SDRAM base address, CONFIG_SYS_LBC_SDRAM_BASE, is 0xf000.
- *
- * For BR2, need:
- *Base address of 0xf000 = BR[0:16] =     0
- *port-size = 32-bits = BR2[19:20] = 11
- *no parity checking = BR2[21:22] = 00
- *SDRAM for MSEL = BR2[24:26] = 011
- *Valid = BR[31] = 1
- *
- * 04812   16   20   24   28
- *     0001 1000 0110 0001 = F0001861
- */
-
-#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_LBC_SDRAM_BASE \
-   | BR_PS_32 \
-   | BR_MS_SDRAM \
-   | BR_V)
-   /* 0xF0001861 */
-/*
- * The SDRAM size in MB, CONFIG_SYS_LBC_SDRAM_SIZE, is 64.
- *
- * For OR2, need:
- *64MB mask for AM, OR2[0:7] =  1100
- * XAM, OR2[17:18] = 11
- *9 columns OR2[19-21] = 010
- *13 rows   OR2[23-25] = 100
- *EAD set for extra time OR[31] = 1
- *
- * 04812   16   20   24   28
- *  1100   0110 1001  0001 = FC006901
- */
-
-#define CONFIG_SYS_OR2_PRELIM  (OR_AM_64MB \
-   | OR_SDRAM_XAM \
-   | ((9 - OR_SDRAM_MIN_COLS) << OR_SDRAM_COLS_SHIFT) \
-   | ((13 - OR_SDRAM_MIN_ROWS) << OR_SDRAM_ROWS_SHIFT) \
-   | OR_SDRAM_EAD)
-   /* 0xFC006901 */
-
-   /* LB sdram refresh timer, about 6us */
-#define CONFIG_SYS_LBC_LSRT0x3200
-   /* LB refresh timer prescal, 266MHz/32 */
-#define CONFIG_SYS_LBC_MRTPR   0x2000
-
-#define CONFIG_SYS_LBC_LSDMR_COMMON(LSDMR_RFEN \
-   | LSDMR_BSMA1516 \
-   | LSDMR_RFCR8 \
-   | LSDMR_PRETOACT6 \
-   | LSDMR_ACTTORW3 \
-   | LSDMR_BL8 \
-   | LSDMR_WRC3 \
-   | LSDMR_CL3)
-
-/*
- * SDRAM Controller configuration sequence.
- */
-#define CONFIG_SYS_LBC_LSDMR_1 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_PCHALL)
-#define CONFIG_SYS_LBC_LSDMR_2 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_ARFRSH)
-#define CONFIG_SYS_LBC_LSDMR_3 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_ARFRSH)
-#define CONFIG_SYS_LBC_LSDMR_4 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_MRW)
-#define CONFIG_SYS_LBC_LSDMR_5 (CONFIG_SYS_LBC_LSDMR_COMMON | LSDMR_OP_NORMAL)
-#endif
-
 /*
  * Serial Port
  */
-- 
2.16.4

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


[U-Boot] [PATCH 29/48] MPC8349ITX: Migrate to CONFIG_TARGET_MPC8349ITX

2018-09-28 Thread Mario Six
Use the proper CONFIG_TARGET_MPC8349ITX Kconfig option to replace the
CONFIG_MPC8349ITX ad-hoc config option.

Signed-off-by: Mario Six 
---
 board/freescale/mpc8349itx/mpc8349itx.c | 2 +-
 configs/MPC8349ITX_LOWBOOT_defconfig| 1 -
 configs/MPC8349ITX_defconfig| 1 -
 include/configs/MPC8349ITX.h| 4 ++--
 4 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/board/freescale/mpc8349itx/mpc8349itx.c 
b/board/freescale/mpc8349itx/mpc8349itx.c
index 3bdec1c400..d90553384f 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -152,7 +152,7 @@ int dram_init(void)
 
 int checkboard(void)
 {
-#ifdef CONFIG_MPC8349ITX
+#ifdef CONFIG_TARGET_MPC8349ITX
puts("Board: Freescale MPC8349E-mITX\n");
 #else
puts("Board: Freescale MPC8349E-mITX-GP\n");
diff --git a/configs/MPC8349ITX_LOWBOOT_defconfig 
b/configs/MPC8349ITX_LOWBOOT_defconfig
index d740908290..acc7eb5b5a 100644
--- a/configs/MPC8349ITX_LOWBOOT_defconfig
+++ b/configs/MPC8349ITX_LOWBOOT_defconfig
@@ -4,7 +4,6 @@ CONFIG_MPC83xx=y
 CONFIG_TARGET_MPC8349ITX=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="MPC8349ITX"
 CONFIG_BOOTDELAY=6
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=:/nfsroot/rootfs 
ip=mpc8349emitx:eth0:off console=ttyS0,115200"
diff --git a/configs/MPC8349ITX_defconfig b/configs/MPC8349ITX_defconfig
index 03f20c39ae..e2b52bfee4 100644
--- a/configs/MPC8349ITX_defconfig
+++ b/configs/MPC8349ITX_defconfig
@@ -4,7 +4,6 @@ CONFIG_MPC83xx=y
 CONFIG_TARGET_MPC8349ITX=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_SYS_EXTRA_OPTIONS="MPC8349ITX"
 CONFIG_BOOTDELAY=6
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=:/nfsroot/rootfs 
ip=mpc8349emitx:eth0:off console=ttyS0,115200"
diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h
index 1b247a3a3e..76386979fb 100644
--- a/include/configs/MPC8349ITX.h
+++ b/include/configs/MPC8349ITX.h
@@ -54,7 +54,7 @@
  * On-board devices
  */
 
-#ifdef CONFIG_MPC8349ITX
+#ifdef CONFIG_TARGET_MPC8349ITX
 /* The CF card interface on the back of the board */
 #define CONFIG_COMPACT_FLASH
 #define CONFIG_VSC7385_ENET/* VSC7385 ethernet support */
@@ -646,7 +646,7 @@ boards, we say we have two, but don't display a message if 
we find only one. */
/* U-Boot image on TFTP server */
 #define CONFIG_UBOOTPATH   "u-boot.bin"
 
-#ifdef CONFIG_MPC8349ITX
+#ifdef CONFIG_TARGET_MPC8349ITX
 #define CONFIG_FDTFILE "mpc8349emitx.dtb"
 #else
 #define CONFIG_FDTFILE "mpc8349emitxgp.dtb"
-- 
2.16.4

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


[U-Boot] [PATCH 26/48] mpc8315erdb: Merge BR/OR settings

2018-09-28 Thread Mario Six
The mpc8315erdb has the option of either configuring the eLBC (enhanced
local system bus) such that

* NOR flash is the first memory bank, and NAND flash is the second
  memory bank, or
* NAND flash is the first memory bank, and NOR flash is the second
  memory bank,

by using CONFIG_SYS_NOR_{BR,OR}_PRELIM and
CONFIG_SYS_NAND_{BR,OR}_PRELIM for defining
CONFIG_SYS_{BR,OR}{0,1}_PRELIM.

After Kconfig migration, replacing some lines in the defconfig will have
the same effect.

Hence, we will not create distinct ve8313_{NOR,NAND} configs for such a small 
change.

Instead, fix the current default (NOR first, NAND second), and unroll
the CONFIG_SYS_NAND_{BR,OR}_PRELIM options. This will ease the Kconfig
migration.

Signed-off-by: Mario Six 
---
 include/configs/MPC8315ERDB.h | 40 +++-
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h
index 64967f6798..7607704411 100644
--- a/include/configs/MPC8315ERDB.h
+++ b/include/configs/MPC8315ERDB.h
@@ -194,20 +194,6 @@
 #define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_8MB)
 
-#define CONFIG_SYS_NOR_BR_PRELIM   (CONFIG_SYS_FLASH_BASE \
-   | BR_PS_16  /* 16 bit port */ \
-   | BR_MS_GPCM/* MSEL = GPCM */ \
-   | BR_V) /* valid */
-#define CONFIG_SYS_NOR_OR_PRELIM   (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
-   | OR_UPM_XAM \
-   | OR_GPCM_CSNT \
-   | OR_GPCM_ACS_DIV2 \
-   | OR_GPCM_XACS \
-   | OR_GPCM_SCY_15 \
-   | OR_GPCM_TRLX_SET \
-   | OR_GPCM_EHTR_SET \
-   | OR_GPCM_EAD)
-
 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
 /* 127 64KB sectors and 8 8KB top sectors per device */
 #define CONFIG_SYS_MAX_FLASH_SECT  135
@@ -239,13 +225,26 @@
 #define CONFIG_SYS_NAND_U_BOOT_OFFS  16384
 #define CONFIG_SYS_NAND_U_BOOT_RELOC 0x0001
 
-#define CONFIG_SYS_NAND_BR_PRELIM  (CONFIG_SYS_NAND_BASE \
+#define CONFIG_SYS_BR0_PRELIM (CONFIG_SYS_FLASH_BASE \
+   | BR_PS_16  /* 16 bit port */ \
+   | BR_MS_GPCM/* MSEL = GPCM */ \
+   | BR_V) /* valid */
+#define CONFIG_SYS_OR0_PRELIM (OR_AM_8MB \
+   | OR_UPM_XAM \
+   | OR_GPCM_CSNT \
+   | OR_GPCM_ACS_DIV2 \
+   | OR_GPCM_XACS \
+   | OR_GPCM_SCY_15 \
+   | OR_GPCM_TRLX_SET \
+   | OR_GPCM_EHTR_SET \
+   | OR_GPCM_EAD)
+#define CONFIG_SYS_BR1_PRELIM (CONFIG_SYS_NAND_BASE \
| BR_DECC_CHK_GEN   /* Use HW ECC */ \
| BR_PS_8   /* 8 bit port */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_NAND_OR_PRELIM  \
-   (P2SZ_TO_AM(CONFIG_SYS_NAND_WINDOW_SIZE) \
+#define CONFIG_SYS_OR1_PRELIM \
+   (OR_AM_32KB \
| OR_FCM_CSCT \
| OR_FCM_CST \
| OR_FCM_CHT \
@@ -254,10 +253,9 @@
| OR_FCM_EHTR)
/* 0x8396 */
 
-#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NOR_BR_PRELIM
-#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NOR_OR_PRELIM
-#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NAND_BR_PRELIM
-#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NAND_OR_PRELIM
+/* Still needed for spl_minimal.c */
+#define CONFIG_SYS_NAND_BR_PRELIM CONFIG_SYS_BR1_PRELIM
+#define CONFIG_SYS_NAND_OR_PRELIM CONFIG_SYS_OR1_PRELIM
 
 #define CONFIG_SYS_LBLAWBAR1_PRELIMCONFIG_SYS_NAND_BASE
 #define CONFIG_SYS_LBLAWAR1_PRELIM (LBLAWAR_EN | LBLAWAR_32KB)
-- 
2.16.4

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


[U-Boot] [PATCH 37/48] mpc83xx: Replace CONFIG_83XX_CLKIN in calculations

2018-09-28 Thread Mario Six
CONFIG_SYS_CLK_FREQ is the standard way to set the system clock
frequency. On MPC83xx, CONFIG_83XX_CLKIN is used for this purpose.
Hence, the obvious way is to replace CONFIG_83XX_CLKIN with
CONFIG_SYS_CLK_FREQ.

A few MPC83xx boards use the CONFIG_83XX_CLKIN variable for computing
CONFIG_SYS_NS16550_CLK. This makes it harder to replace
CONFIG_83XX_CLKIN.

But the value of the multiplicator can be read from the SPMR register.

Hence, replace the static calculations with a call to a new get_bus_freq
function, as other architectures do.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/spl_minimal.c | 8 
 include/configs/MPC8315ERDB.h  | 2 +-
 include/configs/ids8313.h  | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/spl_minimal.c 
b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
index 746f1febba..3315ee05e1 100644
--- a/arch/powerpc/cpu/mpc83xx/spl_minimal.c
+++ b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
@@ -89,3 +89,11 @@ void puts(const char *str)
while (*str)
putc(*str++);
 }
+
+ulong get_bus_freq(ulong dummy)
+{
+   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
+   u8 spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
+
+   return CONFIG_83XX_CLKIN * spmf;
+}
diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h
index dd60ce8538..8466e867bb 100644
--- a/include/configs/MPC8315ERDB.h
+++ b/include/configs/MPC8315ERDB.h
@@ -274,7 +274,7 @@
  */
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE1
-#define CONFIG_SYS_NS16550_CLK (CONFIG_83XX_CLKIN * 2)
+#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0))
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 6a222e9757..b371b3b1ba 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -315,7 +315,7 @@
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}
 #define CONFIG_SYS_NS16550_COM1(CONFIG_SYS_IMMR + 0x4500)
 #define CONFIG_SYS_NS16550_COM2(CONFIG_SYS_IMMR + 0x4600)
-#define CONFIG_SYS_NS16550_CLK (CONFIG_83XX_CLKIN * 2)
+#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0))
 
 #define CONFIG_HAS_FSL_DR_USB
 #define CONFIG_SYS_SCCR_USBDRCM3
-- 
2.16.4

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


[U-Boot] [PATCH 27/48] ve8313: Merge BR/OR settings

2018-09-28 Thread Mario Six
The ve8313 has the option of either configuring the eLBC (enhanced local system 
bus) such that

* NOR flash is the first memory bank, and NAND flash is the second memory bank, 
or
* NAND flash is the first memory bank, and NOR flash is the second memory bank,

by using CONFIG_SYS_NOR_{BR,OR}_PRELIM and
CONFIG_SYS_NAND_{BR,OR}_PRELIM for defining
CONFIG_SYS_{BR,OR}{0,1}_PRELIM.

After Kconfig migration, replacing some lines in the defconfig will have
the same effect.

Hence, we will not create distinct ve8313_{NOR,NAND} configs for such a
small change.

Instead, fix the current default (NOR first, NAND second), and unroll
the  CONFIG_SYS_NAND_{BR,OR}_PRELIM options. This will ease the Kconfig
migration

Signed-off-by: Mario Six 
---
 include/configs/ve8313.h | 39 +++
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/include/configs/ve8313.h b/include/configs/ve8313.h
index dfbebee6b2..deac6a9e60 100644
--- a/include/configs/ve8313.h
+++ b/include/configs/ve8313.h
@@ -118,18 +118,6 @@
 #define CONFIG_SYS_FLASH_EMPTY_INFO/* display empty sectors */
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE  /* buffer up multiple bytes */
 
-#define CONFIG_SYS_NOR_BR_PRELIM   (CONFIG_SYS_FLASH_BASE \
-   | BR_PS_16  /* 16 bit */ \
-   | BR_MS_GPCM/* MSEL = GPCM */ \
-   | BR_V) /* valid */
-#define CONFIG_SYS_NOR_OR_PRELIM   (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
-   | OR_GPCM_CSNT \
-   | OR_GPCM_ACS_DIV4 \
-   | OR_GPCM_SCY_5 \
-   | OR_GPCM_TRLX_SET \
-   | OR_GPCM_EAD)
-   /* 0xfe000c55 */
-
 #define CONFIG_SYS_LBLAWBAR0_PRELIMCONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_LBLAWAR0_PRELIM (LBLAWAR_EN | LBLAWAR_32MB)
 
@@ -175,24 +163,35 @@
 #define CONFIG_NAND_FSL_ELBC 1
 #define CONFIG_SYS_NAND_BLOCK_SIZE 16384
 
-#define CONFIG_SYS_NAND_BR_PRELIM  (CONFIG_SYS_NAND_BASE \
+
+#define CONFIG_SYS_BR0_PRELIM (CONFIG_SYS_FLASH_BASE \
+   | BR_PS_16  /* 16 bit */ \
+   | BR_MS_GPCM/* MSEL = GPCM */ \
+   | BR_V) /* valid */
+#define CONFIG_SYS_OR0_PRELIM (OR_AM_32MB \
+   | OR_GPCM_CSNT \
+   | OR_GPCM_ACS_DIV4 \
+   | OR_GPCM_SCY_5 \
+   | OR_GPCM_TRLX_SET \
+   | OR_GPCM_EAD)
+   /* 0xfe000c55 */
+
+#define CONFIG_SYS_BR1_PRELIM (CONFIG_SYS_NAND_BASE \
| BR_PS_8   \
| BR_DECC_CHK_GEN   \
| BR_MS_FCM \
| BR_V) /* valid */
/* 0x61000c21 */
-#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_32KB \
+#define CONFIG_SYS_OR1_PRELIM (OR_AM_32KB \
| OR_FCM_BCTLD \
| OR_FCM_CHT \
| OR_FCM_SCY_2 \
| OR_FCM_RST \
-   | OR_FCM_TRLX)
-   /* 0x90ac */
+   | OR_FCM_TRLX) /* 0x90ac */
 
-#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NOR_BR_PRELIM
-#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NOR_OR_PRELIM
-#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NAND_BR_PRELIM
-#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NAND_OR_PRELIM
+/* Still needed for spl_minimal.c */
+#define CONFIG_SYS_NAND_BR_PRELIM CONFIG_SYS_BR1_PRELIM
+#define CONFIG_SYS_NAND_OR_PRELIM CONFIG_SYS_OR1_PRELIM
 
 #define CONFIG_SYS_LBLAWBAR1_PRELIMCONFIG_SYS_NAND_BASE
 #define CONFIG_SYS_LBLAWAR1_PRELIM (LBLAWAR_EN | LBLAWAR_32KB)
-- 
2.16.4

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


[U-Boot] [PATCH 40/48] mpc83xx: pcie: Read the clock from registers

2018-09-28 Thread Mario Six
The MPC83xx DM timer driver disables arch.pciexp*_clk, and uses
clk_get_rate instead. But the legacy MPC83xx PCIe driver still uses
arch.pciexp*_clk for the clock.

Hence, read the PCIe clock from the registers in the legacy MPC83xx PCIe
driver.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/pcie.c | 39 ---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
index d3f979f3c4..b500ddd3f3 100644
--- a/arch/powerpc/cpu/mpc83xx/pcie.c
+++ b/arch/powerpc/cpu/mpc83xx/pcie.c
@@ -174,6 +174,41 @@ static void mpc83xx_pcie_register_hose(int bus, struct 
pci_region *reg,
 
 #endif /* CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES */
 
+int get_pcie_clk(int index)
+{
+   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
+   u32 pci_sync_in;
+   u8 spmf;
+   u8 clkin_div;
+   u32 sccr;
+   u32 csb_clk;
+   u32 testval;
+
+   clkin_div = ((im->clk.spmr & SPMR_CKID) >> SPMR_CKID_SHIFT);
+   sccr = im->clk.sccr;
+   pci_sync_in = CONFIG_SYS_CLK_FREQ / (1 + clkin_div);
+   spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
+   csb_clk = pci_sync_in * (1 + clkin_div) * spmf;
+
+   if (index)
+   testval = (sccr & SCCR_PCIEXP2CM) >> SCCR_PCIEXP2CM_SHIFT;
+   else
+   testval = (sccr & SCCR_PCIEXP1CM) >> SCCR_PCIEXP1CM_SHIFT;
+
+   switch (testval) {
+   case 0:
+   return 0;
+   case 1:
+   return csb_clk;
+   case 2:
+   return csb_clk / 2;
+   case 3:
+   return csb_clk / 3;
+   }
+
+   return 0;
+}
+
 static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 {
immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
@@ -269,11 +304,9 @@ static void mpc83xx_pcie_init_bus(int bus, struct 
pci_region *reg)
/* Hose configure header is memory-mapped */
hose_cfg_base = (void *)pex;
 
-   get_clocks();
/* Configure the PCIE controller core clock ratio */
out_le32(hose_cfg_base + PEX_GCLK_RATIO,
-   (((bus ? gd->arch.pciexp2_clk : gd->arch.pciexp1_clk)
-   / 100) * 16) / 333);
+   ((get_pcie_clk(bus) / 100) * 16) / 333);
udelay(100);
 
/* Do Type 1 bridge configuration */
-- 
2.16.4

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


[U-Boot] [PATCH 34/48] MPC837XEMDS: Remove CONFIG_MPC837XEMDS

2018-09-28 Thread Mario Six
CONFIG_MPC837XEMDS is unused, and TARGET_MPC837XEMDS could replace it.

Hence, get rid of CONFIG_MPC837XEMDS.

Signed-off-by: Mario Six 
---
 include/configs/MPC837XEMDS.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h
index ea009eb094..c693486d04 100644
--- a/include/configs/MPC837XEMDS.h
+++ b/include/configs/MPC837XEMDS.h
@@ -11,7 +11,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001 /* E300 family */
-#define CONFIG_MPC837XEMDS 1 /* MPC837XEMDS board specific */
 
 /*
  * System Clock Setup
-- 
2.16.4

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


[U-Boot] [PATCH 36/48] mpc83xx: Migrate legacy PCI options to Kconfig

2018-09-28 Thread Mario Six
The MPC83xx include files contain some settings of the PCI subsystem.

Migrate these to Kconfig until a proper DM PCI driver exists.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig| 26 ++
 board/freescale/mpc8349emds/pci.c   | 12 ++--
 configs/MPC8349EMDS_SDRAM_defconfig |  1 +
 configs/MPC8349EMDS_defconfig   |  1 +
 configs/sbc8349_PCI_33_defconfig|  1 +
 configs/sbc8349_PCI_66_defconfig|  1 +
 configs/vme8349_defconfig   |  1 +
 include/configs/MPC8349EMDS.h   | 11 ++-
 include/configs/MPC8349EMDS_SDRAM.h | 11 ++-
 include/configs/TQM834x.h   |  2 +-
 include/configs/caddy2.h|  8 
 include/configs/sbc8349.h   | 10 +-
 include/configs/vme8349.h   | 10 +-
 13 files changed, 44 insertions(+), 51 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 0ce1aad6d0..bd4e5c14a9 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -215,6 +215,32 @@ config ARCH_MPC8360
 config ARCH_MPC837X
bool
 
+menu "Legacy options"
+
+if ARCH_MPC8349
+
+#TODO(mario@gdsys.cc): Remove when mpc83xx PCI has been converted to DM/DT
+choice
+   prompt "PMC slot configuration"
+
+config PCI_ALL_PCI1
+   bool "All PMC slots on PCI1"
+
+config PCI_ONE_PCI1
+   bool "First PMC1 on PCI1"
+
+config PCI_TWO_PCI1
+   bool "First two PMC1 on PCI1"
+
+endchoice
+
+config PCI_64BIT
+   bool "PMC2 is 64bit"
+
+endif
+
+endmenu
+
 source "board/esd/vme8349/Kconfig"
 source "board/freescale/mpc8308rdb/Kconfig"
 source "board/freescale/mpc8313erdb/Kconfig"
diff --git a/board/freescale/mpc8349emds/pci.c 
b/board/freescale/mpc8349emds/pci.c
index a2feda855f..005190ed87 100644
--- a/board/freescale/mpc8349emds/pci.c
+++ b/board/freescale/mpc8349emds/pci.c
@@ -77,11 +77,11 @@ void pib_init(void)
i2c_write(0x26, 0x6, 1, &val8, 1);
val8 = 0x34;
i2c_write(0x26, 0x7, 1, &val8, 1);
-#if defined(PCI_64BIT)
+#if defined(CONFIG_PCI_64BIT)
val8 = 0xf4;/* PMC2:PCI1/64-bit */
-#elif defined(PCI_ALL_PCI1)
+#elif defined(CONFIG_PCI_ALL_PCI1)
val8 = 0xf3;/* PMC1:PCI1 PMC2:PCI1 PMC3:PCI1 */
-#elif defined(PCI_ONE_PCI1)
+#elif defined(CONFIG_PCI_ONE_PCI1)
val8 = 0xf9;/* PMC1:PCI1 PMC2:PCI2 PMC3:PCI2 */
 #else
val8 = 0xf5;/* PMC1:PCI1 PMC2:PCI1 PMC3:PCI2 */
@@ -98,11 +98,11 @@ void pib_init(void)
i2c_write(0x27, 0x3, 1, &val8, 1);
asm("eieio");
 
-#if defined(PCI_64BIT)
+#if defined(CONFIG_PCI_64BIT)
printf("PCI1: 64-bit on PMC2\n");
-#elif defined(PCI_ALL_PCI1)
+#elif defined(CONFIG_PCI_ALL_PCI1)
printf("PCI1: 32-bit on PMC1, PMC2, PMC3\n");
-#elif defined(PCI_ONE_PCI1)
+#elif defined(CONFIG_PCI_ONE_PCI1)
printf("PCI1: 32-bit on PMC1\n");
printf("PCI2: 32-bit on PMC2, PMC3\n");
 #else
diff --git a/configs/MPC8349EMDS_SDRAM_defconfig 
b/configs/MPC8349EMDS_SDRAM_defconfig
index 8ec8740839..4da9774f07 100644
--- a/configs/MPC8349EMDS_SDRAM_defconfig
+++ b/configs/MPC8349EMDS_SDRAM_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_MPC83xx=y
 CONFIG_TARGET_MPC8349EMDS_SDRAM=y
+CONFIG_PCI_ONE_PCI1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=6
diff --git a/configs/MPC8349EMDS_defconfig b/configs/MPC8349EMDS_defconfig
index 27bd949981..9f6dc44fea 100644
--- a/configs/MPC8349EMDS_defconfig
+++ b/configs/MPC8349EMDS_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_MPC83xx=y
 CONFIG_TARGET_MPC8349EMDS=y
+CONFIG_PCI_ONE_PCI1=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=6
diff --git a/configs/sbc8349_PCI_33_defconfig b/configs/sbc8349_PCI_33_defconfig
index 01a6c260dd..decfc94f6b 100644
--- a/configs/sbc8349_PCI_33_defconfig
+++ b/configs/sbc8349_PCI_33_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFF80
 CONFIG_MPC83xx=y
 CONFIG_TARGET_SBC8349=y
+CONFIG_PCI_64BIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="PCI_33M"
diff --git a/configs/sbc8349_PCI_66_defconfig b/configs/sbc8349_PCI_66_defconfig
index 30bb7c366f..d29a6b51f9 100644
--- a/configs/sbc8349_PCI_66_defconfig
+++ b/configs/sbc8349_PCI_66_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFF80
 CONFIG_MPC83xx=y
 CONFIG_TARGET_SBC8349=y
+CONFIG_PCI_64BIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_SYS_EXTRA_OPTIONS="PCI_66M"
diff --git a/configs/vme8349_defconfig b/configs/vme8349_defconfig
index dae53cf238..8b46074884 100644
--- a/configs/vme8349_defconfig
+++ b/configs/vme8349_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFFF0
 CONFIG_MPC83xx=y
 CONFIG_TARGET_VME8349=y
+CONFIG_PCI_64BIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=6
diff --git a/include/configs/MPC8349EMDS.h 

[U-Boot] [PATCH 35/48] MPC837XERDB: Remove CONFIG_MPC837XERDB

2018-09-28 Thread Mario Six
CONFIG_MPC837XERDB is unused, and TARGET_MPC837XERDB could replace it.

Hence, get rid of CONFIG_MPC837XERDB.

Signed-off-by: Mario Six 
---
 include/configs/MPC837XERDB.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 40824be21e..f924883da3 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -12,7 +12,6 @@
  * High Level Configuration Options
  */
 #define CONFIG_E3001 /* E300 family */
-#define CONFIG_MPC837XERDB 1
 
 #define CONFIG_HWCONFIG
 
-- 
2.16.4

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


[U-Boot] [PATCH 43/48] mpc83xx: Migrate LBLAW_* to Kconfig

2018-09-28 Thread Mario Six
The LBLAW_* values determine the window configuration of the memory
controller. Hence, they must be known at compile time, and cannot be
implemented in the DT mechanism.

Configuration of this crucial variable should still be somewhat
comfortable. Hence, make its fields configurable in Kconfig, and
assemble the final value from these.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig   |   1 +
 arch/powerpc/cpu/mpc83xx/cpu_init.c|   2 +
 arch/powerpc/cpu/mpc83xx/lblaw/Kconfig | 519 +
 arch/powerpc/cpu/mpc83xx/lblaw/lblaw.h |  55 
 arch/powerpc/cpu/mpc83xx/spl_minimal.c |   2 +
 configs/MPC8308RDB_defconfig   |  12 +
 configs/MPC8313ERDB_33_defconfig   |  16 +
 configs/MPC8313ERDB_66_defconfig   |  16 +
 configs/MPC8313ERDB_NAND_33_defconfig  |  17 ++
 configs/MPC8313ERDB_NAND_66_defconfig  |  17 ++
 configs/MPC8315ERDB_defconfig  |   8 +
 configs/MPC8323ERDB_defconfig  |   4 +
 configs/MPC832XEMDS_ATM_defconfig  |  12 +
 configs/MPC832XEMDS_HOST_33_defconfig  |  12 +
 configs/MPC832XEMDS_HOST_66_defconfig  |  12 +
 configs/MPC832XEMDS_SLAVE_defconfig|  12 +
 configs/MPC832XEMDS_defconfig  |  12 +
 configs/MPC8349EMDS_PCI64_defconfig|   8 +
 configs/MPC8349EMDS_SDRAM_defconfig|  12 +
 configs/MPC8349EMDS_SLAVE_defconfig|   8 +
 configs/MPC8349EMDS_defconfig  |   8 +
 configs/MPC8349ITXGP_defconfig |  12 +
 configs/MPC8349ITX_LOWBOOT_defconfig   |  12 +
 configs/MPC8349ITX_defconfig   |  12 +
 configs/MPC837XEMDS_HOST_defconfig |  12 +
 configs/MPC837XEMDS_SLAVE_defconfig|  12 +
 configs/MPC837XEMDS_defconfig  |  12 +
 configs/MPC837XERDB_SLAVE_defconfig|  12 +
 configs/MPC837XERDB_defconfig  |  12 +
 configs/TQM834x_defconfig  |  10 +
 configs/caddy2_defconfig   |   8 +
 configs/hrcon_defconfig|   8 +
 configs/hrcon_dh_defconfig |   8 +
 configs/ids8313_defconfig  |  17 ++
 configs/kmcoge5ne_defconfig|  12 +
 configs/kmeter1_defconfig  |  12 +
 configs/kmopti2_defconfig  |  16 +
 configs/kmsupx5_defconfig  |  12 +
 configs/kmtegr1_defconfig  |  12 +
 configs/kmtepr2_defconfig  |  16 +
 configs/kmvect1_defconfig  |  16 +
 configs/mpc8308_p1m_defconfig  |  12 +
 configs/sbc8349_PCI_33_defconfig   |   4 +
 configs/sbc8349_PCI_66_defconfig   |   4 +
 configs/sbc8349_defconfig  |   4 +
 configs/strider_con_defconfig  |   8 +
 configs/strider_con_dp_defconfig   |   8 +
 configs/strider_cpu_defconfig  |   8 +
 configs/strider_cpu_dp_defconfig   |   8 +
 configs/suvd3_defconfig|  16 +
 configs/tuge1_defconfig|  12 +
 configs/tuxx1_defconfig|  16 +
 configs/ve8313_defconfig   |   9 +
 configs/vme8349_defconfig  |   8 +
 include/configs/MPC8308RDB.h   |  10 -
 include/configs/MPC8313ERDB_NAND.h |  18 --
 include/configs/MPC8313ERDB_NOR.h  |  18 --
 include/configs/MPC8315ERDB.h  |  10 -
 include/configs/MPC8323ERDB.h  |   3 -
 include/configs/MPC832XEMDS.h  |   8 -
 include/configs/MPC8349EMDS.h  |   6 -
 include/configs/MPC8349EMDS_SDRAM.h|   8 -
 include/configs/MPC8349ITX.h   |  10 -
 include/configs/MPC837XEMDS.h  |  10 -
 include/configs/MPC837XERDB.h  |  12 -
 include/configs/TQM834x.h  |  11 -
 include/configs/caddy2.h   |   4 -
 include/configs/hrcon.h|   6 -
 include/configs/ids8313.h  |  12 -
 include/configs/kmcoge5ne.h|  10 -
 include/configs/kmeter1.h  |  10 -
 include/configs/kmopti2.h  |  13 -
 include/configs/kmsupx5.h  |  11 -
 include/configs/kmtegr1.h  |   9 -
 include/configs/kmtepr2.h  |  13 -
 include/configs/kmvect1.h  |  13 -
 include/configs/mpc8308_p1m.h  |   9 -
 include/configs/sbc8349.h  |   7 -
 include/configs/strider.h  |   6 -
 include/configs/suvd3.h|  13 -
 include/configs/tuge1.h|  11 -
 include/configs/tuxx1.h|  16 -
 include/configs/ve8313.h   |   9 -
 include/configs/vme8349.h  |   4 -
 scripts/config_whitelist.txt   |  16 -
 85 files changed, 1125 insertions(+), 316 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc83xx/lblaw/Kconfig
 create mode 100644 arch/powerpc/cpu/mpc83xx/lblaw/lblaw.h

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index f7f625aea1..8c84196b97 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -284,6 +284,7 @@ config ARCH_MPC837X
 
 source "arch/powerpc/cpu/mpc83xx/hrcw/Kconfig"
 source "arch/powerpc/cpu/mpc83xx/bats/Kconfig"
+so

[U-Boot] [PATCH 46/48] mpc83xx: Simplify BR,OR lines

2018-09-28 Thread Mario Six
Re-format all BR,OR #define lines into single lines. This makes them
harder to read, but accessible to semi-automatic replacement.

Signed-off-by: Mario Six 
---
 include/configs/MPC8308RDB.h| 46 +---
 include/configs/MPC8313ERDB_NAND.h  | 67 ---
 include/configs/MPC8313ERDB_NOR.h   | 66 --
 include/configs/MPC8315ERDB.h   | 34 --
 include/configs/MPC8323ERDB.h   | 17 ++---
 include/configs/MPC832XEMDS.h   | 70 -
 include/configs/MPC8349EMDS.h   | 32 -
 include/configs/MPC8349EMDS_SDRAM.h | 45 +---
 include/configs/MPC8349ITX.h| 60 ---
 include/configs/MPC837XEMDS.h   | 52 ++-
 include/configs/MPC837XERDB.h   | 48 +++--
 include/configs/TQM834x.h   | 19 ++
 include/configs/caddy2.h| 32 +
 include/configs/hrcon.h | 32 -
 include/configs/ids8313.h   | 47 ++---
 include/configs/kmcoge5ne.h | 55 +++--
 include/configs/kmeter1.h   | 40 ++---
 include/configs/kmopti2.h   | 53 
 include/configs/kmsupx5.h   | 43 ++-
 include/configs/kmtegr1.h   | 37 ++--
 include/configs/kmtepr2.h   | 57 +++---
 include/configs/kmvect1.h   | 46 +++-
 include/configs/mpc8308_p1m.h   | 40 ++---
 include/configs/sbc8349.h   | 18 ++
 include/configs/strider.h   | 31 
 include/configs/suvd3.h | 46 +++-
 include/configs/tuge1.h | 43 ++-
 include/configs/tuxx1.h | 60 +++
 include/configs/ve8313.h| 64 +++--
 include/configs/vme8349.h   | 32 +
 30 files changed, 304 insertions(+), 1028 deletions(-)

diff --git a/include/configs/MPC8308RDB.h b/include/configs/MPC8308RDB.h
index cc2a8afd30..51e00da62a 100644
--- a/include/configs/MPC8308RDB.h
+++ b/include/configs/MPC8308RDB.h
@@ -178,19 +178,9 @@
 #define CONFIG_SYS_FLASH_SIZE  8 /* FLASH size is 8M */
 #define CONFIG_SYS_FLASH_PROTECTION1 /* Use h/w Flash protection. */
 
-/* Window base at flash base */
-#define CONFIG_SYS_BR0_PRELIM  (CONFIG_SYS_FLASH_BASE \
-   | BR_PS_16  /* 16 bit port */ \
-   | BR_MS_GPCM/* MSEL = GPCM */ \
-   | BR_V) /* valid */
-#define CONFIG_SYS_OR0_PRELIM  (OR_AM_8MB \
-   | OR_UPM_XAM \
-   | OR_GPCM_CSNT \
-   | OR_GPCM_ACS_DIV2 \
-   | OR_GPCM_XACS \
-   | OR_GPCM_SCY_15 \
-   | OR_GPCM_TRLX_SET \
-   | OR_GPCM_EHTR_SET)
+/* FLASH */
+#define CONFIG_SYS_BR0_PRELIM  (0xFE00 | BR_PS_16 | BR_MS_GPCM | BR_V)
+#define CONFIG_SYS_OR0_PRELIM  (OR_AM_8MB | OR_UPM_XAM | OR_GPCM_CSNT | 
OR_GPCM_ACS_DIV2 | OR_GPCM_XACS | OR_GPCM_SCY_15 | OR_GPCM_TRLX_SET | 
OR_GPCM_EHTR_SET)
 
 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
 /* 127 64KB sectors and 8 8KB top sectors per device */
@@ -204,18 +194,9 @@
  */
 #define CONFIG_SYS_NAND_BASE   0xE060  /* 0xE060 */
 #define CONFIG_SYS_NAND_WINDOW_SIZE(32 * 1024) /* 0x8000 */
-#define CONFIG_SYS_BR1_PRELIM  (CONFIG_SYS_NAND_BASE \
-   | BR_DECC_CHK_GEN   /* Use HW ECC */ \
-   | BR_PS_8   /* 8 bit Port */ \
-   | BR_MS_FCM /* MSEL = FCM */ \
-   | BR_V) /* valid */
-#define CONFIG_SYS_OR1_PRELIM  (OR_AM_32KB \
-   | OR_FCM_CSCT \
-   | OR_FCM_CST \
-   | OR_FCM_CHT \
-   | OR_FCM_SCY_1 \
-   | OR_FCM_TRLX \
-   | OR_FCM_EHTR)
+/* NAND */
+#define CONFIG_SYS_BR1_PRELIM  (0xE060 | BR_DECC_CHK_GEN   | BR_PS_8 | 
BR_MS_FCM | BR_V)
+#define CONFIG_SYS_OR1_PRELIM  (OR_AM_32KB | OR_FCM_CSCT | OR_FCM_CST | 
OR_FCM_CHT | OR_FCM_SCY_1 | OR_FCM_TRLX | OR_FCM_EHTR)
/* 0x8396 */
 
 #ifdef CONFIG_VSC7385_ENET
@@ -223,18 +204,9 @@
/* VSC7385 Base address on CS2 */
 #define CONFIG_SYS_VSC7385_BASE0xF000
 #define CONFIG_SYS_VSC7385_SIZE(128 * 1024) /* 0x0

[U-Boot] [PATCH 44/48] mpc83xx: Normalize BR/OR option lines

2018-09-28 Thread Mario Six
All BR/OR option lines should have the same layout to make them easier
to migrate to Kconfig. This includes using the same option macros
everywhere.

The normalize the lines,
* replace function macros with their results, and
* replace hardcoded hex values with standard macros

Signed-off-by: Mario Six 
---
 include/configs/MPC8308RDB.h|  6 +++---
 include/configs/MPC8313ERDB_NAND.h  |  4 ++--
 include/configs/MPC8313ERDB_NOR.h   |  4 ++--
 include/configs/MPC8323ERDB.h   |  2 +-
 include/configs/MPC832XEMDS.h   |  6 +++---
 include/configs/MPC8349EMDS.h   |  2 +-
 include/configs/MPC8349EMDS_SDRAM.h |  2 +-
 include/configs/MPC8349ITX.h|  2 +-
 include/configs/MPC837XEMDS.h   |  2 +-
 include/configs/MPC837XERDB.h   |  2 +-
 include/configs/caddy2.h|  2 +-
 include/configs/hrcon.h |  4 ++--
 include/configs/ids8313.h   | 10 +-
 include/configs/kmcoge5ne.h | 12 ++--
 include/configs/kmeter1.h   |  8 
 include/configs/kmopti2.h   |  8 
 include/configs/kmsupx5.h   |  6 +++---
 include/configs/kmtegr1.h   |  6 +++---
 include/configs/kmtepr2.h   |  8 
 include/configs/kmvect1.h   |  8 
 include/configs/mpc8308_p1m.h   |  2 +-
 include/configs/sbc8349.h   |  4 ++--
 include/configs/strider.h   |  4 ++--
 include/configs/suvd3.h |  8 
 include/configs/tuge1.h |  6 +++---
 include/configs/tuxx1.h |  8 
 include/configs/vme8349.h   |  2 +-
 27 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/include/configs/MPC8308RDB.h b/include/configs/MPC8308RDB.h
index 313cf0e909..cc2a8afd30 100644
--- a/include/configs/MPC8308RDB.h
+++ b/include/configs/MPC8308RDB.h
@@ -183,7 +183,7 @@
| BR_PS_16  /* 16 bit port */ \
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_OR0_PRELIM  (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) \
+#define CONFIG_SYS_OR0_PRELIM  (OR_AM_8MB \
| OR_UPM_XAM \
| OR_GPCM_CSNT \
| OR_GPCM_ACS_DIV2 \
@@ -209,7 +209,7 @@
| BR_PS_8   /* 8 bit Port */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_OR1_PRELIM  (P2SZ_TO_AM(CONFIG_SYS_NAND_WINDOW_SIZE) \
+#define CONFIG_SYS_OR1_PRELIM  (OR_AM_32KB \
| OR_FCM_CSCT \
| OR_FCM_CST \
| OR_FCM_CHT \
@@ -228,7 +228,7 @@
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */
/* 0xF801 */
-#define CONFIG_SYS_OR2_PRELIM  (P2SZ_TO_AM(CONFIG_SYS_VSC7385_SIZE) \
+#define CONFIG_SYS_OR2_PRELIM  (OR_AM_128KB \
| OR_GPCM_CSNT \
| OR_GPCM_XACS \
| OR_GPCM_SCY_15 \
diff --git a/include/configs/MPC8313ERDB_NAND.h 
b/include/configs/MPC8313ERDB_NAND.h
index c969f8d044..0e743ea069 100644
--- a/include/configs/MPC8313ERDB_NAND.h
+++ b/include/configs/MPC8313ERDB_NAND.h
@@ -262,7 +262,7 @@
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */
/* 0xFA000801 */
-#define CONFIG_SYS_OR3_PRELIM  (P2SZ_TO_AM(CONFIG_SYS_BCSR_SIZE) \
+#define CONFIG_SYS_OR3_PRELIM  (OR_AM_32KB \
| OR_GPCM_CSNT \
| OR_GPCM_ACS_DIV2 \
| OR_GPCM_XACS \
@@ -283,7 +283,7 @@
| BR_PS_8   /* 8 bit port */ \
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */
-#define CONFIG_SYS_OR2_PRELIM  (P2SZ_TO_AM(CONFIG_SYS_VSC7385_SIZE) \
+#define CONFIG_SYS_OR2_PRELIM  (OR_AM_128KB \
| OR_GPCM_CSNT \
| OR_GPCM_XACS \
| OR_GPCM_SCY_15 \
diff --git a/include/configs/MPC8313ERDB_NOR.h 
b/include/configs/MPC8313ERDB_NOR.h
index 866ac8faf2..c1bf62e405 100644
--- a/include/configs/MPC8313ERDB_NOR.h
+++ b/include/configs/MPC8313ERDB_NOR.h
@@ -230,7 +230,7 @@
| BR_MS_GPCM/* MSEL = GPCM */ \
| BR_V) /* valid */

[U-Boot] [PATCH 39/48] mpc83xx: Kconfig: Migrate HRCW to Kconfig

2018-09-28 Thread Mario Six
The HRCW (hardware reset configuration word) is a constant that must be
hard-coded into the boot loader image. So, it must be available at
compile time, and cannot be migrated to the DT mechanism, but has to be
kept in Kconfig.

Configuration of this crucial variable should still be somewhat
comfortable. Hence, make its fields configurable in Kconfig, and
assemble the final value from these.

Signed-off-by: Mario Six 
---
 arch/powerpc/cpu/mpc83xx/Kconfig|  69 +++
 arch/powerpc/cpu/mpc83xx/hrcw/Kconfig   | 816 
 arch/powerpc/cpu/mpc83xx/hrcw/hrcw.h|  37 ++
 arch/powerpc/cpu/mpc83xx/start.S|   2 +
 board/freescale/mpc8315erdb/MAINTAINERS |   1 +
 board/freescale/mpc8349emds/MAINTAINERS |   1 +
 board/freescale/mpc8349itx/mpc8349itx.c |   2 +
 board/freescale/mpc837xemds/MAINTAINERS |   1 +
 configs/MPC8308RDB_defconfig|   7 +
 configs/MPC8313ERDB_33_defconfig|   8 +
 configs/MPC8313ERDB_66_defconfig|   7 +
 configs/MPC8313ERDB_NAND_33_defconfig   |   7 +
 configs/MPC8313ERDB_NAND_66_defconfig   |   6 +
 configs/MPC8315ERDB_defconfig   |   8 +
 configs/MPC8323ERDB_defconfig   |   6 +
 configs/MPC832XEMDS_ATM_defconfig   |   6 +
 configs/MPC832XEMDS_HOST_33_defconfig   |   6 +
 configs/MPC832XEMDS_HOST_66_defconfig   |   6 +
 configs/MPC832XEMDS_SLAVE_defconfig |   3 +
 configs/MPC832XEMDS_defconfig   |   6 +
 configs/MPC8349EMDS_PCI64_defconfig |  32 ++
 configs/MPC8349EMDS_SDRAM_defconfig |  10 +
 configs/MPC8349EMDS_SLAVE_defconfig |  12 +-
 configs/MPC8349EMDS_defconfig   |  10 +
 configs/MPC8349ITXGP_defconfig  |  10 +
 configs/MPC8349ITX_LOWBOOT_defconfig|  10 +
 configs/MPC8349ITX_defconfig|   9 +
 configs/MPC837XEMDS_HOST_defconfig  |  10 +
 configs/MPC837XEMDS_SLAVE_defconfig |  33 ++
 configs/MPC837XEMDS_defconfig   |  10 +
 configs/MPC837XERDB_SLAVE_defconfig |   7 +
 configs/MPC837XERDB_defconfig   |  10 +
 configs/TQM834x_defconfig   |   9 +
 configs/caddy2_defconfig|  10 +
 configs/hrcon_defconfig |   6 +
 configs/hrcon_dh_defconfig  |   6 +
 configs/ids8313_defconfig   |   3 +
 configs/kmcoge5ne_defconfig |   9 +
 configs/kmeter1_defconfig   |   9 +
 configs/kmopti2_defconfig   |   4 +
 configs/kmsupx5_defconfig   |   4 +
 configs/kmtegr1_defconfig   |   5 +
 configs/kmtepr2_defconfig   |   4 +
 configs/kmvect1_defconfig   |   5 +
 configs/mpc8308_p1m_defconfig   |   5 +
 configs/sbc8349_PCI_33_defconfig|  10 +
 configs/sbc8349_PCI_66_defconfig|  10 +
 configs/sbc8349_defconfig   |  10 +
 configs/strider_con_defconfig   |   5 +
 configs/strider_con_dp_defconfig|   5 +
 configs/strider_cpu_defconfig   |   5 +
 configs/strider_cpu_dp_defconfig|   5 +
 configs/suvd3_defconfig |   4 +
 configs/tuge1_defconfig |   4 +
 configs/tuxx1_defconfig |   4 +
 configs/ve8313_defconfig|   7 +
 configs/vme8349_defconfig   |  10 +
 include/configs/MPC8308RDB.h|  32 --
 include/configs/MPC8313ERDB_NAND.h  |  38 --
 include/configs/MPC8313ERDB_NOR.h   |  40 --
 include/configs/MPC8315ERDB.h   |  34 --
 include/configs/MPC8323ERDB.h   |  24 -
 include/configs/MPC832XEMDS.h   |  37 --
 include/configs/MPC8349EMDS.h   |  86 
 include/configs/MPC8349EMDS_SDRAM.h |  86 
 include/configs/MPC8349ITX.h|  39 --
 include/configs/MPC837XEMDS.h   |  42 --
 include/configs/MPC837XERDB.h   |  40 --
 include/configs/TQM834x.h   |  35 --
 include/configs/caddy2.h|  41 --
 include/configs/hrcon.h |  32 --
 include/configs/ids8313.h   |  21 -
 include/configs/kmcoge5ne.h |  19 -
 include/configs/kmeter1.h   |  19 -
 include/configs/kmopti2.h   |  22 -
 include/configs/kmsupx5.h   |  22 -
 include/configs/kmtegr1.h   |  22 -
 include/configs/kmtepr2.h   |  22 -
 include/configs/kmvect1.h   |  22 -
 include/configs/mpc8308_p1m.h   |  32 --
 include/configs/sbc8349.h   |  71 ---
 include/configs/strider.h   |  32 --
 include/configs/suvd3.h |  22 -
 include/configs/tuge1.h |  22 -
 include/configs/tuxx1.h |  22 -
 include/configs/ve8313.h|  19 -
 include/configs/vme8349.h   |  43 --
 87 files changed, 1325 insertions(+), 1039 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc83xx/hrcw/Kconfig
 create mode 100644 arch/powerpc/cpu/mpc83xx/hrcw/hrcw.h
 create mode 100644 configs/MPC8349EMDS_PCI64_defconfig
 create mode 100644 con

[U-Boot] [PATCH 45/48] tqm834x: Expand CONFIG_SYS_OR_TIMING_FLASH macro

2018-09-28 Thread Mario Six
We want to normalize all BR/OR config lines as much as possible.

The TQM834x board uses CONFIG_SYS_OR_TIMING_FLASH in a OR definition,
which we want to remove. But CONFIG_SYS_OR_TIMING_FLASH is also used
outside of the config file.

Replace these usages with the definition of the variable, so we can
remove the variable in the next patch.

Signed-off-by: Mario Six 
---
 board/tqc/tqm834x/tqm834x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c
index 7c92f4f54c..c75251e132 100644
--- a/board/tqc/tqm834x/tqm834x.c
+++ b/board/tqc/tqm834x/tqm834x.c
@@ -235,8 +235,8 @@ static int detect_num_flash_banks(void)
debug("Number of flash banks detected: %d\n", 
cfi_flash_num_flash_banks);
 
/* set OR0 and BR0 */
-   set_lbc_or(0, CONFIG_SYS_OR_TIMING_FLASH |
-  (-(total_size) & OR_GPCM_AM));
+   set_lbc_or(0, OR_GPCM_CSNT | OR_GPCM_ACS_DIV4 | OR_GPCM_SCY_5 |
+  OR_GPCM_TRLX | (-(total_size) & OR_GPCM_AM));
set_lbc_br(0, (CONFIG_SYS_FLASH_BASE & BR_BA) |
   (BR_MS_GPCM | BR_PS_32 | BR_V));
 
-- 
2.16.4

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


[U-Boot] [PATCH 38/48] mpc83xx: Get rid of CONFIG_83XX_CLKIN

2018-09-28 Thread Mario Six
MPC83xx uses CONFIG_83XX_CLKIN instead of CONFIG_SYS_CLK_FREQ to set the
system clock. To migrate the architecture, we can replace
CONFIG_83XX_CLKIN with CONFIG_SYS_CLK_FREQ.

To do this
* replace all occurrences of CONFIG_83XX_CLKIN with CONFIG_SYS_CLK_FREQ
* set CONFIG_SYS_CLK_FREQ to the old value of CONFIG_83XX_CLKIN in all
  MPC83xx config files

Signed-off-by: Mario Six 
---
 Kconfig |  2 +-
 arch/powerpc/cpu/mpc83xx/speed.c|  4 ++--
 arch/powerpc/cpu/mpc83xx/spl_minimal.c  |  2 +-
 board/freescale/mpc8349emds/MAINTAINERS |  1 +
 board/freescale/mpc837xerdb/MAINTAINERS |  1 +
 board/tqc/tqm834x/pci.c |  2 +-
 configs/MPC8308RDB_defconfig|  1 +
 configs/MPC8313ERDB_33_defconfig|  1 +
 configs/MPC8313ERDB_66_defconfig|  1 +
 configs/MPC8313ERDB_NAND_33_defconfig   |  1 +
 configs/MPC8313ERDB_NAND_66_defconfig   |  1 +
 configs/MPC8315ERDB_defconfig   |  1 +
 configs/MPC8323ERDB_defconfig   |  1 +
 configs/MPC832XEMDS_ATM_defconfig   |  1 +
 configs/MPC832XEMDS_HOST_33_defconfig   |  1 +
 configs/MPC832XEMDS_HOST_66_defconfig   |  1 +
 configs/MPC832XEMDS_SLAVE_defconfig |  1 +
 configs/MPC832XEMDS_defconfig   |  1 +
 configs/MPC8349EMDS_SDRAM_defconfig |  1 +
 configs/MPC8349EMDS_SLAVE_defconfig | 22 ++
 configs/MPC8349EMDS_defconfig   |  1 +
 configs/MPC8349ITXGP_defconfig  |  2 ++
 configs/MPC8349ITX_LOWBOOT_defconfig|  1 +
 configs/MPC8349ITX_defconfig|  1 +
 configs/MPC837XEMDS_HOST_defconfig  |  1 +
 configs/MPC837XEMDS_defconfig   |  1 +
 configs/MPC837XERDB_SLAVE_defconfig | 31 +++
 configs/MPC837XERDB_defconfig   |  2 ++
 configs/TQM834x_defconfig   |  1 +
 configs/caddy2_defconfig|  1 +
 configs/hrcon_defconfig |  1 +
 configs/hrcon_dh_defconfig  |  1 +
 configs/ids8313_defconfig   |  1 +
 configs/kmcoge5ne_defconfig |  1 +
 configs/kmeter1_defconfig   |  1 +
 configs/kmopti2_defconfig   |  1 +
 configs/kmsupx5_defconfig   |  1 +
 configs/kmtegr1_defconfig   |  1 +
 configs/kmtepr2_defconfig   |  1 +
 configs/kmvect1_defconfig   |  1 +
 configs/mpc8308_p1m_defconfig   |  1 +
 configs/sbc8349_PCI_33_defconfig|  1 +
 configs/sbc8349_PCI_66_defconfig|  1 +
 configs/sbc8349_defconfig   |  1 +
 configs/strider_con_defconfig   |  1 +
 configs/strider_con_dp_defconfig|  1 +
 configs/strider_cpu_defconfig   |  1 +
 configs/strider_cpu_dp_defconfig|  1 +
 configs/suvd3_defconfig |  1 +
 configs/tuge1_defconfig |  1 +
 configs/tuxx1_defconfig |  1 +
 configs/ve8313_defconfig|  1 +
 configs/vme8349_defconfig   |  1 +
 include/configs/MPC8308RDB.h|  6 --
 include/configs/MPC8313ERDB_NAND.h  | 17 +
 include/configs/MPC8313ERDB_NOR.h   | 15 +--
 include/configs/MPC8315ERDB.h   |  6 --
 include/configs/MPC8323ERDB.h   |  9 -
 include/configs/MPC832XEMDS.h   | 13 -
 include/configs/MPC8349EMDS.h   | 19 ++-
 include/configs/MPC8349EMDS_SDRAM.h | 19 ++-
 include/configs/MPC8349ITX.h|  7 ---
 include/configs/MPC837XEMDS.h   | 13 -
 include/configs/MPC837XERDB.h   | 14 --
 include/configs/TQM834x.h   |  3 ---
 include/configs/caddy2.h| 11 ---
 include/configs/hrcon.h |  6 --
 include/configs/ids8313.h   |  3 ---
 include/configs/kmeter1.h   |  7 ---
 include/configs/mpc8308_p1m.h   |  6 --
 include/configs/sbc8349.h   | 16 
 include/configs/strider.h   |  6 --
 include/configs/ve8313.h|  4 
 include/configs/vme8349.h   |  9 -
 74 files changed, 113 insertions(+), 208 deletions(-)
 create mode 100644 configs/MPC8349EMDS_SLAVE_defconfig
 create mode 100644 configs/MPC837XERDB_SLAVE_defconfig

diff --git a/Kconfig b/Kconfig
index 1aadf5dd2d..bef0547ba8 100644
--- a/Kconfig
+++ b/Kconfig
@@ -464,7 +464,7 @@ config SYS_TEXT_BASE
 
 
 config SYS_CLK_FREQ
-   depends on ARC || ARCH_SUNXI
+   depends on ARC || ARCH_SUNXI || MPC83xx
int "CPU clock frequency"
help
  TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 668ed27862..e870a23103 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -137,8 +137,8 @@ int get_clocks(void)
clkin_div = ((im->clk.spmr & SPMR_CKID) >> SP

[U-Boot] [PATCH 41/48] powerpc: Migrate HIGH_BATS to Kconfig

2018-09-28 Thread Mario Six
Migrate the CONFIG_HIGH_BATS variable to Kconfig.

Signed-off-by: Mario Six 
---
 arch/powerpc/Kconfig  | 6 ++
 configs/MPC8313ERDB_33_defconfig  | 1 +
 configs/MPC8313ERDB_66_defconfig  | 1 +
 configs/MPC8313ERDB_NAND_33_defconfig | 1 +
 configs/MPC8313ERDB_NAND_66_defconfig | 1 +
 configs/MPC8315ERDB_defconfig | 1 +
 configs/MPC8323ERDB_defconfig | 1 +
 configs/MPC832XEMDS_ATM_defconfig | 1 +
 configs/MPC832XEMDS_HOST_33_defconfig | 1 +
 configs/MPC832XEMDS_HOST_66_defconfig | 1 +
 configs/MPC832XEMDS_SLAVE_defconfig   | 1 +
 configs/MPC832XEMDS_defconfig | 1 +
 configs/MPC8349EMDS_PCI64_defconfig   | 1 +
 configs/MPC8349EMDS_SDRAM_defconfig   | 1 +
 configs/MPC8349EMDS_SLAVE_defconfig   | 1 +
 configs/MPC8349EMDS_defconfig | 1 +
 configs/MPC8349ITXGP_defconfig| 1 +
 configs/MPC8349ITX_LOWBOOT_defconfig  | 1 +
 configs/MPC8349ITX_defconfig  | 1 +
 configs/MPC837XEMDS_HOST_defconfig| 1 +
 configs/MPC837XEMDS_defconfig | 1 +
 configs/MPC837XERDB_defconfig | 1 +
 configs/MPC8610HPCD_defconfig | 1 +
 configs/MPC8641HPCN_36BIT_defconfig   | 1 +
 configs/MPC8641HPCN_defconfig | 1 +
 configs/TQM834x_defconfig | 1 +
 configs/caddy2_defconfig  | 1 +
 configs/ids8313_defconfig | 1 +
 configs/kmcoge5ne_defconfig   | 1 +
 configs/kmopti2_defconfig | 1 +
 configs/kmsupx5_defconfig | 1 +
 configs/kmtegr1_defconfig | 1 +
 configs/kmtepr2_defconfig | 1 +
 configs/kmvect1_defconfig | 1 +
 configs/sbc8349_PCI_33_defconfig  | 1 +
 configs/sbc8349_PCI_66_defconfig  | 1 +
 configs/sbc8349_defconfig | 1 +
 configs/sbc8641d_defconfig| 1 +
 configs/suvd3_defconfig   | 1 +
 configs/tuge1_defconfig   | 1 +
 configs/tuxx1_defconfig   | 1 +
 configs/ve8313_defconfig  | 1 +
 configs/vme8349_defconfig | 1 +
 configs/xpedite517x_defconfig | 1 +
 include/configs/MPC8313ERDB_NAND.h| 2 --
 include/configs/MPC8313ERDB_NOR.h | 2 --
 include/configs/MPC8315ERDB.h | 1 -
 include/configs/MPC8323ERDB.h | 1 -
 include/configs/MPC832XEMDS.h | 2 --
 include/configs/MPC8349EMDS.h | 1 -
 include/configs/MPC8349EMDS_SDRAM.h   | 1 -
 include/configs/MPC8349ITX.h  | 1 -
 include/configs/MPC837XEMDS.h | 1 -
 include/configs/MPC837XERDB.h | 2 --
 include/configs/MPC8610HPCD.h | 1 -
 include/configs/MPC8641HPCN.h | 1 -
 include/configs/TQM834x.h | 2 --
 include/configs/caddy2.h  | 2 --
 include/configs/ids8313.h | 1 -
 include/configs/kmcoge5ne.h   | 2 --
 include/configs/kmeter1.h | 2 --
 include/configs/kmopti2.h | 2 --
 include/configs/kmsupx5.h | 2 --
 include/configs/kmtegr1.h | 2 --
 include/configs/kmtepr2.h | 2 --
 include/configs/kmvect1.h | 2 --
 include/configs/sbc8349.h | 2 --
 include/configs/sbc8641d.h| 1 -
 include/configs/suvd3.h   | 2 --
 include/configs/tuge1.h   | 2 --
 include/configs/tuxx1.h   | 2 --
 include/configs/ve8313.h  | 2 --
 include/configs/vme8349.h | 2 --
 include/configs/xpedite517x.h | 1 -
 74 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8faef0ba9f..351449a43e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -38,6 +38,12 @@ config MPC8xx
 
 endchoice
 
+config HIGH_BATS
+   bool "Enable high BAT registers"
+   help
+ Enable BATs (block address translation registers) 4-7 on machines
+ that support them.
+
 source "arch/powerpc/cpu/mpc83xx/Kconfig"
 source "arch/powerpc/cpu/mpc85xx/Kconfig"
 source "arch/powerpc/cpu/mpc86xx/Kconfig"
diff --git a/configs/MPC8313ERDB_33_defconfig b/configs/MPC8313ERDB_33_defconfig
index 715640eecc..3cf8f53531 100644
--- a/configs/MPC8313ERDB_33_defconfig
+++ b/configs/MPC8313ERDB_33_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_SYS_CLK_FREQ=
 CONFIG_MPC83xx=y
+CONFIG_HIGH_BATS=y
 CONFIG_TARGET_MPC8313ERDB_NOR=y
 CONFIG_SYSTEM_PLL_FACTOR_5_1=y
 CONFIG_CORE_PLL_RATIO_2_1=y
diff --git a/configs/MPC8313ERDB_66_defconfig b/configs/MPC8313ERDB_66_defconfig
index 14e38a990e..d5ed946c34 100644
--- a/configs/MPC8313ERDB_66_defconfig
+++ b/configs/MPC8313ERDB_66_defconfig
@@ -2,6 +2,7 @@ CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xFE00
 CONFIG_SYS_CLK_FREQ=6667
 CONFIG_MPC83xx=y
+CONFIG_HIGH_BATS=y
 CONFIG_TARGET_MPC8313ERDB_NOR=y
 CONFIG_CORE_PLL_RATIO_2_1=y
 CONFIG_PCI_HOST_MODE_ENABLE=y
diff --git a/configs/MPC8313ERDB_NAND_33_defconfig 
b/configs/MPC8313ERDB_NAND_33_defconfig
index 08fa4ed817..55e0f529cf 100644
--- a/configs/MPC8313ERDB_NAND_33_defconfi

Re: [U-Boot] [PATCH 2/7] drivers: spi: cf_spi: migrate to DM and DT

2018-09-28 Thread Angelo Dureghello
Hi Simon,

On Thu, Sep 27, 2018 at 06:41:37AM -0700, Simon Glass wrote:
> Hi Angelo,
> 
> On 26 September 2018 at 11:53, Angelo Dureghello  wrote:
> > Hi Simon,
> >
> > thanks for the review.
> >
> > On Tue, Sep 25, 2018 at 10:42:08PM -0700, Simon Glass wrote:
> >> Hi Angelo,
> >>
> >> On 20 September 2018 at 15:07, Angelo Dureghello  wrote:
> >> > This patch converts cf_spi.c to DM and to read driver
> >> > platform data from flat devicetree.
> >> >
> >> > ---
> >> > Changes from v1:
> >> > - split into 2 patches
> >> >
> >> > Signed-off-by: Angelo Dureghello 
> >> > ---
> >> >  drivers/spi/Kconfig |  18 +-
> >> >  drivers/spi/cf_spi.c| 495 
> >> >  include/dm/platform_data/spi_coldfire.h |  25 ++
> >> >  3 files changed, 369 insertions(+), 169 deletions(-)
> >> >  create mode 100644 include/dm/platform_data/spi_coldfire.h
> >> >
> >>
> >> Good to see this.
> >>
> >> > diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> >> > index dcd719ff0a..974c5bbed8 100644
> >> > --- a/drivers/spi/Kconfig
> >> > +++ b/drivers/spi/Kconfig
> >> > @@ -80,6 +80,12 @@ config CADENCE_QSPI
> >> >   used to access the SPI NOR flash on platforms embedding this
> >> >   Cadence IP core.
> >> >
> >> > +config CF_SPI
> >> > +bool "ColdFire SPI driver"
> >> > +help
> >> > +  Enable the ColdFire SPI driver. This driver can be used on
> >> > +  some m68k SoCs.
> >> > +
> >> >  config DESIGNWARE_SPI
> >> > bool "Designware SPI driver"
> >> > help
> >> > @@ -244,18 +250,18 @@ config ZYNQMP_GQSPI
> >> >
> >> >  endif # if DM_SPI
> >> >
> >> > -config SOFT_SPI
> >> > -   bool "Soft SPI driver"
> >> > -   help
> >> > -Enable Soft SPI driver. This driver is to use GPIO simulate
> >> > -the SPI protocol.
> >>
> >> How come this is changing? That should be a separate patch.
> >>
> > I just respected Kconfig alphabetical order, SOFT_SPI is just moved after.
> 
> OK, well I do think this should be in a separate patch.
> 
this is done, ready into a v2

> >
> >> > -
> >> >  config CF_SPI
> >> > bool "ColdFire SPI driver"
> >> > help
> >> >   Enable the ColdFire SPI driver. This driver can be used on
> >> >   some m68k SoCs.
> >> >
> >> > +config SOFT_SPI
> >> > +   bool "Soft SPI driver"
> >> > +   help
> >> > +Enable Soft SPI driver. This driver is to use GPIO simulate
> >> > +the SPI protocol.
> >> > +
> >> >  config FSL_ESPI
> >> > bool "Freescale eSPI driver"
> >> > help
> >> > diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
> >> > index 522631cbbf..11a11f79c4 100644
> >> > --- a/drivers/spi/cf_spi.c
> >> > +++ b/drivers/spi/cf_spi.c
> >> > @@ -6,16 +6,27 @@
> >> >   *
> >> >   * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
> >> >   * TsiChung Liew (tsi-chung.l...@freescale.com)
> >> > + *
> >> > + * Support for device model:
> >> > + * Copyright (C) 2018 Angelo Dureghello 
> >> > + *
> >> >   */
> >> >
> >> >  #include 
> >> > +#include 
> >> > +#include 
> >> >  #include 
> >> >  #include 
> >> >  #include 
> >> > +#include 
> >> >
> >> > -struct cf_spi_slave {
> >> > +struct coldfire_spi_priv {
> >> > +#ifndef CONFIG_DM_SPI
> >> > struct spi_slave slave;
> >> > +#endif
> >> > +   struct dspi *regs;
> >> > uint baudrate;
> >> > +   int mode;
> >> > int charbit;
> >> >  };
> >> >
> >> > @@ -38,14 +49,14 @@ DECLARE_GLOBAL_DATA_PTR;
> >> >  #define SPI_MODE_MOD   0x0020
> >> >  #define SPI_DBLRATE0x0010
> >> >
> >> > -static inline struct cf_spi_slave *to_cf_spi_slave(struct spi_slave 
> >> > *slave)
> >> > -{
> >> > -   return container_of(slave, struct cf_spi_slave, slave);
> >> > -}
> >> > +/* Default values */
> >> > +#define MCF_DSPI_DEFAULT_SCK_FREQ  1000
> >> > +#define MCF_DSPI_MAX_CHIPSELECTS   4
> >> > +#define MCF_DSPI_MODE  0
> >> >
> >> > -static void cfspi_init(void)
> >> > +static void __spi_init(struct coldfire_spi_priv *cfspi)
> >> >  {
> >> > -   volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI;
> >> > +   struct dspi *dspi = cfspi->regs;
> >> >
> >> > cfspi_port_conf();  /* port configuration */
> >> >
> >> > @@ -56,125 +67,32 @@ static void cfspi_init(void)
> >> >
> >> > /* Default setting in platform configuration */
> >> >  #ifdef CONFIG_SYS_DSPI_CTAR0
> >> > -   dspi->ctar[0] = CONFIG_SYS_DSPI_CTAR0;
> >> > +   writel(CONFIG_SYS_DSPI_CTAR0, &dspi->ctar[0]);
> >>
> >> What is going on here? I think these CONFIG options are addresses? If
> >> so, they should be read from the DT, not a CONFIG.
> >>
> >
> > These are just default settings for each channel (bus), actually coming
> > from the include/configs/boardxxx.h. Their speed an mode bitfields are
> > rewritten later, with values coming from devicetree.
> > Some driver #define the default value inside the driver itself, 

Re: [U-Boot] [PATCH v3 0/4] Add Rock960 and Ficus 96Board support

2018-09-28 Thread Daniel Lezcano
On 27/09/2018 21:02, Manivannan Sadhasivam wrote:
> This patchset adds support for Rock960 and Ficus 96Boards from Vamrs.
> Since both boards share most of the configurations, a common Rock960
> family support is added with common support and the actual boards are
> based on this.
> 
> The previous version of the patchseries were adding Rock960 [1] and
> Ficus [2] board support individually, but this series fuses them
> together based on the common board support as per Linux kernel.
> 
> [1] https://patchwork.ozlabs.org/cover/963239/
> [2] https://lists.denx.de/pipermail/u-boot/2018-August/339059.html
> 
> This patchseries has been tested on Rock960 v1.2 board and expecting
> Ezequiel to do the testing for Ficus.
> 
> PS: I have explicitly removed the previous Ack's for the Ficus board
> since there has been a heavy modification done on these patches.


With this series I was able to boot the rock960 board (4GB/32GB) and
tftp load a kernel following the instructions given in the documentation.

Tested-by: Daniel Lezcano 


> Manivannan Sadhasivam (4):
>   arm: dts: rockchip: add some common pin-settings to rk3399
>   rockchip: rk3399: Add common Rock960 family from Vamrs
>   rockchip: rk3399: Add Rock960 CE board support
>   rockchip: rk3399: Add Ficus EE board support
> 
>  arch/arm/dts/Makefile |2 +
>  arch/arm/dts/rk3399-ficus.dts |   78 +
>  arch/arm/dts/rk3399-rock960.dts   |   45 +
>  arch/arm/dts/rk3399-rock960.dtsi  |  506 ++
>  .../arm/dts/rk3399-sdram-lpddr3-2GB-1600.dtsi | 1536 +
>  arch/arm/dts/rk3399.dtsi  |   55 +-
>  arch/arm/mach-rockchip/rk3399/Kconfig |   26 +
>  board/vamrs/rock960_rk3399/Kconfig|   15 +
>  board/vamrs/rock960_rk3399/MAINTAINERS|6 +
>  board/vamrs/rock960_rk3399/Makefile   |6 +
>  board/vamrs/rock960_rk3399/README |  152 ++
>  board/vamrs/rock960_rk3399/rock960-rk3399.c   |   50 +
>  configs/ficus-rk3399_defconfig|   71 +
>  configs/rock960-rk3399_defconfig  |   69 +
>  include/configs/rock960_rk3399.h  |   15 +
>  15 files changed, 2626 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/dts/rk3399-ficus.dts
>  create mode 100644 arch/arm/dts/rk3399-rock960.dts
>  create mode 100644 arch/arm/dts/rk3399-rock960.dtsi
>  create mode 100644 arch/arm/dts/rk3399-sdram-lpddr3-2GB-1600.dtsi
>  create mode 100644 board/vamrs/rock960_rk3399/Kconfig
>  create mode 100644 board/vamrs/rock960_rk3399/MAINTAINERS
>  create mode 100644 board/vamrs/rock960_rk3399/Makefile
>  create mode 100644 board/vamrs/rock960_rk3399/README
>  create mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c
>  create mode 100644 configs/ficus-rk3399_defconfig
>  create mode 100644 configs/rock960-rk3399_defconfig
>  create mode 100644 include/configs/rock960_rk3399.h
> 


-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

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


Re: [U-Boot] [PATCH] arm: socfpga: stratix10: Add generic FPGA reconfig mailbox API for S10

2018-09-28 Thread Ang, Chee Hong
On Thu, 2018-09-27 at 22:39 +0200, Marek Vasut wrote:
> On 09/27/2018 08:37 AM, Ang, Chee Hong wrote:
> > 
> > On Thu, 2018-09-27 at 08:21 +0200, Marek Vasut wrote:
> > > 
> > > On 09/27/2018 07:08 AM, Ang, Chee Hong wrote:
> > > > 
> > > > 
> > > > On Wed, 2018-09-26 at 16:53 +0200, Marek Vasut wrote:
> > > > > 
> > > > > 
> > > > > On 09/26/2018 11:03 AM, chee.hong@intel.com wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: "Ang, Chee Hong" 
> > > > > > 
> > > > > > Add a generic mailbox API for FPGA reconfig status which
> > > > > > can be
> > > > > > called by others. This new function accepts 2 different
> > > > > > mailbox
> > > > > > commands: CONFIG_STATUS or RECONFIG_STATUS.
> > > > > What "others" can call this ?
> > > > This is a common function used to check the readiness of the
> > > > FPGA.
> > > > FPGA configuration drivers will need to call this to make sure
> > > > the FPGA configuration is successfully completed and running.
> > > > These FPGA configuration drivers will be submitted soon after
> > > > this
> > > > patch.
> > > So this should be in drivers/fpga/ ?
> > Yes. There is a FPGA configuration driver under this folder. Will
> > submit soon.
> > > 
> > > 
> > > Also, don't add dead code, just submit this alongside the user of
> > > this code.
> > The reason I try to get this common function upstream is because my
> > colleague is trying to upstream socfpga dwmac driver which also
> > need to
> > call this function to check whether the soft Ip running on FPGA for
> > the
> > dwmac driver is up and running.
> SoCFPGA dwmac support is already upstream. Can you explain why it
> needs
> to query the FPGA at all ? Is the whole dwmac in the FPGA ? Or is the
> dwmac just routed through FPGA ?
dwmac driver need to call this function to access PCS (MAC PHY) which
is routed through FPGA.
> 
> > 
> > If I bundle this code alongside with my
> > FPGA configuration driver, it might take longer time to get into
> > the
> > mainline. So this common function is blocking other to upstream
> > his/her
> > code.
> I'm not really fond of accepting dead code, on which code I didn't
> even
> see and design that's unclear depends.
I understand. Can I submit another FPGA driver patchsets and refer this
patch as the dependency ? The FPGA driver patchsets is the user of the
common function.
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > Signed-off-by: Ang, Chee Hong 
> > > > > > ---
> > > > > >  arch/arm/mach-socfpga/include/mach/mailbox_s10.h |  3 +-
> > > > > >  arch/arm/mach-socfpga/mailbox_s10.c  | 48
> > > > > > 
> > > > > >  2 files changed, 50 insertions(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/arch/arm/mach-
> > > > > > socfpga/include/mach/mailbox_s10.h
> > > > > > b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> > > > > > index 81a609d..660df35 100644
> > > > > > --- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> > > > > > +++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> > > > > > @@ -140,5 +140,6 @@ int mbox_qspi_open(void);
> > > > > >  #endif
> > > > > >  
> > > > > >  int mbox_reset_cold(void);
> > > > > > -
> > > > > > +int mbox_get_fpga_config_status(u32 cmd);
> > > > > > +int mbox_get_fpga_config_status_psci(u32 cmd);
> > > > > >  #endif /* _MAILBOX_S10_H_ */
> > > > > > diff --git a/arch/arm/mach-socfpga/mailbox_s10.c
> > > > > > b/arch/arm/mach-
> > > > > > socfpga/mailbox_s10.c
> > > > > > index 0d906c3..345485c 100644
> > > > > > --- a/arch/arm/mach-socfpga/mailbox_s10.c
> > > > > > +++ b/arch/arm/mach-socfpga/mailbox_s10.c
> > > > > > @@ -342,6 +342,54 @@ int mbox_reset_cold(void)
> > > > > >     return 0;
> > > > > >  }
> > > > > >  
> > > > > > +/* Accepted commands: CONFIG_STATUS or RECONFIG_STATUS */
> > > > > > +static __always_inline int
> > > > > > mbox_get_fpga_config_status_common(u32
> > > > > > cmd)
> > > > > Why __always_inline ?
> > > > This function is needed in 2 sections. Our u-boot run in normal
> > > > code
> > > > section and '__secure' section which mainly used for PSCI
> > > > services.
> > > > Refer to the 'mbox_get_fpga_config_status()' and
> > > > 'mbox_get_fpga_config_status_psci()' below. These 2 functions
> > > > run
> > > > in 2
> > > > different sections and they need to call this function.
> > > But why does this need to be __always_inline ? The compiler can
> > > decide
> > > what's best.
> > This is dangerous. Let me explain in more details why we need this,
> > '__secure' section and normal '.code' section exist in different
> > time.
> > '.code' section no longer valid once u-boot boot to OS, but
> > '__secure'
> > section still exist after booting to OS because OS need to call
> > PSCI
> > services to achieve certain things. We need to make sure both
> > sections
> > contain the full code, therefore we need to enforce the compiler to
> > duplicate this piece of code to both sections as well. 
> How does the __always_inline help with that ?
mbox_get_fpga_c

Re: [U-Boot] [PATCH 2/3] spi: Add support for the Aspeed ast2500 SPI controllers

2018-09-28 Thread Cédric Le Goater
Hello Simon,


The Aspeed AST2500 FMC controller can handle SPI flash and NOR flash memory,
and the Aspeed AST2500 SPI Flash Controllers only SPI. If there is some 
misunderstanding on this driver, it might come from the fact it is closer 
to a SPI-NOR driver like we have in Linux, than a generic SPI driver. 
The stm32 SPI driver is somewhat similar.

Should we move it under drivers/mtd/spi/ maybe ? 

Nevertheless, I think I can improve the dependency on the spi_flash driver
and probably remove the aspeed_spi_flash struct. 


On 9/27/18 3:41 PM, Simon Glass wrote:
> Hi Cedric,
> 
> On 10 September 2018 at 07:16, Cédric Le Goater  wrote:
>> The Aspeed AST2500 SoC comes with three static memory controllers, all
>> with a similar interface :
>>
>>  * Firmware SPI Memory Controller (FMC)
>>. BMC firmware
>>. 3 chip select pins (CE0 ~ CE2)
>>. supports SPI type flash memory (CE0 ~ CE1)
>>. CE2 can be of NOR type flash but this is not supported by the
>>  driver
>>
>>  * SPI Flash Controller (SPI1 and SPI2)
>>. host firmware
>>. 2 chip select pins (CE0 ~ CE1)
>>
>> Each controller has a defined AHB window for its registers and another
>> AHB window on which all the flash devices are mapped. Each device is
>> assigned a memory range through a set of registers called the Segment
>> Address Registers.
>>
>> Devices are controlled using two different modes: the USER command
>> mode or the READ/WRITE command mode. When in USER command mode,
>> accesses to the AHB window of the SPI flash device are translated into
>> SPI command transfers. When in READ/WRITE command mode, the HW
>> generates the SPI commands depending on the setting of the CE control
>> register.
>>
>> The following driver supports the FMC and the SPI controllers with the
>> attached SPI flash devices. When the controller is probed, the driver
>> performs a read timing calibration using specific DMA control
>> registers (FMC only). The driver's primary goal is to support the
>> first device of the FMC controller on which reside U-Boot but it
>> should support the other controllers also.
>>
>> The Aspeed FMC controller automatically detects at boot time if a
>> flash device is in 4BYTE address mode and self configures to use the
>> appropriate address width. This can be a problem for the U-Boot SPI
>> Flash layer which only supports 3 byte addresses. In such a case, a
>> warning is emitted and the address width is fixed when sent on the
>> bus.
>>
>> Signed-off-by: Cédric Le Goater 
>> ---
>>  arch/arm/include/asm/arch-aspeed/spi.h | 114 
>>  drivers/spi/aspeed_spi.c   | 788 +
>>  drivers/spi/Kconfig|   8 +
>>  drivers/spi/Makefile   |   1 +
>>  4 files changed, 911 insertions(+)
>>  create mode 100644 arch/arm/include/asm/arch-aspeed/spi.h
>>  create mode 100644 drivers/spi/aspeed_spi.c
>>
>> diff --git a/arch/arm/include/asm/arch-aspeed/spi.h 
>> b/arch/arm/include/asm/arch-aspeed/spi.h
>> new file mode 100644
>> index ..9e952933e1f1
>> --- /dev/null
>> +++ b/arch/arm/include/asm/arch-aspeed/spi.h
>> @@ -0,0 +1,114 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (c) 2018, IBM Corporation.
>> + */
>> +
>> +#ifndef _ASM_ARCH_ASPEED_SPI_H
>> +#define _ASM_ARCH_ASPEED_SPI_H
>> +
>> +/* CE Type Setting Register */
>> +#define CONF_ENABLE_W2 BIT(18)
>> +#define CONF_ENABLE_W1 BIT(17)
>> +#define CONF_ENABLE_W0 BIT(16)
>> +#define CONF_FLASH_TYPE2   4
>> +#define CONF_FLASH_TYPE1   2   /* Hardwired to SPI */
>> +#define CONF_FLASH_TYPE0   0   /* Hardwired to SPI */
>> +#define  CONF_FLASH_TYPE_NOR   0x0
>> +#define  CONF_FLASH_TYPE_SPI   0x2
>> +
>> +/* CE Control Register */
>> +#define CTRL_EXTENDED2 BIT(2)  /* 32 bit addressing for SPI 
>> */
>> +#define CTRL_EXTENDED1 BIT(1)  /* 32 bit addressing for SPI 
>> */
>> +#define CTRL_EXTENDED0 BIT(0)  /* 32 bit addressing for SPI 
>> */
>> +
>> +/* Interrupt Control and Status Register */
>> +#define INTR_CTRL_DMA_STATUS   BIT(11)
>> +#define INTR_CTRL_CMD_ABORT_STATUS BIT(10)
>> +#define INTR_CTRL_WRITE_PROTECT_STATUS BIT(9)
>> +#define INTR_CTRL_DMA_EN   BIT(3)
>> +#define INTR_CTRL_CMD_ABORT_EN BIT(2)
>> +#define INTR_CTRL_WRITE_PROTECT_EN BIT(1)
>> +
>> +/* CEx Control Register */
>> +#define CE_CTRL_IO_MODE_MASK   GENMASK(30, 28)
>> +#define CE_CTRL_IO_DUAL_DATA   BIT(29)
>> +#define CE_CTRL_IO_DUAL_ADDR_DATA  (BIT(29) | BIT(28))
>> +#define CE_CTRL_CMD_SHIFT  16
>> +#define CE_CTRL_CMD_MASK   0xff
>> +#define CE_CTRL_CMD(cmd)   \
>> +   (((cmd) & CE_CTRL_CMD_MASK) << CE_CTRL_CMD_SHIFT)
>> +#define CE_CTRL_DUMMY_HIGH_SHIFT   14
>> +#define CE_CTRL_CLOCK_FREQ_SHIFT   8
>> +#def

Re: [U-Boot] [PATCH 01/48] mpc83xx: Introduce ARCH_MPC830*

2018-09-28 Thread Bin Meng
Hi Mario,

On Fri, Sep 28, 2018 at 5:59 PM Mario Six  wrote:
>
> Replace CONFIG_MPC830* with proper CONFIG_ARCH_MPC830* Kconfig options.
>
> Signed-off-by: Mario Six 
> ---
>  arch/powerpc/cpu/mpc83xx/Kconfig | 17 +
>  arch/powerpc/cpu/mpc83xx/spd_sdram.c |  2 +-
>  arch/powerpc/cpu/mpc83xx/speed.c | 38 
> ++--
>  arch/powerpc/include/asm/arch-mpc83xx/gpio.h |  2 +-
>  arch/powerpc/include/asm/fsl_lbc.h   |  2 +-
>  arch/powerpc/include/asm/global_data.h   |  6 ++---
>  arch/powerpc/include/asm/immap_83xx.h| 10 
>  arch/powerpc/include/asm/mpc8xxx_spi.h   |  2 +-
>  board/keymile/km83xx/km83xx.c|  2 +-
>  drivers/qe/qe.c  |  2 +-
>  drivers/ram/mpc83xx_sdram.c  |  4 +--
>  include/configs/MPC8308RDB.h |  2 --
>  include/configs/hrcon.h  |  2 --
>  include/configs/km/km8309-common.h   |  2 --
>  include/configs/km/km83xx-common.h   |  2 +-
>  include/configs/mpc8308_p1m.h|  2 --
>  include/configs/strider.h|  2 --
>  include/linux/immap_qe.h |  2 +-
>  include/mpc83xx.h| 24 +-
>  19 files changed, 66 insertions(+), 59 deletions(-)
>

One generic comments, shouldn't we call these CONFIG_SOC_XXX? Arch
means architecture, but they are all PowerPC architecture..

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


Re: [U-Boot] [PATCH 2/5] net: re-add support for the Faraday ftgmac100 controller

2018-09-28 Thread Cédric Le Goater
Hello Simon,

On 9/27/18 3:41 PM, Simon Glass wrote:
> Hi Cedric,
> 
> On 10 September 2018 at 07:21, Cédric Le Goater  wrote:
>> The driver is based on the previous one and adds the same support for
>> the Faraday ftgmac100 controller with MAC and MDIO bus support for
>> RGMII/RMII modes.
>>
>> Driver model support was added as well as some enhancements and fixes.
>>
>> Signed-off-by: Cédric Le Goater 
>> ---
>>  drivers/net/ftgmac100.h | 242 
>>  drivers/net/ftgmac100.c | 493 
>>  drivers/net/Kconfig |   8 +
>>  drivers/net/Makefile|   1 +
>>  4 files changed, 744 insertions(+)
>>  create mode 100644 drivers/net/ftgmac100.h
>>  create mode 100644 drivers/net/ftgmac100.c
> 
> Reviewed-by: Simon Glass 
> 
> Various minor comments below.
> 
>>
>> diff --git a/drivers/net/ftgmac100.h b/drivers/net/ftgmac100.h
>> new file mode 100644
>> index ..9a789e4d5bee
>> --- /dev/null
>> +++ b/drivers/net/ftgmac100.h
>> @@ -0,0 +1,242 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Faraday FTGMAC100 Ethernet
>> + *
>> + * (C) Copyright 2010 Faraday Technology
>> + * Po-Yu Chuang 
>> + *
>> + * (C) Copyright 2010 Andes Technology
>> + * Macpaul Lin 
>> + */
>> +
>> +#ifndef __FTGMAC100_H
>> +#define __FTGMAC100_H
>> +
>> +/* The registers offset table of ftgmac100 */
>> +struct ftgmac100 {
>> +   unsigned intisr;/* 0x00 */
>> +   unsigned intier;/* 0x04 */
>> +   unsigned intmac_madr;   /* 0x08 */
>> +   unsigned intmac_ladr;   /* 0x0c */
>> +   unsigned intmaht0;  /* 0x10 */
>> +   unsigned intmaht1;  /* 0x14 */
>> +   unsigned inttxpd;   /* 0x18 */
>> +   unsigned intrxpd;   /* 0x1c */
>> +   unsigned inttxr_badr;   /* 0x20 */
>> +   unsigned intrxr_badr;   /* 0x24 */
>> +   unsigned inthptxpd; /* 0x28 */
>> +   unsigned inthptxpd_badr;/* 0x2c */
>> +   unsigned intitc;/* 0x30 */
>> +   unsigned intaptc;   /* 0x34 */
>> +   unsigned intdblac;  /* 0x38 */
>> +   unsigned intdmafifos;   /* 0x3c */
>> +   unsigned intrevr;   /* 0x40 */
>> +   unsigned intfear;   /* 0x44 */
>> +   unsigned inttpafcr; /* 0x48 */
>> +   unsigned intrbsr;   /* 0x4c */
>> +   unsigned intmaccr;  /* 0x50 */
>> +   unsigned intmacsr;  /* 0x54 */
>> +   unsigned inttm; /* 0x58 */
>> +   unsigned intresv1;  /* 0x5c */ /* not defined in spec */
>> +   unsigned intphycr;  /* 0x60 */
>> +   unsigned intphydata;/* 0x64 */
>> +   unsigned intfcr;/* 0x68 */
>> +   unsigned intbpr;/* 0x6c */
>> +   unsigned intwolcr;  /* 0x70 */
>> +   unsigned intwolsr;  /* 0x74 */
>> +   unsigned intwfcrc;  /* 0x78 */
>> +   unsigned intresv2;  /* 0x7c */ /* not defined in spec */
>> +   unsigned intwfbm1;  /* 0x80 */
>> +   unsigned intwfbm2;  /* 0x84 */
>> +   unsigned intwfbm3;  /* 0x88 */
>> +   unsigned intwfbm4;  /* 0x8c */
>> +   unsigned intnptxr_ptr;  /* 0x90 */
>> +   unsigned inthptxr_ptr;  /* 0x94 */
>> +   unsigned intrxr_ptr;/* 0x98 */
>> +   unsigned intresv3;  /* 0x9c */ /* not defined in spec */
>> +   unsigned inttx; /* 0xa0 */
>> +   unsigned inttx_mcol_scol;   /* 0xa4 */
>> +   unsigned inttx_ecol_fail;   /* 0xa8 */
>> +   unsigned inttx_lcol_und;/* 0xac */
>> +   unsigned intrx; /* 0xb0 */
>> +   unsigned intrx_bc;  /* 0xb4 */
>> +   unsigned intrx_mc;  /* 0xb8 */
>> +   unsigned intrx_pf_aep;  /* 0xbc */
>> +   unsigned intrx_runt;/* 0xc0 */
>> +   unsigned intrx_crcer_ftl;   /* 0xc4 */
>> +   unsigned intrx_col_lost;/* 0xc8 */
>> +};
>> +
>> +/*
>> + * Interrupt status register & interrupt enable register
>> + */
>> +#define FTGMAC100_INT_RPKT_BUF BIT(0)
>> +#define FTGMAC100_INT_RPKT_FIFOBIT(1)
>> +#define FTGMAC100_INT_NO_RXBUF BIT(2)
>> +#define FTGMAC100_INT_RPKT_LOSTBIT(3)
>> +#define FTGMAC100_INT_XPKT_ETH BIT(4)
>> +#define FTGMAC100_INT_XPKT_FIFOBIT(5)
>> +#define FTGMAC100_INT_NO_NPTXBUF   BIT(6)
>> +#define FTGMAC100_INT_XPKT_LOSTBIT(7)
>> +#define FTGMAC100_INT_AHB_ERR  BIT(8)
>> +#define FTGMAC100_INT_PHYSTS_CHG   BIT(9)
>> +#define FTGMAC100_INT_NO_HPTXBUF   BIT(10)
>> +
>> +/*
>> + * Interrupt timer control register
>> + */
>> +#define FTGMAC100_ITC_RXINT_CNT(x) (((x

[U-Boot] [PATCH v3] misc: Add support for the Arm Versatile Express config bus

2018-09-28 Thread Liviu Dudau
Add support for the Arm Versatile Express config bus that is
being used for exposing various subsystems via a generic
configuration bus. This driver adds support for generating
transactions on this configuration bus and can be used by
other drivers to abstract the communication with the actual
function providers.

Signed-off-by: Liviu Dudau 
Reviewed-by: Heiko Schocher 
---

Changelog:
 - v3: Added MAINTAINERS entry and Reviewed-by tag
 - v2: removed #define DEBUG line leftover

 MAINTAINERS|   7 ++
 drivers/misc/Kconfig   |   8 +++
 drivers/misc/Makefile  |   1 +
 drivers/misc/vexpress_config.c | 128 +
 4 files changed, 144 insertions(+)
 create mode 100644 drivers/misc/vexpress_config.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ea21d59f1e..613d7b29a0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -286,6 +286,13 @@ F: arch/arm/mach-uniphier/
 F: configs/uniphier_*_defconfig
 N: uniphier
 
+ARM VERSATILE EXPRESS DRIVERS
+M: Liviu Dudau 
+S: Maintained
+T: git git://github.com/ARM-software/u-boot.git
+F: drivers/misc/vexpress_config.c
+N: vexpress
+
 ARM ZYNQ
 M: Michal Simek 
 S: Maintained
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index bfa5c91687..78dc9264f9 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -41,6 +41,14 @@ config ROCKCHIP_EFUSE
  extended (by porting the read function from the Linux kernel sources)
  to support other recent Rockchip devices.
 
+config VEXPRESS_CONFIG
+   bool "Enable support for Arm Versatile Express config bus"
+   depends on MISC
+   help
+ If you say Y here, you will get support for accessing the
+ configuration bus on the Arm Versatile Express boards via
+ a sysreg driver.
+
 config CMD_CROS_EC
bool "Enable crosec command"
depends on CROS_EC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index da4666fdfc..50b52f9aa5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -55,4 +55,5 @@ obj-$(CONFIG_STM32MP_FUSE) += stm32mp_fuse.o
 obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
 obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
 obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
+obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o
 obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
diff --git a/drivers/misc/vexpress_config.c b/drivers/misc/vexpress_config.c
new file mode 100644
index 00..9f5baa5288
--- /dev/null
+++ b/drivers/misc/vexpress_config.c
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Arm Ltd
+ * Author: Liviu Dudau 
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SYS_CFGDATA0xa0
+
+#define SYS_CFGCTRL0xa4
+#define SYS_CFGCTRL_START  BIT(31)
+#define SYS_CFGCTRL_WRITE  BIT(30)
+
+#define SYS_CFGSTAT0xa8
+#define SYS_CFGSTAT_ERRBIT(1)
+#define SYS_CFGSTAT_COMPLETE   BIT(0)
+
+struct vexpress_config_sysreg {
+   phys_addr_t addr;
+   u32 site;
+};
+
+static int vexpress_config_exec(struct vexpress_config_sysreg *syscfg,
+   bool write, void *buf, int size)
+{
+   u32 cmd, status, tries = 100;
+
+   cmd = (*(u32 *)buf) | SYS_CFGCTRL_START | (syscfg->site << 16);
+
+   if (!write) {
+   /* write a canary in the data register for reads */
+   writel(0xdeadbeef, syscfg->addr + SYS_CFGDATA);
+   } else {
+   cmd |= SYS_CFGCTRL_WRITE;
+   writel(((u32 *)buf)[1], syscfg->addr + SYS_CFGDATA);
+   }
+   writel(0, syscfg->addr + SYS_CFGSTAT);
+   writel(cmd, syscfg->addr + SYS_CFGCTRL);
+
+   /* completion of command takes ages, go to sleep (150us) */
+   do {
+   udelay(150);
+   status = readl(syscfg->addr + SYS_CFGSTAT);
+   if (status & SYS_CFGSTAT_ERR)
+   return -EFAULT;
+   } while (--tries && !(status & SYS_CFGSTAT_COMPLETE));
+
+   if (!tries)
+   return -ETIMEDOUT;
+
+   if (!write)
+   (*(u32 *)buf) = readl(syscfg->addr + SYS_CFGDATA);
+
+   return 0;
+}
+
+static int vexpress_config_read(struct udevice *dev,
+   int offset, void *buf, int size)
+{
+   struct vexpress_config_sysreg *priv = dev_get_uclass_priv(dev);
+
+   if (size != sizeof(u32))
+   return -EINVAL;
+
+   return vexpress_config_exec(priv, false, buf, size);
+}
+
+static int vexpress_config_write(struct udevice *dev,
+int offset, const void *buf, int size)
+{
+   struct vexpress_config_sysreg *priv = dev_get_uclass_priv(dev);
+
+   if (size != sizeof(u32) * 2)
+   return -EINVAL;
+
+   return vexpress_config_exec(priv, true, (void *)buf, size);
+}
+
+static struct misc_ops vexpress_config_ops = {
+   .read = vexpress_confi

[U-Boot] [PATCH v2] i2c: Add support for the Arm's Versatile Express I2C controller.

2018-09-28 Thread Liviu Dudau
The Arm Versatile Express I2C controller is a simple register-based
controller that uses a register to control the state of the SCL and
SDA lines. Add support for it.

Signed-off-by: Liviu Dudau 
Reviewed-by: Heiko Schocher 
---
Changelog:
  - v2: Added MAINTAINERS entry and fixed checkpatch warnings.

 MAINTAINERS |   1 +
 drivers/i2c/Kconfig |   7 +
 drivers/i2c/Makefile|   1 +
 drivers/i2c/i2c-versatile.c | 280 
 4 files changed, 289 insertions(+)
 create mode 100644 drivers/i2c/i2c-versatile.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1aa68e8135..11fc404167 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -291,6 +291,7 @@ M:  Liviu Dudau 
 S: Maintained
 T: git git://github.com/ARM-software/u-boot.git
 F: drivers/clk/clk_vexpress_osc.c
+F: drivers/i2c/i2c-versatile.c
 F: drivers/misc/vexpress_config.c
 N: vexpress
 
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index ae3b501555..1ef22e6bcd 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -416,6 +416,13 @@ config SYS_I2C_UNIPHIER_F
  Support for UniPhier FIFO-builtin I2C controller driver.
  This I2C controller is used on PH1-Pro4 or newer UniPhier SoCs.
 
+config SYS_I2C_VERSATILE
+   bool "Arm Ltd Versatile I2C bus driver"
+   depends on DM_I2C && (TARGET_VEXPRESS_CA15_TC2 || 
TARGET_VEXPRESS64_JUNO)
+   help
+ Add support for the Arm Ltd Versatile Express I2C driver. The I2C host
+ controller is present in the development boards manufactured by Arm 
Ltd.
+
 config SYS_I2C_MVTWSI
bool "Marvell I2C driver"
depends on DM_I2C
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index f2cbe78c53..d3637bcd8d 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o
 obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
 obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
 obj-$(CONFIG_SYS_I2C_UNIPHIER_F) += i2c-uniphier-f.o
+obj-$(CONFIG_SYS_I2C_VERSATILE) += i2c-versatile.o
 obj-$(CONFIG_SYS_I2C_ZYNQ) += zynq_i2c.o
 obj-$(CONFIG_TEGRA186_BPMP_I2C) += tegra186_bpmp_i2c.o
 
diff --git a/drivers/i2c/i2c-versatile.c b/drivers/i2c/i2c-versatile.c
new file mode 100644
index 00..f523844204
--- /dev/null
+++ b/drivers/i2c/i2c-versatile.c
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2018 Arm Ltd.
+ * Author: Liviu Dudau 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define I2C_CONTROL_REG0x00
+#define I2C_SET_REG0x00
+#define I2C_CLEAR_REG  0x04
+
+#define SCLBIT(0)
+#define SDABIT(1)
+
+struct versatile_i2c_priv {
+   phys_addr_t base;
+   u32 delay;
+};
+
+static inline void versatile_sda_set(struct versatile_i2c_priv *priv, u8 state)
+{
+   writel(SDA, priv->base + (state ? I2C_SET_REG : I2C_CLEAR_REG));
+   udelay(priv->delay);
+}
+
+static inline int versatile_sda_get(struct versatile_i2c_priv *priv)
+{
+   int v = !!(readl(priv->base + I2C_CONTROL_REG) & SDA);
+
+   udelay(priv->delay);
+   return v;
+}
+
+static inline void versatile_scl_set(struct versatile_i2c_priv *priv, u8 state)
+{
+   writel(SCL, priv->base + (state ? I2C_SET_REG : I2C_CLEAR_REG));
+   udelay(priv->delay);
+}
+
+static inline int versatile_scl_get(struct versatile_i2c_priv *priv)
+{
+   int v = !!(readl(priv->base + I2C_CONTROL_REG) & SCL);
+
+   udelay(priv->delay);
+   return v;
+}
+
+/* start: SDA goes from high to low while SCL is high */
+static void versatile_i2c_start(struct versatile_i2c_priv *priv)
+{
+   udelay(priv->delay);
+   versatile_sda_set(priv, 1);
+   versatile_scl_set(priv, 1);
+   versatile_sda_set(priv, 0);
+}
+
+/* stop: SDA goes from low to high while SCL is high */
+static void versatile_i2c_stop(struct versatile_i2c_priv *priv)
+{
+   versatile_scl_set(priv, 0);
+   versatile_sda_set(priv, 0);
+   versatile_scl_set(priv, 1);
+   versatile_sda_set(priv, 1);
+}
+
+/* read a bit from the SDA line (data or ACK/NACK) */
+static u8 versatile_i2c_read_bit(struct versatile_i2c_priv *priv)
+{
+   versatile_scl_set(priv, 0);
+   versatile_sda_set(priv, 1);
+   versatile_scl_set(priv, 1);
+   udelay(priv->delay);
+   return (u8)versatile_sda_get(priv);
+}
+
+/* write a bit on the SDA line */
+static void versatile_i2c_write_bit(struct versatile_i2c_priv *priv, u8 bit)
+{
+   versatile_scl_set(priv, 0);
+   versatile_sda_set(priv, bit);
+   versatile_scl_set(priv, 1);
+   udelay(priv->delay);
+}
+
+/* send a reset sequence of 9 clocks with SDA high */
+static void versatile_i2c_reset_bus(struct versatile_i2c_priv *priv)
+{
+   int i;
+
+   for (i = 0; i < 9; i++)
+   versatile_i2c_write_bit(priv, 1);
+
+   versatile_i2c_stop(priv);
+}
+
+/* write byte without start/stop sequen

[U-Boot] [PATCH v2] video: Add support for NXP's TDA19988 HDMI encoder

2018-09-28 Thread Liviu Dudau
Add support for the NXP TDA19988 HDMI encoder as used on the Juno
development board from Arm.

Signed-off-by: Liviu Dudau 
---
Changelog:
  - v2: Added MAINTAINERS entry and fixed checkpatch warnings.

 MAINTAINERS  |   5 +
 drivers/video/Kconfig|   8 +
 drivers/video/Makefile   |   1 +
 drivers/video/tda19988.c | 653 +++
 4 files changed, 667 insertions(+)
 create mode 100644 drivers/video/tda19988.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 11fc404167..112e41d2c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -598,6 +598,11 @@ S: Maintained
 F: drivers/spmi/
 F: include/spmi/
 
+TDA19988 HDMI ENCODER
+M: Liviu Dudau 
+S: Maintained
+F: drivers/video/tda19988.c
+
 TI SYSTEM SECURITY
 M: Andrew F. Davis 
 S: Supported
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index ed0b21f2a7..5d932072a8 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -431,6 +431,14 @@ config DISPLAY
   The devices provide a simple interface to start up the display,
   read display information and enable it.
 
+config NXP_TDA19988
+   bool "Enable NXP TDA19988 support"
+   depends on DISPLAY
+   default n
+   help
+ This enables support for the NXP TDA19988 HDMI encoder. This encoder
+ will convert RGB data streams into HDMI-encoded signals.
+
 config ATMEL_HLCD
bool "Enable ATMEL video support using HLCDC"
depends on DM_VIDEO
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 0f41a23193..4c130e179d 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 obj-$(CONFIG_LD9040) += ld9040.o
 obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_LOGICORE_DP_TX) += logicore_dp_tx.o
+obj-$(CONFIG_NXP_TDA19988) += tda19988.o
 obj-$(CONFIG_PXA_LCD) += pxa_lcd.o
 obj-$(CONFIG_S6E8AX0) += s6e8ax0.o
 obj-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
diff --git a/drivers/video/tda19988.c b/drivers/video/tda19988.c
new file mode 100644
index 00..01ed6193ea
--- /dev/null
+++ b/drivers/video/tda19988.c
@@ -0,0 +1,653 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Liviu Dudau 
+ *
+ * Based on the Linux driver, (C) 2012 Texas Instruments
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * TDA19988 uses paged registers. We encode the page# in the upper
+ * bits of the register#. It also means that reads/writes to a register
+ * have to ensure that the register's page is selected as the current
+ * page.
+ */
+#define REG(page, addr)(((page) << 8) | (addr))
+#define REG2ADDR(reg)  ((reg) & 0xff)
+#define REG2PAGE(reg)  (((reg) >> 8) & 0xff)
+
+/* register for setting current page */
+#define REG_CURRENT_PAGE   0xff
+
+/* Page 00h: General Control */
+#define REG_VERSION_LSBREG(0x00, 0x00) /* read */
+#define REG_MAIN_CNTRL0REG(0x00, 0x01) /* read/write */
+#define  MAIN_CNTRL0_SRBIT(0)
+#define  MAIN_CNTRL0_DECS  BIT(1)
+#define  MAIN_CNTRL0_DEHS  BIT(2)
+#define  MAIN_CNTRL0_CECS  BIT(3)
+#define  MAIN_CNTRL0_CEHS  BIT(4)
+#define  MAIN_CNTRL0_SCALERBIT(7)
+#define REG_VERSION_MSBREG(0x00, 0x02) /* read */
+#define REG_SOFTRESET  REG(0x00, 0x0a) /* write */
+#define  SOFTRESET_AUDIO   BIT(0)
+#define  SOFTRESET_I2C_MASTER  BIT(1)
+#define REG_DDC_DISABLEREG(0x00, 0x0b) /* read/write */
+#define REG_I2C_MASTER REG(0x00, 0x0d) /* read/write */
+#define  I2C_MASTER_DIS_MM BIT(0)
+#define  I2C_MASTER_DIS_FILT   BIT(1)
+#define  I2C_MASTER_APP_STRT_LAT BIT(2)
+#define REG_FEAT_POWERDOWN REG(0x00, 0x0e) /* read/write */
+#define  FEAT_POWERDOWN_PREFILTBIT(0)
+#define  FEAT_POWERDOWN_CSCBIT(1)
+#define  FEAT_POWERDOWN_SPDIF  BIT(3)
+#define REG_INT_FLAGS_0REG(0x00, 0x0f) /* read/write */
+#define REG_INT_FLAGS_1REG(0x00, 0x10) /* read/write */
+#define REG_INT_FLAGS_2REG(0x00, 0x11) /* read/write */
+#define  INT_FLAGS_2_EDID_BLK_RD  BIT(1)
+#define REG_ENA_VP_0   REG(0x00, 0x18) /* read/write */
+#define REG_ENA_VP_1   REG(0x00, 0x19) /* read/write */
+#define REG_ENA_VP_2   REG(0x00, 0x1a) /* read/write */
+#define REG_ENA_AP REG(0x00, 0x1e) /* read/write */
+#define REG_VIP_CNTRL_0REG(0x00, 0x20) /* write */
+#define  VIP_CNTRL_0_MIRR_ABIT(7)
+#define  VIP_CNTRL_0_SWAP_A(x) (((x) & 7) << 4)
+#define  VIP_CNTRL_0_MIRR_BBIT(3)
+#define  VIP_CNTRL_0_SWAP_B(x) (((x) & 7) << 0)
+#define REG_VIP_CNTRL_1REG(0x00, 0x21) /* write */
+#define  VIP_CNTRL_1_MIRR_CBIT(7)
+#define  VIP_CNTRL_1_SWAP_C(x) (((x) & 7) << 4)
+#define  VIP_CNTRL_1_MIRR_DBIT(3)
+#define  VIP_CNTRL_1_SWAP_D(x) (((x) & 7) << 0)
+

Re: [U-Boot] [PATCH 4/5] net: ftgmac100: add support for Aspeed SoC

2018-09-28 Thread Cédric Le Goater
Hello Simon,

On 9/27/18 3:41 PM, Simon Glass wrote:
> Hi Cedric,
> 
> On 10 September 2018 at 07:21, Cédric Le Goater  wrote:
>> The Faraday ftgmac100 MAC controllers as found on the Aspeed SoCs have
>> some slight differences in the HW interface (End-Of-Rx/Tx-Ring
>> bits). Also include the Aspeed clock enablement.
>>
>> Signed-off-by: Cédric Le Goater 
>> ---
>>  drivers/net/ftgmac100.h |  5 +++
>>  drivers/net/ftgmac100.c | 72 +
>>  2 files changed, 71 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ftgmac100.h b/drivers/net/ftgmac100.h
>> index 9a789e4d5bee..b8f99ddf48bc 100644
>> --- a/drivers/net/ftgmac100.h
>> +++ b/drivers/net/ftgmac100.h
>> @@ -129,6 +129,11 @@ struct ftgmac100 {
>>  #define FTGMAC100_DMAFIFOS_RXDMA_REQ   BIT(30)
>>  #define FTGMAC100_DMAFIFOS_TXDMA_REQ   BIT(31)
>>
>> +/*
>> + * Feature Register
>> + */
>> +#define FTGMAC100_REVR_NEW_MDIOBIT(31)
>> +
>>  /*
>>   * Receive buffer size register
>>   */
>> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
>> index 8d7bf5b9b351..3df48a82c1ad 100644
>> --- a/drivers/net/ftgmac100.c
>> +++ b/drivers/net/ftgmac100.c
>> @@ -27,6 +27,8 @@
>>  /* PKTBUFSTX/PKTBUFSRX must both be power of 2 */
>>  #define PKTBUFSTX  4
>>
>> +#define FTGMAC100_ASPEED_NR_CLKS   2
>> +
>>  struct ftgmac100_data {
>> phys_addr_t iobase;
>>
>> @@ -40,6 +42,11 @@ struct ftgmac100_data {
> 
> Comments on struct and members

ok.

> 
>> struct mii_dev *bus;
>> u32 phy_mode;
>> u32 max_speed;
>> +
>> +   struct clk clks[FTGMAC100_ASPEED_NR_CLKS];
>> +   u32 rxdes0_edorr_mask;
>> +   u32 txdes0_edotr_mask;
>> +   bool is_aspeed;
>>  };
>>
>>  /*
>> @@ -115,9 +122,15 @@ static int ftgmac100_mdio_write(struct mii_dev *bus, 
>> int phy_addr, int dev_addr,
>>
>>  static int ftgmac100_mdio_init(struct ftgmac100_data *priv, int dev_id)
>>  {
>> +   struct ftgmac100 *ftgmac100 = (struct ftgmac100 *)priv->iobase;
>> struct mii_dev *bus;
>> int ret;
>>
>> +   if (priv->is_aspeed) {
> 
> Perhaps call this old_mdio_if ?

Well, this feature is related to the Aspeed socs. The old MDIO interface is used
by default so I think we don't have to force the value below. 

However, we can imagine selecting the mdio interface, new or old, through a DT 
property. I will follow your suggestion then.  
>> +   /* This driver supports the old MDIO interface */
>> +   clrbits_le32(&ftgmac100->revr, FTGMAC100_REVR_NEW_MDIO);
>> +   };
>> +
>> bus = mdio_alloc();
>> if (!bus)
>> return -ENOMEM;
>> @@ -246,13 +259,13 @@ static int ftgmac100_start(struct udevice *dev)
>> priv->txdes[i].txdes3 = 0;
>> priv->txdes[i].txdes0 = 0;
>> }
>> -   priv->txdes[PKTBUFSTX - 1].txdes0 = FTGMAC100_TXDES0_EDOTR;
>> +   priv->txdes[PKTBUFSTX - 1].txdes0 = priv->txdes0_edotr_mask;
>>
>> for (i = 0; i < PKTBUFSRX; i++) {
>> priv->rxdes[i].rxdes3 = (unsigned int)net_rx_packets[i];
>> priv->rxdes[i].rxdes0 = 0;
>> }
>> -   priv->rxdes[PKTBUFSRX - 1].rxdes0 = FTGMAC100_RXDES0_EDORR;
>> +   priv->rxdes[PKTBUFSRX - 1].rxdes0 = priv->rxdes0_edorr_mask;
>>
>> /* transmit ring */
>> writel((u32)priv->txdes, &ftgmac100->txr_badr);
>> @@ -378,7 +391,7 @@ static int ftgmac100_send(struct udevice *dev, void 
>> *packet, int length)
>> flush_dcache_range(data_start, data_end);
>>
>> /* only one descriptor on TXBUF */
>> -   curr_des->txdes0 &= FTGMAC100_TXDES0_EDOTR;
>> +   curr_des->txdes0 &= priv->txdes0_edotr_mask;
>> curr_des->txdes0 |= FTGMAC100_TXDES0_FTS |
>> FTGMAC100_TXDES0_LTS |
>> FTGMAC100_TXDES0_TXBUF_SIZE(length) |
>> @@ -409,8 +422,11 @@ static int ftgmac100_write_hwaddr(struct udevice *dev)
>>
>>  static int ftgmac100_ofdata_to_platdata(struct udevice *dev)
>>  {
>> +   struct ftgmac100_data *priv = dev_get_priv(dev);
>> struct eth_pdata *pdata = dev_get_platdata(dev);
>> const char *phy_mode;
>> +   int ret;
>> +   int i;
>>
>> pdata->iobase = devfdt_get_addr(dev);
>> pdata->phy_interface = -1;
>> @@ -424,13 +440,39 @@ static int ftgmac100_ofdata_to_platdata(struct udevice 
>> *dev)
>>
>> pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0);
>>
>> +   if (device_is_compatible(dev, "aspeed,ast2500-mac")) {
> 
> Should use dev_get_driver_data() here.

OK. I see.

> 
>> +   priv->rxdes0_edorr_mask = BIT(30);
>> +   priv->txdes0_edotr_mask = BIT(30);
>> +   priv->is_aspeed = true;
>> +   } else {
>> +   priv->rxdes0_edorr_mask = BIT(15);
>> +   priv->txdes0_edotr_mask = BIT(15);
>> +   }
>> +
>> +   if (priv->is_aspeed) {
>> +   for (i = 0; i < FTGM

[U-Boot] [PATCH v2] video: Add support for Arm's Mali Display Processors

2018-09-28 Thread Liviu Dudau
Add support for Arm Mali Display Processors DP500, DP550 and DP650.
Only one layer is being used to display the console or boot logo,
even if more layers are supported in the hardware.

Signed-off-by: Liviu Dudau 
---
Changelog:
  - v2: Added MAINTAINERS entry and fixed checkpatch warnings.

 MAINTAINERS |   6 +
 drivers/video/Kconfig   |   8 +
 drivers/video/Makefile  |   1 +
 drivers/video/mali_dp.c | 405 
 4 files changed, 420 insertions(+)
 create mode 100644 drivers/video/mali_dp.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 112e41d2c3..fe08365ca8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -449,6 +449,12 @@ F: cmd/log.c
 F: test/log/log_test.c
 F: test/py/tests/test_log.py
 
+MALI DISPLAY PROCESSORS
+M: Liviu Dudau 
+S: Supported
+T: git git://github.com/ARM-software/u-boot.git
+F: drivers/video/mali_dp.c
+
 MICROBLAZE
 M: Michal Simek 
 S: Maintained
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 5d932072a8..ccf7cf83ed 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -497,6 +497,14 @@ config VIDEO_FSL_DCU_MAX_FB_SIZE_MB
 
 source "drivers/video/rockchip/Kconfig"
 
+config VIDEO_ARM_MALIDP
+   bool "Enable Arm Mali Display Processor support"
+   depends on DM_VIDEO && OF_CONTROL
+   select VEXPRESS_CLK
+   help
+ This enables support for Arm Ltd Mali Display Processors from
+ the DP500, DP550 and DP650 family.
+
 config VIDEO_SANDBOX_SDL
bool "Enable sandbox video console using SDL"
depends on SANDBOX
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 4c130e179d..e19e6dad1f 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_NXP_TDA19988) += tda19988.o
 obj-$(CONFIG_PXA_LCD) += pxa_lcd.o
 obj-$(CONFIG_S6E8AX0) += s6e8ax0.o
 obj-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
+obj-$(CONFIG_VIDEO_ARM_MALIDP) += mali_dp.o
 obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o
 obj-$(CONFIG_VIDEO_BROADWELL_IGD) += broadwell_igd.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
diff --git a/drivers/video/mali_dp.c b/drivers/video/mali_dp.c
new file mode 100644
index 00..71151a87aa
--- /dev/null
+++ b/drivers/video/mali_dp.c
@@ -0,0 +1,405 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016-2018 ARM Ltd.
+ * Author: Liviu Dudau 
+ *
+ */
+#define DEBUG
+#include 
+#include 
+#include 
+#ifdef CONFIG_DISPLAY
+#include 
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MALIDP_CORE_ID 0x0018
+#define MALIDP_REG_BG_COLOR0x0044
+#define MALIDP_LAYER_LV1   0x0100
+#define MALIDP_DC_STATUS   0xc000
+#define MALIDP_DC_CONTROL  0xc010
+#define MALIDP_DC_CFG_VALID0xc014
+
+/* offsets inside the modesetting register block */
+#define MALIDP_H_INTERVALS 0x
+#define MALIDP_V_INTERVALS 0x0004
+#define MALIDP_SYNC_CONTROL0x0008
+#define MALIDP_HV_ACTIVESIZE   0x000c
+#define MALIDP_OUTPUT_DEPTH0x001c
+
+/* offsets inside the layer register block */
+#define MALIDP_LAYER_FORMAT0x
+#define MALIDP_LAYER_CONTROL   0x0004
+#define MALIDP_LAYER_IN_SIZE   0x000c
+#define MALIDP_LAYER_CMP_SIZE  0x0010
+#define MALIDP_LAYER_STRIDE0x0018
+#define MALIDP_LAYER_PTR_LOW   0x0024
+#define MALIDP_LAYER_PTR_HIGH  0x0028
+
+/* offsets inside the IRQ control blocks */
+#define MALIDP_REG_MASKIRQ 0x0008
+#define MALIDP_REG_CLEARIRQ0x000c
+
+#define M1BITS 0x0001
+#define M2BITS 0x0003
+#define M4BITS 0x000f
+#define M8BITS 0x00ff
+#define M10BITS0x03ff
+#define M12BITS0x0fff
+#define M13BITS0x1fff
+#define M16BITS0x
+#define M17BITS0x1
+
+#define MALIDP_H_FRONTPORCH(x) (((x) & M12BITS) << 0)
+#define MALIDP_H_BACKPORCH(x)  (((x) & M10BITS) << 16)
+#define MALIDP_V_FRONTPORCH(x) (((x) & M12BITS) << 0)
+#define MALIDP_V_BACKPORCH(x)  (((x) & M8BITS) << 16)
+#define MALIDP_H_SYNCWIDTH(x)  (((x) & M10BITS) << 0)
+#define MALIDP_V_SYNCWIDTH(x)  (((x) & M8BITS) << 16)
+#define MALIDP_H_ACTIVE(x) (((x) & M13BITS) << 0)
+#define MALIDP_V_ACTIVE(x) (((x) & M13BITS) << 16)
+
+#define MALIDP_CMP_V_SIZE(x)   (((x) & M13BITS) << 16)
+#define MALIDP_CMP_H_SIZE(x)   (((x) & M13BITS) << 0)
+
+#define MALIDP_IN_V_SIZE(x)(((x) & M13BITS) << 16)
+#define MALIDP_IN_H_SIZE(x)(((x) & M13BITS) << 0)
+
+#define MALIDP_DC_CM_CONTROL(x)((x) & M1BITS) << 16, 1 << 16
+#define MALIDP_DC_STATUS_GET_CM(reg) (((reg) >> 16) & M1BITS)
+
+#define MALIDP_FORMAT_ARGB 0x08
+#define MALIDP_DEFAULT_BG_R 0x0
+#define MALIDP_DEFAULT_BG_G 0x0
+#define MALIDP_DEFAULT_BG_B 0x0
+
+#define MALIDP_PRODUCT_ID(core_id) ((u32)(core_id) >> 16)
+
+#define MALIDP500  0x500
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct malidp_priv {
+   phys_addr_t base_addr;
+   phys_addr_t dc_status_addr;
+   phys_addr_t dc_control_addr;
+   phys_addr_t cval_addr;
+   struct udevice *disp

[U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding

2018-09-28 Thread Liviu Dudau
Use the uclass_foreach_dev() macro instead of the open coded version.

Signed-off-by: Liviu Dudau 
---
Changelog:
 - v2: Find more places where the open coded version exists and
   replace them with the macro

 drivers/core/dump.c   |  2 +-
 drivers/core/uclass.c | 18 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index d7cdb1475d..9068084404 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -89,7 +89,7 @@ void dm_dump_uclass(void)
printf("uclass %d: %s\n", id, uc->uc_drv->name);
if (list_empty(&uc->dev_head))
continue;
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
dm_display_line(dev, i);
i++;
}
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a56b..d90bdde54e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -180,7 +180,7 @@ int dev_get_uclass_index(struct udevice *dev, struct uclass 
**ucp)
if (list_empty(&uc->dev_head))
return -ENODEV;
 
-   list_for_each_entry(iter, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(iter, uc) {
if (iter == dev) {
if (ucp)
*ucp = uc;
@@ -205,7 +205,7 @@ int uclass_find_device(enum uclass_id id, int index, struct 
udevice **devp)
if (list_empty(&uc->dev_head))
return -ENODEV;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
if (!index--) {
*devp = dev;
return 0;
@@ -259,7 +259,7 @@ int uclass_find_device_by_name(enum uclass_id id, const 
char *name,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
if (!strncmp(dev->name, name, strlen(name))) {
*devp = dev;
return 0;
@@ -284,7 +284,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int 
seq_or_req_seq,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
debug("   - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name);
if ((find_req_seq ? dev->req_seq : dev->seq) ==
seq_or_req_seq) {
@@ -312,7 +312,7 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int 
node,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
if (dev_of_offset(dev) == node) {
*devp = dev;
return 0;
@@ -337,7 +337,7 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode 
node,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
log(LOGC_DM, LOGL_DEBUG_CONTENT, "  - checking %s\n",
dev->name);
if (ofnode_equal(dev_ofnode(dev), node)) {
@@ -372,7 +372,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
uint phandle;
 
phandle = dev_read_phandle(dev);
@@ -399,7 +399,7 @@ int uclass_get_device_by_driver(enum uclass_id id,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
if (dev->driver == find_drv)
return uclass_get_device_tail(dev, 0, devp);
}
@@ -499,7 +499,7 @@ int uclass_get_device_by_phandle_id(enum uclass_id id, uint 
phandle_id,
if (ret)
return ret;
 
-   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   uclass_foreach_dev(dev, uc) {
uint phandle;
 
phandle = dev_read_phandle(dev);
-- 
2.18.0

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


[U-Boot] [PATCH v3] cmd: usb_mass_storage: add protection for block_dev

2018-09-28 Thread Patrick Delaunay
Check the value of block_dev before to use this pointer.
This patch solves problem for the command "ums 0 ubi 0"
when ubifs is previously mounted; in this case the function
blk_get_device_part_str("ubi 0") don't return error
but return block_dev = NULL and then data abort.

Signed-off-by: Patrick Delaunay 
---
I check and the issue is still present on U-Boot v2018.09,
on my board stm32mp1 (with NAND device and UBI volume):

STM32MP> ubi part UBI
STM32MP> ubifsmount ubi0:boot
STM32MP> ums 0 ubi 0
data abort
pc : []  lr : []
reloc pc : []lr : []
sp : fdc3e460  ip : fdc3e518 fp : fdcf06a8
r10: fdcf06b8  r9 : fdc4eed8 r8 : 
r7 : ffce3d84  r6 : fdcf0740 r5 : fdcf0740  r4 : ffce3d88
r3 :   r2 :  r1 : 003a  r0 : 
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Code: f04f4628 9b06fd2a bf082800 0800f04f (f5b3695b) Resetting CPU ...

Even If the command is invalid (ums not allowed on ubi device),
the data abort can be avoid by this patch.

To reproduce the issue you need to have a ubifs  already mounted,
for example with the command:
ubi part UBI
ubifsmount ubi0:boot

I investigate the point, the call stack before the crash is
caused by the ubi support in
./disk/part.c =  blk_get_device_part_str()

Some part of code here are under CONFIG_CMD_UBIFS with the comment :
"ubi goes through a mtd, rathen then through a regular block device"

So the the function return a pointer to disk_partition_t :
   info->type = BOOT_PART_TYPE
   info->name =  "UBI"
but without block device information !
   *dev_desc = NULL

So the issue occurs because, when the ubifs volume is mounted,
The code in  cmd/usb_mass_storage.c

static int ums_init(const char *devtype, const char *devnums_part_str) { ...
  for (;;) {
...
 partnum = blk_get_device_part_str(devtype, devnum_part_str,
&block_dev, &info, 1);

// With devnum_part_str  = "ubi 0"
// This function don't return a error and return a  valid partnum
// So the function continue until block_dev = NULL is used .
 if (partnum < 0)
goto cleanup;

/* Check if the argument is in legacy format. If yes,
 * expose all partitions by setting the partnum = 0
 * e.g. ums 0 mmc 0
 */
 if (!strchr(devnum_part_str, ':'))
 partnum = 0;

 /* f_mass_storage.c assumes SECTOR_SIZE sectors */
 if (block_dev->blksz != SECTOR_SIZE)
goto cleanup;

=> crash occur here (on my board) because block_dev = NULL



Changes in v3:
- Reword commit message

Changes in v2:
- Rebase on master branch

 cmd/usb_mass_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index 0d55114..a90f7bb 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -84,7 +84,7 @@ static int ums_init(const char *devtype, const char 
*devnums_part_str)
partnum = 0;
 
/* f_mass_storage.c assumes SECTOR_SIZE sectors */
-   if (block_dev->blksz != SECTOR_SIZE)
+   if (!block_dev || block_dev->blksz != SECTOR_SIZE)
goto cleanup;
 
ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums));
-- 
2.7.4

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


Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Jagan Teki
On Fri, Sep 28, 2018 at 3:10 PM Miquel Raynal  wrote:
>
> Hi Miquel,
>
> Miquel Raynal  wrote on Fri, 28 Sep 2018
> 09:35:02 +0200:
>
> > Hi Jagan,
> >
> > Jagan Teki  wrote on Fri, 28 Sep 2018
> > 12:56:43 +0530:
> >
> > > On Fri, Sep 28, 2018 at 12:38 PM Miquel Raynal
> > >  wrote:
> > > >
> > > > Hi Jagan,
> > > >
> > > > Jagan Teki  wrote on Fri, 28 Sep 2018
> > > > 12:18:49 +0530:
> > > >
> > > > > On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal 
> > > > >  wrote:
> > > > > >
> > > > > > During the last months, Boris Brezillon shared his work to support
> > > > > > serial flashes within Linux. First, he delivered (and merged) a new
> > > > > > layer called spi-mem. He also initiated in Linux MTD subsystem the 
> > > > > > move
> > > > > > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > > > > > same time a NAND core that would be shared with all NAND devices. 
> > > > > > Then,
> > > > > > he contributed a generic SPI-NAND driver, making use of this NAND 
> > > > > > core,
> > > > > > as well as some vendor code to drive a few chips.
> > > > > >
> > > > > > On top of this work, I made some cleanups in the MTD layer and 
> > > > > > added an
> > > > > > 'mtd' U-Boot command to handle all sort of MTD devices. This should
> > > > > > become the default command instead of having one per flash flavor
> > > > > > ('sf', 'nand', 'spi-nand' ?).
> > > > > >
> > > > > > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > > > > featuring a Macronix SPI NAND chip.
> > > > > >
> > > > > > TL;DR: the series contains (stripped version since ~30 patches have
> > > > > > already been taken):
> > > > > > - Support for spi-nand devices in mtdparts.
> > > > > > - Generics mtdparts/mtdids parsers.
> > > > > > - A new 'mtd' command.
> > > > > > - A note to set mtdparts command legacy.
> > > > > >
> > > > > > To test your SPI-NAND device with U-Boot, you can test someting 
> > > > > > like:
> > > > > >
> > > > > > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > > > > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for 
> > > > > > > this device
> > > > > > > ubi part bar # create a static UBI volume in the bar 
> > > > > > > partition
> > > > > > > mtd list # show the current MTD devices/partitions
> > > > > >
> > > > > > Thanks,
> > > > > > Miquèl
> > > > > >
> > > > > >
> > > > > > NB1: If UBI refuses to attach, verify the partition is epty with
> > > > > >  # mtd erase bar
> > > > > >
> > > > > > NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
> > > > > >  don't forget to probe your device *first* (sf probe, ...).
> > > > > >
> > > > > >
> > > > > > Changes since v9:
> > > > > > -
> > > > > > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
> > > > > >   everybody wants to use mtdids).
> > > > > > * mtd_parse_partitions() is still in mtdparts.c because it depends 
> > > > > > on
> > > > > >   partitions support, but the header file declaring it
> > > > > >   (include/linux/mtd/partitions.h) also has a dummy function if
> > > > > >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > > > > > * Typo corrected in mtd_parse_partitions prototype
> > > > > >   (s/_nb_parts/_nparts/).
> > > > > > * Added Boris' R-b tags.
> > > > > >
> > > > > > Changes since v8 (called v7 by mistake):
> > > > > > 
> > > > > > * Moved most of the generic logic to the core (mtd_uboot.c) so that 
> > > > > > it
> > > > > >   can be reused by other parts of U-Boot without depending on 
> > > > > > anything
> > > > > >   else than the MTD core itself.
> > > > > > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls 
> > > > > > now
> > > > > >   that the code is in the core.
> > > > > > * Created an helper for partitions deletion (as there is one to
> > > > > >   parse/create partition objects).
> > > > > > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > > > > > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > > > > > * Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" 
> > > > > > to
> > > > > >   actually deprecate the command.
> > > >
> > > > [...]
> > > >
> > > > > > Miquel Raynal (7):
> > > > > >   mtd: uclass: add probe function
> > > > > >   mtd: mtdpart: add a generic mtdparts-like parser
> > > > > >   mtd: uboot: search for an equivalent MTD name with the mtdids
> > > > > >   mtd: mtdpart: implement proper partition handling
> > > > > >   cmd: mtd: add 'mtd' command
> > > > > >   cmd: ubi: clean the partition handling
> > > > > >   cmd: mtdparts: describe as legacy
> > > > >
> > > > > I didn't find this mtdparts fallback change[1] in v10? does this
> > > > > fallback issue fixed differently.
> > > > >
> > > > > [1] 
> > > > > https://github.com/openedev/u-boot-amarula/commit/9edbc2be512c9bd572884c53b5f54b583e897e9b
> > > >
> > > > Indeed, I dropped this patch on Boris advice: if we want to deprecate
> 

Re: [U-Boot] [PATCH v10 0/7] SPI-NAND support (third batch)

2018-09-28 Thread Miquel Raynal
Hi Jagan,

Jagan Teki  wrote on Fri, 28 Sep 2018
19:09:21 +0530:

> On Fri, Sep 28, 2018 at 3:10 PM Miquel Raynal  
> wrote:
> >
> > Hi Miquel,
> >
> > Miquel Raynal  wrote on Fri, 28 Sep 2018
> > 09:35:02 +0200:
> >  
> > > Hi Jagan,
> > >
> > > Jagan Teki  wrote on Fri, 28 Sep 2018
> > > 12:56:43 +0530:
> > >  
> > > > On Fri, Sep 28, 2018 at 12:38 PM Miquel Raynal
> > > >  wrote:  
> > > > >
> > > > > Hi Jagan,
> > > > >
> > > > > Jagan Teki  wrote on Fri, 28 Sep 2018
> > > > > 12:18:49 +0530:
> > > > >  
> > > > > > On Thu, Sep 27, 2018 at 3:04 PM Miquel Raynal 
> > > > > >  wrote:  
> > > > > > >
> > > > > > > During the last months, Boris Brezillon shared his work to support
> > > > > > > serial flashes within Linux. First, he delivered (and merged) a 
> > > > > > > new
> > > > > > > layer called spi-mem. He also initiated in Linux MTD subsystem 
> > > > > > > the move
> > > > > > > of all 'raw' NAND related code to a raw/ subdirectory, adding at 
> > > > > > > the
> > > > > > > same time a NAND core that would be shared with all NAND devices. 
> > > > > > > Then,
> > > > > > > he contributed a generic SPI-NAND driver, making use of this NAND 
> > > > > > > core,
> > > > > > > as well as some vendor code to drive a few chips.
> > > > > > >
> > > > > > > On top of this work, I made some cleanups in the MTD layer and 
> > > > > > > added an
> > > > > > > 'mtd' U-Boot command to handle all sort of MTD devices. This 
> > > > > > > should
> > > > > > > become the default command instead of having one per flash flavor
> > > > > > > ('sf', 'nand', 'spi-nand' ?).
> > > > > > >
> > > > > > > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > > > > > featuring a Macronix SPI NAND chip.
> > > > > > >
> > > > > > > TL;DR: the series contains (stripped version since ~30 patches 
> > > > > > > have
> > > > > > > already been taken):
> > > > > > > - Support for spi-nand devices in mtdparts.
> > > > > > > - Generics mtdparts/mtdids parsers.
> > > > > > > - A new 'mtd' command.
> > > > > > > - A note to set mtdparts command legacy.
> > > > > > >
> > > > > > > To test your SPI-NAND device with U-Boot, you can test someting 
> > > > > > > like:
> > > > > > >  
> > > > > > > > setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> > > > > > > > setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for 
> > > > > > > > this device
> > > > > > > > ubi part bar # create a static UBI volume in the bar 
> > > > > > > > partition
> > > > > > > > mtd list # show the current MTD devices/partitions  
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Miquèl
> > > > > > >
> > > > > > >
> > > > > > > NB1: If UBI refuses to attach, verify the partition is epty with
> > > > > > >  # mtd erase bar
> > > > > > >
> > > > > > > NB2: If your U-Boot crashes and you are using a non SPI-NAND 
> > > > > > > device,
> > > > > > >  don't forget to probe your device *first* (sf probe, ...).
> > > > > > >
> > > > > > >
> > > > > > > Changes since v9:
> > > > > > > -
> > > > > > > * mtd_search_alternate_name() is moved in mtd_uboot.c (generic 
> > > > > > > code,
> > > > > > >   everybody wants to use mtdids).
> > > > > > > * mtd_parse_partitions() is still in mtdparts.c because it 
> > > > > > > depends on
> > > > > > >   partitions support, but the header file declaring it
> > > > > > >   (include/linux/mtd/partitions.h) also has a dummy function if
> > > > > > >   #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
> > > > > > > * Typo corrected in mtd_parse_partitions prototype
> > > > > > >   (s/_nb_parts/_nparts/).
> > > > > > > * Added Boris' R-b tags.
> > > > > > >
> > > > > > > Changes since v8 (called v7 by mistake):
> > > > > > > 
> > > > > > > * Moved most of the generic logic to the core (mtd_uboot.c) so 
> > > > > > > that it
> > > > > > >   can be reused by other parts of U-Boot without depending on 
> > > > > > > anything
> > > > > > >   else than the MTD core itself.
> > > > > > > * Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() 
> > > > > > > calls now
> > > > > > >   that the code is in the core.
> > > > > > > * Created an helper for partitions deletion (as there is one to
> > > > > > >   parse/create partition objects).
> > > > > > > * Enhanced a bit the text in Kconfig about deprecating mtdparts.
> > > > > > > * Fixed checkpatch.pl warnings in the mtdparts driver.
> > > > > > > * Drop "cmd: mtdparts: try to probe the MTD devices as a 
> > > > > > > fallback" to
> > > > > > >   actually deprecate the command.  
> > > > >
> > > > > [...]
> > > > >  
> > > > > > > Miquel Raynal (7):
> > > > > > >   mtd: uclass: add probe function
> > > > > > >   mtd: mtdpart: add a generic mtdparts-like parser
> > > > > > >   mtd: uboot: search for an equivalent MTD name with the mtdids
> > > > > > >   mtd: mtdpart: implement proper partition handling
> > > > > > >   cmd: mtd: add 'mtd' command
> > > > > > >   cmd: ubi: clean the partition h

[U-Boot] [PATCH v3 1/4] pico-imx6ul, pico-imx7d: Use eMMC user partition by default

2018-09-28 Thread Otavio Salvador
After discussing with TechNexion about how its default setting, it is
better to install on the eMMC user partition by default, when using
DFU, so it works out of box for majority of users.

Reviewed-by: Fabio Estevam 
Signed-off-by: Otavio Salvador 
---

Changes in v3: None
Changes in v2: None

 include/configs/pico-imx6ul.h | 4 ++--
 include/configs/pico-imx7d.h  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index 3d93205535..0fea2d65dd 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -56,8 +56,8 @@
 
 #define CONFIG_DFU_ENV_SETTINGS \
"dfu_alt_info=" \
-   "spl raw 0x2 0x400 mmcpart 1;" \
-   "u-boot raw 0x8a 0x400 mmcpart 1;" \
+   "spl raw 0x2 0x400;" \
+   "u-boot raw 0x8a 0x400;" \
"/boot/zImage ext4 0 1;" \
"/boot/imx6ul-pico-hobbit.dtb ext4 0 1;" \
"/boot/imx6ul-pico-pi.dtb ext4 0 1;" \
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 0e770bf41f..614be99d93 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -45,8 +45,8 @@
 
 #define CONFIG_DFU_ENV_SETTINGS \
"dfu_alt_info=" \
-   "spl raw 0x2 0x400 mmcpart 1;" \
-   "u-boot raw 0x8a 0x400 mmcpart 1;" \
+   "spl raw 0x2 0x400;" \
+   "u-boot raw 0x8a 0x400;" \
"/boot/zImage ext4 0 1;" \
"/boot/imx7d-pico-hobbit.dtb ext4 0 1;" \
"/boot/imx7d-pico-pi.dtb ext4 0 1;" \
-- 
2.19.0

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


[U-Boot] [PATCH v3 2/4] pico-imx6ul, pico-imx7d: Enable USB and PXE boot support

2018-09-28 Thread Otavio Salvador
This allow the use of a USB storage or PXE network booting as
fallback, allowing for example for manufacturing installation of eMMC
storage in an easy way.

Reviewed-by: Fabio Estevam 
Signed-off-by: Otavio Salvador 
---

Changes in v3: None
Changes in v2:
- improve commit log (fabio)

 include/configs/pico-imx6ul.h | 2 ++
 include/configs/pico-imx7d.h  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index 0fea2d65dd..8082b74c9c 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -103,6 +103,8 @@
 
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
+   func(USB, usb, 0) \
+   func(PXE, pxe, na) \
func(DHCP, dhcp, na)
 
 #include 
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 614be99d93..2bc42a04a0 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -92,6 +92,8 @@
 
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
+   func(USB, usb, 0) \
+   func(PXE, pxe, na) \
func(DHCP, dhcp, na)
 
 #include 
-- 
2.19.0

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


[U-Boot] [PATCH v3 4/4] pico-imx7d: Add USB Host support

2018-09-28 Thread Otavio Salvador
From: Fabio Estevam 

USB OTG2 port is connected to the USB host connector.

Add support for it.

Signed-off-by: Fabio Estevam 
Signed-off-by: Otavio Salvador 
---

Changes in v3:
- new patch

Changes in v2: None

 board/technexion/pico-imx7d/pico-imx7d.c | 29 +++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/board/technexion/pico-imx7d/pico-imx7d.c 
b/board/technexion/pico-imx7d/pico-imx7d.c
index 0767d0462f..53e14693a5 100644
--- a/board/technexion/pico-imx7d/pico-imx7d.c
+++ b/board/technexion/pico-imx7d/pico-imx7d.c
@@ -282,7 +282,34 @@ int checkboard(void)
return 0;
 }
 
+static iomux_v3_cfg_t const usb_otg2_pads[] = {
+   MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+   switch (port) {
+   case 0:
+   break;
+   case 1:
+   imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+ARRAY_SIZE(usb_otg2_pads));
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
 int board_usb_phy_mode(int port)
 {
-   return USB_INIT_DEVICE;
+   switch (port) {
+   case 0:
+   return USB_INIT_DEVICE;
+   case 1:
+   return USB_INIT_HOST;
+   default:
+   return -EINVAL;
+   }
+   return 0;
 }
-- 
2.19.0

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


[U-Boot] [PATCH v3 3/4] pico-imx7d: Make SPL binary fit into 64kB

2018-09-28 Thread Otavio Salvador
From: Fabio Estevam 

Currently SPL binary is larger than 64kB, which is larger than
CONFIG_SPL_MAX_SIZE defined in imx7_spl.h.

This causes boot failure on the pico-mx7 targets.

Remove CONFIG_SPL_LIBDISK_SUPPORT option for now, so that the SPL
binary can fit into the 64kB range.

Signed-off-by: Fabio Estevam 
Signed-off-by: Otavio Salvador 
---

Changes in v3:
- new patch

Changes in v2: None

 configs/pico-hobbit-imx7d_defconfig | 1 -
 configs/pico-imx7d_defconfig| 1 -
 configs/pico-pi-imx7d_defconfig | 1 -
 3 files changed, 3 deletions(-)

diff --git a/configs/pico-hobbit-imx7d_defconfig 
b/configs/pico-hobbit-imx7d_defconfig
index 568fb11d59..b02cae5237 100644
--- a/configs/pico-hobbit-imx7d_defconfig
+++ b/configs/pico-hobbit-imx7d_defconfig
@@ -8,7 +8,6 @@ CONFIG_TARGET_PICO_IMX7D=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
-CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig
index d6cfc2065e..f355f07be7 100644
--- a/configs/pico-imx7d_defconfig
+++ b/configs/pico-imx7d_defconfig
@@ -8,7 +8,6 @@ CONFIG_TARGET_PICO_IMX7D=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
-CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig
index 73800fc8eb..3a182dcb81 100644
--- a/configs/pico-pi-imx7d_defconfig
+++ b/configs/pico-pi-imx7d_defconfig
@@ -8,7 +8,6 @@ CONFIG_TARGET_PICO_IMX7D=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
-CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-- 
2.19.0

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


Re: [U-Boot] [PATCH v3 1/4] pico-imx6ul, pico-imx7d: Use eMMC user partition by default

2018-09-28 Thread Otavio Salvador
Hello Stefano,

I forgot to add you to Cc list

On Fri, Sep 28, 2018 at 11:22 AM Otavio Salvador
 wrote:
>
> After discussing with TechNexion about how its default setting, it is
> better to install on the eMMC user partition by default, when using
> DFU, so it works out of box for majority of users.
>
> Reviewed-by: Fabio Estevam 
> Signed-off-by: Otavio Salvador 




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


Re: [U-Boot] [PATCH 00/48] mpc83xx: Kconfig migrations

2018-09-28 Thread York Sun
On 09/28/2018 02:53 AM, Mario Six wrote:
> This series converts the first bunch of legacy configuration options to
> the Kconfig framework.
> 
> Functionality is preserved where possible, and setting configuration
> options is made a comfortable as possible.
> 
> Mario Six (48):
>   mpc83xx: Introduce ARCH_MPC830*
>   mpc83xx: Introduce ARCH_MPC831*
>   mpc83xx: Introduce ARCH_MPC832*
>   mpc83xx: Introduce ARCH_MPC834*
>   mpc83xx: Introduce ARCH_MPC836*
>   mpc83xx: Introduce ARCH_MPC837X
>   keymile: Make distinct kmtegr1, kmvect1, suvd3 configs
>   keymile: Simplify kmtegr1, kmvect1, suvd3 configs

Does it make sense to squash the above two patches (and other similar
patches)?

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


[U-Boot] Please pull u-boot-fsl-qoriq master

2018-09-28 Thread York Sun
Tom,

The following changes since commit 9dc8d155d4e88563f572ee79aab758eb4272f3fd:

  Merge git://git.denx.de/u-boot-imx (2018-09-19 20:35:27 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-fsl-qoriq.git tags/fsl-qoriq-for-v2018.11-rc1

for you to fetch changes up to 26cbc0d663555b8af7d40ecfd0d0fefe960d9686:

  armv7: ls102xa: Disable QE before enter deep sleep (2018-09-27
10:01:28 -0700)


Switch to driver model for eSDHC on Layerscape SoCs including LS1021A,
LS1043A, LS1046A, LS1088A, LS2088A.
Switch to driver model for SATA on LS1021A and LS1043A.
Add support for LS1012AFRWY rev C board.
Enable SMMU for LS1043A.

Build log is available at
https://travis-ci.org/yorksun/u-boot/builds/434207475.


Laurentiu Tudor (4):
  armv8: fsl-layerscape: add missing qe base address define
  armv8: ls1043a: advertise QMan v3 in configuration
  armv8: ls1043a: add icid setup support
  armv8: ls1043a: enable icid setup for qman portals

Nipun Gupta (1):
  u-boot: fixup the iommu-map property of fsl-mc node

Peng Ma (7):
  armv8: dts: fsl-ls1043a: add sata node support
  scsi: ceva: add ls1043a soc support
  arm64: ls1043aqds: enable DM support for sata
  armv7: fsl: remove sata support
  armv7: dts: fsl-ls1021a: add sata node support enable sata for
ls1021a-qds and ls1021a-twr
  arm: ls1021atwr: enable DM support for sata
  scsi: ceva: add ls1021a soc support.

Prabhakar Kushwaha (1):
  driver: net: fsl-mc: Memset MC reserve ram memory before usage

Pramod Kumar (3):
  ls1012afrwy: Add ls1012afrwy revC board support.
  ls1012a: remove debug info from u-boot log
  ls1088a: remove dhcp function from u-boot env as boot source

Priyanka Jain (1):
  ls2080ardb: remove dhcp function from env as boot source

Ran Wang (2):
  drivers: qe: Move CONFIG_U_QE to Kconfig
  armv7: ls102xa: Disable QE before enter deep sleep

Yinbo Zhu (8):
  ppa/fm/qe: use block layer in ppa/fm/qe driver
  armv8/ls1088a/ls2088a: esdhc: Add esdhc clock support
  armv8: ls2088a: add eSDHC node
  armv8: ls1088a: add eSDHC node
  armv8: ls1043a: add eSDHC node
  armv8: ls1046a: add eSDHC node
  armv7: ls1021a: enable esdhc
  Enable CONFIG_BLK and CONFIG_DM_MMC to Kconfig

Zhao Qiang (1):
  net: fman: Support both new and legacy FMan Compatibles

 arch/arm/cpu/armv7/ls102xa/Makefile|  1 -
 arch/arm/cpu/armv7/ls102xa/ls102xa_psci.c  |  4 +
 arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c  | 41 --
 arch/arm/cpu/armv8/fsl-layerscape/Makefile |  1 +
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c | 14 
 arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c | 90
++
 arch/arm/cpu/armv8/fsl-layerscape/ppa.c|  7 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c|  2 +-
 arch/arm/dts/fsl-ls1043a-qds.dtsi  |  4 +
 arch/arm/dts/fsl-ls1043a.dtsi  | 16 
 arch/arm/dts/fsl-ls1046a.dtsi  |  8 ++
 arch/arm/dts/fsl-ls1088a.dtsi  |  9 +++
 arch/arm/dts/fsl-ls2080a.dtsi  |  8 ++
 arch/arm/dts/ls1021a-qds.dtsi  |  4 +
 arch/arm/dts/ls1021a-twr.dtsi  |  4 +
 arch/arm/dts/ls1021a.dtsi  |  8 +-
 arch/arm/include/asm/arch-fsl-layerscape/config.h  |  1 +
 .../arm/include/asm/arch-fsl-layerscape/fsl_icid.h |  4 +
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  2 +
 .../asm/arch-fsl-layerscape/stream_id_lsch3.h  |  3 +
 arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h  | 29 +--
 arch/arm/include/asm/arch-ls102xa/ls102xa_sata.h   | 10 ---
 board/freescale/ls1012afrdm/ls1012afrdm.c  | 20 +++--
 board/freescale/ls1021aiot/ls1021aiot.c|  5 --
 board/freescale/ls1021aqds/ls1021aqds.c|  4 -
 board/freescale/ls1021atwr/ls1021atwr.c|  4 -
 board/freescale/ls1043aqds/ls1043aqds.c|  3 +
 board/freescale/ls1043ardb/ls1043ardb.c|  3 +
 board/freescale/ls1088a/ls1088a.c  |  2 +
 board/freescale/ls2080a/ls2080a.c  |  2 +
 board/freescale/ls2080aqds/ls2080aqds.c|  2 +
 board/freescale/ls2080ardb/ls2080ardb.c|  2 +
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig   |  2 +
 configs/ls1021atwr_nor_defconfig   |  7 ++
 configs/ls1021atwr_nor_lpuart_defconfig|  2 +
 configs/ls1021atwr_qspi_defconfig  |  2 +
 configs/ls1021atwr_sdcard_ifc_defconfig|  2 +
 configs/ls1021atwr_sdcard_qspi_defconfig   |  2 +
 configs/ls1043aqds_defconfig   |  7 ++
 configs/ls1043aqds_lpuart_defconfig|  2 +
 configs/ls1043aqds_nand_defconfig  |  2 +
 configs/ls1043aqds

Re: [U-Boot] enabling MMU in U-Boot-2017.09

2018-09-28 Thread Mrun Lele
Hi Bin,

Thanks for your reply.

I am using acadia processor.

After Linux boots we are getting some problems in MMU path.
Debugging that would be one way to move ahead.

However, I want to enable MMU in Uboot context to test MMU path to RAM.

Also, is there any document or README which will have all the available
configuration options?
README in the U-Boot-2017.09 do have some of the configuration options but
I believe not all of them are included there.

Please, do let me know if you need more details.
I am new to this community. Please, bare with me.

Thanks,
Harshad.

On Thu, Sep 27, 2018 at 11:37 PM Bin Meng  wrote:

> Hi,
>
> On Fri, Sep 28, 2018 at 11:30 AM Mrun Lele  wrote:
> >
> > Hello Everyone,
> >
> > I am using U-Boot-2017.09. I want to enable MMU before U-Boot loads
> uImage.
> >
> > I googled it and I found one thread dated back in July 2010.
> > this is the link
> > https://lists.denx.de/pipermail/u-boot/2010-July/073510.html
> >
> > Basically, it involved code change (enabling MMU in start.S and some
> other
> > modifications).
> >
> > Before walking down on that road described in that link, I want to know
> is
> > there any configuration parameter with which I can achieve it easily in
> > U-Boot-2017.09?
> >
> > If not, then is there any document/ guide which I can follow for
> > U-Boot-2017.09? I am using armv7 cpu.
> >
> > Any help would be highly appreciated.
>
> You did not specify which exact armv7 processor you are using, and
> what issues are you trying to fix. Please provide more details.
>
> Regards,
> Bin
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-09-28 Thread York Sun
Tom,

The following changes since commit 9dc8d155d4e88563f572ee79aab758eb4272f3fd:

  Merge git://git.denx.de/u-boot-imx (2018-09-19 20:35:27 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-mpc85xx.git tags/mpc85xx-for-v2018.11-rc1

for you to fetch changes up to 432054b947a79dbf0f1554f6d6814e8ea8ecb623:

  powerpc: dts: Enable device tree support for T2080QDS (2018-09-27
10:14:14 -0700)


Use device tree for mpc85xx with binman. Enabled for T2080QDS.

Build log is available at
https://travis-ci.org/yorksun/u-boot/builds/434213313.


Jagdish Gediya (8):
  powerpc/dts: Define '_end' symbol in mpc85xx U-Boot lds files
  powerpc/dts: Makefile changes to clean and build dts
  binman: Add a new "skip-at-start" property in Section class
  binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entry
  powerpc: mpc85xx: Select BINMAN by default
  powerpc: mpc85xx: Use binman to embed dtb inside U-Boot
  powerpc: dts: Add u-boot.dtsi to use binman for MPC85xx boards
  powerpc: dts: Enable device tree support for T2080QDS

 Makefile   | 23 +++-
 arch/powerpc/Kconfig   |  1 +
 arch/powerpc/cpu/mpc85xx/Kconfig   |  4 ++
 arch/powerpc/cpu/mpc85xx/u-boot-nand.lds   |  1 +
 arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds   |  1 +
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds|  1 +
 arch/powerpc/cpu/mpc85xx/u-boot.lds|  1 +
 arch/powerpc/dts/Makefile  | 14 +
 arch/powerpc/dts/e6500_power_isa.dtsi  | 39 ++
 arch/powerpc/dts/t2080.dtsi| 62
++
 arch/powerpc/dts/t2080qds.dts  | 17 ++
 arch/powerpc/dts/u-boot.dtsi   | 32 +++
 board/freescale/t208xqds/README| 19 +++
 configs/T2080QDS_NAND_defconfig|  3 +-
 configs/T2080QDS_SDCARD_defconfig  |  3 +-
 configs/T2080QDS_SPIFLASH_defconfig|  3 +-
 configs/T2080QDS_defconfig |  4 +-
 dts/Makefile   |  2 +-
 tools/binman/README|  9 
 tools/binman/README.entries| 14 -
 tools/binman/bsection.py   | 15 --
 .../etype/powerpc_mpc85xx_bootpg_resetvec.py   | 25 +
 tools/binman/ftest.py  | 16 ++
 .../test/80_4gb_and_skip_at_start_together.dts | 21 
 .../test/81_powerpc_mpc85xx_bootpg_resetvec.dts| 16 ++
 25 files changed, 335 insertions(+), 11 deletions(-)
 create mode 100644 arch/powerpc/dts/Makefile
 create mode 100644 arch/powerpc/dts/e6500_power_isa.dtsi
 create mode 100644 arch/powerpc/dts/t2080.dtsi
 create mode 100644 arch/powerpc/dts/t2080qds.dts
 create mode 100644 arch/powerpc/dts/u-boot.dtsi
 create mode 100644 tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
 create mode 100644 tools/binman/test/80_4gb_and_skip_at_start_together.dts
 create mode 100644 tools/binman/test/81_powerpc_mpc85xx_bootpg_resetvec.dts

Thanks.

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


Re: [U-Boot] [PATCH v9 1/8] ppa/fm/qe: use block layer in ppa/fm/qe driver

2018-09-28 Thread York Sun
On 09/24/2018 11:50 PM, Yinbo Zhu wrote:
> At present the MMC subsystem maintains its own list
> of MMC devices. This cannot work with driver model
> when CONFIG_BLK is enabled, use blk_dread to
> replace previous mmc read interface,
> use mmc_get_blk_desc to get the mmc device property
> 
> Signed-off-by: Yinbo Zhu 
> ---
> Change in v9:
>   fix ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig compiling 
> errors 


This patch set has been applied to fsl-qoriq master, awaiting upstream.
Thanks.

York

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


Re: [U-Boot] [PATCH 1/3, v2] armv8: dts: fsl-ls1043a: add sata node support

2018-09-28 Thread York Sun
On 07/31/2018 08:37 PM, Peng Ma wrote:
> Add sata node to support ls1043a.
> 
> Signed-off-by: Peng Ma 
> ---
> v2:
>   -no changes

This patch set has been applied to fsl-qoriq master, awaiting upstream.
Thanks.

York

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


Re: [U-Boot] [PATCH 1/4] armv7: fsl: remove sata support

2018-09-28 Thread York Sun
On 07/31/2018 11:18 PM, Peng Ma wrote:
> Remove the old implementation in order to enable DM for sata
> 
> Signed-off-by: Peng Ma 
> ---

This patch set has been applied to fsl-qoriq master, awaiting upstream.
Thanks.

York


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


Re: [U-Boot] [PATCH] ls1012afrwy: Add ls1012afrwy revC board support.

2018-09-28 Thread York Sun
On 08/13/2018 09:19 PM, Pramod Kumar wrote:
> ls1012afrwy support three revisions of the board.
> 512MB revA, revB boards and 1GB revC board.
> revision A and B board are collectively identified as revA/B,
> however revision C board is identifies as revC.
> 
> Signed-off-by: Pramod Kumar 
> ---

Applied to fsl-qoriq master, awaiting upstream. Thanks.

York


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


Re: [U-Boot] [PATCH] u-boot: fixup the iommu-map property of fsl-mc node

2018-09-28 Thread York Sun
On 08/20/2018 03:31 AM, Nipun Gupta wrote:
> The iommu-map property in the fsl-mc node is updated by
> valid stream-ids by u-boot. This patch is to fixup this
> property for LS208x and LS1088.
> 
> Signed-off-by: Nipun Gupta 
> ---
> 

Applied to fsl-qoriq master, awaiting upstream. Thanks.

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


  1   2   >