Commit Graph

17568 Commits

Author SHA1 Message Date
Ren Jianing 858bd926c5 configs: rk3568: add USB support
Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Id49e056ad30c4cef2eea22a7eb4ea4992318b9c4
2020-11-02 18:18:24 +08:00
Joseph Chen 912fa0754a common: board_f.c: add fpga init call
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5fb507094207b14ad64cf3dee646aaac177bf43d
2020-11-02 16:39:14 +08:00
Lin Jinhan c48f1acf4a crypto: rockchip: modify crypto hash cache support for crypto v1&v2
Change-Id: I6e0604bf02908269ab021714378b66ed712fdc06
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2020-10-30 09:24:49 +08:00
Finley Xiao a4c57e8a07 rockchip: otp: Add support for rv1126
This adds the necessary data for handling otp on the rv1126.

Change-Id: Ie78ad04861ee8dca506f0bb7b851570b360694de
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2020-10-23 15:06:11 +08:00
Joseph Chen 7e26af3867 rockchip: add rk3568 SoC support
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2e163b93d4ec5a60f1ff9c589626d3ccd994f854
2020-10-22 19:39:19 +08:00
Joseph Chen be7064f8f7 rockchip: dts: rk3568: add basic dtsi/dts
Sync from kernel-4.19:
(85abcd6 phy: phy-rockchip-snps-pcie3: Initial support)

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I474a6f5bfdaf5f78655a121ac9dc08e3708de226
2020-10-22 19:39:19 +08:00
Elaine Zhang 6b7c0aa59e rockchip: dts: rk3568: sync from kernel
sync from: ac723c clk: rockchip: rk3568: Replace RKNN with NPU

Change-Id: I24084626ef787f6fb7cbb8875365eb31fbea3541
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2020-10-22 19:39:19 +08:00
Jason Zhu cee2fb0e57 common: android_ab: move the ab functions to android_ab.c
Move the ab functions to android_ab.c and add "ab_" prefix to
api function.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I4527a0c957aa7853a1b75d456ca3fabaf80c1c57
2020-10-22 19:38:57 +08:00
Jason Zhu cf87ffd351 include: android_image: move some android common definitions to this file
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ia0da707408bcd43b50b49cef89495af7f9d97cd7
2020-10-22 19:38:57 +08:00
Joseph Chen e7498cb05b common: android: show ramdisk size of boot and vendor-boot
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia8eca7010989e64d10b09628a12bcfc5aaeb988c
2020-10-10 16:17:06 +08:00
Dayao Ji 40a6a2cba2 fastboot: add virtual A/B feature support
Add "fasboot getvar snapshot-update-status" support and
prevent erase/wipe of userdata/metadata when virtual A/B
merge status is MERGING or SNAPSHOTTED (+source slot !=
current slot).

Signed-off-by: Dayao Ji <jdy@rock-chips.com>
Change-Id: Ibb6ea5778b78b2601178f489d6efcee60d5d0a49
2020-09-23 19:01:12 +08:00
Dayao Ji 132e9ecacf rockchip: rkimg: Add R/W interfaces for virtual A/B metadata
According to the AOSP default definition, the virtual A/B
metadata is located at the offset 32KB of the misc partition.

Signed-off-by: Dayao Ji <jdy@rock-chips.com>
Change-Id: Ib60379f25e4c72be9f5ed03934ab7dc928cdd585
2020-09-23 16:26:32 +08:00
Joseph Chen ab2b3191ab rockchip: rv1126: add periph device region for thunder-boot SPL
It makes thunder-boot SPL only map periph device region as
dcache off but not all 4GB region to save boot time.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ib0abafe1b74cde24755780261fb7fcfaa8932ea2
2020-09-21 15:42:09 +08:00
Joseph Chen d93c779cf8 include: linux: add SZ_3G/4G definition
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I97ebf0e488bc33da29c923e7fe9a253f5369ad9a
2020-09-21 15:38:29 +08:00
Joseph Chen 745aeb1a7d common: android: add boot_img_hdr_v3 and vendor boot support
Android Header v3 and vendor boot partition are introduced
from Android-11(R).

