Merge branch 'next-dev' into thunder-boot
This commit is contained in:
commit
2bc8e1106f
|
|
@ -110,7 +110,12 @@ static inline void mmu_setup(void)
|
|||
int i;
|
||||
u32 reg;
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
/* bootrom and ddr didn't initial dcache,
|
||||
* skip this to save boot time.
|
||||
*/
|
||||
arm_init_before_mmu();
|
||||
#endif
|
||||
/* Set up an identity-mapping for all 4GB, rw for everyone */
|
||||
for (i = 0; i < ((4096ULL * 1024 * 1024) >> MMU_SECTION_SHIFT); i++)
|
||||
set_section_dcache(i, DCACHE_OFF);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <misc.h>
|
||||
#include <misc_decompress.h>
|
||||
#include <spl.h>
|
||||
#include <spl_rkfw.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-$(CONFIG_$(SPL_TPL_)MISC) += misc-uclass.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)MISC) += misc-uclass.o misc_decompress.o misc_otp.o
|
||||
obj-$(CONFIG_ALI152X) += ali512x.o
|
||||
obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
|
||||
obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
|
||||
|
|
@ -56,4 +56,3 @@ obj-$(CONFIG_ROCKCHIP_OTP) += rockchip-otp.o
|
|||
obj-$(CONFIG_$(SPL_TPL_)ROCKCHIP_SECURE_OTP) += rockchip-secure-otp.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ROCKCHIP_SECURE_OTP_V2) += rockchip-secure-otp-v2.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ROCKCHIP_HW_DECOMPRESS) += rockchip_decompress.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)MISC) += misc_decompress.o misc_otp.o
|
||||
|
|
|
|||
|
|
@ -56,6 +56,33 @@ int misc_call(struct udevice *dev, int msgid, void *tx_msg, int tx_size,
|
|||
return ops->call(dev, msgid, tx_msg, tx_size, rx_msg, rx_size);
|
||||
}
|
||||
|
||||
struct udevice *misc_get_device_by_capability(u32 capability)
|
||||
{
|
||||
const struct misc_ops *ops;
|
||||
struct udevice *dev;
|
||||
struct uclass *uc;
|
||||
int ret;
|
||||
u32 cap;
|
||||
|
||||
ret = uclass_get(UCLASS_MISC, &uc);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
for (uclass_first_device(UCLASS_MISC, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
ops = device_get_ops(dev);
|
||||
if (!ops || !ops->ioctl)
|
||||
continue;
|
||||
|
||||
ret = ops->ioctl(dev, IOCTL_REQ_CAPABILITY, &cap);
|
||||
if (!ret && ((cap & capability) == capability))
|
||||
return dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(misc) = {
|
||||
.id = UCLASS_MISC,
|
||||
.name = "misc",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <dm.h>
|
||||
#include <dm/uclass.h>
|
||||
#include <misc.h>
|
||||
#include <misc_decompress.h>
|
||||
|
||||
#define HEAD_CRC 2
|
||||
#define EXTRA_FIELD 4
|
||||
|
|
@ -45,29 +44,7 @@ static int misc_gzip_parse_header(const unsigned char *src, unsigned long len)
|
|||
|
||||
struct udevice *misc_decompress_get_device(u32 capability)
|
||||
{
|
||||
const struct misc_ops *ops;
|
||||
struct udevice *dev;
|
||||
struct uclass *uc;
|
||||
int ret;
|
||||
u32 cap;
|
||||
|
||||
ret = uclass_get(UCLASS_MISC, &uc);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
for (uclass_first_device(UCLASS_MISC, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
ops = device_get_ops(dev);
|
||||
if (!ops || !ops->ioctl)
|
||||
continue;
|
||||
|
||||
cap = ops->ioctl(dev, IOCTL_REQ_CAPABILITY, NULL);
|
||||
if ((cap & capability) == capability)
|
||||
return dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return misc_get_device_by_capability(capability);
|
||||
}
|
||||
|
||||
int misc_decompress_start(struct udevice *dev, unsigned long src,
|
||||
|
|
|
|||
|
|
@ -10,29 +10,7 @@
|
|||
|
||||
struct udevice *misc_otp_get_device(u32 capability)
|
||||
{
|
||||
const struct misc_ops *ops;
|
||||
struct udevice *dev;
|
||||
struct uclass *uc;
|
||||
int ret;
|
||||
u32 cap;
|
||||
|
||||
ret = uclass_get(UCLASS_MISC, &uc);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
for (uclass_first_device(UCLASS_MISC, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
ops = device_get_ops(dev);
|
||||
if (!ops || !ops->ioctl)
|
||||
continue;
|
||||
|
||||
cap = ops->ioctl(dev, IOCTL_REQ_CAPABILITY, NULL);
|
||||
if ((cap & capability) == capability)
|
||||
return dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return misc_get_device_by_capability(capability);
|
||||
}
|
||||
|
||||
int misc_otp_read(struct udevice *dev, int offset, void *buf, int size)
|
||||
|
|
|
|||
|
|
@ -378,8 +378,31 @@ static int rockchip_efuse_read(struct udevice *dev, int offset,
|
|||
return (*efuse_read)(dev, offset, buf, size);
|
||||
}
|
||||
|
||||
static int rockchip_efuse_capatiblity(struct udevice *dev, u32 *buf)
|
||||
{
|
||||
*buf = device_is_compatible(dev, "rockchip,rk3288-secure-efuse") ?
|
||||
OTP_S : OTP_NS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_efuse_ioctl(struct udevice *dev, unsigned long request,
|
||||
void *buf)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
switch (request) {
|
||||
case IOCTL_REQ_CAPABILITY:
|
||||
ret = rockchip_efuse_capatiblity(dev, buf);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct misc_ops rockchip_efuse_ops = {
|
||||
.read = rockchip_efuse_read,
|
||||
.ioctl = rockchip_efuse_ioctl,
|
||||
};
|
||||
|
||||
static int rockchip_efuse_ofdata_to_platdata(struct udevice *dev)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <dm.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <misc.h>
|
||||
#include <misc_decompress.h>
|
||||
#include <irq-generic.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
|
@ -144,9 +143,11 @@ static int rockchip_decom_done_poll(struct udevice *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int rockchip_decom_ability(void)
|
||||
static int rockchip_decom_capability(u32 *buf)
|
||||
{
|
||||
return DECOM_GZIP;
|
||||
*buf = DECOM_GZIP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Caller must fill in param @buf which represent struct decom_param */
|
||||
|
|
@ -166,7 +167,7 @@ static int rockchip_decom_ioctl(struct udevice *dev, unsigned long request,
|
|||
ret = rockchip_decom_stop(dev);
|
||||
break;
|
||||
case IOCTL_REQ_CAPABILITY:
|
||||
ret = rockchip_decom_ability();
|
||||
ret = rockchip_decom_capability(buf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,17 @@ int misc_ioctl(struct udevice *dev, unsigned long request, void *buf);
|
|||
int misc_call(struct udevice *dev, int msgid, void *tx_msg, int tx_size,
|
||||
void *rx_msg, int rx_size);
|
||||
|
||||
/*
|
||||
* Get a misc device by capability
|
||||
*
|
||||
* The caller can get a misc device according to capability request, the driver
|
||||
* must implement the IOCTL_REQ_CAPABILITY callback.
|
||||
*
|
||||
* @capability: the value of enum misc_mode.
|
||||
* @return the require device if OK, NULL on error
|
||||
*/
|
||||
struct udevice *misc_get_device_by_capability(u32 capability);
|
||||
|
||||
/*
|
||||
* struct misc_ops - Driver model Misc operations
|
||||
*
|
||||
|
|
@ -129,4 +140,23 @@ struct misc_ops {
|
|||
void *rx_msg, int rx_size);
|
||||
};
|
||||
|
||||
/* generic layer for otp */
|
||||
struct udevice *misc_otp_get_device(u32 capability);
|
||||
int misc_otp_read(struct udevice *dev, int offset, void *buf, int size);
|
||||
int misc_otp_write(struct udevice *dev, int offset, const void *buf, int size);
|
||||
|
||||
/* generic layer for decompress */
|
||||
struct decom_param {
|
||||
unsigned long addr_src;
|
||||
unsigned long addr_dst;
|
||||
unsigned long size;
|
||||
enum misc_mode mode;
|
||||
};
|
||||
|
||||
struct udevice *misc_decompress_get_device(u32 capability);
|
||||
int misc_decompress_start(struct udevice *dev, unsigned long src,
|
||||
unsigned long dst, unsigned long size);
|
||||
int misc_decompress_stop(struct udevice *dev);
|
||||
int misc_decompress_is_complete(struct udevice *dev);
|
||||
|
||||
#endif /* _MISC_H_ */
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* (C) Copyright 2020 Rockchip Electronics Co., Ltd
|
||||
*/
|
||||
|
||||
#ifndef _MISC_DECOMPRESS_H_
|
||||
#define _MISC_DECOMPRESS_H_
|
||||
|
||||
struct decom_param {
|
||||
unsigned long addr_src;
|
||||
unsigned long addr_dst;
|
||||
unsigned long size;
|
||||
enum misc_mode mode;
|
||||
};
|
||||
|
||||
struct udevice *misc_decompress_get_device(u32 capability);
|
||||
int misc_decompress_start(struct udevice *dev, unsigned long src,
|
||||
unsigned long dst, unsigned long size);
|
||||
int misc_decompress_stop(struct udevice *dev);
|
||||
int misc_decompress_is_complete(struct udevice *dev);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* (C) Copyright 2020 Rockchip Electronics Co., Ltd
|
||||
*/
|
||||
|
||||
#ifndef __MISC_OTP_H__
|
||||
#define __MISC_OTP_H__
|
||||
|
||||
struct udevice *misc_otp_get_device(u32 capability);
|
||||
int misc_otp_read(struct udevice *dev, int offset, void *buf, int size);
|
||||
int misc_otp_write(struct udevice *dev, int offset, const void *buf, int size);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue