software/liblitedram Fix compilation when no SDRAM.

This commit is contained in:
Florent Kermarrec 2023-01-10 10:17:10 +01:00
parent 0a36ad1f6d
commit 2d7cd7802c
3 changed files with 16 additions and 5 deletions

View File

@ -3,7 +3,7 @@
#include <liblitedram/sdram_spd.h> #include <liblitedram/sdram_spd.h>
#ifdef CONFIG_HAS_I2C #if defined(CSR_SDRAM_BASE) && defined(CONFIG_HAS_I2C)
#if defined(SDRAM_PHY_DDR4) #if defined(SDRAM_PHY_DDR4)
/* /*
@ -55,8 +55,8 @@ bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool
return ok; return ok;
} }
#else /* no CONFIG_HAS_I2C */ #else /* no CSR_SDRAM_BASE && CONFIG_HAS_I2C */
bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop) { bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop) {
return false; return false;
} }
#endif /* CONFIG_HAS_I2C */ #endif /* CSR_SDRAM_BASE && CONFIG_HAS_I2C */

View File

@ -7,6 +7,11 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <libbase/i2c.h> #include <libbase/i2c.h>
#include <generated/csr.h>
#if defined(CSR_SDRAM_BASE) && defined(CONFIG_HAS_I2C)
#include <generated/sdram_phy.h> #include <generated/sdram_phy.h>
#define SPD_RW_PREAMBLE 0b1010 #define SPD_RW_PREAMBLE 0b1010
@ -25,6 +30,8 @@
#define SDRAM_SPD_SIZE (SDRAM_SPD_PAGES * SDRAM_SPD_PAGE_SIZE) #define SDRAM_SPD_SIZE (SDRAM_SPD_PAGES * SDRAM_SPD_PAGE_SIZE)
#endif /* CSR_SDRAM_BASE && CONFIG_HAS_I2C */
bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop); bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop);
#endif /* __SDRAM_SPD_H */ #endif /* __SDRAM_SPD_H */

View File

@ -8,8 +8,6 @@
#include <libbase/i2c.h> #include <libbase/i2c.h>
#include <generated/sdram_phy.h>
#define KIB 1024 #define KIB 1024
#define MIB (KIB*1024) #define MIB (KIB*1024)
#define GIB (MIB*1024) #define GIB (MIB*1024)
@ -32,6 +30,10 @@ void print_progress(const char * header, uint64_t origin, uint64_t size)
printf(" \r"); printf(" \r");
} }
#ifdef CSR_SDRAM_BASE
#include <generated/sdram_phy.h>
uint64_t sdram_get_supported_memory(void) { uint64_t sdram_get_supported_memory(void) {
#ifdef CONFIG_HAS_I2C #ifdef CONFIG_HAS_I2C
@ -59,3 +61,5 @@ uint64_t sdram_get_supported_memory(void) {
return SDRAM_PHY_SUPPORTED_MEMORY; return SDRAM_PHY_SUPPORTED_MEMORY;
#endif /* CONFIG_HAS_I2C */ #endif /* CONFIG_HAS_I2C */
} }
#endif