Header populate:
  Header v3 is no longer compatible with v0/1/2 header, we
  add populate_andr_img_hdr() to merge boot and vendor_boot
  partition header into struct andr_img_hdr in order to
  compatible with v0/1/2 header.

resource.img:
  The second_addr and second_size fields are removed in v3,
  so we require resource partition to restore resource.img.

A/B system:
  If not A/B system, the boot.img header version is 3 and
  recovery header is version 2.

AVB load image:
  - If allow verification error: the image is loaded by
    ops->get_preloaded_partition() which auto populates
    boot_img_hdr_v3.
  - If not allow verification error: the image is full loaded
    by ops->read_from_partition() which doesn't populate
    boot_img_hdr_v3, we need to fix it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2afce53c43d782fc57baa01acf9c05518b580840
2020-09-18 14:41:37 +08:00
Jon Lin 03d86fc3c0 mtd: spinand: Support FM25S01A
Change-Id: I805cbf0e8bc47cd9bd94fd296dbaf46921490f15
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-09-16 12:58:33 +08:00
Jason Zhu 0ee21b67f5 include: image: fix compile error
error message: include/image.h:1015:1: error: unknown type
name 'bool'; did you mean '_Bool'?

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I786c04be6f389ad42685b934eb13426ea9a9e5a4
2020-09-16 08:39:09 +08:00
Jon Lin b66d41c240 mtd: spinand: Support hyf devices
Support HYF1GQ4UPACAE, HYF1GQ4UDACAE

Change-Id: I9b8022d9320150d587b443cfa4cdc7495267795e
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-09-16 08:37:57 +08:00
Elaine Zhang 9848d60c83 dt-bindings: clock: rk3568: Add binding header for rk3568
files origin from kernel.

Change-Id: Iab1de697da1db28ef0d4d10c96c437373363c1bd
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2020-09-14 17:14:15 +08:00
Jon Lin 853fc11fcc blk: Add BLK_MTD_CONT_WRITE tag
Change-Id: I72537387912d5c981dbe205c0d0c1864fa42a555
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-09-08 17:51:23 +08:00
Jason Zhu 2201a451d5 common: fit: add fit_image_is_preload()
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I3c3001a347ae59fcfd186156382c04b4b8a77546
2020-09-07 14:53:06 +08:00
Jason Zhu 4d62a7e032 blk: remove unused code
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ib43223baa7d335f6810f714fd64c40cd314b0185
2020-09-07 14:53:06 +08:00
Joseph Chen 8259a58e4a rv1126: configs: do reset for bootcmd if thunder-boot version
We made a deal: Not allow U-Boot to bring up thunder-boot kernel.

Because the thunder-boot feature may require special memory layout
or other appointments, U-Boot can't handle all that. Let's go back
to SPL to bring up kernel.

Note: bootcmd is only called in normal boot sequence, that means
we allow user to boot what they want in U-Boot shell mode.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8a68af3fbd441ab7e30ad310640eaf3ee5f24525
2020-09-02 16:02:49 +08:00
Jianqun Xu d3acdc96e2 pinctrl: support to build without pinctrl driver
Change-Id: I353d4a761d42ad2a22f94cc72dfeb7724e288061
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-08-31 16:03:47 +08:00
Joseph Chen a00b516f44 spl: fit: use CONFIG_SPL_KERNEL_BOOT for thunder-boot
This option was added by RKFW boot flow, let's reuse it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id4625a783747ce2e4ebaf69a5fa3812077a79639
2020-08-20 15:04:37 +08:00
Joseph Chen e1e885d399 misc: decompress: correct size_src and size_dst usage
We misunderstood the size_src as decompressed image size.

