[PATCH] common: state: fix typo

2018-10-08 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/state/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state/state.c b/common/state/state.c
index 25d9502111c2..1273c494c138 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -83,7 +83,7 @@ out:
 }
 
 /**
- * state_load - Loads a state from the backend
+ * state_do_load - Loads a state from the backend
  * @param state The state that should be updated to contain the loaded data
  * @return 0 on success, -errno on failure. If no state is loaded the previous
  * values remain in the state.
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: backend_bucket_circular: fix memory leak

2018-10-08 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 0529421a2c2f..277b94d79737 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -480,7 +480,8 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
circ->fd = open(path, O_RDWR);
if (circ->fd < 0) {
pr_err("Failed to open circular bucket '%s'\n", path);
-   return -errno;
+   ret = -errno;
+   goto out_free;
}
 #endif
 
@@ -489,7 +490,7 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
dev_info(dev, "Not using eraseblock %u, it is marked as bad 
(%d)\n",
 circ->eraseblock, ret);
ret = -EIO;
-   goto out_free;
+   goto out_close;
}
 
circ->bucket.read = state_backend_bucket_circular_read;
@@ -499,13 +500,15 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
 
ret = state_backend_bucket_circular_init(*bucket);
if (ret)
-   goto out_free;
+   goto out_close;
 
return 0;
 
-out_free:
+out_close:
 #ifndef __BAREBOX__
close(circ->fd);
+out_free:
+   free(circ->mtd);
 #endif
free(circ);
 
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 13/16] mdio_bus: Allow for non PHY-devices on MDIO buses

2018-10-08 Thread Andrey Smirnov
On Mon, Oct 8, 2018 at 1:44 AM Sascha Hauer  wrote:
>
> On Sun, Oct 07, 2018 at 11:35:39PM -0700, Andrey Smirnov wrote:
> > Instead of just creating a simple PHY device for every child of MDIO
> > bus node, add code to check if any of them have "compatible" property
> > set as well as code to create a proper platform device for such cases.
> >
> > This change is useful for when MDIO bus and some of Ethernet ports are
> > connected to a switch or some other MDIO device that doesn't behave
> > like a generic PHY and can't be probed via its PHY ID.
> >
> > Signed-off-by: Andrey Smirnov 
> > ---
> >  drivers/net/phy/mdio_bus.c | 11 +++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> > index d7d6d8940..589ed57d2 100644
> > --- a/drivers/net/phy/mdio_bus.c
> > +++ b/drivers/net/phy/mdio_bus.c
> > @@ -26,6 +26,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #define DEFAULT_GPIO_RESET_ASSERT   1000  /* us */
> >  #define DEFAULT_GPIO_RESET_DEASSERT 1000  /* us */
> > @@ -179,6 +180,16 @@ static int of_mdiobus_register(struct mii_bus *mdio, 
> > struct device_node *np)
> >
> >   /* Loop over the child nodes and register a phy_device for each one */
> >   for_each_available_child_of_node(np, child) {
> > + if (of_get_property(child, "compatible", NULL)) {
> > + if (!of_platform_device_create(child, >dev)) {
> > + dev_err(>dev,
> > + "Failed to create device for %s\n",
> > + child->full_name);
> > + }
> > +
> > + continue;
> > + }
>
> PHYs can have a compatible property aswell which is checked for here:
>
> > +
> >   if (!of_mdiobus_child_is_phy(child))
> >   continue;
>
> So I believe you have to create a platform device only if it is not a
> PHY device.
>

Yeah, good point, missed this in my logic. Will fix in v2.

Thanks,
Andrey Smirnov

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 02/16] clocksource: Add ARM global timer support

2018-10-08 Thread Andrey Smirnov
On Mon, Oct 8, 2018 at 1:17 AM Sascha Hauer  wrote:
>
> On Sun, Oct 07, 2018 at 11:35:28PM -0700, Andrey Smirnov wrote:
> > Port corresponding Linux kernel driver. Currently VFxxx SoC is the
> > intended consumer because it doesn't include common i.MX GPT block
> > used as clocksource by other i.MX SoCs.
> >
> > Signed-off-by: Andrey Smirnov 
> > ---
> >  drivers/clocksource/Kconfig|   4 +
> >  drivers/clocksource/Makefile   |   1 +
> >  drivers/clocksource/arm_global_timer.c | 113 +
> >  3 files changed, 118 insertions(+)
> >  create mode 100644 drivers/clocksource/arm_global_timer.c
> >
> > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> > index 3d63f7ff1..2be5a76b3 100644
> > --- a/drivers/clocksource/Kconfig
> > +++ b/drivers/clocksource/Kconfig
> > @@ -70,3 +70,7 @@ config CLOCKSOURCE_ARMV8_TIMER
> >   bool
> >   default y
> >   depends on ARM && CPU_64v8
> > +
> > +config CLOCKSOURCE_ARM_GLOBAL_TIMER
> > +def_bool y
> > + depends on ARM
>
> Can you add a 'select' of this option to the VFxxx Kconfig instead?
> Having this on all Arm systems is not so nice.
>

Sure, no problem, will do in v2.

Thanks,
Andrey Smirnov

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


v2018.09.1

2018-10-08 Thread Sascha Hauer
We have a stable update for the September release, v2018.09.1. Please
update to this one as it contains several fixes for the recently
introduced dentry cache support.

Sascha


Antony Pavlov (2):
  MIPS: fix PCI quirk infrastructure build
  pci_of_match_device: don't crash on MIPS Malta

Oleksij Rempel (1):
  ARM: i.MX28: Add APBH clk support

Sascha Hauer (8):
  fs: devfs: Create device files as character devices
  fs: devfs: fix r/w permissions
  ARM: Multi PBL: Fix image calculation for certain toolchains
  ARM: omap: xload: Fix network boot filename
  fs: open: Do not forget to set errno
  fs: stat: Do not forget to set errno
  fs: ubifs: Do not free memory not allocated by ubifs
  Release v2018.09.1

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


v2018.10.0

2018-10-08 Thread Sascha Hauer
Hi All,

barebox-2018.10.0 is out. The most important thing this time is that
several issues with the new dentry cache implementation are fixed with
this release, so users of v2018.09.0 are recommended to upgrade to
either this one or v2018.09.1 which I also released.
Other than that we have a huge UBI update from Teresa. This comes as
individual patches directly from the Kernel which means our list of
patches contains authors who never contributed to barebox directly.

Sascha



Aleksander Morgado (3):
  i2c_write: document master send mode
  i2c_read: implement support for master receive mode
  ratp: fix sending data that won't fit in a single RATP packet

Andrew F. Davis (1):
  UBI: Fix typos

Andrey Smirnov (48):
  ARM: cache-l2x0: Make use of IS_ALIGNED and ALIGN_DOWN
  include/common: Make use of ALIGN and ALIGN_DOWN
  net: Do not route traffic to interfaces that are not up
  ARM: mmu64: Don't flush freshly invalidated region
  log2: Use fls_long() in __roundup_pow_of_two()
  USB: host: hub: Make sure to remove dangling pointers
  USB: host: hub: Adjust device speed after every port reset
  clk: clk-sccg-pll: Remove leftover debug output
  Revert "i.MX: Add provisions to boot from IRAM"
  ARM: i.MX: bbu: Remove unused define
  filetype: Add arch/ to include path
  filetype: Add code to detect i.MX image v1
  filetype: Add code to detect i.MX image v2
  ARM: i.MX: bbu: Move inner-image type check
  ARM: i.MX: bbu: Drop IMX_INTERNAL_FLAG_NAND
  ARM: i.MX: bbu: Consolidate various update helpers
  ARM: i.MX: bbu: Simplify imx53_bbu_internal_nand_register_handler()
  ARM: i.MX: bbu: Constify all 'devicefile' arguments
  ARM: i.MX: bbu: Detect which platforms need v2 i.MX header
  ARM: i.MX: bbu: Alias imx5*_bbu_internal_mmc_register_handler()
  ARM: i.MX: bbu: Alias imx5*_bbu_internal_spi_i2c_register_handler()
  ARM: i.MX: bbu: Move protect code into a separate routine
  ARM: i.MX: bbu: Adjust FLASH_HEADER_OFFSET_MMC for i.MX8MQ
  ARM: i.MX: bbu: Add support for SPI/I2C on VFxxx
  ARM: i.MX: zii-vf610-dev-rev-b/c: Add support for BBU on SPI-NOR
  ARM: i.MX: bbu: Add support for MMC on i.MX8MQ
  ARM: nxp-imx8mq-evk: Add eMMC BBU configuration
  libfile: Introduce pwrite_full()
  ARM: i.MX: bbu: Use pwrite_full() instead of pwrite()
  bbu: Remove logical negation in barebox_update_handler_exists()
  block: Do not ignore error in blk->ops->write()
  bbu: Report update failures explicitly
  mfd: rave-sp: Remove unused defines
  mfd: rave-sp: Fix incorrectly specified checksum type
  mfd: rave-sp: Add mapping for legacy EEPROM command
  mfd: rave-sp: Add legacy watchdog ping command translation
  mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support it
  driver: Adopt DMA mask concept from Linux
  net: fec_imx: Specify that DMA is 32-bit only
  mci: imx-esdhc: Specify that DMA is 32-bit only
  net: fec_imx: Return EFAULT when DMA mapping fails
  mci: imx-esdhc: Return EFAULT when DMA mapping fails
  ARM: freescale-mx51-babbage: Add USBH1 PHY reset sequence
  dts: imx51-babbage: Add USBH1 iomux configuration
  ARM: imx51-zii-rdu1: Add USBH1,2 iomux configuration
  ARM: vf610dev: Change "Zodiac" to "ZII"
  scripts: imx: Add support for signed HDMI firmware
  ARM: i.MX: xload: Add support for signed HDMI firmware

Antony Pavlov (2):
  MIPS: fix PCI quirk infrastructure build
  pci_of_match_device: don't crash on MIPS Malta

Ard Biesheuvel (1):
  log2: make order_base_2() behave correctly on const input value zero

Bastian Stender (2):
  ARM: imx: add fusemap entries for i.MX6SDL silicon revision >=1.4
  HAB: fuse recommended OCOTP_DIR_BT_DIS

Ben Dooks (1):
  ubi: pr_err() strings should end with newlines

Boris Brezillon (18):
  UBI: fastmap: use ubi_find_volume() instead of open coding it
  UBI: fix add_fastmap() to use the vid_hdr passed in argument
  UBI: fastmap: avoid multiple be32_to_cpu() when unneccesary
  UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC header
  UBI: factorize code used to manipulate volumes at attach time
  UBI: factorize destroy_av() and ubi_remove_av() code
  UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()
  UBI: fastmap: use ubi_io_{read, write}_data() instead of ubi_io_{read, 
write}()
  UBI: provide helpers to allocate and free aeb elements
  UBI: move the global ech and vidh variables into struct ubi_attach_info
  UBI: simplify recover_peb() code
  UBI: simplify LEB write and atomic LEB change code
  UBI: add an helper to check lnum validity
  UBI: provide an helper to check whether a LEB is mapped or not
  UBI: provide an helper to query LEB information
  UBI: hide EBA internals
 

[PATCH] digest.h: Sync hash_algo values with kernel

2018-10-08 Thread Sascha Hauer
enum hash_algo is exported from the Kernel, so sync it with the numbers
that are exported. Since we have barebox specific extensions to the
hash_algo list add a big comment and put the extenstions at the end.

Signed-off-by: Sascha Hauer 
---
 include/digest.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/digest.h b/include/digest.h
index 4552e58255..a1cdbb2d7a 100644
--- a/include/digest.h
+++ b/include/digest.h
@@ -28,10 +28,10 @@ enum hash_algo {
HASH_ALGO_MD5,
HASH_ALGO_SHA1,
HASH_ALGO_RIPE_MD_160,
-   HASH_ALGO_SHA224,
HASH_ALGO_SHA256,
HASH_ALGO_SHA384,
HASH_ALGO_SHA512,
+   HASH_ALGO_SHA224,
HASH_ALGO_RIPE_MD_128,
HASH_ALGO_RIPE_MD_256,
HASH_ALGO_RIPE_MD_320,
@@ -41,6 +41,12 @@ enum hash_algo {
HASH_ALGO_TGR_128,
HASH_ALGO_TGR_160,
HASH_ALGO_TGR_192,
+   HASH_ALGO_SM3_256,
+   /*
+* The above are exported from the Kernel as
+* /usr/include/linux/hash_info.h and thus have a fixed number, do not
+* change it. Below are barebox specific, subject to renumbering.
+*/
HASH_ALGO_CRC32,
HASH_ALGO__LAST
 };
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mtd: do not attach already attached UBI

2018-10-08 Thread Sascha Hauer
in mtd_detect we do not check if the mtd is already attached to UBI. If
it is we get the error:

ERROR: ubi: mtd0 is already attached to ubi0

Check before trying to attach it to avoid this message.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/core.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index ae7818a189..15fe9ce798 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -589,11 +589,8 @@ static int mtd_detect(struct device_d *dev)
continue;
 
filetype = file_detect_type(buf, bufsize);
-   if (filetype == filetype_ubi) {
+   if (filetype == filetype_ubi && ubi_num_get_by_mtd(mtd) < 0)
ret = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 20);
-   if (ret == -EEXIST)
-   ret = 0;
-   }
 
break;
}
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 13/16] mdio_bus: Allow for non PHY-devices on MDIO buses

