All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-05-08  6:30 ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: u-boot

Hi,

this series adds a very basic support for Amlogic S905 SoC (GXBaby)
and for the ODROID-C2 board [1], and is based on u-boot sources
available from the board vendor [2]. At the moment the only supported
devices are the integrated UART and Ethernet adapter.

Changes since v6:
 - documented ARCH_MESON Kconfig entry

Changes since v5:
 - used default CONFIG_SYS_BAUDRATE_TABLE
 - removed check for CONFIG_IDENT_STRING

Changes since v4:
 - added patch to implement generic PSCI reset
 - used min() macro from linux/kernel.h

Changes since v3:
 - designware eth: added check that buffer addresses are in first 4GiB
   as suggested by Marek (and thus removed the ack tags)
 - consolidated pinmux and gpio macros
 - used get_unaligned_be64() to avoid alignment faults in dram_init()
 - uint32_t -> u32 in serial_meson.c
 - implemented reboot and read from e-fuse through secure monitor

Changes since v2:
 - squashed all platform patches into a single one
 - got rid of additional non-upstream DTS node for ethernet
 - improved board README
 - added macros for SoC registers fields

Changes since v1:
 - updated DTS files from Linux kernel
 - added Ethernet support
 - first 16MiB of RAM are now marked as unavailable; this seems to
   be required to successfully boot Linux
 - fixed typo in config file

[1] http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438
[2] https://github.com/hardkernel/u-boot/tree/odroidc2-v2015.01

Beniamino Galvani (4):
  arm: implement generic PSCI reset call for armv8
  net: designware: fix descriptor layout and warnings on 64-bit archs
  arm: add initial support for Amlogic Meson and ODROID-C2
  arm: meson: implement calls to secure monitor

 arch/arm/Kconfig                       |   9 ++
 arch/arm/Makefile                      |   1 +
 arch/arm/cpu/armv8/fwcall.c            |  16 +++
 arch/arm/dts/Makefile                  |   2 +
 arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
 arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
 arch/arm/include/asm/arch-meson/sm.h   |  12 +++
 arch/arm/include/asm/psci.h            |  17 +++-
 arch/arm/include/asm/system.h          |   2 +
 arch/arm/mach-meson/Kconfig            |  31 ++++++
 arch/arm/mach-meson/Makefile           |   7 ++
 arch/arm/mach-meson/board.c            |  67 +++++++++++++
 arch/arm/mach-meson/sm.c               |  57 +++++++++++
 board/hardkernel/odroid-c2/Kconfig     |  12 +++
 board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
 board/hardkernel/odroid-c2/Makefile    |   7 ++
 board/hardkernel/odroid-c2/README      |  60 +++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c |  67 +++++++++++++
 configs/odroid-c2_defconfig            |  23 +++++
 drivers/net/designware.c               |  59 ++++++-----
 drivers/net/designware.h               |   4 +-
 drivers/serial/Kconfig                 |  15 +++
 drivers/serial/Makefile                |   1 +
 drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
 include/configs/odroid-c2.h            |  51 ++++++++++
 26 files changed, 957 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 create mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
 create mode 100644 arch/arm/include/asm/arch-meson/sm.h
 create mode 100644 arch/arm/mach-meson/Kconfig
 create mode 100644 arch/arm/mach-meson/Makefile
 create mode 100644 arch/arm/mach-meson/board.c
 create mode 100644 arch/arm/mach-meson/sm.c
 create mode 100644 board/hardkernel/odroid-c2/Kconfig
 create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
 create mode 100644 board/hardkernel/odroid-c2/Makefile
 create mode 100644 board/hardkernel/odroid-c2/README
 create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
 create mode 100644 configs/odroid-c2_defconfig
 create mode 100644 drivers/serial/serial_meson.c
 create mode 100644 include/configs/odroid-c2.h

-- 
2.7.3

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-05-08  6:30 ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: linus-amlogic

Hi,

this series adds a very basic support for Amlogic S905 SoC (GXBaby)
and for the ODROID-C2 board [1], and is based on u-boot sources
available from the board vendor [2]. At the moment the only supported
devices are the integrated UART and Ethernet adapter.

Changes since v6:
 - documented ARCH_MESON Kconfig entry

Changes since v5:
 - used default CONFIG_SYS_BAUDRATE_TABLE
 - removed check for CONFIG_IDENT_STRING

Changes since v4:
 - added patch to implement generic PSCI reset
 - used min() macro from linux/kernel.h

Changes since v3:
 - designware eth: added check that buffer addresses are in first 4GiB
   as suggested by Marek (and thus removed the ack tags)
 - consolidated pinmux and gpio macros
 - used get_unaligned_be64() to avoid alignment faults in dram_init()
 - uint32_t -> u32 in serial_meson.c
 - implemented reboot and read from e-fuse through secure monitor

Changes since v2:
 - squashed all platform patches into a single one
 - got rid of additional non-upstream DTS node for ethernet
 - improved board README
 - added macros for SoC registers fields

Changes since v1:
 - updated DTS files from Linux kernel
 - added Ethernet support
 - first 16MiB of RAM are now marked as unavailable; this seems to
   be required to successfully boot Linux
 - fixed typo in config file

[1] http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438
[2] https://github.com/hardkernel/u-boot/tree/odroidc2-v2015.01

Beniamino Galvani (4):
  arm: implement generic PSCI reset call for armv8
  net: designware: fix descriptor layout and warnings on 64-bit archs
  arm: add initial support for Amlogic Meson and ODROID-C2
  arm: meson: implement calls to secure monitor

 arch/arm/Kconfig                       |   9 ++
 arch/arm/Makefile                      |   1 +
 arch/arm/cpu/armv8/fwcall.c            |  16 +++
 arch/arm/dts/Makefile                  |   2 +
 arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
 arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
 arch/arm/include/asm/arch-meson/sm.h   |  12 +++
 arch/arm/include/asm/psci.h            |  17 +++-
 arch/arm/include/asm/system.h          |   2 +
 arch/arm/mach-meson/Kconfig            |  31 ++++++
 arch/arm/mach-meson/Makefile           |   7 ++
 arch/arm/mach-meson/board.c            |  67 +++++++++++++
 arch/arm/mach-meson/sm.c               |  57 +++++++++++
 board/hardkernel/odroid-c2/Kconfig     |  12 +++
 board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
 board/hardkernel/odroid-c2/Makefile    |   7 ++
 board/hardkernel/odroid-c2/README      |  60 +++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c |  67 +++++++++++++
 configs/odroid-c2_defconfig            |  23 +++++
 drivers/net/designware.c               |  59 ++++++-----
 drivers/net/designware.h               |   4 +-
 drivers/serial/Kconfig                 |  15 +++
 drivers/serial/Makefile                |   1 +
 drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
 include/configs/odroid-c2.h            |  51 ++++++++++
 26 files changed, 957 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 create mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
 create mode 100644 arch/arm/include/asm/arch-meson/sm.h
 create mode 100644 arch/arm/mach-meson/Kconfig
 create mode 100644 arch/arm/mach-meson/Makefile
 create mode 100644 arch/arm/mach-meson/board.c
 create mode 100644 arch/arm/mach-meson/sm.c
 create mode 100644 board/hardkernel/odroid-c2/Kconfig
 create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
 create mode 100644 board/hardkernel/odroid-c2/Makefile
 create mode 100644 board/hardkernel/odroid-c2/README
 create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
 create mode 100644 configs/odroid-c2_defconfig
 create mode 100644 drivers/serial/serial_meson.c
 create mode 100644 include/configs/odroid-c2.h

-- 
2.7.3

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-05-08  6:30   ` Beniamino Galvani
  -1 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: u-boot

Add a psci_system_reset() which calls the SYSTEM_RESET function of
PSCI 0.2 and can be used by boards that support it to implement
reset_cpu().

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
 arch/arm/cpu/armv8/fwcall.c   | 16 ++++++++++++++++
 arch/arm/include/asm/psci.h   | 17 ++++++++++++++++-
 arch/arm/include/asm/system.h |  2 ++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
index 9efcc5a..079e250 100644
--- a/arch/arm/cpu/armv8/fwcall.c
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <version.h>
 #include <asm/macro.h>
+#include <asm/psci.h>
 #include <asm/system.h>
 
 /*
@@ -73,3 +74,18 @@ void smc_call(struct pt_regs *args)
 		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
 		  "x16", "x17");
 }
+
+void __noreturn psci_system_reset(bool conduit_smc)
+{
+	struct pt_regs regs;
+
+	regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
+
+	if (conduit_smc)
+		smc_call(&regs);
+	else
+		hvc_call(&regs);
+
+	while (1)
+		;
+}
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 128a606..3704f07 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -18,7 +18,7 @@
 #ifndef __ARM_PSCI_H__
 #define __ARM_PSCI_H__
 
-/* PSCI interface */
+/* PSCI 0.1 interface */
 #define ARM_PSCI_FN_BASE		0x95c1ba5e
 #define ARM_PSCI_FN(n)			(ARM_PSCI_FN_BASE + (n))
 
@@ -32,6 +32,21 @@
 #define ARM_PSCI_RET_INVAL		(-2)
 #define ARM_PSCI_RET_DENIED		(-3)
 
+/* PSCI 0.2 interface */
+#define ARM_PSCI_0_2_FN_BASE			0x84000000
+#define ARM_PSCI_0_2_FN(n)			(ARM_PSCI_0_2_FN_BASE + (n))
+
+#define ARM_PSCI_0_2_FN_PSCI_VERSION		ARM_PSCI_0_2_FN(0)
+#define ARM_PSCI_0_2_FN_CPU_SUSPEND		ARM_PSCI_0_2_FN(1)
+#define ARM_PSCI_0_2_FN_CPU_OFF			ARM_PSCI_0_2_FN(2)
+#define ARM_PSCI_0_2_FN_CPU_ON			ARM_PSCI_0_2_FN(3)
+#define ARM_PSCI_0_2_FN_AFFINITY_INFO		ARM_PSCI_0_2_FN(4)
+#define ARM_PSCI_0_2_FN_MIGRATE			ARM_PSCI_0_2_FN(5)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE	ARM_PSCI_0_2_FN(6)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU	ARM_PSCI_0_2_FN(7)
+#define ARM_PSCI_0_2_FN_SYSTEM_OFF		ARM_PSCI_0_2_FN(8)
+#define ARM_PSCI_0_2_FN_SYSTEM_RESET		ARM_PSCI_0_2_FN(9)
+
 #ifndef __ASSEMBLY__
 int psci_update_dt(void *fdt);
 void psci_board_init(void);
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 9ae890a..2bdc0be 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -128,6 +128,8 @@ void hvc_call(struct pt_regs *args);
  */
 void smc_call(struct pt_regs *args);
 
+void __noreturn psci_system_reset(bool smc);
+
 #endif	/* __ASSEMBLY__ */
 
 #else /* CONFIG_ARM64 */
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8
@ 2016-05-08  6:30   ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: linus-amlogic

Add a psci_system_reset() which calls the SYSTEM_RESET function of
PSCI 0.2 and can be used by boards that support it to implement
reset_cpu().

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
 arch/arm/cpu/armv8/fwcall.c   | 16 ++++++++++++++++
 arch/arm/include/asm/psci.h   | 17 ++++++++++++++++-
 arch/arm/include/asm/system.h |  2 ++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
index 9efcc5a..079e250 100644
--- a/arch/arm/cpu/armv8/fwcall.c
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <version.h>
 #include <asm/macro.h>
+#include <asm/psci.h>
 #include <asm/system.h>
 
 /*
@@ -73,3 +74,18 @@ void smc_call(struct pt_regs *args)
 		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
 		  "x16", "x17");
 }
+
+void __noreturn psci_system_reset(bool conduit_smc)
+{
+	struct pt_regs regs;
+
+	regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
+
+	if (conduit_smc)
+		smc_call(&regs);
+	else
+		hvc_call(&regs);
+
+	while (1)
+		;
+}
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 128a606..3704f07 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -18,7 +18,7 @@
 #ifndef __ARM_PSCI_H__
 #define __ARM_PSCI_H__
 
-/* PSCI interface */
+/* PSCI 0.1 interface */
 #define ARM_PSCI_FN_BASE		0x95c1ba5e
 #define ARM_PSCI_FN(n)			(ARM_PSCI_FN_BASE + (n))
 
@@ -32,6 +32,21 @@
 #define ARM_PSCI_RET_INVAL		(-2)
 #define ARM_PSCI_RET_DENIED		(-3)
 
+/* PSCI 0.2 interface */
+#define ARM_PSCI_0_2_FN_BASE			0x84000000
+#define ARM_PSCI_0_2_FN(n)			(ARM_PSCI_0_2_FN_BASE + (n))
+
+#define ARM_PSCI_0_2_FN_PSCI_VERSION		ARM_PSCI_0_2_FN(0)
+#define ARM_PSCI_0_2_FN_CPU_SUSPEND		ARM_PSCI_0_2_FN(1)
+#define ARM_PSCI_0_2_FN_CPU_OFF			ARM_PSCI_0_2_FN(2)
+#define ARM_PSCI_0_2_FN_CPU_ON			ARM_PSCI_0_2_FN(3)
+#define ARM_PSCI_0_2_FN_AFFINITY_INFO		ARM_PSCI_0_2_FN(4)
+#define ARM_PSCI_0_2_FN_MIGRATE			ARM_PSCI_0_2_FN(5)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE	ARM_PSCI_0_2_FN(6)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU	ARM_PSCI_0_2_FN(7)
+#define ARM_PSCI_0_2_FN_SYSTEM_OFF		ARM_PSCI_0_2_FN(8)
+#define ARM_PSCI_0_2_FN_SYSTEM_RESET		ARM_PSCI_0_2_FN(9)
+
 #ifndef __ASSEMBLY__
 int psci_update_dt(void *fdt);
 void psci_board_init(void);
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 9ae890a..2bdc0be 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -128,6 +128,8 @@ void hvc_call(struct pt_regs *args);
  */
 void smc_call(struct pt_regs *args);
 
+void __noreturn psci_system_reset(bool smc);
+
 #endif	/* __ASSEMBLY__ */
 
 #else /* CONFIG_ARM64 */
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-05-08  6:30   ` Beniamino Galvani
  -1 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: u-boot

All members of the DMA descriptor must be 32-bit, even on 64-bit
architectures: change the type to u32 to ensure this. Also, fix
other warnings.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/designware.c | 59 ++++++++++++++++++++++++++----------------------
 drivers/net/designware.h |  4 ++--
 2 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index ca58f34..2eda461 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -98,8 +98,8 @@ static void tx_descs_init(struct dw_eth_dev *priv)
 
 	for (idx = 0; idx < CONFIG_TX_DESCR_NUM; idx++) {
 		desc_p = &desc_table_p[idx];
-		desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE];
-		desc_p->dmamac_next = &desc_table_p[idx + 1];
+		desc_p->dmamac_addr = (ulong)&txbuffs[idx * CONFIG_ETH_BUFSIZE];
+		desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
 
 #if defined(CONFIG_DW_ALTDESCRIPTOR)
 		desc_p->txrx_status &= ~(DESC_TXSTS_TXINT | DESC_TXSTS_TXLAST |
@@ -117,11 +117,11 @@ static void tx_descs_init(struct dw_eth_dev *priv)
 	}
 
 	/* Correcting the last pointer of the chain */
-	desc_p->dmamac_next = &desc_table_p[0];
+	desc_p->dmamac_next = (ulong)&desc_table_p[0];
 
 	/* Flush all Tx buffer descriptors at once */