Without this patch, the decompress can work normally, but
it wastes the time to flush data cache. Let's correct it
for thunder boot version to save boot time.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I93014ccec7814faec5abbe96b383bc1170cdb0e2
2020-08-20 15:04:37 +08:00
Elon Zhang 396e3049bd rochchip: board: only map op-tee share memory as dcache enabled
The cache fixup is for the data coherence when communication
between U-Boot and OP-TEE. And data abort exception appeares on
OP-TEE V1 32bit platform due to unknown reason.
So only the share memory need be mapped as dcache enabled.

Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
Change-Id: I92b62ef5fbdf47adc0328a14034a5861e8e77fed
2020-08-14 15:39:42 +08:00
Jon Lin 41f545b6de blk: op_flag bitwise definition
Change-Id: I99750780e1d947bfd87a7b9960da8e75a1615baa
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-08-13 09:29:03 +08:00
Jason Zhu 0f91a0406d blk: remove read_prepare()
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I1b4016bd084027540237f691f3bcc3cb7f9a1120
2020-08-11 09:11:28 +08:00
Jason Zhu 1f3b6bbf4e blk: define op_flag to handle some special block operation
Usage:
	If prepare to read & write block data, just do it like this:
		struct blk_desc desc;
		......
		desc.op_flag = BLK_PRE_RW;
		blk_dread(......);
		desc.op_flag = 0;

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I180bb7c09a7021e1f80760cc852169b3f750941d
2020-08-11 09:11:10 +08:00
Jon Lin f5a32af5a3 spi: spi-mem: Support dma transfer skip waiting idle
Change-Id: Iabe9260f4c6c7edcb885f9f9a6aa55650fdfc932
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-08-11 09:01:19 +08:00
Hisping Lin 74eb602743 lib: optee_client: update to new optee msg for optee v1 platform
optee v1 smc message is deprecated and update to new optee msg,
api revision smc call is add in init func to check capcibility.

Change-Id: Ia54a1257050b5e3776a00b6b76ca608c939bb401
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2020-08-04 14:38:23 +08:00
Joseph Chen 3e8318d739 rockchip: rv1126: remove boot_uimage command
There is no requirement of booting uimage.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ibc290af2f8a3e70e3833cad3e3e228c67e85115f
2020-07-29 15:30:53 +08:00
Joseph Chen e12dde2d59 spl: fit: support load kernel fit
Support load kernel fit image from boot/recovery partition
and ignore U-Boot proper if we expect to boot kernel in SPL.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I220c70c784e2327feea591756cbbde97ada8335f
2020-07-24 18:02:27 +08:00
Joseph Chen 656bdb598a misc: decompress: add/update API
- Support get gunzip data size from src data;
- Support sync decompress for this round;
- Support return the gunzip data size of compressed image.
- Add misc_decompress_cleanup() for waiting last decompress done.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ie84b2a6174d04592110333d66667da66f98f07f6
2020-07-24 18:02:27 +08:00
Joseph Chen 9c63328889 common: fit: update board_fit_image_post_process() args
Add more args for the function to parse more fit information.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I9be6607e5f7eb9b9912eb570f765dc6f634f956e
2020-07-24 18:02:27 +08:00
Joseph Chen 7385816b5a common: fit: add fit_image_get_comp_addr()
Add API to get compress address of image.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id33d96795d5bb5db8d55a537f7d1c7a425b5b3e8
2020-07-24 18:02:27 +08:00
Jason Zhu b693f15681 include: boot_rkimg: define system partition name
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ifaaf5c5eb6baf777ed32e28ca6e5ef382e782c11
2020-07-22 18:05:32 +08:00
Philippe Reynes 85289e9d5d UPSTREAM: rsa: add support of padding pss
We add the support of the padding pss for rsa signature.
This new padding is often recommended instead of pkcs-1.5.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 061daa0b61f0fbeb214c566f3adb23da05545320)

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I28e5722504bfd0428cd119b2aaae60682a720648
2020-07-15 10:33:36 +08:00
Philippe Reynes 219050bf6a UPSTREAM: rsa: add a structure for the padding
The rsa signature use a padding algorithm. By default, we use the
padding pkcs-1.5. In order to add some new padding algorithm, we
add a padding framework to manage several padding algorithm.
The choice of the padding is done in the file .its.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 20031567e12bb312bff95b70767f6275e20f0346)

Conflicts:
	common/image-fit.c
	lib/rsa/rsa-sign.c
	lib/rsa/rsa-verify.c

Change-Id: Ie522fec1ea69e6b86ebde0f7dad91a45670da66b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-07-15 10:33:36 +08:00
Jon Lin fc656fc366 mtd: spinand: Support xtx devices
Support XT26G01A, XT26G02A, XT26G04A, XT26G01B, XT26G02B

Change-Id: I447d83e5c5da8f6ba8515aab77a8039fe9cb2cc4
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-07-10 15:58:11 +08:00
Joseph Chen ad07c38f68 tools: mkimage: support set FIT image version
Command: "./mkimage ... -v [version]".

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I84dd5c3d7380150f428cdd0c2055929343bf2138
2020-07-09 09:23:37 +08:00
Joseph Chen e49e7bf9b1 spl: remove unused variable "rollback_index"
We prefer use "gd->rollback_index".

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I45bc64e38224064797d8d8bd89d9d3881f8793b5
2020-07-07 16:11:07 +08:00
Jon Lin 52b0060178 mtd: spinand: Support esmt devices
Support F50L1G41LB

Change-Id: I094a093fd07b6b2f924a58cf45375e214df796ce
Signed-off-by: Carl <xjxia@grandstream.cn>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-07-07 14:44:25 +08:00
Jon Lin c219aedb27 mtd: spinand: Support dosilicon devcies
Support DS35X1GA

Change-Id: Iadbda15075e54325bf5c2dffa28d560947cec627
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-07-06 19:52:24 +08:00
Algea Cao 00997ff116 edid: Move functions of sorting modes to edid.c
Not only does dw-hdmi use these functions, but others
need to use them, such as inno-hdmi.

Change-Id: I1ced6e30b7634511fecbbfb39c24ede78894dd1d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2020-07-06 19:40:40 +08:00
Algea Cao d34efd258b edid: Complete hdmi infoframe
Complete hdmi infoframe interfaces.

Change-Id: I4a5408c83d08fb13dc1123a87d9037d4d9dc96da
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2020-07-06 19:40:40 +08:00
Joseph Chen 4fe117be42 common: image-fit: add API to get "/totalsize"
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Icca5200040ab14ad76515888cdaa4cd16f554af0
2020-07-06 16:10:46 +08:00
Joseph Chen cf13b78438 rockchip: spl: add rollback index check with otp
Add rollback index check with otp, support OTP V2 only.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I640a44e55f00ac55215fa8aa3a3b63e0d75f6422
2020-06-30 13:05:49 +08:00
Joseph Chen 9db5ffeb00 common: image: add weak fit_read_otp_rollback_index()
Board should implement it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I95023ce489c4335fdd9034d9577ce242eac0f1ea
2020-06-30 12:30:23 +08:00
Joseph Chen e5ca21e884 common: fit: add more info for otp index
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I9360d3d4bc16c1c1f5e4a2310e79858d38413eb8
2020-06-30 12:24:31 +08:00
Hisping Lin df538e29bd lib: optee_client v2: support RKFS version 2
1.use get_rkss_version function to get rkss version,
  if security partition have data with rkss version 1, then
  we choice rkss version 1, if security partition is empty,
  then we choice rkss version 2
2.rkss version 2 support dual backup mechanism,
  security partition total use 1M
3.rkss version 2 R&W 256k data one time

Change-Id: I2f17b22d6a442df84be0d94a808b03465dc6fefe
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2020-06-24 11:45:46 +08:00
Hisping Lin d079c1a5ed lib: optee_client v1: support RKFS version 2
1.use get_rkss_version function to get rkss version,
  if security partition have data with rkss version 1, then
  we choice rkss version 1, if security partition is empty,
  then we choice rkss version 2
2.rkss version 2 support dual backup mechanism,
  security partition total use 1M
3.rkss version 2 R&W 256k data one time

Change-Id: I4103b6600666dffccf473ec4ed8854776a46da31
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2020-06-24 11:45:46 +08:00
Joseph Chen 986192a2bc common: image-fit: remove fit_get_image_defconf_node()
It's not a standard and nice interface, remove it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ib918c4759fa5e01393c36eccd5673b8ca754ef35
2020-06-24 11:21:14 +08:00
Joseph Chen 89d8b5fba1 include: global_data: add rollback index
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6f8a558246e8003c7124609b604c0331cec1204a
2020-06-24 11:21:14 +08:00
Joseph Chen 50454a094f dm: pmic: add "addr" field for binding children
If some child info->prefix are the same, try to
distinguish them by parent addr.