2018-10-08 Thread Sascha Hauer
On Sun, Oct 07, 2018 at 11:35:39PM -0700, Andrey Smirnov wrote:
> Instead of just creating a simple PHY device for every child of MDIO
> bus node, add code to check if any of them have "compatible" property
> set as well as code to create a proper platform device for such cases.
> 
> This change is useful for when MDIO bus and some of Ethernet ports are
> connected to a switch or some other MDIO device that doesn't behave
> like a generic PHY and can't be probed via its PHY ID.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>  drivers/net/phy/mdio_bus.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index d7d6d8940..589ed57d2 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -26,6 +26,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #define DEFAULT_GPIO_RESET_ASSERT   1000  /* us */
>  #define DEFAULT_GPIO_RESET_DEASSERT 1000  /* us */
> @@ -179,6 +180,16 @@ static int of_mdiobus_register(struct mii_bus *mdio, 
> struct device_node *np)
>  
>   /* Loop over the child nodes and register a phy_device for each one */
>   for_each_available_child_of_node(np, child) {
> + if (of_get_property(child, "compatible", NULL)) {
> + if (!of_platform_device_create(child, >dev)) {
> + dev_err(>dev,
> + "Failed to create device for %s\n",
> + child->full_name);
> + }
> +
> + continue;
> + }

PHYs can have a compatible property aswell which is checked for here:

> +
>   if (!of_mdiobus_child_is_phy(child))
>   continue;

So I believe you have to create a platform device only if it is not a
PHY device.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 02/16] clocksource: Add ARM global timer support

2018-10-08 Thread Sascha Hauer
On Sun, Oct 07, 2018 at 11:35:28PM -0700, Andrey Smirnov wrote:
> Port corresponding Linux kernel driver. Currently VFxxx SoC is the
> intended consumer because it doesn't include common i.MX GPT block
> used as clocksource by other i.MX SoCs.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>  drivers/clocksource/Kconfig|   4 +
>  drivers/clocksource/Makefile   |   1 +
>  drivers/clocksource/arm_global_timer.c | 113 +
>  3 files changed, 118 insertions(+)
>  create mode 100644 drivers/clocksource/arm_global_timer.c
> 
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 3d63f7ff1..2be5a76b3 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -70,3 +70,7 @@ config CLOCKSOURCE_ARMV8_TIMER
>   bool
>   default y
>   depends on ARM && CPU_64v8
> +
> +config CLOCKSOURCE_ARM_GLOBAL_TIMER
> +def_bool y
> + depends on ARM

Can you add a 'select' of this option to the VFxxx Kconfig instead?
Having this on all Arm systems is not so nice.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v3 2/2] mci: implement command to switch a mmc device to enhanced mode

2018-10-08 Thread Uwe Kleine-König
The command structure allows adding more subcommands and is designed to
match the Linux program mmc from the mmc-utils. So later more commands
can easily be added if need be.

Compared to mmc-utils'

mmc enh_area set <-y|-n|-c>   

the command that is implemented here (

mmc enh_area setmax [-c] 

) is easier to use (because you don't have to check the maximal allowed
size by reading some registers and calculate the available size from
them (which then must be calculated back to register values by the mmc
command)) but less flexible as it doesn't allow all the crazy
possibilities specified in the eMMC standard but just creates an
enhanced area with maximal size.

Signed-off-by: Uwe Kleine-König 
---
 commands/Kconfig  |  11 +++
 commands/Makefile |   1 +
 commands/mmc.c| 195 ++
 include/mci.h |   7 ++
 4 files changed, 214 insertions(+)
 create mode 100644 commands/mmc.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 675bd1ca76a0..221d65a358e0 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -238,6 +238,17 @@ config CMD_VERSION
 
  barebox 2014.05.0-00142-gb289373 #177 Mon May 12 20:35:55 CEST 2014
 
+config CMD_MMC
+   tristate
+   prompt "mmc command allowing to set enhanced area"
+   depends on MCI
+   help
+ Configure mmc cards similar to the userspace mmc utility. Compared to
+ mmc_extcsd it works on a higher abstraction level.
+
+ Currently only the enh_area subcommand is implemented to configure
+ the "Enhanced Area" of an mmc device.
+
 config CMD_MMC_EXTCSD
tristate
prompt "read/write eMMC ext. CSD register"
diff --git a/commands/Makefile b/commands/Makefile
index eb4796389e6b..27a62240b039 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -119,6 +119,7 @@ obj-$(CONFIG_CMD_DHCP)  += dhcp.o
 obj-$(CONFIG_CMD_BOOTCHOOSER)  += bootchooser.o
 obj-$(CONFIG_CMD_DHRYSTONE)+= dhrystone.o
 obj-$(CONFIG_CMD_SPD_DECODE)   += spd_decode.o
+obj-$(CONFIG_CMD_MMC)  += mmc.o
 obj-$(CONFIG_CMD_MMC_EXTCSD)   += mmc_extcsd.o
 obj-$(CONFIG_CMD_NAND_BITFLIP) += nand-bitflip.o
 obj-$(CONFIG_CMD_SEED) += seed.o
diff --git a/commands/mmc.c b/commands/mmc.c
new file mode 100644
index ..b3af2d9c769c
--- /dev/null
+++ b/commands/mmc.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+
+static int mmc_enh_area_setmax(struct mci *mci, u8 *ext_csd)
+{
+   unsigned i;
+   struct {
+   unsigned index;
+   unsigned value;
+   } regval[] = {
+   {
+   .index = EXT_CSD_ERASE_GROUP_DEF,
+   .value = 1,
+   }, {
+   .index = EXT_CSD_ENH_START_ADDR,
+   .value = 0,
+   }, {
+   .index = EXT_CSD_ENH_START_ADDR + 1,
+   .value = 0,
+   }, {
+   .index = EXT_CSD_ENH_START_ADDR + 2,
+   .value = 0,
+   }, {
+   .index = EXT_CSD_ENH_START_ADDR + 3,
+   .value = 0,
+   }, {
+   .index = EXT_CSD_ENH_SIZE_MULT,
+   .value = ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT],
+   }, {
+   .index = EXT_CSD_ENH_SIZE_MULT + 1,
+   .value = ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 1],
+   }, {
+   .index = EXT_CSD_ENH_SIZE_MULT + 2,
+   .value = ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 2],
+   }, {
+   .index = EXT_CSD_PARTITIONS_ATTRIBUTE,
+   .value = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] | 
EXT_CSD_ENH_USR_MASK,
+   }
+   };
+
+   for (i = 0; i < ARRAY_SIZE(regval); ++i) {
+   int ret = mci_switch(mci, regval[i].index, regval[i].value);
+   if (ret) {
+   printf("Failure to write to register %u", 
regval[i].index);
+   return ret;
+   }
+   }
+
+   return 0;
+}
+
+static int mmc_partitioning_complete(struct mci *mci)
+{
+   int ret;
+
+   ret = mci_switch(mci, EXT_CSD_PARTITION_SETTING_COMPLETED, 1);
+   if (ret)
+   printf("Failure to write to 
EXT_CSD_PARTITION_SETTING_COMPLETED\n");
+
+   return ret;
+}
+
+static u8 *mci_get_ext_csd(struct mci *mci)
+{
+   u8 *ext_csd;
+   int ret;
+
+   ext_csd = xmalloc(512);
+
+   ret = mci_send_ext_csd(mci, ext_csd);
+   if (ret) {
+   printf("Failure to read EXT_CSD register\n");
+   return ERR_PTR(-EIO);
+   }
+
+   return ext_csd;
+}
+
+/* enh_area setmax [-c] /dev/mmcX */
+static int do_mmc_enh_area(int argc, char *argv[])
+{
+   char *devpath;
+   struct mci *mci;
+   u8 *ext_csd;
+   int set_completed = 0;
+   

[PATCH v3 1/2] mci: provide wrapper for mci_get_device_by_name ∘ devpath_to_name

2018-10-08 Thread Uwe Kleine-König
Also convert the only user of mci_get_device_by_name to this new
wrapper.

Signed-off-by: Uwe Kleine-König 
---
 commands/mmc_extcsd.c | 6 +++---
 include/mci.h | 6 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index 889a6c614a47..55decd618553 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -2366,7 +2366,7 @@ static int do_mmc_extcsd(int argc, char *argv[])
u8  *dst;
int retval = 0;
int opt;
-   char*devname;
+   char*devpath;
int index = 0;
int value = 0;
int write_operation = 0;
@@ -2404,9 +2404,9 @@ static int do_mmc_extcsd(int argc, char *argv[])
if (optind == argc)
return COMMAND_ERROR_USAGE;
 
-   devname = argv[optind];
+   devpath = argv[optind];
 
-   mci = mci_get_device_by_name(devpath_to_name(devname));
+   mci = mci_get_device_by_devpath(devpath);
if (mci == NULL) {
retval = -ENOENT;
goto error;
diff --git a/include/mci.h b/include/mci.h
index 072008ef9da7..5d0c2f8f9638 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /* These codes should be sorted numerically in order of newness.  If the last
@@ -490,4 +491,9 @@ static inline int mmc_host_is_spi(struct mci_host *host)
 
 struct mci *mci_get_device_by_name(const char *name);
 
+static inline struct mci *mci_get_device_by_devpath(const char *devpath)
+{
+   return mci_get_device_by_name(devpath_to_name(devpath));
+}
+
 #endif /* _MCI_H_ */
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2 0/4] Additional error checking for barebox_update

2018-10-08 Thread Sascha Hauer
On Sun, Oct 07, 2018 at 11:35:14PM -0700, Andrey Smirnov wrote:
> Everyone:
> 
> This is a follow up to discussion [1]. Hopefull all of the patches are
> self-explanatory enough.
> 
> Feedback is welcome!
> 
> Changes since [v1]:
> 
> - Move handler lookup out of barebox_update() in order to avoid
>   making calls to bbu_handler_by_*() twice
> 
> Thanks,
> Andrey Smirnov
> 
> [v1] http://lists.infradead.org/pipermail/barebox/2018-September/034865.html
> [1] http://lists.infradead.org/pipermail/barebox/2018-August/034573.html
> 
> Andrey Smirnov (4):
>   bbu: Expose bbu_find_handler_by_*() functions
>   bbu: Add "handler" parameter to barebox_update()
>   bbu: command: Make sure specified update handler exists
>   bbu: Simplify bbu_find_handler_by_device()

Applied, thanks

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2 0/6] ZII RPU2 i.MX7D board support

2018-10-08 Thread Sascha Hauer
On Sun, Oct 07, 2018 at 11:34:03PM -0700, Andrey Smirnov wrote:
> Everyone:
> 
> This series is a number of small patches I developed while adding
> support for ZII's RPU2 board. Hopefully all of them are self-explanatory.
> 
> Feedback is welcome!
> 
> Changes since [v1]:
> 
> - Renamed flash-header-mx7-default.imxcfg to 
> flash-header-mx7-sabresd.imxcfg
> 
> Thanks,
> Andrey Smirnov
> 
> [v1] http://lists.infradead.org/pipermail/barebox/2018-September/034845.html
> 
> Andrey Smirnov (6):
>   ARM: i.MX: esdctl: Add memory size detection for i.MX7D
>   ARM: freescale-mx7-sabresd: Make use of imx7d_barebox_entry()
>   i.MX7D: DCD: Create shared DDR configuration header
>   ARM: i.MX7: bbu: Add MMC boot handler
>   ARM: i.MX7: bbu: Add I2C and SPI handler
>   i.MX: Add support for ZII's i.MX7D-based RPU2 board

Applied, thanks

Sascha

> 
>  arch/arm/boards/Makefile  |   1 +
>  .../flash-header-mx7-sabresd.imxcfg   |  79 +--
>  .../boards/freescale-mx7-sabresd/lowlevel.c   |   7 +-
>  arch/arm/boards/zii-imx7d-rpu2/Makefile   |   2 +
>  arch/arm/boards/zii-imx7d-rpu2/board.c|  49 ++
>  .../flash-header-zii-imx7d-rpu2.imxcfg|   6 +
>  arch/arm/boards/zii-imx7d-rpu2/lowlevel.c |  50 ++
>  arch/arm/dts/Makefile |   2 +
>  arch/arm/dts/imx7d-ddrc.dtsi  |  15 +
>  arch/arm/dts/imx7d-zii-rpu2.dts   | 613 ++
>  arch/arm/mach-imx/Kconfig |   4 +
>  arch/arm/mach-imx/esdctl.c|  61 ++
>  arch/arm/mach-imx/imx-bbu-internal.c  |  11 +
>  arch/arm/mach-imx/include/mach/bbu.h  |  20 +
>  arch/arm/mach-imx/include/mach/esdctl.h   |   1 +
>  .../flash-header/imx7d-ddr-sabresd.imxcfg |  78 +++
>  arch/arm/mach-imx/include/mach/imx7-regs.h|   2 +
>  images/Makefile.imx   |   5 +
>  18 files changed, 923 insertions(+), 83 deletions(-)
>  create mode 100644 arch/arm/boards/zii-imx7d-rpu2/Makefile
>  create mode 100644 arch/arm/boards/zii-imx7d-rpu2/board.c
>  create mode 100644 
> arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg
>  create mode 100644 arch/arm/boards/zii-imx7d-rpu2/lowlevel.c
>  create mode 100644 arch/arm/dts/imx7d-ddrc.dtsi
>  create mode 100644 arch/arm/dts/imx7d-zii-rpu2.dts
>  create mode 100644 
> arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg
> 
> -- 
> 2.17.1
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/2] ARM: rdu2: Remove now redundant RAVE SP properties/nodes