-	flush_dcache_range((unsigned int)priv->tx_mac_descrtable,
-			   (unsigned int)priv->tx_mac_descrtable +
+	flush_dcache_range((ulong)priv->tx_mac_descrtable,
+			   (ulong)priv->tx_mac_descrtable +
 			   sizeof(priv->tx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->txdesclistaddr);
@@ -142,13 +142,12 @@ static void rx_descs_init(struct dw_eth_dev *priv)
 	 * Otherwise there's a chance to get some of them flushed in RAM when
 	 * GMAC is already pushing data to RAM via DMA. This way incoming from
 	 * GMAC data will be corrupted. */
-	flush_dcache_range((unsigned int)rxbuffs, (unsigned int)rxbuffs +
-			   RX_TOTAL_BUFSIZE);
+	flush_dcache_range((ulong)rxbuffs, (ulong)rxbuffs + RX_TOTAL_BUFSIZE);
 
 	for (idx = 0; idx < CONFIG_RX_DESCR_NUM; idx++) {
 		desc_p = &desc_table_p[idx];
-		desc_p->dmamac_addr = &rxbuffs[idx * CONFIG_ETH_BUFSIZE];
-		desc_p->dmamac_next = &desc_table_p[idx + 1];
+		desc_p->dmamac_addr = (ulong)&rxbuffs[idx * CONFIG_ETH_BUFSIZE];
+		desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
 
 		desc_p->dmamac_cntl =
 			(MAC_MAX_FRAME_SZ & DESC_RXCTRL_SIZE1MASK) |
@@ -158,11 +157,11 @@ static void rx_descs_init(struct dw_eth_dev *priv)
 	}
 
 	/* Correcting the last pointer of the chain */
-	desc_p->dmamac_next = &desc_table_p[0];
+	desc_p->dmamac_next = (ulong)&desc_table_p[0];
 
 	/* Flush all Rx buffer descriptors at once */
-	flush_dcache_range((unsigned int)priv->rx_mac_descrtable,
-			   (unsigned int)priv->rx_mac_descrtable +
+	flush_dcache_range((ulong)priv->rx_mac_descrtable,
+			   (ulong)priv->rx_mac_descrtable +
 			   sizeof(priv->rx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->rxdesclistaddr);
@@ -290,12 +289,11 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	u32 desc_num = priv->tx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
-	uint32_t data_start = (uint32_t)desc_p->dmamac_addr;
-	uint32_t data_end = data_start +
-		roundup(length, ARCH_DMA_MINALIGN);
+	ulong data_start = desc_p->dmamac_addr;
+	ulong data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 	/*
 	 * Strictly we only need to invalidate the "txrx_status" field
 	 * for the following check, but on some platforms we cannot
@@ -312,7 +310,7 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
 		return -EPERM;
 	}
 
-	memcpy(desc_p->dmamac_addr, packet, length);
+	memcpy((void *)data_start, packet, length);
 
 	/* Flush data to be sent */
 	flush_dcache_range(data_start, data_end);
@@ -352,11 +350,11 @@ static int _dw_eth_recv(struct dw_eth_dev *priv, uchar **packetp)
 	u32 status, desc_num = priv->rx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->rx_mac_descrtable[desc_num];
 	int length = -EAGAIN;
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
-	uint32_t data_start = (uint32_t)desc_p->dmamac_addr;
-	uint32_t data_end;
+	ulong data_start = desc_p->dmamac_addr;
+	ulong data_end;
 
 	/* Invalidate entire buffer descriptor */
 	invalidate_dcache_range(desc_start, desc_end);
@@ -372,7 +370,7 @@ static int _dw_eth_recv(struct dw_eth_dev *priv, uchar **packetp)
 		/* Invalidate received data */
 		data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(data_start, data_end);
-		*packetp = desc_p->dmamac_addr;
+		*packetp = (uchar *)(ulong)desc_p->dmamac_addr;
 	}
 
 	return length;
@@ -382,8 +380,8 @@ static int _dw_free_pkt(struct dw_eth_dev *priv)
 {
 	u32 desc_num = priv->rx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->rx_mac_descrtable[desc_num];
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
 
 	/*
@@ -488,6 +486,11 @@ int designware_initialize(ulong base_addr, u32 interface)
 		return -ENOMEM;
 	}
 
+	if ((unsigned long long)priv + sizeof(*priv) > (1ULL << 32)) {
+		printf("designware: buffers are outside DMA memory\n");
+		return -EINVAL;
+	}
+
 	memset(dev, 0, sizeof(struct eth_device));
 	memset(priv, 0, sizeof(struct dw_eth_dev));
 
@@ -583,6 +586,7 @@ static int designware_eth_probe(struct udevice *dev)
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct dw_eth_dev *priv = dev_get_priv(dev);
 	u32 iobase = pdata->iobase;
+	ulong ioaddr;
 	int ret;
 
 #ifdef CONFIG_DM_PCI
@@ -601,8 +605,9 @@ static int designware_eth_probe(struct udevice *dev)
 #endif
 
 	debug("%s, iobase=%x, priv=%p\n", __func__, iobase, priv);
-	priv->mac_regs_p = (struct eth_mac_regs *)iobase;
-	priv->dma_regs_p = (struct eth_dma_regs *)(iobase + DW_DMA_BASE_OFFSET);
+	ioaddr = iobase;
+	priv->mac_regs_p = (struct eth_mac_regs *)ioaddr;
+	priv->dma_regs_p = (struct eth_dma_regs *)(ioaddr + DW_DMA_BASE_OFFSET);
 	priv->interface = pdata->phy_interface;
 	priv->max_speed = pdata->max_speed;
 
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index ed6344c..d48df7b 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -110,8 +110,8 @@ struct eth_dma_regs {
 struct dmamacdescr {
 	u32 txrx_status;
 	u32 dmamac_cntl;
-	void *dmamac_addr;
-	struct dmamacdescr *dmamac_next;
+	u32 dmamac_addr;
+	u32 dmamac_next;
 } __aligned(ARCH_DMA_MINALIGN);
 
 /*
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
@ 2016-05-08  6:30   ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: linus-amlogic

All members of the DMA descriptor must be 32-bit, even on 64-bit
architectures: change the type to u32 to ensure this. Also, fix
other warnings.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/designware.c | 59 ++++++++++++++++++++++++++----------------------
 drivers/net/designware.h |  4 ++--
 2 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index ca58f34..2eda461 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -98,8 +98,8 @@ static void tx_descs_init(struct dw_eth_dev *priv)
 
 	for (idx = 0; idx < CONFIG_TX_DESCR_NUM; idx++) {
 		desc_p = &desc_table_p[idx];
-		desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE];
-		desc_p->dmamac_next = &desc_table_p[idx + 1];
+		desc_p->dmamac_addr = (ulong)&txbuffs[idx * CONFIG_ETH_BUFSIZE];
+		desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
 
 #if defined(CONFIG_DW_ALTDESCRIPTOR)
 		desc_p->txrx_status &= ~(DESC_TXSTS_TXINT | DESC_TXSTS_TXLAST |
@@ -117,11 +117,11 @@ static void tx_descs_init(struct dw_eth_dev *priv)
 	}
 
 	/* Correcting the last pointer of the chain */
-	desc_p->dmamac_next = &desc_table_p[0];
+	desc_p->dmamac_next = (ulong)&desc_table_p[0];
 
 	/* Flush all Tx buffer descriptors at once */
-	flush_dcache_range((unsigned int)priv->tx_mac_descrtable,
-			   (unsigned int)priv->tx_mac_descrtable +
+	flush_dcache_range((ulong)priv->tx_mac_descrtable,
+			   (ulong)priv->tx_mac_descrtable +
 			   sizeof(priv->tx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->txdesclistaddr);
@@ -142,13 +142,12 @@ static void rx_descs_init(struct dw_eth_dev *priv)
 	 * Otherwise there's a chance to get some of them flushed in RAM when
 	 * GMAC is already pushing data to RAM via DMA. This way incoming from
 	 * GMAC data will be corrupted. */
-	flush_dcache_range((unsigned int)rxbuffs, (unsigned int)rxbuffs +
-			   RX_TOTAL_BUFSIZE);
+	flush_dcache_range((ulong)rxbuffs, (ulong)rxbuffs + RX_TOTAL_BUFSIZE);
 
 	for (idx = 0; idx < CONFIG_RX_DESCR_NUM; idx++) {
 		desc_p = &desc_table_p[idx];
-		desc_p->dmamac_addr = &rxbuffs[idx * CONFIG_ETH_BUFSIZE];
-		desc_p->dmamac_next = &desc_table_p[idx + 1];
+		desc_p->dmamac_addr = (ulong)&rxbuffs[idx * CONFIG_ETH_BUFSIZE];
+		desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
 
 		desc_p->dmamac_cntl =
 			(MAC_MAX_FRAME_SZ & DESC_RXCTRL_SIZE1MASK) |
@@ -158,11 +157,11 @@ static void rx_descs_init(struct dw_eth_dev *priv)
 	}
 
 	/* Correcting the last pointer of the chain */
-	desc_p->dmamac_next = &desc_table_p[0];
+	desc_p->dmamac_next = (ulong)&desc_table_p[0];
 
 	/* Flush all Rx buffer descriptors at once */
-	flush_dcache_range((unsigned int)priv->rx_mac_descrtable,
-			   (unsigned int)priv->rx_mac_descrtable +
+	flush_dcache_range((ulong)priv->rx_mac_descrtable,
+			   (ulong)priv->rx_mac_descrtable +
 			   sizeof(priv->rx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->rxdesclistaddr);
@@ -290,12 +289,11 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	u32 desc_num = priv->tx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
-	uint32_t data_start = (uint32_t)desc_p->dmamac_addr;
-	uint32_t data_end = data_start +
-		roundup(length, ARCH_DMA_MINALIGN);
+	ulong data_start = desc_p->dmamac_addr;
+	ulong data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 	/*
 	 * Strictly we only need to invalidate the "txrx_status" field
 	 * for the following check, but on some platforms we cannot
@@ -312,7 +310,7 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
 		return -EPERM;
 	}
 
-	memcpy(desc_p->dmamac_addr, packet, length);
+	memcpy((void *)data_start, packet, length);
 
 	/* Flush data to be sent */
 	flush_dcache_range(data_start, data_end);
@@ -352,11 +350,11 @@ static int _dw_eth_recv(struct dw_eth_dev *priv, uchar **packetp)
 	u32 status, desc_num = priv->rx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->rx_mac_descrtable[desc_num];
 	int length = -EAGAIN;
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
-	uint32_t data_start = (uint32_t)desc_p->dmamac_addr;
-	uint32_t data_end;
+	ulong data_start = desc_p->dmamac_addr;
+	ulong data_end;
 
 	/* Invalidate entire buffer descriptor */
 	invalidate_dcache_range(desc_start, desc_end);
@@ -372,7 +370,7 @@ static int _dw_eth_recv(struct dw_eth_dev *priv, uchar **packetp)
 		/* Invalidate received data */
 		data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(data_start, data_end);
-		*packetp = desc_p->dmamac_addr;
+		*packetp = (uchar *)(ulong)desc_p->dmamac_addr;
 	}
 
 	return length;
@@ -382,8 +380,8 @@ static int _dw_free_pkt(struct dw_eth_dev *priv)
 {
 	u32 desc_num = priv->rx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->rx_mac_descrtable[desc_num];
-	uint32_t desc_start = (uint32_t)desc_p;
-	uint32_t desc_end = desc_start +
+	ulong desc_start = (ulong)desc_p;
+	ulong desc_end = desc_start +
 		roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
 
 	/*
@@ -488,6 +486,11 @@ int designware_initialize(ulong base_addr, u32 interface)
 		return -ENOMEM;
 	}
 
+	if ((unsigned long long)priv + sizeof(*priv) > (1ULL << 32)) {
+		printf("designware: buffers are outside DMA memory\n");
+		return -EINVAL;
+	}
+
 	memset(dev, 0, sizeof(struct eth_device));
 	memset(priv, 0, sizeof(struct dw_eth_dev));
 
@@ -583,6 +586,7 @@ static int designware_eth_probe(struct udevice *dev)
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct dw_eth_dev *priv = dev_get_priv(dev);
 	u32 iobase = pdata->iobase;
+	ulong ioaddr;
 	int ret;
 
 #ifdef CONFIG_DM_PCI
@@ -601,8 +605,9 @@ static int designware_eth_probe(struct udevice *dev)
 #endif
 
 	debug("%s, iobase=%x, priv=%p\n", __func__, iobase, priv);
-	priv->mac_regs_p = (struct eth_mac_regs *)iobase;
-	priv->dma_regs_p = (struct eth_dma_regs *)(iobase + DW_DMA_BASE_OFFSET);
+	ioaddr = iobase;
+	priv->mac_regs_p = (struct eth_mac_regs *)ioaddr;
+	priv->dma_regs_p = (struct eth_dma_regs *)(ioaddr + DW_DMA_BASE_OFFSET);
 	priv->interface = pdata->phy_interface;
 	priv->max_speed = pdata->max_speed;
 
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index ed6344c..d48df7b 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -110,8 +110,8 @@ struct eth_dma_regs {
 struct dmamacdescr {
 	u32 txrx_status;
 	u32 dmamac_cntl;
-	void *dmamac_addr;
-	struct dmamacdescr *dmamac_next;
+	u32 dmamac_addr;
+	u32 dmamac_next;
 } __aligned(ARCH_DMA_MINALIGN);
 
 /*
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-05-08  6:30   ` Beniamino Galvani
  -1 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: u-boot

This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
board definition for ODROID-C2. This initial submission only supports
UART and Ethernet (through the existing Designware driver). DTS files
are the ones submitted to Linux arm-soc for 4.7 [1].

[1] https://patchwork.ozlabs.org/patch/603583/

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/Kconfig                       |   9 ++
 arch/arm/Makefile                      |   1 +
 arch/arm/dts/Makefile                  |   2 +
 arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
 arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
 arch/arm/mach-meson/Kconfig            |  31 ++++++
 arch/arm/mach-meson/Makefile           |   7 ++
 arch/arm/mach-meson/board.c            |  66 ++++++++++++
 board/hardkernel/odroid-c2/Kconfig     |  12 +++
 board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
 board/hardkernel/odroid-c2/Makefile    |   7 ++
 board/hardkernel/odroid-c2/README      |  60 +++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++
 configs/odroid-c2_defconfig            |  23 +++++
 drivers/serial/Kconfig                 |  15 +++
 drivers/serial/Makefile                |   1 +
 drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
 include/configs/odroid-c2.h            |  51 ++++++++++
 19 files changed, 803 insertions(+)
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 create mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
 create mode 100644 arch/arm/mach-meson/Kconfig
 create mode 100644 arch/arm/mach-meson/Makefile
 create mode 100644 arch/arm/mach-meson/board.c
 create mode 100644 board/hardkernel/odroid-c2/Kconfig
 create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
 create mode 100644 board/hardkernel/odroid-c2/Makefile
 create mode 100644 board/hardkernel/odroid-c2/README
 create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
 create mode 100644 configs/odroid-c2_defconfig
 create mode 100644 drivers/serial/serial_meson.c
 create mode 100644 include/configs/odroid-c2.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6b65d8e..2786372 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -456,6 +456,13 @@ config ARCH_KEYSTONE
 	select SUPPORT_SPL
 	select CMD_POWEROFF
 
+config ARCH_MESON
+	bool "Amlogic Meson"
+	help
+	  Support for the Meson SoC family developed by Amlogic Inc.,
+	  targeted at media players and tablet computers. We currently
+	  support the S905 (GXBaby) 64-bit SoC.
+
 config ARCH_MX7
 	bool "Freescale MX7"
 	select CPU_V7
@@ -781,6 +788,8 @@ source "arch/arm/mach-orion5x/Kconfig"
 
 source "arch/arm/cpu/armv7/rmobile/Kconfig"
 
+source "arch/arm/mach-meson/Kconfig"
+
 source "arch/arm/mach-rockchip/Kconfig"
 
 source "arch/arm/mach-s5pc1xx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d516345..ecd1887 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -50,6 +50,7 @@ machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
 # TODO: rename CONFIG_KIRKWOOD -> CONFIG_ARCH_KIRKWOOD
 machine-$(CONFIG_KIRKWOOD)		+= kirkwood
+machine-$(CONFIG_ARCH_MESON)		+= meson
 machine-$(CONFIG_ARCH_MVEBU)		+= mvebu
 # TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA
 # TODO: rename CONFIG_ORION5X -> CONFIG_ARCH_ORION5X
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d1f8e22..136a7d8 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,6 +26,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-jerry.dtb \
 	rk3288-rock2-square.dtb \
 	rk3036-sdk.dtb
+dtb-$(CONFIG_ARCH_MESON) += \
+	meson-gxbb-odroidc2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-gxbb-odroidc2.dts b/arch/arm/dts/meson-gxbb-odroidc2.dts
new file mode 100644
index 0000000..653c2fa
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-odroidc2.dts
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016 Andreas F?rber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ *
+ * 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 library 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 library 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 "AS IS", 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.
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb.dtsi"
+
+/ {
+	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
+	model = "Hardkernel ODROID-C2";
+
+	aliases {
+		serial0 = &uart_AO;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x80000000>;
+	};
+};
+
+&uart_AO {
+	status = "okay";
+};
diff --git a/arch/arm/dts/meson-gxbb.dtsi b/arch/arm/dts/meson-gxbb.dtsi
new file mode 100644
index 0000000..832815d
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb.dtsi
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2016 Andreas F?rber
+ *
+ * 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 library 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 library 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 "AS IS", 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 <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "amlogic,meson-gxbb";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <0x2>;
+		#size-cells = <0x0>;
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+		};
+	};
+
+	arm-pmu {
+		compatible = "arm,cortex-a53-pmu";
+		interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 14
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 11
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 10
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>;
+	};
+
+	xtal: xtal-clk {
+		compatible = "fixed-clock";
+		clock-frequency = <24000000>;
+		clock-output-names = "xtal";
+		#clock-cells = <0>;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		cbus: cbus at c1100000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xc1100000 0x0 0x100000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xc1100000 0x0 0x100000>;
+
+			uart_A: serial at 84c0 {
+				compatible = "amlogic,meson-uart";
+				reg = <0x0 0x084c0 0x0 0x14>;
+				interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&xtal>;
+				status = "disabled";
+			};
+		};
+
+		gic: interrupt-controller at c4301000 {
+			compatible = "arm,gic-400";
+			reg = <0x0 0xc4301000 0 0x1000>,
+			      <0x0 0xc4302000 0 0x2000>,
+			      <0x0 0xc4304000 0 0x2000>,
+			      <0x0 0xc4306000 0 0x2000>;
+			interrupt-controller;
+			interrupts = <GIC_PPI 9
+				(GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+		};
+
+		aobus: aobus at c8100000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xc8100000 0x0 0x100000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xc8100000 0x0 0x100000>;
+
+			uart_AO: serial at 4c0 {
+				compatible = "amlogic,meson-uart";
+				reg = <0x0 0x004c0 0x0 0x14>;
+				interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&xtal>;
+				status = "disabled";
+			};
+		};
+
+		apb: apb at d0000000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xd0000000 0x0 0x200000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xd0000000 0x0 0x200000>;
+		};
+	};
+};
diff --git a/arch/arm/include/asm/arch-meson/gxbb.h b/arch/arm/include/asm/arch-meson/gxbb.h
new file mode 100644
index 0000000..f90f632
--- /dev/null
+++ b/arch/arm/include/asm/arch-meson/gxbb.h
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __GXBB_H__
+#define __GXBB_H__
+
+#define GXBB_PERIPHS_BASE	0xc8834400
+#define GXBB_HIU_BASE		0xc883c000
+#define GXBB_ETH_BASE		0xc9410000
+
+/* Peripherals registers */
+#define GXBB_PERIPHS_ADDR(off)	(GXBB_PERIPHS_BASE + ((off) << 2))
+
+/* GPIO registers 0 to 6 */
+#define _GXBB_GPIO_OFF(n)	((n) == 6 ? 0x08 : 0x0c + 3 * (n))
+#define GXBB_GPIO_EN(n)		GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 0)
+#define GXBB_GPIO_IN(n)		GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 1)
+#define GXBB_GPIO_OUT(n)	GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 2)
+
+/* Pinmux registers 0 to 12 */
+#define GXBB_PINMUX(n)		GXBB_PERIPHS_ADDR(0x2c + (n))
+
+#define GXBB_ETH_REG_0		GXBB_PERIPHS_ADDR(0x50)
+#define GXBB_ETH_REG_1		GXBB_PERIPHS_ADDR(0x51)
+
+#define GXBB_ETH_REG_0_PHY_INTF		BIT(0)
+#define GXBB_ETH_REG_0_TX_PHASE(x)	(((x) & 3) << 5)
+#define GXBB_ETH_REG_0_TX_RATIO(x)	(((x) & 7) << 7)
+#define GXBB_ETH_REG_0_PHY_CLK_EN	BIT(10)
+#define GXBB_ETH_REG_0_CLK_EN		BIT(12)
+
+/* HIU registers */
+#define GXBB_HIU_ADDR(off)	(GXBB_HIU_BASE + ((off) << 2))
+
+#define GXBB_MEM_PD_REG_0	GXBB_HIU_ADDR(0x40)
+
+/* Ethernet memory power domain */
+#define GXBB_MEM_PD_REG_0_ETH_MASK	(BIT(2) | BIT(3))
+
+/* Clock gates */
+#define GXBB_GCLK_MPEG_0	GXBB_HIU_ADDR(0x50)
+#define GXBB_GCLK_MPEG_1	GXBB_HIU_ADDR(0x51)
+#define GXBB_GCLK_MPEG_2	GXBB_HIU_ADDR(0x52)
+#define GXBB_GCLK_MPEG_OTHER	GXBB_HIU_ADDR(0x53)
+#define GXBB_GCLK_MPEG_AO	GXBB_HIU_ADDR(0x54)
+
+#define GXBB_GCLK_MPEG_1_ETH	BIT(3)
+
+#endif /* __GXBB_H__ */
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
new file mode 100644
index 0000000..77d3cfe
--- /dev/null
+++ b/arch/arm/mach-meson/Kconfig
@@ -0,0 +1,31 @@
+if ARCH_MESON
+
+config MESON_GXBB
+	bool "Support Meson GXBaby"
+	select ARM64
+	select DM
+	select DM_SERIAL
+	help
+	  The Amlogic Meson GXBaby (S905) is an ARM SoC with a
+	  quad-core Cortex-A53 CPU and a Mali-450 GPU.
+
+if MESON_GXBB
+
+config TARGET_ODROID_C2
+	bool "ODROID-C2"
+	help
+	  ODROID-C2 is a single board computer based on Meson GXBaby
+	  with 2 GiB of RAM, Gigabit Ethernet, HDMI, 4 USB, micro-SD
+	  slot, eMMC, IR receiver and a 40-pin GPIO header.
+
+endif
+
+config SYS_SOC
+	default "meson"
+
+config SYS_MALLOC_F_LEN
+	default 0x1000
+
+source "board/hardkernel/odroid-c2/Kconfig"
+
+endif
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
new file mode 100644
index 0000000..44e3d63
--- /dev/null
+++ b/arch/arm/mach-meson/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2016 Beniamino Galvani <b.galvani@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += board.o
diff --git a/arch/arm/mach-meson/board.c b/arch/arm/mach-meson/board.c
new file mode 100644
index 0000000..782f86c
--- /dev/null
+++ b/arch/arm/mach-meson/board.c
@@ -0,0 +1,66 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <libfdt.h>
+#include <linux/err.h>
+#include <asm/arch/gxbb.h>
+#include <asm/armv8/mmu.h>
+#include <asm/unaligned.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	const fdt64_t *val;
+	int offset;
+	int len;
+
+	offset = fdt_path_offset(gd->fdt_blob, "/memory");
+	if (offset < 0)
+		return -EINVAL;
+
+	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
+	if (len < sizeof(*val) * 2)
+		return -EINVAL;
+
+	/* Use unaligned access since cache is still disabled */
+	gd->ram_size = get_unaligned_be64(&val[1]);
+
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
+	/* Reserve first 16 MiB of RAM for firmware */
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + (16 * 1024 * 1024);
+	gd->bd->bi_dram[0].size = gd->ram_size - (16 * 1024 * 1024);
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset(true);
+}
+
+static struct mm_region gxbb_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0x80000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = gxbb_mem_map;
diff --git a/board/hardkernel/odroid-c2/Kconfig b/board/hardkernel/odroid-c2/Kconfig
new file mode 100644
index 0000000..687d9c6
--- /dev/null
+++ b/board/hardkernel/odroid-c2/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_ODROID_C2
+
+config SYS_BOARD
+	default "odroid-c2"
+
+config SYS_VENDOR
+	default "hardkernel"
+
+config SYS_CONFIG_NAME
+	default "odroid-c2"
+
+endif
diff --git a/board/hardkernel/odroid-c2/MAINTAINERS b/board/hardkernel/odroid-c2/MAINTAINERS
new file mode 100644
index 0000000..23ae1e7
--- /dev/null
+++ b/board/hardkernel/odroid-c2/MAINTAINERS
@@ -0,0 +1,6 @@
+ODROID-C2
+M:	Beniamino Galvani <b.galvani@gmail.com>
+S:	Maintained
+F:	board/hardkernel/odroid-c2/
+F:	include/configs/odroid-c2.h
+F:	configs/odroid-c2_defconfig
diff --git a/board/hardkernel/odroid-c2/Makefile b/board/hardkernel/odroid-c2/Makefile
new file mode 100644
index 0000000..571044b
--- /dev/null
+++ b/board/hardkernel/odroid-c2/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= odroid-c2.o
diff --git a/board/hardkernel/odroid-c2/README b/board/hardkernel/odroid-c2/README
new file mode 100644
index 0000000..d6d266a
--- /dev/null
+++ b/board/hardkernel/odroid-c2/README
@@ -0,0 +1,60 @@
+U-Boot for ODROID-C2
+====================
+
+ODROID-C2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 2GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 2.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-c2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > DIR=odroid-c2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
+       $DIR
+ > $DIR/fip/fip_create --bl30  $DIR/fip/gxb/bl30.bin \
+                       --bl301 $DIR/fip/gxb/bl301.bin \
+                       --bl31  $DIR/fip/gxb/bl31.bin \
+                       --bl33  u-boot.bin \
+                       $DIR/fip.bin
+ > $DIR/fip/fip_create --dump $DIR/fip.bin
+ > cat $DIR/fip/gxb/bl2.package $DIR/fip.bin > $DIR/boot_new.bin
+ > $DIR/fip/gxb/aml_encrypt_gxb --bootsig \
+                                --input $DIR/boot_new.bin \
+                                --output $DIR/u-boot.img
+ > dd if=$DIR/u-boot.img of=$DIR/u-boot.gxbb bs=512 skip=96
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > BL1=$DIR/sd_fuse/bl1.bin.hardkernel
+ > dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
+ > dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
+ > dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
diff --git a/board/hardkernel/odroid-c2/odroid-c2.c b/board/hardkernel/odroid-c2/odroid-c2.c
new file mode 100644
index 0000000..c258d4f
--- /dev/null
+++ b/board/hardkernel/odroid-c2/odroid-c2.c
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/gxbb.h>
+#include <dm/platdata.h>
+#include <phy.h>
+
+int board_init(void)
+{
+	return 0;
+}
+
+static const struct eth_pdata gxbb_eth_pdata = {
+	.iobase = GXBB_ETH_BASE,
+	.phy_interface = PHY_INTERFACE_MODE_RGMII,
+};
+
+U_BOOT_DEVICE(meson_eth) = {
+	.name = "eth_designware",
+	.platdata = &gxbb_eth_pdata,
+};
+
+int misc_init_r(void)
+{
+	/* Select Ethernet function */
+	setbits_le32(GXBB_PINMUX(6), 0x3fff);
+
+	/* Set RGMII mode */
+	setbits_le32(GXBB_ETH_REG_0, GXBB_ETH_REG_0_PHY_INTF |
+				     GXBB_ETH_REG_0_TX_PHASE(1) |
+				     GXBB_ETH_REG_0_TX_RATIO(4) |
+				     GXBB_ETH_REG_0_PHY_CLK_EN |
+				     GXBB_ETH_REG_0_CLK_EN);
+
+	/* Enable power and clock gate */
+	setbits_le32(GXBB_GCLK_MPEG_1, GXBB_GCLK_MPEG_1_ETH);
+	clrbits_le32(GXBB_MEM_PD_REG_0, GXBB_MEM_PD_REG_0_ETH_MASK);
+
+	/* Reset PHY on GPIOZ_14 */
+	clrbits_le32(GXBB_GPIO_EN(3), BIT(14));
+	clrbits_le32(GXBB_GPIO_OUT(3), BIT(14));
+	mdelay(10);
+	setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
+
+	return 0;
+}
diff --git a/configs/odroid-c2_defconfig b/configs/odroid-c2_defconfig
new file mode 100644
index 0000000..a771b20
--- /dev/null
+++ b/configs/odroid-c2_defconfig
@@ -0,0 +1,23 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_MESON_GXBB=y
+CONFIG_TARGET_ODROID_C2=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_LOADS is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_CMD_SOURCE is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index a9a5d47..7720b3e 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -112,6 +112,14 @@ config DEBUG_UART_S5P
 	  will need to provide parameters to make this work. The driver will
 	  be available until the real driver-model serial is running.
 
+config DEBUG_UART_MESON
+	bool "Amlogic Meson"
+	depends on MESON_SERIAL
+	help
+	  Select this to enable a debug UART using the serial_meson driver. You
+	  will need to provide parameters to make this work. The driver will
+	  be available until the real driver-model serial is running.
+
 config DEBUG_UART_UARTLITE
 	bool "Xilinx Uartlite"
 	help
@@ -320,6 +328,13 @@ config XILINX_UARTLITE
 	  If you have a Xilinx based board and want to use the uartlite
 	  serial ports, say Y to this option. If unsure, say N.
 
+config MESON_SERIAL
+	bool "Support for Amlogic Meson UART"
+	depends on DM_SERIAL && ARCH_MESON
+	help
+	  If you have an Amlogic Meson based board and want to use the on-chip
+	  serial ports, say Y to this option. If unsure, say N.
+
 config MSM_SERIAL
 	bool "Qualcomm on-chip UART"
 	depends on DM_SERIAL
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index b0ac9d8..35c143d 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_SYS_NS16550) += ns16550.o
 obj-$(CONFIG_S5P) += serial_s5p.o
 obj-$(CONFIG_MXC_UART) += serial_mxc.o
 obj-$(CONFIG_PXA_SERIAL) += serial_pxa.o
+obj-$(CONFIG_MESON_SERIAL) += serial_meson.o
 obj-$(CONFIG_S3C24X0_SERIAL) += serial_s3c24x0.o
 obj-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o
 obj-$(CONFIG_SANDBOX_SERIAL) += sandbox.o
diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
new file mode 100644
index 0000000..1b49426
--- /dev/null
+++ b/drivers/serial/serial_meson.c
@@ -0,0 +1,162 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <linux/compiler.h>
+#include <serial.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct meson_uart {
+	u32 wfifo;
+	u32 rfifo;
+	u32 control;
+	u32 status;
+	u32 misc;
+};
+
+struct meson_serial_platdata {
+	struct meson_uart *reg;
+};
+
+/* AML_UART_STATUS bits */
+#define AML_UART_PARITY_ERR		BIT(16)
+#define AML_UART_FRAME_ERR		BIT(17)
+#define AML_UART_TX_FIFO_WERR		BIT(18)
+#define AML_UART_RX_EMPTY		BIT(20)
+#define AML_UART_TX_FULL		BIT(21)
+#define AML_UART_TX_EMPTY		BIT(22)
+#define AML_UART_XMIT_BUSY		BIT(25)
+#define AML_UART_ERR			(AML_UART_PARITY_ERR | \
+					 AML_UART_FRAME_ERR  | \
+					 AML_UART_TX_FIFO_WERR)
+
+/* AML_UART_CONTROL bits */
+#define AML_UART_TX_EN			BIT(12)
+#define AML_UART_RX_EN			BIT(13)
+#define AML_UART_TX_RST			BIT(22)
+#define AML_UART_RX_RST			BIT(23)
+#define AML_UART_CLR_ERR		BIT(24)
+
+static void meson_serial_init(struct meson_uart *uart)
+{
+	u32 val;
+
+	val = readl(&uart->control);
+	val |= (AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	writel(val, &uart->control);
+	val &= ~(AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	writel(val, &uart->control);
+	val |= (AML_UART_RX_EN | AML_UART_TX_EN);
+	writel(val, &uart->control);
+}
+
+static int meson_serial_probe(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	meson_serial_init(uart);
+
+	return 0;
+}
+
+static int meson_serial_getc(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	if (readl(&uart->status) & AML_UART_RX_EMPTY)
+		return -EAGAIN;
+
+	return readl(&uart->rfifo) & 0xff;
+}
+
+static int meson_serial_putc(struct udevice *dev, const char ch)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	if (readl(&uart->status) & AML_UART_TX_FULL)
+		return -EAGAIN;
+
+	writel(ch, &uart->wfifo);
+
+	return 0;
+}
+
+static int meson_serial_pending(struct udevice *dev, bool input)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+	uint32_t status = readl(&uart->status);
+
+	if (input)
+		return !(status & AML_UART_RX_EMPTY);
+	else
+		return !(status & AML_UART_TX_FULL);
+}
+
+static int meson_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	fdt_addr_t addr;
+
+	addr = dev_get_addr(dev);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->reg = (struct meson_uart *)addr;
+
+	return 0;
+}
+
+static const struct dm_serial_ops meson_serial_ops = {
+	.putc = meson_serial_putc,
+	.pending = meson_serial_pending,
+	.getc = meson_serial_getc,
+};
+
+static const struct udevice_id meson_serial_ids[] = {
+	{ .compatible = "amlogic,meson-uart" },
+	{ }
+};
+
+U_BOOT_DRIVER(serial_meson) = {
+	.name		= "serial_meson",
+	.id		= UCLASS_SERIAL,
+	.of_match	= meson_serial_ids,
+	.probe		= meson_serial_probe,
+	.ops		= &meson_serial_ops,
+	.flags		= DM_FLAG_PRE_RELOC,
+	.ofdata_to_platdata = meson_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct meson_serial_platdata),
+};
+
+#ifdef CONFIG_DEBUG_UART_MESON
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+	struct meson_uart *regs = (struct meson_uart *)CONFIG_DEBUG_UART_BASE;
+
+	while (readl(&regs->status) & AML_UART_TX_FULL)
+		;
+
+	writel(ch, &regs->wfifo);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
diff --git a/include/configs/odroid-c2.h b/include/configs/odroid-c2.h
new file mode 100644
index 0000000..37a5671
--- /dev/null
+++ b/include/configs/odroid-c2.h
@@ -0,0 +1,51 @@
+/*
+ * Configuration for ODROID-C2
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_CPU_ARMV8
+#define CONFIG_REMAKE_ELF
+#define CONFIG_SYS_CACHELINE_SIZE	64
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_ENV_IS_NOWHERE		1
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_SYS_MAXARGS		32
+#define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#define CONFIG_SYS_CBSIZE		1024
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_SYS_SDRAM_BASE		0
+#define CONFIG_SYS_TEXT_BASE		0x01000000
+#define CONFIG_SYS_INIT_SP_ADDR		0x20000000
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_TEXT_BASE
+
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE			0xc4301000
+#define GICC_BASE			0xc4302000
+
+#define CONFIG_IDENT_STRING		" odroid-c2"
+
+/* Serial setup */
+#define CONFIG_CONS_INDEX		0
+#define CONFIG_BAUDRATE			115200
+
+#define CONFIG_CMD_ENV
+
+/* Monitor Command Prompt */
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
+					sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_CMDLINE_EDITING
+
+#include <config_distro_defaults.h>
+
+#endif /* __CONFIG_H */
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
@ 2016-05-08  6:30   ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: linus-amlogic

This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
board definition for ODROID-C2. This initial submission only supports
UART and Ethernet (through the existing Designware driver). DTS files
are the ones submitted to Linux arm-soc for 4.7 [1].

[1] https://patchwork.ozlabs.org/patch/603583/

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/Kconfig                       |   9 ++
 arch/arm/Makefile                      |   1 +
 arch/arm/dts/Makefile                  |   2 +
 arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
 arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
 arch/arm/mach-meson/Kconfig            |  31 ++++++
 arch/arm/mach-meson/Makefile           |   7 ++
 arch/arm/mach-meson/board.c            |  66 ++++++++++++
 board/hardkernel/odroid-c2/Kconfig     |  12 +++
 board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
 board/hardkernel/odroid-c2/Makefile    |   7 ++
 board/hardkernel/odroid-c2/README      |  60 +++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++
 configs/odroid-c2_defconfig            |  23 +++++
 drivers/serial/Kconfig                 |  15 +++
 drivers/serial/Makefile                |   1 +
 drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
 include/configs/odroid-c2.h            |  51 ++++++++++
 19 files changed, 803 insertions(+)
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 create mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
 create mode 100644 arch/arm/mach-meson/Kconfig
 create mode 100644 arch/arm/mach-meson/Makefile
 create mode 100644 arch/arm/mach-meson/board.c
 create mode 100644 board/hardkernel/odroid-c2/Kconfig
 create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
 create mode 100644 board/hardkernel/odroid-c2/Makefile
 create mode 100644 board/hardkernel/odroid-c2/README
 create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
 create mode 100644 configs/odroid-c2_defconfig
 create mode 100644 drivers/serial/serial_meson.c
 create mode 100644 include/configs/odroid-c2.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6b65d8e..2786372 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -456,6 +456,13 @@ config ARCH_KEYSTONE
 	select SUPPORT_SPL
 	select CMD_POWEROFF
 
+config ARCH_MESON
+	bool "Amlogic Meson"
+	help
+	  Support for the Meson SoC family developed by Amlogic Inc.,
+	  targeted at media players and tablet computers. We currently
+	  support the S905 (GXBaby) 64-bit SoC.
+
 config ARCH_MX7
 	bool "Freescale MX7"
 	select CPU_V7
@@ -781,6 +788,8 @@ source "arch/arm/mach-orion5x/Kconfig"
 
 source "arch/arm/cpu/armv7/rmobile/Kconfig"
 
+source "arch/arm/mach-meson/Kconfig"
+
 source "arch/arm/mach-rockchip/Kconfig"
 
 source "arch/arm/mach-s5pc1xx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d516345..ecd1887 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -50,6 +50,7 @@ machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
 # TODO: rename CONFIG_KIRKWOOD -> CONFIG_ARCH_KIRKWOOD
 machine-$(CONFIG_KIRKWOOD)		+= kirkwood
+machine-$(CONFIG_ARCH_MESON)		+= meson
 machine-$(CONFIG_ARCH_MVEBU)		+= mvebu
 # TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA
 # TODO: rename CONFIG_ORION5X -> CONFIG_ARCH_ORION5X
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d1f8e22..136a7d8 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,6 +26,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-jerry.dtb \
 	rk3288-rock2-square.dtb \
 	rk3036-sdk.dtb
+dtb-$(CONFIG_ARCH_MESON) += \
+	meson-gxbb-odroidc2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-gxbb-odroidc2.dts b/arch/arm/dts/meson-gxbb-odroidc2.dts
new file mode 100644
index 0000000..653c2fa
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-odroidc2.dts
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016 Andreas F?rber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ *
+ * 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 library 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 library 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 "AS IS", 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.
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb.dtsi"
+
+/ {
+	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
+	model = "Hardkernel ODROID-C2";
+
+	aliases {
+		serial0 = &uart_AO;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x80000000>;
+	};
+};
+
+&uart_AO {
+	status = "okay";
+};
diff --git a/arch/arm/dts/meson-gxbb.dtsi b/arch/arm/dts/meson-gxbb.dtsi
new file mode 100644
index 0000000..832815d
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb.dtsi
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2016 Andreas F?rber
+ *
+ * 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 library 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 library 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 "AS IS", 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 <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "amlogic,meson-gxbb";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <0x2>;
+		#size-cells = <0x0>;
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+		};
+	};
+
+	arm-pmu {
+		compatible = "arm,cortex-a53-pmu";
+		interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 14
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 11
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>,
+			     <GIC_PPI 10
+			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>;
+	};
+
+	xtal: xtal-clk {
+		compatible = "fixed-clock";
+		clock-frequency = <24000000>;
+		clock-output-names = "xtal";
+		#clock-cells = <0>;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		cbus: cbus at c1100000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xc1100000 0x0 0x100000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xc1100000 0x0 0x100000>;
+
+			uart_A: serial at 84c0 {
+				compatible = "amlogic,meson-uart";
+				reg = <0x0 0x084c0 0x0 0x14>;
+				interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&xtal>;
+				status = "disabled";
+			};
+		};
+
+		gic: interrupt-controller at c4301000 {
+			compatible = "arm,gic-400";
+			reg = <0x0 0xc4301000 0 0x1000>,
+			      <0x0 0xc4302000 0 0x2000>,
+			      <0x0 0xc4304000 0 0x2000>,
+			      <0x0 0xc4306000 0 0x2000>;
+			interrupt-controller;
+			interrupts = <GIC_PPI 9
+				(GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+		};
+
+		aobus: aobus at c8100000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xc8100000 0x0 0x100000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xc8100000 0x0 0x100000>;
+
+			uart_AO: serial at 4c0 {
+				compatible = "amlogic,meson-uart";
+				reg = <0x0 0x004c0 0x0 0x14>;
+				interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&xtal>;
+				status = "disabled";
+			};
+		};
+
+		apb: apb at d0000000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xd0000000 0x0 0x200000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xd0000000 0x0 0x200000>;
+		};
+	};
+};
diff --git a/arch/arm/include/asm/arch-meson/gxbb.h b/arch/arm/include/asm/arch-meson/gxbb.h
new file mode 100644
index 0000000..f90f632
--- /dev/null
+++ b/arch/arm/include/asm/arch-meson/gxbb.h
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __GXBB_H__
+#define __GXBB_H__
+
+#define GXBB_PERIPHS_BASE	0xc8834400
+#define GXBB_HIU_BASE		0xc883c000
+#define GXBB_ETH_BASE		0xc9410000
+
+/* Peripherals registers */
+#define GXBB_PERIPHS_ADDR(off)	(GXBB_PERIPHS_BASE + ((off) << 2))
+
+/* GPIO registers 0 to 6 */
+#define _GXBB_GPIO_OFF(n)	((n) == 6 ? 0x08 : 0x0c + 3 * (n))
+#define GXBB_GPIO_EN(n)		GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 0)
+#define GXBB_GPIO_IN(n)		GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 1)
+#define GXBB_GPIO_OUT(n)	GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 2)
+
+/* Pinmux registers 0 to 12 */
+#define GXBB_PINMUX(n)		GXBB_PERIPHS_ADDR(0x2c + (n))
+
+#define GXBB_ETH_REG_0		GXBB_PERIPHS_ADDR(0x50)
+#define GXBB_ETH_REG_1		GXBB_PERIPHS_ADDR(0x51)
+
+#define GXBB_ETH_REG_0_PHY_INTF		BIT(0)
+#define GXBB_ETH_REG_0_TX_PHASE(x)	(((x) & 3) << 5)
+#define GXBB_ETH_REG_0_TX_RATIO(x)	(((x) & 7) << 7)
+#define GXBB_ETH_REG_0_PHY_CLK_EN	BIT(10)
+#define GXBB_ETH_REG_0_CLK_EN		BIT(12)
+
+/* HIU registers */
+#define GXBB_HIU_ADDR(off)	(GXBB_HIU_BASE + ((off) << 2))
+
+#define GXBB_MEM_PD_REG_0	GXBB_HIU_ADDR(0x40)
+
+/* Ethernet memory power domain */
+#define GXBB_MEM_PD_REG_0_ETH_MASK	(BIT(2) | BIT(3))
+
+/* Clock gates */
+#define GXBB_GCLK_MPEG_0	GXBB_HIU_ADDR(0x50)
+#define GXBB_GCLK_MPEG_1	GXBB_HIU_ADDR(0x51)
+#define GXBB_GCLK_MPEG_2	GXBB_HIU_ADDR(0x52)
+#define GXBB_GCLK_MPEG_OTHER	GXBB_HIU_ADDR(0x53)
+#define GXBB_GCLK_MPEG_AO	GXBB_HIU_ADDR(0x54)
+
+#define GXBB_GCLK_MPEG_1_ETH	BIT(3)
+
+#endif /* __GXBB_H__ */
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
new file mode 100644
index 0000000..77d3cfe
--- /dev/null
+++ b/arch/arm/mach-meson/Kconfig
@@ -0,0 +1,31 @@
+if ARCH_MESON
+
+config MESON_GXBB
+	bool "Support Meson GXBaby"
+	select ARM64
+	select DM
+	select DM_SERIAL
+	help
+	  The Amlogic Meson GXBaby (S905) is an ARM SoC with a
+	  quad-core Cortex-A53 CPU and a Mali-450 GPU.
+
+if MESON_GXBB
+
+config TARGET_ODROID_C2
+	bool "ODROID-C2"
+	help
+	  ODROID-C2 is a single board computer based on Meson GXBaby
+	  with 2 GiB of RAM, Gigabit Ethernet, HDMI, 4 USB, micro-SD
+	  slot, eMMC, IR receiver and a 40-pin GPIO header.
+
+endif
+
+config SYS_SOC
+	default "meson"
+
+config SYS_MALLOC_F_LEN
+	default 0x1000
+
+source "board/hardkernel/odroid-c2/Kconfig"
+
+endif
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
new file mode 100644
index 0000000..44e3d63
--- /dev/null
+++ b/arch/arm/mach-meson/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2016 Beniamino Galvani <b.galvani@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += board.o
diff --git a/arch/arm/mach-meson/board.c b/arch/arm/mach-meson/board.c
new file mode 100644
index 0000000..782f86c
--- /dev/null
+++ b/arch/arm/mach-meson/board.c
@@ -0,0 +1,66 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <libfdt.h>
+#include <linux/err.h>
+#include <asm/arch/gxbb.h>
+#include <asm/armv8/mmu.h>
+#include <asm/unaligned.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	const fdt64_t *val;
+	int offset;
+	int len;
+
+	offset = fdt_path_offset(gd->fdt_blob, "/memory");
+	if (offset < 0)
+		return -EINVAL;
+
+	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
+	if (len < sizeof(*val) * 2)
+		return -EINVAL;
+
+	/* Use unaligned access since cache is still disabled */
+	gd->ram_size = get_unaligned_be64(&val[1]);
+
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
+	/* Reserve first 16 MiB of RAM for firmware */
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + (16 * 1024 * 1024);
+	gd->bd->bi_dram[0].size = gd->ram_size - (16 * 1024 * 1024);
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset(true);
+}
+
+static struct mm_region gxbb_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0x80000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = gxbb_mem_map;
diff --git a/board/hardkernel/odroid-c2/Kconfig b/board/hardkernel/odroid-c2/Kconfig
new file mode 100644
index 0000000..687d9c6
--- /dev/null
+++ b/board/hardkernel/odroid-c2/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_ODROID_C2
+
+config SYS_BOARD
+	default "odroid-c2"
+
+config SYS_VENDOR
+	default "hardkernel"
+
+config SYS_CONFIG_NAME
+	default "odroid-c2"
+
+endif
diff --git a/board/hardkernel/odroid-c2/MAINTAINERS b/board/hardkernel/odroid-c2/MAINTAINERS
new file mode 100644
index 0000000..23ae1e7
--- /dev/null
+++ b/board/hardkernel/odroid-c2/MAINTAINERS
@@ -0,0 +1,6 @@
+ODROID-C2
+M:	Beniamino Galvani <b.galvani@gmail.com>
+S:	Maintained
+F:	board/hardkernel/odroid-c2/
+F:	include/configs/odroid-c2.h
+F:	configs/odroid-c2_defconfig
diff --git a/board/hardkernel/odroid-c2/Makefile b/board/hardkernel/odroid-c2/Makefile
new file mode 100644
index 0000000..571044b
--- /dev/null
+++ b/board/hardkernel/odroid-c2/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= odroid-c2.o
diff --git a/board/hardkernel/odroid-c2/README b/board/hardkernel/odroid-c2/README
new file mode 100644
index 0000000..d6d266a
--- /dev/null
+++ b/board/hardkernel/odroid-c2/README
@@ -0,0 +1,60 @@
+U-Boot for ODROID-C2
+====================
+
+ODROID-C2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 2GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 2.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-c2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > DIR=odroid-c2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
+       $DIR
+ > $DIR/fip/fip_create --bl30  $DIR/fip/gxb/bl30.bin \
+                       --bl301 $DIR/fip/gxb/bl301.bin \
+                       --bl31  $DIR/fip/gxb/bl31.bin \
+                       --bl33  u-boot.bin \
+                       $DIR/fip.bin
+ > $DIR/fip/fip_create --dump $DIR/fip.bin
+ > cat $DIR/fip/gxb/bl2.package $DIR/fip.bin > $DIR/boot_new.bin
+ > $DIR/fip/gxb/aml_encrypt_gxb --bootsig \
+                                --input $DIR/boot_new.bin \
+                                --output $DIR/u-boot.img
+ > dd if=$DIR/u-boot.img of=$DIR/u-boot.gxbb bs=512 skip=96
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > BL1=$DIR/sd_fuse/bl1.bin.hardkernel
+ > dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
+ > dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
+ > dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
diff --git a/board/hardkernel/odroid-c2/odroid-c2.c b/board/hardkernel/odroid-c2/odroid-c2.c
new file mode 100644
index 0000000..c258d4f
--- /dev/null
+++ b/board/hardkernel/odroid-c2/odroid-c2.c
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/gxbb.h>
+#include <dm/platdata.h>
+#include <phy.h>
+
+int board_init(void)
+{
+	return 0;
+}
+
+static const struct eth_pdata gxbb_eth_pdata = {
+	.iobase = GXBB_ETH_BASE,
+	.phy_interface = PHY_INTERFACE_MODE_RGMII,
+};
+
+U_BOOT_DEVICE(meson_eth) = {
+	.name = "eth_designware",
+	.platdata = &gxbb_eth_pdata,
+};
+
+int misc_init_r(void)
+{
+	/* Select Ethernet function */
+	setbits_le32(GXBB_PINMUX(6), 0x3fff);
+
+	/* Set RGMII mode */
+	setbits_le32(GXBB_ETH_REG_0, GXBB_ETH_REG_0_PHY_INTF |
+				     GXBB_ETH_REG_0_TX_PHASE(1) |
+				     GXBB_ETH_REG_0_TX_RATIO(4) |
+				     GXBB_ETH_REG_0_PHY_CLK_EN |
+				     GXBB_ETH_REG_0_CLK_EN);
+
+	/* Enable power and clock gate */
+	setbits_le32(GXBB_GCLK_MPEG_1, GXBB_GCLK_MPEG_1_ETH);
+	clrbits_le32(GXBB_MEM_PD_REG_0, GXBB_MEM_PD_REG_0_ETH_MASK);
+
+	/* Reset PHY on GPIOZ_14 */
+	clrbits_le32(GXBB_GPIO_EN(3), BIT(14));
+	clrbits_le32(GXBB_GPIO_OUT(3), BIT(14));
+	mdelay(10);
+	setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
+
+	return 0;
+}
diff --git a/configs/odroid-c2_defconfig b/configs/odroid-c2_defconfig
new file mode 100644
index 0000000..a771b20
--- /dev/null
+++ b/configs/odroid-c2_defconfig
@@ -0,0 +1,23 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_MESON_GXBB=y
+CONFIG_TARGET_ODROID_C2=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_LOADS is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_CMD_SOURCE is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index a9a5d47..7720b3e 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -112,6 +112,14 @@ config DEBUG_UART_S5P
 	  will need to provide parameters to make this work. The driver will
 	  be available until the real driver-model serial is running.
 
