u-boot-brain/board/qualcomm/dragonboard410c
Masahiro Yamada b75d8dc564 treewide: convert bd_t to struct bd_info by coccinelle
The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

  It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

  void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

  #include <asm/u-boot.h>
  void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

  struct bd_info;
  void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

  <smpl>
  @@
  typedef bd_t;
  @@
  -bd_t
  +struct bd_info
  </smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-17 09:30:13 -04:00
..
dragonboard410c.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
head.S SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig board: Add Qualcomm Dragonboard 410C support 2016-04-01 17:18:27 -04:00
lowlevel_init.S SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
MAINTAINERS MAINTAINERS: change Ramon Fried email address 2019-06-14 10:09:15 -04:00
Makefile SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
readme.txt SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
u-boot.lds efi_loader: Rename sections to allow for implicit data 2018-07-25 14:57:44 +02:00

# SPDX-License-Identifier: GPL-2.0+
#
# (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com>

Build & Run instructions:

1) Install mkbootimg and dtbTool 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 table with dtbTool [1]
$ dtbTool -o dt.img arch/arm/dts

7) Generate Android boot image with mkbootimg [2]:
$ mkbootimg --kernel=u-boot-dtb.bin --output=u-boot.img --dt=dt.img  \
  --pagesize 2048 --base 0x80000000 --ramdisk=rd --cmdline=""

8) Enter fastboot (reboot board with vol- button pressed)

9) Boot it:
$ 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)

[1] To boot any kernel image, Little Kernel requires valid device tree for the
platform it runs on. dtbTool creates device tree table that Little Kernel scans.
Later on proper device tree is passed to next boot stage.
Full device tree is not required to boot u-boot. Enough would be:
/dts-v1/;

/ {
	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>;
	chosen { };
	aliases { };

	memory {
		device_type = "memory";
		reg = <0 0x80000000 0 0x3da00000>;
	};
};

but for simplicity (and because size of image is not that critical) we use
existing Qualcomm device trees.

[2] Note that ramdisk is required, even if it is unused.