2018-10-08 Thread Sascha Hauer
On Sun, Oct 07, 2018 at 11:33:02PM -0700, Andrey Smirnov wrote:
> Remove RAVE SP properties/nodes that are now availible from upstream
> Linux DTS files.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>  arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 16 
>  1 file changed, 16 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi 
> b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
> index a74fb4783..f63b5d2ed 100644
> --- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
> +++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
> @@ -66,19 +66,7 @@
>   nvmem-cell-names = "boot-source";
>   };
>  
> - eeprom@a3 {
> - compatible = "zii,rave-sp-eeprom";
> - reg = <0xa3 0x4000>;
> - zii,eeprom-name = "dds-eeprom";
> - };
> -
>   eeprom@a4 {
> - compatible = "zii,rave-sp-eeprom";
> - reg = <0xa4 0x4000>;
> - #address-cells = <1>;
> - #size-cells = <1>;
> - zii,eeprom-name = "main-eeprom";
> -
>   boot_source: boot-source@83 {
>   reg = <0x83 1>;
>   };
> @@ -91,10 +79,6 @@
>   reg = <0x190 6>;
>   };
>   };
> -
> - backlight {
> - compatible = "zii,rave-sp-backlight";
> - };
>   };
>  };
>  
> -- 
> 2.17.1
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] fs: fix NULL pointer dereference in ramfs_truncate

2018-10-08 Thread Sascha Hauer
On Wed, Oct 03, 2018 at 01:42:16PM +0200, Marcin Niestroj wrote:
> This patch fixes lately introduced speed improvement of ramfs_truncate
> function. Number of chunks were passed to ramfs_find_chunk function,
> which returned NULL as result. Chunks are indexed from 0, hence we
> need to pass (number_of_chunks - 1) to get pointer to the last chunk.
> 
> Fixes: d49dd1d840d7 ("fs: improve ramfs_truncate speed")
> Signed-off-by: Marcin Niestroj 
> ---
> Hi,
> 
> Just few words to clarify where this bug come from.
> 
> We are fixing now patch [1], which was rebased on top of patch [2].
> Simple file transfer using fastboot protocol worked fine in such
> configuration. However it turned out that [2] had bug (`newchunks = 1`
> instead of `oldchunks = 1`). After [2] was fixed it turned out that
> [1] has also bug, which results in NULL pointer dereference during
> file upload with fastboot protocol.
> 
> Patch tested on `next` branch.
> 
> [1] http://lists.infradead.org/pipermail/barebox/2018-September/034859.html
> [2] http://lists.infradead.org/pipermail/barebox/2018-September/034855.html
> 
>  fs/ramfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ramfs.c b/fs/ramfs.c
> index bad126c65..84ecfa0dd 100644
> --- a/fs/ramfs.c
> +++ b/fs/ramfs.c
> @@ -380,7 +380,7 @@ static int ramfs_truncate(struct device_d *dev, FILE *f, 
> ulong size)
>  
>   if (newchunks > oldchunks) {
>   if (data) {
> - data = ramfs_find_chunk(node, oldchunks);
> + data = ramfs_find_chunk(node, oldchunks - 1);

Ok, makes sense. I squashed this into the original commit.

Thanks
  Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2 2/2] mci: implement command to switch a mmc device to enhanced mode

2018-10-08 Thread Sascha Hauer
Hi Uwe,

On Tue, Oct 02, 2018 at 10:33:10AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> On Mon, Jan 22, 2018 at 09:12:34AM +0100, Sascha Hauer wrote:
> > On Fri, Jan 19, 2018 at 02:28:25PM +0100, Uwe Kleine-König wrote:
> > > new file mode 100644
> > > index ..2f5c7ad69a37
> > > --- /dev/null
> > > +++ b/commands/mmc.c
> > > @@ -0,0 +1,171 @@
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +/* enh_area setmax <-y|-n|-c> /dev/mmcX */
> > > +static int do_mmc_enh_area(int argc, char *argv[])
> > > +{
> > > + char *devname;
> > > + struct mci *mci;
> > > + u8 *ext_csd;
> > > + int set_completed = 0;
> > > + int ret;
> > > +
> > > + if (argc != 4 || strcmp(argv[1], "setmax") ||
> > > + argv[2][0] != '-' ||
> > > + (argv[2][1] != 'y' && argv[2][1] != 'n' && argv[2][1] != 'c')) {
> > > + printf("Usage: mmc enh_area setmax <-y|-n|-c> /dev/mmcX\n");
> > > + return 1;
> > > + }
> > 
> > I assume 'y' means 'yes', 'n' means 'no', but what does 'c' mean? It
> > doesn't seem to be implemented and none of these options is documented.
> 
> I'll rework to
> 
>   enh_area setmax [-c] /dev/mmcX
> 
> and add some documentation.
> 
> > > + if (argv[2][1] == 'y')
> > > + set_completed = 1;
> > > +
> > > + devname = argv[3];
> > > + if (!strncmp(devname, "/dev/", 5))
> > > + devname += 5;
> > > +
> > > + mci = mci_get_device_by_name(devname);
> > > + if (!mci) {
> > > + printf("Failure to open %s as mci device\n", devname);
> > > + return -ENOENT;
> > > + }
> > 
> > This part is probably needed by all other future subcommands aswell.
> > Should it be an extra function?
> 
> Something like:
> 
> struct mci *mci_get_device_by_devname(const char *devname)
> {
>   if (!strncmp(devname, "/dev/", 5))
>   devname += 5;

devpath_to_name() instead.

> 
>   return mci_get_device_by_name(devname);
> }
> 
> ?
> 
> > > + if (!(ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & 
> > > EXT_CSD_ENH_ATTRIBUTE_EN_MASK)) {
> > > + printf("Device doesn't support enhanced area\n");
> > > + ret = -EIO;
> > > + goto error;
> > > + }
> > > +
> > > + if (ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED]) {
> > > + printf("Partitioning already finalized\n");
> > > + ret = -EIO;
> > > + goto error;
> > > + }
> > > +
> > > + ret = mci_switch(mci, EXT_CSD_ERASE_GROUP_DEF, 1);
> > > + if (ret) {
> > > + printf("Failure to write to EXT_CSD_ERASE_GROUP_DEF\n");
> > > + goto error;
> > 
> > This command is *very* verbose in the error path. Would it be enough to
> > just write the register number of the failed access instead of the name?
> 
> It prints a single line if an error happens. I'd not say this is too
> verbose. Do you care about the output or the binary size?

The latter.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 09/16] mdio_bus: Fix documentation for mdio_bus_match()

2018-10-08 Thread Andrey Smirnov
Fix documentation for mdio_bus_match(), while at it re-arrange the
code to be easier to follow. Seeing != used as a result of a matching
function is extremely confusing.

Signed-off-by: Andrey Smirnov 
---
 drivers/net/phy/mdio_bus.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 177d54863..d7d6d8940 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -335,16 +335,19 @@ EXPORT_SYMBOL(of_mdio_find_bus);
  * @dev: target PHY device
  * @drv: given PHY driver
  *
- * Description: Given a PHY device, and a PHY driver, return 1 if
- *   the driver supports the device.  Otherwise, return 0.
+ * Description: Given a PHY device, and a PHY driver, return 0 if
+ *   the driver supports the device.  Otherwise, return 1.
  */
 static int mdio_bus_match(struct device_d *dev, struct driver_d *drv)
 {
struct phy_device *phydev = to_phy_device(dev);
struct phy_driver *phydrv = to_phy_driver(drv);
 
-   return ((phydrv->phy_id & phydrv->phy_id_mask) !=
-   (phydev->phy_id & phydrv->phy_id_mask));
+   if ((phydrv->phy_id & phydrv->phy_id_mask) ==
+   (phydev->phy_id & phydrv->phy_id_mask))
+   return 0;
+
+   return 1;
 }
 
 static ssize_t phydev_read(struct cdev *cdev, void *_buf, size_t count, loff_t 
offset, ulong flags)
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 16/16] net: phy: mv88e6xxx: Add support for MAC ports

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 drivers/net/phy/mv88e6xxx/chip.c | 146 ++-
 drivers/net/phy/mv88e6xxx/chip.h |  72 
 drivers/net/phy/mv88e6xxx/port.c | 646 +++
 drivers/net/phy/mv88e6xxx/port.h |  38 ++
 4 files changed, 898 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
index 162acf1cc..5a8947f8b 100644
--- a/drivers/net/phy/mv88e6xxx/chip.c
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -64,12 +64,20 @@ static const struct mv88e6xxx_ops mv88e6097_ops = {
/* MV88E6XXX_FAMILY_6097 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6123_ops = {
/* MV88E6XXX_FAMILY_6165 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6131_ops = {
@@ -85,12 +93,20 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6161_ops = {
/* MV88E6XXX_FAMILY_6165 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6165_ops = {
@@ -104,6 +120,11 @@ static const struct mv88e6xxx_ops mv88e6171_ops = {
/* MV88E6XXX_FAMILY_6351 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6172_ops = {
@@ -112,12 +133,22 @@ static const struct mv88e6xxx_ops mv88e6172_ops = {
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+   .port_set_speed = mv88e6352_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6175_ops = {
/* MV88E6XXX_FAMILY_6351 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+   .port_set_speed = mv88e6185_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6176_ops = {
@@ -126,6 +157,11 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+   .port_set_speed = mv88e6352_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6185_ops = {
@@ -141,6 +177,11 @@ static const struct mv88e6xxx_ops mv88e6190_ops = {
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
+   .port_set_speed = mv88e6390_port_set_speed,
+   .port_link_state = mv88e6352_port_link_state,
 };
 
 static const struct mv88e6xxx_ops mv88e6190x_ops = {
@@ -149,6 +190,11 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = {

[PATCH 15/16] net: phy: mv88e6xxx: Port EEPROM support code

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 drivers/net/phy/mv88e6xxx/chip.c|  85 -
 drivers/net/phy/mv88e6xxx/chip.h|  10 ++
 drivers/net/phy/mv88e6xxx/global2.c | 265 
 drivers/net/phy/mv88e6xxx/global2.h |  29 +++
 4 files changed, 388 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
index cde60f43c..162acf1cc 100644
--- a/drivers/net/phy/mv88e6xxx/chip.c
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -4,6 +4,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -80,6 +81,8 @@ static const struct mv88e6xxx_ops mv88e6131_ops = {
 
 static const struct mv88e6xxx_ops mv88e6141_ops = {
/* MV88E6XXX_FAMILY_6341 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
@@ -105,6 +108,8 @@ static const struct mv88e6xxx_ops mv88e6171_ops = {
 
 static const struct mv88e6xxx_ops mv88e6172_ops = {
/* MV88E6XXX_FAMILY_6352 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
@@ -117,6 +122,8 @@ static const struct mv88e6xxx_ops mv88e6175_ops = {
 
 static const struct mv88e6xxx_ops mv88e6176_ops = {
/* MV88E6XXX_FAMILY_6352 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
@@ -130,48 +137,64 @@ static const struct mv88e6xxx_ops mv88e6185_ops = {
 
 static const struct mv88e6xxx_ops mv88e6190_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6190x_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6191_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6240_ops = {
/* MV88E6XXX_FAMILY_6352 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6290_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6320_ops = {
/* MV88E6XXX_FAMILY_6320 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6321_ops = {
/* MV88E6XXX_FAMILY_6320 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6341_ops = {
/* MV88E6XXX_FAMILY_6341 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
@@ -192,16 +215,22 @@ static const struct mv88e6xxx_ops mv88e6352_ops = {
/* MV88E6XXX_FAMILY_6352 */
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
+   .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom16,
 };
 
 static const struct mv88e6xxx_ops mv88e6390_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
 
 static const struct mv88e6xxx_ops mv88e6390x_ops = {
/* MV88E6XXX_FAMILY_6390 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
 };
@@ -622,6 +651,41 @@ static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip 

Re: [PATCH] arm: crypto: fix SHA256 shipped assembler code

2018-10-08 Thread Sascha Hauer
On Fri, Oct 05, 2018 at 02:30:35PM +0200, Lucas Stach wrote:
> Binutils 2.29 changed behavior of the adr instruction to always
> add the thumb mode switch offset, which breaks usages where the
> user is interested in the address of an internal symbol, instead
> of a jump address. Binutils 3.31 fixed this by only adding the
> offset when interworking is required.
> 
> As there are toolchains out there with broken binutils, it's better
> to fix the code to work around the issue by not using the named
> label.
> 
> Signed-off-by: Lucas Stach 
> Tested-by: Robert Schwebel 
> ---
>  arch/arm/crypto/sha256-core.S_shipped | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/crypto/sha256-core.S_shipped 
> b/arch/arm/crypto/sha256-core.S_shipped
> index 15e0f4ad1e68..4f9cf833b94b 100644
> --- a/arch/arm/crypto/sha256-core.S_shipped
> +++ b/arch/arm/crypto/sha256-core.S_shipped
> @@ -92,7 +92,7 @@ sha256_block_data_order:
>  #if __ARM_ARCH__<7
>   sub r3,pc,#8@ sha256_block_data_order
>  #else
> - adr r3,sha256_block_data_order
> + adr r3,.
>  #endif
>  #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
>   ldr r12,.LOPENSSL_armcap
> -- 
> 2.19.0
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 00/14] UBIFS update

2018-10-08 Thread Sascha Hauer
Hi Sam,

On Wed, Oct 03, 2018 at 10:50:29PM +0200, Sam Ravnborg wrote:
> Hi Sasha.
> 
> On Tue, Oct 02, 2018 at 04:03:49PM +0200, Sascha Hauer wrote:
> > This series updates the UBIFS codebase to Linux-4.19-rc6.
> 
> Excpet that we are now in sync with upstream kernel, what else
> does this set of patches provide?
> Better performance, bugs fixed, or?
> 
> Just asking out of curiosity as there is known (by me) problems
> with the current barebox ubifs code.

I am also not aware of any problems in the current UBIFS code. The
motivation for updating it is that I want to add authentication support:
http://lists.infradead.org/pipermail/linux-mtd/2018-September/083902.html
This will be easier on a current codebase.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 10/16] include: linux: phy: Add missing PHY_INTERFACE_* constants

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 include/linux/phy.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index ac750f5c3..5b2c63ff6 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -54,7 +54,16 @@ typedef enum {
PHY_INTERFACE_MODE_RGMII_TXID,
PHY_INTERFACE_MODE_RTBI,
PHY_INTERFACE_MODE_SMII,
+   PHY_INTERFACE_MODE_XGMII,
PHY_INTERFACE_MODE_QSGMII,
+   PHY_INTERFACE_MODE_TRGMII,
+   PHY_INTERFACE_MODE_1000BASEX,
+   PHY_INTERFACE_MODE_2500BASEX,
+   PHY_INTERFACE_MODE_RXAUI,
+   PHY_INTERFACE_MODE_XAUI,
+   /* 10GBASE-KR, XFI, SFI - single lane 10G Serdes */
+   PHY_INTERFACE_MODE_10GKR,
+   PHY_INTERFACE_MODE_MAX,
 } phy_interface_t;
 
 #define PHY_INIT_TIMEOUT   10
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 08/16] of: Port latest of_device_make_bus_id() implementation

