Message ID | 1449783707-23594-12-git-send-email-mateusz.kulikowski@gmail.com |
---|---|
State | RFC |
Delegated to: | Tom Rini |
Headers | show |
Hi Mateusz, On 10 December 2015 at 14:41, Mateusz Kulikowski <mateusz.kulikowski@gmail.com> wrote: > This commit add support for 96Boards Dragonboard410C. > It is board based on APQ8016 Qualcomm SoC, complying with > 96boards specification. > Features (present out of the box): > - 4x Cortex A53 (ARMv8) > - 2x USB Host port > - 1x USB Device port > - 4x LEDs > - 1x HDMI connector > - 1x uSD connector > - 3x buttons (Power, Vol+, Vol-/Reset) > - WIFI, Bluetooth with integrated antenna > - 8GiB eMMC > > U-Boot boots chained with fastboot in 64-bit mode. > For detailed build instructions see readme.txt in board directory. > > This is code is cleaned-up version of code I did last month > that is already used by some people: > https://github.com/hallor/u-boot > > Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > --- > > arch/arm/dts/Makefile | 2 + > arch/arm/dts/dragonboard410c.dts | 157 +++++++++++++++++++ > arch/arm/mach-snapdragon/Kconfig | 9 ++ > board/qualcomm/dragonboard410c/Kconfig | 15 ++ > board/qualcomm/dragonboard410c/Makefile | 8 + > board/qualcomm/dragonboard410c/dragonboard410c.c | 111 ++++++++++++++ > board/qualcomm/dragonboard410c/head.S | 20 +++ > board/qualcomm/dragonboard410c/readme.txt | 40 +++++ > board/qualcomm/dragonboard410c/u-boot.lds | 90 +++++++++++ > configs/dragonboard410c_defconfig | 29 ++++ > include/configs/dragonboard410c.h | 184 +++++++++++++++++++++++ > 11 files changed, 665 insertions(+) > create mode 100644 arch/arm/dts/dragonboard410c.dts > create mode 100644 board/qualcomm/dragonboard410c/Kconfig > create mode 100644 board/qualcomm/dragonboard410c/Makefile > create mode 100644 board/qualcomm/dragonboard410c/dragonboard410c.c > create mode 100644 board/qualcomm/dragonboard410c/head.S > create mode 100644 board/qualcomm/dragonboard410c/readme.txt > create mode 100644 board/qualcomm/dragonboard410c/u-boot.lds > create mode 100644 configs/dragonboard410c_defconfig > create mode 100644 include/configs/dragonboard410c.h > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > index 521aa4c..1154993 100644 > --- a/arch/arm/dts/Makefile > +++ b/arch/arm/dts/Makefile > @@ -95,6 +95,8 @@ dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \ > dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \ > fsl-ls1043a-rdb.dtb > > +dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb > + > dtb-$(CONFIG_MACH_SUN4I) += \ > sun4i-a10-a1000.dtb \ > sun4i-a10-ba10-tvbox.dtb \ > diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts > new file mode 100644 > index 0000000..04ad9eb > --- /dev/null > +++ b/arch/arm/dts/dragonboard410c.dts > @@ -0,0 +1,157 @@ > +/dts-v1/; > + > +#include "skeleton64.dtsi" > + > +/ { > + model = "Qualcomm Technologies, Inc. Dragonboard 410c"; > + compatible = "qcom,dragonboard", "qcom,apq8016-sbc"; > + qcom,msm-id = <0xce 0x0 0xf8 0x0 0xf9 0x0 0xfa 0x0 0xf7 0x0>; > + qcom,board-id = <0x10018 0x0>; > + #address-cells = <0x2>; > + #size-cells = <0x2>; > + > + memory { > + device_type = "memory"; > + reg = <0 0x80000000 0 0x3da00000>; > + }; > + > + chosen { > + stdout-path = "/soc/serial@78b0000"; > + }; > + > + > + soc { > + #address-cells = <0x1>; > + #size-cells = <0x1>; > + ranges = <0x0 0x0 0x0 0xffffffff>; > + compatible = "simple-bus"; > + > + clkc: qcom,gcc@1800000 { > + compatible = "qcom,gcc-msm8916"; > + reg = <0x1800000 0x80000>; > + #address-cells = <0x1>; > + #size-cells = <0x0>; > + }; > + > + serial@78b0000 { > + compatible = "qcom,msm-uartdm-v1.4"; > + reg = <0x78b0000 0x200>; > + u-boot,dm-pre-reloc; > + clock = <&clkc 4>; > + }; > + > + restart@4ab000 { > + compatible = "qcom,pshold"; > + reg = <0x4ab000 0x4>; > + }; > + > + soc_gpios: pinctrl@1000000 { > + compatible = "qcom,msm8916-pinctrl"; > + reg = <0x1000000 0x300000>; > + gpio-controller; > + gpio-count = <122>; > + gpio-bank-name="soc"; > + #gpio-cells = <1>; > + }; > + > + ehci@78d9000 { > + compatible = "qcom,ehci-host"; > + reg = <0x78d9000 0x400>; > + }; > + > + sdhci@07824000 { > + compatible = "qcom,sdhci-msm-v4"; > + reg = <0x7824900 0x11c 0x7824000 0x800>; > + bus-width = <0x8>; > + index = <0x0>; > + non-removable; > + clock = <&clkc 0>; > + clock-frequency = <100000000>; > + }; > + > + sdhci@07864000 { > + compatible = "qcom,sdhci-msm-v4"; > + reg = <0x7864900 0x11c 0x7864000 0x800>; > + index = <0x1>; > + bus-width = <0x4>; > + clock = <&clkc 1>; > + clock-frequency = <200000000>; > + }; > + > + spmi@200f000 { > + compatible = "qcom,spmi-pmic-arb"; > + reg = <0x200f000 0x1000 0x2400000 0x400000 0x2c00000 0x400000 0x3800000 0x200000 0x200a000 0x2100>; > + reg-names = "core", "chnls", "obsrvr", "intr", "cnfg"; > + #address-cells = <0x1>; > + #size-cells = <0x1>; > + pm8916@0 { > + compatible = "qcom,spmi-pmic"; > + reg = <0x0 0x2>; > + #address-cells = <0x1>; > + #size-cells = <0x1>; > + > + pmic_pon: pon@800 { > + compatible = "qcom,pm8916-pwrkey"; > + reg = <0x800 0x96>; > + #gpio-cells = <2>; > + gpio-controller; > + }; > + > + pmic_gpios: gpios@c000 { > + compatible = "qcom,pm8916-gpio"; > + reg = <0xc000 0x400>; > + gpio-controller; > + gpio-count = <4>; > + #gpio-cells = <2>; > + gpio-bank-name="pmic"; > + }; > + }; > + > + pm8916@1 { > + compatible = "qcom,spmi-pmic"; > + reg = <0x1>; > + #address-cells = <0x1>; > + #size-cells = <0x0>; > + }; > + }; > + }; > + > + leds { > + compatible = "gpio-leds"; > + user1 { > + label = "green:user1"; > + gpios = <&soc_gpios 21 0>; > + }; > + > + user2 { > + label = "green:user2"; > + gpios = <&soc_gpios 120 0>; > + }; > + > + user3 { > + label = "green:user3"; > + gpios = <&pmic_gpios 0 0>; > + }; > + > + user4 { > + label = "green:user4"; > + gpios = <&pmic_gpios 1 0>; > + }; > + }; > + > + usb_hub_reset_n_pm { > + gpios = <&pmic_gpios 2 0>; > + }; > + > + usb_sw_sel_pm { > + gpios = <&pmic_gpios 3 0>; > + }; > + > + key_vol_down { > + gpios = <&pmic_pon 1 0>; > + }; > + > + key_power { > + gpios = <&pmic_pon 0 0>; > + }; > +}; > diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig > index 156e733..61e0e9e 100644 > --- a/arch/arm/mach-snapdragon/Kconfig > +++ b/arch/arm/mach-snapdragon/Kconfig > @@ -3,4 +3,13 @@ if ARCH_SNAPDRAGON > config SYS_SOC > default "snapdragon" > > +choice > + prompt "Snapdragon board select" > + > +config TARGET_DRAGONBOARD410C > + bool "96Boards Dragonboard 410C" help Rough description of the board and its peripherals. Should be 3-4 lines. > +endchoice > + > +source "board/qualcomm/dragonboard410c/Kconfig" > + > endif > diff --git a/board/qualcomm/dragonboard410c/Kconfig b/board/qualcomm/dragonboard410c/Kconfig > new file mode 100644 > index 0000000..03bd7ae > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/Kconfig > @@ -0,0 +1,15 @@ > +if TARGET_DRAGONBOARD410C > + > +config SYS_BOARD > + default "dragonboard410c" > + > +config SYS_VENDOR > + default "qualcomm" > + > +config SYS_SOC > + default "apq8016" > + > +config SYS_CONFIG_NAME > + default "dragonboard410c" > + > +endif > diff --git a/board/qualcomm/dragonboard410c/Makefile b/board/qualcomm/dragonboard410c/Makefile > new file mode 100644 > index 0000000..cd67808 > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/Makefile > @@ -0,0 +1,8 @@ > +# > +# (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > +# > +# SPDX-License-Identifier: GPL-2.0+ > +# > + > +obj-y := dragonboard410c.o > +extra-y += head.o > diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c > new file mode 100644 > index 0000000..7057a2c > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c > @@ -0,0 +1,111 @@ > +/* > + * Board init file for Dragonboard 410C > + * > + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > + > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include <common.h> > +#include <dm.h> > +#include <usb.h> > +#include <asm/gpio.h> > + > +DECLARE_GLOBAL_DATA_PTR; > + > +int dram_init(void) > +{ > + gd->ram_size = PHYS_SDRAM_1_SIZE; > + return 0; > +} > + > +void dram_init_banksize(void) > +{ > + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; > + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; > +} > + > +static struct gpio_desc hub_reset, usb_sel; Can these just be local variables in the function below? I doubt the function is called more than once. > + > +int board_prepare_usb(enum usb_init_type type) > +{ > + int ret = 0, node; > + > + /* Try to request gpios needed to start usb host on dragonboard */ > + if (!dm_gpio_is_valid(&hub_reset)) { > + node = fdt_subnode_offset(gd->fdt_blob, 0, > + "usb_hub_reset_n_pm"); Is this really the standard binding? I would expect a USB node with a reset-gpios property. > + if (node < 0) { > + printf("Failed to find usb_hub_reset_n_pm dt node.\n"); > + return node; > + } > + ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, > + &hub_reset, 0); > + if (ret < 0) { > + printf("Failed to request usb_hub_reset_n_pm gpio.\n"); > + return ret; > + } > + } > + > + if (!dm_gpio_is_valid(&usb_sel)) { > + node = fdt_subnode_offset(gd->fdt_blob, 0, "usb_sw_sel_pm"); > + if (node < 0) { > + printf("Failed to find usb_sw_sel_pm dt node.\n"); > + return 0; > + } > + ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, > + &usb_sel, 0); > + if (ret < 0) { > + printf("Failed to request usb_sw_sel_pm gpio.\n"); > + return ret; > + } > + } > + > + if (type == USB_INIT_HOST) { > + /* Start USB Hub */ > + dm_gpio_set_dir_flags(&hub_reset, > + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); > + mdelay(100); > + /* Switch usb to host connectors */ > + dm_gpio_set_dir_flags(&usb_sel, > + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); > + mdelay(100); > + } else { /* Device */ > + /* Disable hub */ > + dm_gpio_set_dir_flags(&hub_reset, GPIOD_IS_OUT); > + /* Switch back to device connector */ > + dm_gpio_set_dir_flags(&usb_sel, GPIOD_IS_OUT); > + } > + return 0; > +} > + > +int board_init(void) > +{ > + return 0; > +} > + > +/* Check for vol- button - if pressed - stop autoboot */ > +int misc_init_r(void) > +{ > + int node; > + struct gpio_desc resin; > + > + node = fdt_subnode_offset(gd->fdt_blob, 0, "key_vol_down"); Should this be a GPIO key? > + if (node < 0) { > + printf("Failed to find key_vol_down node. Check device tree\n"); > + return 0; > + } > + > + if (gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, &resin, > + 0)) { > + printf("Failed to request key_vol_down button.\n"); > + return 0; > + } > + > + if (dm_gpio_get_value(&resin)) { > + setenv("bootdelay", "-1"); > + printf("Power button pressed - dropping to console.\n"); > + } > + > + return 0; > +} > diff --git a/board/qualcomm/dragonboard410c/head.S b/board/qualcomm/dragonboard410c/head.S > new file mode 100644 > index 0000000..00d6d97 > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/head.S > @@ -0,0 +1,20 @@ > +#include <config.h> > + > +.global _fastboot_header > +_fastboot_header: > + b _start > + add x13, x18, #0x16 > + // Image load offset from start of RAM, little-endian > + .quad CONFIG_SYS_TEXT_BASE-PHYS_SDRAM_1 > + // Effective size of kernel image, little-endian > + .quad 0 //0x60000 > + // Informative flags, little-endian > + .quad 0 > + .quad 0 // reserved > + .quad 0 // reserved > + .quad 0 // reserved > + .byte 0x41 // Magic number, "ARM\x64" > + .byte 0x52 > + .byte 0x4d > + .byte 0x64 > + .word 0 // reserved > diff --git a/board/qualcomm/dragonboard410c/readme.txt b/board/qualcomm/dragonboard410c/readme.txt > new file mode 100644 > index 0000000..0f575db > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/readme.txt > @@ -0,0 +1,40 @@ > +# > +# (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > +# > +# SPDX-License-Identifier: GPL-2.0+ > +# > + > +Build & Run instructions: > + > +1) Install mkbootimg from git://codeaurora.org/quic/kernel/skales (15ece94f09 worked for me) > +2) Setup CROSS_COMPILE to aarch64 compiler > +3) make dragonboard410c_config > +4) make > +5) generate fake, empty ramdisk (can have 0 bytes) > +$ touch rd > + > +6) generate qualcomm device tree, use dtbTool to generate it > +$ dtbTool -o dt.img arch/arm/dts > + > +7) generate image with mkbootimg: > +$ mkbootimg --kernel=u-boot-dtb.bin --output=u-boot.img --dt=dt.img --pagesize 2048 --base 0x80000000 --ramdisk=rd --cmdline="" > + > +Boot it with fastboot: > +fastboot boot u-boot.img > +or flash as kernel: > +fastboot flash boot u-boot.img > +fastboot reboot > + > + > +What is working: > +- UART > +- GPIO (SoC) > +- SD > +- eMMC > +- Reset > +- USB in EHCI mode (usb starts does switch device->host, usb stop does the opposite) > +- PMIC GPIOS (but not in generic subsystem) > +- PMIC "special" buttons (power, vol-) > + > +What is not working / known bugs: > +- SDHCI is slow (~2.5MiB/s for SD and eMMC) > diff --git a/board/qualcomm/dragonboard410c/u-boot.lds b/board/qualcomm/dragonboard410c/u-boot.lds > new file mode 100644 > index 0000000..3fb4235 > --- /dev/null > +++ b/board/qualcomm/dragonboard410c/u-boot.lds > @@ -0,0 +1,90 @@ > +/* > + * Override linker script for fastboot-readable images > + * > + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > + * > + * Based on arch/arm/cpu/armv8/u-boot.lds (Just add header) > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") > +OUTPUT_ARCH(aarch64) > +ENTRY(_fastboot_header) I wonder if you could use the standard .lds file and amend it to support fastboot? > +SECTIONS > +{ > + . = 0x00000000; > + > + . = ALIGN(8); > + .text : > + { > + *(.__image_copy_start) > + board/qualcomm/dragonboard410c/head.o (.text*) > + CPUDIR/start.o (.text*) > + *(.text*) > + } > + > + . = ALIGN(8); > + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } > + > + . = ALIGN(8); > + .data : { > + *(.data*) > + } > + > + . = ALIGN(8); > + > + . = .; > + > + . = ALIGN(8); > + .u_boot_list : { > + KEEP(*(SORT(.u_boot_list*))); > + } > + > + . = ALIGN(8); > + > + .image_copy_end : > + { > + *(.__image_copy_end) > + } > + > + . = ALIGN(8); > + > + .rel_dyn_start : > + { > + *(.__rel_dyn_start) > + } > + > + .rela.dyn : { > + *(.rela*) > + } > + > + .rel_dyn_end : > + { > + *(.__rel_dyn_end) > + } > + > + _end = .; > + > + . = ALIGN(8); > + > + .bss_start : { > + KEEP(*(.__bss_start)); > + } > + > + .bss : { > + *(.bss*) > + . = ALIGN(8); > + } > + > + .bss_end : { > + KEEP(*(.__bss_end)); > + } > + > + /DISCARD/ : { *(.dynsym) } > + /DISCARD/ : { *(.dynstr*) } > + /DISCARD/ : { *(.dynamic*) } > + /DISCARD/ : { *(.plt*) } > + /DISCARD/ : { *(.interp*) } > + /DISCARD/ : { *(.gnu*) } > +} > diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig > new file mode 100644 > index 0000000..7dd9aae > --- /dev/null > +++ b/configs/dragonboard410c_defconfig > @@ -0,0 +1,29 @@ > +CONFIG_ARM=y > +CONFIG_ARM64=y > +CONFIG_ARCH_SNAPDRAGON=y > +CONFIG_TARGET_DRAGONBOARD410C=y > + > +CONFIG_HUSH_PARSER=y > +CONFIG_SYS_PROMPT="dragonboard410c => " > +CONFIG_CMD_USB=y > +# CONFIG_CMD_IMI is not set > +# CONFIG_CMD_IMLS is not set > +CONFIG_DEFAULT_DEVICE_TREE="dragonboard410c" > + > +CONFIG_CLK=y > +CONFIG_MSM_GPIO=y > +CONFIG_PM8916_GPIO=y > +CONFIG_LED=y > +CONFIG_LED_GPIO=y > +CONFIG_RESET=y > +CONFIG_DM_MMC=y > +CONFIG_MSM_SDHCI=y > +CONFIG_DM_PMIC=y > +CONFIG_PMIC_PM8916=y > +CONFIG_SPMI_MSM=y > +CONFIG_MSM_SERIAL=y > +CONFIG_USB=y > +CONFIG_DM_USB=y > +CONFIG_USB_EHCI_HCD=y > +CONFIG_USB_EHCI_MSM=y > +CONFIG_USB_STORAGE=y CONFIG_DM_ETH=y > diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h > new file mode 100644 > index 0000000..132ed75 > --- /dev/null > +++ b/include/configs/dragonboard410c.h > @@ -0,0 +1,184 @@ > +/* > + * Board configuration file for Dragonboard 410C > + * > + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#ifndef __CONFIGS_DRAGONBOARD410C_H > +#define __CONFIGS_DRAGONBOARD410C_H > + > +#include <linux/sizes.h> > +#include <asm/arch/sysmap-apq8016.h> > + > +#define CONFIG_IDENT_STRING "\nQualcomm-DragonBoard 410C" > + > +#define CONFIG_MISC_INIT_R /* To stop autoboot */ > + > +/* Flat Device Tree Definitions */ > +#define CONFIG_OF_LIBFDT > + > +/* Physical Memory Map */ > +#define CONFIG_NR_DRAM_BANKS 1 > +#define PHYS_SDRAM_1 0x80000000 > +/* 1008 MB (the last ~30Mb are secured for TrustZone by ATF*/ > +#define PHYS_SDRAM_1_SIZE 0x3da00000 > +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 > +#define CONFIG_SYS_TEXT_BASE 0x80080000 > +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0) > +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x80000) > +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16MB max kernel size */ > + > +/* UART */ > +#define CONFIG_BAUDRATE 115200 > + > +/* Generic Timer Definitions */ > +#define COUNTER_FREQUENCY 19000000 > + > +/* This are needed to have proper mmc support */ > +#define CONFIG_MMC > +#define CONFIG_GENERIC_MMC > +#define CONFIG_SDHCI > + > +#define CONFIG_SYS_LDSCRIPT "board/qualcomm/dragonboard410c/u-boot.lds" > + > +/* Fixup - in init code we switch from device to host mode, > + * it has to be done after each HCD reset */ > +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET > +/* Needed for Host Controller driver */ > +#define CONFIG_USB_ULPI_VIEWPORT > + > +#define CONFIG_USB_HOST_ETHER /* Enable USB Networking */ > + > +/* Support all possible USB ethernet dongles */ > +#define CONFIG_USB_ETHER_DM9601 > +#define CONFIG_USB_ETHER_ASIX > +#define CONFIG_USB_ETHER_ASIX88179 > +#define CONFIG_USB_ETHER_MCS7830 > +#define CONFIG_USB_ETHER_SMSC95XX > + > +/* Libraries */ > +#define CONFIG_MD5 > + > +/* Extra Commands */ > +#define CONFIG_CMD_CACHE > +#define CONFIG_CMD_DHCP > +#define CONFIG_CMD_ENV > +#define CONFIG_CMD_FAT /* FAT support */ > +#define CONFIG_CMD_GPIO > +#define CONFIG_CMD_GPT > +#define CONFIG_CMD_MD5SUM > +#define CONFIG_CMD_MEMINFO /* meminfo */ > +#define CONFIG_CMD_MMC > +/* Enable that for switching of boot partitions */ > +/* Disabled by default as some sub-commands can brick eMMC */ > +/*#define CONFIG_SUPPORT_EMMC_BOOT */ > +#define CONFIG_CMD_PART > +#define CONFIG_CMD_PING > +#define CONFIG_CMD_REGINFO /* Register dump */ > +#define CONFIG_CMD_TFTP > +#define CONFIG_CMD_TIMER > +#define CONFIG_CMD_UNZIP > +#define CONFIG_CMD_BOOTZ > +#define CONFIG_CMD_BOOTI > + > +/* Command line configuration */ > +#define CONFIG_MENU > +#define CONFIG_SYS_LONGHELP > + > +/* Partition table support */ > +#define HAVE_BLOCK_DEVICE /* Needed for partition commands */ > +#define CONFIG_DOS_PARTITION > +#define CONFIG_EFI_PARTITION > +#define CONFIG_PARTITION_UUIDS > + > +/* BOOTP options */ > +#define CONFIG_BOOTP_BOOTFILESIZE > + > +/* Environment - Boot*/ > +#define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */ > + > +#define CONFIG_NFSBOOTCOMMAND "" > +#define CONFIG_BOOTCOMMAND "usb start && dhcp && tftp && usb stop && bootm" > +#define CONFIG_BOOTARGS "console=ttyMSM0,115200n8" > + > +/* Does what recovery does */ > +#define REFLASH(file, part) \ > +"part start mmc 0 "#part" start && "\ > +"part size mmc 0 "#part" size && "\ > +"tftp $loadaddr "#file" &&" \ > +"mmc write $loadaddr $start $size &&" > + > + > +#define CONFIG_ENV_REFLASH \ > +"mmc dev 0 &&"\ > +"usb start &&"\ > +"dhcp &&"\ > +"tftp $loadaddr dragonboard/rescue/gpt_both0.bin && "\ > +"mmc write $loadaddr 0 43 &&" \ > +"mmc rescan &&"\ > +REFLASH(dragonboard/rescue/NON-HLOS.bin, 1)\ > +REFLASH(dragonboard/rescue/sbl1.mbn, 2)\ > +REFLASH(dragonboard/rescue/rpm.mbn, 3)\ > +REFLASH(dragonboard/rescue/tz.mbn, 4)\ > +REFLASH(dragonboard/rescue/hyp.mbn, 5)\ > +REFLASH(dragonboard/rescue/sec.dat, 6)\ > +REFLASH(dragonboard/rescue/emmc_appsboot.mbn, 7)\ > +REFLASH(dragonboard/u-boot.img, 8)\ > +"usb stop &&"\ > +"echo Reflash completed" > + > +#define CONFIG_UBOOT_REFLASH \ > +"mmc dev 0 &&"\ > +"usb start &&"\ > +"dhcp &&"\ > +"part start mmc 0 8 start && "\ > +"setenv size 0x800 &&"\ > +"tftp $loadaddr dragonboard/u-boot.img &&" \ > +"mmc write $loadaddr $start $size &&"\ > +"usb stop &&"\ > +"echo Reflash completed &&" \ > +"reset" > + > +/* Environment */ > +#define CONFIG_EXTRA_ENV_SETTINGS \ > + "reflash="CONFIG_ENV_REFLASH"\0"\ > + "reflash_uboot="CONFIG_UBOOT_REFLASH"\0"\ > + "loadaddr=0x81000000\0" \ > + "fdt_high=0xffffffffffffffff\0" \ > + "initrd_high=0xffffffffffffffff\0" \ > + "linux_image=dragonboard/Image\0" \ > + "linux_addr=0x81000000\0"\ > + "fdt_image=dragonboard/apq8016-sbc.dtb\0" \ > + "fdt_addr=0x83000000\0"\ > + "ramdisk_addr=0x84000000\0"\ > + "ramdisk_image=dragonboard/initrd.img\0" \ > + "dl_uboot=tftp $loadaddr dragonboard/u-boot.img\0"\ > + "dl_kernel=tftp $linux_addr $linux_image " \ > + "&& tftp $fdt_addr $fdt_image\0"\ > + "dl_ramdisk=tftp $ramdisk_addr $ramdisk_image\0"\ > + "nboot_nord=usb start && run dl_kernel && usb stop && " \ > + "booti $linux_addr - $fdt_addr\0"\ > + "nboot_rd=usb start && run dl_kernel && run dl_ramdisk && "\ > + "booti $linux_addr $ramdisk_addr $fdt_addr\0" > + > +#define CONFIG_ENV_IS_NOWHERE > +#define CONFIG_ENV_SIZE 0x1000 > +#define CONFIG_ENV_VARS_UBOOT_CONFIG > +#define CONFIG_SYS_NO_FLASH > + > +/* Size of malloc() pool */ > +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) > + > +/* Monitor Command Prompt */ > +#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ > +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ > + sizeof(CONFIG_SYS_PROMPT) + 16) > +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE > +#define CONFIG_SYS_LONGHELP > +#define CONFIG_CMDLINE_EDITING > +#define CONFIG_SYS_MAXARGS 64 /* max command args */ > + > + > +#endif > -- > 2.5.0 > Regards, Simon
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi Simon, On 16.12.2015 23:29, Simon Glass wrote: > Hi Mateusz, > > On 10 December 2015 at 14:41, Mateusz Kulikowski > <mateusz.kulikowski@gmail.com> wrote: [...] > >> + >> +int board_prepare_usb(enum usb_init_type type) >> +{ >> + int ret = 0, node; >> + >> + /* Try to request gpios needed to start usb host on dragonboard */ >> + if (!dm_gpio_is_valid(&hub_reset)) { >> + node = fdt_subnode_offset(gd->fdt_blob, 0, >> + "usb_hub_reset_n_pm"); > > Is this really the standard binding? I would expect a USB node with a > reset-gpios property. > That's a good idea. [...] >> + >> +/* Check for vol- button - if pressed - stop autoboot */ >> +int misc_init_r(void) >> +{ >> + int node; >> + struct gpio_desc resin; >> + >> + node = fdt_subnode_offset(gd->fdt_blob, 0, "key_vol_down"); > > Should this be a GPIO key? Yes, but I couldn't find something like that in U-Boot.. did I missed it? [...] >> + >> +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") >> +OUTPUT_ARCH(aarch64) >> +ENTRY(_fastboot_header) > > I wonder if you could use the standard .lds file and amend it to > support fastboot? Perhaps it's a good idea to make it generic option (at least for ARMv8 devices). I'm not sure is it "generic" fastboot header or only works for Little Kernel on Qualcomm devices though. @Albert what do you think? > >> +SECTIONS >> +{ >> + . = 0x00000000; >> + >> + . = ALIGN(8); >> + .text : >> + { >> + *(.__image_copy_start) >> + board/qualcomm/dragonboard410c/head.o (.text*) >> + CPUDIR/start.o (.text*) >> + *(.text*) >> + } >> + Regards, Mateusz -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWdUxgAAoJELvtohmVtQzBSV0IAIeIJSDENgvWvR5Q7hkmGYWQ y+M0QWFaZpAD+iyOsHBelRWpaOTlrjrnG7n9aAsUf6VUJ8d70p8dPDgycxoRyrtw QdWGTfamlO3V9/cw0iLKlWpz3xXZXIVkMrLyhggZkA4anGMSopvNkuOs42LQSgnp dOUJAEbLgwZBlALlZH3uAdpSuAYywbfDhyyXGXH4sCHhx2wNnLJjr4sXLoamz8Jd 2o9ITZfr5TAl3fWTxSRN0XHxUeFRYLUywpSyqmI9A3ajtsRSh8uPzde2v3PP6qjI Qw94RrF2QWKSLu/OMehajcWzG6VYYKaGc0nMMmLV6aHL1VNI9FjRpUcSraHhU0A= =AVPb -----END PGP SIGNATURE-----
Hi Mateusz, On 19 December 2015 at 05:24, Mateusz Kulikowski <mateusz.kulikowski@gmail.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Hi Simon, > > On 16.12.2015 23:29, Simon Glass wrote: >> Hi Mateusz, >> >> On 10 December 2015 at 14:41, Mateusz Kulikowski >> <mateusz.kulikowski@gmail.com> wrote: > [...] >> >>> + >>> +int board_prepare_usb(enum usb_init_type type) >>> +{ >>> + int ret = 0, node; >>> + >>> + /* Try to request gpios needed to start usb host on dragonboard */ >>> + if (!dm_gpio_is_valid(&hub_reset)) { >>> + node = fdt_subnode_offset(gd->fdt_blob, 0, >>> + "usb_hub_reset_n_pm"); >> >> Is this really the standard binding? I would expect a USB node with a >> reset-gpios property. >> > > That's a good idea. > > [...] >>> + >>> +/* Check for vol- button - if pressed - stop autoboot */ >>> +int misc_init_r(void) >>> +{ >>> + int node; >>> + struct gpio_desc resin; >>> + >>> + node = fdt_subnode_offset(gd->fdt_blob, 0, "key_vol_down"); >> >> Should this be a GPIO key? > > Yes, but I couldn't find something like that in U-Boot.. did I missed it? > > [...] >>> + >>> +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") >>> +OUTPUT_ARCH(aarch64) >>> +ENTRY(_fastboot_header) >> >> I wonder if you could use the standard .lds file and amend it to >> support fastboot? > > Perhaps it's a good idea to make it generic option (at least for ARMv8 devices). > > I'm not sure is it "generic" fastboot header or only works for Little Kernel > on Qualcomm devices though. > > @Albert what do you think? I see later that you plan to remove this one day, so perhaps it is fine to keep it as it is. > >> >>> +SECTIONS >>> +{ >>> + . = 0x00000000; >>> + >>> + . = ALIGN(8); >>> + .text : >>> + { >>> + *(.__image_copy_start) >>> + board/qualcomm/dragonboard410c/head.o (.text*) >>> + CPUDIR/start.o (.text*) >>> + *(.text*) >>> + } >>> + Regards, Simon
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 521aa4c..1154993 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -95,6 +95,8 @@ dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \ fsl-ls1043a-rdb.dtb +dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb + dtb-$(CONFIG_MACH_SUN4I) += \ sun4i-a10-a1000.dtb \ sun4i-a10-ba10-tvbox.dtb \ diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts new file mode 100644 index 0000000..04ad9eb --- /dev/null +++ b/arch/arm/dts/dragonboard410c.dts @@ -0,0 +1,157 @@ +/dts-v1/; + +#include "skeleton64.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. Dragonboard 410c"; + compatible = "qcom,dragonboard", "qcom,apq8016-sbc"; + qcom,msm-id = <0xce 0x0 0xf8 0x0 0xf9 0x0 0xfa 0x0 0xf7 0x0>; + qcom,board-id = <0x10018 0x0>; + #address-cells = <0x2>; + #size-cells = <0x2>; + + memory { + device_type = "memory"; + reg = <0 0x80000000 0 0x3da00000>; + }; + + chosen { + stdout-path = "/soc/serial@78b0000"; + }; + + + soc { + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges = <0x0 0x0 0x0 0xffffffff>; + compatible = "simple-bus"; + + clkc: qcom,gcc@1800000 { + compatible = "qcom,gcc-msm8916"; + reg = <0x1800000 0x80000>; + #address-cells = <0x1>; + #size-cells = <0x0>; + }; + + serial@78b0000 { + compatible = "qcom,msm-uartdm-v1.4"; + reg = <0x78b0000 0x200>; + u-boot,dm-pre-reloc; + clock = <&clkc 4>; + }; + + restart@4ab000 { + compatible = "qcom,pshold"; + reg = <0x4ab000 0x4>; + }; + + soc_gpios: pinctrl@1000000 { + compatible = "qcom,msm8916-pinctrl"; + reg = <0x1000000 0x300000>; + gpio-controller; + gpio-count = <122>; + gpio-bank-name="soc"; + #gpio-cells = <1>; + }; + + ehci@78d9000 { + compatible = "qcom,ehci-host"; + reg = <0x78d9000 0x400>; + }; + + sdhci@07824000 { + compatible = "qcom,sdhci-msm-v4"; + reg = <0x7824900 0x11c 0x7824000 0x800>; + bus-width = <0x8>; + index = <0x0>; + non-removable; + clock = <&clkc 0>; + clock-frequency = <100000000>; + }; + + sdhci@07864000 { + compatible = "qcom,sdhci-msm-v4"; + reg = <0x7864900 0x11c 0x7864000 0x800>; + index = <0x1>; + bus-width = <0x4>; + clock = <&clkc 1>; + clock-frequency = <200000000>; + }; + + spmi@200f000 { + compatible = "qcom,spmi-pmic-arb"; + reg = <0x200f000 0x1000 0x2400000 0x400000 0x2c00000 0x400000 0x3800000 0x200000 0x200a000 0x2100>; + reg-names = "core", "chnls", "obsrvr", "intr", "cnfg"; + #address-cells = <0x1>; + #size-cells = <0x1>; + pm8916@0 { + compatible = "qcom,spmi-pmic"; + reg = <0x0 0x2>; + #address-cells = <0x1>; + #size-cells = <0x1>; + + pmic_pon: pon@800 { + compatible = "qcom,pm8916-pwrkey"; + reg = <0x800 0x96>; + #gpio-cells = <2>; + gpio-controller; + }; + + pmic_gpios: gpios@c000 { + compatible = "qcom,pm8916-gpio"; + reg = <0xc000 0x400>; + gpio-controller; + gpio-count = <4>; + #gpio-cells = <2>; + gpio-bank-name="pmic"; + }; + }; + + pm8916@1 { + compatible = "qcom,spmi-pmic"; + reg = <0x1>; + #address-cells = <0x1>; + #size-cells = <0x0>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + user1 { + label = "green:user1"; + gpios = <&soc_gpios 21 0>; + }; + + user2 { + label = "green:user2"; + gpios = <&soc_gpios 120 0>; + }; + + user3 { + label = "green:user3"; + gpios = <&pmic_gpios 0 0>; + }; + + user4 { + label = "green:user4"; + gpios = <&pmic_gpios 1 0>; + }; + }; + + usb_hub_reset_n_pm { + gpios = <&pmic_gpios 2 0>; + }; + + usb_sw_sel_pm { + gpios = <&pmic_gpios 3 0>; + }; + + key_vol_down { + gpios = <&pmic_pon 1 0>; + }; + + key_power { + gpios = <&pmic_pon 0 0>; + }; +}; diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig index 156e733..61e0e9e 100644 --- a/arch/arm/mach-snapdragon/Kconfig +++ b/arch/arm/mach-snapdragon/Kconfig @@ -3,4 +3,13 @@ if ARCH_SNAPDRAGON config SYS_SOC default "snapdragon" +choice + prompt "Snapdragon board select" + +config TARGET_DRAGONBOARD410C + bool "96Boards Dragonboard 410C" +endchoice + +source "board/qualcomm/dragonboard410c/Kconfig" + endif diff --git a/board/qualcomm/dragonboard410c/Kconfig b/board/qualcomm/dragonboard410c/Kconfig new file mode 100644 index 0000000..03bd7ae --- /dev/null +++ b/board/qualcomm/dragonboard410c/Kconfig @@ -0,0 +1,15 @@ +if TARGET_DRAGONBOARD410C + +config SYS_BOARD + default "dragonboard410c" + +config SYS_VENDOR + default "qualcomm" + +config SYS_SOC + default "apq8016" + +config SYS_CONFIG_NAME + default "dragonboard410c" + +endif diff --git a/board/qualcomm/dragonboard410c/Makefile b/board/qualcomm/dragonboard410c/Makefile new file mode 100644 index 0000000..cd67808 --- /dev/null +++ b/board/qualcomm/dragonboard410c/Makefile @@ -0,0 +1,8 @@ +# +# (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := dragonboard410c.o +extra-y += head.o diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c new file mode 100644 index 0000000..7057a2c --- /dev/null +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c @@ -0,0 +1,111 @@ +/* + * Board init file for Dragonboard 410C + * + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> + + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <dm.h> +#include <usb.h> +#include <asm/gpio.h> + +DECLARE_GLOBAL_DATA_PTR; + +int dram_init(void) +{ + gd->ram_size = PHYS_SDRAM_1_SIZE; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +static struct gpio_desc hub_reset, usb_sel; + +int board_prepare_usb(enum usb_init_type type) +{ + int ret = 0, node; + + /* Try to request gpios needed to start usb host on dragonboard */ + if (!dm_gpio_is_valid(&hub_reset)) { + node = fdt_subnode_offset(gd->fdt_blob, 0, + "usb_hub_reset_n_pm"); + if (node < 0) { + printf("Failed to find usb_hub_reset_n_pm dt node.\n"); + return node; + } + ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, + &hub_reset, 0); + if (ret < 0) { + printf("Failed to request usb_hub_reset_n_pm gpio.\n"); + return ret; + } + } + + if (!dm_gpio_is_valid(&usb_sel)) { + node = fdt_subnode_offset(gd->fdt_blob, 0, "usb_sw_sel_pm"); + if (node < 0) { + printf("Failed to find usb_sw_sel_pm dt node.\n"); + return 0; + } + ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, + &usb_sel, 0); + if (ret < 0) { + printf("Failed to request usb_sw_sel_pm gpio.\n"); + return ret; + } + } + + if (type == USB_INIT_HOST) { + /* Start USB Hub */ + dm_gpio_set_dir_flags(&hub_reset, + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); + mdelay(100); + /* Switch usb to host connectors */ + dm_gpio_set_dir_flags(&usb_sel, + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); + mdelay(100); + } else { /* Device */ + /* Disable hub */ + dm_gpio_set_dir_flags(&hub_reset, GPIOD_IS_OUT); + /* Switch back to device connector */ + dm_gpio_set_dir_flags(&usb_sel, GPIOD_IS_OUT); + } + return 0; +} + +int board_init(void) +{ + return 0; +} + +/* Check for vol- button - if pressed - stop autoboot */ +int misc_init_r(void) +{ + int node; + struct gpio_desc resin; + + node = fdt_subnode_offset(gd->fdt_blob, 0, "key_vol_down"); + if (node < 0) { + printf("Failed to find key_vol_down node. Check device tree\n"); + return 0; + } + + if (gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, &resin, + 0)) { + printf("Failed to request key_vol_down button.\n"); + return 0; + } + + if (dm_gpio_get_value(&resin)) { + setenv("bootdelay", "-1"); + printf("Power button pressed - dropping to console.\n"); + } + + return 0; +} diff --git a/board/qualcomm/dragonboard410c/head.S b/board/qualcomm/dragonboard410c/head.S new file mode 100644 index 0000000..00d6d97 --- /dev/null +++ b/board/qualcomm/dragonboard410c/head.S @@ -0,0 +1,20 @@ +#include <config.h> + +.global _fastboot_header +_fastboot_header: + b _start + add x13, x18, #0x16 + // Image load offset from start of RAM, little-endian + .quad CONFIG_SYS_TEXT_BASE-PHYS_SDRAM_1 + // Effective size of kernel image, little-endian + .quad 0 //0x60000 + // Informative flags, little-endian + .quad 0 + .quad 0 // reserved + .quad 0 // reserved + .quad 0 // reserved + .byte 0x41 // Magic number, "ARM\x64" + .byte 0x52 + .byte 0x4d + .byte 0x64 + .word 0 // reserved diff --git a/board/qualcomm/dragonboard410c/readme.txt b/board/qualcomm/dragonboard410c/readme.txt new file mode 100644 index 0000000..0f575db --- /dev/null +++ b/board/qualcomm/dragonboard410c/readme.txt @@ -0,0 +1,40 @@ +# +# (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +Build & Run instructions: + +1) Install mkbootimg from git://codeaurora.org/quic/kernel/skales (15ece94f09 worked for me) +2) Setup CROSS_COMPILE to aarch64 compiler +3) make dragonboard410c_config +4) make +5) generate fake, empty ramdisk (can have 0 bytes) +$ touch rd + +6) generate qualcomm device tree, use dtbTool to generate it +$ dtbTool -o dt.img arch/arm/dts + +7) generate image with mkbootimg: +$ mkbootimg --kernel=u-boot-dtb.bin --output=u-boot.img --dt=dt.img --pagesize 2048 --base 0x80000000 --ramdisk=rd --cmdline="" + +Boot it with fastboot: +fastboot boot u-boot.img +or flash as kernel: +fastboot flash boot u-boot.img +fastboot reboot + + +What is working: +- UART +- GPIO (SoC) +- SD +- eMMC +- Reset +- USB in EHCI mode (usb starts does switch device->host, usb stop does the opposite) +- PMIC GPIOS (but not in generic subsystem) +- PMIC "special" buttons (power, vol-) + +What is not working / known bugs: +- SDHCI is slow (~2.5MiB/s for SD and eMMC) diff --git a/board/qualcomm/dragonboard410c/u-boot.lds b/board/qualcomm/dragonboard410c/u-boot.lds new file mode 100644 index 0000000..3fb4235 --- /dev/null +++ b/board/qualcomm/dragonboard410c/u-boot.lds @@ -0,0 +1,90 @@ +/* + * Override linker script for fastboot-readable images + * + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> + * + * Based on arch/arm/cpu/armv8/u-boot.lds (Just add header) + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") +OUTPUT_ARCH(aarch64) +ENTRY(_fastboot_header) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(8); + .text : + { + *(.__image_copy_start) + board/qualcomm/dragonboard410c/head.o (.text*) + CPUDIR/start.o (.text*) + *(.text*) + } + + . = ALIGN(8); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + + . = ALIGN(8); + .data : { + *(.data*) + } + + . = ALIGN(8); + + . = .; + + . = ALIGN(8); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } + + . = ALIGN(8); + + .image_copy_end : + { + *(.__image_copy_end) + } + + . = ALIGN(8); + + .rel_dyn_start : + { + *(.__rel_dyn_start) + } + + .rela.dyn : { + *(.rela*) + } + + .rel_dyn_end : + { + *(.__rel_dyn_end) + } + + _end = .; + + . = ALIGN(8); + + .bss_start : { + KEEP(*(.__bss_start)); + } + + .bss : { + *(.bss*) + . = ALIGN(8); + } + + .bss_end : { + KEEP(*(.__bss_end)); + } + + /DISCARD/ : { *(.dynsym) } + /DISCARD/ : { *(.dynstr*) } + /DISCARD/ : { *(.dynamic*) } + /DISCARD/ : { *(.plt*) } + /DISCARD/ : { *(.interp*) } + /DISCARD/ : { *(.gnu*) } +} diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig new file mode 100644 index 0000000..7dd9aae --- /dev/null +++ b/configs/dragonboard410c_defconfig @@ -0,0 +1,29 @@ +CONFIG_ARM=y +CONFIG_ARM64=y +CONFIG_ARCH_SNAPDRAGON=y +CONFIG_TARGET_DRAGONBOARD410C=y + +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="dragonboard410c => " +CONFIG_CMD_USB=y +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +CONFIG_DEFAULT_DEVICE_TREE="dragonboard410c" + +CONFIG_CLK=y +CONFIG_MSM_GPIO=y +CONFIG_PM8916_GPIO=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_RESET=y +CONFIG_DM_MMC=y +CONFIG_MSM_SDHCI=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_PM8916=y +CONFIG_SPMI_MSM=y +CONFIG_MSM_SERIAL=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_MSM=y +CONFIG_USB_STORAGE=y diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h new file mode 100644 index 0000000..132ed75 --- /dev/null +++ b/include/configs/dragonboard410c.h @@ -0,0 +1,184 @@ +/* + * Board configuration file for Dragonboard 410C + * + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __CONFIGS_DRAGONBOARD410C_H +#define __CONFIGS_DRAGONBOARD410C_H + +#include <linux/sizes.h> +#include <asm/arch/sysmap-apq8016.h> + +#define CONFIG_IDENT_STRING "\nQualcomm-DragonBoard 410C" + +#define CONFIG_MISC_INIT_R /* To stop autoboot */ + +/* Flat Device Tree Definitions */ +#define CONFIG_OF_LIBFDT + +/* Physical Memory Map */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1 0x80000000 +/* 1008 MB (the last ~30Mb are secured for TrustZone by ATF*/ +#define PHYS_SDRAM_1_SIZE 0x3da00000 +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_TEXT_BASE 0x80080000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0) +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x80000) +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16MB max kernel size */ + +/* UART */ +#define CONFIG_BAUDRATE 115200 + +/* Generic Timer Definitions */ +#define COUNTER_FREQUENCY 19000000 + +/* This are needed to have proper mmc support */ +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_SDHCI + +#define CONFIG_SYS_LDSCRIPT "board/qualcomm/dragonboard410c/u-boot.lds" + +/* Fixup - in init code we switch from device to host mode, + * it has to be done after each HCD reset */ +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET +/* Needed for Host Controller driver */ +#define CONFIG_USB_ULPI_VIEWPORT + +#define CONFIG_USB_HOST_ETHER /* Enable USB Networking */ + +/* Support all possible USB ethernet dongles */ +#define CONFIG_USB_ETHER_DM9601 +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_ASIX88179 +#define CONFIG_USB_ETHER_MCS7830 +#define CONFIG_USB_ETHER_SMSC95XX + +/* Libraries */ +#define CONFIG_MD5 + +/* Extra Commands */ +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_ENV +#define CONFIG_CMD_FAT /* FAT support */ +#define CONFIG_CMD_GPIO +#define CONFIG_CMD_GPT +#define CONFIG_CMD_MD5SUM +#define CONFIG_CMD_MEMINFO /* meminfo */ +#define CONFIG_CMD_MMC +/* Enable that for switching of boot partitions */ +/* Disabled by default as some sub-commands can brick eMMC */ +/*#define CONFIG_SUPPORT_EMMC_BOOT */ +#define CONFIG_CMD_PART +#define CONFIG_CMD_PING +#define CONFIG_CMD_REGINFO /* Register dump */ +#define CONFIG_CMD_TFTP +#define CONFIG_CMD_TIMER +#define CONFIG_CMD_UNZIP +#define CONFIG_CMD_BOOTZ +#define CONFIG_CMD_BOOTI + +/* Command line configuration */ +#define CONFIG_MENU +#define CONFIG_SYS_LONGHELP + +/* Partition table support */ +#define HAVE_BLOCK_DEVICE /* Needed for partition commands */ +#define CONFIG_DOS_PARTITION +#define CONFIG_EFI_PARTITION +#define CONFIG_PARTITION_UUIDS + +/* BOOTP options */ +#define CONFIG_BOOTP_BOOTFILESIZE + +/* Environment - Boot*/ +#define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */ + +#define CONFIG_NFSBOOTCOMMAND "" +#define CONFIG_BOOTCOMMAND "usb start && dhcp && tftp && usb stop && bootm" +#define CONFIG_BOOTARGS "console=ttyMSM0,115200n8" + +/* Does what recovery does */ +#define REFLASH(file, part) \ +"part start mmc 0 "#part" start && "\ +"part size mmc 0 "#part" size && "\ +"tftp $loadaddr "#file" &&" \ +"mmc write $loadaddr $start $size &&" + + +#define CONFIG_ENV_REFLASH \ +"mmc dev 0 &&"\ +"usb start &&"\ +"dhcp &&"\ +"tftp $loadaddr dragonboard/rescue/gpt_both0.bin && "\ +"mmc write $loadaddr 0 43 &&" \ +"mmc rescan &&"\ +REFLASH(dragonboard/rescue/NON-HLOS.bin, 1)\ +REFLASH(dragonboard/rescue/sbl1.mbn, 2)\ +REFLASH(dragonboard/rescue/rpm.mbn, 3)\ +REFLASH(dragonboard/rescue/tz.mbn, 4)\ +REFLASH(dragonboard/rescue/hyp.mbn, 5)\ +REFLASH(dragonboard/rescue/sec.dat, 6)\ +REFLASH(dragonboard/rescue/emmc_appsboot.mbn, 7)\ +REFLASH(dragonboard/u-boot.img, 8)\ +"usb stop &&"\ +"echo Reflash completed" + +#define CONFIG_UBOOT_REFLASH \ +"mmc dev 0 &&"\ +"usb start &&"\ +"dhcp &&"\ +"part start mmc 0 8 start && "\ +"setenv size 0x800 &&"\ +"tftp $loadaddr dragonboard/u-boot.img &&" \ +"mmc write $loadaddr $start $size &&"\ +"usb stop &&"\ +"echo Reflash completed &&" \ +"reset" + +/* Environment */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "reflash="CONFIG_ENV_REFLASH"\0"\ + "reflash_uboot="CONFIG_UBOOT_REFLASH"\0"\ + "loadaddr=0x81000000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" \ + "linux_image=dragonboard/Image\0" \ + "linux_addr=0x81000000\0"\ + "fdt_image=dragonboard/apq8016-sbc.dtb\0" \ + "fdt_addr=0x83000000\0"\ + "ramdisk_addr=0x84000000\0"\ + "ramdisk_image=dragonboard/initrd.img\0" \ + "dl_uboot=tftp $loadaddr dragonboard/u-boot.img\0"\ + "dl_kernel=tftp $linux_addr $linux_image " \ + "&& tftp $fdt_addr $fdt_image\0"\ + "dl_ramdisk=tftp $ramdisk_addr $ramdisk_image\0"\ + "nboot_nord=usb start && run dl_kernel && usb stop && " \ + "booti $linux_addr - $fdt_addr\0"\ + "nboot_rd=usb start && run dl_kernel && run dl_ramdisk && "\ + "booti $linux_addr $ramdisk_addr $fdt_addr\0" + +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x1000 +#define CONFIG_ENV_VARS_UBOOT_CONFIG +#define CONFIG_SYS_NO_FLASH + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) + +/* Monitor Command Prompt */ +#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_SYS_MAXARGS 64 /* max command args */ + + +#endif
This commit add support for 96Boards Dragonboard410C. It is board based on APQ8016 Qualcomm SoC, complying with 96boards specification. Features (present out of the box): - 4x Cortex A53 (ARMv8) - 2x USB Host port - 1x USB Device port - 4x LEDs - 1x HDMI connector - 1x uSD connector - 3x buttons (Power, Vol+, Vol-/Reset) - WIFI, Bluetooth with integrated antenna - 8GiB eMMC U-Boot boots chained with fastboot in 64-bit mode. For detailed build instructions see readme.txt in board directory. This is code is cleaned-up version of code I did last month that is already used by some people: https://github.com/hallor/u-boot Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> --- arch/arm/dts/Makefile | 2 + arch/arm/dts/dragonboard410c.dts | 157 +++++++++++++++++++ arch/arm/mach-snapdragon/Kconfig | 9 ++ board/qualcomm/dragonboard410c/Kconfig | 15 ++ board/qualcomm/dragonboard410c/Makefile | 8 + board/qualcomm/dragonboard410c/dragonboard410c.c | 111 ++++++++++++++ board/qualcomm/dragonboard410c/head.S | 20 +++ board/qualcomm/dragonboard410c/readme.txt | 40 +++++ board/qualcomm/dragonboard410c/u-boot.lds | 90 +++++++++++ configs/dragonboard410c_defconfig | 29 ++++ include/configs/dragonboard410c.h | 184 +++++++++++++++++++++++ 11 files changed, 665 insertions(+) create mode 100644 arch/arm/dts/dragonboard410c.dts create mode 100644 board/qualcomm/dragonboard410c/Kconfig create mode 100644 board/qualcomm/dragonboard410c/Makefile create mode 100644 board/qualcomm/dragonboard410c/dragonboard410c.c create mode 100644 board/qualcomm/dragonboard410c/head.S create mode 100644 board/qualcomm/dragonboard410c/readme.txt create mode 100644 board/qualcomm/dragonboard410c/u-boot.lds create mode 100644 configs/dragonboard410c_defconfig create mode 100644 include/configs/dragonboard410c.h