UPSTREAM: soc/mediatek/common/emi: Cache SDRAM size

Optimize the `sdram_size` function by caching the calculated SDRAM
size in a static variable. This prevents redundant calls to
`mtk_dram_size()` or `mem_chip_info_total_density_bytes()` if the size
has already been determined, improving performance in scenarios where
`sdram_size` is called multiple times.

BUG=none
TEST=emerege-tanjiro coreboot

(cherry picked from commit 1e8cea55a068ae5f4f1bd9bf48bfd75b24962094)

Original-Change-Id: I0ca0df80ee9cb781a5bb6d55ee28a2c1153be0ad
Original-Signed-off-by: Yidi Lin <[email protected]>
Original-Reviewed-on: https://review.coreboot.org/c/coreboot/+/90485
Original-Reviewed-by: Yu-Ping Wu <[email protected]>
Original-Tested-by: build bot (Jenkins) <[email protected]>
Original-Reviewed-by: Hung-Te Lin <[email protected]>
GitOrigin-RevId: 1e8cea55a068ae5f4f1bd9bf48bfd75b24962094
Cr-Build-Id: 8695571093982353777
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8695571093982353777
Copybot-Job-Name: coreboot-main-copybot-downstream
Change-Id: I96029d7ed17e5b48ad3135c6ac3280c726979df5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/7258059
Tested-by: ChromeOS Copybot <[email protected]>
Commit-Queue: ChromeOS Copybot <[email protected]>
Bot-Commit: ChromeOS Copybot <[email protected]>
1 file changed