2018-10-08 Thread Andrey Smirnov
Code implementing of_device_make_bus_id() in Barebox uses rather old
implementation from Linux kernel and has a very significan limitation
in that it will produce identical names for different DT nodes that
happen to have the same node name as well as "reg" property.

One such example, that tirggered this change, is "switch@0" nodes that
can be found in dts/src/arm/vf610-zii-dev-rev-c.dts

This commit replaces original code with the current Linux kernel
implementation that traverses DT hierarchy from leaf node to its root
concatenating node names in the process.

Signed-off-by: Andrey Smirnov 
---
 drivers/of/platform.c | 80 ---
 1 file changed, 22 insertions(+), 58 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 4fd3ce2b7..17052f419 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -43,71 +43,35 @@ EXPORT_SYMBOL(of_find_device_by_node);
  * of_device_make_bus_id - Use the device node data to assign a unique name
  * @dev: pointer to device structure that is linked to a device tree node
  *
- * This routine will first try using either the dcr-reg or the reg property
- * value to derive a unique name.  As a last resort it will use the node
- * name followed by a unique number.
+ * This routine will first try using the translated bus address to
+ * derive a unique name. If it cannot, then it will prepend names from
+ * parent nodes until a unique name can be derived.
  */
 static void of_device_make_bus_id(struct device_d *dev)
 {
-   static int bus_no_reg_magic;
-   struct device_node *np = dev->device_node;
-   const __be32 *reg, *addrp;
+   struct device_node *node = dev->device_node;
+   const __be32 *reg;
u64 addr;
-   char *name, *at;
-
-   name = xstrdup(np->name);
-   at = strchr(name, '@');
-   if (at)
-   *at = '\0';
-
-#ifdef CONFIG_PPC_DCR
-   /*
-* If it's a DCR based device, use 'd' for native DCRs
-* and 'D' for MMIO DCRs.
-*/
-   reg = of_get_property(np, "dcr-reg", NULL);
-   if (reg) {
-#ifdef CONFIG_PPC_DCR_NATIVE
-   dev_set_name(dev, "d%x.%s", *reg, name);
-#else /* CONFIG_PPC_DCR_NATIVE */
-   u64 addr = of_translate_dcr_address(np, *reg, NULL);
-   if (addr != OF_BAD_ADDR) {
-   dev_set_name(dev, "D%llx.%s",
-(unsigned long long)addr, name);
-   free(name);
-   return;
-   }
-#endif /* !CONFIG_PPC_DCR_NATIVE */
-   }
-#endif /* CONFIG_PPC_DCR */
-
-   /*
-* For MMIO, get the physical address
-*/
-   reg = of_get_property(np, "reg", NULL);
-   if (reg) {
-   if (of_can_translate_address(np)) {
-   addr = of_translate_address(np, reg);
-   } else {
-   addrp = of_get_address(np, 0, NULL, NULL);
-   if (addrp)
-   addr = of_read_number(addrp, 1);
-   else
-   addr = OF_BAD_ADDR;
-   }
-   if (addr != OF_BAD_ADDR) {
-   dev_set_name(dev, "%llx.%s",
-(unsigned long long)addr, name);
-   free(name);
+
+   /* Construct the name, using parent nodes if necessary to ensure 
uniqueness */
+   while (node->parent) {
+   /*
+* If the address can be translated, then that is as much
+* uniqueness as we need. Make it the first component and return
+*/
+   reg = of_get_property(node, "reg", NULL);
+   if (reg && (addr = of_translate_address(node, reg)) != 
OF_BAD_ADDR) {
+   dev_set_name(dev, dev->name ? "%llx.%s:%s" : "%llx.%s",
+(unsigned long long)addr, node->name,
+dev->name);
return;
}
-   }
 
-   /*
-* No BusID, use the node name and add a globally incremented counter
-*/
-   dev_set_name(dev, "%s.%d", name, bus_no_reg_magic++);
-   free(name);
+   /* format arguments only used if dev_name() resolves to NULL */
+   dev_set_name(dev, dev->name ? "%s:%s" : "%s",
+kbasename(node->full_name), dev->name);
+   node = node->parent;
+   }
 }
 
 /**
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 11/16] include: linux: ethtool: Add missing *_UNKNOWN constants

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 include/linux/ethtool.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 4d83fe019..324e40cde 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -72,9 +72,12 @@
 #define SPEED_2500 2500
 #define SPEED_11
 
+#define SPEED_UNKNOWN  -1
+
 /* Duplex, half or full. */
 #define DUPLEX_HALF0x00
 #define DUPLEX_FULL0x01
+#define DUPLEX_UNKNOWN 0xff
 
 /* Which connector port. */
 #define PORT_TP0x00
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 12/16] net: phy: Check phy_mask in get_phy_device()

2018-10-08 Thread Andrey Smirnov
Do not try to probe PHY devices if they are masked via phy_mask of the
corresponding bus. This way we won't try adding devices that are
unlikely to be proper PHYs by default. With this change it is still
remain to be possible to add such a device to the bus explicitly
either using "miitool" or calling phy_device_create() explicilty.

Signed-off-by: Andrey Smirnov 
---
 drivers/net/phy/phy.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 19d458e07..b985b7567 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -234,6 +234,10 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int 
addr)
u32 phy_id = 0;
int r;
 
+   /* skip masked out PHY addresses */
+   if (bus->phy_mask & BIT(addr))
+   return ERR_PTR(-ENODEV);
+
r = get_phy_id(bus, addr, _id);
if (r)
return ERR_PTR(r);
@@ -440,9 +444,6 @@ int phy_device_connect(struct eth_device *edev, struct 
mii_bus *bus, int addr,
}
 
for (i = 0; i < PHY_MAX_ADDR && !edev->phydev; i++) {
-   /* skip masked out PHY addresses */
-   if (bus->phy_mask & (1 << i))
-   continue;
 
phy = mdiobus_scan(bus, i);
if (IS_ERR(phy))
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 13/16] mdio_bus: Allow for non PHY-devices on MDIO buses

2018-10-08 Thread Andrey Smirnov
Instead of just creating a simple PHY device for every child of MDIO
bus node, add code to check if any of them have "compatible" property
set as well as code to create a proper platform device for such cases.

This change is useful for when MDIO bus and some of Ethernet ports are
connected to a switch or some other MDIO device that doesn't behave
like a generic PHY and can't be probed via its PHY ID.

Signed-off-by: Andrey Smirnov 
---
 drivers/net/phy/mdio_bus.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index d7d6d8940..589ed57d2 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DEFAULT_GPIO_RESET_ASSERT   1000  /* us */
 #define DEFAULT_GPIO_RESET_DEASSERT 1000  /* us */
@@ -179,6 +180,16 @@ static int of_mdiobus_register(struct mii_bus *mdio, 
struct device_node *np)
 
/* Loop over the child nodes and register a phy_device for each one */
for_each_available_child_of_node(np, child) {
+   if (of_get_property(child, "compatible", NULL)) {
+   if (!of_platform_device_create(child, >dev)) {
+   dev_err(>dev,
+   "Failed to create device for %s\n",
+   child->full_name);
+   }
+
+   continue;
+   }
+
if (!of_mdiobus_child_is_phy(child))
continue;
 
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 06/16] drivers: Introduce dev_set_name()

2018-10-08 Thread Andrey Smirnov
In order to allow device names that are longer than MAX_DRIVER_NAME,
port Linux kernel function of the same name, and convert all of the
code to use it.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/mach-imx/iim.c   |  2 +-
 .../arm/mach-imx/include/mach/devices-imx51.h |  2 +-
 .../arm/mach-imx/include/mach/devices-imx53.h |  2 +-
 arch/arm/mach-mxs/include/mach/devices.h  |  2 +-
 arch/arm/mach-mxs/ocotp.c |  2 +-
 arch/sandbox/board/console.c  |  2 +-
 common/console.c  |  4 +-
 common/state/state.c  |  2 +-
 drivers/aiodev/core.c |  2 +-
 drivers/amba/bus.c|  2 +-
 drivers/ata/disk_ata_drive.c  |  4 +-
 drivers/base/bus.c|  2 +-
 drivers/base/driver.c | 38 +--
 drivers/base/resource.c   |  2 +-
 drivers/efi/efi-device.c  |  2 +-
 drivers/firmware/socfpga.c|  2 +-
 drivers/i2c/i2c.c |  4 +-
 drivers/mci/mci-core.c|  4 +-
 drivers/mfd/rave-sp.c |  2 +-
 drivers/mtd/core.c|  2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c |  2 +-
 drivers/mtd/ubi/build.c   |  2 +-
 drivers/mtd/ubi/vmt.c |  4 +-
 drivers/net/cpsw.c|  2 +-
 drivers/net/e1000/eeprom.c|  2 +-
 drivers/net/orion-gbe.c   |  2 +-
 drivers/net/phy/mdio_bus.c|  2 +-
 drivers/net/phy/phy.c |  8 ++--
 drivers/nvmem/core.c  |  2 +-
 drivers/nvmem/ocotp.c |  2 +-
 drivers/of/platform.c | 12 +++---
 drivers/pci/bus.c |  3 +-
 drivers/phy/phy-core.c|  2 +-
 drivers/pwm/core.c|  2 +-
 drivers/rtc/class.c   |  2 +-
 drivers/spi/spi.c |  2 +-
 drivers/usb/core/usb.c|  5 ++-
 drivers/usb/gadget/udc-core.c |  4 +-
 drivers/usb/musb/musb_dsps.c  |  2 +-
 drivers/video/backlight.c |  2 +-
 drivers/video/fb.c|  2 +-
 drivers/w1/w1.c   |  4 +-
 drivers/watchdog/wd_core.c|  2 +-
 fs/fs.c   |  2 +-
 include/driver.h  |  5 ++-
 net/eth.c |  2 +-
 46 files changed, 99 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-imx/iim.c b/arch/arm/mach-imx/iim.c
index d4794cbac..207e1879c 100644
--- a/arch/arm/mach-imx/iim.c
+++ b/arch/arm/mach-imx/iim.c
@@ -474,7 +474,7 @@ static int imx_iim_probe(struct device_d *dev)
 
imx_iim = iim;
 
