From 9e597927cab51c7a6b3cb5a896065f5951a2f637 Mon Sep 17 00:00:00 2001 From: SamulKyull Date: Thu, 1 May 2025 11:10:02 +0800 Subject: [PATCH 1/3] [chip] add chip a537 a333 --- chips/a537_a333.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++ fel.c | 2 + 2 files changed, 100 insertions(+) create mode 100644 chips/a537_a333.c diff --git a/chips/a537_a333.c b/chips/a537_a333.c new file mode 100644 index 0000000..aafa0af --- /dev/null +++ b/chips/a537_a333.c @@ -0,0 +1,98 @@ +#include + +static int chip_detect(struct xfel_ctx_t * ctx, uint32_t id) +{ + if(id == 0x00191900) + return 1; + return 0; +} + +static uint32_t payload_read32(struct xfel_ctx_t * ctx, uint32_t addr) +{ + static const uint8_t payload[] = { + 0x00, 0x00, 0xa0, 0xe3, 0x17, 0x0f, 0x08, 0xee, 0x15, 0x0f, 0x07, 0xee, + 0xd5, 0x0f, 0x07, 0xee, 0x9a, 0x0f, 0x07, 0xee, 0x95, 0x0f, 0x07, 0xee, + 0xff, 0xff, 0xff, 0xea, 0x0c, 0x00, 0x9f, 0xe5, 0x0c, 0x10, 0x8f, 0xe2, + 0x00, 0x20, 0x90, 0xe5, 0x00, 0x20, 0x81, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, + }; + uint32_t adr = cpu_to_le32(addr); + uint32_t val; + + fel_write(ctx, ctx->version.scratchpad, (void *)payload, sizeof(payload)); + fel_write(ctx, ctx->version.scratchpad + sizeof(payload), (void *)&adr, sizeof(adr)); + fel_exec(ctx, ctx->version.scratchpad); + fel_read(ctx, ctx->version.scratchpad + sizeof(payload) + sizeof(adr), (void *)&val, sizeof(val)); + return le32_to_cpu(val); +} + +static void payload_write32(struct xfel_ctx_t * ctx, uint32_t addr, uint32_t val) +{ + static const uint8_t payload[] = { + 0x00, 0x00, 0xa0, 0xe3, 0x17, 0x0f, 0x08, 0xee, 0x15, 0x0f, 0x07, 0xee, + 0xd5, 0x0f, 0x07, 0xee, 0x9a, 0x0f, 0x07, 0xee, 0x95, 0x0f, 0x07, 0xee, + 0xff, 0xff, 0xff, 0xea, 0x08, 0x00, 0x9f, 0xe5, 0x08, 0x10, 0x9f, 0xe5, + 0x00, 0x10, 0x80, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, + }; + uint32_t params[2] = { + cpu_to_le32(addr), + cpu_to_le32(val), + }; + + fel_write(ctx, ctx->version.scratchpad, (void *)payload, sizeof(payload)); + fel_write(ctx, ctx->version.scratchpad + sizeof(payload), (void *)params, sizeof(params)); + fel_exec(ctx, ctx->version.scratchpad); +} + +static int chip_reset(struct xfel_ctx_t * ctx) +{ + return 0; +} + +static int chip_sid(struct xfel_ctx_t * ctx, char * sid) +{ + uint32_t id[4]; + + id[0] = payload_read32(ctx, 0x03006200 + 0x0); + id[1] = payload_read32(ctx, 0x03006200 + 0x4); + id[2] = payload_read32(ctx, 0x03006200 + 0x8); + id[3] = payload_read32(ctx, 0x03006200 + 0xc); + sprintf(sid, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]); + return 1; +} + +static int chip_jtag(struct xfel_ctx_t * ctx) +{ + return 0; +} + +static int chip_ddr(struct xfel_ctx_t * ctx, const char * type) +{ + return 0; +} + +static int chip_spi_init(struct xfel_ctx_t * ctx, uint32_t * swapbuf, uint32_t * swaplen, uint32_t * cmdlen) +{ + return 0; +} + +static int chip_spi_run(struct xfel_ctx_t * ctx, uint8_t * cbuf, uint32_t clen) +{ + return 0; +} + +static int chip_extra(struct xfel_ctx_t * ctx, int argc, char * argv[]) +{ + return 0; +} + +struct chip_t a537_a333 = { + .name = "A537/A333", + .detect = chip_detect, + .reset = chip_reset, + .sid = chip_sid, + .jtag = chip_jtag, + .ddr = chip_ddr, + .spi_init = chip_spi_init, + .spi_run = chip_spi_run, + .extra = chip_extra, +}; diff --git a/fel.c b/fel.c index ad8e7a1..8c7b33c 100644 --- a/fel.c +++ b/fel.c @@ -30,6 +30,7 @@ extern struct chip_t v851_v853; extern struct chip_t v821; extern struct chip_t a733; extern struct chip_t t536; +extern struct chip_t a537_a333; static struct chip_t * chips[] = { @@ -63,6 +64,7 @@ static struct chip_t * chips[] = { &v821, &a733, &t536, + &a537_a333, }; struct usb_request_t { From 363eaceb3fb4773311f0ba2200ae7c7406388382 Mon Sep 17 00:00:00 2001 From: SamulKyull Date: Sat, 21 Jun 2025 21:32:45 +0800 Subject: [PATCH 2/3] [chip] add chip h135 --- chips/h135.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fel.c | 2 ++ 2 files changed, 57 insertions(+) create mode 100644 chips/h135.c diff --git a/chips/h135.c b/chips/h135.c new file mode 100644 index 0000000..da7742b --- /dev/null +++ b/chips/h135.c @@ -0,0 +1,55 @@ +#include + +static int chip_detect(struct xfel_ctx_t * ctx, uint32_t id) +{ + if(id == 0x00192100) + return 1; + return 0; +} + +static int chip_reset(struct xfel_ctx_t * ctx) +{ + return 0; +} + +static int chip_sid(struct xfel_ctx_t * ctx, char * sid) +{ + return 0; +} + +static int chip_jtag(struct xfel_ctx_t * ctx) +{ + return 0; +} + +static int chip_ddr(struct xfel_ctx_t * ctx, const char * type) +{ + return 0; +} + +static int chip_spi_init(struct xfel_ctx_t * ctx, uint32_t * swapbuf, uint32_t * swaplen, uint32_t * cmdlen) +{ + return 0; +} + +static int chip_spi_run(struct xfel_ctx_t * ctx, uint8_t * cbuf, uint32_t clen) +{ + return 0; +} + +static int chip_extra(struct xfel_ctx_t * ctx, int argc, char * argv[]) +{ + return 0; +} + +struct chip_t h135 = { + .name = "H135", + .detect = chip_detect, + .reset = chip_reset, + .sid = chip_sid, + .jtag = chip_jtag, + .ddr = chip_ddr, + .spi_init = chip_spi_init, + .spi_run = chip_spi_run, + .extra = chip_extra, +}; diff --git a/fel.c b/fel.c index 8c7b33c..147b395 100644 --- a/fel.c +++ b/fel.c @@ -31,6 +31,7 @@ extern struct chip_t v821; extern struct chip_t a733; extern struct chip_t t536; extern struct chip_t a537_a333; +extern struct chip_t h135; static struct chip_t * chips[] = { @@ -65,6 +66,7 @@ static struct chip_t * chips[] = { &a733, &t536, &a537_a333, + &h135, }; struct usb_request_t { From 1d19db03f06c689e010244b89cbad978dd933a80 Mon Sep 17 00:00:00 2001 From: Jiang Jianjun <8192542@qq.com> Date: Sun, 13 Jul 2025 10:43:46 +0800 Subject: [PATCH 3/3] [v821]remove oem-program-secure efuse area --- chips/v821.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chips/v821.c b/chips/v821.c index 64015ef..b64074a 100644 --- a/chips/v821.c +++ b/chips/v821.c @@ -1588,7 +1588,7 @@ static const struct sid_section_t { { "nv1", 0x00d0, 32 }, { "nv2", 0x00d4, 32 }, { "reserved3", 0x00d8, 96 }, - { "oem-program-secure", 0x00e4, 224 }, + //{ "oem-program-secure", 0x00e4, 224 }, /* Don't support dump, why? */ }; static int chip_extra(struct xfel_ctx_t * ctx, int argc, char * argv[])