Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added external spi flash driver. #15419

Merged
merged 38 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
806bef7
Added external spi flash driver.
Dec 7, 2021
d8dd74d
Added document description of SPI Flash configuration parameters.
Dec 7, 2021
d6f89b7
Added FLASH_DRIVER configuration
Dec 7, 2021
72ba901
Modified FLASH_DRIVER configuration.
Dec 7, 2021
41e3a4d
Update
Dec 17, 2021
69e167f
Update drivers/flash/flash_spi.h
Feb 9, 2022
bc72ce2
Update drivers/flash/flash_spi.c
Feb 9, 2022
1211426
Update drivers/flash/flash_spi.c
Feb 9, 2022
8e7c2ae
Update drivers/flash/flash_spi.h
Feb 9, 2022
4d51073
Update drivers/flash/flash_spi.h
Feb 9, 2022
762ba45
Update drivers/flash/flash_spi.h
Feb 9, 2022
9c5b198
Update drivers/flash/flash_spi.c
Feb 9, 2022
21cb1ff
Update drivers/flash/flash_spi.c
Feb 9, 2022
de1b9f4
Revert docs.
Feb 9, 2022
46daf95
Update drivers/flash/flash_spi.c
Feb 9, 2022
d8cacab
Update drivers/flash/flash_spi.c
Feb 9, 2022
03ecdde
Update drivers/flash/flash_spi.c
Feb 9, 2022
a06f14e
Update docs/flash_driver.md
Feb 9, 2022
b34e048
Update drivers/flash/flash_spi.c
Feb 9, 2022
20a59a3
Update drivers/flash/flash_spi.c
Feb 9, 2022
2466ffd
Update drivers/flash/flash_spi.c
Feb 9, 2022
5e81862
Update drivers/flash/flash_spi.c
Feb 9, 2022
b3647d9
Update drivers/flash/flash_spi.h
Feb 9, 2022
ef65275
Update drivers/flash/flash_spi.h
Feb 9, 2022
10b83e5
Update drivers/flash/flash_spi.h
Feb 9, 2022
cb46b3d
Modified code format.
Feb 9, 2022
fd58d30
Update drivers/flash/flash_spi.c
Feb 9, 2022
734fefd
Modified code format.
Feb 9, 2022
ba823f5
Update docs/flash_driver.md
Feb 9, 2022
e6c4eb0
Update drivers/flash/flash_spi.h
Feb 9, 2022
cb78267
Update common_features.mk
Feb 9, 2022
cc66dc4
Update drivers/flash/flash_spi.c
Feb 9, 2022
b64de27
Update drivers/flash/flash_spi.c
Feb 9, 2022
9c7c4f1
Update drivers/flash/flash_spi.c
Feb 9, 2022
54e3886
Update drivers/flash/flash_spi.c
Feb 9, 2022
8b24ee5
Update drivers/flash/flash_spi.c
Feb 9, 2022
ab63b20
Update drivers/flash/flash_spi.c
Feb 9, 2022
6774152
Merge remote-tracking branch 'origin/develop' into develop_for_spi_flash
Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,21 @@ else
endif
endif

VALID_FLASH_DRIVER_TYPES := spi
FLASH_DRIVER ?= no
ifneq ($(strip $(FLASH_DRIVER)), no)
ifeq ($(filter $(FLASH_DRIVER),$(VALID_FLASH_DRIVER_TYPES)),)
$(error FLASH_DRIVER="$(FLASH_DRIVER)" is not a valid FLASH driver)
else
OPT_DEFS += -DFLASH_ENABLE
ifeq ($(strip $(FLASH_DRIVER)), spi)
OPT_DEFS += -DFLASH_DRIVER -DFLASH_SPI
COMMON_VPATH += $(DRIVER_PATH)/flash
SRC += flash_spi.c
endif
endif
endif

RGBLIGHT_ENABLE ?= no
VALID_RGBLIGHT_TYPES := WS2812 APA102 custom

Expand Down
24 changes: 24 additions & 0 deletions docs/flash_driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# FLASH Driver Configuration :id=flash-driver-configuration

The FLASH driver can be swapped out depending on the needs of the keyboard, or whether extra hardware is present.

Driver | Description
-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`FLASH_DRIVER = spi` | Supports writing to almost all NOR Flash chips. See the driver section below.


## SPI FLASH Driver Configuration :id=spi-flash-driver-configuration

Currently QMK supports almost all NOR Flash chips over SPI. As such, requires a working spi_master driver configuration. You can override the driver configuration via your config.h:

`config.h` override | Description | Default Value
-----------------------------------------------|--------------------------------------------------------------------------------------|-----------------
`#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN` | SPI Slave select pin in order to inform that the FLASH is currently being addressed | _none_
`#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR` | Clock divisor used to divide the peripheral clock to derive the SPI frequency | `8`
`#define EXTERNAL_FLASH_PAGE_SIZE` | The Page size of the FLASH in bytes, as specified in the datasheet | `256`
`#define EXTERNAL_FLASH_SECTOR_SIZE` | The sector size of the FLASH in bytes, as specified in the datasheet | `(4 * 1024)`
`#define EXTERNAL_FLASH_BLOCK_SIZE` | The block size of the FLASH in bytes, as specified in the datasheet | `(64 * 1024)`
`#define EXTERNAL_FLASH_SIZE` | The total size of the FLASH in bytes, as specified in the datasheet | `(512 * 1024)`
`#define EXTERNAL_FLASH_ADDRESS_SIZE` | The Flash address size in bytes, as specified in datasheet | `3`

!> All the above default configurations are based on MX25L4006E NOR Flash.