mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] sandbox: Makefile: drop unused SUBARCH stuff
From: Antony Pavlov @ 2016-10-03 11:56 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/sandbox/Makefile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index a539a90..8155a79 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -31,11 +31,6 @@ else
 CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
 endif
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-				  -e s/arm.*/arm/ -e s/sa110/arm/ \
-				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
-				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
-
 archprepare: maketools
 
 PHONY += maketools
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH] net/phy: marvell: fix error handling
From: Uwe Kleine-König @ 2016-09-30 20:10 UTC (permalink / raw)
  To: barebox

Without first assigning to ret it doesn't make sense to check it.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/phy/marvell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 6409f14ae2e2..9a963f6d5e61 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -198,7 +198,8 @@ static int m88e1121_config_init(struct phy_device *phydev)
 	if (ret < 0)
 		return ret;
 
-	phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_MARVELL_PHY_DEFAULT_PAGE);
+	ret = phy_write(phydev, MII_MARVELL_PHY_PAGE,
+			MII_MARVELL_PHY_DEFAULT_PAGE);
 	if (ret < 0)
 		return ret;
 
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 0/2] H100 support
From: Lucas Stach @ 2016-09-30 16:03 UTC (permalink / raw)
  To: barebox

This adds support for the H100 baseboard. Series is on top of -next
as the base DT for this board is only in Linux 4.8.

Lucas Stach (2):
  ARM: microsom: use imx6q_barebox_entry
  ARM: imx6: add support for Auvidea H100

 arch/arm/boards/solidrun-microsom/board.c    | 16 ++++++-
 arch/arm/boards/solidrun-microsom/lowlevel.c | 24 +++++++---
 arch/arm/dts/Makefile                        |  2 +-
 arch/arm/dts/imx6q-h100.dts                  | 70 ++++++++++++++++++++++++++++
 images/Makefile.imx                          |  5 ++
 5 files changed, 108 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-h100.dts

-- 
2.9.3


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

^ permalink raw reply

* [PATCH 1/2] ARM: microsom: use imx6q_barebox_entry
From: Lucas Stach @ 2016-09-30 16:04 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930160401.21147-1-l.stach@pengutronix.de>

Instead of hardcoding the different RAM sizes.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/boards/solidrun-microsom/lowlevel.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boards/solidrun-microsom/lowlevel.c b/arch/arm/boards/solidrun-microsom/lowlevel.c
index 54f1cdf9f4ea..3d5ab7a13f42 100644
--- a/arch/arm/boards/solidrun-microsom/lowlevel.c
+++ b/arch/arm/boards/solidrun-microsom/lowlevel.c
@@ -1,8 +1,7 @@
+#include <asm/barebox-arm.h>
 #include <common.h>
-#include <linux/sizes.h>
+#include <mach/esdctl.h>
 #include <mach/generic.h>
-#include <asm/barebox-arm-head.h>
-#include <asm/barebox-arm.h>
 
 extern char __dtb_imx6dl_hummingboard_start[];
 extern char __dtb_imx6q_hummingboard_start[];
@@ -14,7 +13,7 @@ ENTRY_FUNCTION(start_hummingboard_microsom_i1, r0, r1, r2)
 	imx6_cpu_lowlevel_init();
 
 	fdt = __dtb_imx6dl_hummingboard_start - get_runtime_offset();
-	barebox_arm_entry(0x10000000, SZ_512M, fdt);
+	imx6q_barebox_entry(fdt);
 }
 
 ENTRY_FUNCTION(start_hummingboard_microsom_i2, r0, r1, r2)
@@ -24,7 +23,7 @@ ENTRY_FUNCTION(start_hummingboard_microsom_i2, r0, r1, r2)
 	imx6_cpu_lowlevel_init();
 
 	fdt = __dtb_imx6dl_hummingboard_start - get_runtime_offset();
-	barebox_arm_entry(0x10000000, SZ_1G, fdt);
+	imx6q_barebox_entry(fdt);
 }
 
 ENTRY_FUNCTION(start_hummingboard_microsom_i2ex, r0, r1, r2)
@@ -34,7 +33,7 @@ ENTRY_FUNCTION(start_hummingboard_microsom_i2ex, r0, r1, r2)
 	imx6_cpu_lowlevel_init();
 
 	fdt = __dtb_imx6q_hummingboard_start - get_runtime_offset();
-	barebox_arm_entry(0x10000000, SZ_1G, fdt);
+	imx6q_barebox_entry(fdt);
 }
 
 ENTRY_FUNCTION(start_hummingboard_microsom_i4, r0, r1, r2)
@@ -44,5 +43,5 @@ ENTRY_FUNCTION(start_hummingboard_microsom_i4, r0, r1, r2)
 	imx6_cpu_lowlevel_init();
 
 	fdt = __dtb_imx6q_hummingboard_start - get_runtime_offset();
-	barebox_arm_entry(0x10000000, SZ_2G, fdt);
+	imx6q_barebox_entry(fdt);
 }
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 2/2] ARM: imx6: add support for Auvidea H100
From: Lucas Stach @ 2016-09-30 16:04 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930160401.21147-1-l.stach@pengutronix.de>

The Auvidea H100 is a baseboard for the SolidRun MicroSOM, which
provides HDMI IN/OUT capabilities.

Currently supported is only a combination of the H100 baseboard
with a i2eX MicroSOM.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/boards/solidrun-microsom/board.c    | 16 ++++++-
 arch/arm/boards/solidrun-microsom/lowlevel.c | 11 +++++
 arch/arm/dts/Makefile                        |  2 +-
 arch/arm/dts/imx6q-h100.dts                  | 70 ++++++++++++++++++++++++++++
 images/Makefile.imx                          |  5 ++
 5 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-h100.dts

diff --git a/arch/arm/boards/solidrun-microsom/board.c b/arch/arm/boards/solidrun-microsom/board.c
index 28a60b9e8c79..b9041687e49c 100644
--- a/arch/arm/boards/solidrun-microsom/board.c
+++ b/arch/arm/boards/solidrun-microsom/board.c
@@ -93,10 +93,24 @@ static int hummingboard_device_init(void)
 }
 device_initcall(hummingboard_device_init);
 