-   strcpy(iim->dev.name, "iim");
+   dev_set_name(>dev, "iim");
iim->dev.parent = dev;
iim->dev.id = DEVICE_ID_SINGLE;
ret = register_device(>dev);
diff --git a/arch/arm/mach-imx/include/mach/devices-imx51.h 
b/arch/arm/mach-imx/include/mach/devices-imx51.h
index cccd8f461..66fe643f8 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx51.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx51.h
@@ -81,7 +81,7 @@ static inline struct device_d *imx51_add_nand(struct 
imx_nand_platform_data *pda
dev->resource = xzalloc(sizeof(struct resource) * ARRAY_SIZE(res));
memcpy(dev->resource, res, sizeof(struct resource) * ARRAY_SIZE(res));
dev->num_resources = ARRAY_SIZE(res);
-   strcpy(dev->name, "imx_nand");
+   dev_set_name(dev, "imx_nand");
dev->id = DEVICE_ID_DYNAMIC;
dev->platform_data = pdata;
 
diff --git a/arch/arm/mach-imx/include/mach/devices-imx53.h 
b/arch/arm/mach-imx/include/mach/devices-imx53.h
index 10caae8c9..27200a26d 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx53.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx53.h
@@ -95,7 +95,7 @@ static inline struct device_d *imx53_add_nand(struct 
imx_nand_platform_data *pda
dev->resource = xzalloc(sizeof(struct resource) * ARRAY_SIZE(res));
memcpy(dev->resource, res, sizeof(struct resource) * ARRAY_SIZE(res));
dev->num_resources = ARRAY_SIZE(res);
-   strcpy(dev->name, "imx_nand");
+   dev_set_name(dev, "imx_nand");
dev->id = DEVICE_ID_DYNAMIC;
dev->platform_data = pdata;
 
diff --git a/arch/arm/mach-mxs/include/mach/devices.h 
b/arch/arm/mach-mxs/include/mach/devices.h
index 5680d61c9..b212aa783 100644
--- a/arch/arm/mach-mxs/include/mach/devices.h
+++ b/arch/arm/mach-mxs/include/mach/devices.h
@@ -26,7 +26,7 @@ static inline struct device_d *mxs_add_nand(unsigned long 
gpmi_base, unsigned lo
dev->resource = 

[PATCH 14/16] net: phy: Add basic driver for MV88E6XXX switches from Marvell

2018-10-08 Thread Andrey Smirnov
Port a very abridged version of MV88E6XXX DSA driver from Linux
kernel. Currently only internal MDIO bus connected to switch PHYs is
exposed.

Signed-off-by: Andrey Smirnov 

net: phy: mv88e6xxx: Expose internal MDIO bus
---
 drivers/net/phy/Kconfig |   6 +
 drivers/net/phy/Makefile|   1 +
 drivers/net/phy/mv88e6xxx/Makefile  |   5 +
 drivers/net/phy/mv88e6xxx/chip.c| 724 
 drivers/net/phy/mv88e6xxx/chip.h|  61 +++
 drivers/net/phy/mv88e6xxx/global2.c | 124 +
 drivers/net/phy/mv88e6xxx/global2.h |  41 ++
 drivers/net/phy/mv88e6xxx/port.c|  20 +
 drivers/net/phy/mv88e6xxx/port.h|  89 
 9 files changed, 1071 insertions(+)
 create mode 100644 drivers/net/phy/mv88e6xxx/Makefile
 create mode 100644 drivers/net/phy/mv88e6xxx/chip.c
 create mode 100644 drivers/net/phy/mv88e6xxx/chip.h
 create mode 100644 drivers/net/phy/mv88e6xxx/global2.c
 create mode 100644 drivers/net/phy/mv88e6xxx/global2.h
 create mode 100644 drivers/net/phy/mv88e6xxx/port.c
 create mode 100644 drivers/net/phy/mv88e6xxx/port.h

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 79fb917ee..3b1a6ea7e 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -48,6 +48,12 @@ config SMSC_PHY
---help---
  Currently supports the LAN83C185, LAN8187 and LAN8700 PHYs
 
+config NET_DSA_MV88E6XXX
+   tristate "Marvell 88E6xxx Ethernet switch fabric support"
+   help
+ This driver adds support for most of the Marvell 88E6xxx models of
+ Ethernet switch chips, except 88E6060.
+
 comment "MII bus device drivers"
 
 config MDIO_MVEBU
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 4424054d9..e4d9ec65a 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_MARVELL_PHY)   += marvell.o
 obj-$(CONFIG_MICREL_PHY)   += micrel.o
 obj-$(CONFIG_NATIONAL_PHY) += national.o
 obj-$(CONFIG_SMSC_PHY) += smsc.o
+obj-$(CONFIG_NET_DSA_MV88E6XXX)+= mv88e6xxx/
 
 obj-$(CONFIG_MDIO_MVEBU)   += mdio-mvebu.o
 obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
diff --git a/drivers/net/phy/mv88e6xxx/Makefile 
b/drivers/net/phy/mv88e6xxx/Makefile
new file mode 100644
index 0..8c8ba78cd
--- /dev/null
+++ b/drivers/net/phy/mv88e6xxx/Makefile
@@ -0,0 +1,5 @@
+obj-y += mv88e6xxx.o
+
+mv88e6xxx-objs := chip.o
+mv88e6xxx-objs += global2.o
+mv88e6xxx-objs += port.o
\ No newline at end of file
diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
new file mode 100644
index 0..cde60f43c
--- /dev/null
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -0,0 +1,724 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "chip.h"
+#include "global2.h"
+#include "port.h"
+
+/* #define MV88E6XXX_SWITCH_GLOBAL_REGS_3  0x1d */
+
+/* List of supported models */
+enum mv88e6xxx_model {
+   MV88E6085,
+   MV88E6095,
+   MV88E6097,
+   MV88E6123,
+   MV88E6131,
+   MV88E6141,
+   MV88E6161,
+   MV88E6165,
+   MV88E6171,
+   MV88E6172,
+   MV88E6175,
+   MV88E6176,
+   MV88E6185,
+   MV88E6190,
+   MV88E6190X,
+   MV88E6191,
+   MV88E6240,
+   MV88E6290,
+   MV88E6320,
+   MV88E6321,
+   MV88E6341,
+   MV88E6350,
+   MV88E6351,
+   MV88E6352,
+   MV88E6390,
+   MV88E6390X,
+};
+
+static const struct mv88e6xxx_ops mv88e6085_ops = {
+   /* MV88E6XXX_FAMILY_6097 */
+   /* FIXME: Was not ported due to lack of HW */
+   .phy_read = NULL,
+   .phy_write = NULL,
+};
+
+static const struct mv88e6xxx_ops mv88e6095_ops = {
+   /* MV88E6XXX_FAMILY_6095 */
+   /* FIXME: Was not ported due to lack of HW */
+   .phy_read = NULL,
+   .phy_write = NULL,
+};
+
+static const struct mv88e6xxx_ops mv88e6097_ops = {
+   /* MV88E6XXX_FAMILY_6097 */
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+};
+
+static const struct mv88e6xxx_ops mv88e6123_ops = {
+   /* MV88E6XXX_FAMILY_6165 */
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+};
+
+static const struct mv88e6xxx_ops mv88e6131_ops = {
+   /* MV88E6XXX_FAMILY_6185 */
+   /* FIXME: Was not ported due to lack of HW */
+   .phy_read = NULL,
+   .phy_write = NULL,
+};
+
+static const struct mv88e6xxx_ops mv88e6141_ops = {
+   /* MV88E6XXX_FAMILY_6341 */
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+};
+
+static const struct mv88e6xxx_ops mv88e6161_ops = {
+   /* MV88E6XXX_FAMILY_6165 */
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+};
+
+static const struct mv88e6xxx_ops mv88e6165_ops = {
+   /* MV88E6XXX_FAMILY_6165 */
+   /* FIXME: Was not ported due to lack of HW 

[PATCH 05/16] of: Demote "Bad cell count for" to debug

2018-10-08 Thread Andrey Smirnov
There are valid use-cases where getting OF_BAD_ADDR via that codepath
is expected. In addition to that analogous code in Linux kernel uses
pr_debug as well.

Signed-off-by: Andrey Smirnov 
---
 drivers/of/address.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 14db08041..4e12522a0 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -379,8 +379,8 @@ static u64 __of_translate_address(struct device_node *dev,
/* Count address cells & copy address locally */
bus->count_cells(dev, , );
if (!OF_CHECK_COUNTS(na, ns)) {
-   printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
-  dev->full_name);
+   pr_debug("prom_parse: Bad cell count for %s\n",
+dev->full_name);
return OF_BAD_ADDR;
}
memcpy(addr, in_addr, na * 4);
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 03/16] i.MX: Move GPT driver to drivers/clocksource

2018-10-08 Thread Andrey Smirnov
Move GPT driver to drivers/clocksource and rename it to
timer-imx-gpt.c to match Linux kernel as well as to keep all
clocksource drivers in a common location.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/mach-imx/Makefile| 1 -
 drivers/clocksource/Kconfig   | 4 
 drivers/clocksource/Makefile  | 1 +
 .../clocksource.c => drivers/clocksource/timer-imx-gpt.c  | 0
 4 files changed, 5 insertions(+), 1 deletion(-)
 rename arch/arm/mach-imx/clocksource.c => drivers/clocksource/timer-imx-gpt.c 
(100%)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 5a01dd57e..97c54406e 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,4 +1,3 @@
-obj-y += clocksource.o
 obj-$(CONFIG_ARCH_IMX1)  += imx1.o
 obj-$(CONFIG_ARCH_IMX25) += imx25.o
 obj-$(CONFIG_ARCH_IMX21) += imx21.o
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 2be5a76b3..bb9d57f91 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -74,3 +74,7 @@ config CLOCKSOURCE_ARMV8_TIMER
 config CLOCKSOURCE_ARM_GLOBAL_TIMER
 def_bool y
depends on ARM
+
+config CLOCKSOURCE_IMX_GPT
+   def_bool y
+   depends on ARCH_IMX
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 51f6cb2f4..ce4d74137 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_CLOCKSOURCE_ROCKCHIP)+= rk_timer.o
 obj-$(CONFIG_CLOCKSOURCE_ATMEL_PIT) += timer-atmel-pit.o
 obj-$(CONFIG_CLOCKSOURCE_ARMV8_TIMER) += armv8-timer.o
 obj-$(CONFIG_CLOCKSOURCE_ARM_GLOBAL_TIMER) += arm_global_timer.o
+obj-$(CONFIG_CLOCKSOURCE_IMX_GPT) += timer-imx-gpt.o
diff --git a/arch/arm/mach-imx/clocksource.c 
b/drivers/clocksource/timer-imx-gpt.c
similarity index 100%
rename from arch/arm/mach-imx/clocksource.c
rename to drivers/clocksource/timer-imx-gpt.c
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 02/16] clocksource: Add ARM global timer support

2018-10-08 Thread Andrey Smirnov
Port corresponding Linux kernel driver. Currently VFxxx SoC is the
intended consumer because it doesn't include common i.MX GPT block
used as clocksource by other i.MX SoCs.

Signed-off-by: Andrey Smirnov 
---
 drivers/clocksource/Kconfig|   4 +
 drivers/clocksource/Makefile   |   1 +
 drivers/clocksource/arm_global_timer.c | 113 +
 3 files changed, 118 insertions(+)
 create mode 100644 drivers/clocksource/arm_global_timer.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 3d63f7ff1..2be5a76b3 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -70,3 +70,7 @@ config CLOCKSOURCE_ARMV8_TIMER
bool
default y
depends on ARM && CPU_64v8
+
+config CLOCKSOURCE_ARM_GLOBAL_TIMER
+def_bool y
+   depends on ARM
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index ea33fff50..51f6cb2f4 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_CLOCKSOURCE_UEMD)+= uemd.o
 obj-$(CONFIG_CLOCKSOURCE_ROCKCHIP)+= rk_timer.o
 obj-$(CONFIG_CLOCKSOURCE_ATMEL_PIT) += timer-atmel-pit.o
 obj-$(CONFIG_CLOCKSOURCE_ARMV8_TIMER) += armv8-timer.o
+obj-$(CONFIG_CLOCKSOURCE_ARM_GLOBAL_TIMER) += arm_global_timer.o
diff --git a/drivers/clocksource/arm_global_timer.c 
b/drivers/clocksource/arm_global_timer.c
new file mode 100644
index 0..44e3a3c76
--- /dev/null
+++ b/drivers/clocksource/arm_global_timer.c
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Clocksource driver for generic Cortex A9 timer block
+ *
+ * Copyright (C) 2018 Zodiac Inflight Innovations
+ * Author: Andrey Smirnov 
+ *
+ * based on corresponding driver from Linux kernel with the following
+ * copyright:
+ *
+ * drivers/clocksource/arm_global_timer.c
+ *
+ * Copyright (C) 2013 STMicroelectronics (R) Limited.
+ * Author: Stuart Menefy 
+ * Author: Srinivas Kandagatla 
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define GT_COUNTER00x00
+#define GT_COUNTER10x04
+
+#define GT_CONTROL 0x08
+#define GT_CONTROL_TIMER_ENABLEBIT(0)  /* this bit is NOT 
banked */
+
+static void __iomem *gt_base;
+
+/*
+ * To get the value from the Global Timer Counter register proceed as follows:
+ * 1. Read the upper 32-bit timer counter register
+ * 2. Read the lower 32-bit timer counter register
+ * 3. Read the upper 32-bit timer counter register again. If the value is
+ *  different to the 32-bit upper value read previously, go back to step 2.
+ *  Otherwise the 64-bit timer counter value is correct.
+ */
+static uint64_t arm_global_clocksource_read(void)
+{
+   uint64_t counter;
+   uint32_t lower;
+   uint32_t upper, old_upper;
+
+   upper = readl(gt_base + GT_COUNTER1);
+   do {
+   old_upper = upper;
+   lower = readl(gt_base + GT_COUNTER0);
+   upper = readl(gt_base + GT_COUNTER1);
+   } while (upper != old_upper);
+
+   counter = upper;
+   counter <<= 32;
+   counter |= lower;
+   return counter;
+}
+
+static struct clocksource cs = {
+   .read   = arm_global_clocksource_read,
+   .mask   = CLOCKSOURCE_MASK(64),
+   .shift  = 0,
+};
+
+static int arm_global_timer_probe(struct device_d *dev)
+{
+   struct resource *iores;
+   struct clk *clk;
+   int ret;
+
+   iores = dev_request_mem_resource(dev, 0);
+   if (IS_ERR(iores))
+   return PTR_ERR(iores);
+
+   clk = clk_get(dev, NULL);
+   if (IS_ERR(clk)) {
+   ret = PTR_ERR(clk);
+   dev_err(dev, "clock not found: %d\n", ret);
+   return ret;
+   }
+
+   ret = clk_enable(clk);
+   if (ret) {
+   dev_err(dev, "clock failed to enable: %d\n", ret);
+   return ret;
+   }
+
+   gt_base = IOMEM(iores->start);
+
+   cs.mult = clocksource_hz2mult(clk_get_rate(clk), cs.shift);
+
+   writel(0, gt_base + GT_CONTROL);
+   writel(0, gt_base + GT_COUNTER0);
+   writel(0, gt_base + GT_COUNTER1);
+   /* enables timer on all the cores */
+   writel(GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
+
+   return init_clock();
+}
+
+static struct of_device_id arm_global_timer_dt_ids[] = {
+   { .compatible = "arm,cortex-a9-global-timer", },
+   { }
+};
+
+static struct driver_d arm_global_timer_driver = {
+   .name = "arm-global-timer",
+   .probe = arm_global_timer_probe,
+   .of_compatible = DRV_OF_COMPAT(arm_global_timer_dt_ids),
+};
+postcore_platform_driver(arm_global_timer_driver);
+
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 07/16] linux: string: Port kbasename()

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 include/linux/string.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index ed4eeb551..8479a3f57 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -111,6 +111,18 @@ extern char *strim(char *);
 
 void *memchr_inv(const void *start, int c, size_t bytes);
 
