diff options
author | Jonas Karlman <jonas@kwiboo.se> | 2023-02-22 22:44:40 +0000 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2023-02-28 18:07:28 +0800 |
commit | 16e8afa802ebc3869c99d57186720476f3affd6b (patch) | |
tree | 023c6486ae7862896442f6991f3c165d1a0fca19 | |
parent | b0828cf98901c993f7a88ef8f5b7f97a1c0c5d51 (diff) | |
download | u-boot-16e8afa802ebc3869c99d57186720476f3affd6b.zip u-boot-16e8afa802ebc3869c99d57186720476f3affd6b.tar.gz u-boot-16e8afa802ebc3869c99d57186720476f3affd6b.tar.bz2 |
rockchip: efuse: Add support for RK3128
Add support for rk3128 compatible.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
-rw-r--r-- | drivers/misc/rockchip-efuse.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/misc/rockchip-efuse.c b/drivers/misc/rockchip-efuse.c index 8cf61e3..bc73fd3 100644 --- a/drivers/misc/rockchip-efuse.c +++ b/drivers/misc/rockchip-efuse.c @@ -18,6 +18,9 @@ #include <misc.h> #define EFUSE_CTRL 0x0000 +#define RK3128_A_SHIFT 7 +#define RK3128_A_MASK GENMASK(15, 7) +#define RK3128_ADDR(n) ((n) << RK3128_A_SHIFT) #define RK3288_A_SHIFT 6 #define RK3288_A_MASK GENMASK(15, 6) #define RK3288_ADDR(n) ((n) << RK3288_A_SHIFT) @@ -83,6 +86,33 @@ U_BOOT_CMD( ); #endif +static int rockchip_rk3128_efuse_read(struct udevice *dev, int offset, + void *buf, int size) +{ + struct rockchip_efuse_plat *efuse = dev_get_plat(dev); + u8 *buffer = buf; + + /* Switch to read mode */ + writel(EFUSE_LOAD, efuse->base + EFUSE_CTRL); + udelay(2); + + while (size--) { + clrsetbits_le32(efuse->base + EFUSE_CTRL, RK3128_A_MASK, + RK3128_ADDR(offset++)); + udelay(2); + setbits_le32(efuse->base + EFUSE_CTRL, EFUSE_STROBE); + udelay(2); + *buffer++ = (u8)(readl(efuse->base + EFUSE_DOUT) & 0xFF); + clrbits_le32(efuse->base + EFUSE_CTRL, EFUSE_STROBE); + udelay(2); + } + + /* Switch to inactive mode */ + writel(0x0, efuse->base + EFUSE_CTRL); + + return 0; +} + static int rockchip_rk3288_efuse_read(struct udevice *dev, int offset, void *buf, int size) { @@ -211,6 +241,11 @@ static int rockchip_efuse_of_to_plat(struct udevice *dev) return 0; } +static const struct rockchip_efuse_data rk3128_data = { + .read = rockchip_rk3128_efuse_read, + .size = 0x40, +}; + static const struct rockchip_efuse_data rk3288_data = { .read = rockchip_rk3288_efuse_read, .size = 0x20, @@ -235,6 +270,10 @@ static const struct udevice_id rockchip_efuse_ids[] = { .data = (ulong)&rk3288_data, }, { + .compatible = "rockchip,rk3128-efuse", + .data = (ulong)&rk3128_data, + }, + { .compatible = "rockchip,rk3188-efuse", .data = (ulong)&rk3288_data, }, |