Commit Graph

308 Commits

Author SHA1 Message Date
Jason Zhu cf432719d2 misc: rockchip-otp: support rk3568
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I21be09b06f7ac3a0f75e47e59ec094d6e254d05d
2020-12-15 16:19:19 +08:00
Jason Zhu 990fd51c55 misc: rockchip-otp: extract the difference in each chips
We use function spl_rockchip_otp_start & spl_rockchip_otp_stop to
realize the different of each chip's otps, such as mask area and
secure config.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I3b5d0377d78e5c2ed6e8ed52a89cadefc4994be1
2020-12-08 17:37:39 +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 c9f753f3de misc: rockchip decompress: use flush_dcache_all() before decompress
flush_dcache_all() operating on set/way is faster than
flush_cache() and invalidate_dcache_range() operating
on virtual address.

Tested: it saves about 12.5ms in rv1126 thunder-boot.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ie8ba42f56e72d0d554dca3949573196ef2165bd7
2020-09-02 16:35:16 +08:00
Simon Xue 5db33a7101 misc: rockchip_decompress: set default dclk to 400MHz
Change-Id: Ie64c1d7fd25ae2e570a06141c9942faeaadcc09c
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2020-08-21 14:47:29 +08:00
Joseph Chen 8353750512 misc: decompress: wait complete before stop for sync
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia70003e9fe2f27b6834324edabae095b6b9c21b7
2020-08-20 15:04:37 +08:00
Joseph Chen 9f59c154c4 misc: rockchip decompress: support invalidate dcache
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I668fc041083c1547357d0556cb483b6ab2f58b5a
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
Joseph Chen b367c66bb3 misc: rockchip decompress: add dm resets support
Using dm reset API to reset decompress module.

There seems to be some unknown cause to make the module
in abnormal state, which output the wrong decompress
data. Let's reset it before starting decompress.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ic4113eec0701f83059453fa263810d31caa406eb
2020-07-27 14:44:28 +08:00
Joseph Chen 8b225c61c2 misc: rockchip_decompress: add dcache flush
If the decompress module doesn't access the data through dcache,
it should add flush behavior to promise getting the real data
from dram. Otherwise it may decompress the wrong data but not
report any failure.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6570ca7dc3a60c4b5bb9fcf3ae9f1025e2c658ea
2020-07-24 18:02:27 +08:00
Joseph Chen adf6937910 misc: rockchip decompress: remove IRQ support
SPL don't support IRQ and U-Boot proper is not deeply care
about boot time. There is not a mechanism to support IRQ
mode now.

In addition, the decompress irq is design to catch the exceptions
but not to decompress images continuously.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I842bce530aa180d5b0a30c1d2038575e464241b8
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 01b57c0600 misc: decompress: add Kconfig option
It's used for other generic code.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I925c89d77165d781f9eff3c609eb06e2a1895a3e
2020-07-24 18:02:27 +08:00
Jason Zhu 31767fe77d misc: otp: support write rollback space several times
Naturally, otp is written by bytes and programed just one time.
Now the rollback space is written by bit and programed several times.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I964693c5067ffdedfc0990f038f6d013a49a41a8
2020-07-07 15:40:33 +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
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
Simon Xue 327380da2b misc: rockchip_decompress: add limit decompressed buffer size
In order to prevent physical memory from being written oversize,
limit the decompressed buffer size, user can assign a size to
decompress, the reserved destination buffer size is a choice

Change-Id: I8723c5ec8d58ec1d443c5607987941cf67cf1a01
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2020-06-05 09:14:02 +08:00
Joseph Chen e3d9a19ada Revert "misc: otp: re-compile the code due to the UCLASS_MISC is changed"
This reverts commit 551ae2b922.

Change-Id: Ic2723614182b8c4cf2a5433f97ce17bceac4f8dc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-06-03 10:24:41 +08:00
Jason Zhu 551ae2b922 misc: otp: re-compile the code due to the UCLASS_MISC is changed
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Icec8cf342f8cb5f0cf5bdae5644c2814a76c5860
2020-06-03 10:11:36 +08:00
Jason Zhu 94b85d035d misc: otp: use buffer to store capability
ioctl() should return error code but not data.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ica1242619ed59728acbeda7db493e5710f410a17
2020-04-24 10:23:25 +08:00
Joseph Chen dc33c23192 misc: rockchip_decompress: use buffer to store capability
ioctl() should return error code but not data.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I66eaefc64a20303400b730cc46f3814a9f050cf0
2020-04-23 16:17:06 +08:00
Joseph Chen 40f8ee7a99 misc: rockchip-efuse: implement IOCTL_REQ_CAPABILITY of ioctl()
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8ae7b1bad8a892173bee442e1163cb5872b169e5
2020-04-23 16:17:06 +08:00
Joseph Chen 374c241cf9 misc: add a common api to get device by capability
fix: ioctl() should return error code but not capability.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8030a1842692697f32f87e765ce3d68d1adb1c11
2020-04-23 16:17:06 +08:00
Joseph Chen 1cef1b20c4 dm: misc: merge generic header file into misc.h
Puting the generic function declaration together that the
caller don't need care too much about different header file.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ib37d1550e5a747d8f18e30c428ea8f613f9cc006
2020-04-23 16:17:06 +08:00
Jason Zhu 6a8fa29e04 misc: otp: realize otp interface layer function
Realize otp read & write functions for application layer calling.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ic8f698b36fce4c1c6cd7a2848afd370567b43448
2020-04-22 18:08:19 +08:00
Jason Zhu f9519410b1 misc: otp: support rockchip secure otp version 2 driver
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I10a8cc92f2130c1f1957fd36fb924d9846707e65
2020-04-22 18:08:19 +08:00
Jason Zhu 5b7d32987c drivers: misc: use misc_mode to distinguish different device
The misc attach different device. We use the misc_mode to show
different device's capability.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ibce5bb0465e452a7e783c5859f1e8ab2bfd8b0c5
2020-04-22 18:08:19 +08:00
Simon Xue 1540ca3755 misc: decompress: reset decompress before starting decompress
Change-Id: Id1031a204bb1ae4ebe5e1ea7c86b10e0d49dfd4b
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2020-04-21 09:57:34 +08:00
Jason Zhu 767409c5a6 misc: Kconfig: change the SPL_ROCKCHIP_HW_DECOMPRESS dependent's attribute
Change "depends on MISC" to "depends on SPL_MISC".

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I1b6c2296d5e88e4e2c0cbafb9bb31790d6f25e66
2020-04-20 14:52:32 +08:00
Jason Zhu cc05bcfa96 misc: decompress: realize decompress interface layer function
Realize decompress start & stop & is_complete functions for application layer
calling.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I996861e51706a9ecf97e3db53cf5fce097d9b547
2020-04-15 11:55:40 +08:00
Simon Xue 2bb8d138c1 misc: decompress: add decompress driver
Signed-off-by: Simon Xue <xxm@rock-chips.com>
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I0bffe944c54a933fd8ea48d856e6ac5da06b3b16
2020-03-02 09:19:49 +08:00
Finley Xiao 492844a318 rockchip: efuse: Add rockchip_rk3288_efuse_secure_read() for rk3288
The 256-bit and 1024-bit efuse are always secure.

Change-Id: I763a745360952991e63785bcacf0b63e859e60f8
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-01-08 15:11:32 +08:00
Jason Zhu 52ed8851b8 misc: rockchip-otp: support read & write secure otp
support chip: rk3308

Change-Id: I7daeaab16495d17bd75994de94dc19ed18eca21e
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-23 09:16:14 +08:00
Jason Zhu bc94d10207 misc: add tpl misc compile support
Separate the tpl compile with spl compile.

Change-Id: I01e6005fbc9fc49cc0fe6b357a4f15b35f591944
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-23 09:15:36 +08:00
Jason Zhu 06536c203f misc: add spl misc support
Change-Id: I77de161aaaa6490aeb8a5a8c3f9dfdc5c65f3f71
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-21 12:58:49 +08:00
Jason Zhu 6e12c1dd66 rockchip: otp: move some definition to header file
Change-Id: I82b4afe1adbb5f91f3b3146c3cad14e2873b93c3
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-21 12:58:49 +08:00
Jason Zhu 95e4d4078e misc: rockchip efuse & otp: remove the cmd code from driver file
Change-Id: I3c1f89a92770d69234cf0fdc6811b05fa275f262
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-21 12:58:49 +08:00
Masahiro Yamada f1ba13f8e2 UPSTREAM: libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
  include/libfdt.h         -> include/linux/libfdt.h
  include/libfdt_env.h     -> include/linux/libfdt_env.h

and replaces include directives:
  #include <libfdt.h>      -> #include <linux/libfdt.h>
  #include <libfdt_env.h>  -> #include <linux/libfdt_env.h>

Change-Id: I68fd5734d6460c169fa5ee2893c57cb5d73340b6
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit b08c8c4870831c9315dcae237772238e80035bd5)
2019-07-05 19:33:35 +08:00
Finley Xiao 6be53b633a rockchip: otp: Add support for RK3308
Change-Id: I44391e0f039b1bd347124e90aad67a936ade2f99
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-29 18:26:05 +08:00
Finley Xiao 4973d825b8 rockchip: otp: Add (misc) driver for PX30 non-secure OTP block
This adds a simple driver for reading the OTP block of the PX30.

Change-Id: Ic2c0f4b0886808af87c826e8d0045e5d440521f7
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-29 18:26:05 +08:00
Finley Xiao b13cc84cd1 rockchip: efuse: support rk1808 non-secure efuse
Change-Id: I2a7cc8306c5ea45c5586b036cbc13eaa153e4227
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-29 18:26:05 +08:00
Kever Yang 10e7f377e4 misc: i2c_eeprom: use separate config for spl and tpl
We may not need I2C_EEPROM in SPL and TPL.

Change-Id: I8e8ded63601b791d12d6531dd958121b87e9231d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-11-19 15:15:57 +08:00
Joseph Chen 59a83996bc rockchip: efuse: support rk3328 non-secure efuse
Change-Id: Ie74764ef946b79c2e9f73e9082c1cb8bbc288abb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Masahiro Yamada 90aa625c9a treewide: replace with error() with pr_err()
U-Boot widely uses error() as a bit noisier variant of printf().

This macro causes name conflict with the following line in
include/linux/compiler-gcc.h:

  # define __compiletime_error(message) __attribute__((error(message)))

This prevents us from using __compiletime_error(), and makes it
difficult to fully sync BUILD_BUG macros with Linux.  (Notice
Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

Let's convert error() into now treewide-available pr_err().

Done with the help of Coccinelle, excluing tools/ directory.

The semantic patch I used is as follows:

// <smpl>
@@@@
-error
+pr_err
 (...)
// </smpl>

Change-Id: I921807c1770d36a91e692c48ab477558bb2ed0b8
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Re-run Coccinelle]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9b643e312d528f291966c1f30b0d90bf3b1d43dc)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 63a453e638 UPSTREAM: rockchip: efuse: change to use dev_read_addr_ptr
With the dev_read_addr_ptr function available, we can change the
efuse driver to use it (and eliminate the explicit type-cast).

Change-Id: I8183492892b77c8c6260070cee3104060e273c31
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit f6230a00579d5ca5ba01ca158f5c369cf64e87eb)
2018-01-16 18:16:48 +08:00
Simon Glass 17c82fdc12 UPSTREAM: dm: core: Add ofnode_for_each_subnode()
Add a convenience macro to iterate over subnodes of a node. Make use of
this where appropriate in the code.

Change-Id: Iae0fb554472d0b5819d26becbbcf8909ff891514
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3991f42ed2e38aff28ba3c24369bfbd90620bea7)
2018-01-16 18:13:59 +08:00
Cody Xie e9cfb932f9 rockchip: efuse: Fix compile warning.
Change-Id: I57b331c0e2bdc713c60e1f636b66a11cdf3ef015
Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
(cherry picked from commit d3f8f6517e8b2073aff51d6a35528baeb35d2153)
2017-11-22 10:43:50 +08:00
Francis Fan b4fa32f0b6 rockchip: efuse: Support rk322x non-secure efuse.
Change-Id: Ia25df975d21d7c97cf090f0d374074c2c5cd1a58
Signed-off-by: Francis Fan <francis.fan@rock-chips.com>
Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
2017-11-20 10:29:56 +08:00
Adam Ford e3f24d4f2c Kconfig: Add EEPROM options to Kconfig when I2C_EEPROM is set
Add the following options to drivers/misc/Kconfig:
	SYS_I2C_EEPROM_ADDR
	SYS_I2C_EEPROM_BUS
	SYS_EEPROM_SIZE
	SYS_EEPROM_PAGE_WRITE_BITS
	SYS_EEPROM_PAGE_WRITE_DELAY_MS
	SYS_I2C_EEPROM_ADDR_LEN
	SYS_I2C_EEPROM_ADDR_OVERFLOW

This does not migrate any boards, but provides a foundations for
those who want/need these options

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Migrate uniphier]
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-09-02 15:50:30 -04:00