+config DEBUG_UART_MESON
+	bool "Amlogic Meson"
+	depends on MESON_SERIAL
+	help
+	  Select this to enable a debug UART using the serial_meson driver. You
+	  will need to provide parameters to make this work. The driver will
+	  be available until the real driver-model serial is running.
+
 config DEBUG_UART_UARTLITE
 	bool "Xilinx Uartlite"
 	help
@@ -320,6 +328,13 @@ config XILINX_UARTLITE
 	  If you have a Xilinx based board and want to use the uartlite
 	  serial ports, say Y to this option. If unsure, say N.
 
+config MESON_SERIAL
+	bool "Support for Amlogic Meson UART"
+	depends on DM_SERIAL && ARCH_MESON
+	help
+	  If you have an Amlogic Meson based board and want to use the on-chip
+	  serial ports, say Y to this option. If unsure, say N.
+
 config MSM_SERIAL
 	bool "Qualcomm on-chip UART"
 	depends on DM_SERIAL
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index b0ac9d8..35c143d 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_SYS_NS16550) += ns16550.o
 obj-$(CONFIG_S5P) += serial_s5p.o
 obj-$(CONFIG_MXC_UART) += serial_mxc.o
 obj-$(CONFIG_PXA_SERIAL) += serial_pxa.o
