gtm900b target: autodetection between MGCxGSMT and MG01GSMT hw is wrong
There exist 3 different hw variants which were all sold as GTM900-B by Huawei: MG01GSMT, MGC1GSMT and MGC2GSMT. The last of the 3 was also made with 850&1900 MHz SAW filters and sold as GTM900-P. MGC1 and MGC2 are fully firmware-compatible, but the earliest MG01GSMT has different flash size and thus different FFS location (would matter for #3582), and a different set of TSPACT signals for RFFE control. The current code in OBB uses the flash manufacturer ID (Spansion vs. Samsung) to decide which set of RFFE control signals should be used, but this logic is wrong.
To this Mother's knowledge MG01GSMT was shipped with only one flash chip type (Spansion S71PL064J), but I have personally seen 3 different flash chip types on the MGCxGSMT family:
- Spansion S71PL032J
- Samsung K5A3281CTM (same as Openmoko GTA02)
- Samsung K5L3316CAM
All 3 just-listed chips found in MGCxGSMT modules have the same 4 MiB total size and the same geometry toward the higher addresses end, and thankfully Huawei used the same FFS configuration on all 3 - but the 8 MiB chip on MG01GSMT is obviously different.
The problem with the current autodetection logic is that it assumes that Spansion flash means MG01GSMT. This logic will give the wrong answer on MGC2GSMT modules with S71PL032J flash - it is a Spansion flash chip, but the module is still an MGC2GSMT variant and needs MGCxGSMT RFFE control signals.
My approach would be to make separate gtm900mg01 and gtm900mgc fw build targets, but if you wish to continue autodetecting based on the flash chip type, you should use flash total size rather than manufacturer ID: 4 MiB means MGCxGSMT, 8 MiB means MG01GSMT.
The attached patch fixes flash-based autodetection (changes the code to look at the complete flash device ID rather than just the manufacturer ID) and adds the appropriate tiffs_init() calls for 4 MiB vs. 8 MiB flash. The latter addition is necessary for #3582.