drivers: flash: NXP k6x/kw2xd: Convert to use device tree
Convert NXP k6x and kw2xd flash driver to use device tree to get the flash controller name from device tree. We introduce yaml bindings for the "nxp,kinetis-ftfe" and "nxp,kinetis-ftfl" devices. Fixes: #5788 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
68d826ce93
commit
a394693d2f
10 changed files with 65 additions and 16 deletions
6
arch/arm/soc/nxp_kinetis/k6x/dts.fixup
Normal file
6
arch/arm/soc/nxp_kinetis/k6x/dts.fixup
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* SoC level DTS fixup file */
|
||||
|
||||
#define FLASH_DEV_BASE_ADDRESS NXP_KINETIS_FTFE_40020000_BASE_ADDRESS_0
|
||||
#define FLASH_DEV_NAME NXP_KINETIS_FTFE_40020000_LABEL
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
|
@ -54,7 +54,7 @@ extern "C" {
|
|||
|
||||
/* For IMG_MANAGER */
|
||||
#if defined(CONFIG_SOC_FLASH_MCUX)
|
||||
#define FLASH_DRIVER_NAME CONFIG_SOC_FLASH_MCUX_DEV_NAME
|
||||
#define FLASH_DRIVER_NAME FLASH_DEV_NAME
|
||||
#endif
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
|
8
arch/arm/soc/nxp_kinetis/kwx/dts.fixup
Normal file
8
arch/arm/soc/nxp_kinetis/kwx/dts.fixup
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* SoC level DTS fixup file */
|
||||
|
||||
#if defined(CONFIG_SOC_MKW22D5) || defined(CONFIG_SOC_MKW24D5)
|
||||
#define FLASH_DEV_BASE_ADDRESS NXP_KINETIS_FTFL_40020000_BASE_ADDRESS_0
|
||||
#define FLASH_DEV_NAME NXP_KINETIS_FTFL_40020000_LABEL
|
||||
#endif /* CONFIG_SOC_MKW22D5 || CONFIG_SOC_MKW24D5 */
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
|
@ -149,13 +149,6 @@ config SOC_FLASH_MCUX
|
|||
have an impact on the overall system performance - whether
|
||||
this is acceptable or not will depend on the use case.
|
||||
|
||||
config SOC_FLASH_MCUX_DEV_NAME
|
||||
string "MCUX flash device name"
|
||||
depends on SOC_FLASH_MCUX
|
||||
default "MCUX_FLASH"
|
||||
help
|
||||
Specify the device name for the flash driver.
|
||||
|
||||
source "drivers/flash/Kconfig.stm32"
|
||||
|
||||
source "drivers/flash/Kconfig.sam0"
|
||||
|
|
|
@ -110,7 +110,7 @@ static int flash_mcux_init(struct device *dev)
|
|||
return (rc == kStatus_Success) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
DEVICE_AND_API_INIT(flash_mcux, CONFIG_SOC_FLASH_MCUX_DEV_NAME,
|
||||
DEVICE_AND_API_INIT(flash_mcux, FLASH_DEV_NAME,
|
||||
flash_mcux_init, &flash_data, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &flash_mcux_api);
|
||||
|
||||
|
|
|
@ -64,10 +64,12 @@
|
|||
#clocks-cells = <3>;
|
||||
};
|
||||
|
||||
flash-controller@4001f000 {
|
||||
compatible = "nxp,k64f-flash-controller";
|
||||
reg = <0x4001f000 0x27c>;
|
||||
flash-controller@40020000 {
|
||||
compatible = "nxp,kinetis-ftfe";
|
||||
label = "FLASH_CTRL";
|
||||
reg = <0x40020000 0x18>;
|
||||
interrupts = <18 0>, <19 0>;
|
||||
interrupt-names = "command-complete", "read-collision";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
|
|
@ -56,10 +56,12 @@
|
|||
#clocks-cells = <3>;
|
||||
};
|
||||
|
||||
flash-controller@4001f000 {
|
||||
compatible = "nxp,k64f-flash-controller";
|
||||
reg = <0x4001f000 0x27c>;
|
||||
flash-controller@40020000 {
|
||||
compatible = "nxp,kinetis-ftfl";
|
||||
label = "FLASH_CTRL";
|
||||
reg = <0x40020000 0x18>;
|
||||
interrupts = <18 0>, <19 0>;
|
||||
interrupt-names = "command-complete", "read-collision";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
|
19
dts/bindings/flash_controller/nxp,kinetis-ftfe.yaml
Normal file
19
dts/bindings/flash_controller/nxp,kinetis-ftfe.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: NXP Kinetis Flash Memory Module (FTFE)
|
||||
id: nxp,kinetis-ftfe
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives for the NXP Kinetis Flash Memory Module E (FTFE)
|
||||
|
||||
inherits:
|
||||
!include flash-controller.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
type: string
|
||||
category: required
|
||||
description: compatible strings
|
||||
constraint: "nxp,kinetis-ftfe"
|
||||
|
||||
...
|
19
dts/bindings/flash_controller/nxp,kinetis-ftfl.yaml
Normal file
19
dts/bindings/flash_controller/nxp,kinetis-ftfl.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: NXP Kinetis Flash Memory Module (FTFL)
|
||||
id: nxp,kinetis-ftfl
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives for the NXP Kinetis Flash Memory Module L (FTFL)
|
||||
|
||||
inherits:
|
||||
!include flash-controller.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
type: string
|
||||
category: required
|
||||
description: compatible strings
|
||||
constraint: "nxp,kinetis-ftfl"
|
||||
|
||||
...
|
|
@ -41,7 +41,7 @@ static int shell_cmd_write_mcux(int argc, char *argv[])
|
|||
ARG_UNUSED(argv);
|
||||
|
||||
struct device *flash_dev;
|
||||
flash_dev = device_get_binding(CONFIG_SOC_FLASH_MCUX_DEV_NAME);
|
||||
flash_dev = device_get_binding(FLASH_DEV_NAME);
|
||||
|
||||
u32_t value[2];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue