From bf6f13a2b0a185e935b8554e41317ab471a4c0ec Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 23 Oct 2023 00:37:27 +0100 Subject: [PATCH] Consolidate some EEPROM Driver configuration (#22321) --- docs/eeprom_driver.md | 8 ++++++++ drivers/eeprom/eeprom_spi.h | 12 ++++++++++++ keyboards/custommk/evo70_r2/config.h | 1 + keyboards/rgbkb/mun/keymaps/default/config.h | 2 -- keyboards/rgbkb/mun/keymaps/via/config.h | 2 -- keyboards/rgbkb/sol3/keymaps/default/config.h | 3 --- keyboards/rgbkb/sol3/keymaps/via/config.h | 3 --- keyboards/tau4/config.h | 9 --------- keyboards/tzarc/djinn/rev1/config.h | 3 +-- keyboards/tzarc/djinn/rev2/config.h | 3 +-- keyboards/tzarc/ghoul/config.h | 3 +-- keyboards/vinhcatba/uncertainty/config.h | 6 +----- keyboards/xelus/kangaroo/rev1/config.h | 3 --- keyboards/xelus/pachi/rgb/rev1/config.h | 3 --- keyboards/xelus/rs108/config.h | 9 +-------- keyboards/xelus/rs60/rev2_0/config.h | 9 +-------- keyboards/xelus/valor/rev2/config.h | 3 --- keyboards/xelus/valor_frl_tkl/rev1/config.h | 6 ------ keyboards/xelus/xs108/config.h | 3 --- keyboards/xelus/xs60/hotswap/config.h | 3 --- platforms/chibios/boards/BONSAI_C4/configs/config.h | 4 +--- 21 files changed, 28 insertions(+), 70 deletions(-) diff --git a/docs/eeprom_driver.md b/docs/eeprom_driver.md index 34b6f51cbe..c77d18c68d 100644 --- a/docs/eeprom_driver.md +++ b/docs/eeprom_driver.md @@ -66,6 +66,14 @@ Currently QMK supports 25xx-series chips over SPI. As such, requires a working s `#define EXTERNAL_EEPROM_PAGE_SIZE` | `32` | Page size of the EEPROM in bytes, as specified in the datasheet `#define EXTERNAL_EEPROM_ADDRESS_SIZE` | `2` | The number of bytes to transmit for the memory location within the EEPROM +Default values and extended descriptions can be found in `drivers/eeprom/eeprom_spi.h`. + +Alternatively, there are pre-defined hardware configurations for available chips/modules: + +Module | Equivalent `#define` | Source +-----------------|---------------------------------|------------------------------------------ +MB85RS64V FRAM | `define EEPROM_SPI_MB85RS64V` | + !> There's no way to determine if there is an SPI EEPROM actually responding. Generally, this will result in reads of nothing but zero. ## Transient Driver configuration :id=transient-eeprom-driver-configuration diff --git a/drivers/eeprom/eeprom_spi.h b/drivers/eeprom/eeprom_spi.h index 282c603565..6a21d5516b 100644 --- a/drivers/eeprom/eeprom_spi.h +++ b/drivers/eeprom/eeprom_spi.h @@ -16,6 +16,18 @@ #pragma once +/* + Default device configurations: + + For the Adafruit SPI Non-Volatile FRAM Breakout: https://www.adafruit.com/product/1897 + #define EEPROM_SPI_MB85RS64V +*/ +#if defined(EEPROM_SPI_MB85RS64V) +# define EXTERNAL_EEPROM_BYTE_COUNT 8192 +# define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer +# define EXTERNAL_EEPROM_ADDRESS_SIZE 2 +#endif + /* The slave select pin of the EEPROM. This needs to be a normal GPIO pin_t value, such as A7. diff --git a/keyboards/custommk/evo70_r2/config.h b/keyboards/custommk/evo70_r2/config.h index 25ab789d75..62606cf1ee 100644 --- a/keyboards/custommk/evo70_r2/config.h +++ b/keyboards/custommk/evo70_r2/config.h @@ -26,6 +26,7 @@ #define MATRIX_ROW_PINS { A8, A1, A2, B1, A7 } // FRAM configuration +#define EEPROM_SPI_MB85RS64V #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A0 #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 4 // 48MHz / 4 = 12MHz; max supported by MB85R64 is 20MHz diff --git a/keyboards/rgbkb/mun/keymaps/default/config.h b/keyboards/rgbkb/mun/keymaps/default/config.h index 9fbbfc5901..88bdc06dee 100644 --- a/keyboards/rgbkb/mun/keymaps/default/config.h +++ b/keyboards/rgbkb/mun/keymaps/default/config.h @@ -19,5 +19,3 @@ // 20m timeout (20m * 60s * 1000mil) // #define RGB_MATRIX_TIMEOUT 1200000 #define RGB_DISABLE_WHEN_USB_SUSPENDED - -#define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/mun/keymaps/via/config.h b/keyboards/rgbkb/mun/keymaps/via/config.h index 002081a1c8..a0f581b50a 100644 --- a/keyboards/rgbkb/mun/keymaps/via/config.h +++ b/keyboards/rgbkb/mun/keymaps/via/config.h @@ -24,5 +24,3 @@ // 224B per layer right now #define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 - -#define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/sol3/keymaps/default/config.h b/keyboards/rgbkb/sol3/keymaps/default/config.h index 7e46726115..88bdc06dee 100644 --- a/keyboards/rgbkb/sol3/keymaps/default/config.h +++ b/keyboards/rgbkb/sol3/keymaps/default/config.h @@ -19,6 +19,3 @@ // 20m timeout (20m * 60s * 1000mil) // #define RGB_MATRIX_TIMEOUT 1200000 #define RGB_DISABLE_WHEN_USB_SUSPENDED - -#define STM32_ONBOARD_EEPROM_SIZE 2048 - diff --git a/keyboards/rgbkb/sol3/keymaps/via/config.h b/keyboards/rgbkb/sol3/keymaps/via/config.h index ff1ff77472..7b7f806261 100644 --- a/keyboards/rgbkb/sol3/keymaps/via/config.h +++ b/keyboards/rgbkb/sol3/keymaps/via/config.h @@ -25,6 +25,3 @@ // 224B per layer right now #define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 - -#define STM32_ONBOARD_EEPROM_SIZE 2048 - diff --git a/keyboards/tau4/config.h b/keyboards/tau4/config.h index 053f210c07..e36b3b8f2e 100644 --- a/keyboards/tau4/config.h +++ b/keyboards/tau4/config.h @@ -17,15 +17,6 @@ along with this program. If not, see . #pragma once - -// Buggy, currently disabled -/* #define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000 -#define EXTERNAL_EEPROM_I2C_ADDRESS(loc) (EXTERNAL_EEPROM_I2C_BASE_ADDRESS | ((((loc) >> 8) & 0x07) << 1)) -#define EXTERNAL_EEPROM_BYTE_COUNT 2048 -#define EXTERNAL_EEPROM_PAGE_SIZE 16 -#define EXTERNAL_EEPROM_ADDRESS_SIZE 1 -#define EXTERNAL_EEPROM_WRITE_TIME 5 */ - #define RGBLIGHT_LAYERS_RETAIN_VAL #define OLED_DISPLAY_WIDTH 128 diff --git a/keyboards/tzarc/djinn/rev1/config.h b/keyboards/tzarc/djinn/rev1/config.h index 5dffc00141..cdcabed05c 100644 --- a/keyboards/tzarc/djinn/rev1/config.h +++ b/keyboards/tzarc/djinn/rev1/config.h @@ -22,7 +22,6 @@ #define RGB_CURR_3000mA_OK_PIN C5 // EEPROM configuration +#define EEPROM_SPI_MB85RS64V #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5 #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz -#define EXTERNAL_EEPROM_BYTE_COUNT 8192 -#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer size diff --git a/keyboards/tzarc/djinn/rev2/config.h b/keyboards/tzarc/djinn/rev2/config.h index 12a6372405..00a893ff65 100644 --- a/keyboards/tzarc/djinn/rev2/config.h +++ b/keyboards/tzarc/djinn/rev2/config.h @@ -25,10 +25,9 @@ #define RGB_CURR_3000mA_OK_PIN C4 // EEPROM configuration +#define EEPROM_SPI_MB85RS64V #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5 #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz -#define EXTERNAL_EEPROM_BYTE_COUNT 8192 -#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer size // External flash config #define EXTERNAL_FLASH_SPI_MODE 3 diff --git a/keyboards/tzarc/ghoul/config.h b/keyboards/tzarc/ghoul/config.h index 932ea8eb50..402f14cd92 100644 --- a/keyboards/tzarc/ghoul/config.h +++ b/keyboards/tzarc/ghoul/config.h @@ -8,8 +8,7 @@ // #define MATRIX_COLS 8 // actually defined in info.json: 8 bits per register // EEPROM configuration -#define EXTERNAL_EEPROM_BYTE_COUNT 8192 -#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer +#define EEPROM_SPI_MB85RS64V // RGB configuration #define RGB_MATRIX_LED_COUNT 40 diff --git a/keyboards/vinhcatba/uncertainty/config.h b/keyboards/vinhcatba/uncertainty/config.h index 288f1d81a9..5c02b78efe 100644 --- a/keyboards/vinhcatba/uncertainty/config.h +++ b/keyboards/vinhcatba/uncertainty/config.h @@ -19,11 +19,7 @@ #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 /* eeprom i2c driver config */ -#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000 -#define EXTERNAL_EEPROM_BYTE_COUNT 4096 -#define EXTERNAL_EEPROM_PAGE_SIZE 32 -#define EXTERNAL_EEPROM_WRITE_TIME 10 -//#define EEPROM_I2C_24LC32 +#define EEPROM_I2C_24LC32A /* OLED config */ #define OLED_UPDATE_INTERVAL 100 diff --git a/keyboards/xelus/kangaroo/rev1/config.h b/keyboards/xelus/kangaroo/rev1/config.h index 7f246458f5..c174b67e57 100644 --- a/keyboards/xelus/kangaroo/rev1/config.h +++ b/keyboards/xelus/kangaroo/rev1/config.h @@ -35,6 +35,3 @@ // I2C EEPROM #define EEPROM_I2C_CAT24C512 - -// Dynamic EEPROM -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 65535 diff --git a/keyboards/xelus/pachi/rgb/rev1/config.h b/keyboards/xelus/pachi/rgb/rev1/config.h index baa15eaa49..e51a176c84 100644 --- a/keyboards/xelus/pachi/rgb/rev1/config.h +++ b/keyboards/xelus/pachi/rgb/rev1/config.h @@ -36,9 +36,6 @@ // I2C EEPROM #define EEPROM_I2C_24LC64 -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 - // RGB Matrix defines #define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND diff --git a/keyboards/xelus/rs108/config.h b/keyboards/xelus/rs108/config.h index 9ff25facc8..45f2a54530 100644 --- a/keyboards/xelus/rs108/config.h +++ b/keyboards/xelus/rs108/config.h @@ -30,14 +30,7 @@ #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 // EEPROM config -// 24LC32 -#define EXTERNAL_EEPROM_BYTE_COUNT 4096 -#define EXTERNAL_EEPROM_PAGE_SIZE 32 -#define EXTERNAL_EEPROM_ADDRESS_SIZE 2 -#define EXTERNAL_EEPROM_WRITE_TIME 5 - -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 +#define EEPROM_I2C_24LC32A // Hardware Defines #define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE diff --git a/keyboards/xelus/rs60/rev2_0/config.h b/keyboards/xelus/rs60/rev2_0/config.h index 9ff25facc8..45f2a54530 100644 --- a/keyboards/xelus/rs60/rev2_0/config.h +++ b/keyboards/xelus/rs60/rev2_0/config.h @@ -30,14 +30,7 @@ #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 // EEPROM config -// 24LC32 -#define EXTERNAL_EEPROM_BYTE_COUNT 4096 -#define EXTERNAL_EEPROM_PAGE_SIZE 32 -#define EXTERNAL_EEPROM_ADDRESS_SIZE 2 -#define EXTERNAL_EEPROM_WRITE_TIME 5 - -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 +#define EEPROM_I2C_24LC32A // Hardware Defines #define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE diff --git a/keyboards/xelus/valor/rev2/config.h b/keyboards/xelus/valor/rev2/config.h index e5acad6f9c..9a0146172d 100644 --- a/keyboards/xelus/valor/rev2/config.h +++ b/keyboards/xelus/valor/rev2/config.h @@ -36,9 +36,6 @@ // I2C EEPROM #define EEPROM_I2C_24LC64 -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 - /* RGB Matrix */ #define RGB_MATRIX_LED_COUNT 28 #define NOP_FUDGE 0.4 diff --git a/keyboards/xelus/valor_frl_tkl/rev1/config.h b/keyboards/xelus/valor_frl_tkl/rev1/config.h index a03694deaa..af702fcafd 100644 --- a/keyboards/xelus/valor_frl_tkl/rev1/config.h +++ b/keyboards/xelus/valor_frl_tkl/rev1/config.h @@ -35,10 +35,4 @@ #define I2C1_TIMINGR_SCLL 9U // I2C EEPROM -// 24LC64 #define EEPROM_I2C_24LC64 - -// Dynamic EEPROM -// Something sensible or else VIA may crash -// Users may enable more if they wish -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 diff --git a/keyboards/xelus/xs108/config.h b/keyboards/xelus/xs108/config.h index 8a6ab123c4..4b3b447c95 100644 --- a/keyboards/xelus/xs108/config.h +++ b/keyboards/xelus/xs108/config.h @@ -34,6 +34,3 @@ // I2C EEPROM #define EEPROM_I2C_24LC64 - -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 diff --git a/keyboards/xelus/xs60/hotswap/config.h b/keyboards/xelus/xs60/hotswap/config.h index d1138c735d..56ecd57ec9 100644 --- a/keyboards/xelus/xs60/hotswap/config.h +++ b/keyboards/xelus/xs60/hotswap/config.h @@ -34,9 +34,6 @@ // I2C EEPROM #define EEPROM_I2C_24LC64 -// More EEPROM for layers -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 - // RGBLIGHT #define RGBLIGHT_LAYERS #define WS2812_EXTERNAL_PULLUP diff --git a/platforms/chibios/boards/BONSAI_C4/configs/config.h b/platforms/chibios/boards/BONSAI_C4/configs/config.h index 7539ebed41..193b028bde 100644 --- a/platforms/chibios/boards/BONSAI_C4/configs/config.h +++ b/platforms/chibios/boards/BONSAI_C4/configs/config.h @@ -24,11 +24,9 @@ // FRAM configuration #ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN +# define EEPROM_SPI_MB85RS64V # define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOA, 0) # define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // 96MHz / 8 = 12MHz; max supported by MB85R64 is 20MHz -# define EXTERNAL_EEPROM_BYTE_COUNT 8192 -# define EXTERNAL_EEPROM_PAGE_SIZE 64 // does not matter for FRAM, just sets the RAM buffer size in STM32F chip -# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 #endif // External flash configuration