S105: more support (#4937)

* s105: ts_name for battery input

* flash: allow one copy for devices with 512K of flash

* s105: all outputs are open drain
This commit is contained in:
Andrey G 2023-01-05 00:39:17 +03:00 committed by GitHub
parent 79104f574f
commit 9ef8a8ab69
2 changed files with 18 additions and 1 deletions

View File

@ -185,7 +185,11 @@ void writeToFlashNow(void) {
#if EFI_STORAGE_INT_FLASH == TRUE
// Flash two copies
int result1 = eraseAndFlashCopy(getFlashAddrFirstCopy(), persistentState);
int result2 = eraseAndFlashCopy(getFlashAddrSecondCopy(), persistentState);
int result2 = FLASH_RETURN_SUCCESS;
/* Only if second copy is supported */
if (getFlashAddrSecondCopy()) {
result2 = eraseAndFlashCopy(getFlashAddrSecondCopy(), persistentState);
}
// handle success/failure
isSuccess = (result1 == FLASH_RETURN_SUCCESS) && (result2 == FLASH_RETURN_SUCCESS);
@ -276,6 +280,11 @@ static FlashState readConfiguration() {
return firstCopy;
}
/* no second copy? */
if (getFlashAddrSecondCopy() == 0x0) {
return firstCopy;
}
efiPrintf("Reading second configuration copy");
return readOneConfigurationCopy(secondyCopyAddr);
#endif

View File

@ -23,11 +23,19 @@ size_t flashSectorSize(flashsector_t sector) {
return 0;
}
#define TM_ID_GetFlashSize() (*(__IO uint16_t *) (FLASHSIZE_BASE))
uintptr_t getFlashAddrFirstCopy() {
/* last 128K sector on 512K devices */
if (TM_ID_GetFlashSize() <= 512)
return 0x08060000;
return 0x080E0000;
}
uintptr_t getFlashAddrSecondCopy() {
/* no second copy on 512K devices */
if (TM_ID_GetFlashSize() <= 512)
return 0x000000000;
return 0x080C0000;
}
/*