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:
Kumar Gala 2018-01-18 13:40:18 -06:00 committed by Maureen Helm
commit a394693d2f
10 changed files with 65 additions and 16 deletions

View 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 */

View file

@ -54,7 +54,7 @@ extern "C" {
/* For IMG_MANAGER */ /* For IMG_MANAGER */
#if defined(CONFIG_SOC_FLASH_MCUX) #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
#endif /* !_ASMLANGUAGE */ #endif /* !_ASMLANGUAGE */

View 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 */

View file

@ -149,13 +149,6 @@ config SOC_FLASH_MCUX
have an impact on the overall system performance - whether have an impact on the overall system performance - whether
this is acceptable or not will depend on the use case. 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.stm32"
source "drivers/flash/Kconfig.sam0" source "drivers/flash/Kconfig.sam0"

View file

@ -110,7 +110,7 @@ static int flash_mcux_init(struct device *dev)
return (rc == kStatus_Success) ? 0 : -EIO; 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, flash_mcux_init, &flash_data, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &flash_mcux_api); CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &flash_mcux_api);

View file

@ -64,10 +64,12 @@
#clocks-cells = <3>; #clocks-cells = <3>;
}; };
flash-controller@4001f000 { flash-controller@40020000 {
compatible = "nxp,k64f-flash-controller"; compatible = "nxp,kinetis-ftfe";
reg = <0x4001f000 0x27c>; label = "FLASH_CTRL";
reg = <0x40020000 0x18>;
interrupts = <18 0>, <19 0>; interrupts = <18 0>, <19 0>;
interrupt-names = "command-complete", "read-collision";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;

View file

@ -56,10 +56,12 @@
#clocks-cells = <3>; #clocks-cells = <3>;
}; };
flash-controller@4001f000 { flash-controller@40020000 {
compatible = "nxp,k64f-flash-controller"; compatible = "nxp,kinetis-ftfl";
reg = <0x4001f000 0x27c>; label = "FLASH_CTRL";
reg = <0x40020000 0x18>;
interrupts = <18 0>, <19 0>; interrupts = <18 0>, <19 0>;
interrupt-names = "command-complete", "read-collision";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;

View 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"
...

View 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"
...

View file

@ -41,7 +41,7 @@ static int shell_cmd_write_mcux(int argc, char *argv[])
ARG_UNUSED(argv); ARG_UNUSED(argv);
struct device *flash_dev; 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]; u32_t value[2];