+obj-$(CONFIG_MESON_SERIAL) += serial_meson.o
 obj-$(CONFIG_S3C24X0_SERIAL) += serial_s3c24x0.o
 obj-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o
 obj-$(CONFIG_SANDBOX_SERIAL) += sandbox.o
diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
new file mode 100644
index 0000000..1b49426
--- /dev/null
+++ b/drivers/serial/serial_meson.c
@@ -0,0 +1,162 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <linux/compiler.h>
+#include <serial.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct meson_uart {
+	u32 wfifo;
+	u32 rfifo;
+	u32 control;
+	u32 status;
+	u32 misc;
+};
+
+struct meson_serial_platdata {
+	struct meson_uart *reg;
+};
+
+/* AML_UART_STATUS bits */
+#define AML_UART_PARITY_ERR		BIT(16)
+#define AML_UART_FRAME_ERR		BIT(17)
+#define AML_UART_TX_FIFO_WERR		BIT(18)
+#define AML_UART_RX_EMPTY		BIT(20)
+#define AML_UART_TX_FULL		BIT(21)
+#define AML_UART_TX_EMPTY		BIT(22)
+#define AML_UART_XMIT_BUSY		BIT(25)
+#define AML_UART_ERR			(AML_UART_PARITY_ERR | \
+					 AML_UART_FRAME_ERR  | \
+					 AML_UART_TX_FIFO_WERR)
+
+/* AML_UART_CONTROL bits */
+#define AML_UART_TX_EN			BIT(12)
+#define AML_UART_RX_EN			BIT(13)
+#define AML_UART_TX_RST			BIT(22)
+#define AML_UART_RX_RST			BIT(23)
+#define AML_UART_CLR_ERR		BIT(24)
+
+static void meson_serial_init(struct meson_uart *uart)
+{
+	u32 val;
+
+	val = readl(&uart->control);
+	val |= (AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	writel(val, &uart->control);
+	val &= ~(AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	writel(val, &uart->control);
+	val |= (AML_UART_RX_EN | AML_UART_TX_EN);
+	writel(val, &uart->control);
+}
+
+static int meson_serial_probe(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	meson_serial_init(uart);
+
+	return 0;
+}
+
+static int meson_serial_getc(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	if (readl(&uart->status) & AML_UART_RX_EMPTY)
+		return -EAGAIN;
+
+	return readl(&uart->rfifo) & 0xff;
+}
+
+static int meson_serial_putc(struct udevice *dev, const char ch)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+
+	if (readl(&uart->status) & AML_UART_TX_FULL)
+		return -EAGAIN;
+
+	writel(ch, &uart->wfifo);
+
+	return 0;
+}
+
+static int meson_serial_pending(struct udevice *dev, bool input)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	struct meson_uart *const uart = plat->reg;
+	uint32_t status = readl(&uart->status);
+
+	if (input)
+		return !(status & AML_UART_RX_EMPTY);
+	else
+		return !(status & AML_UART_TX_FULL);
+}
+
+static int meson_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct meson_serial_platdata *plat = dev->platdata;
+	fdt_addr_t addr;
+
+	addr = dev_get_addr(dev);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->reg = (struct meson_uart *)addr;
+
+	return 0;
+}
+
+static const struct dm_serial_ops meson_serial_ops = {
+	.putc = meson_serial_putc,
+	.pending = meson_serial_pending,
+	.getc = meson_serial_getc,
+};
+
+static const struct udevice_id meson_serial_ids[] = {
+	{ .compatible = "amlogic,meson-uart" },
+	{ }
+};
+
+U_BOOT_DRIVER(serial_meson) = {
+	.name		= "serial_meson",
+	.id		= UCLASS_SERIAL,
+	.of_match	= meson_serial_ids,
+	.probe		= meson_serial_probe,
+	.ops		= &meson_serial_ops,
+	.flags		= DM_FLAG_PRE_RELOC,
+	.ofdata_to_platdata = meson_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct meson_serial_platdata),
+};
+
+#ifdef CONFIG_DEBUG_UART_MESON
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+	struct meson_uart *regs = (struct meson_uart *)CONFIG_DEBUG_UART_BASE;
+
+	while (readl(&regs->status) & AML_UART_TX_FULL)
+		;
+
+	writel(ch, &regs->wfifo);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
diff --git a/include/configs/odroid-c2.h b/include/configs/odroid-c2.h
new file mode 100644
index 0000000..37a5671
--- /dev/null
+++ b/include/configs/odroid-c2.h
@@ -0,0 +1,51 @@
+/*
+ * Configuration for ODROID-C2
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_CPU_ARMV8
+#define CONFIG_REMAKE_ELF
+#define CONFIG_SYS_CACHELINE_SIZE	64
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_ENV_IS_NOWHERE		1
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_SYS_MAXARGS		32
+#define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#define CONFIG_SYS_CBSIZE		1024
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_SYS_SDRAM_BASE		0
+#define CONFIG_SYS_TEXT_BASE		0x01000000
+#define CONFIG_SYS_INIT_SP_ADDR		0x20000000
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_TEXT_BASE
+
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE			0xc4301000
+#define GICC_BASE			0xc4302000
+
+#define CONFIG_IDENT_STRING		" odroid-c2"
+
+/* Serial setup */
+#define CONFIG_CONS_INDEX		0
+#define CONFIG_BAUDRATE			115200
+
+#define CONFIG_CMD_ENV
+
+/* Monitor Command Prompt */
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
+					sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_CMDLINE_EDITING
+
+#include <config_distro_defaults.h>
+
+#endif /* __CONFIG_H */
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 4/4] arm: meson: implement calls to secure monitor
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-05-08  6:30   ` Beniamino Galvani
  -1 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: u-boot

Implement calls to secure monitor to read the MAC address from e-fuse.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
 arch/arm/include/asm/arch-meson/sm.h   | 12 +++++++
 arch/arm/mach-meson/Makefile           |  2 +-
 arch/arm/mach-meson/board.c            |  1 +
 arch/arm/mach-meson/sm.c               | 57 ++++++++++++++++++++++++++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c | 16 ++++++++++
 5 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-meson/sm.h
 create mode 100644 arch/arm/mach-meson/sm.c

diff --git a/arch/arm/include/asm/arch-meson/sm.h b/arch/arm/include/asm/arch-meson/sm.h
new file mode 100644
index 0000000..225438d
--- /dev/null
+++ b/arch/arm/include/asm/arch-meson/sm.h
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __MESON_SM_H__
+#define __MESON_SM_H__
+
+ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size);
+
+#endif /* __MESON_SM_H__ */
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
index 44e3d63..bf49b8b 100644
--- a/arch/arm/mach-meson/Makefile
+++ b/arch/arm/mach-meson/Makefile
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y += board.o
+obj-y += board.o sm.o
diff --git a/arch/arm/mach-meson/board.c b/arch/arm/mach-meson/board.c
index 782f86c..64fa3c1 100644
--- a/arch/arm/mach-meson/board.c
+++ b/arch/arm/mach-meson/board.c
@@ -8,6 +8,7 @@
 #include <libfdt.h>
 #include <linux/err.h>
 #include <asm/arch/gxbb.h>
+#include <asm/arch/sm.h>
 #include <asm/armv8/mmu.h>
 #include <asm/unaligned.h>
 
diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
new file mode 100644
index 0000000..1b35a22
--- /dev/null
+++ b/arch/arm/mach-meson/sm.c
@@ -0,0 +1,57 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * Secure monitor calls.
+ */
+
+#include <common.h>
+#include <asm/arch/gxbb.h>
+#include <linux/kernel.h>
+
+#define FN_GET_SHARE_MEM_INPUT_BASE	0x82000020
+#define FN_GET_SHARE_MEM_OUTPUT_BASE	0x82000021
+#define FN_EFUSE_READ			0x82000030
+#define FN_EFUSE_WRITE			0x82000031
+
+static void *shmem_input;
+static void *shmem_output;
+
+static void meson_init_shmem(void)
+{
+	struct pt_regs regs;
+
+	if (shmem_input && shmem_output)
+		return;
+
+	regs.regs[0] = FN_GET_SHARE_MEM_INPUT_BASE;
+	smc_call(&regs);
+	shmem_input = (void *)regs.regs[0];
+
+	regs.regs[0] = FN_GET_SHARE_MEM_OUTPUT_BASE;
+	smc_call(&regs);
+	shmem_output = (void *)regs.regs[0];
+
+	debug("Secure Monitor shmem: 0x%p 0x%p\n", shmem_input, shmem_output);
+}
+
+ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size)
+{
+	struct pt_regs regs;
+
+	meson_init_shmem();
+
+	regs.regs[0] = FN_EFUSE_READ;
+	regs.regs[1] = offset;
+	regs.regs[2] = size;
+
+	smc_call(&regs);
+
+	if (regs.regs[0] == 0)
+		return -1;
+
+	memcpy(buffer, shmem_output, min(size, regs.regs[0]));
+
+	return regs.regs[0];
+}
diff --git a/board/hardkernel/odroid-c2/odroid-c2.c b/board/hardkernel/odroid-c2/odroid-c2.c
index c258d4f..bd72100 100644
--- a/board/hardkernel/odroid-c2/odroid-c2.c
+++ b/board/hardkernel/odroid-c2/odroid-c2.c
@@ -7,9 +7,15 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
+#include <asm/arch/sm.h>
 #include <dm/platdata.h>
 #include <phy.h>
 
+#define EFUSE_SN_OFFSET		20
+#define EFUSE_SN_SIZE		16
+#define EFUSE_MAC_OFFSET	52
+#define EFUSE_MAC_SIZE		6
+
 int board_init(void)
 {
 	return 0;
@@ -27,6 +33,9 @@ U_BOOT_DEVICE(meson_eth) = {
 
 int misc_init_r(void)
 {
+	u8 mac_addr[EFUSE_MAC_SIZE];
+	ssize_t len;
+
 	/* Select Ethernet function */
 	setbits_le32(GXBB_PINMUX(6), 0x3fff);
 
@@ -47,5 +56,12 @@ int misc_init_r(void)
 	mdelay(10);
 	setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
 
+	if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+					  mac_addr, EFUSE_MAC_SIZE);
+		if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+			eth_setenv_enetaddr("ethaddr", mac_addr);
+	}
+
 	return 0;
 }
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v7 4/4] arm: meson: implement calls to secure monitor
@ 2016-05-08  6:30   ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-05-08  6:30 UTC (permalink / raw)
  To: linus-amlogic

Implement calls to secure monitor to read the MAC address from e-fuse.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
 arch/arm/include/asm/arch-meson/sm.h   | 12 +++++++
 arch/arm/mach-meson/Makefile           |  2 +-
 arch/arm/mach-meson/board.c            |  1 +
 arch/arm/mach-meson/sm.c               | 57 ++++++++++++++++++++++++++++++++++
 board/hardkernel/odroid-c2/odroid-c2.c | 16 ++++++++++
 5 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-meson/sm.h
 create mode 100644 arch/arm/mach-meson/sm.c

diff --git a/arch/arm/include/asm/arch-meson/sm.h b/arch/arm/include/asm/arch-meson/sm.h
new file mode 100644
index 0000000..225438d
--- /dev/null
+++ b/arch/arm/include/asm/arch-meson/sm.h
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __MESON_SM_H__
+#define __MESON_SM_H__
+
+ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size);
+
+#endif /* __MESON_SM_H__ */
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
index 44e3d63..bf49b8b 100644
--- a/arch/arm/mach-meson/Makefile
+++ b/arch/arm/mach-meson/Makefile
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y += board.o
+obj-y += board.o sm.o
diff --git a/arch/arm/mach-meson/board.c b/arch/arm/mach-meson/board.c
index 782f86c..64fa3c1 100644
--- a/arch/arm/mach-meson/board.c
+++ b/arch/arm/mach-meson/board.c
@@ -8,6 +8,7 @@
 #include <libfdt.h>
 #include <linux/err.h>
 #include <asm/arch/gxbb.h>
+#include <asm/arch/sm.h>
 #include <asm/armv8/mmu.h>
 #include <asm/unaligned.h>
 
diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
new file mode 100644
index 0000000..1b35a22
--- /dev/null
+++ b/arch/arm/mach-meson/sm.c
@@ -0,0 +1,57 @@
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * Secure monitor calls.
+ */
+
+#include <common.h>
+#include <asm/arch/gxbb.h>
+#include <linux/kernel.h>
+
+#define FN_GET_SHARE_MEM_INPUT_BASE	0x82000020
+#define FN_GET_SHARE_MEM_OUTPUT_BASE	0x82000021
+#define FN_EFUSE_READ			0x82000030
+#define FN_EFUSE_WRITE			0x82000031
+
+static void *shmem_input;
+static void *shmem_output;
+
+static void meson_init_shmem(void)
+{
+	struct pt_regs regs;
+
+	if (shmem_input && shmem_output)
+		return;
+
+	regs.regs[0] = FN_GET_SHARE_MEM_INPUT_BASE;
+	smc_call(&regs);
+	shmem_input = (void *)regs.regs[0];
+
+	regs.regs[0] = FN_GET_SHARE_MEM_OUTPUT_BASE;
+	smc_call(&regs);
+	shmem_output = (void *)regs.regs[0];
+
+	debug("Secure Monitor shmem: 0x%p 0x%p\n", shmem_input, shmem_output);
+}
+
+ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size)
+{
+	struct pt_regs regs;
+
+	meson_init_shmem();
+
+	regs.regs[0] = FN_EFUSE_READ;
+	regs.regs[1] = offset;
+	regs.regs[2] = size;
+
+	smc_call(&regs);
+
+	if (regs.regs[0] == 0)
+		return -1;
+
+	memcpy(buffer, shmem_output, min(size, regs.regs[0]));
+
+	return regs.regs[0];
+}
diff --git a/board/hardkernel/odroid-c2/odroid-c2.c b/board/hardkernel/odroid-c2/odroid-c2.c
index c258d4f..bd72100 100644
--- a/board/hardkernel/odroid-c2/odroid-c2.c
+++ b/board/hardkernel/odroid-c2/odroid-c2.c
@@ -7,9 +7,15 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
+#include <asm/arch/sm.h>
 #include <dm/platdata.h>
 #include <phy.h>
 
+#define EFUSE_SN_OFFSET		20
+#define EFUSE_SN_SIZE		16
+#define EFUSE_MAC_OFFSET	52
+#define EFUSE_MAC_SIZE		6
+
 int board_init(void)
 {
 	return 0;
@@ -27,6 +33,9 @@ U_BOOT_DEVICE(meson_eth) = {
 
 int misc_init_r(void)
 {
+	u8 mac_addr[EFUSE_MAC_SIZE];
+	ssize_t len;
+
 	/* Select Ethernet function */
 	setbits_le32(GXBB_PINMUX(6), 0x3fff);
 
@@ -47,5 +56,12 @@ int misc_init_r(void)
 	mdelay(10);
 	setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
 
+	if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+					  mac_addr, EFUSE_MAC_SIZE);
+		if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+			eth_setenv_enetaddr("ethaddr", mac_addr);
+	}
+
 	return 0;
 }
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-19  3:59     ` Simon Glass
  -1 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: u-boot

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> ---
>  arch/arm/cpu/armv8/fwcall.c   | 16 ++++++++++++++++
>  arch/arm/include/asm/psci.h   | 17 ++++++++++++++++-
>  arch/arm/include/asm/system.h |  2 ++
>  3 files changed, 34 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8
@ 2016-05-19  3:59     ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: linus-amlogic

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> ---
>  arch/arm/cpu/armv8/fwcall.c   | 16 ++++++++++++++++
>  arch/arm/include/asm/psci.h   | 17 ++++++++++++++++-
>  arch/arm/include/asm/system.h |  2 ++
>  3 files changed, 34 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-19  3:59     ` Simon Glass
  -1 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: u-boot

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> All members of the DMA descriptor must be 32-bit, even on 64-bit
> architectures: change the type to u32 to ensure this. Also, fix
> other warnings.
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>  drivers/net/designware.c | 59 ++++++++++++++++++++++++++----------------------
>  drivers/net/designware.h |  4 ++--
>  2 files changed, 34 insertions(+), 29 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
@ 2016-05-19  3:59     ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: linus-amlogic

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> All members of the DMA descriptor must be 32-bit, even on 64-bit
> architectures: change the type to u32 to ensure this. Also, fix
> other warnings.
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>  drivers/net/designware.c | 59 ++++++++++++++++++++++++++----------------------
>  drivers/net/designware.h |  4 ++--
>  2 files changed, 34 insertions(+), 29 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-19  3:59     ` Simon Glass
  -1 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: u-boot

Hi Benjamino,

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
>
> [1] https://patchwork.ozlabs.org/patch/603583/
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/Kconfig                       |   9 ++
>  arch/arm/Makefile                      |   1 +
>  arch/arm/dts/Makefile                  |   2 +
>  arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
>  arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
>  arch/arm/mach-meson/Kconfig            |  31 ++++++
>  arch/arm/mach-meson/Makefile           |   7 ++
>  arch/arm/mach-meson/board.c            |  66 ++++++++++++
>  board/hardkernel/odroid-c2/Kconfig     |  12 +++
>  board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
>  board/hardkernel/odroid-c2/Makefile    |   7 ++
>  board/hardkernel/odroid-c2/README      |  60 +++++++++++
>  board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++
>  configs/odroid-c2_defconfig            |  23 +++++
>  drivers/serial/Kconfig                 |  15 +++
>  drivers/serial/Makefile                |   1 +
>  drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
>  include/configs/odroid-c2.h            |  51 ++++++++++
>  19 files changed, 803 insertions(+)
>  create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
>  create mode 100644 arch/arm/dts/meson-gxbb.dtsi
>  create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
>  create mode 100644 arch/arm/mach-meson/Kconfig
>  create mode 100644 arch/arm/mach-meson/Makefile
>  create mode 100644 arch/arm/mach-meson/board.c
>  create mode 100644 board/hardkernel/odroid-c2/Kconfig
>  create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
>  create mode 100644 board/hardkernel/odroid-c2/Makefile
>  create mode 100644 board/hardkernel/odroid-c2/README
>  create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
>  create mode 100644 configs/odroid-c2_defconfig
>  create mode 100644 drivers/serial/serial_meson.c
>  create mode 100644 include/configs/odroid-c2.h