Example:
	pmic@20, pmic@1a...

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I504cd887e232bb309d8e1790f6d55910172d08b5
2020-06-23 19:30:21 +08:00
Jason Zhu 4298c19d4f misc: decompress: add function misc_decompress_process()
Use it to decompress data.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I189cded00069cc9f559097811733a481aae8d08f
2020-06-18 10:34:30 +08:00
Jason Zhu 809af6ba3d misc: rockchip_decompress: update the decompress driver
1.add DECOM_AXI_STAT to test decompress whether is in idle
2.correct the misc_decompress_is_complete return value

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Simon Xue <xxm@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I904d9909ade709fb479893325dd6c0b3d47d5908
2020-06-18 10:34:04 +08:00
Jason Zhu 47f7fd3a52 blk/mmc: add function blk_dread_prepare
This function prepares to read data without confirming completed.
We can use it to prefetch data and run other process.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I76116c25dfdb7559b80a0216c414189e85409a3e
2020-06-16 11:34:02 +08:00
Jason Zhu 55eb094f8a rockchip: rv1126: update the spl stack address
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I891e9600cffd8fd9495ef13560314b6fc8809eb7
2020-06-16 09:58:42 +08:00
Jason Zhu 6b5189e724 rockchip: rk1808: add nand flash definition
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Id7ab325059eeecb342af83cd7333cad55adb7dd6
2020-06-12 18:50:44 +08:00
Jason Zhu 2206b10747 rockchip: rk3308: enlarge CONFIG_SPL_MAX_SIZE to 0x40000
We are using DRAM offset 0~0x40000 as SPL text size, Note that BSS,
STACK and MALLOC may using separate space.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I19b5f868e8a596a627011ad127a9d34837a6c1b6
2020-06-09 11:01:59 +08:00
Joseph Chen 38b87fbc94 rv1126: configs: remove CONFIG_SUPPORT_USBPLUG wrap
Wrapping makes no sense.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I107fcb8a73438e10392511c43e17d03119b55fc0
2020-06-08 16:47:00 +08:00
Joseph Chen 8a5f71e473 spl: rkfw: get partition sector independ on outside
- clean and simplify the code.
- support a/b system and spl boot kernel.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I1adb2c1853e51a01e80d7453715ba2aabe0fc973
2020-06-08 16:23:21 +08:00
Simon Xue 3cafcfcd6f misc: rockchip_decompress: fix param size
Change-Id: Ia193a6035faff4bab66262cab2e97a3c6b94e45a
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2020-06-05 11:30:07 +08:00
Jon Lin d55257eea0 mtd: nand: Support using BBT in flash
Change-Id: I67c8859a711156d1264f783ec2749139999228f3
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Joseph Chen 371e5b63ad rv1126: common.h: set fit as 1st boot image type
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id36149c79eb0b08fbcb92bd2d55bb808a42bf9dd
2020-06-03 14:29:02 +08:00
Simon Glass 301f8dd17d UPSTREAM: mtd: Rename free() to rfree()
This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Change-Id: I2718843dd4646b7450c36e84cc16e6440c718959
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 8d38a8459b0de45f5ff41f3e11c278a5cf395fd0)
2020-06-03 10:48:53 +08:00
Joseph Chen 5cc4c624ec dm: uclass: move new uclass id to the end
This patch handles the issue in SPL:

	U-Boot SPL board initspl_early_init()
	   - found match at 'rv1126_syscon'
	   - found match at 'rv1126_syscon'
	   - found match at 'syscon'
	   - found match at 'rockchip_rv1126_pmucru'
	   - found match at 'rockchip_rv1126_cru'
	   - found match at 'ns16550_serial'
	   - found match at 'rockchip_rk3288_dw_mshc'
	   - found match at 'rk_nandc_v6'
	   - found match at 'rockchip_sfc'
	   - found match at 'spi_nand'
	   - found match at 'spi_flash_std'
	   - found match at 'rockchip_crypto_v2'
	   - found match at 'rockchip_secure_otp_v2'
	Cannot find uclass for id 36: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
	Missing uclass for driver rockchip_secure_otp_v2
	secure_otp@0xff5d0000: ret=-96
	dm_scan_fdt() failed: -96
	dm_extended_scan_dt() failed: -96
	dm_init_and_scan() returned error -96
	spl_early_init() failed: -96
	......

The root cause is drivers/misc/rockchip-secure-otp-v2.S is pre-compile
but not compile every time, it occupies the UCLASS_MISC id as 36.

There are the same situation for other otp drivers, so let's move it to
the end.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I58a2bec703c2af743d209192fefda6ff6167b01c
2020-06-03 10:24:44 +08:00
Robert Marko e0242caf53 UPSTREAM: mtd: spi-nand: Import Toshiba SPI-NAND support
Linux has good support for Toshiba SPI-NAND, so lets import it.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Tested-by: Luka Kovacic <luka.kovacic@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Change-Id: I70a328bf28c7e8740d818958faf749016dd9ca77
(cherry picked from commit 89127104848cea38bac5d40e3d6973fc203e2df6)
2020-06-03 10:08:02 +08:00
David Wu 225d510420 configs: rv1126_common: reserve 1M nocache memory
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ibc82c3dd0a19c2ae5a7997fda077f8cfea830abf
2020-06-02 17:50:16 +08:00
Ye Li 70664e19a3 UPSTREAM: net: Add eth phy generic driver for shared MDIO
For dual ethernet controllers, the HW design may connect ETH phys to
one MDIO ports. So two different ethernet drivers have to share MDIO bus.
Since two ethernet drivers are independent, we can't ensure their probe
order.

To resolve this problem, introduce an eth phy generic driver and uclass.

After eth-uclass binds, we search the mdio node and binds the phy node
with the eth-phy-generic driver.

When one eth driver get its phy device, the parent of phy device will
probe prior than phy device. So this ensure the eth driver ownes the
MDIO bus will be probed before using its MDIO.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ice83493e9e1caf3842f9ce0c129e29ad46cc0532
2020-06-02 16:10:47 +08:00
Alex Marginean 8a2d844d7d UPSTREAM: net: introduce MDIO DM class for MDIO devices
Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as
stand-alone devices.  Useful in particular for systems that support
DM_ETH and have a stand-alone MDIO hardware block shared by multiple
Ethernet interfaces.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I8e106f4360aa46289e0ed551f8f685cad9dc6269
2020-06-02 16:10:47 +08:00
Patrick Delaunay 1e8d5d80b6 UPSTREAM: net: dwc_et_qos: update weak function board_interface_eth_init
Align the board and driver prototype for board_interface_eth_init
to avoid execution issue (the interface_type parameter is defined
as int or phy_interface_t).

To have a generic weak function (it should be reused by other driver)
I change the prototype to use directly udevice.

This prototype is added in netdev.h to allow compilation check
and avoid warning when compiling with W=1 on file
board/st/stm32mp1/stm32mp1.c