+/**
+ * kbasename - return the last part of a pathname.
+ *
+ * @path: path to extract the filename from.
+ */
+static inline const char *kbasename(const char *path)
+{
+   const char *tail = strrchr(path, '/');
+   return tail ? tail + 1 : path;
+}
+
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 01/16] ARM: Do not expose ARMv8 functions on ARMv7

2018-10-08 Thread Andrey Smirnov
Assembly implementing current_el(), read_mpidr(), set_cntfrq(),
get_cntfrq() and get_cntpct() is ARMv8 specific, so change #if guard
protecting it to reflect that fact.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/include/asm/system.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 5cf828ea3..2f13e2b98 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -61,7 +61,7 @@
 #define CR_TE   (1 << 30)  /* Thumb exception enable   */
 
 #ifndef __ASSEMBLY__
-#if __LINUX_ARM_ARCH__ >= 7
+#if __LINUX_ARM_ARCH__ > 7
 static inline unsigned int current_el(void)
 {
unsigned int el;
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 00/16]

2018-10-08 Thread Andrey Smirnov
Everyone:

Patches in this series are a result of my work on porting Linux code
for MV88E6xxx switches to Barebox.

 - Patch 1 is loosely related header fix

 - Patch 2 adds clocksource support for ARM global time, needed on
   VF610 in order to get an accurate clocksource. MV88E6xxx EEPROM
   supporte code turned out to be dependent on that.

 - Pathes 3 and 4 are clocksource related fixes

 - Patches 5, 6, 7, 8 update the device naming scheme used by
   Barebox driver code. Old scheme couldn't handle devices created
   for DT nodes with identical names. This was the case on ZII
   VF610 Development Board Rev. C which had two switch devices.

- Patch 9 is documentation/small code fix for generic MDIO bus
  code

- Patches 10, 11 bring needed preprocessor constants from Linux kernel

- Patch 12 prevents PHYs masked by MDIO bus's phy_maks from being
  probed

- Patch 13 allows custom platform deviecs to be attached to an MDIO bus

- Patch 14 exposes internal MDIO bus on MV88E6xxx devices

- Patch 15 support for EEPROM devices attached to MV88E6xxx devices

- Patch 16 exposes ports that don't have a PHY attached as
  "virtual" PHY devices (RPU2 needs this code to properly
  configure port connected to FEC)

NOTE: This is quite a mix and I am more than happy to split this
series in several if current patch grouping is problematic.

Tested on the following H/W:

 - ZII i.MX6Q RDU2, MV88E6352 switch
 - ZII i.MX51 RDU1, MV88E6161 switch
 - ZII i.MX7D RPU2, MV88E6352 switch
 - ZII VF610 CFU1, MV88E6352 switch
 - ZII VF610 SPU3, MV88E6390X switch
 - ZII VF610 Development Board Rev. C, MV88E6390X switch x 2

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey Smirnov (16):
  ARM: Do not expose ARMv8 functions on ARMv7
  clocksource: Add ARM global timer support
  i.MX: Move GPT driver to drivers/clocksource
  clocksource: Introduce ARCH_HAS_IMX_GPT
  of: Demote "Bad cell count for" to debug
  drivers: Introduce dev_set_name()
  linux: string: Port kbasename()
  of: Port latest of_device_make_bus_id() implementation
  mdio_bus: Fix documentation for mdio_bus_match()
  include: linux: phy: Add missing PHY_INTERFACE_* constants
  include: linux: ethtool: Add missing *_UNKNOWN constants
  net: phy: Check phy_mask in get_phy_device()
  mdio_bus: Allow for non PHY-devices on MDIO buses
  net: phy: Add basic driver for MV88E6XXX switches from Marvell
  net: phy: mv88e6xxx: Port EEPROM support code
  net: phy: mv88e6xxx: Add support for MAC ports

 arch/arm/include/asm/system.h |   2 +-
 arch/arm/mach-imx/Kconfig |  11 +
 arch/arm/mach-imx/Makefile|   1 -
 arch/arm/mach-imx/iim.c   |   2 +-
 .../arm/mach-imx/include/mach/devices-imx51.h |   2 +-
 .../arm/mach-imx/include/mach/devices-imx53.h |   2 +-
 arch/arm/mach-mxs/include/mach/devices.h  |   2 +-
 arch/arm/mach-mxs/ocotp.c |   2 +-
 arch/sandbox/board/console.c  |   2 +-
 common/console.c  |   4 +-
 common/state/state.c  |   2 +-
 drivers/aiodev/core.c |   2 +-
 drivers/amba/bus.c|   2 +-
 drivers/ata/disk_ata_drive.c  |   4 +-
 drivers/base/bus.c|   2 +-
 drivers/base/driver.c |  38 +-
 drivers/base/resource.c   |   2 +-
 drivers/clocksource/Kconfig   |  11 +
 drivers/clocksource/Makefile  |   2 +
 drivers/clocksource/arm_global_timer.c| 113 +++
 .../clocksource/timer-imx-gpt.c   |   0
 drivers/efi/efi-device.c  |   2 +-
 drivers/firmware/socfpga.c|   2 +-
 drivers/i2c/i2c.c |   4 +-
 drivers/mci/mci-core.c|   4 +-
 drivers/mfd/rave-sp.c |   2 +-
 drivers/mtd/core.c|   2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c |   2 +-
 drivers/mtd/ubi/build.c   |   2 +-
 drivers/mtd/ubi/vmt.c |   4 +-
 drivers/net/cpsw.c|   2 +-
 drivers/net/e1000/eeprom.c|   2 +-
 drivers/net/orion-gbe.c   |   2 +-
 drivers/net/phy/Kconfig   |   6 +
 drivers/net/phy/Makefile  |   1 +
 drivers/net/phy/mdio_bus.c|  24 +-
 drivers/net/phy/mv88e6xxx/Makefile|   5 +
 drivers/net/phy/mv88e6xxx/chip.c  | 945 ++
 drivers/net/phy/mv88e6xxx/chip.h  | 143 +++
 drivers/net/phy/mv88e6xxx/global2.c   | 389 +++
 drivers/net/phy/mv88e6xxx/global2.h   |  70 ++
 drivers/net/phy/mv88e6xxx/port.c  | 666 
 drivers/net/phy/mv88e6xxx/port.h   

[PATCH v2 4/4] bbu: Simplify bbu_find_handler_by_device()

2018-10-08 Thread Andrey Smirnov
Simplify bbu_find_handler_by_device() by making use of
devpath_to_name() as well as some basic recursion to avoid coding the
same loop twice.

Signed-off-by: Andrey Smirnov 
---
 common/bbu.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/common/bbu.c b/common/bbu.c
index 75c3221d5..5cb09e4eb 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -120,22 +120,18 @@ struct bbu_handler *bbu_find_handler_by_name(const char 
*name)
 struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
 {
struct bbu_handler *handler;
+   const char *devname = devpath_to_name(devicepath);
 
if (!devicepath)
return NULL;
 
-   list_for_each_entry(handler, _image_handlers, list)
+   list_for_each_entry(handler, _image_handlers, list) {
if (!strcmp(handler->devicefile, devicepath))
return handler;
+   }
 
-   if (strncmp(devicepath, "/dev/", 5))
-   return NULL;
-
-   devicepath += 5;
-
-   list_for_each_entry(handler, _image_handlers, list)
-   if (!strcmp(handler->devicefile, devicepath))
-   return handler;
+   if (devname != devicepath)
+   return bbu_find_handler_by_device(devname);
 
return NULL;
 }
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 1/4] bbu: Expose bbu_find_handler_by_*() functions

2018-10-08 Thread Andrey Smirnov
Expose bbu_find_handler_by_device() and bbu_find_handler_by_name() as
public functions and convert the only user of
barebox_update_handler_exists() to use the former function instead.

With this done, barebox_update_handler_exists() is no longer used
anywhere in the code and can be removed.

Signed-off-by: Andrey Smirnov 
---
 common/bbu.c| 24 +---
 drivers/usb/gadget/f_fastboot.c |  2 +-
 include/bbu.h   |  3 ++-
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/common/bbu.c b/common/bbu.c
index 3974bf672..fabd94966 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -99,7 +99,7 @@ int bbu_confirm(struct bbu_data *data)
return -EINTR;
 }
 
-static struct bbu_handler *bbu_find_handler(const char *name)
+struct bbu_handler *bbu_find_handler_by_name(const char *name)
 {
struct bbu_handler *handler;
 
@@ -117,7 +117,7 @@ static struct bbu_handler *bbu_find_handler(const char 
*name)
return NULL;
 }
 
-static struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
+struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
 {
struct bbu_handler *handler;
 
@@ -140,20 +140,6 @@ static struct bbu_handler 
*bbu_find_handler_by_device(const char *devicepath)
return NULL;
 }
 
-bool barebox_update_handler_exists(struct bbu_data *data)
-{
-   struct bbu_handler *handler;
-
-   handler = bbu_find_handler_by_device(data->devicefile);
-   if (handler)
-   return true;
-
-   if (!data->handler_name)
-   return false;
-
-   return bbu_find_handler(data->handler_name) != NULL;
-}
-
 static int bbu_check_of_compat(struct bbu_data *data)
 {
struct device_node *root_node;
@@ -238,7 +224,7 @@ int barebox_update(struct bbu_data *data)
handler = bbu_find_handler_by_device(data->devicefile);
 
if (!handler)
-   handler = bbu_find_handler(data->handler_name);
+   handler = bbu_find_handler_by_name(data->handler_name);
 
if (!handler)
return -ENODEV;
@@ -292,11 +278,11 @@ void bbu_handlers_list(void)
  */
 int bbu_register_handler(struct bbu_handler *handler)
 {
-   if (bbu_find_handler(handler->name))
+   if (bbu_find_handler_by_name(handler->name))
return -EBUSY;
 
if (handler->flags & BBU_HANDLER_FLAG_DEFAULT &&
-   bbu_find_handler(NULL))
+   bbu_find_handler_by_name(NULL))
return -EBUSY;
 
list_add_tail(>list, _image_handlers);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 74fb524c1..ea36fc988 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -996,7 +996,7 @@ static void cb_flash(struct f_fastboot *f_fb, const char 
*cmd)
.flags = BBU_FLAG_YES,
};
 
-   if (!barebox_update_handler_exists())
+   if (!bbu_find_handler_by_device(data.devicefile))
goto copy;
 
fastboot_tx_print(f_fb, "INFOThis is a barebox image...");
diff --git a/include/bbu.h b/include/bbu.h
index d1ab9f563..775d7a310 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -42,7 +42,8 @@ int bbu_confirm(struct bbu_data *);
 
 int barebox_update(struct bbu_data *);
 
-bool barebox_update_handler_exists(struct bbu_data *);
+struct bbu_handler *bbu_find_handler_by_name(const char *name);
+struct bbu_handler *bbu_find_handler_by_device(const char *devicepath);
 
 void bbu_handlers_list(void);
 
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 2/4] bbu: Add "handler" parameter to barebox_update()

2018-10-08 Thread Andrey Smirnov
Add "handler" parameter to barebox_update() and remove the code that
was respondible for header lookup before. With this change finding
appropriate handler is caller's responsibility, which makes it
possible to implement custom handler lookup/existence check, chache
it, and then re-use it without calling handler_find_by_* functions for
the second time.

