Re: [PATCH] scripts: imx/mxs remove mxs-usb-loader

2017-03-08 Thread Sascha Hauer
On Tue, Mar 07, 2017 at 12:22:49PM +0100, Oleksij Rempel wrote:
> ... and use imx-usb-loader instead
> 
> Signed-off-by: Oleksij Rempel 
> ---
>  arch/arm/mach-imx/Kconfig |   7 +-
>  arch/arm/mach-mxs/Kconfig |   7 +-
>  scripts/Makefile  |   7 +-
>  scripts/imx/Kconfig   |   6 ++
>  scripts/mxs-usb-loader.c  | 236 
> --
>  5 files changed, 11 insertions(+), 252 deletions(-)
>  create mode 100644 scripts/imx/Kconfig
>  delete mode 100644 scripts/mxs-usb-loader.c
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 9dbe31c4b..420b52281 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -632,12 +632,7 @@ endmenu
>  
>  menu "i.MX specific settings"
>  
> -config ARCH_IMX_USBLOADER
> - bool "compile imx-usb-loader"
> - help
> -   imx-usb-loader is a tool to upload and start imximages to an i.MX SoC
> -   in ROM boot mode. It requires libusb, so make sure you have the libusb
> -   devel package installed on your machine.
> +source scripts/imx/Kconfig
>  
>  config IMX_IIM
>   tristate "IIM fusebox device"
> diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
> index facab9c25..25e2a8d04 100644
> --- a/arch/arm/mach-mxs/Kconfig
> +++ b/arch/arm/mach-mxs/Kconfig
> @@ -143,11 +143,6 @@ endif
>  
>  endmenu
>  
> -config ARCH_MXS_USBLOADER
> - bool "compile mxs-usb-loader"
> - help
> -   mxs-usb-loader is a tool to upload and start mxs bootstream images to 
> an
> -   i.MX SoC in ROM boot mode. It requires libusb, so make sure you have 
> the libusb
> -   devel package installed on your machine.
> +source scripts/imx/Kconfig

Including the same file two times confuses Kconfig. Here the search
function found the menu path where it's included the first time, but in
the menu itself it is then sorted in where it's included the second
time.

I refactored a bit to include only once.

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] scripts: imx/mxs remove mxs-usb-loader

2017-03-07 Thread Oleksij Rempel
... and use imx-usb-loader instead

Signed-off-by: Oleksij Rempel 
---
 arch/arm/mach-imx/Kconfig |   7 +-
 arch/arm/mach-mxs/Kconfig |   7 +-
 scripts/Makefile  |   7 +-
 scripts/imx/Kconfig   |   6 ++
 scripts/mxs-usb-loader.c  | 236 --
 5 files changed, 11 insertions(+), 252 deletions(-)
 create mode 100644 scripts/imx/Kconfig
 delete mode 100644 scripts/mxs-usb-loader.c

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 9dbe31c4b..420b52281 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -632,12 +632,7 @@ endmenu
 
 menu "i.MX specific settings"
 
-config ARCH_IMX_USBLOADER
-   bool "compile imx-usb-loader"
-   help
- imx-usb-loader is a tool to upload and start imximages to an i.MX SoC
- in ROM boot mode. It requires libusb, so make sure you have the libusb
- devel package installed on your machine.
+source scripts/imx/Kconfig
 
 config IMX_IIM
tristate "IIM fusebox device"
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index facab9c25..25e2a8d04 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -143,11 +143,6 @@ endif
 
 endmenu
 
-config ARCH_MXS_USBLOADER
-   bool "compile mxs-usb-loader"
-   help
- mxs-usb-loader is a tool to upload and start mxs bootstream images to 
an
- i.MX SoC in ROM boot mode. It requires libusb, so make sure you have 
the libusb
- devel package installed on your machine.
+source scripts/imx/Kconfig
 
 endif
diff --git a/scripts/Makefile b/scripts/Makefile
index a5c16b2f3..78bb7d5e2 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -22,16 +22,15 @@ hostprogs-$(CONFIG_ARCH_SOCFPGA) += socfpga_mkimage
 hostprogs-$(CONFIG_ARCH_MXS) += mxsimage mxsboot
 HOSTCFLAGS += -I$(srctree)/scripts/include/
 HOSTLOADLIBES_mxsimage  = `pkg-config --libs openssl`
-HOSTCFLAGS_mxs-usb-loader.o = `pkg-config --cflags libusb-1.0`
-HOSTLOADLIBES_mxs-usb-loader  = `pkg-config --libs libusb-1.0`
-hostprogs-$(CONFIG_ARCH_MXS_USBLOADER)  += mxs-usb-loader
 HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
 HOSTLOADLIBES_omap3-usb-loader  = `pkg-config --libs libusb-1.0`
 hostprogs-$(CONFIG_OMAP3_USB_LOADER)  += omap3-usb-loader
 
 subdir-y   += mod
 subdir-$(CONFIG_OMAP4_USBBOOT) += omap4_usbboot
-subdir-$(CONFIG_ARCH_IMX)  += imx
+ifneq ($(filter y,$(CONFIG_ARCH_IMX) $(CONFIG_ARCH_MXS)),)
+subdir-y   += imx
+endif
 subdir-$(CONFIG_X86)   += setupmbr
 subdir-$(CONFIG_DTC)   += dtc
 subdir-$(CONFIG_ARCH_TEGRA)+= tegra
diff --git a/scripts/imx/Kconfig b/scripts/imx/Kconfig
new file mode 100644
index 0..de052d070
--- /dev/null
+++ b/scripts/imx/Kconfig
@@ -0,0 +1,6 @@
+config ARCH_IMX_USBLOADER
+   bool "compile imx-usb-loader"
+   help
+ imx-usb-loader is a tool to upload and start imximages to an i.MX SoC
+ in ROM boot mode. It requires libusb, so make sure you have the libusb
+ devel package installed on your machine.
diff --git a/scripts/mxs-usb-loader.c b/scripts/mxs-usb-loader.c
deleted file mode 100644
index 8529274d6..0
--- a/scripts/mxs-usb-loader.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/***
- * __   __   ___.
- *   Open  \__   \     |  | _\_ |__   ___  ___
- *   Source |   _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
- *   Jukebox||   (  <_> )  \___|< | \_\ (  <_> > <  <
- *   Firmware   ||_  /\/ \___  >__|_ \|___  /\/__/\_ \
- * \/\/ \/\/\/
- * $Id$
- *
- * Copyright (C) 2010 Amaury Pouly
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- /
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-void put32le(uint8_t * buf, uint32_t i)
-{
-   *buf++ = i & 0xff;
-   *buf++ = (i >> 8) & 0xff;
-   *buf++ = (i >> 16) & 0xff;
-   *buf++ = (i >> 24) & 0xff;
-}
-
-void put32be(uint8_t * buf, uint32_t i)
-{
-   *buf++ = (i >> 24) & 0xff;
-   *buf++ = (i >> 16) & 0xff;
-   *buf++ = (i >> 8) & 0xff;
-   *buf++ = i & 0xff;
-}
-
-enum dev_type_t {
-   HID_DEVICE,
-   RECOVERY_DEVICE,
-};
-
-struct dev_info_t {
-   uint16_t vendor_id;
-   uint16_t product_id;
-   unsigned xfer_size;
-   enum dev_type_t dev_type;
-};
-
-struct dev_info_