+static int h100_device_init(void)
+{
+	if (!of_machine_is_compatible("auvidea,h100"))
+		return 0;
+
+	microsom_eth_init();
+
+	barebox_set_hostname("h100");
+
+	return 0;
+}
+device_initcall(h100_device_init);
+
 static int hummingboard_late_init(void)
 {
 	if (!of_machine_is_compatible("solidrun,hummingboard/dl") &&
-	    !of_machine_is_compatible("solidrun,hummingboard/q"))
+	    !of_machine_is_compatible("solidrun,hummingboard/q") &&
+	    !of_machine_is_compatible("auvidea,h100"))
 		return 0;
 
 	imx6_bbu_internal_mmc_register_handler("sdcard", "/dev/mmc1.barebox",
diff --git a/arch/arm/boards/solidrun-microsom/lowlevel.c b/arch/arm/boards/solidrun-microsom/lowlevel.c
index 3d5ab7a13f42..7b97f2e94797 100644
--- a/arch/arm/boards/solidrun-microsom/lowlevel.c
+++ b/arch/arm/boards/solidrun-microsom/lowlevel.c
@@ -5,6 +5,7 @@
 
 extern char __dtb_imx6dl_hummingboard_start[];
 extern char __dtb_imx6q_hummingboard_start[];
+extern char __dtb_imx6q_h100_start[];
 
 ENTRY_FUNCTION(start_hummingboard_microsom_i1, r0, r1, r2)
 {
@@ -45,3 +46,13 @@ ENTRY_FUNCTION(start_hummingboard_microsom_i4, r0, r1, r2)
 	fdt = __dtb_imx6q_hummingboard_start - get_runtime_offset();
 	imx6q_barebox_entry(fdt);
 }
+
+ENTRY_FUNCTION(start_h100_microsom_i2ex, r0, r1, r2)
+{
+	void *fdt;
+
+	imx6_cpu_lowlevel_init();
+
+	fdt = __dtb_imx6q_h100_start - get_runtime_offset();
+	imx6q_barebox_entry(fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d1a3fe8ae847..2aca5e757da0 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -64,7 +64,7 @@ pbl-dtb-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += socfpga_cyclone5_socrates.dtb.o
 pbl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC) += socfpga_cyclone5_de0_nano_soc.dtb.o
 pbl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += socfpga_cyclone5_sockit.dtb.o
 pbl-dtb-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingboard.dtb.o
+pbl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingboard.dtb.o imx6q-h100.dtb.o
 pbl-dtb-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
 pbl-dtb-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
 pbl-dtb-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
diff --git a/arch/arm/dts/imx6q-h100.dts b/arch/arm/dts/imx6q-h100.dts
new file mode 100644
index 000000000000..bfee186f28a4
--- /dev/null
+++ b/arch/arm/dts/imx6q-h100.dts
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 Lucas Stach <kernel@pengutronix.de>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License
+ *     version 2 as published by the Free Software Foundation.
+ *
+ *     This file is distributed in the hope that it will be useful
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <arm/imx6q-h100.dts>
+
+/ {
+	chosen {
+		environment {
+			compatible = "barebox,environment";
+			device-path = &usdhc2, "partname:barebox-environment";
+		};
+	};
+};
+
+&ocotp {
+	barebox,provide-mac-address = <&fec 0x620>;
+};
+
+&usdhc2 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "barebox";
+		reg = <0x0 0xe0000>;
+	};
+
+	partition@e0000 {
+		label = "barebox-environment";
+		reg = <0xe0000 0x20000>;
+	};
+};
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 1904e8bcf3db..8db9c754f212 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -274,6 +274,11 @@ CFG_start_hummingboard_microsom_i4.pblx.imximg = $(board)/solidrun-microsom/flas
 FILE_barebox-solidrun-hummingboard-microsom-i4.img = start_hummingboard_microsom_i4.pblx.imximg
 image-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += barebox-solidrun-hummingboard-microsom-i4.img
 
+pblx-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += start_h100_microsom_i2ex
+CFG_start_h100_microsom_i2ex.pblx.imximg = $(board)/solidrun-microsom/flash-header-microsom-i2eX.imxcfg
+FILE_barebox-auvidea-h100-microsom-i2eX.img = start_h100_microsom_i2ex.pblx.imximg
+image-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += barebox-auvidea-h100-microsom-i2eX.img
+
 pblx-$(CONFIG_MACH_NITROGEN6) += start_imx6q_nitrogen6x_1g
 CFG_start_imx6q_nitrogen6x_1g.pblx.imximg = $(board)/boundarydevices-nitrogen6/flash-header-nitrogen6q-1g.imxcfg
 FILE_barebox-boundarydevices-imx6q-nitrogen6x-1g.img = start_imx6q_nitrogen6x_1g.pblx.imximg
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 05/10] arm(64): move HAS_DMA and HAS_MODULES to CPU_32
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

We don't yet have an implementation for those two features on ARM64, so move
them to a place where they are only selected for a 32bit barebox.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/Kconfig     | 2 --
 arch/arm/cpu/Kconfig | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 150320c6af86..cb121ab98dcb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1,8 +1,6 @@
 config ARM
 	bool
 	select HAS_KALLSYMS
-	select HAS_MODULES
-	select HAS_DMA
 	select HAS_CACHE
 	select HAVE_CONFIGURABLE_TEXT_BASE
 	select HAVE_PBL_IMAGE
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 9928120cc020..e45e05bdb19d 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -5,6 +5,8 @@ config PHYS_ADDR_T_64BIT
 
 config CPU_32
 	bool
+	select HAS_MODULES
+	select HAS_DMA
 
 config CPU_64
 	bool
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 06/10] arm(64): don't advertise stack_dumping capabilities for ARM64
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

The unwind code to support this feature is not there yet.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/include/asm/barebox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/barebox.h b/arch/arm/include/asm/barebox.h
index 31a8e1563050..5a6622235b82 100644
--- a/arch/arm/include/asm/barebox.h
+++ b/arch/arm/include/asm/barebox.h
@@ -2,8 +2,10 @@
 #define _BAREBOX_H_	1
 
 #ifdef CONFIG_ARM_UNWIND
+#ifndef CONFIG_CPU_V8
 #define ARCH_HAS_STACK_DUMP
 #endif
+#endif
 
 #ifdef CONFIG_ARM_EXCEPTIONS
 #define ARCH_HAS_DATA_ABORT_MASK
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 10/10] arm64: don't allow to build relocatable image
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