Signed-off-by: Andrey Smirnov 
---
 commands/barebox-update.c   | 11 ++-
 common/bbu.c| 11 +--
 drivers/usb/gadget/f_fastboot.c |  6 --
 include/bbu.h   |  2 +-
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/commands/barebox-update.c b/commands/barebox-update.c
index 84798ab0d..903b4068d 100644
--- a/commands/barebox-update.c
+++ b/commands/barebox-update.c
@@ -28,6 +28,7 @@ static int do_barebox_update(int argc, char *argv[])
 {
int opt, ret, repair = 0;
struct bbu_data data = {};
+   struct bbu_handler *handler;
void *image = NULL;
 
while ((opt = getopt(argc, argv, "t:yf:ld:r")) > 0) {
@@ -69,7 +70,15 @@ static int do_barebox_update(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
}
 
-   ret = barebox_update();
+   handler = bbu_find_handler_by_device(data.devicefile);
+
+   if (!handler)
+   handler = bbu_find_handler_by_name(data.handler_name);
+
+   if (!handler)
+   return COMMAND_ERROR_USAGE;
+
+   ret = barebox_update(, handler);
 
free(image);
 
diff --git a/common/bbu.c b/common/bbu.c
index fabd94966..75c3221d5 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -216,19 +216,10 @@ static int bbu_check_metadata(struct bbu_data *data)
 /*
  * do a barebox update with data from *data
  */
-int barebox_update(struct bbu_data *data)
+int barebox_update(struct bbu_data *data, struct bbu_handler *handler)
 {
-   struct bbu_handler *handler;
int ret;
 
-   handler = bbu_find_handler_by_device(data->devicefile);
-
-   if (!handler)
-   handler = bbu_find_handler_by_name(data->handler_name);
-
-   if (!handler)
-   return -ENODEV;
-
if (!data->image && !data->imagefile &&
!(handler->flags & BBU_HANDLER_CAN_REFRESH)) {
pr_err("No Image file given\n");
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index ea36fc988..2c137fe7e 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -991,12 +991,14 @@ static void cb_flash(struct f_fastboot *f_fb, const char 
*cmd)
}
 
if (IS_ENABLED(CONFIG_BAREBOX_UPDATE) && 
filetype_is_barebox_image(filetype)) {
+   struct bbu_handler *handler;
struct bbu_data data = {
.devicefile = filename,
.flags = BBU_FLAG_YES,
};
 
-   if (!bbu_find_handler_by_device(data.devicefile))
+   handler = bbu_find_handler_by_device(data.devicefile);
+   if (!handler)
goto copy;
 
fastboot_tx_print(f_fb, "INFOThis is a barebox image...");
@@ -1015,7 +1017,7 @@ static void cb_flash(struct f_fastboot *f_fb, const char 
*cmd)
data.image = f_fb->buf;
data.imagefile = sourcefile;
 
-   ret = barebox_update();
+   ret = barebox_update(, handler);
 
if (ret)
fastboot_tx_print(f_fb, "FAILupdate barebox: %s", 
strerror(-ret));
diff --git a/include/bbu.h b/include/bbu.h
index 775d7a310..0ed355b53 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -40,7 +40,7 @@ int bbu_force(struct bbu_data *, const char *fmt, ...)
 
 int bbu_confirm(struct bbu_data *);
 
-int barebox_update(struct bbu_data *);
+int barebox_update(struct bbu_data *, struct bbu_handler *);
 
 struct bbu_handler *bbu_find_handler_by_name(const char *name);
 struct bbu_handler *bbu_find_handler_by_device(const char *devicepath);
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 0/4] Additional error checking for barebox_update

2018-10-08 Thread Andrey Smirnov
Everyone:

This is a follow up to discussion [1]. Hopefull all of the patches are
self-explanatory enough.

Feedback is welcome!

Changes since [v1]:

- Move handler lookup out of barebox_update() in order to avoid
  making calls to bbu_handler_by_*() twice

Thanks,
Andrey Smirnov

[v1] http://lists.infradead.org/pipermail/barebox/2018-September/034865.html
[1] http://lists.infradead.org/pipermail/barebox/2018-August/034573.html

Andrey Smirnov (4):
  bbu: Expose bbu_find_handler_by_*() functions
  bbu: Add "handler" parameter to barebox_update()
  bbu: command: Make sure specified update handler exists
  bbu: Simplify bbu_find_handler_by_device()

 commands/barebox-update.c   | 41 +---
 common/bbu.c| 47 +++--
 drivers/usb/gadget/f_fastboot.c |  6 +++--
 include/bbu.h   |  5 ++--
 4 files changed, 55 insertions(+), 44 deletions(-)

-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 3/6] i.MX7D: DCD: Create shared DDR configuration header

2018-10-08 Thread Andrey Smirnov
Create a shared DDR configuration header based on configuration used
by i.MX7D SabreSD board.

Signed-off-by: Andrey Smirnov 
---
 .../flash-header-mx7-sabresd.imxcfg   | 79 +--
 .../flash-header/imx7d-ddr-sabresd.imxcfg | 78 ++
 2 files changed, 79 insertions(+), 78 deletions(-)
 create mode 100644 
arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg

diff --git 
a/arch/arm/boards/freescale-mx7-sabresd/flash-header-mx7-sabresd.imxcfg 
b/arch/arm/boards/freescale-mx7-sabresd/flash-header-mx7-sabresd.imxcfg
index 83ed2dc06..f4920bc13 100644
--- a/arch/arm/boards/freescale-mx7-sabresd/flash-header-mx7-sabresd.imxcfg
+++ b/arch/arm/boards/freescale-mx7-sabresd/flash-header-mx7-sabresd.imxcfg
@@ -1,82 +1,5 @@
-/*
- * Copyright (C) 2016 NXP Semiconductors
- *
- * SPDX-License-Identifier:GPL-2.0
- *
- * Refer docs/README.imxmage for more details about how-to configure
- * and create imximage boot image
- *
- * The syntax is taken as close as possible with the kwbimage
- *
- * Taken from upstream U-Boot git://git.denx.de/u-boot.git, commit
- * 1a8150d4b16fbafa6f1d207ddb85eda7dc399e2d
- */
-
 soc imx7
 loadaddr 0x8000
 dcdofs 0x400
 
-#include 
-
-wm 32 0x30340004 0x4F45
-
-wm 32 0x30391000 0x0002
-
-wm 32 MX7_DDRC_MSTR 0x01040001
-wm 32 MX7_DDRC_DFIUPD0 0x8043
-wm 32 MX7_DDRC_DFIUPD1 0x00100020
-wm 32 MX7_DDRC_DFIUPD2 0x8014
-wm 32 MX7_DDRC_RFSHTMG 0x00400046
-wm 32 MX7_DDRC_MP_PCTRL_0 0x0001
-wm 32 MX7_DDRC_INIT0 0x00020083
-wm 32 MX7_DDRC_INIT1 0x0069
-wm 32 MX7_DDRC_INIT3 0x0934
-wm 32 MX7_DDRC_INIT4 0x0408
-wm 32 MX7_DDRC_INIT5 0x0014
-wm 32 MX7_DDRC_RANKCTL 0x033f
-wm 32 MX7_DDRC_DRAMTMG0 0x09081109
-wm 32 MX7_DDRC_DRAMTMG1 0x0007020d
-wm 32 MX7_DDRC_DRAMTMG2 0x03040407
-wm 32 MX7_DDRC_DRAMTMG3 0x2006
-wm 32 MX7_DDRC_DRAMTMG4 0x04020205
-wm 32 MX7_DDRC_DRAMTMG5 0x03030202
-wm 32 MX7_DDRC_DRAMTMG8 0x0803
-wm 32 MX7_DDRC_ZQCTL0 0x00800020
-wm 32 MX7_DDRC_ZQCTL1 0x02000100
-wm 32 MX7_DDRC_DFITMG0 0x02098204
-wm 32 MX7_DDRC_DFITMG1 0x00030303
-wm 32 MX7_DDRC_ADDRMAP0 0x0016
-wm 32 MX7_DDRC_ADDRMAP1 0x00171717
-wm 32 MX7_DDRC_ADDRMAP5 0x04040404
-wm 32 MX7_DDRC_ADDRMAP6 0x0f040404
-wm 32 MX7_DDRC_ODTCFG 0x06000604
-wm 32 MX7_DDRC_ODTMAP 0x0001
-
-wm 32 0x30391000 0x
-
-wm 32 MX7_DDR_PHY_PHY_CON0 0x17420f40
-wm 32 MX7_DDR_PHY_PHY_CON1 0x10210100
-wm 32 MX7_DDR_PHY_PHY_CON4 0x00060807
-wm 32 MX7_DDR_PHY_MDLL_CON0 0x1010007e
-wm 32 MX7_DDR_PHY_DRVDS_CON0 0x0d6e
-wm 32 MX7_DDR_PHY_OFFSET_RD_CON0 0x08080808
-wm 32 MX7_DDR_PHY_OFFSET_WR_CON0 0x08080808
-wm 32 MX7_DDR_PHY_CMD_SDLL_CON0 0x0110
-wm 32 MX7_DDR_PHY_CMD_SDLL_CON0 0x0010
-
-wm 32 MX7_DDR_PHY_ZQ_CON0 0x0e407304
-wm 32 MX7_DDR_PHY_ZQ_CON0 0x0e447304
-wm 32 MX7_DDR_PHY_ZQ_CON0 0x0e447306
-
-check 32 until_any_bit_set MX7_DDR_PHY_ZQ_CON1 0x1
-
-wm 32 MX7_DDR_PHY_ZQ_CON0 0x0e447304
-wm 32 MX7_DDR_PHY_ZQ_CON0 0x0e407304
-
-wm 32 0x30384130 0x
-wm 32 0x30340020 0x0178
-wm 32 0x30384130 0x0002
-
-wm 32 MX7_DDR_PHY_LP_CON0 0x000f
-
-check 32 until_any_bit_set MX7_DDRC_STAT 0x1
+#include 
\ No newline at end of file
diff --git 
a/arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg 
b/arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg
new file mode 100644
index 0..e98f055ee
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 NXP Semiconductors
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ *
+ * Refer docs/README.imxmage for more details about how-to configure
+ * and create imximage boot image
+ *
+ * The syntax is taken as close as possible with the kwbimage
+ *
+ * Taken from upstream U-Boot git://git.denx.de/u-boot.git, commit
+ * 1a8150d4b16fbafa6f1d207ddb85eda7dc399e2d
+ */
+
+#include 
+
+wm 32 0x30340004 0x4F45
+
+wm 32 0x30391000 0x0002
+
+wm 32 MX7_DDRC_MSTR 0x01040001
+wm 32 MX7_DDRC_DFIUPD0 0x8043
+wm 32 MX7_DDRC_DFIUPD1 0x00100020
+wm 32 MX7_DDRC_DFIUPD2 0x8014
+wm 32 MX7_DDRC_RFSHTMG 0x00400046
+wm 32 MX7_DDRC_MP_PCTRL_0 0x0001
+wm 32 MX7_DDRC_INIT0 0x00020083
+wm 32 MX7_DDRC_INIT1 0x0069
+wm 32 MX7_DDRC_INIT3 0x0934
+wm 32 MX7_DDRC_INIT4 0x0408
+wm 32 MX7_DDRC_INIT5 0x0014
+wm 32 MX7_DDRC_RANKCTL 0x033f
+wm 32 MX7_DDRC_DRAMTMG0 0x09081109
+wm 32 MX7_DDRC_DRAMTMG1 0x0007020d
+wm 32 MX7_DDRC_DRAMTMG2 0x03040407
+wm 32 MX7_DDRC_DRAMTMG3 0x2006
+wm 32 MX7_DDRC_DRAMTMG4 0x04020205
+wm 32 MX7_DDRC_DRAMTMG5 0x03030202
+wm 32 MX7_DDRC_DRAMTMG8 0x0803
+wm 32 MX7_DDRC_ZQCTL0 0x00800020
+wm 32 MX7_DDRC_ZQCTL1 0x02000100
+wm 32 MX7_DDRC_DFITMG0 0x02098204
+wm 32 MX7_DDRC_DFITMG1 0x00030303
+wm 32 MX7_DDRC_ADDRMAP0 0x0016
+wm 32 MX7_DDRC_ADDRMAP1 0x00171717
+wm 32 MX7_DDRC_ADDRMAP5 0x04040404
+wm 32 MX7_DDRC_ADDRMAP6 0x0f040404
+wm 32 MX7_DDRC_ODTCFG 0x06000604
+wm 32 MX7_DDRC_ODTMAP 0x0001
+
+wm 32 0x30391000 0x
+
+wm 32 

[PATCH v2 6/6] i.MX: Add support for ZII's i.MX7D-based RPU2 board

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 arch/arm/boards/Makefile  |   1 +
 arch/arm/boards/zii-imx7d-rpu2/Makefile   |   2 +
 arch/arm/boards/zii-imx7d-rpu2/board.c|  49 ++
 .../flash-header-zii-imx7d-rpu2.imxcfg|   6 +
 arch/arm/boards/zii-imx7d-rpu2/lowlevel.c |  50 ++
 arch/arm/dts/Makefile |   2 +
 arch/arm/dts/imx7d-zii-rpu2.dts   | 613 ++
 arch/arm/mach-imx/Kconfig |   4 +
 images/Makefile.imx   |   5 +
 9 files changed, 732 insertions(+)
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/Makefile
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/board.c
 create mode 100644 
arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/lowlevel.c
 create mode 100644 arch/arm/dts/imx7d-zii-rpu2.dts

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index b9bf67f0a..b6766616a 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -156,3 +156,4 @@ obj-$(CONFIG_MACH_ZII_RDU1) += 
zii-imx51-rdu1/
 obj-$(CONFIG_MACH_ZII_RDU2)+= zii-imx6q-rdu2/
 obj-$(CONFIG_MACH_ZII_RDU3)+= zii-imx8mq-rdu3/
 obj-$(CONFIG_MACH_ZII_VF610_DEV)   += zii-vf610-dev/
+obj-$(CONFIG_MACH_ZII_IMX7D_RPU2)  += zii-imx7d-rpu2/
diff --git a/arch/arm/boards/zii-imx7d-rpu2/Makefile 
b/arch/arm/boards/zii-imx7d-rpu2/Makefile
new file mode 100644
index 0..01c7a259e
--- /dev/null
+++ b/arch/arm/boards/zii-imx7d-rpu2/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/zii-imx7d-rpu2/board.c 
b/arch/arm/boards/zii-imx7d-rpu2/board.c
new file mode 100644
index 0..0a99976b7
--- /dev/null
+++ b/arch/arm/boards/zii-imx7d-rpu2/board.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * Copyright (C) 2018 Zodiac Inflight Innovation
+ * Author: Andrey Smirnov 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static void zii_imx7d_rpu2_init_fec(void)
+{
+   void __iomem *gpr = IOMEM(MX7_IOMUXC_GPR_BASE_ADDR);
+   uint32_t gpr1;
+
+   /*
+* Make sure we do not drive ENETn_TX_CLK signal
+*/
+   gpr1 = readl(gpr + IOMUXC_GPR1);
+   gpr1 &= ~(IMX7D_GPR1_ENET1_TX_CLK_SEL_MASK |
+ IMX7D_GPR1_ENET1_CLK_DIR_MASK |
+ IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK |
+ IMX7D_GPR1_ENET2_CLK_DIR_MASK);
+   writel(gpr1, gpr + IOMUXC_GPR1);
+}
+
+static int zii_imx7d_rpu2_coredevices_init(void)
+{
+   if (!of_machine_is_compatible("zii,imx7d-zii-rpu2"))
+   return 0;
+
+   zii_imx7d_rpu2_init_fec();
+
+   imx7_bbu_internal_spi_i2c_register_handler("SPI", "/dev/m25p0.barebox",
+  BBU_HANDLER_FLAG_DEFAULT);
+
+   imx7_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", 0);
+
+   return 0;
+}
+coredevice_initcall(zii_imx7d_rpu2_coredevices_init);
+
diff --git a/arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg 
b/arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg
new file mode 100644
index 0..46f3d9504
--- /dev/null
+++ b/arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg
@@ -0,0 +1,6 @@
+soc imx7
+loadaddr 0x8000
+dcdofs 0x400
+
+#include 
+
diff --git a/arch/arm/boards/zii-imx7d-rpu2/lowlevel.c 
b/arch/arm/boards/zii-imx7d-rpu2/lowlevel.c
new file mode 100644
index 0..1eeab7d21
--- /dev/null
+++ b/arch/arm/boards/zii-imx7d-rpu2/lowlevel.c
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * Copyright (C) 2018 Zodiac Inflight Innovation
+ * Author: Andrey Smirnov 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern char __dtb_imx7d_zii_rpu2_start[];
+
+static inline void setup_uart(void)
+{
+   void __iomem *iomux = IOMEM(MX7_IOMUXC_BASE_ADDR);
+   void __iomem *ccm   = IOMEM(MX7_CCM_BASE_ADDR);
+
+   writel(CCM_CCGR_SETTINGn_NEEDED(0),
+  ccm + CCM_CCGRn_CLR(CCM_CCGR_UART2));
+   writel(CCM_TARGET_ROOTn_ENABLE | UART2_CLK_ROOT__OSC_24M,
+  ccm + CCM_TARGET_ROOTn(UART2_CLK_ROOT));
+   writel(CCM_CCGR_SETTINGn_NEEDED(0),
+  ccm + CCM_CCGRn_SET(CCM_CCGR_UART2));
+
+   mx7_setup_pad(iomux, MX7D_PAD_UART2_TX_DATA__UART2_DCE_TX);
+
+   imx7_uart_setup_ll();
+
+   putc_ll('>');
+}
+
+ENTRY_FUNCTION(start_zii_imx7d_rpu2, r0, r1, r2)
+{
+   imx7_cpu_lowlevel_init();
+
+   if (IS_ENABLED(CONFIG_DEBUG_LL))
+   setup_uart();
+
+   imx7d_barebox_entry(__dtb_imx7d_zii_rpu2_start + get_runtime_offset());
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2361e0d6f..f8ebb6ca5 100644
--- a/arch/arm/dts/Makefile
+++ 

[PATCH v2 4/6] ARM: i.MX7: bbu: Add MMC boot handler

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 arch/arm/mach-imx/imx-bbu-internal.c |  5 +
 arch/arm/mach-imx/include/mach/bbu.h | 10 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c 
b/arch/arm/mach-imx/imx-bbu-internal.c
index 799b97361..77e0b86bc 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -624,6 +624,11 @@ int vf610_bbu_internal_mmcboot_register_handler(const char 
*name,
unsigned long flags)
__alias(imx_bbu_internal_mmcboot_register_handler);
 
+int imx7_bbu_internal_mmcboot_register_handler(const char *name,
+   const char *devicefile,
+   unsigned long flags)
+   __alias(imx_bbu_internal_mmcboot_register_handler);
+
 /*
  * Register an i.MX53 internal boot update handler for i2c/spi
  * EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
diff --git a/arch/arm/mach-imx/include/mach/bbu.h 
b/arch/arm/mach-imx/include/mach/bbu.h
index bc1fc4ba6..1174c21d2 100644
--- a/arch/arm/mach-imx/include/mach/bbu.h
+++ b/arch/arm/mach-imx/include/mach/bbu.h
@@ -59,6 +59,9 @@ int imx51_bbu_internal_mmcboot_register_handler(const char 
*name, const char *de
 int vf610_bbu_internal_mmcboot_register_handler(const char *name, const char 
*devicefile,
unsigned long flags);
 
+int imx7_bbu_internal_mmcboot_register_handler(const char *name, const char 
*devicefile,
+   unsigned long flags);
+
 int imx6_bbu_internal_spi_i2c_register_handler(const char *name, const char 
*devicefile,
unsigned long flags);
 
@@ -134,6 +137,13 @@ static inline int 
vf610_bbu_internal_mmcboot_register_handler(const char *name,
return -ENOSYS;
 }
 
+static inline int imx7_bbu_internal_mmcboot_register_handler(const char *name,
+const char 
*devicefile,
+unsigned long 
flags)
+{
+   return -ENOSYS;
+}
+
 static inline int imx6_bbu_internal_spi_i2c_register_handler(const char *name, 
const char *devicefile,
unsigned long flags)
 {
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 2/6] ARM: freescale-mx7-sabresd: Make use of imx7d_barebox_entry()

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 arch/arm/boards/freescale-mx7-sabresd/lowlevel.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c 
b/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
index 43aa61075..f718ea73b 100644
--- a/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
+++ b/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern char __dtb_imx7d_sdb_start[];
 
@@ -33,14 +34,10 @@ static inline void setup_uart(void)
 
 ENTRY_FUNCTION(start_imx7d_sabresd, r0, r1, r2)
 {
-   void *fdt;
-
imx7_cpu_lowlevel_init();
 
if (IS_ENABLED(CONFIG_DEBUG_LL))
setup_uart();
 
-   fdt = __dtb_imx7d_sdb_start + get_runtime_offset();
-
-   barebox_arm_entry(0x8000, SZ_1G, fdt);
+   imx7d_barebox_entry(__dtb_imx7d_sdb_start + get_runtime_offset());
 }
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 0/6] ZII RPU2 i.MX7D board support

2018-10-08 Thread Andrey Smirnov
Everyone:

This series is a number of small patches I developed while adding
support for ZII's RPU2 board. Hopefully all of them are self-explanatory.

Feedback is welcome!

Changes since [v1]:

- Renamed flash-header-mx7-default.imxcfg to flash-header-mx7-sabresd.imxcfg

Thanks,
Andrey Smirnov

[v1] http://lists.infradead.org/pipermail/barebox/2018-September/034845.html

Andrey Smirnov (6):
  ARM: i.MX: esdctl: Add memory size detection for i.MX7D
  ARM: freescale-mx7-sabresd: Make use of imx7d_barebox_entry()
  i.MX7D: DCD: Create shared DDR configuration header
  ARM: i.MX7: bbu: Add MMC boot handler
  ARM: i.MX7: bbu: Add I2C and SPI handler
  i.MX: Add support for ZII's i.MX7D-based RPU2 board

 arch/arm/boards/Makefile  |   1 +
 .../flash-header-mx7-sabresd.imxcfg   |  79 +--
 .../boards/freescale-mx7-sabresd/lowlevel.c   |   7 +-
 arch/arm/boards/zii-imx7d-rpu2/Makefile   |   2 +
 arch/arm/boards/zii-imx7d-rpu2/board.c|  49 ++
 .../flash-header-zii-imx7d-rpu2.imxcfg|   6 +
 arch/arm/boards/zii-imx7d-rpu2/lowlevel.c |  50 ++
 arch/arm/dts/Makefile |   2 +
 arch/arm/dts/imx7d-ddrc.dtsi  |  15 +
 arch/arm/dts/imx7d-zii-rpu2.dts   | 613 ++
 arch/arm/mach-imx/Kconfig |   4 +
 arch/arm/mach-imx/esdctl.c|  61 ++
 arch/arm/mach-imx/imx-bbu-internal.c  |  11 +
 arch/arm/mach-imx/include/mach/bbu.h  |  20 +
 arch/arm/mach-imx/include/mach/esdctl.h   |   1 +
 .../flash-header/imx7d-ddr-sabresd.imxcfg |  78 +++
 arch/arm/mach-imx/include/mach/imx7-regs.h|   2 +
 images/Makefile.imx   |   5 +
 18 files changed, 923 insertions(+), 83 deletions(-)
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/Makefile
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/board.c
 create mode 100644 
arch/arm/boards/zii-imx7d-rpu2/flash-header-zii-imx7d-rpu2.imxcfg
 create mode 100644 arch/arm/boards/zii-imx7d-rpu2/lowlevel.c
 create mode 100644 arch/arm/dts/imx7d-ddrc.dtsi
 create mode 100644 arch/arm/dts/imx7d-zii-rpu2.dts
 create mode 100644 
arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg

-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 5/6] ARM: i.MX7: bbu: Add I2C and SPI handler

2018-10-08 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov 
---
 arch/arm/mach-imx/imx-bbu-internal.c |  6 ++
 arch/arm/mach-imx/include/mach/bbu.h | 10 ++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c 
b/arch/arm/mach-imx/imx-bbu-internal.c
index 77e0b86bc..5f85b13dc 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -649,6 +649,12 @@ int vf610_bbu_internal_spi_i2c_register_handler(const char 
*name,
unsigned long flags)
__alias(imx6_bbu_internal_spi_i2c_register_handler);
 
+
+int imx7_bbu_internal_spi_i2c_register_handler(const char *name,
+   const char *devicefile,
+   unsigned long flags)
+   __alias(imx6_bbu_internal_spi_i2c_register_handler);
+
 int imx_bbu_external_nor_register_handler(const char *name,
  const char *devicefile,
  unsigned long flags)
diff --git a/arch/arm/mach-imx/include/mach/bbu.h 
b/arch/arm/mach-imx/include/mach/bbu.h
index 1174c21d2..c8223c840 100644
--- a/arch/arm/mach-imx/include/mach/bbu.h
+++ b/arch/arm/mach-imx/include/mach/bbu.h
@@ -71,6 +71,9 @@ int vf610_bbu_internal_mmc_register_handler(const char *name, 
const char *device
 int vf610_bbu_internal_spi_i2c_register_handler(const char *name, const char 
*devicefile,
unsigned long flags);
 
+int imx7_bbu_internal_spi_i2c_register_handler(const char *name, const char 
*devicefile,
+  unsigned long flags);
+
 int imx8mq_bbu_internal_mmc_register_handler(const char *name, const char 
*devicefile,
 unsigned long flags);
 
@@ -175,6 +178,13 @@ vf610_bbu_internal_spi_i2c_register_handler(const char 
*name, char *devicefile,
return -ENOSYS;
 }
 
+static inline int
+imx7_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefile,
+  unsigned long flags)
+{
+   return -ENOSYS;
+}
+
 #endif
 
 #if defined(CONFIG_BAREBOX_UPDATE_IMX_EXTERNAL_NAND)
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] ARM: rdu1: Remove now redundant RAVE SP properties/nodes

2018-10-08 Thread Andrey Smirnov
Remove RAVE SP properties/nodes that are now availible from upstream
Linux DTS files.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/dts/imx51-zii-rdu1.dts | 21 -
 1 file changed, 21 deletions(-)

diff --git a/arch/arm/dts/imx51-zii-rdu1.dts b/arch/arm/dts/imx51-zii-rdu1.dts
index bde565fe0..93bb344f5 100644
--- a/arch/arm/dts/imx51-zii-rdu1.dts
+++ b/arch/arm/dts/imx51-zii-rdu1.dts
@@ -53,37 +53,16 @@
 
  {
rave-sp {
-   #address-cells = <1>;
-   #size-cells = <1>;
-
watchdog {
nvmem-cells = <_source>;
nvmem-cell-names = "boot-source";
};
 
-   eeprom@a3 {
-   compatible = "zii,rave-sp-eeprom";
-   reg = <0xa3 0x4000>;
-   #address-cells = <1>;
-   #size-cells = <1>;
-   zii,eeprom-name = "dds-eeprom";
-   };
-
eeprom@a4 {
-   compatible = "zii,rave-sp-eeprom";
-   reg = <0xa4 0x4000>;
-   #address-cells = <1>;
-   #size-cells = <1>;
-   zii,eeprom-name = "main-eeprom";
-
boot_source: boot-source@83 {
reg = <0x83 1>;
};
};
-
-   backlight {
-   compatible = "zii,rave-sp-backlight";
-   };
};
 };
 
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] ARM: rdu2: Remove now redundant RAVE SP properties/nodes

2018-10-08 Thread Andrey Smirnov
Remove RAVE SP properties/nodes that are now availible from upstream
Linux DTS files.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 16 
 1 file changed, 16 deletions(-)

diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi 
b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index a74fb4783..f63b5d2ed 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -66,19 +66,7 @@
nvmem-cell-names = "boot-source";
};
 
-   eeprom@a3 {
-   compatible = "zii,rave-sp-eeprom";
-   reg = <0xa3 0x4000>;
-   zii,eeprom-name = "dds-eeprom";
-   };
-
eeprom@a4 {
-   compatible = "zii,rave-sp-eeprom";
-   reg = <0xa4 0x4000>;
-   #address-cells = <1>;
-   #size-cells = <1>;
-   zii,eeprom-name = "main-eeprom";
-
boot_source: boot-source@83 {
reg = <0x83 1>;
};
@@ -91,10 +79,6 @@
reg = <0x190 6>;
};
};
-
-   backlight {
-   compatible = "zii,rave-sp-backlight";
-   };
};
 };
 
-- 
2.17.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox