Amlogic Meson GXBaby and ODROID-C2 support
v2 cover Amlogic Meson GXBaby and ODROID-C2 support
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 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 (9):
arm: add initial support for Amlogic Meson and ODROID-C2
arm: dts: import Meson files
serial: add support for Amlogic Meson UART
arm: meson: use device tree
board: odroid-c2: enable serial
net: designware: fix descriptor layout and warnings on 64-bit archs
net: designware: add generic device tree compatible id
arm: dts: add ethernet node to Meson gxbb
board: odroid-c2: add Ethernet support
arch/arm/Kconfig | 5 + arch/arm/Makefile | 1 + arch/arm/dts/Makefile | 2 + arch/arm/dts/meson-gxbb-odroidc2.dts | 73 +++++++++++++ arch/arm/dts/meson-gxbb.dtsi | 187 +++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-meson/gxbb.h | 64 +++++++++++ arch/arm/mach-meson/Kconfig | 31 ++++++ arch/arm/mach-meson/Makefile | 7 ++ arch/arm/mach-meson/board.c | 70 ++++++++++++ board/hardkernel/odroid-c2/Kconfig | 12 +++ board/hardkernel/odroid-c2/MAINTAINERS | 6 ++ board/hardkernel/odroid-c2/Makefile | 7 ++ board/hardkernel/odroid-c2/README | 34 ++++++ board/hardkernel/odroid-c2/odroid-c2.c | 32 ++++++ configs/odroid-c2_defconfig | 23 ++++ drivers/net/designware.c | 55 +++++----- drivers/net/designware.h | 4 +- drivers/serial/Kconfig | 14 +++ drivers/serial/Makefile | 1 + drivers/serial/serial_meson.c | 162 ++++++++++++++++++++++++++++ include/configs/odroid-c2.h | 56 ++++++++++ 21 files changed, 817 insertions(+), 29 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/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
Signature · 1 line
2.7.3
PATCH v2 1/9 arm: add initial support for Amlogic Meson and ODROID-C2
Support the Amlogic Meson GXBaby platform.
--- arch/arm/Kconfig | 5 ++++ arch/arm/Makefile | 1 + arch/arm/include/asm/arch-meson/gxbb.h | 10 +++++++ arch/arm/mach-meson/Kconfig | 31 +++++++++++++++++++ arch/arm/mach-meson/Makefile | 7 +++++ arch/arm/mach-meson/board.c | 45 ++++++++++++++++++++++++++++ board/hardkernel/odroid-c2/Kconfig | 12 ++++++++ board/hardkernel/odroid-c2/MAINTAINERS | 6 ++++ board/hardkernel/odroid-c2/Makefile | 7 +++++ board/hardkernel/odroid-c2/README | 34 +++++++++++++++++++++ board/hardkernel/odroid-c2/odroid-c2.c | 7 +++++ configs/odroid-c2_defconfig | 11 +++++++ include/configs/odroid-c2.h | 55 ++++++++++++++++++++++++++++++++++ 13 files changed, 231 insertions(+) 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 include/configs/odroid-c2.h
arch/arm/Kconfig +5 -0
@@ -456,6 +456,9 @@ config ARCH_KEYSTONE select SUPPORT_SPL select CMD_POWEROFF +config ARCH_MESON + bool "Amlogic Meson" + config ARCH_MX7 bool "Freescale MX7" select CPU_V7
@@ -770,6 +773,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"
arch/arm/Makefile +1 -0
@@ -49,6 +49,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
arch/arm/include/asm/arch-meson/gxbb.h new file +10 -0
@@ -0,0 +1,10 @@ +/* +* (C) Copyright 2016 - Beniamino Galvani <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __GXBB_H__ +#define __GXBB_H__ + +#endif /* __GXBB_H__ */
arch/arm/mach-meson/Kconfig new file +31 -0
@@ -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
arch/arm/mach-meson/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright (c) 2016 Beniamino Galvani <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += board.o
arch/arm/mach-meson/board.c new file +45 -0
45 lines not on this page · raw message
board/hardkernel/odroid-c2/Kconfig new file +12 -0
@@ -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
board/hardkernel/odroid-c2/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +ODROID-C2 +M: Beniamino Galvani <[email protected]> +S: Maintained +F: board/hardkernel/odroid-c2/ +F: include/configs/odroid-c2.h +F: configs/odroid-c2_defconfig
board/hardkernel/odroid-c2/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2016 Beniamino Galvani <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := odroid-c2.o
board/hardkernel/odroid-c2/README new file +34 -0
@@ -0,0 +1,34 @@ +* U-Boot for ODROID-C2: quick guide + +** Compile u-boot + + > export ARCH=arm + > export CROSS_COMPILE=aarch64-none-elf- + > make odroid-c2_defconfig + > make + +** Create the image + + > 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 + +** Write u-boot to a SD card + + > 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
board/hardkernel/odroid-c2/odroid-c2.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* (C) Copyright 2016 Beniamino Galvani <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
configs/odroid-c2_defconfig new file +11 -0
@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_MESON=y +CONFIG_MESON_GXBB=y +CONFIG_TARGET_ODROID_C2=y +# 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
include/configs/odroid-c2.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.7.3
PATCH v2 2/9 arm: dts: import Meson files
In reply to Beniamino GalvaniImport device tree files for Meson gxbb and ODROID-C2 from Linux kernel.
--- arch/arm/dts/Makefile | 2 + arch/arm/dts/meson-gxbb-odroidc2.dts | 69 ++++++++++++++ arch/arm/dts/meson-gxbb.dtsi | 178 +++++++++++++++++++++++++++++++++++ 3 files changed, 249 insertions(+) create mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts create mode 100644 arch/arm/dts/meson-gxbb.dtsi
arch/arm/dts/Makefile +2 -0
@@ -24,6 +24,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 \
arch/arm/dts/meson-gxbb-odroidc2.dts new file +69 -0
69 lines not on this page · raw message
arch/arm/dts/meson-gxbb.dtsi new file +178 -0
178 lines not on this page · raw message
Signature · 1 line
2.7.3
PATCH v2 3/9 serial: add support for Amlogic Meson UART
In reply to Beniamino GalvaniImplement a driver for the UART adapter available in Meson SoCs.
--- drivers/serial/Kconfig | 14 ++++ drivers/serial/Makefile | 1 + drivers/serial/serial_meson.c | 162 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 drivers/serial/serial_meson.c
drivers/serial/Kconfig +14 -0
@@ -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,4 +328,10 @@ 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. endmenu
drivers/serial/Makefile +1 -0
@@ -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
drivers/serial/serial_meson.c new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
2.7.3
PATCH v2 4/9 arm: meson: use device tree
In reply to Beniamino GalvaniConvert the board and config files to the use of device tree.
--- arch/arm/mach-meson/board.c | 25 +++++++++++++++++++++++++ configs/odroid-c2_defconfig | 2 ++ 2 files changed, 27 insertions(+)
arch/arm/mach-meson/board.c +25 -0
@@ -5,6 +5,8 @@*/ #include <common.h> +#include <libfdt.h> +#include <linux/err.h> #include <asm/arch/gxbb.h> #include <asm/armv8/mmu.h>
@@ -17,9 +19,32 @@ int board_init(void)int dram_init (void ) { +const fdt32_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) *4 ) +return -EINVAL ; + +/* Don't use fdt64_t to avoid unaligned access */ + gd->ram_size = (uint64_t )fdt32_to_cpu (val[2 ]) <<32 ; + gd->ram_size |=fdt32_to_cpu (val[3 ]); +return 0 ; } +void dram_init_banksize (void ) +{ +/* Reserve first 16 MiB of RAM */ + 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) { }
configs/odroid-c2_defconfig +2 -0
@@ -2,6 +2,7 @@ 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
@@ -9,3 +10,4 @@ CONFIG_TARGET_ODROID_C2=y # CONFIG_CMD_FPGA is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set +CONFIG_OF_CONTROL=y
Signature · 1 line
2.7.3
PATCH v2 5/9 board: odroid-c2: enable serial
In reply to Beniamino GalvaniEnable serial support in the ODROID-C2 configuration.
--- configs/odroid-c2_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/odroid-c2_defconfig +7 -0
@@ -11,3 +11,10 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=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
Signature · 1 line
2.7.3
PATCH v2 6/9 net: designware: fix descriptor layout and warnings on 64-bit archs
In reply to Beniamino GalvaniAll 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.
--- drivers/net/designware.c | 54 ++++++++++++++++++++++++------------------------ drivers/net/designware.h | 4 ++-- 2 files changed, 29 insertions(+), 29 deletions(-)
drivers/net/designware.c +27 -27
@@ -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 );/*
@@ -583,6 +581,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 +600,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;
drivers/net/designware.h +2 -2
@@ -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) ;/*
Signature · 1 line
2.7.3
PATCH v2 7/9 net: designware: add generic device tree compatible id
In reply to Beniamino GalvaniAdd a generic 'snps,dwmac' compatible id to the Synopsys Designware MAC driver.
--- drivers/net/designware.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/designware.c +1 -0
@@ -662,6 +662,7 @@ static int designware_eth_ofdata_to_platdata(struct udevice *dev)static const struct udevice_id designware_eth_ids[] = { { .compatible ="allwinner,sun7i-a20-gmac" }, { .compatible ="altr,socfpga-stmmac" }, + { .compatible ="snps,dwmac" }, { } };
Signature · 1 line
2.7.3
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
In reply to Beniamino GalvaniAdd a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
--- arch/arm/dts/meson-gxbb-odroidc2.dts | 4 ++++ arch/arm/dts/meson-gxbb.dtsi | 9 +++++++++ 2 files changed, 13 insertions(+)
arch/arm/dts/meson-gxbb-odroidc2.dts +4 -0
@@ -67,3 +67,7 @@ &uart_AO { status = "okay"; }; + +&gmac0 { + status = "okay"; +};
arch/arm/dts/meson-gxbb.dtsi +9 -0
@@ -167,6 +167,15 @@ }; }; + gmac0: ethernet at c9410000 { + compatible = "snps,dwmac"; + reg = <0x0 0xc9410000 0x0 0x10000>; + interrupts = <0 8 1>; + interrupt-names = "macirq"; + phy-mode = "rgmii"; + status = "disabled"; + }; + apb: apb at d0000000 { compatible = "simple-bus"; reg = <0x0 0xd0000000 0x0 0x200000>;
Signature · 1 line
2.7.3
PATCH v2 9/9 board: odroid-c2: add Ethernet support
In reply to Beniamino GalvaniAdd initialization code for the Ethernet adapter on ODROID-C2 and enable the driver.
--- arch/arm/include/asm/arch-meson/gxbb.h | 54 ++++++++++++++++++++++++++++++++++ board/hardkernel/odroid-c2/odroid-c2.c | 25 ++++++++++++++++ configs/odroid-c2_defconfig | 3 ++ include/configs/odroid-c2.h | 1 + 4 files changed, 83 insertions(+)
arch/arm/include/asm/arch-meson/gxbb.h +54 -0
@@ -7,4 +7,58 @@#ifndef __GXBB_H__#define __GXBB_H__ +#define GXBB_PERIPHS_BASE 0xc8834400 +#define GXBB_PERIPHS_ADDR (off) (GXBB_PERIPHS_BASE + ((off) << 2)) + +#define GXBB_GPIO_0_EN GXBB_PERIPHS_ADDR(0x0c) +#define GXBB_GPIO_0_OUT GXBB_PERIPHS_ADDR(0x0d) +#define GXBB_GPIO_0_IN GXBB_PERIPHS_ADDR(0x0e) +#define GXBB_GPIO_1_EN GXBB_PERIPHS_ADDR(0x0f) +#define GXBB_GPIO_1_OUT GXBB_PERIPHS_ADDR(0x10) +#define GXBB_GPIO_1_IN GXBB_PERIPHS_ADDR(0x11) +#define GXBB_GPIO_2_EN GXBB_PERIPHS_ADDR(0x12) +#define GXBB_GPIO_2_OUT GXBB_PERIPHS_ADDR(0x13) +#define GXBB_GPIO_2_IN GXBB_PERIPHS_ADDR(0x14) +#define GXBB_GPIO_3_EN GXBB_PERIPHS_ADDR(0x15) +#define GXBB_GPIO_3_OUT GXBB_PERIPHS_ADDR(0x16) +#define GXBB_GPIO_3_IN GXBB_PERIPHS_ADDR(0x17) +#define GXBB_GPIO_4_EN GXBB_PERIPHS_ADDR(0x18) +#define GXBB_GPIO_4_OUT GXBB_PERIPHS_ADDR(0x19) +#define GXBB_GPIO_4_IN GXBB_PERIPHS_ADDR(0x1a) +#define GXBB_GPIO_5_EN GXBB_PERIPHS_ADDR(0x1b) +#define GXBB_GPIO_5_OUT GXBB_PERIPHS_ADDR(0x1c) +#define GXBB_GPIO_5_IN GXBB_PERIPHS_ADDR(0x1d) +#define GXBB_GPIO_6_EN GXBB_PERIPHS_ADDR(0x08) +#define GXBB_GPIO_6_OUT GXBB_PERIPHS_ADDR(0x09) +#define GXBB_GPIO_6_IN GXBB_PERIPHS_ADDR(0x0a) + +#define GXBB_PINMUX_0 GXBB_PERIPHS_ADDR(0x2c) +#define GXBB_PINMUX_1 GXBB_PERIPHS_ADDR(0x2d) +#define GXBB_PINMUX_2 GXBB_PERIPHS_ADDR(0x2e) +#define GXBB_PINMUX_3 GXBB_PERIPHS_ADDR(0x2f) +#define GXBB_PINMUX_4 GXBB_PERIPHS_ADDR(0x30) +#define GXBB_PINMUX_5 GXBB_PERIPHS_ADDR(0x31) +#define GXBB_PINMUX_6 GXBB_PERIPHS_ADDR(0x32) +#define GXBB_PINMUX_7 GXBB_PERIPHS_ADDR(0x33) +#define GXBB_PINMUX_8 GXBB_PERIPHS_ADDR(0x34) +#define GXBB_PINMUX_9 GXBB_PERIPHS_ADDR(0x35) +#define GXBB_PINMUX_10 GXBB_PERIPHS_ADDR(0x36) +#define GXBB_PINMUX_11 GXBB_PERIPHS_ADDR(0x37) +#define GXBB_PINMUX_12 GXBB_PERIPHS_ADDR(0x38) + +#define GXBB_ETH_REG_0 GXBB_PERIPHS_ADDR(0x50) +#define GXBB_ETH_REG_1 GXBB_PERIPHS_ADDR(0x51) + +#define GXBB_HIU_BASE 0xc883c000 +#define GXBB_HIU_ADDR (off) (GXBB_HIU_BASE + ((off) << 2)) + +#define GXBB_MEM_PD_REG_0 GXBB_HIU_ADDR(0x40) + +/* 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) +#endif /* __GXBB_H__ */
board/hardkernel/odroid-c2/odroid-c2.c +25 -0
@@ -5,3 +5,28 @@*/ #include <common.h> +#include <asm/io.h> +#include <asm/arch/gxbb.h> + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +/* Select Ethernet function */ +setbits_le32 (GXBB_PINMUX_6 ,0x3fff ); + +/* Set RGMII mode */ +setbits_le32 (GXBB_ETH_REG_0 ,0x1621 ); + +/* Enable clocks */ +setbits_le32 (GXBB_GCLK_MPEG_1 ,1 <<3 ); +clrbits_le32 (GXBB_MEM_PD_REG_0 , (1 <<3 ) | (1 <<2 )); + +/* Reset PHY on GPIOZ_14 */ +clrbits_le32 (GXBB_GPIO_3_EN ,1 <<14 ); +clrbits_le32 (GXBB_GPIO_3_OUT ,1 <<14 ); +udelay (100000 ); +setbits_le32 (GXBB_GPIO_3_OUT ,1 <<14 ); + +return 0 ; +} +#endif /* CONFIG_MISC_INIT_R */
configs/odroid-c2_defconfig +3 -0
@@ -11,6 +11,9 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # 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
include/configs/odroid-c2.h +1 -0
@@ -19,6 +19,7 @@#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024#define CONFIG_DISPLAY_BOARDINFO +#define CONFIG_MISC_INIT_R #define CONFIG_SYS_SDRAM_BASE 0#define CONFIG_SYS_TEXT_BASE 0x01000000
Signature · 1 line
2.7.3
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
In reply to Beniamino GalvaniQuoted 32 lines · Beniamino Galvani
Add a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>--- arch/arm/dts/meson-gxbb-odroidc2.dts | 4 ++++ arch/arm/dts/meson-gxbb.dtsi | 9 +++++++++ 2 files changed, 13 insertions(+)arch/arm/dts/meson-gxbb-odroidc2.dts +4
-0@@ -67,3 +67,7 @@ &uart_AO { status = "okay"; }; + +&gmac0 { + status = "okay"; +};arch/arm/dts/meson-gxbb.dtsi +2
-0@@ -167,6 +167,15 @@ }; }; + gmac0: ethernet at c9410000 { + compatible = "snps,dwmac";
arch/arm/dts/meson-gxbb.dtsi line 181
Quoted 10 lines
arch/arm/dts/meson-gxbb.dtsi +7
-0+ reg = <0x0 0xc9410000 0x0 0x10000>; + interrupts = <0 8 1>; + interrupt-names = "macirq"; + phy-mode = "rgmii"; + status = "disabled"; + }; + apb: apb at d0000000 { compatible = "simple-bus"; reg = <0x0 0xd0000000 0x0 0x200000>;
Adding this gmac node means that this DTS is already different from the DTS we have in mainline. This makes me wonder how in u-boot we manages the difference in the DT between the kernel and u-boot. Are they supposed to be always in sync or we expect to have two different DTs?
Signature · 1 line
Carlo Caione
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
Quoted 41 lines · Carlo Caione
Quoted 40 lines · Beniamino Galvani
Add a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>--- arch/arm/dts/meson-gxbb-odroidc2.dts | 4 ++++ arch/arm/dts/meson-gxbb.dtsi | 9 +++++++++ 2 files changed, 13 insertions(+)arch/arm/dts/meson-gxbb-odroidc2.dts +4
-0@@ -67,3 +67,7 @@ &uart_AO { status = "okay"; }; + +&gmac0 { + status = "okay"; +};arch/arm/dts/meson-gxbb.dtsi +9
-0@@ -167,6 +167,15 @@ }; }; + gmac0: ethernet at c9410000 { + compatible = "snps,dwmac"; + reg = <0x0 0xc9410000 0x0 0x10000>; + interrupts = <0 8 1>; + interrupt-names = "macirq"; + phy-mode = "rgmii"; + status = "disabled"; + }; + apb: apb at d0000000 {
Quoted 8 lines
arch/arm/dts/meson-gxbb.dtsi line 181
Quoted 2 lines
arch/arm/dts/meson-gxbb.dtsi +0
-0compatible = "simple-bus"; reg = <0x0 0xd0000000 0x0 0x200000>;Adding this gmac node means that this DTS is already different from the DTS we have in mainline. This makes me wonder how in u-boot we manages the difference in the DT between the kernel and u-boot. Are they supposed to be always in sync or we expect to have two different DTs?
The expectation is that we keep them in sync, aside from "u-boot," prefixed items. It's OK to sync with whatever the authorative tree is for a device if it hasn't made it into Linus' tree just yet. New bindings also need to be accepted upstream before we pull them in.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/6a729a61/attachment.sig>
PATCH v2 1/9 arm: add initial support for Amlogic Meson and ODROID-C2
In reply to Beniamino GalvaniQuoted 3 lines · Beniamino Galvani
Support the Amlogic Meson GXBaby platform.
Signed-off-by Beniamino Galvani <[email protected]>
[snip]
Quoted 6 lines
arch/arm/include/asm/arch-meson/gxbb.h new file +0
-0
arch/arm/include/asm/arch-meson/gxbb.h line 10
Quoted 10 lines
arch/arm/include/asm/arch-meson/gxbb.h new file +10
-0@@ -0,0 +1,10 @@ +/* +* (C) Copyright 2016 - Beniamino Galvani <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __GXBB_H__ +#define __GXBB_H__ + +#endif /* __GXBB_H__ */
Why do we need an empty header? Ah, I see later in the series...
Quoted 5 lines
arch/arm/mach-meson/board.c new file +0
-0
[snip]
arch/arm/mach-meson/board.c line 16
Quoted 4 lines
arch/arm/mach-meson/board.c new file +4
-0+int board_init (void ) +{ +return 0 ; +}
This really should go into the board/ board file
Quoted 22 lines
board/hardkernel/odroid-c2/README new file +16
-0@@ -0,0 +1,34 @@ +* U-Boot for ODROID-C2: quick guide + +** Compile u-boot + + > export ARCH=arm + > export CROSS_COMPILE=aarch64-none-elf- + > make odroid-c2_defconfig + > make + +** Create the image + + > 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 \
board/hardkernel/odroid-c2/README line 26
Quoted 10 lines
board/hardkernel/odroid-c2/README new file +10
-0+ --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
Why can't we have these tools in mainline? Yes, the binaries (likely) need to live elsewhere, and we should perhaps give links on how to grab / build the particular supported blobs. See board/hisilicon/hikey/README for an example.
board/hardkernel/odroid-c2/odroid-c2.c line 7
Quoted 13 lines
board/hardkernel/odroid-c2/odroid-c2.c new file +7
-0@@ -0,0 +1,7 @@ +/* +* (C) Copyright 2016 Beniamino Galvani <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
And we shouldn't have an empty file here. I see later on in the series we patch this file which means we should probably be squashing some patches together or reworking things a bit. Also, you set CONFIG_DISPLAY_BOARDINFO but never define checkboard to print out the device we're on, which would be a good thing to populate here.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/2ddf4022/attachment.sig>
PATCH v2 2/9 arm: dts: import Meson files
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Import device tree files for Meson gxbb and ODROID-C2 from Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/430d3ec9/attachment.sig>
PATCH v2 3/9 serial: add support for Amlogic Meson UART
In reply to Beniamino GalvaniQuoted 3 lines · Beniamino Galvani
Implement a driver for the UART adapter available in Meson SoCs.
Signed-off-by Beniamino Galvani <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/74cc2044/attachment.sig>
PATCH v2 4/9 arm: meson: use device tree
In reply to Beniamino GalvaniQuoted 3 lines · Beniamino Galvani
Convert the board and config files to the use of device tree.
Signed-off-by Beniamino Galvani <[email protected]>
Since we're always adding this board with device tree support, this should be folded into the first patch. Along with importing the initial device tree from the kernel (and just say what release / githash it's from). For the contents:
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/46b96c04/attachment.sig>
PATCH v2 6/9 net: designware: fix descriptor layout and warnings on 64-bit archs
In reply to Beniamino GalvaniQuoted 5 lines · Beniamino Galvani
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 <[email protected]>
And I would say this should be patch #1.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/d6e5f2d6/attachment.sig>
PATCH v2 7/9 net: designware: add generic device tree compatible id
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add a generic 'snps,dwmac' compatible id to the Synopsys Designware MAC driver.
Signed-off-by Beniamino Galvani <[email protected]>
... and this should be patch #2.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/eb32b4b9/attachment.sig>
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
In reply to Beniamino GalvaniQuoted 5 lines · Beniamino Galvani
Add a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>
... but why is this not yet in the kernel device tree? Has it just not made it up from the SoC tree?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/c21c2a50/attachment.sig>
PATCH v2 9/9 board: odroid-c2: add Ethernet support
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add initialization code for the Ethernet adapter on ODROID-C2 and enable the driver.
Signed-off-by Beniamino Galvani <[email protected]>
For the contents:
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/a48b758d/attachment.sig>
PATCH v2 5/9 board: odroid-c2: enable serial
In reply to Beniamino GalvaniQuoted 3 lines · Beniamino Galvani
Enable serial support in the ODROID-C2 configuration.
Signed-off-by Beniamino Galvani <[email protected]>
But this too should be folded in with the initial support. In fact, I would go so far as to say that in general, the initial platform patch should be enough to boot the platform. So UART, DDR (and anything that all requires), board itself. If we're not adding a new eth driver, enabling eth is fine too. If that means adding some driver fixes first, make them the first patches in the series. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160403/c1c91e09/attachment.sig>
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
In reply to Tom RiniQuoted 6 lines · Tom Rini
Quoted 3 lines
Add a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
... but why is this not yet in the kernel device tree? Has it just not made it up from the SoC tree?
Because kernel doesn't have yet an Ethernet driver for Meson GXBaby to set the platform-specific registers needed to program the MII mode, clocks and other things (the settings that are in patch 9/9 of this submission). And without documentation it's hard to write one and get it right.
So this patch adds a new uboot-only node to the DTS for Ethernet. This doesn't seem problematic to me WRT synchronization with kernel DTS because no new bindings or driver changes are needed; and whenever the same node will be added to kernel we'll only have to update it in u-boot.
If it is not acceptable to have a DTS different to kernel one, I'll have to find a different solution, any suggestions? Should I use U_BOOT_DEVICE and platform_data inside the board file instead?
Maybe I will submit v3 of the series without Ethernet while I figure out this.
Beniamino
PATCH v2 5/9 board: odroid-c2: enable serial
In reply to Tom RiniQuoted 6 lines · Tom Rini
But this too should be folded in with the initial support. In fact, I would go so far as to say that in general, the initial platform patch should be enough to boot the platform. So UART, DDR (and anything that all requires), board itself. If we're not adding a new eth driver, enabling eth is fine too. If that means adding some driver fixes first, make them the first patches in the series. Thanks!
I'll do, thanks.
Beniamino
PATCH v2 6/9 net: designware: fix descriptor layout and warnings on 64-bit archs
In reply to Beniamino GalvaniQuoted 5 lines · Beniamino Galvani
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 <[email protected]>
PATCH v2 7/9 net: designware: add generic device tree compatible id
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add a generic 'snps,dwmac' compatible id to the Synopsys Designware MAC driver.
Signed-off-by Beniamino Galvani <[email protected]>
PATCH v2 9/9 board: odroid-c2: add Ethernet support
In reply to Beniamino GalvaniQuoted 83 lines · Beniamino Galvani
Add initialization code for the Ethernet adapter on ODROID-C2 and enable the driver.
Signed-off-by Beniamino Galvani <[email protected]>--- arch/arm/include/asm/arch-meson/gxbb.h | 54 ++++++++++++++++++++++++++++++++++ board/hardkernel/odroid-c2/odroid-c2.c | 25 ++++++++++++++++ configs/odroid-c2_defconfig | 3 ++ include/configs/odroid-c2.h | 1 + 4 files changed, 83 insertions(+)arch/arm/include/asm/arch-meson/gxbb.h +54
-0@@ -7,4 +7,58 @@#ifndef __GXBB_H__#define __GXBB_H__ +#define GXBB_PERIPHS_BASE 0xc8834400 +#define GXBB_PERIPHS_ADDR (off) (GXBB_PERIPHS_BASE + ((off) << 2)) + +#define GXBB_GPIO_0_EN GXBB_PERIPHS_ADDR(0x0c) +#define GXBB_GPIO_0_OUT GXBB_PERIPHS_ADDR(0x0d) +#define GXBB_GPIO_0_IN GXBB_PERIPHS_ADDR(0x0e) +#define GXBB_GPIO_1_EN GXBB_PERIPHS_ADDR(0x0f) +#define GXBB_GPIO_1_OUT GXBB_PERIPHS_ADDR(0x10) +#define GXBB_GPIO_1_IN GXBB_PERIPHS_ADDR(0x11) +#define GXBB_GPIO_2_EN GXBB_PERIPHS_ADDR(0x12) +#define GXBB_GPIO_2_OUT GXBB_PERIPHS_ADDR(0x13) +#define GXBB_GPIO_2_IN GXBB_PERIPHS_ADDR(0x14) +#define GXBB_GPIO_3_EN GXBB_PERIPHS_ADDR(0x15) +#define GXBB_GPIO_3_OUT GXBB_PERIPHS_ADDR(0x16) +#define GXBB_GPIO_3_IN GXBB_PERIPHS_ADDR(0x17) +#define GXBB_GPIO_4_EN GXBB_PERIPHS_ADDR(0x18) +#define GXBB_GPIO_4_OUT GXBB_PERIPHS_ADDR(0x19) +#define GXBB_GPIO_4_IN GXBB_PERIPHS_ADDR(0x1a) +#define GXBB_GPIO_5_EN GXBB_PERIPHS_ADDR(0x1b) +#define GXBB_GPIO_5_OUT GXBB_PERIPHS_ADDR(0x1c) +#define GXBB_GPIO_5_IN GXBB_PERIPHS_ADDR(0x1d) +#define GXBB_GPIO_6_EN GXBB_PERIPHS_ADDR(0x08) +#define GXBB_GPIO_6_OUT GXBB_PERIPHS_ADDR(0x09) +#define GXBB_GPIO_6_IN GXBB_PERIPHS_ADDR(0x0a) + +#define GXBB_PINMUX_0 GXBB_PERIPHS_ADDR(0x2c) +#define GXBB_PINMUX_1 GXBB_PERIPHS_ADDR(0x2d) +#define GXBB_PINMUX_2 GXBB_PERIPHS_ADDR(0x2e) +#define GXBB_PINMUX_3 GXBB_PERIPHS_ADDR(0x2f) +#define GXBB_PINMUX_4 GXBB_PERIPHS_ADDR(0x30) +#define GXBB_PINMUX_5 GXBB_PERIPHS_ADDR(0x31) +#define GXBB_PINMUX_6 GXBB_PERIPHS_ADDR(0x32) +#define GXBB_PINMUX_7 GXBB_PERIPHS_ADDR(0x33) +#define GXBB_PINMUX_8 GXBB_PERIPHS_ADDR(0x34) +#define GXBB_PINMUX_9 GXBB_PERIPHS_ADDR(0x35) +#define GXBB_PINMUX_10 GXBB_PERIPHS_ADDR(0x36) +#define GXBB_PINMUX_11 GXBB_PERIPHS_ADDR(0x37) +#define GXBB_PINMUX_12 GXBB_PERIPHS_ADDR(0x38) + +#define GXBB_ETH_REG_0 GXBB_PERIPHS_ADDR(0x50) +#define GXBB_ETH_REG_1 GXBB_PERIPHS_ADDR(0x51) + +#define GXBB_HIU_BASE 0xc883c000 +#define GXBB_HIU_ADDR (off) (GXBB_HIU_BASE + ((off) << 2)) + +#define GXBB_MEM_PD_REG_0 GXBB_HIU_ADDR(0x40) + +/* 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) +#endif /* __GXBB_H__ */ board/hardkernel/odroid-c2/odroid-c2.c +1
-0@@ -5,3 +5,28 @@*/ #include <common.h> +#include <asm/io.h>
board/hardkernel/odroid-c2/odroid-c2.c line 18
Quoted 10 lines
board/hardkernel/odroid-c2/odroid-c2.c +10
-0+#include <asm/arch/gxbb.h> + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +/* Select Ethernet function */ +setbits_le32 (GXBB_PINMUX_6 ,0x3fff ); + +/* Set RGMII mode */ +setbits_le32 (GXBB_ETH_REG_0 ,0x1621 );
It would be good to have constants for all these magic numbers.
board/hardkernel/odroid-c2/odroid-c2.c line 21
Quoted 3 lines
board/hardkernel/odroid-c2/odroid-c2.c +3
-0+ +/* Enable clocks */ +setbits_le32 (GXBB_GCLK_MPEG_1 ,1 <<3 );
Use the BIT() macro for this type of thing. Probably use the BIT() macro in another named macro for the meaning of the magic bit.
Quoted 44 lines
board/hardkernel/odroid-c2/odroid-c2.c +11
-0+clrbits_le32 (GXBB_MEM_PD_REG_0 , (1 <<3 ) | (1 <<2 )); + +/* Reset PHY on GPIOZ_14 */ +clrbits_le32 (GXBB_GPIO_3_EN ,1 <<14 ); +clrbits_le32 (GXBB_GPIO_3_OUT ,1 <<14 ); +udelay (100000 ); +setbits_le32 (GXBB_GPIO_3_OUT ,1 <<14 ); + + return 0; +} +#endif /* CONFIG_MISC_INIT_R */ configs/odroid-c2_defconfig +3
-0@@ -11,6 +11,9 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # 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=0xc81004c0include/configs/odroid-c2.h +1
-1@@ -19,6 +19,7 @@#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024#define CONFIG_DISPLAY_BOARDINFO +#define CONFIG_MISC_INIT_R #define CONFIG_SYS_SDRAM_BASE 0#define CONFIG_SYS_TEXT_BASE 0x01000000 --2.7.3
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v2 8/9 arm: dts: add ethernet node to Meson gxbb
In reply to Beniamino GalvaniQuoted 5 lines · Beniamino Galvani
Quoted 4 lines · Tom Rini
Quoted 3 lines
Add a node for the Synopsys Designware Ethernet adapter available on Meson SoCs to the Meson GXBaby DTS files. The node is not present in DTS files used in Linux kernel.
Quoted 8 lines
Quoted 2 lines
... but why is this not yet in the kernel device tree? Has it just not made it up from the SoC tree?
Because kernel doesn't have yet an Ethernet driver for Meson GXBaby to set the platform-specific registers needed to program the MII mode, clocks and other things (the settings that are in patch 9/9 of this submission). And without documentation it's hard to write one and get it right.
So you're just not submitting the binding for the kernel at this point? If so, yes, sticking with pdata is probably better since when we've been in this situation before the bindings were actively being worked on the kernel side as well and we just resynced when things were finalized.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160404/20bb9613/attachment.sig>
PATCH v2 9/9 board: odroid-c2: add Ethernet support
In reply to Joe HershbergerQuoted 11 lines · Joe Hershberger
board/hardkernel/odroid-c2/odroid-c2.c line 18
Quoted 8 lines
board/hardkernel/odroid-c2/odroid-c2.c +8
-0+#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +/* Select Ethernet function */ +setbits_le32 (GXBB_PINMUX_6 ,0x3fff ); + +/* Set RGMII mode */ +setbits_le32 (GXBB_ETH_REG_0 ,0x1621 );It would be good to have constants for all these magic numbers.
Quoted 6 lines
board/hardkernel/odroid-c2/odroid-c2.c line 21
Quoted 3 lines
board/hardkernel/odroid-c2/odroid-c2.c +3
-0+ +/* Enable clocks */ +setbits_le32 (GXBB_GCLK_MPEG_1 ,1 <<3 );Use the
BIT()macro for this type of thing. Probably use theBIT()macro in another named macro for the meaning of the magic bit.
I updated known values with macros in v3 (but left 0x3fff as is because its meaning is not documented). Thanks!
Beniamino