mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Fix W25M support
This commit is contained in:
parent
f39f8ee410
commit
39905b3b60
3 changed files with 24 additions and 4 deletions
|
@ -43,12 +43,14 @@
|
||||||
|
|
||||||
#include "flash_m25p16.h"
|
#include "flash_m25p16.h"
|
||||||
#include "flash_w25m.h"
|
#include "flash_w25m.h"
|
||||||
|
#include "flash_w25n01g.h"
|
||||||
|
|
||||||
#include "pg/flash.h"
|
#include "pg/flash.h"
|
||||||
|
|
||||||
#define W25M_INSTRUCTION_SOFTWARE_DIE_SELECT 0xC2
|
#define W25M_INSTRUCTION_SOFTWARE_DIE_SELECT 0xC2
|
||||||
|
|
||||||
#define JEDEC_ID_WINBOND_W25M512 0xEF7119 // W25Q256 x 2
|
#define JEDEC_ID_WINBOND_W25M512 0xEF7119 // W25Q256 x 2
|
||||||
|
#define JEDEC_ID_WINBOND_W25M02G 0xEFAB21 // W25N01G x 2
|
||||||
|
|
||||||
static const flashVTable_t w25m_vTable;
|
static const flashVTable_t w25m_vTable;
|
||||||
|
|
||||||
|
@ -108,6 +110,7 @@ bool w25m_detect(flashDevice_t *fdevice, uint32_t chipID)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (chipID) {
|
switch (chipID) {
|
||||||
|
#ifdef USE_FLASH_W25M512
|
||||||
case JEDEC_ID_WINBOND_W25M512:
|
case JEDEC_ID_WINBOND_W25M512:
|
||||||
// W25Q256 x 2
|
// W25Q256 x 2
|
||||||
dieCount = 2;
|
dieCount = 2;
|
||||||
|
@ -121,6 +124,23 @@ bool w25m_detect(flashDevice_t *fdevice, uint32_t chipID)
|
||||||
|
|
||||||
fdevice->geometry.flashType = FLASH_TYPE_NOR;
|
fdevice->geometry.flashType = FLASH_TYPE_NOR;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FLASH_W25M02G
|
||||||
|
case JEDEC_ID_WINBOND_W25M02G:
|
||||||
|
// W25N01G x 2
|
||||||
|
dieCount = 2;
|
||||||
|
|
||||||
|
for (int die = 0 ; die < dieCount ; die++) {
|
||||||
|
w25m_dieSelect(fdevice->io.handle.busdev, die);
|
||||||
|
dieDevice[die].io.handle.busdev = fdevice->io.handle.busdev;
|
||||||
|
dieDevice[die].io.mode = fdevice->io.mode;
|
||||||
|
w25n01g_detect(&dieDevice[die], JEDEC_ID_WINBOND_W25N01GV);
|
||||||
|
}
|
||||||
|
|
||||||
|
fdevice->geometry.flashType = FLASH_TYPE_NAND;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Not a valid W25M series device
|
// Not a valid W25M series device
|
||||||
|
@ -131,7 +151,7 @@ bool w25m_detect(flashDevice_t *fdevice, uint32_t chipID)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdevice->geometry.sectors = dieDevice[0].geometry.sectors;
|
fdevice->geometry.sectors = dieDevice[0].geometry.sectors * dieCount;
|
||||||
fdevice->geometry.sectorSize = dieDevice[0].geometry.sectorSize;
|
fdevice->geometry.sectorSize = dieDevice[0].geometry.sectorSize;
|
||||||
fdevice->geometry.pagesPerSector = dieDevice[0].geometry.pagesPerSector;
|
fdevice->geometry.pagesPerSector = dieDevice[0].geometry.pagesPerSector;
|
||||||
fdevice->geometry.pageSize = dieDevice[0].geometry.pageSize;
|
fdevice->geometry.pageSize = dieDevice[0].geometry.pageSize;
|
||||||
|
|
|
@ -50,9 +50,6 @@ serialPort_t *debugSerialPort = NULL;
|
||||||
#define DPRINTF(x)
|
#define DPRINTF(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// JEDEC ID
|
|
||||||
#define JEDEC_ID_WINBOND_W25N01GV 0xEFAA21
|
|
||||||
|
|
||||||
// Device size parameters
|
// Device size parameters
|
||||||
#define W25N01G_PAGE_SIZE 2048
|
#define W25N01G_PAGE_SIZE 2048
|
||||||
#define W25N01G_PAGES_PER_BLOCK 64
|
#define W25N01G_PAGES_PER_BLOCK 64
|
||||||
|
|
|
@ -22,4 +22,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// JEDEC ID
|
||||||
|
#define JEDEC_ID_WINBOND_W25N01GV 0xEFAA21
|
||||||
|
|
||||||
bool w25n01g_detect(flashDevice_t *fdevice, uint32_t chipID);
|
bool w25n01g_detect(flashDevice_t *fdevice, uint32_t chipID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue