Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/hal/fh.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static sensor_addr_t fh_possible_i2c_addrs[] = {
bool fh_detect_cpu(char *chip_name) {

char buf[256];
uint32_t sysctrl, ipver, reg;
uint32_t sysctrl, ipver, chipinfo = 0, reg;
unsigned int chip_id = 0;

if (!line_from_file("/proc/cpuinfo", "Hardware.+: ([a-zA-Z0-9-]+)", buf,
Expand Down Expand Up @@ -96,7 +96,9 @@ bool fh_detect_cpu(char *chip_name) {
}
break;
case 0x20031601:
switch (ipver & 0xc) {
/* mach-fh/fh_chipid.c reads the FH865x package from CHIP_INFO */
mem_reg(REG_PMU_CHIP_INFO, &chipinfo, OP_READ);
Comment on lines +99 to +100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Fh8632 packages remain unknown 📘 Rule violation ≡ Correctness

fh_detect_cpu() still derives FH8632 and FH8632v2 from ipver, while the required package value
is in the PMU SPC_IO_STATUS register. When the chip ID is 0x46488302, the unchanged IP_VER
mask can leave chip_name unset, so both package names remain unidentified even though the new
register handling is present for FH865x only.
Agent Prompt
## Issue description
FH8632 and FH8632v2 package detection still reads `IP_VER`, but the vendor implementation reads PMU `SPC_IO_STATUS` at offset `0x054` and masks bits 5:0. As a result, the `0x46488302` path can leave the package name unset.

## Fix Focus Areas
- src/hal/fh.c[88-95]
- src/hal/fh.h[8-12]

## Recommended Fix
Define the PMU `SPC_IO_STATUS` register address and read it in the `0x46488302` branch before applying the vendor’s `0x3f` mask, while retaining the existing FH865x `CHIP_INFO` handling separately.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

switch (chipinfo & 0xc) {
case 0xc:
strcpy(chip_name, "FH8652");
break;
Expand Down
1 change: 1 addition & 0 deletions src/hal/fh.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define REG_PMU_IP_VER (PMU_REG_BASE + 0x0004)
#define REG_PMU_FW_VER (PMU_REG_BASE + 0x0008)
#define REG_PMU_SYS_CTRL (PMU_REG_BASE + 0x000c)
#define REG_PMU_CHIP_INFO (PMU_REG_BASE + 0x033c)

/* chip_generation for the parts hal/fh_padmux.c has a pad table for, and the
* two it knows it has none for. "FH", the model, and a last nibble for the
Expand Down
Loading