misc: pl310: add a dm cache driver
Dinh Nguyen
maintainercover misc: pl310: add a dm cache driver
Hello,
I'm soliciting comments of this patchset. The patchset adds a driver for the cache controller(specifically the PL310). This cache controller can be found on many ARMv7 SoCs. I don't think it's used on ARMv8 platforms.
This driver will retrieve the cache properties from the board DTS files and set the corresponding bits in cache controller.
I think we can do something similar without make this driver and placing the file in /arch/arm/cpu/armv7, but wanted to get feedback.
To-dos:
- Add error checking
- Add more cache properties
Thanks,
Dinh Nguyen (3):
misc: pl310: add a misc driver for the pl310 cache controller
defconfig: socfpga_sockit_defconfig: enable L2X0_CACHE driver
ARM: socfpga: let the pl310 driver configure the cache settings
arch/arm/include/asm/pl310.h | 3 ++ arch/arm/mach-socfpga/misc.c | 15 +----- configs/socfpga_sockit_defconfig | 2 + drivers/misc/Kconfig | 7 +++ drivers/misc/Makefile | 1 + drivers/misc/cache-l2x0.c | 84 ++++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 drivers/misc/cache-l2x0.c
Signature · 1 line
2.20.0
Dinh Nguyen
maintainerRFC PATCH 1/3 misc: pl310: add a misc driver for the pl310 cache controller
The driver will read the cache properties from the device tree file and set it up.
--- arch/arm/include/asm/pl310.h | 3 ++ drivers/misc/Kconfig | 7 +++ drivers/misc/Makefile | 1 + drivers/misc/cache-l2x0.c | 84 ++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 drivers/misc/cache-l2x0.c
arch/arm/include/asm/pl310.h +3 -0
@@ -18,6 +18,9 @@#define L310_SHARED_ATT_OVERRIDE_ENABLE (1 << 22)#define L310_AUX_CTRL_DATA_PREFETCH_MASK (1 << 28)#define L310_AUX_CTRL_INST_PREFETCH_MASK (1 << 29) +#define L310_LATENCY_CTRL_SETUP (n) ((n) << 0) +#define L310_LATENCY_CTRL_RD (n) ((n) << 4) +#define L310_LATENCY_CTRL_WR (n) ((n) << 8)#define L2X0_CACHE_ID_PART_MASK (0xf << 6)#define L2X0_CACHE_ID_PART_L310 (3 << 6)
drivers/misc/Kconfig +7 -0
@@ -13,6 +13,13 @@ config MISC set of generic read, write and ioctl methods may be used to access the device. +config L2X0_CACHE + bool "L2x0 Cache support" + depends on MISC + help + Select this to enable a PL310 L2 Cache driver. The driver will + configure the L2 Cache settings found in the device tree. + config ALTERA_SYSID bool "Altera Sysid support" depends on MISC
drivers/misc/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_SANDBOX) += spltest_sandbox.o endif endif obj-$(CONFIG_ALI152X) += ali512x.o +obj-$(CONFIG_L2X0_CACHE) += cache-l2x0.o obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
drivers/misc/cache-l2x0.c new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
2.20.0
RFC PATCH 1/3 misc: pl310: add a misc driver for the pl310 cache controller
Quoted 31 lines · Dinh Nguyen
The driver will read the cache properties from the device tree file and set it up.
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/include/asm/pl310.h | 3 ++ drivers/misc/Kconfig | 7 +++ drivers/misc/Makefile | 1 + drivers/misc/cache-l2x0.c | 84 ++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 drivers/misc/cache-l2x0.carch/arm/include/asm/pl310.h +3
-0@@ -18,6 +18,9 @@#define L310_SHARED_ATT_OVERRIDE_ENABLE (1 << 22)#define L310_AUX_CTRL_DATA_PREFETCH_MASK (1 << 28)#define L310_AUX_CTRL_INST_PREFETCH_MASK (1 << 29) +#define L310_LATENCY_CTRL_SETUP (n) ((n) << 0) +#define L310_LATENCY_CTRL_RD (n) ((n) << 4) +#define L310_LATENCY_CTRL_WR (n) ((n) << 8)#define L2X0_CACHE_ID_PART_MASK (0xf << 6)#define L2X0_CACHE_ID_PART_L310 (3 << 6)drivers/misc/Kconfig +0
-0
drivers/misc/Kconfig config MISC · line 21
Quoted 9 lines
drivers/misc/Kconfig +6
-0@@ -13,6 +13,13 @@ config MISC set of generic read, write and ioctl methods may be used to access the device. +config L2X0_CACHE + bool "L2x0 Cache support" + depends on MISC + help + Select this to enable a PL310 L2 Cache driver. The driver will + configure the L2 Cache settings found in the device tree.
I wonder whether we don't need some drivers/plat or drivers/soc for this ?
Quoted 21 lines
drivers/misc/Kconfig +0
-0config ALTERA_SYSID bool "Altera Sysid support" depends on MISCdrivers/misc/Makefile +1
-0@@ -23,6 +23,7 @@ obj-$(CONFIG_SANDBOX) += spltest_sandbox.o endif endif obj-$(CONFIG_ALI152X) += ali512x.o +obj-$(CONFIG_L2X0_CACHE) += cache-l2x0.o obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.odrivers/misc/cache-l2x0.c new file +0
-0
drivers/misc/cache-l2x0.c line 3
Quoted 3 lines
drivers/misc/cache-l2x0.c new file +3
-0@@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2007 ARM Limited
2007 ? :)
Quoted 7 lines
drivers/misc/cache-l2x0.c new file +7
-0+* copied from Linux(arch/arm/mm/cache-l2x0.c +*/ +#include <common.h> +#include <command.h> +#include <dm.h> + +#include <asm/io.h>
drivers/misc/cache-l2x0.c line 21
Quoted 10 lines
drivers/misc/cache-l2x0.c new file +10
-0+#include <asm/pl310.h> + +static void l2c310_of_parse (struct udevice *dev) +{ +u32 tag[3 ] = {0 ,0 ,0 }; +u32 saved_reg, prefetch_i, prefetch_d; +bool shared_override; +struct pl310_regs *regs = (struct pl310_regs *)devfdt_get_addr (dev); + +/*Disable the L2 Cache */
/*<SPACE>D
Quoted 17 lines
drivers/misc/cache-l2x0.c new file +17
-0+clrbits_le32 (®s->pl310_ctrl,L2X0_CTRL_EN ); + +dev_read_u32 (dev,"prefetch-data" , &prefetch_d); +dev_read_u32 (dev,"prefetch-instr" , &prefetch_i); + shared_override =dev_read_bool (dev,"arm,shared-override" ); + + saved_reg =readl (®s->pl310_aux_ctrl); +if (prefetch_d) + saved_reg |=L310_AUX_CTRL_DATA_PREFETCH_MASK ; +if (prefetch_i) + saved_reg |=L310_AUX_CTRL_INST_PREFETCH_MASK ; +if (shared_override) + saved_reg |=L310_SHARED_ATT_OVERRIDE_ENABLE ; + +writel (saved_reg, ®s->pl310_aux_ctrl); + + saved_reg =readl (®s->pl310_tag_latency_ctrl);
drivers/misc/cache-l2x0.c line 48
Quoted 10 lines
drivers/misc/cache-l2x0.c new file +10
-0+dev_read_u32_array (dev,"arm,tag-latency" , tag,3 ); + + saved_reg |=L310_LATENCY_CTRL_RD (tag[0 ] -1 ) | +L310_LATENCY_CTRL_WR (tag[1 ] -1 ) | +L310_LATENCY_CTRL_SETUP (tag[2 ] -1 ); + +writel (saved_reg, ®s->pl310_tag_latency_ctrl); + + saved_reg =readl (®s->pl310_data_latency_ctrl); +dev_read_u32_array (dev,"arm,data-latency" , tag,3 );
What happens if the array isn't present ? Should we _not_ configure the latencies in such case ?
Quoted 12 lines
drivers/misc/cache-l2x0.c new file +12
-0+ saved_reg |=L310_LATENCY_CTRL_RD (tag[0 ] -1 ) | +L310_LATENCY_CTRL_WR (tag[1 ] -1 ) | +L310_LATENCY_CTRL_SETUP (tag[2 ] -1 ); + +writel (saved_reg, ®s->pl310_data_latency_ctrl); + +/* Enable the L2 cache */ +setbits_le32 (®s->pl310_ctrl,L2X0_CTRL_EN ); +} + +static int l2x0_ofdata_to_platdata (struct udevice *dev) +{
drivers/misc/cache-l2x0.c line 71
Quoted 10 lines
drivers/misc/cache-l2x0.c new file +10
-0+return 0 ; +} + +static int l2x0_probe (struct udevice *dev) +{ +l2c310_of_parse (dev); +return 0 ; +} + +
Two newlines here ^ drop one
Quoted 14 lines
drivers/misc/cache-l2x0.c new file +13
-0+static const struct udevice_id l2x0_ids[] = { + { .compatible ="arm,pl310-cache" }, + {} +}; + +U_BOOT_DRIVER (pl310_cache) = { + .name ="pl310_cache" , + .id =UCLASS_MISC , + .of_match = l2x0_ids, + .probe = l2x0_probe, + .ofdata_to_platdata = l2x0_ofdata_to_platdata, + .flags =DM_FLAG_PRE_RELOC , +};
Signature · 2 lines
Best regards, Marek Vasut
Dinh Nguyen
maintainerRFC PATCH 1/3 misc: pl310: add a misc driver for the pl310 cache controller
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Dinh Nguyen
The driver will read the cache properties from the device tree file and set it up.
Quoted 8 lines
drivers/misc/Kconfig config MISC · line 21
Quoted 6 lines
drivers/misc/Kconfig +6
-0+config L2X0_CACHE + bool "L2x0 Cache support" + depends on MISC + help + Select this to enable a PL310 L2 Cache driver. The driver will + configure the L2 Cache settings found in the device tree.I wonder whether we don't need some
drivers/platordrivers/socfor this ?
You mean for plat specific implementations?
Quoted 19 lines
Quoted 19 lines
config
ALTERA_SYSIDdrivers/misc/Kconfig +0
-0bool "Altera Sysid support" depends on MISCdrivers/misc/Makefile +1
-0@@ -23,6 +23,7 @@ obj-$(CONFIG_SANDBOX) += spltest_sandbox.o endif endif obj-$(CONFIG_ALI152X) += ali512x.o +obj-$(CONFIG_L2X0_CACHE) += cache-l2x0.o obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.odrivers/misc/cache-l2x0.c new file +0
-0
Quoted 8 lines
drivers/misc/cache-l2x0.c line 3
Quoted 6 lines
drivers/misc/cache-l2x0.c new file +3
-0@@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2007 ARM Limited 2007 ? :)
I think I can remove this. I started with the Linux's cache-l2x0, but removed almost all of the code. Just a left-over artifact.
Quoted 4 lines
Quoted 4 lines
drivers/misc/cache-l2x0.c new file +4
-0+ + saved_reg |=L310_LATENCY_CTRL_RD (tag[0 ] -1 ) | +L310_LATENCY_CTRL_WR (tag[1 ] -1 ) | +L310_LATENCY_CTRL_SETUP (tag[2 ] -1 );
Quoted 8 lines
drivers/misc/cache-l2x0.c line 48
Quoted 5 lines
drivers/misc/cache-l2x0.c new file +5
-0+ +writel (saved_reg, ®s->pl310_tag_latency_ctrl); + + saved_reg =readl (®s->pl310_data_latency_ctrl); +dev_read_u32_array (dev,"arm,data-latency" , tag,3 );What happens if the array isn't present ? Should we _not_ configure the latencies in such case ?
Right, I have a to-do list that need to handle error conditions like this.
RFC PATCH 1/3 misc: pl310: add a misc driver for the pl310 cache controller
Quoted 18 lines · Dinh Nguyen
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Dinh Nguyen
The driver will read the cache properties from the device tree file and set it up.
Quoted 8 lines
drivers/misc/Kconfig config MISC · line 21
Quoted 6 lines
drivers/misc/Kconfig +6
-0+config L2X0_CACHE + bool "L2x0 Cache support" + depends on MISC + help + Select this to enable a PL310 L2 Cache driver. The driver will + configure the L2 Cache settings found in the device tree.I wonder whether we don't need some
drivers/platordrivers/socfor this ?
Quoted 1 line
You mean for plat specific implementations?
Rather, since this is ARM-specific driver.
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
config
ALTERA_SYSIDdrivers/misc/Kconfig +0
-0bool "Altera Sysid support" depends on MISCdrivers/misc/Makefile +1
-0@@ -23,6 +23,7 @@ obj-$(CONFIG_SANDBOX) += spltest_sandbox.o endif endif obj-$(CONFIG_ALI152X) += ali512x.o +obj-$(CONFIG_L2X0_CACHE) += cache-l2x0.o obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.odrivers/misc/cache-l2x0.c new file +0
-0Quoted 8 lines
drivers/misc/cache-l2x0.c line 3
Quoted 6 lines
drivers/misc/cache-l2x0.c new file +3
-0@@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2007 ARM Limited 2007 ? :)
Quoted 2 lines
I think I can remove this. I started with the Linux's cache-l2x0, but removed almost all of the code. Just a left-over artifact.
2007-2019 then ?
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/cache-l2x0.c new file +4
-0+ + saved_reg |=L310_LATENCY_CTRL_RD (tag[0 ] -1 ) | +L310_LATENCY_CTRL_WR (tag[1 ] -1 ) | +L310_LATENCY_CTRL_SETUP (tag[2 ] -1 );Quoted 8 lines
drivers/misc/cache-l2x0.c line 48
Quoted 5 lines
drivers/misc/cache-l2x0.c new file +5
-0+ +writel (saved_reg, ®s->pl310_tag_latency_ctrl); + + saved_reg =readl (®s->pl310_data_latency_ctrl); +dev_read_u32_array (dev,"arm,data-latency" , tag,3 );What happens if the array isn't present ? Should we _not_ configure the latencies in such case ?
Quoted 1 line
Right, I have a to-do list that need to handle error conditions like this.
Please fix.
Signature · 2 lines
Best regards, Marek Vasut
Dinh Nguyen
maintainerRFC PATCH 2/3 defconfig: socfpga_sockit_defconfig: enable L2X0_CACHE driver
In reply to Dinh NguyenEnable CONFIG_MISC and CONFIG_L2X0_CACHE config options.
--- configs/socfpga_sockit_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/socfpga_sockit_defconfig +2 -0
@@ -47,6 +47,8 @@ CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DW=y +CONFIG_MISC=y +CONFIG_L2X0_CACHE=y CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_MTD_DEVICE=y
Signature · 1 line
2.20.0
RFC PATCH 2/3 defconfig: socfpga_sockit_defconfig: enable L2X0_CACHE driver
Quoted 12 lines · Dinh Nguyen
Enable
CONFIG_MISCandCONFIG_L2X0_CACHEconfig options.Signed-off-by Dinh Nguyen <[email protected]>--- configs/socfpga_sockit_defconfig | 2 ++ 1 file changed, 2 insertions(+)configs/socfpga_sockit_defconfig +0
-0
configs/socfpga_sockit_defconfig CONFIG_DM_GPIO=y · line 54
Quoted 8 lines
configs/socfpga_sockit_defconfig +2
-0@@ -47,6 +47,8 @@ CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DW=y +CONFIG_MISC=y +CONFIG_L2X0_CACHE=y CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_MTD_DEVICE=y
I think you can just add it as a default into arch/arm/socfpga/Kconfig with 'imply CONFIG_...' instead.
Signature · 2 lines
Best regards, Marek Vasut
Dinh Nguyen
maintainerRFC PATCH 2/3 defconfig: socfpga_sockit_defconfig: enable L2X0_CACHE driver
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Dinh Nguyen
Enable
CONFIG_MISCandCONFIG_L2X0_CACHEconfig options.Signed-off-by Dinh Nguyen <[email protected]>--- configs/socfpga_sockit_defconfig | 2 ++ 1 file changed, 2 insertions(+)
Quoted 17 lines
configs/socfpga_sockit_defconfig CONFIG_DM_GPIO=y · line 54
Quoted 13 lines
configs/socfpga_sockit_defconfig +2
-0@@ -47,6 +47,8 @@ CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DW=y +CONFIG_MISC=y +CONFIG_L2X0_CACHE=y CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_MTD_DEVICE=yI think you can just add it as a default into
arch/arm/socfpga/Kconfigwith 'implyCONFIG_...' instead.
Ah, yes...thanks. This would prevent the need make the same edits for all the other socfpga_*_defconfigs.
Dinh
RFC PATCH 2/3 defconfig: socfpga_sockit_defconfig: enable L2X0_CACHE driver
Quoted 29 lines · Dinh Nguyen
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Dinh Nguyen
Enable
CONFIG_MISCandCONFIG_L2X0_CACHEconfig options.Signed-off-by Dinh Nguyen <[email protected]>--- configs/socfpga_sockit_defconfig | 2 ++ 1 file changed, 2 insertions(+)Quoted 17 lines
configs/socfpga_sockit_defconfig CONFIG_DM_GPIO=y · line 54
Quoted 13 lines
configs/socfpga_sockit_defconfig +2
-0@@ -47,6 +47,8 @@ CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DW=y +CONFIG_MISC=y +CONFIG_L2X0_CACHE=y CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_MTD_DEVICE=yI think you can just add it as a default into
arch/arm/socfpga/Kconfigwith 'implyCONFIG_...' instead.
Quoted 2 lines
Ah, yes...thanks. This would prevent the need make the same edits for all the other socfpga_*_defconfigs.
Right
Signature · 2 lines
Best regards, Marek Vasut
Dinh Nguyen
maintainerRFC PATCH 3/3 ARM: socfpga: let the pl310 driver configure the cache settings
In reply to Dinh NguyenLoad the PL310 L2 cache driver and allow it to setup the cache settings
--- arch/arm/mach-socfpga/misc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
arch/arm/mach-socfpga/misc.c +2 -13
@@ -59,20 +59,9 @@ void enable_caches(void)#ifdef CONFIG_SYS_L2_PL310 void v7_outer_cache_enable (void ) { -/* Disable the L2 cache */ -clrbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); - -writel (0x111 , &pl310->pl310_tag_latency_ctrl); -writel (0x121 , &pl310->pl310_data_latency_ctrl); - -/* enable BRESP, instruction and data prefetch, full line of zeroes */ -setbits_le32 (&pl310->pl310_aux_ctrl, -L310_AUX_CTRL_DATA_PREFETCH_MASK | -L310_AUX_CTRL_INST_PREFETCH_MASK | -L310_SHARED_ATT_OVERRIDE_ENABLE ); +struct udevice *dev; -/* Enable the L2 cache */ -setbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); +uclass_first_device (UCLASS_MISC , &dev); }void v7_outer_cache_disable (void )
Signature · 1 line
2.20.0
RFC PATCH 3/3 ARM: socfpga: let the pl310 driver configure the cache settings
Quoted 21 lines · Dinh Nguyen
Load the PL310 L2 cache driver and allow it to setup the cache settings
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/mach-socfpga/misc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)arch/arm/mach-socfpga/misc.c +0
-6@@ -59,20 +59,9 @@ void enable_caches(void)#ifdef CONFIG_SYS_L2_PL310 void v7_outer_cache_enable (void ) { -/* Disable the L2 cache */ -clrbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); - -writel (0x111 , &pl310->pl310_tag_latency_ctrl); -writel (0x121 , &pl310->pl310_data_latency_ctrl); -
arch/arm/mach-socfpga/misc.c void enable_caches(void) · line 64
Quoted 10 lines
arch/arm/mach-socfpga/misc.c +2
-7-/* enable BRESP, instruction and data prefetch, full line of zeroes */ -setbits_le32 (&pl310->pl310_aux_ctrl, -L310_AUX_CTRL_DATA_PREFETCH_MASK | -L310_AUX_CTRL_INST_PREFETCH_MASK | -L310_SHARED_ATT_OVERRIDE_ENABLE ); +struct udevice *dev; -/* Enable the L2 cache */ -setbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); +uclass_first_device (UCLASS_MISC , &dev);
Error handling might help here
Quoted 4 lines
arch/arm/mach-socfpga/misc.c +0
-0}void v7_outer_cache_disable (void )
Signature · 2 lines
Best regards, Marek Vasut
Dinh Nguyen
maintainerRFC PATCH 3/3 ARM: socfpga: let the pl310 driver configure the cache settings
Quoted 29 lines · Marek Vasut
Quoted 28 lines · Dinh Nguyen
Load the PL310 L2 cache driver and allow it to setup the cache settings
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/mach-socfpga/misc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)arch/arm/mach-socfpga/misc.c +1
-11@@ -59,20 +59,9 @@ void enable_caches(void)#ifdef CONFIG_SYS_L2_PL310 void v7_outer_cache_enable (void ) { -/* Disable the L2 cache */ -clrbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); - -writel (0x111 , &pl310->pl310_tag_latency_ctrl); -writel (0x121 , &pl310->pl310_data_latency_ctrl); - -/* enable BRESP, instruction and data prefetch, full line of zeroes */ -setbits_le32 (&pl310->pl310_aux_ctrl, -L310_AUX_CTRL_DATA_PREFETCH_MASK | -L310_AUX_CTRL_INST_PREFETCH_MASK | -L310_SHARED_ATT_OVERRIDE_ENABLE ); +struct udevice *dev;
Quoted 6 lines
arch/arm/mach-socfpga/misc.c void enable_caches(void) · line 64
Quoted 3 lines
arch/arm/mach-socfpga/misc.c +1
-2-/* Enable the L2 cache */ -setbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); +uclass_first_device (UCLASS_MISC , &dev);Error handling might help here
Agreed..Just trying to solicit comments on whether this is the right approach? Will add error handling..
Thanks for reviewing...
Dinh
RFC PATCH 3/3 ARM: socfpga: let the pl310 driver configure the cache settings
Quoted 39 lines · Dinh Nguyen
Quoted 29 lines · Marek Vasut
Quoted 28 lines · Dinh Nguyen
Load the PL310 L2 cache driver and allow it to setup the cache settings
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/mach-socfpga/misc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)arch/arm/mach-socfpga/misc.c +1
-11@@ -59,20 +59,9 @@ void enable_caches(void)#ifdef CONFIG_SYS_L2_PL310 void v7_outer_cache_enable (void ) { -/* Disable the L2 cache */ -clrbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); - -writel (0x111 , &pl310->pl310_tag_latency_ctrl); -writel (0x121 , &pl310->pl310_data_latency_ctrl); - -/* enable BRESP, instruction and data prefetch, full line of zeroes */ -setbits_le32 (&pl310->pl310_aux_ctrl, -L310_AUX_CTRL_DATA_PREFETCH_MASK | -L310_AUX_CTRL_INST_PREFETCH_MASK | -L310_SHARED_ATT_OVERRIDE_ENABLE ); +struct udevice *dev;Quoted 6 lines
arch/arm/mach-socfpga/misc.c void enable_caches(void) · line 64
Quoted 3 lines
arch/arm/mach-socfpga/misc.c +1
-2-/* Enable the L2 cache */ -setbits_le32 (&pl310->pl310_ctrl,L2X0_CTRL_EN ); +uclass_first_device (UCLASS_MISC , &dev);Error handling might help here
Quoted 2 lines
Agreed..Just trying to solicit comments on whether this is the right approach? Will add error handling..
I think so.
Signature · 2 lines
Best regards, Marek Vasut