warning: no previous prototype for 'board_interface_eth_init'\
[-Wmissing-prototypes]
     int board_interface_eth_init(int interface_type, ....
         ^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I7301e49ef8e51ecdde0629a69d7bcc07465952d0
2020-06-02 16:10:47 +08:00
Alex Marginean 8f873b891f UPSTREAM: net: add comments to phy APIs
Added a comment on the limitations of phy_find_by_mask API when scanning
MDIO buses with multiple PHYs present.  Added short descriptions to the
other APIs in phy.h for consistency.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ic726c545a9e2c7a68eb565e01848f6e6e9475111
2020-06-02 16:07:42 +08:00
Carlo Caione 7965f3d331 UPSTREAM: net: phy: Add generic helpers to access MMD PHY registers
Two new helper functions (phy_read_mmd() and phy_write_mmd()) are added
to allow access to the MMD PHY registers.

The MMD PHY registers can be accessed by several means:

1. Using two new MMD access function hooks in the PHY driver. These
functions can be implemented when the PHY driver does not support the
standard IEEE Compatible clause 45 access mechanism described in clause
22 or if the PHY uses its own non-standard access mechanism.

2. Direct access for C45 PHYs and C22 PHYs when accessing the reachable
DEVADs.

3. The standard clause 45 access extensions to the MMD registers through
the indirection registers (clause 22) in all the other cases.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I53a73274b6386f8a510b590a0f7ce1923f7b5528
2020-06-02 16:07:42 +08:00
Pankaj Bansal 5b8d12099d UPSTREAM: net: phy: Add clause 45 identifier to phy_device
The phy devices can be accessed via clause 22 or via clause 45.
This information can be deduced when we read phy id. if the phy id
is read without giving any MDIO Manageable Device Address (MMD), then
it conforms to clause 22. otherwise it conforms to clause 45.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Iae1c8e2414b655639c42f7098a097c6a0a1e5792
2020-06-02 16:07:42 +08:00
Priyanka Jain 296978b3f4 UPSTREAM: net/phy: Add phy-id for IN112525_S03
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ib26103a02f63a0baa0feb09a10def83097e7458b
2020-06-02 16:07:42 +08:00
Grygorii Strashko 7ef8964296 UPSTREAM: net: phy: add ofnode node to struct phy_device
Now the UCLASS_ETH device "node" field is owerwritten by some network drivers in
case of Ethernet PHYs which are linked to UCLASS_ETH device using
"phy-handle" DT property and when Ethernet PHY driver needs to read some
additional information from DT. In such cases following happens (in
general):

- network drivers
	priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
				   priv->interface);
	<-- phydev is connected to dev which is UCLASS_ETH device

	if (priv->phy_of_handle > 0)
		dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
	<-- phydev->dev->node is overwritten by phy-handle DT node

- PHY driver in .config() callback
	int node = dev_of_offset(dev);
	<-- PHY driver uses overwritten dev->node
        const void *fdt = gd->fdt_blob;

	 if (fdtdec_get_bool(fdt, node, "property"))
		...

As result, UCLASS_ETH device can't be used any more for DT accessing.

This patch adds additional ofnode node field to struct phy_device which can
be set explicitly by network drivers and used by PHY drivers, so
overwriting can be avoided. Also add helper function phy_get_ofnode()
which will check and return phy_device->node or dev_ofnode(phydev->dev) for
backward compatibility with existing drivers.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I31fcf01cfb19894bc90d198d9138c1fd3e25802e
2020-06-02 16:07:42 +08:00
Joe Hershberger 22e6d8f7d5 UPSTREAM: phy: Break include cycle
Because some phy wants to export some functions [1], export.h was
including the whole phy subsystem which pulls in lots of stuff that
causes some ordering and redefinition issues. Split out the only part
that is actually needed in export.h and include it there and in phy.h.

[1] commit 9527931507 ("board/ls2085rdb: Export functions for
			  standalone AQ FW load apps")

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I201c0c637ffd3fbba5b276ac06882d399e817511
2020-06-02 16:07:42 +08:00
Bin Meng 147c366e79 UPSTREAM: linux/mii.h: Sync with Linux kernel v4.17
This syncs U-Boot's include/linux/mii.h with Linux kernel v4.17
include/uapi/linux/mii.h.

While we are here, this also fixes some style issues.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I9e2089fc5a8d87e09b6d1470c08ddb039171b4c2
2020-06-02 16:07:42 +08:00
Fabrice Gasnier 827e2ae92e UPSTREAM: clk: add clk_valid()
Add clk_valid() to check for optional clocks are valid.
Call clk_valid() in test/dm/clk.c and add relevant test routine to
sandbox clk tests.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I78b1edea1f8ef54d3aa3f7610d39d79dd994d1bf
2020-06-02 16:07:42 +08:00
Jason Zhu 33e40bac6a mmc: dw_mmc: set DWMCI_CARDTHRCTL
Since v2.80a, dwmmc controller introduced the card write threshold for
HS200 & HS400 mode. So CardThrCtl can be supported during write operation, not
only read operation.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I7f345660107c2978d2f874d36f2dffd2acdfbcb6
2020-06-02 09:49:38 +08:00
Joseph Chen ca0130caa2 common: image-fit: correct fit_set_totalsize()
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2febc67bf0b16611cd54afad75fa79ac7454f4a5
2020-06-01 14:44:48 +08:00
Jianqun Xu 33f8d8a65e pinctrl: export pinctrl_get_pins_count as generic API
Change-Id: I0c5e4977b068a09276a1d0561058679bd1791e0a
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-05-28 19:20:09 +08:00
Joseph Chen d1ffb5dd43 rockchip: dts: rv1126: sync from kernel-4.19
from kernel-4.19:
(3bd4dd9 ARM: dts: rv1126: Add CPU idle states node.)

otp and secure-otp nodes are only defined in U-Boot.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2fcdf677bd86a477dc087d3e4986ee6cd2dfe4de
2020-05-28 19:12:02 +08:00
Jason Zhu a07b97f223 mtd: mtd_blk: map the part address if dev is mtd_blk
The blk_dread will occor error if the image is packed with multiple
firmwares, for example boot.img, when nand or spi nand have bad block.
So call mtd_blk_map_table_init to remap part address to make sure
reading correct data.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Icebc6b1c5a10758efa615424d0706b9ed6ec23ad
2020-05-26 22:13:07 +08:00
Joseph Chen c516743f40 common: fit: add fit_set_totalsize() interface
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ib10984da99aa82d5dd4bbfe2b13233e7155aee41
2020-05-25 14:57:18 +08:00
Joseph Chen f79adc89c3 rockchip: rv1126: support usbplug
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
Change-Id: I841df666100e78dda2bac4b7ce9a8495a5e4a171
2020-05-22 16:58:04 +08:00
Joseph Chen 3d8049ad2f common: add U_BOOT_CMD_ALWAYS() support
This function is used to support some special U-Boot commands with
U_BOOT_CMD_ALWAYS() declared even when CONFIG_CMDLINE is disabled.

It's used when developers requires a critial u-boot.bin by disabling
the U_BOOT_CMD() and using a simple CLI instead.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I768637592a4d85c7fea00564e96fb80f21ab65fe
2020-05-22 16:46:40 +08:00
Joseph Chen f3ff8d72ff sysmem: fix compile error
Error msg: multiple definition of `sysmem_overflow_check'.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I46de1ef35f2decfab7412c415b7f734e3459e5d9
2020-05-22 16:46:40 +08:00
Joseph Chen a3320fac15 bidram: fix compile error
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia459afb9f821fa22352615de2fd132cc43ec462e
2020-05-22 16:46:40 +08:00
Joseph Chen 869c6dc2a9 include: boot_rkimg: define more partition name
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia8c58e2acca485771ef6a2747bdcbb8326dbfebc
2020-05-22 16:39:51 +08:00
Joseph Chen d4229e7722 image: fit: export fit_image_check_hash()
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I41c5c853e9fdad0a9e64c823a68cc88fb68a7e55
2020-05-13 18:37:52 +08:00
Joseph Chen 5a157e97d5 Merge branch 'thunder-boot' into next-dev 2020-05-12 10:37:37 +08:00
Jon Lin c9e94690ba mtd: mtd_blk: Optimize map table reinitialization
Change-Id: Ie27c8a215568755857cf67444637b1d89f55bd3a
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-05-11 11:34:22 +08:00
Joseph Chen ab6f8011c4 Merge branch 'next-dev' into thunder-boot 2020-05-06 18:29:50 +08:00
Jason Zhu 1e33e3cb7c common: spl: ab: update new function to support ab system
Add spl_ab_append_part_slot()
Delete spl_get_partitions_sector()

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I116d6d708604762203974dc66a39be1a0e7b6bbe
2020-05-06 11:59:29 +08:00
Joseph Chen e9e0746f31 Merge branch 'next-dev' into thunder-boot 2020-04-27 16:54:06 +08:00
Jon Lin 85c83705f8 mtd: nand: Fix nanddev_neraseblocks()
nanddev_neraseblocks() currently returns the number pages per LUN
instead of the total number of eraseblocks.

Change-Id: Id5ec7cd7170dae28acbfa568941ffea8e8907361
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-27 14:31:17 +08:00