The current ARM64 implementation is lacking the lowlevel functions
to do the relocation. Don't allow to select it.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index cd3f6d0cb068..7869a531bf48 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -344,7 +344,7 @@ config KALLSYMS
 	  This is useful to print a nice backtrace when an exception occurs.
 
 config RELOCATABLE
-	depends on PPC || ARM
+	depends on PPC || (ARM && !CPU_V8)
 	bool "generate relocatable barebox binary"
 	help
 	  A non relocatable barebox binary will run at it's compiled in
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 09/10] arm64: drop unneeded files from Makefile
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

ARM64 has native instructions for division and thus doesn't need the
helper functions implemented in those files.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/lib64/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/lib64/Makefile b/arch/arm/lib64/Makefile
index 87e26f6afab2..4b7b7e3cc5e3 100644
--- a/arch/arm/lib64/Makefile
+++ b/arch/arm/lib64/Makefile
@@ -4,6 +4,4 @@ obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memcpy.o
 obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memset.o
 extra-y += barebox.lds
 
-pbl-y	+= lib1funcs.o
-pbl-y	+= ashldi3.o
 pbl-y	+= div0.o
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 02/10] mfd: syscon: drop EXPORT_SYMBOL for static function
From: Lucas Stach @ 2016-09-30 10:35 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/mfd/syscon.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 295e210f6e2d..6ef30ce1959e 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -76,8 +76,6 @@ static void __iomem *syscon_node_to_base(struct device_node *np)
 
 	return syscon->base;
 }
-EXPORT_SYMBOL_GPL(syscon_node_to_regmap);
-
 
 void __iomem *syscon_base_lookup_by_pdevname(const char *s)
 {
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 08/10] arm64: include correct setupc file in ARM64 PBL
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/cpu/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index 331c1cd8bc8d..d8cb1871a60f 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -16,8 +16,10 @@ obj-y += start.o entry.o
 
 ifeq ($(CONFIG_CPU_64v8), y)
 obj-y += setupc_64.o
+pbl-y += setupc_64.o
 else
 obj-y += setupc.o
+pbl-y += setupc.o
 endif
 
 #
@@ -48,7 +50,7 @@ obj-$(CONFIG_CPU_64v8) += cache-armv8.o
 AFLAGS_pbl-cache-armv8.o       :=-Wa,-march=armv8-a
 pbl-$(CONFIG_CPU_64v8) += cache-armv8.o
 
-pbl-y += setupc.o entry.o
+pbl-y += entry.o
 pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
 pbl-$(CONFIG_PBL_MULTI_IMAGES) += uncompress.o
 
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 07/10] arm: semihosting support is not implemented for ARM64
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

Don't allow it to be selected in a ARM64 build.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cb121ab98dcb..07c5e2d6f590 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -376,6 +376,7 @@ config ARM_UNWIND
 
 config ARM_SEMIHOSTING
 	bool "enable ARM semihosting support"
+	depends on !CPU_V8
 	help
 	  This option enables ARM semihosting support in barebox. ARM
 	  semihosting is a communication discipline that allows code
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 04/10] arm64: select ARM_EXCEPTIONS
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

The current ARM64 lowlevel code needs the exception vector to set
up all the ELs. Select ARM_EXCEPTIONS to make sure this is always
present.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/cpu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 450a6d593a4b..9928120cc020 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -80,6 +80,7 @@ config CPU_V8
 	bool
 	select CPU_64v8
 	select CPU_SUPPORTS_64BIT_KERNEL
+	select ARM_EXCEPTIONS
 
 config CPU_XSC3
         bool
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 03/10] video: tc358767: depend on EDID helpers
From: Lucas Stach @ 2016-09-30 10:36 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20160930103607.15791-1-l.stach@pengutronix.de>

The eDP part need to be able to read the panel EDID.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/video/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 2457bb9e45f9..8f31f5af745e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -130,6 +130,7 @@ config DRIVER_VIDEO_MTL017
 config DRIVER_VIDEO_TC358767
 	bool "TC358767A Display Port encoder"
 	select VIDEO_VPL
+	depends on DRIVER_VIDEO_EDID
 	depends on I2C
 	depends on OFTREE
 	help
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 01/10] serial: arm_dcc: depend on !CPU_V8
From: Lucas Stach @ 2016-09-30 10:35 UTC (permalink / raw)
  To: barebox

The DCC console uses coprocessor registers registers accesses, the
implementation of those for ARMv8 is currently missing.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 146bf1ec3c30..b112d7ee044a 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -2,7 +2,7 @@ menu "serial drivers"
 	depends on !CONSOLE_NONE
 
 config DRIVER_SERIAL_ARM_DCC
-	depends on ARM
+	depends on ARM && !CPU_V8
 	bool "ARM Debug Communications Channel (DCC) serial driver"
 
 config SERIAL_AMBA_PL011
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 2/2] i.MX: Register imx6_fixup_cpus() for MX6Q+ as well
From: Andrey Smirnov @ 2016-09-29 22:21 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov
In-Reply-To: <1475187703-5748-1-git-send-email-andrew.smirnov@gmail.com>

