Introduce MEMORY uclass and TI GPMC driver
Subsystems (3)
v2 cover Introduce MEMORY uclass and TI GPMC driver
Hi,
This series introduces the MEMORY controller uclass for the drivers that exist in drivers/memory directory.
With that, we add the TI GPMC Memory controller driver as the first user of this uclass.
The GPMC is a unified memory controller dedicated for interfacing with external memory devices like
- Asynchronous SRAM-like memories and ASICs
- Asynchronous, synchronous, and page mode burst NOR flash
- NAND flash
- Pseudo-SRAM devices
The driver is pulled straight from the Linux kernel and adapted for u-boot.
This driver will take care of setting up the GPMC based on the settings specified in the Device tree and then probe its children.
Roger Quadros (4):
dm: memory: Introduce new uclass
scripts: Makefile.spl: Enable memory drivers to be built for SPL dt/bindings: memory: Add bindings for TI GPMC driver
memory: Add TI GPMC driver
arch/sandbox/dts/test.dts | 4 + .../memory/ti,gpmc-child.yaml | 252 ++++ doc/device-tree-bindings/memory/ti,gpmc.yaml | 190 +++ drivers/memory/Kconfig | 36 + drivers/memory/Makefile | 3 + drivers/memory/memory-sandbox.c | 18 + drivers/memory/memory-uclass.c | 13 + drivers/memory/ti-gpmc.c | 1240 +++++++++++++++++ drivers/memory/ti-gpmc.h | 298 ++++ include/dm/uclass-id.h | 1 + include/linux/mtd/omap_gpmc.h | 3 + scripts/Makefile.spl | 1 + test/dm/Makefile | 1 + test/dm/memory.c | 21 + 14 files changed, 2081 insertions(+) create mode 100644 doc/device-tree-bindings/memory/ti,gpmc-child.yaml create mode 100644 doc/device-tree-bindings/memory/ti,gpmc.yaml create mode 100644 drivers/memory/memory-sandbox.c create mode 100644 drivers/memory/memory-uclass.c create mode 100644 drivers/memory/ti-gpmc.c create mode 100644 drivers/memory/ti-gpmc.h create mode 100644 test/dm/memory.c
Signature · 1 line
2.17.1
PATCH v2 1/4 dm: memory: Introduce new uclass
Introduce UCLASS_MEMORY for future Memory Controller device drivers.
--- arch/sandbox/dts/test.dts | 4 ++++ drivers/memory/Kconfig | 17 +++++++++++++++++ drivers/memory/Makefile | 2 ++ drivers/memory/memory-sandbox.c | 18 ++++++++++++++++++ drivers/memory/memory-uclass.c | 13 +++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/memory.c | 21 +++++++++++++++++++++ 8 files changed, 77 insertions(+) create mode 100644 drivers/memory/memory-sandbox.c create mode 100644 drivers/memory/memory-uclass.c create mode 100644 test/dm/memory.c
arch/sandbox/dts/test.dts +4 -0
@@ -926,6 +926,10 @@ }; }; + memory-controller { + compatible = "sandbox,memory"; + }; + misc-test { #address-cells = <1>; #size-cells = <1>;
drivers/memory/Kconfig +17 -0
@@ -4,6 +4,23 @@ menu "Memory Controller drivers" +config DM_MEMORY + bool "Enable Driver Model for Memory Controller drivers" + depends on DM + help + Enable driver model for Memory Controller devices. + These devices provide Memory bus interface to various devices like + SRAM, Ethernet adapters, FPGAs, etc. + For now this uclass has no methods yet. + +config SANDBOX_MEMORY + bool "Enable Sandbox Memory Controller driver" + depends on SANDBOX && DM_MEMORY + help + This is a driver model based Memory Controller driver for sandbox. + Currently it is a stub only, as there are no usable uclass methods + yet. + config STM32_FMC2_EBI bool "Support for FMC2 External Bus Interface on STM32MP SoCs" depends on ARCH_STM32MP
drivers/memory/Makefile +2 -0
@@ -1,3 +1,5 @@ +obj-$(CONFIG_DM_MEMORY) += memory-uclass.o +obj-$(CONFIG_SANDBOX_MEMORY) += memory-sandbox.o obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
drivers/memory/memory-sandbox.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2022 +* Texas Instruments Incorporated, <www.ti.com> +*/ + +#include <dm.h> + +static const struct udevice_id sandbox_memory_match[] = { + { .compatible ="sandbox,memory" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sandbox_memory) = { + .name ="sandbox_memory" , + .id =UCLASS_MEMORY , + .of_match = sandbox_memory_match, +};
drivers/memory/memory-uclass.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2022 +* Texas Instruments Incorporated, <www.ti.com> +*/ + +#include <dm.h> + +UCLASS_DRIVER (memory) = { + .name ="memory" , + .id =UCLASS_MEMORY , + .post_bind = dm_scan_fdt_dev, +};
include/dm/uclass-id.h +1 -0
@@ -76,6 +76,7 @@ enum uclass_id {UCLASS_MASS_STORAGE ,/* Mass storage device */ UCLASS_MDIO ,/* MDIO bus */ UCLASS_MDIO_MUX ,/* MDIO MUX/switch */ +UCLASS_MEMORY ,/* Memory Controller device */ UCLASS_MISC ,/* Miscellaneous device */ UCLASS_MMC ,/* SD / MMC card or chip */ UCLASS_MOD_EXP, /* RSA Mod Exp device */
test/dm/Makefile +1 -0
@@ -47,6 +47,7 @@ ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o endif obj-$(CONFIG_FIRMWARE) += firmware.o +obj-$(CONFIG_DM_MEMORY) += memory.o obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_SOUND) += i2s.o
test/dm/memory.c new file +21 -0
@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2022 +* Texas Instruments Incorporated, <www.ti.com> +*/ + +#include <dm.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +static int dm_test_memory (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_first_device_err (UCLASS_MEMORY , &dev)); + +return 0 ; +} + +DM_TEST (dm_test_memory,UT_TESTF_SCAN_FDT );
Signature · 1 line
2.17.1
Re: [u-boot][PATCH v2 1/4] dm: memory: Introduce new uclass
Hi Roger,
Quoted 5 lines · Roger Quadros
Introduce
UCLASS_MEMORYfor future Memory Controller device drivers.Signed-off-by Roger Quadros <[email protected]>
Quoted 14 lines
--- arch/sandbox/dts/test.dts | 4 ++++ drivers/memory/Kconfig | 17 +++++++++++++++++ drivers/memory/Makefile | 2 ++ drivers/memory/memory-sandbox.c | 18 ++++++++++++++++++ drivers/memory/memory-uclass.c | 13 +++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/memory.c | 21 +++++++++++++++++++++ 8 files changed, 77 insertions(+) create mode 100644 drivers/memory/memory-sandbox.c create mode 100644 drivers/memory/memory-uclass.c create mode 100644 test/dm/memory.c
(with change below)
Quoted 20 lines
arch/sandbox/dts/test.dts +4
-0@@ -926,6 +926,10 @@ }; }; + memory-controller { + compatible = "sandbox,memory"; + }; + misc-test { #address-cells = <1>; #size-cells = <1>;drivers/memory/Kconfig +0
-0
drivers/memory/Kconfig line 7
Quoted 4 lines
drivers/memory/Kconfig +1
-0@@ -4,6 +4,23 @@ menu "Memory Controller drivers" +config DM_MEMORY
Please use MEMORY since there is no non-DM memory option.
Quoted 9 lines
drivers/memory/Kconfig +9
-0+ bool "Enable Driver Model for Memory Controller drivers" + depends on DM + help + Enable driver model for Memory Controller devices. + These devices provide Memory bus interface to various devices like + SRAM, Ethernet adapters, FPGAs, etc. + For now this uclass has no methods yet. + +config SANDBOX_MEMORY
drivers/memory/Kconfig line 26
Quoted 10 lines
drivers/memory/Kconfig +7
-0+ bool "Enable Sandbox Memory Controller driver" + depends on SANDBOX && DM_MEMORY + help + This is a driver model based Memory Controller driver for sandbox. + Currently it is a stub only, as there are no usable uclass methods + yet. + config STM32_FMC2_EBI bool "Support for FMC2 External Bus Interface on STM32MP SoCs" depends on ARCH_STM32MP
[..]
Regards,
Simon
PATCH v2 2/4 scripts: Makefile.spl: Enable memory drivers to be built for SPL
In reply to Roger QuadrosWe will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)
scripts/Makefile.spl +1 -0
@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endif libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/
Signature · 1 line
2.17.1
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Quoted 13 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 7 lines
scripts/Makefile.spl +1
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endif libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/
This ends up being the wrong approach as it then pulls in drivers/memory/stm32-fmc2-ebi.o on all of those platforms, in SPL, which is not what's intended. We need an SPL_MEMORY symbol and then gate the directory on that.
Signature · 1 line
Tom
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endif
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.
That's right. I'll fix it up. Will wait for your comments on the rest of the series before re-spin.
cheers,
-roger
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Quoted 31 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.
Quoted 2 lines
That's right. I'll fix it up. Will wait for your comments on the rest of the series before re-spin.
Everything else is fine, I was about to merge it (with a %s/DM_MEMORY/MEMORY) when I saw the stm32 platforms increasing in size and dug in.
Signature · 1 line
Tom
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endif
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.
I have a question about how CONFIG_SPL_MEMORY works together with CONFIG_MEMORY.
Do we use CONFIG_SPL_MEMORY only to gate the drivers/memory directory inclusion? Then continue to use CONFIG_MEMORY and others to enable/disable driver build for both non-SPL and SPL case?
So drivers/memory/Makefile remains as it is?
Quoted 8 lines
Quoted 3 lines
That's right. I'll fix it up. Will wait for your comments on the rest of the series before re-spin.
Everything else is fine, I was about to merge it (with a %s/DM_MEMORY/MEMORY) when I saw the stm32 platforms increasing in size and dug in.
cheers,
-roger
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Quoted 35 lines · Roger Quadros
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.
Quoted 7 lines
I have a question about how
CONFIG_SPL_MEMORYworks together withCONFIG_MEMORY.Do we use
CONFIG_SPL_MEMORYonly to gate thedrivers/memorydirectory inclusion? Then continue to useCONFIG_MEMORYand others to enable/disable driver build for both non-SPL and SPL case?So
drivers/memory/Makefileremains as it is?
Well, for consistency code should use IS_ENABLED(MEMORY) which will be true for CONFIG_MEMORY or CONFIG_SPL_MEMORY.
Signature · 1 line
Tom
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Hi Tom,
Quoted 39 lines · Tom Rini
Quoted 37 lines · Roger Quadros
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.I have a question about how
CONFIG_SPL_MEMORYworks together withCONFIG_MEMORY.
Quoted 8 lines
Quoted 5 lines
Do we use
CONFIG_SPL_MEMORYonly to gate thedrivers/memorydirectory inclusion? Then continue to useCONFIG_MEMORYand others to enable/disable driver build for both non-SPL and SPL case?So
drivers/memory/Makefileremains as it is?Well, for consistency code should use
IS_ENABLED(MEMORY)which will be true forCONFIG_MEMORYorCONFIG_SPL_MEMORY.
nit: CONFIG_IS_ENABLED(MEMORY)
Perhaps we can look at my Kconfig series so it can become CONFIG(MEMORY) and we can drop all the SPL_TPL_ stuff in Makefiles?
Regards,
SImon
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Tom,
Quoted 46 lines · Simon Glass
Hi Tom,
Quoted 43 lines · Tom Rini
Quoted 41 lines · Roger Quadros
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.I have a question about how
CONFIG_SPL_MEMORYworks together withCONFIG_MEMORY.Do we use
CONFIG_SPL_MEMORYonly to gate thedrivers/memorydirectory inclusion? Then continue to useCONFIG_MEMORYand others to enable/disable driver build for both non-SPL and SPL case?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
So
drivers/memory/Makefileremains as it is?Well, for consistency code should use
IS_ENABLED(MEMORY)which will be true forCONFIG_MEMORYorCONFIG_SPL_MEMORY.nit:
CONFIG_IS_ENABLED(MEMORY)
CONFIG_IS_ENABLED* is used in code but not by any Makefile.
My question was on what basis do we gate drivers/memory inclusion in build from Makefile.
Can CONFIG_MEMORY and CONFIG_SPL_MEMORY co-exist or that should never happen?
Quoted 6 lines
Perhaps we can look at my
Kconfigseries so it can become CONFIG(MEMORY) and we can drop all theSPL_TPL_stuff in Makefiles?Regards,
SImon
cheers,
-roger
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
Quoted 54 lines · Roger Quadros
Tom,
Quoted 51 lines · Simon Glass
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 35 lines · Roger Quadros
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.Quoted 7 lines
I have a question about how
CONFIG_SPL_MEMORYworks together withCONFIG_MEMORY.Do we use
CONFIG_SPL_MEMORYonly to gate thedrivers/memorydirectory inclusion? Then continue to useCONFIG_MEMORYand others to enable/disable driver build for both non-SPL and SPL case?So
drivers/memory/Makefileremains as it is?Well, for consistency code should use
IS_ENABLED(MEMORY)which will be true forCONFIG_MEMORYorCONFIG_SPL_MEMORY.
Quoted 6 lines
Quoted 1 line
nit:
CONFIG_IS_ENABLED(MEMORY)CONFIG_IS_ENABLED* is used in code but not by any
Makefile.
My question was on what basis do we gatedrivers/memoryinclusion in build fromMakefile.Can
CONFIG_MEMORYandCONFIG_SPL_MEMORYco-exist or that should never happen?
What we have for now in your patch is fine and we can tweak slightly if needed if other cases arise.
Signature · 1 line
Tom
Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL
In reply to Simon GlassQuoted 48 lines · Simon Glass
Hi Tom,
Quoted 45 lines · Tom Rini
Quoted 42 lines · Roger Quadros
Hi Tom,
Quoted 20 lines · Tom Rini
Quoted 19 lines · Roger Quadros
Quoted 16 lines · Tom Rini
Quoted 15 lines · Roger Quadros
We will need ti-gpmc driver for SPL. Allow memory drivers do be built for SPL.
Signed-off-by Roger Quadros <[email protected]>--- scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.spl +0
-0@@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/ endifQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.spl libs-$(CONFIG_PARTITIONS) += disk/ · line 120
Quoted 5 lines
scripts/Makefile.spl +1
-0libs-y += drivers/ +libs-y += drivers/memory/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/ libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/ libs-y += dts/This ends up being the wrong approach as it then pulls in
drivers/memory/stm32-fmc2-ebi.oon all of those platforms, in SPL, which is not what's intended. We need anSPL_MEMORYsymbol and then gate the directory on that.I have a question about how
CONFIG_SPL_MEMORYworks together withCONFIG_MEMORY.Do we use
CONFIG_SPL_MEMORYonly to gate thedrivers/memorydirectory inclusion? Then continue to useCONFIG_MEMORYand others to enable/disable driver build for both non-SPL and SPL case?So
drivers/memory/Makefileremains as it is?
Quoted 7 lines
Quoted 2 lines
Well, for consistency code should use
IS_ENABLED(MEMORY)which will be true forCONFIG_MEMORYorCONFIG_SPL_MEMORY.nit:
CONFIG_IS_ENABLED(MEMORY)Perhaps we can look at my
Kconfigseries so it can become CONFIG(MEMORY) and we can drop all theSPL_TPL_stuff in Makefiles?
I think that was the part I had some reservations about, but we should re-visit that idea as I wasn't disagreeing (I believe) with making the logic easier, but I think that we need to re-evaluate how we manage the SPL/TPL/full U-Boot idea.
Signature · 1 line
Tom
PATCH v2 3/4 dt/bindings: memory: Add bindings for TI GPMC driver
In reply to Roger QuadrosGPMC stands for General Purpose Memory Controller and it is present on many Texas Instruments SoCs.
It supports a number of Asynchronous and Synchronous interfaces and has various settings to configure the bus interface.
The DT bindings define all the various GPMC settings.
As the GPMC supports multiple devices on the bus, each device is represented as a child and the respective GPMC settings are situated there. (see ti,gpmc-child.yaml)
These binding docs are picked up from the Linux kernel.
--- .../memory/ti,gpmc-child.yaml | 252 ++++++++++++++++++ doc/device-tree-bindings/memory/ti,gpmc.yaml | 190 +++++++++++++ 2 files changed, 442 insertions(+) create mode 100644 doc/device-tree-bindings/memory/ti,gpmc-child.yaml create mode 100644 doc/device-tree-bindings/memory/ti,gpmc.yaml
doc/device-tree-bindings/memory/ti,gpmc-child.yaml new file +252 -0
@@ -0,0 +1,252 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/memory-controllers/ti,gpmc-child.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: device tree bindings for children of the Texas Instruments GPMC + +maintainers: + - Tony Lindgren <[email protected]> + - Roger Quadros <[email protected]> + +description: + This binding is meant for the child nodes of the GPMC node. The node + represents any device connected to the GPMC bus. It may be a Flash chip, + RAM chip or Ethernet controller, etc. These properties are meant for + configuring the GPMC settings/timings and will accompany the bindings + supported by the respective device. + +properties: + reg: true + +# GPMC Timing properties for child nodes. All are optional and default to 0. + gpmc,sync-clk-ps: + description: Minimum clock period for synchronous mode + default: 0 + +# Chip-select signal timings corresponding to GPMC_CONFIG2: + gpmc,cs-on-ns: + description: Assertion time + default: 0 + + gpmc,cs-rd-off-ns: + description: Read deassertion time + default: 0 + + gpmc,cs-wr-off-ns: + description: Write deassertion time + default: 0 + +# ADV signal timings corresponding to GPMC_CONFIG3: + gpmc,adv-on-ns: + description: Assertion time + default: 0 + + gpmc,adv-rd-off-ns: + description: Read deassertion time + default: 0 + + gpmc,adv-wr-off-ns: + description: Write deassertion time + default: 0 + + gpmc,adv-aad-mux-on-ns: + description: Assertion time for AAD + default: 0 + + gpmc,adv-aad-mux-rd-off-ns: + description: Read deassertion time for AAD + default: 0 + + gpmc,adv-aad-mux-wr-off-ns: + description: Write deassertion time for AAD + default: 0 + +# WE signals timings corresponding to GPMC_CONFIG4: + gpmc,we-on-ns: + description: Assertion time + default: 0 + + gpmc,we-off-ns: + description: Deassertion time + default: 0 + +# OE signals timings corresponding to GPMC_CONFIG4: + gpmc,oe-on-ns: + description: Assertion time + default: 0 + + gpmc,oe-off-ns: + description: Deassertion time + default: 0 + + gpmc,oe-aad-mux-on-ns: + description: Assertion time for AAD + default: 0 + + gpmc,oe-aad-mux-off-ns: + description: Deassertion time for AAD + default: 0 + +# Access time and cycle time timings (in nanoseconds) corresponding to +# GPMC_CONFIG5: + gpmc,page-burst-access-ns: + description: Multiple access word delay + default: 0 + + gpmc,access-ns: + description: Start-cycle to first data valid delay + default: 0 + + gpmc,rd-cycle-ns: + description: Total read cycle time + default: 0 + + gpmc,wr-cycle-ns: + description: Total write cycle time + default: 0 + + gpmc,bus-turnaround-ns: + description: Turn-around time between successive accesses + default: 0 + + gpmc,cycle2cycle-delay-ns: + description: Delay between chip-select pulses + default: 0 + + gpmc,clk-activation-ns: + description: GPMC clock activation time + default: 0 + + gpmc,wait-monitoring-ns: + description: Start of wait monitoring with regard to valid data + default: 0 + +# Boolean timing parameters. If property is present, parameter is enabled +# otherwise disabled. + gpmc,adv-extra-delay: + description: ADV signal is delayed by half GPMC clock + type: boolean + + gpmc,cs-extra-delay: + description: CS signal is delayed by half GPMC clock + type: boolean + + gpmc,cycle2cycle-diffcsen: + description: | + Add "cycle2cycle-delay" between successive accesses + to a different CS + type: boolean + + gpmc,cycle2cycle-samecsen: + description: | + Add "cycle2cycle-delay" between successive accesses + to the same CS + type: boolean + + gpmc,oe-extra-delay: + description: OE signal is delayed by half GPMC clock + type: boolean + + gpmc,we-extra-delay: + description: WE signal is delayed by half GPMC clock + type: boolean + + gpmc,time-para-granularity: + description: Multiply all access times by 2 + type: boolean + +# The following two properties are applicable only to OMAP3+ and AM335x: + gpmc,wr-access-ns: + description: | + In synchronous write mode, for single or + burst accesses, defines the number of + GPMC_FCLK cycles from start access time + to the GPMC_CLK rising edge used by the + memory device for the first data capture. + default: 0 + + gpmc,wr-data-mux-bus-ns: + description: | + In address-data multiplex mode, specifies + the time when the first data is driven on + the address-data bus. + default: 0 + +# GPMC chip-select settings properties for child nodes. All are optional. + gpmc,burst-length: + description: Page/burst length. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 4, 8, 16] + default: 0 + + gpmc,burst-wrap: + description: Enables wrap bursting + type: boolean + + gpmc,burst-read: + description: Enables read page/burst mode + type: boolean + + gpmc,burst-write: + description: Enables write page/burst mode + type: boolean + + gpmc,device-width: + description: | + Total width of device(s) connected to a GPMC + chip-select in bytes. The GPMC supports 8-bit + and 16-bit devices and so this property must be + 1 or 2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + default: 1 + + gpmc,mux-add-data: + description: | + Address and data multiplexing configuration. + Valid values are + 0 for Non multiplexed mode + 1 for address-address-data multiplexing mode and + 2 for address-data multiplexing mode. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + + gpmc,sync-read: + description: | + Enables synchronous read. Defaults to asynchronous + is this is not set. + type: boolean + + gpmc,sync-write: + description: | + Enables synchronous writes. Defaults to asynchronous + is this is not set. + type: boolean + + gpmc,wait-pin: + description: | + Wait-pin used by client. Must be less than "gpmc,num-waitpins". + $ref: /schemas/types.yaml#/definitions/uint32 + + gpmc,wait-pin-polarity: + description: | + Set the desired polarity for the selected wait pin. + 0 for active low, 1 for active high. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + + gpmc,wait-on-read: + description: Enables wait monitoring on reads. + type: boolean + + gpmc,wait-on-write: + description: Enables wait monitoring on writes. + type: boolean + +required: + - reg + +# the GPMC child will have its own native properties +additionalProperties: true
doc/device-tree-bindings/memory/ti,gpmc.yaml new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/4 memory: Add TI GPMC driver
In reply to Roger QuadrosThe GPMC is a unified memory controller dedicated for interfacing with external memory devices like
- Asynchronous SRAM-like memories and ASICs
- Asynchronous, synchronous, and page mode burst NOR flash
- NAND flash
- Pseudo-SRAM devices
This driver will take care of setting up the GPMC based on the settings specified in the Device tree and then probe its children.
--- drivers/memory/Kconfig | 19 + drivers/memory/Makefile | 1 + drivers/memory/ti-gpmc.c | 1240 +++++++++++++++++++++++++++++++++ drivers/memory/ti-gpmc.h | 298 ++++++++ include/linux/mtd/omap_gpmc.h | 3 + 5 files changed, 1561 insertions(+) create mode 100644 drivers/memory/ti-gpmc.c create mode 100644 drivers/memory/ti-gpmc.h
drivers/memory/Kconfig +19 -0
@@ -41,4 +41,23 @@ config TI_AEMIF of 256M bytes of any of these memories can be accessed at a given time via four chip selects with 64M byte access per chip select. +config TI_GPMC + bool "Texas Instruments GPMC driver" + depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 + depends on DM_MEMORY + help + This driver is for the General Purpose Memory Controller (GPMC) + present on Texas Instruments SoCs (e.g. OMAP2+). GPMC allows + interfacing to a variety of asynchronous as well as synchronous + memory drives like NOR, NAND, OneNAND, SRAM. + +if TI_GPMC +config TI_GPMC_DEBUG + bool "Debug Texas Instruments GPMC timings" + default n + help + Enable this to print GPMC timings before and after the GPMC registers + are programmed. This should not be left enabled on production systems. +endif + endmenu
drivers/memory/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_DM_MEMORY) += memory-uclass.o obj-$(CONFIG_SANDBOX_MEMORY) += memory-sandbox.o obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o obj-$(CONFIG_TI_AEMIF) += ti-aemif.o +obj-$(CONFIG_TI_GPMC) += ti-gpmc.o
drivers/memory/ti-gpmc.c new file +1240 -0
1,240 lines not on this page · raw message
drivers/memory/ti-gpmc.h new file +298 -0
298 lines not on this page · raw message
include/linux/mtd/omap_gpmc.h +3 -0
@@ -8,6 +8,9 @@#ifndef __ASM_OMAP_GPMC_H#define __ASM_OMAP_GPMC_H +/* Maximum Number of Chip Selects */ +#define GPMC_CS_NUM 8 +#define GPMC_BUF_EMPTY 0#define GPMC_BUF_FULL 1#define GPMC_MAX_SECTORS 8
Signature · 1 line
2.17.1