One point that I may have already asked...can the Ethernet use
CONFIG_DM_ETH (i.e. driver mode), perhaps in a follow-on patch?

Regards,
Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
@ 2016-05-19  3:59     ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2016-05-19  3:59 UTC (permalink / raw)
  To: linus-amlogic

Hi Benjamino,

On 8 May 2016 at 00:30, Beniamino Galvani <b.galvani@gmail.com> wrote:
> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
>
> [1] https://patchwork.ozlabs.org/patch/603583/
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/Kconfig                       |   9 ++
>  arch/arm/Makefile                      |   1 +
>  arch/arm/dts/Makefile                  |   2 +
>  arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
>  arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
>  arch/arm/mach-meson/Kconfig            |  31 ++++++
>  arch/arm/mach-meson/Makefile           |   7 ++
>  arch/arm/mach-meson/board.c            |  66 ++++++++++++
>  board/hardkernel/odroid-c2/Kconfig     |  12 +++
>  board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
>  board/hardkernel/odroid-c2/Makefile    |   7 ++
>  board/hardkernel/odroid-c2/README      |  60 +++++++++++
>  board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++
>  configs/odroid-c2_defconfig            |  23 +++++
>  drivers/serial/Kconfig                 |  15 +++
>  drivers/serial/Makefile                |   1 +
>  drivers/serial/serial_meson.c          | 162 ++++++++++++++++++++++++++++++
>  include/configs/odroid-c2.h            |  51 ++++++++++
>  19 files changed, 803 insertions(+)
>  create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
>  create mode 100644 arch/arm/dts/meson-gxbb.dtsi
>  create mode 100644 arch/arm/include/asm/arch-meson/gxbb.h
>  create mode 100644 arch/arm/mach-meson/Kconfig
>  create mode 100644 arch/arm/mach-meson/Makefile
>  create mode 100644 arch/arm/mach-meson/board.c
>  create mode 100644 board/hardkernel/odroid-c2/Kconfig
>  create mode 100644 board/hardkernel/odroid-c2/MAINTAINERS
>  create mode 100644 board/hardkernel/odroid-c2/Makefile
>  create mode 100644 board/hardkernel/odroid-c2/README
>  create mode 100644 board/hardkernel/odroid-c2/odroid-c2.c
>  create mode 100644 configs/odroid-c2_defconfig
>  create mode 100644 drivers/serial/serial_meson.c
>  create mode 100644 include/configs/odroid-c2.h

One point that I may have already asked...can the Ethernet use
CONFIG_DM_ETH (i.e. driver mode), perhaps in a follow-on patch?

Regards,
Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-20 14:44     ` Carlo Caione
  -1 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-05-20 14:44 UTC (permalink / raw)
  To: u-boot

On 08/05/16 08:30, Beniamino Galvani wrote:
> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
> 
> [1] https://patchwork.ozlabs.org/patch/603583/
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/Kconfig                       |   9 ++
>  arch/arm/Makefile                      |   1 +
>  arch/arm/dts/Makefile                  |   2 +
>  arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
>  arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
>  arch/arm/mach-meson/Kconfig            |  31 ++++++
>  arch/arm/mach-meson/Makefile           |   7 ++
>  arch/arm/mach-meson/board.c            |  66 ++++++++++++
>  board/hardkernel/odroid-c2/Kconfig     |  12 +++
>  board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
>  board/hardkernel/odroid-c2/Makefile    |   7 ++
>  board/hardkernel/odroid-c2/README      |  60 +++++++++++
>  board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++

I suggest to have s/hardkernel/amlogic/ so that we can have all the
amlogic boards in the same place.

Also I wonder if it's worth to have one single board file board.c so to
avoid duplicating code among the boards, especially now that the DT
support is still incomplete. 

Cheers,

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
@ 2016-05-20 14:44     ` Carlo Caione
  0 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-05-20 14:44 UTC (permalink / raw)
  To: linus-amlogic

On 08/05/16 08:30, Beniamino Galvani wrote:
> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
> 
> [1] https://patchwork.ozlabs.org/patch/603583/
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/Kconfig                       |   9 ++
>  arch/arm/Makefile                      |   1 +
>  arch/arm/dts/Makefile                  |   2 +
>  arch/arm/dts/meson-gxbb-odroidc2.dts   |  69 +++++++++++++
>  arch/arm/dts/meson-gxbb.dtsi           | 178 +++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-meson/gxbb.h |  52 ++++++++++
>  arch/arm/mach-meson/Kconfig            |  31 ++++++
>  arch/arm/mach-meson/Makefile           |   7 ++
>  arch/arm/mach-meson/board.c            |  66 ++++++++++++
>  board/hardkernel/odroid-c2/Kconfig     |  12 +++
>  board/hardkernel/odroid-c2/MAINTAINERS |   6 ++
>  board/hardkernel/odroid-c2/Makefile    |   7 ++
>  board/hardkernel/odroid-c2/README      |  60 +++++++++++
>  board/hardkernel/odroid-c2/odroid-c2.c |  51 ++++++++++

I suggest to have s/hardkernel/amlogic/ so that we can have all the
amlogic boards in the same place.

Also I wonder if it's worth to have one single board file board.c so to
avoid duplicating code among the boards, especially now that the DT
support is still incomplete. 

Cheers,

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-05-29 16:38   ` Carlo Caione
  -1 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-05-29 16:38 UTC (permalink / raw)
  To: u-boot

On 08/05/16 08:30, Beniamino Galvani wrote:
> Hi,
> 
> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> and for the ODROID-C2 board [1], and is based on u-boot sources
> available from the board vendor [2]. At the moment the only supported
> devices are the integrated UART and Ethernet adapter.

Hey guys,
what's left for this patchset to be merged?

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-05-29 16:38   ` Carlo Caione
  0 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-05-29 16:38 UTC (permalink / raw)
  To: linus-amlogic

On 08/05/16 08:30, Beniamino Galvani wrote:
> Hi,
> 
> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> and for the ODROID-C2 board [1], and is based on u-boot sources
> available from the board vendor [2]. At the moment the only supported
> devices are the integrated UART and Ethernet adapter.

Hey guys,
what's left for this patchset to be merged?

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-05-29 16:38   ` Carlo Caione
@ 2016-05-29 17:09     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-29 17:09 UTC (permalink / raw)
  To: u-boot

On Sun, May 29, 2016 at 06:38:14PM +0200, Carlo Caione wrote:
> On 08/05/16 08:30, Beniamino Galvani wrote:
> > Hi,
> > 
> > this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> > and for the ODROID-C2 board [1], and is based on u-boot sources
> > available from the board vendor [2]. At the moment the only supported
> > devices are the integrated UART and Ethernet adapter.
> 
> Hey guys,
> what's left for this patchset to be merged?

Good timing.  I've got this locally and just need to finish my unit
tests before I can merge.  But, due to the DM PR I've had to disable eth
as you'll need to address GPIO for this platform next.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160529/af097ebe/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-05-29 17:09     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-29 17:09 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 29, 2016 at 06:38:14PM +0200, Carlo Caione wrote:
> On 08/05/16 08:30, Beniamino Galvani wrote:
> > Hi,
> > 
> > this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> > and for the ODROID-C2 board [1], and is based on u-boot sources
> > available from the board vendor [2]. At the moment the only supported
> > devices are the integrated UART and Ethernet adapter.
> 
> Hey guys,
> what's left for this patchset to be merged?

Good timing.  I've got this locally and just need to finish my unit
tests before I can merge.  But, due to the DM PR I've had to disable eth
as you'll need to address GPIO for this platform next.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160529/af097ebe/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [U-Boot, v7, 1/4] arm: implement generic PSCI reset call for armv8
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-30 17:57     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: u-boot

On Sun, May 08, 2016 at 08:30:14AM +0200, Beniamino Galvani wrote:

> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/4de241c3/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot,v7,1/4] arm: implement generic PSCI reset call for armv8
@ 2016-05-30 17:57     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 08, 2016 at 08:30:14AM +0200, Beniamino Galvani wrote:

> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160530/4de241c3/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [U-Boot, v7, 1/4] arm: implement generic PSCI reset call for armv8
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-30 17:57     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: u-boot

On Sun, May 08, 2016 at 08:30:14AM +0200, Beniamino Galvani wrote:

> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/0aaa3a64/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot,v7,1/4] arm: implement generic PSCI reset call for armv8
@ 2016-05-30 17:57     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 08, 2016 at 08:30:14AM +0200, Beniamino Galvani wrote:

> Add a psci_system_reset() which calls the SYSTEM_RESET function of
> PSCI 0.2 and can be used by boards that support it to implement
> reset_cpu().
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160530/0aaa3a64/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [U-Boot, v7, 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-30 17:57     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: u-boot

On Sun, May 08, 2016 at 08:30:15AM +0200, Beniamino Galvani wrote:

> All members of the DMA descriptor must be 32-bit, even on 64-bit
> architectures: change the type to u32 to ensure this. Also, fix
> other warnings.
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/e62f03bf/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot, v7, 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
@ 2016-05-30 17:57     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 08, 2016 at 08:30:15AM +0200, Beniamino Galvani wrote:

> All members of the DMA descriptor must be 32-bit, even on 64-bit
> architectures: change the type to u32 to ensure this. Also, fix
> other warnings.
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160530/e62f03bf/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [U-Boot, v7, 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-30 17:57     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: u-boot

On Sun, May 08, 2016 at 08:30:16AM +0200, Beniamino Galvani wrote:

> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
> 
> [1] https://patchwork.ozlabs.org/patch/603583/
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/707978c0/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot, v7, 3/4] arm: add initial support for Amlogic Meson and ODROID-C2
@ 2016-05-30 17:57     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 08, 2016 at 08:30:16AM +0200, Beniamino Galvani wrote:

> This adds platform code for the Amlogic Meson GXBaby (S905) SoC and a
> board definition for ODROID-C2. This initial submission only supports
> UART and Ethernet (through the existing Designware driver). DTS files
> are the ones submitted to Linux arm-soc for 4.7 [1].
> 
> [1] https://patchwork.ozlabs.org/patch/603583/
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160530/707978c0/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [U-Boot, v7, 4/4] arm: meson: implement calls to secure monitor
  2016-05-08  6:30   ` Beniamino Galvani
@ 2016-05-30 17:57     ` Tom Rini
  -1 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: u-boot

On Sun, May 08, 2016 at 08:30:17AM +0200, Beniamino Galvani wrote:

> Implement calls to secure monitor to read the MAC address from e-fuse.
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/c88cc854/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot,v7,4/4] arm: meson: implement calls to secure monitor
@ 2016-05-30 17:57     ` Tom Rini
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Rini @ 2016-05-30 17:57 UTC (permalink / raw)
  To: linus-amlogic

On Sun, May 08, 2016 at 08:30:17AM +0200, Beniamino Galvani wrote:

> Implement calls to secure monitor to read the MAC address from e-fuse.
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160530/c88cc854/attachment.sig>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-05-08  6:30 ` Beniamino Galvani
@ 2016-07-11  3:57   ` Andreas Färber
  -1 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11  3:57 UTC (permalink / raw)
  To: u-boot

Hi,

Am 08.05.2016 um 08:30 schrieb Beniamino Galvani:
> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> and for the ODROID-C2 board [1], and is based on u-boot sources
> available from the board vendor [2]. At the moment the only supported
> devices are the integrated UART and Ethernet adapter.

On current master with these four patches merged, should I expect to see
any output after BL31? o.O

Note that the README is outdated in that Hardkernel now has sources for
fip_create and no binary any more. I've verified that the behavior is
the same when using the binary and the self-compiled tool. Last output:

NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9

I.e., no U-Boot SPL output on serial.

Regards,
Andreas

P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
about --bl30 and --bl301 btw, anyone any insights?

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11  3:57   ` Andreas Färber
  0 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11  3:57 UTC (permalink / raw)
  To: linus-amlogic

Hi,

Am 08.05.2016 um 08:30 schrieb Beniamino Galvani:
> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
> and for the ODROID-C2 board [1], and is based on u-boot sources
> available from the board vendor [2]. At the moment the only supported
> devices are the integrated UART and Ethernet adapter.

On current master with these four patches merged, should I expect to see
any output after BL31? o.O

Note that the README is outdated in that Hardkernel now has sources for
fip_create and no binary any more. I've verified that the behavior is
the same when using the binary and the self-compiled tool. Last output:

NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9

I.e., no U-Boot SPL output on serial.

Regards,
Andreas

P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
about --bl30 and --bl301 btw, anyone any insights?

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11  3:57   ` Andreas Färber
@ 2016-07-11  4:23     ` Peter Robinson
  -1 siblings, 0 replies; 52+ messages in thread
From: Peter Robinson @ 2016-07-11  4:23 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
> Hi,
>
> Am 08.05.2016 um 08:30 schrieb Beniamino Galvani:
>> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
>> and for the ODROID-C2 board [1], and is based on u-boot sources
>> available from the board vendor [2]. At the moment the only supported
>> devices are the integrated UART and Ethernet adapter.
>
> On current master with these four patches merged, should I expect to see
> any output after BL31? o.O
>
> Note that the README is outdated in that Hardkernel now has sources for
> fip_create and no binary any more. I've verified that the behavior is
> the same when using the binary and the self-compiled tool. Last output:
>
> NOTICE:  BL3-1: v1.0(debug):4d2e34d
> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> INFO:    BL3-1: Initializing runtime services
> INFO:    BL3-1: Preparing for EL3 exit to normal world
> INFO:    BL3-1: Next image address = 0x1000000
> INFO:    BL3-1: Next image spsr = 0x3c9
>
> I.e., no U-Boot SPL output on serial.

I see similar on Pine64 with 2016.07rc3

> P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
> about --bl30 and --bl301 btw, anyone any insights?

If you find details on the upstream ATF support I'd love a link for more details

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11  4:23     ` Peter Robinson
  0 siblings, 0 replies; 52+ messages in thread
From: Peter Robinson @ 2016-07-11  4:23 UTC (permalink / raw)
  To: linus-amlogic

On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
> Hi,
>
> Am 08.05.2016 um 08:30 schrieb Beniamino Galvani:
>> this series adds a very basic support for Amlogic S905 SoC (GXBaby)
>> and for the ODROID-C2 board [1], and is based on u-boot sources
>> available from the board vendor [2]. At the moment the only supported
>> devices are the integrated UART and Ethernet adapter.
>
> On current master with these four patches merged, should I expect to see
> any output after BL31? o.O
>
> Note that the README is outdated in that Hardkernel now has sources for
> fip_create and no binary any more. I've verified that the behavior is
> the same when using the binary and the self-compiled tool. Last output:
>
> NOTICE:  BL3-1: v1.0(debug):4d2e34d
> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> INFO:    BL3-1: Initializing runtime services
> INFO:    BL3-1: Preparing for EL3 exit to normal world
> INFO:    BL3-1: Next image address = 0x1000000
> INFO:    BL3-1: Next image spsr = 0x3c9
>
> I.e., no U-Boot SPL output on serial.

I see similar on Pine64 with 2016.07rc3

> P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
> about --bl30 and --bl301 btw, anyone any insights?

If you find details on the upstream ATF support I'd love a link for more details

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11  4:23     ` Peter Robinson
@ 2016-07-11  4:41       ` Andreas Färber
  -1 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11  4:41 UTC (permalink / raw)
  To: u-boot

Am 11.07.2016 um 06:23 schrieb Peter Robinson:
> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>> P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
>> about --bl30 and --bl301 btw, anyone any insights?
> 
> If you find details on the upstream ATF support I'd love a link for more details

https://github.com/ARM-software/arm-trusted-firmware/tree/master/tools/fip_create

I found a commit renaming BL3-0 to SCP_BL2, but no mention of BL3-0-1
beyond Hardkernel and this patchset.

https://github.com/ARM-software/arm-trusted-firmware/commit/f59821d51255f14e0ac00eef7bc98ef75c686876

$ make -C u-boot-hardkernel fip_create
$ ./u-boot-hardkernel/tools/fip_create/fip_create --dump fip.bin
Firmware Image Package ToC:
---------------------------
- SCP Firmware BL3-0: offset=0x4000, size=0x9E88
- SCP Firmware BL3-0-1: offset=0x10000, size=0x1758
- EL3 Runtime Firmware BL3-1: offset=0x14000, size=0x110D0
- Non-Trusted Firmware BL3-3: offset=0x28000, size=0x36AF6
---------------------------

$ make -C arm-trusted-firmware fiptool
$ ./arm-trusted-firmware/tools/fip_create/fip_create --dump fip.bin
Firmware Image Package ToC:
---------------------------
- SCP Firmware SCP_BL2: offset=0xD8, size=0x9E88
- Unknown entry: offset=0x9F60, size=0x1758
- EL3 Runtime Firmware BL31: offset=0xB6B8, size=0x110D0
- Non-Trusted Firmware BL33: offset=0x1C788, size=0x36AF6
---------------------------

Note that the offsets for BL30[1] are shown differently.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11  4:41       ` Andreas Färber
  0 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11  4:41 UTC (permalink / raw)
  To: linus-amlogic

Am 11.07.2016 um 06:23 schrieb Peter Robinson:
> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>> P.S. The upstream arm-trusted-firmware fip_create tool doesn't know
>> about --bl30 and --bl301 btw, anyone any insights?
> 
> If you find details on the upstream ATF support I'd love a link for more details

https://github.com/ARM-software/arm-trusted-firmware/tree/master/tools/fip_create

I found a commit renaming BL3-0 to SCP_BL2, but no mention of BL3-0-1
beyond Hardkernel and this patchset.

https://github.com/ARM-software/arm-trusted-firmware/commit/f59821d51255f14e0ac00eef7bc98ef75c686876

$ make -C u-boot-hardkernel fip_create
$ ./u-boot-hardkernel/tools/fip_create/fip_create --dump fip.bin
Firmware Image Package ToC:
---------------------------
- SCP Firmware BL3-0: offset=0x4000, size=0x9E88
- SCP Firmware BL3-0-1: offset=0x10000, size=0x1758
- EL3 Runtime Firmware BL3-1: offset=0x14000, size=0x110D0
- Non-Trusted Firmware BL3-3: offset=0x28000, size=0x36AF6
---------------------------

$ make -C arm-trusted-firmware fiptool
$ ./arm-trusted-firmware/tools/fip_create/fip_create --dump fip.bin
Firmware Image Package ToC:
---------------------------
- SCP Firmware SCP_BL2: offset=0xD8, size=0x9E88
- Unknown entry: offset=0x9F60, size=0x1758
- EL3 Runtime Firmware BL31: offset=0xB6B8, size=0x110D0
- Non-Trusted Firmware BL33: offset=0x1C788, size=0x36AF6
---------------------------

Note that the offsets for BL30[1] are shown differently.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11  4:23     ` Peter Robinson
@ 2016-07-11 19:48       ` Beniamino Galvani
  -1 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-07-11 19:48 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:

> > Last output:
> >
> > NOTICE:  BL3-1: v1.0(debug):4d2e34d
> > NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> > INFO:    BL3-1: Initializing runtime services
> > INFO:    BL3-1: Preparing for EL3 exit to normal world
> > INFO:    BL3-1: Next image address = 0x1000000
> > INFO:    BL3-1: Next image spsr = 0x3c9
> >
> > I.e., no U-Boot SPL output on serial.
> 
> I see similar on Pine64 with 2016.07rc3

Here the first non-booting commit is:

commit d73718f3236c520a92efa401084c658e6cc067f3
Author: Mingkai Hu <mingkai.hu@nxp.com>
Date:   Thu Jul 7 12:22:12 2016 +0800

    armv8: Enable CPUECTLR.SMPEN for coherency


Mingkai, any ideas about how to debug or fix this?

Beniamino

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 19:48       ` Beniamino Galvani
  0 siblings, 0 replies; 52+ messages in thread
From: Beniamino Galvani @ 2016-07-11 19:48 UTC (permalink / raw)
  To: linus-amlogic

On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:

> > Last output:
> >
> > NOTICE:  BL3-1: v1.0(debug):4d2e34d
> > NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> > INFO:    BL3-1: Initializing runtime services
> > INFO:    BL3-1: Preparing for EL3 exit to normal world
> > INFO:    BL3-1: Next image address = 0x1000000
> > INFO:    BL3-1: Next image spsr = 0x3c9
> >
> > I.e., no U-Boot SPL output on serial.
> 
> I see similar on Pine64 with 2016.07rc3

Here the first non-booting commit is:

commit d73718f3236c520a92efa401084c658e6cc067f3
Author: Mingkai Hu <mingkai.hu@nxp.com>
Date:   Thu Jul 7 12:22:12 2016 +0800

    armv8: Enable CPUECTLR.SMPEN for coherency


Mingkai, any ideas about how to debug or fix this?

Beniamino

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 19:48       ` Beniamino Galvani
@ 2016-07-11 20:15         ` Andreas Färber
  -1 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 20:15 UTC (permalink / raw)
  To: u-boot

Am 11.07.2016 um 21:48 schrieb Beniamino Galvani:
> On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
>> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>>> Last output:
>>>
>>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>>> INFO:    BL3-1: Initializing runtime services
>>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>>> INFO:    BL3-1: Next image address = 0x1000000
>>> INFO:    BL3-1: Next image spsr = 0x3c9
>>>
>>> I.e., no U-Boot SPL output on serial.
>>
>> I see similar on Pine64 with 2016.07rc3
> 
> Here the first non-booting commit is:
> 
> commit d73718f3236c520a92efa401084c658e6cc067f3
> Author: Mingkai Hu <mingkai.hu@nxp.com>
> Date:   Thu Jul 7 12:22:12 2016 +0800
> 
>     armv8: Enable CPUECTLR.SMPEN for coherency

Thanks! With that reverted I get:

[...]
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9
No match for driver 'eth_designware'
Some drivers were not found


U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2

DRAM:  2 GiB
No maUsing default environment

In:    serial at 4c0
Out:   serial at 4c0
Err:   serial at 4c0
Net:   No ethernet found.
=>

The eth_designware line (twice, if counting "No ma") is due to what Tom
mentioned wrt DM GPIO, I guess.

Shouldn't we get a version line from SPL, too? A serial driver issue?

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 20:15         ` Andreas Färber
  0 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 20:15 UTC (permalink / raw)
  To: linus-amlogic

Am 11.07.2016 um 21:48 schrieb Beniamino Galvani:
> On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
>> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>>> Last output:
>>>
>>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>>> INFO:    BL3-1: Initializing runtime services
>>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>>> INFO:    BL3-1: Next image address = 0x1000000
>>> INFO:    BL3-1: Next image spsr = 0x3c9
>>>
>>> I.e., no U-Boot SPL output on serial.
>>
>> I see similar on Pine64 with 2016.07rc3
> 
> Here the first non-booting commit is:
> 
> commit d73718f3236c520a92efa401084c658e6cc067f3
> Author: Mingkai Hu <mingkai.hu@nxp.com>
> Date:   Thu Jul 7 12:22:12 2016 +0800
> 
>     armv8: Enable CPUECTLR.SMPEN for coherency

Thanks! With that reverted I get:

[...]
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9
No match for driver 'eth_designware'
Some drivers were not found


U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2

DRAM:  2 GiB
No maUsing default environment

In:    serial at 4c0
Out:   serial at 4c0
Err:   serial at 4c0
Net:   No ethernet found.
=>

The eth_designware line (twice, if counting "No ma") is due to what Tom
mentioned wrt DM GPIO, I guess.

Shouldn't we get a version line from SPL, too? A serial driver issue?

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 20:15         ` Andreas Färber
@ 2016-07-11 20:36           ` Carlo Caione
  -1 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 20:36 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 11.07.2016 um 21:48 schrieb Beniamino Galvani:
>> On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
>>> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>>>> Last output:
>>>>
>>>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>>>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>>>> INFO:    BL3-1: Initializing runtime services
>>>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>>>> INFO:    BL3-1: Next image address = 0x1000000
>>>> INFO:    BL3-1: Next image spsr = 0x3c9
>>>>
>>>> I.e., no U-Boot SPL output on serial.
>>>
>>> I see similar on Pine64 with 2016.07rc3
>>
>> Here the first non-booting commit is:
>>
>> commit d73718f3236c520a92efa401084c658e6cc067f3
>> Author: Mingkai Hu <mingkai.hu@nxp.com>
>> Date:   Thu Jul 7 12:22:12 2016 +0800
>>
>>     armv8: Enable CPUECTLR.SMPEN for coherency
>
> Thanks! With that reverted I get:
>
> [...]
> NOTICE:  BL3-1: v1.0(debug):4d2e34d
> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> INFO:    BL3-1: Initializing runtime services
> INFO:    BL3-1: Preparing for EL3 exit to normal world
> INFO:    BL3-1: Next image address = 0x1000000
> INFO:    BL3-1: Next image spsr = 0x3c9
> No match for driver 'eth_designware'
> Some drivers were not found
>
>
> U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2
>
> DRAM:  2 GiB
> No maUsing default environment
>
> In:    serial at 4c0
> Out:   serial at 4c0
> Err:   serial at 4c0
> Net:   No ethernet found.
> =>
>
> The eth_designware line (twice, if counting "No ma") is due to what Tom
> mentioned wrt DM GPIO, I guess.
>
> Shouldn't we get a version line from SPL, too? A serial driver issue?

AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
shipped by amlogic.

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 20:36           ` Carlo Caione
  0 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 20:36 UTC (permalink / raw)
  To: linus-amlogic

On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 11.07.2016 um 21:48 schrieb Beniamino Galvani:
>> On Mon, Jul 11, 2016 at 05:23:15AM +0100, Peter Robinson wrote:
>>> On Mon, Jul 11, 2016 at 4:57 AM, Andreas F?rber <afaerber@suse.de> wrote:
>>>> Last output:
>>>>
>>>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>>>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>>>> INFO:    BL3-1: Initializing runtime services
>>>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>>>> INFO:    BL3-1: Next image address = 0x1000000
>>>> INFO:    BL3-1: Next image spsr = 0x3c9
>>>>
>>>> I.e., no U-Boot SPL output on serial.
>>>
>>> I see similar on Pine64 with 2016.07rc3
>>
>> Here the first non-booting commit is:
>>
>> commit d73718f3236c520a92efa401084c658e6cc067f3
>> Author: Mingkai Hu <mingkai.hu@nxp.com>
>> Date:   Thu Jul 7 12:22:12 2016 +0800
>>
>>     armv8: Enable CPUECTLR.SMPEN for coherency
>
> Thanks! With that reverted I get:
>
> [...]
> NOTICE:  BL3-1: v1.0(debug):4d2e34d
> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
> INFO:    BL3-1: Initializing runtime services
> INFO:    BL3-1: Preparing for EL3 exit to normal world
> INFO:    BL3-1: Next image address = 0x1000000
> INFO:    BL3-1: Next image spsr = 0x3c9
> No match for driver 'eth_designware'
> Some drivers were not found
>
>
> U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2
>
> DRAM:  2 GiB
> No maUsing default environment
>
> In:    serial at 4c0
> Out:   serial at 4c0
> Err:   serial at 4c0
> Net:   No ethernet found.
> =>
>
> The eth_designware line (twice, if counting "No ma") is due to what Tom
> mentioned wrt DM GPIO, I guess.
>
> Shouldn't we get a version line from SPL, too? A serial driver issue?

AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
shipped by amlogic.

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 20:36           ` Carlo Caione
@ 2016-07-11 21:38             ` Andreas Färber
  -1 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 21:38 UTC (permalink / raw)
  To: u-boot

Am 11.07.2016 um 22:36 schrieb Carlo Caione:
> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
>> [...]
>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>> INFO:    BL3-1: Initializing runtime services
>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>> INFO:    BL3-1: Next image address = 0x1000000
>> INFO:    BL3-1: Next image spsr = 0x3c9
>> No match for driver 'eth_designware'
>> Some drivers were not found
>>
>>
>> U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2
>>
>> DRAM:  2 GiB
>> No maUsing default environment
>>
>> In:    serial at 4c0
>> Out:   serial at 4c0
>> Err:   serial at 4c0
>> Net:   No ethernet found.
>> =>
>>
>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>> mentioned wrt DM GPIO, I guess.
>>
>> Shouldn't we get a version line from SPL, too? A serial driver issue?
> 
> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
> shipped by amlogic.

You're right, Hardkernel's version is without SPL, too.

Still I wonder about that "No ma" (after the DRAM line).

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 21:38             ` Andreas Färber
  0 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 21:38 UTC (permalink / raw)
  To: linus-amlogic

Am 11.07.2016 um 22:36 schrieb Carlo Caione:
> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
>> [...]
>> NOTICE:  BL3-1: v1.0(debug):4d2e34d
>> NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
>> INFO:    BL3-1: Initializing runtime services
>> INFO:    BL3-1: Preparing for EL3 exit to normal world
>> INFO:    BL3-1: Next image address = 0x1000000
>> INFO:    BL3-1: Next image spsr = 0x3c9
>> No match for driver 'eth_designware'
>> Some drivers were not found
>>
>>
>> U-Boot 2016.07-00001-g10a9e48 (Jul 11 2016 - 21:58:13 +0200) odroid-c2
>>
>> DRAM:  2 GiB
>> No maUsing default environment
>>
>> In:    serial at 4c0
>> Out:   serial at 4c0
>> Err:   serial at 4c0
>> Net:   No ethernet found.
>> =>
>>
>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>> mentioned wrt DM GPIO, I guess.
>>
>> Shouldn't we get a version line from SPL, too? A serial driver issue?
> 
> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
> shipped by amlogic.

You're right, Hardkernel's version is without SPL, too.

Still I wonder about that "No ma" (after the DRAM line).

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 21:38             ` Andreas Färber
@ 2016-07-11 22:52               ` Carlo Caione
  -1 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 22:52 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:

[...]

>>>
>>> DRAM:  2 GiB
>>> No maUsing default environment
>>>
>>> In:    serial at 4c0
>>> Out:   serial at 4c0
>>> Err:   serial at 4c0
>>> Net:   No ethernet found.
>>> =>
>>>
>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>> mentioned wrt DM GPIO, I guess.
>>>
>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>
>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>> shipped by amlogic.
>
> You're right, Hardkernel's version is without SPL, too.
>
> Still I wonder about that "No ma" (after the DRAM line).

drivers/core/lists.c:                   dm_warn("No match for driver
'%s'\n", entry->name);

:)

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 22:52               ` Carlo Caione
  0 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 22:52 UTC (permalink / raw)
  To: linus-amlogic

On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:

[...]

>>>
>>> DRAM:  2 GiB
>>> No maUsing default environment
>>>
>>> In:    serial at 4c0
>>> Out:   serial at 4c0
>>> Err:   serial at 4c0
>>> Net:   No ethernet found.
>>> =>
>>>
>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>> mentioned wrt DM GPIO, I guess.
>>>
>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>
>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>> shipped by amlogic.
>
> You're right, Hardkernel's version is without SPL, too.
>
> Still I wonder about that "No ma" (after the DRAM line).

drivers/core/lists.c:                   dm_warn("No match for driver
'%s'\n", entry->name);

:)

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 22:52               ` Carlo Caione
@ 2016-07-11 22:54                 ` Andreas Färber
  -1 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 22:54 UTC (permalink / raw)
  To: u-boot

Am 12.07.2016 um 00:52 schrieb Carlo Caione:
> On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
>> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
> 
> [...]
> 
>>>>
>>>> DRAM:  2 GiB
>>>> No maUsing default environment
>>>>
>>>> In:    serial at 4c0
>>>> Out:   serial at 4c0
>>>> Err:   serial at 4c0
>>>> Net:   No ethernet found.
>>>> =>
>>>>
>>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>>> mentioned wrt DM GPIO, I guess.
>>>>
>>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>>
>>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>>> shipped by amlogic.
>>
>> You're right, Hardkernel's version is without SPL, too.
>>
>> Still I wonder about that "No ma" (after the DRAM line).
> 
> drivers/core/lists.c:                   dm_warn("No match for driver
> '%s'\n", entry->name);
> 
> :)

How does that explain the incomplete "No ma"?

Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 22:54                 ` Andreas Färber
  0 siblings, 0 replies; 52+ messages in thread
From: Andreas Färber @ 2016-07-11 22:54 UTC (permalink / raw)
  To: linus-amlogic

Am 12.07.2016 um 00:52 schrieb Carlo Caione:
> On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
>> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
> 
> [...]
> 
>>>>
>>>> DRAM:  2 GiB
>>>> No maUsing default environment
>>>>
>>>> In:    serial at 4c0
>>>> Out:   serial at 4c0
>>>> Err:   serial at 4c0
>>>> Net:   No ethernet found.
>>>> =>
>>>>
>>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>>> mentioned wrt DM GPIO, I guess.
>>>>
>>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>>
>>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>>> shipped by amlogic.
>>
>> You're right, Hardkernel's version is without SPL, too.
>>
>> Still I wonder about that "No ma" (after the DRAM line).
> 
> drivers/core/lists.c:                   dm_warn("No match for driver
> '%s'\n", entry->name);
> 
> :)

How does that explain the incomplete "No ma"?

Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
  2016-07-11 22:54                 ` Andreas Färber
@ 2016-07-11 23:04                   ` Carlo Caione
  -1 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 23:04 UTC (permalink / raw)
  To: u-boot

On Tue, Jul 12, 2016 at 12:54 AM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 12.07.2016 um 00:52 schrieb Carlo Caione:
>> On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
>>> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>>>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
>>
>> [...]
>>
>>>>>
>>>>> DRAM:  2 GiB
>>>>> No maUsing default environment
>>>>>
>>>>> In:    serial at 4c0
>>>>> Out:   serial at 4c0
>>>>> Err:   serial at 4c0
>>>>> Net:   No ethernet found.
>>>>> =>
>>>>>
>>>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>>>> mentioned wrt DM GPIO, I guess.
>>>>>
>>>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>>>
>>>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>>>> shipped by amlogic.
>>>
>>> You're right, Hardkernel's version is without SPL, too.
>>>
>>> Still I wonder about that "No ma" (after the DRAM line).
>>
>> drivers/core/lists.c:                   dm_warn("No match for driver
>> '%s'\n", entry->name);
>>
>> :)
>
> How does that explain the incomplete "No ma"?

The only thing I can think of is a shitty queueing by the UART driver
/ hardware.

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support
@ 2016-07-11 23:04                   ` Carlo Caione
  0 siblings, 0 replies; 52+ messages in thread
From: Carlo Caione @ 2016-07-11 23:04 UTC (permalink / raw)
  To: linus-amlogic

On Tue, Jul 12, 2016 at 12:54 AM, Andreas F?rber <afaerber@suse.de> wrote:
> Am 12.07.2016 um 00:52 schrieb Carlo Caione:
>> On Mon, Jul 11, 2016 at 11:38 PM, Andreas F?rber <afaerber@suse.de> wrote:
>>> Am 11.07.2016 um 22:36 schrieb Carlo Caione:
>>>> On Mon, Jul 11, 2016 at 10:15 PM, Andreas F?rber <afaerber@suse.de> wrote:
>>
>> [...]
>>
>>>>>
>>>>> DRAM:  2 GiB
>>>>> No maUsing default environment
>>>>>
>>>>> In:    serial at 4c0
>>>>> Out:   serial at 4c0
>>>>> Err:   serial at 4c0
>>>>> Net:   No ethernet found.
>>>>> =>
>>>>>
>>>>> The eth_designware line (twice, if counting "No ma") is due to what Tom
>>>>> mentioned wrt DM GPIO, I guess.
>>>>>
>>>>> Shouldn't we get a version line from SPL, too? A serial driver issue?
>>>>
>>>> AFAIKT there is no SPL. U-Boot is loaded by BL3-1 also in the U-Boot
>>>> shipped by amlogic.
>>>
>>> You're right, Hardkernel's version is without SPL, too.
>>>
>>> Still I wonder about that "No ma" (after the DRAM line).
>>
>> drivers/core/lists.c:                   dm_warn("No match for driver
>> '%s'\n", entry->name);
>>
>> :)
>
> How does that explain the incomplete "No ma"?

The only thing I can think of is a shitty queueing by the UART driver
/ hardware.

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2016-07-11 23:04 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-08  6:30 [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-05-08  6:30 ` Beniamino Galvani
2016-05-08  6:30 ` [U-Boot] [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8 Beniamino Galvani
2016-05-08  6:30   ` Beniamino Galvani
2016-05-19  3:59   ` [U-Boot] " Simon Glass
2016-05-19  3:59     ` Simon Glass
2016-05-30 17:57   ` [U-Boot] [U-Boot, v7, " Tom Rini
2016-05-30 17:57     ` [U-Boot,v7,1/4] " Tom Rini
2016-05-30 17:57   ` [U-Boot] [U-Boot, v7, 1/4] " Tom Rini
2016-05-30 17:57     ` [U-Boot,v7,1/4] " Tom Rini
2016-05-08  6:30 ` [U-Boot] [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-05-08  6:30   ` Beniamino Galvani
2016-05-19  3:59   ` [U-Boot] " Simon Glass
2016-05-19  3:59     ` Simon Glass
2016-05-30 17:57   ` [U-Boot] [U-Boot, v7, " Tom Rini
2016-05-30 17:57     ` Tom Rini
2016-05-08  6:30 ` [U-Boot] [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-05-08  6:30   ` Beniamino Galvani
2016-05-19  3:59   ` [U-Boot] " Simon Glass
2016-05-19  3:59     ` Simon Glass
2016-05-20 14:44   ` [U-Boot] " Carlo Caione
2016-05-20 14:44     ` Carlo Caione
2016-05-30 17:57   ` [U-Boot] [U-Boot, v7, " Tom Rini
2016-05-30 17:57     ` Tom Rini
2016-05-08  6:30 ` [U-Boot] [PATCH v7 4/4] arm: meson: implement calls to secure monitor Beniamino Galvani
2016-05-08  6:30   ` Beniamino Galvani
2016-05-30 17:57   ` [U-Boot] [U-Boot, v7, " Tom Rini
2016-05-30 17:57     ` [U-Boot,v7,4/4] " Tom Rini
2016-05-29 16:38 ` [U-Boot] [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support Carlo Caione
2016-05-29 16:38   ` Carlo Caione
2016-05-29 17:09   ` [U-Boot] " Tom Rini
2016-05-29 17:09     ` Tom Rini
2016-07-11  3:57 ` [U-Boot] " Andreas Färber
2016-07-11  3:57   ` Andreas Färber
2016-07-11  4:23   ` Peter Robinson
2016-07-11  4:23     ` Peter Robinson
2016-07-11  4:41     ` Andreas Färber
2016-07-11  4:41       ` Andreas Färber
2016-07-11 19:48     ` Beniamino Galvani
2016-07-11 19:48       ` Beniamino Galvani
2016-07-11 20:15       ` Andreas Färber
2016-07-11 20:15         ` Andreas Färber
2016-07-11 20:36         ` Carlo Caione
2016-07-11 20:36           ` Carlo Caione
2016-07-11 21:38           ` Andreas Färber
2016-07-11 21:38             ` Andreas Färber
2016-07-11 22:52             ` Carlo Caione
2016-07-11 22:52               ` Carlo Caione
2016-07-11 22:54               ` Andreas Färber
2016-07-11 22:54                 ` Andreas Färber
2016-07-11 23:04                 ` Carlo Caione
2016-07-11 23:04                   ` Carlo Caione

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.