Register imx6_fixup_cpus() for MX6Q+ as well as for MX6Q and MX6DL.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/mach-imx/imx6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index 101a2f6..809584e 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -255,7 +255,8 @@ static int imx6_fixup_cpus(struct device_node *root, void *context)
 
 static int imx6_fixup_cpus_register(void)
 {
-	if (!of_machine_is_compatible("fsl,imx6q") &&
+	if (!of_machine_is_compatible("fsl,imx6qp") &&
+	    !of_machine_is_compatible("fsl,imx6q")  &&
 	    !of_machine_is_compatible("fsl,imx6dl"))
 		return 0;
 
-- 
2.5.5


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

^ permalink raw reply related

* [PATCH 1/2] i.MX: Introduce imx6_cpu_revision()
From: Andrey Smirnov @ 2016-09-29 22:21 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Factor out CPU revision identification code from imx6_init() into a
standalone inline function (similar to imx6_cpu_type()), so that it
would be possible to use that functionality in PBL code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---

Sascha:

I have an almost ready to send, board support patch that uses this in
PBL. Unfortunately at the last minute a regression in functionality
was discovered in that code, so I can't post it until that is
resolved, meanwhile I am hoping I can get this code in while I am
debugging.

Let me know if you'd rathe I send everything together.

 arch/arm/mach-imx/imx6.c              | 38 +----------------------------------
 arch/arm/mach-imx/include/mach/imx6.h | 36 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index ba8fb89..101a2f6 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -25,8 +25,6 @@
 #include <asm/mmu.h>
 #include <asm/cache-l2x0.h>
 
-#define SI_REV 0x260
-
 void imx6_init_lowlevel(void)
 {
 	void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
@@ -115,47 +113,13 @@ void imx6_init_lowlevel(void)
 int imx6_init(void)
 {
 	const char *cputypestr;
-	u32 rev;
 	u32 mx6_silicon_revision;
 
 	imx6_init_lowlevel();
 
 	imx6_boot_save_loc((void *)MX6_SRC_BASE_ADDR);
 
-	rev = readl(MX6_ANATOP_BASE_ADDR + SI_REV);
-
-	switch (rev & 0xfff) {
-	case 0x00:
-		mx6_silicon_revision = IMX_CHIP_REV_1_0;
-		break;
-
-	case 0x01:
-		mx6_silicon_revision = IMX_CHIP_REV_1_1;
-		break;
-
-	case 0x02:
-		mx6_silicon_revision = IMX_CHIP_REV_1_2;
-		break;
-
-	case 0x03:
-		mx6_silicon_revision = IMX_CHIP_REV_1_3;
-		break;
-
-	case 0x04:
-		mx6_silicon_revision = IMX_CHIP_REV_1_4;
-		break;
-
-	case 0x05:
-		mx6_silicon_revision = IMX_CHIP_REV_1_5;
-		break;
-
-	case 0x100:
-		mx6_silicon_revision = IMX_CHIP_REV_2_0;
-		break;
-
-	default:
-		mx6_silicon_revision = IMX_CHIP_REV_UNKNOWN;
-	}
+	mx6_silicon_revision = imx6_cpu_revision();
 
 	switch (imx6_cpu_type()) {
 	case IMX6_CPUTYPE_IMX6Q:
diff --git a/arch/arm/mach-imx/include/mach/imx6.h b/arch/arm/mach-imx/include/mach/imx6.h
index e8ffa47..fb5eaf1 100644
--- a/arch/arm/mach-imx/include/mach/imx6.h
+++ b/arch/arm/mach-imx/include/mach/imx6.h
@@ -4,6 +4,7 @@
 #include <io.h>
 #include <mach/generic.h>
 #include <mach/imx6-regs.h>
+#include <mach/revision.h>
 
 void imx6_init_lowlevel(void);
 
@@ -48,6 +49,41 @@ static inline int imx6_cpu_type(void)
 	return __imx6_cpu_type();
 }
 
+static inline int __imx6_cpu_revision(void)
+{
+
+	uint32_t rev;
+
+	rev = readl(MX6_ANATOP_BASE_ADDR + IMX6_ANATOP_SI_REV);
+
+	switch (rev & 0xfff) {
+	case 0x00:
+		return IMX_CHIP_REV_1_0;
+	case 0x01:
+		return IMX_CHIP_REV_1_1;
+	case 0x02:
+		return IMX_CHIP_REV_1_2;
+	case 0x03:
+		return IMX_CHIP_REV_1_3;
+	case 0x04:
+		return IMX_CHIP_REV_1_4;
+	case 0x05:
+		return IMX_CHIP_REV_1_5;
+	case 0x100:
+		return IMX_CHIP_REV_2_0;
+	}
+
+	return IMX_CHIP_REV_UNKNOWN;
+}
+
+static inline int imx6_cpu_revision(void)
+{
+	if (!cpu_is_mx6())
+		return 0;
+
+	return __imx6_cpu_revision();
+}
+
 #define DEFINE_MX6_CPU_TYPE(str, type)					\
 	static inline int cpu_mx6_is_##str(void)			\
 	{								\
-- 
2.5.5


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

^ permalink raw reply related

* [PATCH 8/9] usb: imx-us-phy: Convert driver to generic phy support
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

The generic phy layer now supports USB phys, so convert
the driver over to use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/configs/imx_defconfig    |  2 ++
 arch/arm/configs/imx_v7_defconfig |  2 ++
 drivers/usb/imx/Kconfig           |  3 +--
 drivers/usb/imx/chipidea-imx.c    | 21 ++++++++++++++++++
 drivers/usb/imx/imx-usb-phy.c     | 46 +++++++++++++++++++++++++++++++++++++--
 5 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/arch/arm/configs/imx_defconfig b/arch/arm/configs/imx_defconfig
index 69ab021..7d061cd 100644
--- a/arch/arm/configs/imx_defconfig
+++ b/arch/arm/configs/imx_defconfig
@@ -107,6 +107,8 @@ CONFIG_EEPROM_AT24=y
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_IMX=y
 CONFIG_IMX_WEIM=y
+CONFIG_GENERIC_PHY=y
+CONFIG_USB_NOP_XCEIV=y
 CONFIG_FS_EXT4=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index e3a8f47..ac649ac 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -177,6 +177,8 @@ CONFIG_MXS_APBH_DMA=y
 CONFIG_GPIO_STMPE=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED=y
+CONFIG_GENERIC_PHY=y
+CONFIG_USB_NOP_XCEIV=y
 CONFIG_FS_EXT4=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
diff --git a/drivers/usb/imx/Kconfig b/drivers/usb/imx/Kconfig
index b1ce682..b0c6a41 100644
--- a/drivers/usb/imx/Kconfig
+++ b/drivers/usb/imx/Kconfig
@@ -16,5 +16,4 @@ config USB_IMX_CHIPIDEA
 
 config USB_IMX_PHY
 	bool
-	depends on ARCH_IMX
-	default y if ARCH_IMX6
+	default y if ARCH_IMX6 && GENERIC_PHY
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index a6f5926..ed00ff4 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -26,6 +26,7 @@
 #include <usb/ulpi.h>
 #include <usb/fsl_usb2.h>
 #include <linux/err.h>
+#include <linux/phy/phy.h>
 
 #define MXC_EHCI_PORTSC_MASK ((0xf << 28) | (1 << 25))
 
@@ -40,6 +41,8 @@ struct imx_chipidea {
 	struct param_d *param_mode;
 	int role_registered;
 	struct regulator *vbus;
+	struct phy *phy;
+	struct usb_phy *usbphy;
 };
 
 static int imx_chipidea_port_init(void *drvdata)
@@ -260,6 +263,23 @@ static int imx_chipidea_probe(struct device_d *dev)
 	if (IS_ERR(ci->vbus))
 		ci->vbus = NULL;
 
+	if (of_property_read_bool(dev->device_node, "fsl,usbphy")) {
+		ci->phy = of_phy_get_by_phandle(dev, "fsl,usbphy", 0);
+		if (IS_ERR(ci->phy)) {
+			ret = PTR_ERR(ci->phy);
+			dev_err(dev, "Cannot get phy: %s\n", strerror(-ret));
+			return ret;
+		} else {
+			ci->usbphy = phy_to_usbphy(ci->phy);
+			if (IS_ERR(ci->usbphy))
+				return PTR_ERR(ci->usbphy);
+
+			ret = phy_init(ci->phy);
+			if (ret)
+				return ret;
+		}
+	}
+
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
@@ -270,6 +290,7 @@ static int imx_chipidea_probe(struct device_d *dev)
 	ci->data.init = imx_chipidea_port_init;
 	ci->data.post_init = imx_chipidea_port_post_init;
 	ci->data.drvdata = ci;
+	ci->data.usbphy = ci->usbphy;
 
 	if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_HSIC)
 		imx_chipidea_port_init(ci);
diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index eec195d..2829ffc 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -19,6 +19,8 @@
 #include <errno.h>
 #include <driver.h>
 #include <malloc.h>
+#include <usb/phy.h>
+#include <linux/phy/phy.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 
@@ -33,12 +35,17 @@
 #define USBPHY_CTRL_ENUTMILEVEL2	(1 << 14)
 
 struct imx_usbphy {
+	struct usb_phy usb_phy;
+	struct phy *phy;
 	void __iomem *base;
 	struct clk *clk;
+	struct phy_provider *provider;
 };
 
-static int imx_usbphy_enable(struct imx_usbphy *imxphy)
+static int imx_usbphy_phy_init(struct phy *phy)
 {
+	struct imx_usbphy *imxphy = phy_get_drvdata(phy);
+
 	clk_enable(imxphy->clk);
 
 	/* reset usbphy */
@@ -60,6 +67,26 @@ static int imx_usbphy_enable(struct imx_usbphy *imxphy)
 	return 0;
 }
 
+static struct phy *imx_usbphy_xlate(struct device_d *dev,
+				    struct of_phandle_args *args)
+{
+	struct imx_usbphy *imxphy = dev->priv;
+
+	return imxphy->phy;
+}
+
+static struct usb_phy *imx_usbphy_to_usbphy(struct phy *phy)
+{
+	struct imx_usbphy *imxphy = phy_get_drvdata(phy);
+
+	return &imxphy->usb_phy;
+}
+
+static const struct phy_ops imx_phy_ops = {
+	.init = imx_usbphy_phy_init,
+	.to_usbphy = imx_usbphy_to_usbphy,
+};
+
 static int imx_usbphy_probe(struct device_d *dev)
 {
 	struct resource *iores;
@@ -82,7 +109,22 @@ static int imx_usbphy_probe(struct device_d *dev)
 		goto err_clk;
 	}
 
-	imx_usbphy_enable(imxphy);
+	dev->priv = imxphy;
+
+	imxphy->usb_phy.dev = dev;
+	imxphy->phy = phy_create(dev, NULL, &imx_phy_ops, NULL);
+	if (IS_ERR(imxphy->phy)) {
+		ret = PTR_ERR(imxphy->phy);
+		goto err_clk;
+	}
+
+	phy_set_drvdata(imxphy->phy, imxphy);
+
+	imxphy->provider = of_phy_provider_register(dev, imx_usbphy_xlate);
+	if (IS_ERR(imxphy->provider)) {
+		ret = PTR_ERR(imxphy->provider);
+		goto err_clk;
+	}
 
 	dev_dbg(dev, "phy enabled\n");
 
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 5/9] phy: Introduce of_phy_get_by_phandle
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

Currently generic phy support assumes that the standard phy binding from
dts/Bindings/phy/phy-bindings.txt is used. This adds a helper function
which can be used to retrieve a phy when this standard binding is not
used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/phy/phy-core.c  | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/phy/phy.h |  8 ++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 67af14f..7c1f3d4 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -268,6 +268,42 @@ struct phy *of_phy_get(struct device_node *np, const char *con_id)
 }
 
 /**
+ * of_phy_get_by_phandle() - lookup and obtain a reference to a phy.
+ * @dev: device that requests this phy
+ * @phandle - name of the property holding the phy phandle value
+ * @index - the index of the phy
+ *
+ * Returns the phy driver, after getting a refcount to it; or
+ * -ENODEV if there is no such phy. The caller is responsible for
+ * calling phy_put() to release that count.
+ */
+struct phy *of_phy_get_by_phandle(struct device_d *dev, const char *phandle,
+				  u8 index)
+{
+	struct device_node *np;
+	struct phy_provider *phy_provider;
+
+	if (!dev->device_node) {
+		dev_dbg(dev, "device does not have a device node entry\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	np = of_parse_phandle(dev->device_node, phandle, index);
+	if (!np) {
+		dev_dbg(dev, "failed to get %s phandle in %s node\n", phandle,
+			dev->device_node->full_name);
+		return ERR_PTR(-ENODEV);
+	}
+
+	phy_provider = of_phy_provider_lookup(np);
+	if (IS_ERR(phy_provider)) {
+		return ERR_PTR(-ENODEV);
+	}
+
+	return phy_provider->of_xlate(phy_provider->dev, NULL);
+}
+
+/**
  * phy_get() - lookup and obtain a reference to a phy.
  * @dev: device that requests this phy
  * @string: the phy name as given in the dt data or the name of the controller
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 94f0044..0d78923 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -136,6 +136,8 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 }
 struct phy *phy_get(struct device_d *dev, const char *string);
 struct phy *phy_optional_get(struct device_d *dev, const char *string);
+struct phy *of_phy_get_by_phandle(struct device_d *dev, const char *phandle,
+				  u8 index);
 void phy_put(struct phy *phy);
 struct phy *of_phy_get(struct device_node *np, const char *con_id);
 struct phy *of_phy_simple_xlate(struct device_d *dev,
@@ -198,6 +200,12 @@ static inline struct phy *phy_optional_get(struct device_d *dev,
 	return ERR_PTR(-ENOSYS);
 }
 
+static inline struct phy *of_phy_get_by_phandle(struct device_d *dev,
+						const char *phandle, u8 index)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
 static inline void phy_put(struct phy *phy)
 {
 }
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 1/9] usb: Use standard debug macro
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List

Use standard pr_debug instead of homebrew USB_PRINTF

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/core/usb.c | 52 ++++++++++++++++++++++++--------------------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index ce229f2..aba2da0 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -40,6 +40,9 @@
  *
  * For each transfer (except "Interrupt") we wait for completion.
  */
+
+#define pr_fmt(fmt) "usb: " fmt
+
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
@@ -56,14 +59,6 @@
 #include "usb.h"
 #include "hub.h"
 
-/* #define USB_DEBUG */
-
-#ifdef	USB_DEBUG
-#define	USB_PRINTF(fmt, args...)	printf(fmt , ##args)
-#else
-#define USB_PRINTF(fmt, args...)
-#endif
-
 #define USB_BUFSIZ	512
 
 static int dev_count;
@@ -113,7 +108,9 @@ int usb_register_host(struct usb_host *host)
 static int usb_set_configuration(struct usb_device *dev, int configuration)
 {
 	int res;
-	USB_PRINTF("set configuration %d\n", configuration);
+
+	pr_debug("set configuration %d\n", configuration);
+
 	/* set setup command */
 	res = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 				USB_REQ_SET_CONFIGURATION, 0,
@@ -147,21 +144,21 @@ usb_set_maxpacket_ep(struct usb_device *dev, struct usb_endpoint_descriptor *ep)
 		/* Control => bidirectional */
 		dev->epmaxpacketout[b] = ep->wMaxPacketSize;
 		dev->epmaxpacketin[b] = ep->wMaxPacketSize;
-		USB_PRINTF("##Control EP epmaxpacketout/in[%d] = %d\n",
+		pr_debug("##Control EP epmaxpacketout/in[%d] = %d\n",
 			   b, dev->epmaxpacketin[b]);
 	} else {
 		if ((ep->bEndpointAddress & 0x80) == 0) {
 			/* OUT Endpoint */
 			if (ep->wMaxPacketSize > dev->epmaxpacketout[b]) {
 				dev->epmaxpacketout[b] = ep->wMaxPacketSize;
-				USB_PRINTF("##EP epmaxpacketout[%d] = %d\n",
+				pr_debug("##EP epmaxpacketout[%d] = %d\n",
 					   b, dev->epmaxpacketout[b]);
 			}
 		} else {
 			/* IN Endpoint */
 			if (ep->wMaxPacketSize > dev->epmaxpacketin[b]) {
 				dev->epmaxpacketin[b] = ep->wMaxPacketSize;
-				USB_PRINTF("##EP epmaxpacketin[%d] = %d\n",
+				pr_debug("##EP epmaxpacketin[%d] = %d\n",
 					   b, dev->epmaxpacketin[b]);
 			}
 		} /* if out */
@@ -250,20 +247,20 @@ static int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int c
 				&buffer[index], buffer[index]);
 			le16_to_cpus(&(dev->config.interface[ifno].ep_desc[epno].\
 							       wMaxPacketSize));
-			USB_PRINTF("if %d, ep %d\n", ifno, epno);
+			pr_debug("if %d, ep %d\n", ifno, epno);
 			break;
 		default:
 			if (head->bLength == 0)
 				return 1;
 
-			USB_PRINTF("unknown Description Type : %x\n",
+			pr_debug("unknown Description Type : %x\n",
 				   head->bDescriptorType);
 
 			{
 				ch = (unsigned char *)head;
 				for (i = 0; i < head->bLength; i++)
-					USB_PRINTF("%02X ", *ch++);
-				USB_PRINTF("\n\n\n");
+					pr_debug("%02X ", *ch++);
+				pr_debug("\n\n\n");
 			}
 			break;
 		}
@@ -281,7 +278,8 @@ static int usb_set_address(struct usb_device *dev)
 {
 	int res;
 
-	USB_PRINTF("set address %d\n", dev->devnum);
+	pr_debug("set address %d\n", dev->devnum);
+
 	res = usb_control_msg(dev, usb_snddefctrl(dev),
 				USB_REQ_SET_ADDRESS, 0,
 				(dev->devnum), 0,
@@ -345,7 +343,7 @@ int usb_new_device(struct usb_device *dev)
 
 	err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64);
 	if (err < 0) {
-		USB_PRINTF("%s: usb_get_descriptor() failed with %d\n", __func__, err);
+		pr_debug("%s: usb_get_descriptor() failed with %d\n", __func__, err);
 		goto err_out;
 	}
 
@@ -417,7 +415,7 @@ int usb_new_device(struct usb_device *dev)
 			"len %d, status %lX\n", dev->act_len, dev->status);
 		goto err_out;
 	}
-	USB_PRINTF("new device: Mfr=%d, Product=%d, SerialNumber=%d\n",
+	pr_debug("new device: Mfr=%d, Product=%d, SerialNumber=%d\n",
 		   dev->descriptor->iManufacturer, dev->descriptor->iProduct,
 		   dev->descriptor->iSerialNumber);
 	memset(dev->mf, 0, sizeof(dev->mf));
@@ -624,7 +622,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
 	setup_packet->value = cpu_to_le16(value);
 	setup_packet->index = cpu_to_le16(index);
 	setup_packet->length = cpu_to_le16(size);
-	USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
+	pr_debug("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
 		   "value 0x%X index 0x%X length 0x%X\n",
 		   request, requesttype, value, index, size);
 	dev->status = USB_ST_NOT_PROC; /*not yet processed */
@@ -744,13 +742,13 @@ int usb_get_configuration_no(struct usb_device *dev,
 	tmp = le16_to_cpu(config->wTotalLength);
 
 	if (tmp > USB_BUFSIZ) {
-		USB_PRINTF("usb_get_configuration_no: failed to get " \
+		pr_debug("usb_get_configuration_no: failed to get " \
 			   "descriptor - too long: %u\n", tmp);
 		return -1;
 	}
 
 	result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, tmp);
-	USB_PRINTF("get_conf_no %d Result %d, wLength %u\n",
+	pr_debug("get_conf_no %d Result %d, wLength %u\n",
 		   cfgno, result, tmp);
 	return result;
 }
@@ -931,17 +929,17 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
 	if (!dev->have_langid) {
 		err = usb_string_sub(dev, 0, 0, tbuf);
 		if (err < 0) {
-			USB_PRINTF("error getting string descriptor 0 " \
+			pr_debug("error getting string descriptor 0 " \
 				   "(error=%lx)\n", dev->status);
 			return -1;
 		} else if (tbuf[0] < 4) {
-			USB_PRINTF("string descriptor 0 too short\n");
+			pr_debug("string descriptor 0 too short\n");
 			return -1;
 		} else {
 			dev->have_langid = -1;
 			dev->string_langid = tbuf[2] | (tbuf[3] << 8);
 				/* always use the first langid listed */
-			USB_PRINTF("USB device number %d default " \
+			pr_debug("USB device number %d default " \
 				   "language ID 0x%x\n",
 				   dev->devnum, dev->string_langid);
 		}
@@ -1063,12 +1061,12 @@ static int usb_match(struct device_d *dev, struct driver_d *drv)
 	struct usb_driver *usbdrv = container_of(dev->driver, struct usb_driver, driver);
 	const struct usb_device_id *id;
 
-	debug("matching: 0x%04x 0x%04x\n", usbdev->descriptor->idVendor,
+	pr_debug("matching: 0x%04x 0x%04x\n", usbdev->descriptor->idVendor,
 			usbdev->descriptor->idProduct);
 
 	id = usb_match_id(usbdev, usbdrv->id_table);
 	if (id) {
-		debug("match: 0x%04x 0x%04x\n", id->idVendor, id->idProduct);
+		pr_debug("match: 0x%04x 0x%04x\n", id->idVendor, id->idProduct);
 		return 0;
 	}
 	return 1;
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 3/9] usb: ehci: forward phy given in registration data to host
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

Allow to pass a phy in the registration data and forward it to
the usb_host structure.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/host/ehci-hcd.c | 1 +
 include/usb/ehci.h          | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 35cf6aa..f6e9099 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1297,6 +1297,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data)
 
 	host->hw_dev = dev;
 	host->init = ehci_init;
+	host->usbphy = data->usbphy;
 	host->submit_int_msg = submit_int_msg;
 	host->submit_control_msg = submit_control_msg;
 	host->submit_bulk_msg = submit_bulk_msg;
diff --git a/include/usb/ehci.h b/include/usb/ehci.h
index 93f980d..1008e92 100644
--- a/include/usb/ehci.h
+++ b/include/usb/ehci.h
@@ -11,6 +11,7 @@ struct ehci_data {
 	void __iomem *hccr;
 	void __iomem *hcor;
 	unsigned long flags;
+	struct usb_phy *usbphy;
 
 	/* platform specific init functions */
 	int (*init)(void *drvdata);
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 9/9] usb: imx-us-phy: implement notify_(dis)concect
From: Sascha Hauer @ 2016-09-29 12:39 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

The i.MX6 USB phy does not recognize disconnects of high speed
devices when the USBPHY_CTRL_ENHOSTDISCONDETECT is not set. The
phy does not work properly though when this bit is always set, so
implement the notify_(dis)concect() callbacks to set this bit
whenever a high speed device is connected and to clear it again
when the device is disconnected.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/imx-usb-phy.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 2829ffc..9f46f8d 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -33,6 +33,7 @@
 #define USBPHY_CTRL_CLKGATE		(1 << 30)
 #define USBPHY_CTRL_ENUTMILEVEL3	(1 << 15)
 #define USBPHY_CTRL_ENUTMILEVEL2	(1 << 14)
+#define USBPHY_CTRL_ENHOSTDISCONDETECT	(1 << 1)
 
 struct imx_usbphy {
 	struct usb_phy usb_phy;
@@ -67,6 +68,30 @@ static int imx_usbphy_phy_init(struct phy *phy)
 	return 0;
 }
 
+static int imx_usbphy_notify_connect(struct usb_phy *phy,
+				     enum usb_device_speed speed)
+{
+	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
+
+	if (speed == USB_SPEED_HIGH) {
+		writel(USBPHY_CTRL_ENHOSTDISCONDETECT,
+		       imxphy->base + USBPHY_CTRL + SET);
+	}
+
+	return 0;
+}
+
+static int imx_usbphy_notify_disconnect(struct usb_phy *phy,
+					enum usb_device_speed speed)
+{
+	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
+
+	writel(USBPHY_CTRL_ENHOSTDISCONDETECT,
+	       imxphy->base + USBPHY_CTRL + CLR);
+
+	return 0;
+}
+
 static struct phy *imx_usbphy_xlate(struct device_d *dev,
 				    struct of_phandle_args *args)
 {
@@ -112,6 +137,8 @@ static int imx_usbphy_probe(struct device_d *dev)
 	dev->priv = imxphy;
 
 	imxphy->usb_phy.dev = dev;
+	imxphy->usb_phy.notify_connect = imx_usbphy_notify_connect;
+	imxphy->usb_phy.notify_disconnect = imx_usbphy_notify_disconnect;
 	imxphy->phy = phy_create(dev, NULL, &imx_phy_ops, NULL);
 	if (IS_ERR(imxphy->phy)) {
 		ret = PTR_ERR(imxphy->phy);
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 2/9] usb: Add usb phy to usb host
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

Add a struct usb_phy * member to struct usb_host. Also, call
usb_phy_notify_connect() / usb_phy_notify_disconnect() when there
are connection changes on the root hub.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/core/hub.c | 8 ++++++++
 include/usb/usb.h      | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index dd3c10e..f44aea5 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -22,6 +22,7 @@
 #include <malloc.h>
 #include <errno.h>
 #include <scsi.h>
+#include <usb/phy.h>
 #include <usb/usb.h>
 #include <usb/usb_defs.h>
 
@@ -189,6 +190,10 @@ static void usb_hub_port_connect_change(struct usb_device *dev, int port)
 	if (dev->children[port] && !(portstatus & USB_PORT_STAT_CONNECTION)) {
 		dev_dbg(&dev->dev, "disconnect detected on port %d\n", port + 1);
 		usb_remove_device(dev->children[port]);
+
+		if (!dev->parent && dev->host->usbphy)
+			usb_phy_notify_disconnect(dev->host->usbphy, dev->speed);
+
 		return;
 	}
 
@@ -231,6 +236,9 @@ static void usb_hub_port_connect_change(struct usb_device *dev, int port)
 		return;
 	}
 
+	if (!dev->parent && dev->host->usbphy)
+		usb_phy_notify_connect(dev->host->usbphy, usb->speed);
+
 	device_detect(&usb->dev);
 }
 
diff --git a/include/usb/usb.h b/include/usb/usb.h
index aedc527..93308ce 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -153,6 +153,7 @@ struct usb_host {
 	int busnum;
 	struct usb_device *root_dev;
 	int sem;
+	struct usb_phy *usbphy;
 };
 
 int usb_register_host(struct usb_host *);
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 4/9] usb: imx-usb-phy: Drop unnecessary read/modify/write
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

When writing to the USBPHY_CTRL register read/modify/write is unncessary
since we are writing to the associated bit set register anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/imx-usb-phy.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 1aa12be..eec195d 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -39,8 +39,6 @@ struct imx_usbphy {
 
 static int imx_usbphy_enable(struct imx_usbphy *imxphy)
 {
-	u32 val;
-
 	clk_enable(imxphy->clk);
 
 	/* reset usbphy */
@@ -56,9 +54,8 @@ static int imx_usbphy_enable(struct imx_usbphy *imxphy)
 	writel(0xffffffff, imxphy->base + CLR);
 
 	/* set utmilvl2/3 */
-	val = readl(imxphy->base + USBPHY_CTRL);
-	val |= USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2;
-	writel(val, imxphy->base + USBPHY_CTRL + SET);
+	writel(USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2,
+	       imxphy->base + USBPHY_CTRL + SET);
 
 	return 0;
 }
-- 
2.9.3


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

^ permalink raw reply related

* [PATCH 7/9] phy: Add usb-nop-xceiv support
From: Sascha Hauer @ 2016-09-29 12:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160929123900.24853-1-s.hauer@pengutronix.de>

Add a nop usb transcveiver driver. At the moment it does nothing,
so is nothing more than a driver to satisfy the device tree
dependencies. clk / vbus-regulator / vbus-detect-gpio support can be
added later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/phy/Kconfig         |  15 +++++--
 drivers/phy/Makefile        |   1 +
 drivers/phy/usb-nop-xceiv.c | 104 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 4 deletions(-)
 create mode 100644 drivers/phy/usb-nop-xceiv.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index e9461e1..b0c8b9b 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -2,9 +2,7 @@
 # PHY
 #
 
-menu "PHY Subsystem"
-
-config GENERIC_PHY
+menuconfig GENERIC_PHY
 	bool "PHY Core"
 	help
 	  Generic PHY support.
@@ -15,4 +13,13 @@ config GENERIC_PHY
 	  phy users can obtain reference to the PHY. All the users of this
 	  framework should select this config.
 
-endmenu
+if GENERIC_PHY
+
+config USB_NOP_XCEIV
+	bool "Generic USB nop phy"
+	help
+	  This driver is to be used by all the usb transceiver which are either
+	  built-in with usb ip or which are autonomous and doesn't require any
+	  phy programming such as ISP1x04 etc.
+
+endif
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 74514ae..8fc8595 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)		+= phy-core.o
+obj-$(CONFIG_USB_NOP_XCEIV)		+= usb-nop-xceiv.o
diff --git a/drivers/phy/usb-nop-xceiv.c b/drivers/phy/usb-nop-xceiv.c
new file mode 100644
index 0000000..606e098
--- /dev/null
+++ b/drivers/phy/usb-nop-xceiv.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016 Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * 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 program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <of.h>
+#include <errno.h>
+#include <driver.h>
+#include <malloc.h>
+#include <usb/phy.h>
+#include <linux/phy/phy.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+struct nop_usbphy {
+	struct usb_phy usb_phy;
+	struct phy *phy;
+	struct phy_provider *provider;
+};
+
+static struct phy *nop_usbphy_xlate(struct device_d *dev,
+				    struct of_phandle_args *args)
+{
+	struct nop_usbphy *nopphy = dev->priv;
+
+	return nopphy->phy;
+}
+
+static struct usb_phy *nop_usbphy_to_usbphy(struct phy *phy)
+{
+	struct nop_usbphy *nopphy = phy_get_drvdata(phy);
+
+	return &nopphy->usb_phy;
+}
+
+static const struct phy_ops nop_phy_ops = {
+	.to_usbphy = nop_usbphy_to_usbphy,
+};
+
+static int nop_usbphy_probe(struct device_d *dev)
+{
+	int ret;
+	struct nop_usbphy *nopphy;
+
+	nopphy = xzalloc(sizeof(*nopphy));
+
+	dev->priv = nopphy;
+
+	/* FIXME: Add clk support */
+	/* FIXME: Add vbus regulator support */
+	/* FIXME: Add vbus-detect-gpio support */
+
+	nopphy->usb_phy.dev = dev;
+	nopphy->phy = phy_create(dev, NULL, &nop_phy_ops, NULL);
+	if (IS_ERR(nopphy->phy)) {
+		ret = PTR_ERR(nopphy->phy);
+		goto err_free;
+	}
+
+	phy_set_drvdata(nopphy->phy, nopphy);
+
+	nopphy->provider = of_phy_provider_register(dev, nop_usbphy_xlate);
+	if (IS_ERR(nopphy->provider)) {
+		ret = PTR_ERR(nopphy->provider);
+		goto err_free;
+	}
+
+	return 0;
+err_free:
+	free(nopphy);
+
+	return ret;
+};
+
+static __maybe_unused struct of_device_id nop_usbphy_dt_ids[] = {
+	{
+		.compatible = "usb-nop-xceiv",
+	}, {
+		/* sentinel */
+	},
+};
+
+static struct driver_d nop_usbphy_driver = {
+	.name   = "usb-nop-xceiv",
+	.probe  = nop_usbphy_probe,
+	.of_compatible = DRV_OF_COMPAT(nop_usbphy_dt_ids),
+};
+
+static int nop_usbphy_init(void)
+{
+	return platform_driver_register(&nop_usbphy_driver);
+}
+fs_initcall(nop_usbphy_init);
-- 
2.9.3


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

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox