Skip to contentSkip to conversation

driver/edac/fsl_ddr: Add support of little endian

PATCH NAK York Sun 10 participants 48 messages Aug 4, 2016 – Aug 9, 2016 2 messages not in the archive

Subsystems (11)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

York Sun

author
#1 lore raw

PATCH v3 1/11 arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Two symbols are missing if mpc85xx_edac driver is compiled as module.

---
Change log
v3: Change subject tag
v2: no change

 arch/powerpc/kernel/pci-common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/pci-common.c +2 -0
index 0f7a60f..86bc484 100644
@@ -226,6 +226,7 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(pci_find_hose_for_OF_device);
 
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
 {
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
 }
+EXPORT_SYMBOL(early_find_capability);
 
 struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 {
Signature · 1 line
2.7.4
Reviewed-by on v3 1/11
#2 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 3 lines · York Sun

Two symbols are missing if mpc85xx_edac driver is compiled as module.

Good catch! One comment below.

arch/powerpc/kernel/pci-common.c int early_find_capability(struct pci_controller *hose, int bus, int devfn, · line 1589

Quoted 7 lines

/*
* Reads the interrupt pin to determine if interrupt is use by card.

arch/powerpc/kernel/pci-common.c +1 -0
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
 {
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
 }
+EXPORT_SYMBOL(early_find_capability);

It'd be nicer for this to be renamed as "pci_early_find_capability" or something like that with a "namespace", I think.

Andrew

Signature · 2 lines
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]  IBM Australia Limited
author
#3 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 9 lines · Andrew Donnellan
Quoted 3 lines · York Sun

Two symbols are missing if mpc85xx_edac driver is compiled as module.

Good catch! One comment below.

Quoted 11 lines

arch/powerpc/kernel/pci-common.c int early_find_capability(struct pci_controller *hose, int bus, int devfn, · line 1589

Quoted 7 lines

/*
* Reads the interrupt pin to determine if interrupt is use by card.

arch/powerpc/kernel/pci-common.c +1 -0
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
 {
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
 }
+EXPORT_SYMBOL(early_find_capability);

It'd be nicer for this to be renamed as "pci_early_find_capability" or something like that with a "namespace", I think.

I will rename it if I respin this patch for any reason. Otherwise, I will send out another patch to rename it after merging.

York

maintainer
#4 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 2 lines · york sun

I will rename it if I respin this patch for any reason. Otherwise, I will send out another patch to rename it after merging.

Feel free to send an updated one as a reply to this thread.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#5 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

In reply to York Sun
Quoted 25 lines · York Sun

Two symbols are missing if mpc85xx_edac driver is compiled as module.

---
Change log
v3: Change subject tag
v2: no change

 arch/powerpc/kernel/pci-common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/pci-common.c +1 -0
index 0f7a60f..86bc484 100644
@@ -226,6 +226,7 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(pci_find_hose_for_OF_device);
 
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.

arch/powerpc/kernel/pci-common.c int early_find_capability(struct pci_controller *hose, int bus, int devfn, · line 1589

Quoted 4 lines
arch/powerpc/kernel/pci-common.c +1 -0
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
 {
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
 }
+EXPORT_SYMBOL(early_find_capability);

Does the driver really need to use these routines? They're meant for use early in boot, before PCI is setup.

AFAICS this is just a regular driver, so when it's probed the PCI devices should have already been scanned. In which case pci_get_device() could work couldn't it? (I see other edac drivers doing that).

cheers

author
#6 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

On 08/04/2016 08:43 PM, Michael Ellerman wrote:=0A=

Quoted 15 lines

York Sun <[email protected]> writes:=0A=
=0A=

arch/powerpc/kernel/pci-=

Quoted 13 lines

Two symbols are missing if mpc85xx_edac driver is compiled as module.=0A= =0A=

=0A=
---=0A=
Change log=0A=
v3: Change subject tag=0A=
v2: no change=0A=
=0A=
arch/powerpc/kernel/pci-common.c | 2 ++=0A=

 1 file changed, 2 insertions(+)=0A=

=0A=

arch/powerpc/kernel/pci-= renamed from arch/powerpc/kernel/pci-common.c +0 -0

common.c=0A=

Quoted 4 lines

arch/powerpc/kernel/pci-common.c=0A= struct pci_controller* pci_find_hose_for_OF_device(s=

Quoted 4 lines

index 0f7a60f..86bc484 100644=0A=

arch/powerpc/kernel/pci-common.c=0A= +0 -0
@@ -226,6 +226,7 @@ struct pci_controller* pci_find_hose_for_OF_device(s=

truct device_node* node)=0A=

Quoted 8 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h=

Quoted 8 lines
arch/powerpc/kernel/pci-common.c=0A= +1 -0
 	}=0A=
 	return NULL;=0A=
 }=0A=
+EXPORT_SYMBOL(pci_find_hose_for_OF_device);=0A=

=0A=
/*=0A=
* Reads the interrupt pin to determine if interrupt is use by card.=0A=

arch/powerpc/kernel/pci-common.c=0A= +0 -0
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *h=

ose, int bus, int devfn,=0A=

Quoted 2 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h= · line 1587

Quoted 2 lines
arch/powerpc/kernel/pci-common.c=0A= +0 -0
 {=0A=
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);=

=0A=

Quoted 4 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h= · line 1589

Quoted 2 lines
arch/powerpc/kernel/pci-common.c=0A= +1 -0
 }=0A=
+EXPORT_SYMBOL(early_find_capability);=0A=

=0A=
Does the driver really need to use these routines? They're meant for use=

=0A=

Quoted 4 lines

early in boot, before PCI is setup.=0A=
=0A=
AFAICS this is just a regular driver, so when it's probed the PCI=0A= devices should have already been scanned. In which case pci_get_device()=

=0A=

Quoted 2 lines

could work couldn't it? (I see other edac drivers doing that).=0A= =0A=

=0A=
I don't have deep knowledge of this driver. What I am trying is to =0A= separate the common DDR part and share it with ARM platforms. Along the =0A= way, I found the compiling error if build a module. If exposing these =0A= functions becomes a concern, I can live without it.=0A=
=0A=
York=0A=
=0A=

maintainer
#7 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 4 lines · york sun

I don't have deep knowledge of this driver. What I am trying is to separate the common DDR part and share it with ARM platforms. Along the way, I found the compiling error if build a module. If exposing these functions becomes a concern, I can live without it.

Perhaps you or Johannes could fix this properly to use pci_get_device() as the rest of the EDAC drivers do, instead of exporting core PCI functions...

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#8 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 9 lines · Borislav Petkov
Quoted 4 lines · york sun

I don't have deep knowledge of this driver. What I am trying is to separate the common DDR part and share it with ARM platforms. Along the way, I found the compiling error if build a module. If exposing these functions becomes a concern, I can live without it.

Perhaps you or Johannes could fix this properly to use pci_get_device() as the rest of the EDAC drivers do, instead of exporting core PCI functions...

I can give it a shot, but I don't have too much spare time atm and no hardware to test, so it'll have a strong RFC smell attached to it.

Byte,
Johannes

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
author
#9 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

In reply to Borislav Petkov

On 08/05/2016 12:01 AM, Borislav Petkov wrote:=0A=

Quoted 3 lines

On Fri, Aug 05, 2016 at 04:26:26AM +0000, york sun wrote:=0A=

Quoted 2 lines

I don't have deep knowledge of this driver. What I am trying is to=0A= separate the common DDR part and share it with ARM platforms. Along the=

=0A=

Quoted 4 lines
Quoted 2 lines

way, I found the compiling error if build a module. If exposing these=0A= functions becomes a concern, I can live without it.=0A=

=0A=
Perhaps you or Johannes could fix this properly to use pci_get_device()=

=0A=

Quoted 3 lines

as the rest of the EDAC drivers do, instead of exporting core PCI=0A= functions...=0A=
=0A=

=0A=
Boris,=0A=
=0A=
I'd like to separate the first two patches from this set. They are not =0A= really related to the DDR part I am working on. It will take me a while =0A= to sort out the correct fix.=0A=
=0A=
York=0A=

author
#10 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

In reply to Michael Ellerman

On 08/04/2016 08:43 PM, Michael Ellerman wrote:=0A=

Quoted 15 lines

York Sun <[email protected]> writes:=0A=
=0A=

arch/powerpc/kernel/pci-=

Quoted 13 lines

Two symbols are missing if mpc85xx_edac driver is compiled as module.=0A= =0A=

=0A=
---=0A=
Change log=0A=
v3: Change subject tag=0A=
v2: no change=0A=
=0A=
arch/powerpc/kernel/pci-common.c | 2 ++=0A=

 1 file changed, 2 insertions(+)=0A=

=0A=

arch/powerpc/kernel/pci-= renamed from arch/powerpc/kernel/pci-common.c +0 -0

common.c=0A=

Quoted 4 lines

arch/powerpc/kernel/pci-common.c=0A= struct pci_controller* pci_find_hose_for_OF_device(s=

Quoted 4 lines

index 0f7a60f..86bc484 100644=0A=

arch/powerpc/kernel/pci-common.c=0A= +0 -0
@@ -226,6 +226,7 @@ struct pci_controller* pci_find_hose_for_OF_device(s=

truct device_node* node)=0A=

Quoted 8 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h=

Quoted 8 lines
arch/powerpc/kernel/pci-common.c=0A= +1 -0
 	}=0A=
 	return NULL;=0A=
 }=0A=
+EXPORT_SYMBOL(pci_find_hose_for_OF_device);=0A=

=0A=
/*=0A=
* Reads the interrupt pin to determine if interrupt is use by card.=0A=

arch/powerpc/kernel/pci-common.c=0A= +0 -0
@@ -1585,6 +1586,7 @@ int early_find_capability(struct pci_controller *h=

ose, int bus, int devfn,=0A=

Quoted 2 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h= · line 1587

Quoted 2 lines
arch/powerpc/kernel/pci-common.c=0A= +0 -0
 {=0A=
 	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);=

=0A=

Quoted 4 lines

arch/powerpc/kernel/pci-common.c=0A= int early_find_capability(struct pci_controller *h= · line 1589

Quoted 2 lines
arch/powerpc/kernel/pci-common.c=0A= +1 -0
 }=0A=
+EXPORT_SYMBOL(early_find_capability);=0A=

=0A=
Does the driver really need to use these routines? They're meant for use=

=0A=

Quoted 4 lines

early in boot, before PCI is setup.=0A=
=0A=
AFAICS this is just a regular driver, so when it's probed the PCI=0A= devices should have already been scanned. In which case pci_get_device()=

=0A=

Quoted 1 line

could work couldn't it? (I see other edac drivers doing that).=0A=

=0A=
I am trying to fix this but need some help. We are dealing with PCIe =0A= controller here. Does it have a bus number assigned at this point? If =0A= yes, how can I find it? I seem not able to find out where the =0A= platform_data is filled as well. Can someone kindly point it out to me?=0A= =0A=
York=0A=
=0A=

maintainer
#11 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 5 lines · york sun
Quoted 4 lines · Michael Ellerman

Does the driver really need to use these routines? They're meant for use early in boot, before PCI is setup.

Quoted 7 lines
Quoted 3 lines

AFAICS this is just a regular driver, so when it's probed the PCI devices should have already been scanned. In which case pci_get_device() could work couldn't it? (I see other edac drivers doing that).

I am trying to fix this but need some help. We are dealing with PCIe controller here. Does it have a bus number assigned at this point? If yes, how can I find it? I seem not able to find out where the platform_data is filled as well. Can someone kindly point it out to me?

The platform data comes from add_err_dev() in arch/powerpc/sysdev/fsl_pci.c.

-Scott

author
#12 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

On 08/05/2016 02:09 PM, Scott Wood wrote:=0A=

Quoted 4 lines

On Fri, 2016-08-05 at 20:29 +0000, york sun wrote:=0A=

Quoted 3 lines

On 08/04/2016 08:43 PM, Michael Ellerman wrote:=0A=

Quoted 2 lines

=0A=
Does the driver really need to use these routines? They're meant for us=

e=0A=

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

early in boot, before PCI is setup.=0A=
=0A=
AFAICS this is just a regular driver, so when it's probed the PCI=0A= devices should have already been scanned. In which case pci_get_device(=

)=0A=

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

could work couldn't it? (I see other edac drivers doing that).=0A=

I am trying to fix this but need some help. We are dealing with PCIe=0A= controller here. Does it have a bus number assigned at this point? If=0A= yes, how can I find it? I seem not able to find out where the=0A= platform_data is filled as well. Can someone kindly point it out to me?=

=0A=

Quoted 3 lines

=0A=
=0A=
The platform data comes from add_err_dev() in arch/powerpc/sysdev/fsl_pci=

.c.=0A=

Quoted 1 line

=0A=

=0A=
Thanks, Scott.=0A=
=0A=
When add_err_dev() is called, pci is not scanned, is using =0A= early_find_capability() justified?=0A=
=0A=
York=0A=

maintainer
#13 lore raw

Re: [Patch v3 01/11] arch/powerpc/pci: Fix compiling error for mpc85xx_edac

Quoted 20 lines · york sun
Quoted 19 lines · Scott Wood
Quoted 16 lines · york sun
Quoted 10 lines · Michael Ellerman

Does the driver really need to use these routines? They're meant for use
early in boot, before PCI is setup.

AFAICS this is just a regular driver, so when it's probed the PCI devices should have already been scanned. In which case pci_get_device()
could work couldn't it? (I see other edac drivers doing that).

I am trying to fix this but need some help. We are dealing with PCIe controller here. Does it have a bus number assigned at this point? If yes, how can I find it? I seem not able to find out where the platform_data is filled as well. Can someone kindly point it out to me?

Quoted 7 lines
Quoted 3 lines

The platform data comes from add_err_dev() in
arch/powerpc/sysdev/fsl_pci.c.

Thanks, Scott.

When add_err_dev() is called, pci is not scanned, is using early_find_capability() justified?

The edac driver is registered with a normal device-level initcall.  The PCI scanning appears to happen at the subsys initcall level.

-Scott

author
#14 lore raw

PATCH v3 2/11 arch/microblaze/pci: Drop early_find_capability()

In reply to a message not in the archive

This function is a copy from powerpc, and is never used on microblaze.

---
This patch has nothing to do with this EDAC patch set, but suggested by Bjorn Helgaas as good code hygiene, along with patch 01/11 to expose early_find_capability() for powerpc.

Change log
v3: new patch

 arch/microblaze/include/asm/pci-bridge.h | 3 ---
 arch/microblaze/pci/pci-common.c         | 7 -------
 2 files changed, 10 deletions(-)
arch/microblaze/include/asm/pci-bridge.h +0 -3
index cb5d397..a0f4a91 100644
@@ -121,9 +121,6 @@ extern int early_write_config_word(struct pci_controller *hose, int bus,
 extern int early_write_config_dword(struct pci_controller *hose, int bus,
 			int dev_fn, int where, u32 val);
 
-extern int early_find_capability(struct pci_controller *hose, int bus,
-				 int dev_fn, int cap);
-
 extern void setup_indirect_pci(struct pci_controller *hose,
 			       resource_size_t cfg_addr,
 			       resource_size_t cfg_data, u32 flags);
arch/microblaze/pci/pci-common.c +0 -7
index 14cba60..2f4c79e 100644
@@ -1461,10 +1461,3 @@ EARLY_PCI_OP(read, dword, u32 *)
 EARLY_PCI_OP(write, byte, u8)
 EARLY_PCI_OP(write, word, u16)
 EARLY_PCI_OP(write, dword, u32)
-
-int early_find_capability(struct pci_controller *hose, int bus, int devfn,
-			  int cap)
-{
-	return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
-}
-
Signature · 1 line
2.7.4
author
#15 lore raw

PATCH v3 3/11 driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

In reply to a message not in the archive

On e500v1, read fault exception enable (RFXE) controls whether assertion of core_fault_in causes a machine check interrupt. Assertion of core_fault_in can result from uncorrectable data error, such as an L2 multibit ECC error. It can also occur from a system error if logic on the integrated device signals a fault for nonfatal errors. RFXE bit is cleared out of reset, and should be left clear for normal operation. Assertion of core_fault_in does not cause a machine check.

RFXE is set specifically for RIO (Rapid IO) and PCI for book E to catch the errors by machine check. With this bit set, EDAC driver can't get the interrupt in case of uncorrectable error. So this bit is cleared in favor of EDAC. However, the benefit of catching such uncorrectable error doesn't outweight the other errors which may hang the system. Beside, e500v2 has different errors maksed by RFXE, and e500mc doesn't support this bit. It is more reasonable to leave RFXE as is in EDAC driver, and leave the uncorrectable errors triggering machine check for e500v1.

---
Change log
v3: Revise commit message
v2: new patch in this set

 drivers/edac/mpc85xx_edac.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)
drivers/edac/mpc85xx_edac.c +0 -40
index ca63d0d..fdc3d9b 100644
@@ -46,9 +46,6 @@ static u32 orig_pci_err_en;
 #endif
 
 static u32 orig_l2_err_disable;
-#ifdef CONFIG_FSL_SOC_BOOKE
-static u32 orig_hid1[2];
-#endif
 
 /************************ MC SYSFS parts ***********************************/
 
@@ -1225,14 +1222,6 @@ static struct platform_driver mpc85xx_mc_err_driver = {
 	},
 };
 
-#ifdef CONFIG_FSL_SOC_BOOKE
-static void __init mpc85xx_mc_clear_rfxe(void *data)
-{
-	orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1);
-	mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~HID1_RFXE));
-}
-#endif
-
 static struct platform_driver * const drivers[] = {
 	&mpc85xx_mc_err_driver,
 	&mpc85xx_l2_err_driver,
@@ -1263,42 +1252,13 @@ static int __init mpc85xx_mc_init(void)
 	if (res)
 		printk(KERN_WARNING EDAC_MOD_STR "drivers fail to register\n");
 
-#ifdef CONFIG_FSL_SOC_BOOKE
-	pvr = mfspr(SPRN_PVR);
-
-	if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
-	    (PVR_VER(pvr) == PVR_VER_E500V2)) {
-		/*
-		 * need to clear HID1[RFXE] to disable machine check int
-		 * so we can catch it
-		 */
-		if (edac_op_state == EDAC_OPSTATE_INT)
-			on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0);
-	}
-#endif
-
 	return 0;
 }
 
 module_init(mpc85xx_mc_init);
 
-#ifdef CONFIG_FSL_SOC_BOOKE
-static void __exit mpc85xx_mc_restore_hid1(void *data)
-{
-	mtspr(SPRN_HID1, orig_hid1[smp_processor_id()]);
-}
-#endif
-
 static void __exit mpc85xx_mc_exit(void)
 {
-#ifdef CONFIG_FSL_SOC_BOOKE
-	u32 pvr = mfspr(SPRN_PVR);
-
-	if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
-	    (PVR_VER(pvr) == PVR_VER_E500V2)) {
-		on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
-	}
-#endif
 	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
Signature · 1 line
2.7.4
maintainer
#16 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 9 lines · York Sun

On e500v1, read fault exception enable (RFXE) controls whether assertion of core_fault_in causes a machine check interrupt. Assertion of core_fault_in can result from uncorrectable data error, such as an L2 multibit ECC error. It can also occur from a system error if logic on the integrated device signals a fault for nonfatal errors. RFXE bit is cleared out of reset, and should be left clear for normal operation. Assertion of core_fault_in does not cause a machine check.

Quoted 9 lines

RFXE is set specifically for RIO (Rapid IO) and PCI for book E to catch the errors by machine check. With this bit set, EDAC driver can't get the interrupt in case of uncorrectable error. So this bit is cleared in favor of EDAC. However, the benefit of catching such uncorrectable error doesn't outweight the other errors which may hang the system. Beside, e500v2 has different errors maksed by RFXE, and e500mc doesn't support this bit. It is more reasonable to leave RFXE as is in EDAC driver, and leave the uncorrectable errors triggering machine check for e500v1.

Very nice, thanks for expanding it!

Two final remarks:

- please use a spell checker

- now, what happens if you leave RFXE clear and mpc85xx_edac gets the error? Is it going to do proper error handling of the uncorrectable error or are we better off handling the error in the #MC interrupt handler?

IOW, is mpc85xx_edac well equipped to handle those multibit errors or should we leave the current setting as is?

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#17 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 26 lines · Borislav Petkov
Quoted 9 lines · York Sun

On e500v1, read fault exception enable (RFXE) controls whether assertion of core_fault_in causes a machine check interrupt. Assertion of core_fault_in can result from uncorrectable data error, such as an L2 multibit ECC error. It can also occur from a system error if logic on the integrated device signals a fault for nonfatal errors. RFXE bit is cleared out of reset, and should be left clear for normal operation. Assertion of core_fault_in does not cause a machine check.

Quoted 9 lines

RFXE is set specifically for RIO (Rapid IO) and PCI for book E to catch the errors by machine check. With this bit set, EDAC driver can't get the interrupt in case of uncorrectable error. So this bit is cleared in favor of EDAC. However, the benefit of catching such uncorrectable error doesn't outweight the other errors which may hang the system. Beside, e500v2 has different errors maksed by RFXE, and e500mc doesn't support this bit. It is more reasonable to leave RFXE as is in EDAC driver, and leave the uncorrectable errors triggering machine check for e500v1.

Very nice, thanks for expanding it!

Two final remarks:

- please use a spell checker

Quoted 8 lines

- now, what happens if you leave RFXE clear and mpc85xx_edac gets the error? Is it going to do proper error handling of the uncorrectable error or are we better off handling the error in the #MC interrupt handler?

IOW, is mpc85xx_edac well equipped to handle those multibit errors or should we leave the current setting as is?

RFXE is cleared by default. So for most SoCs, this is not even a concern at all. But for e500v1, when RIO or PCI are used, this bit is set specifically to catch an error by machine check (see commit 4e0e3435). This is not the uncorrectable error from DDR. We will be better off to let this error happen.

York

maintainer
#18 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 5 lines · york sun

RFXE is cleared by default. So for most SoCs, this is not even a concern at all. But for e500v1, when RIO or PCI are used, this bit is set specifically to catch an error by machine check (see commit 4e0e3435). This is not the uncorrectable error from DDR. We will be better off to let this error happen.

So I'm reading this: "With this bit set, EDAC driver can't get the interrupt in case of uncorrectable error. So this bit is cleared in favor of EDAC."

AFAIU, it means, RFXE bit remains clear so EDAC will get the interrupt for the uncorrectable error (UE). So on those !e500v1 systems, EDAC be handling those UEs.

Am I close?

If so, can EDAC handle the UE?

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#19 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 11 lines · Borislav Petkov
Quoted 5 lines · york sun

RFXE is cleared by default. So for most SoCs, this is not even a concern at all. But for e500v1, when RIO or PCI are used, this bit is set specifically to catch an error by machine check (see commit 4e0e3435). This is not the uncorrectable error from DDR. We will be better off to let this error happen.

So I'm reading this: "With this bit set, EDAC driver can't get the interrupt in case of uncorrectable error. So this bit is cleared in favor of EDAC."

Quoted 8 lines

AFAIU, it means, RFXE bit remains clear so EDAC will get the interrupt for the uncorrectable error (UE). So on those !e500v1 systems, EDAC be handling those UEs.

Am I close?

If so, can EDAC handle the UE?

Yes, for most SoCs RFXE remains cleared. Uncorrectable errors are handled by EDAC.

York

maintainer
#20 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 2 lines · york sun

Yes, for most SoCs RFXE remains cleared. Uncorrectable errors are handled by EDAC.

And how is mpc85_xxx EDAC handling them?

mpc85xx_mc_check() only reports them.

And now to get to my original question: is it *enough* to report uncorrectable errors on those platforms or do they need more sophisticated error handling in order to disable data corruption?

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#21 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 7 lines · Borislav Petkov
Quoted 2 lines · york sun

Yes, for most SoCs RFXE remains cleared. Uncorrectable errors are handled by EDAC.

And how is mpc85_xxx EDAC handling them?

mpc85xx_mc_check() only reports them.

Correct. It can only report this kind of error. It is not correctable. Nothing more can be done.

Quoted 5 lines

And now to get to my original question: is it *enough* to report uncorrectable errors on those platforms or do they need more sophisticated error handling in order to disable data corruption?

It is uncorrectable. DDR controller can only report the error. I don't believe EDAC driver can do more. For the same reason I said we can leave RXFE as is, even for e500v1 case (with RIO or PCI is enabled). Nothing can be done with uncorrectable error.

York

maintainer
#22 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 4 lines · york sun

It is uncorrectable. DDR controller can only report the error. I don't believe EDAC driver can do more. For the same reason I said we can leave RXFE as is, even for e500v1 case (with RIO or PCI is enabled). Nothing can be done with uncorrectable error.

Of course it can: it can panic the machine so that it doesn't corrupt data on secondary storage. You might consider whether this is a better course of action instead of only reporting the error.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#24 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 12 lines · On 08/09/2016 08:57 AM, [email protected] wrote:
Quoted 10 lines · Borislav Petkov
Quoted 4 lines · york sun

It is uncorrectable. DDR controller can only report the error. I don't believe EDAC driver can do more. For the same reason I said we can leave RXFE as is, even for e500v1 case (with RIO or PCI is enabled). Nothing can be done with uncorrectable error.

Of course it can: it can panic the machine so that it doesn't corrupt data on secondary storage. You might consider whether this is a better course of action instead of only reporting the error.

Quoted 8 lines

Boris,

My opinion is the error shouldn't happen at the first place. It usually means wrong configuration or physical error on the hardware. An EDAC driver can report these errors. How far you want to go on the error handling is up for discussion. I don't think we should include those improvement in this patch set.

I want to add this, normally uncorrectable errors don't trigger machine check on e500v1. RXFE controls different interrupt on e500v2. e500mc doesn't support RXFE. Together with the reason I explained, I believe EDAC driver shouldn't change RXFE.

I hope I made it clear.

York

maintainer
#25 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

Quoted 6 lines · york sun

I want to add this, normally uncorrectable errors don't trigger machine check on e500v1. RXFE controls different interrupt on e500v2. e500mc doesn't support RXFE. Together with the reason I explained, I believe EDAC driver shouldn't change RXFE.

I hope I made it clear.

Yes, you did, thanks. I reread Scott's previous mail too and yes, it doesn't make a whole lotta sense to touch the RXFE bit in EDAC. I'm assuming firmware leaves it cleared coming out of reset so we're all good.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#26 lore raw

Re: [Patch v3 03/11] driver/edac/mpc85xx_edac: Drop setting/clearing RFXE bit in HID1

In reply to Borislav Petkov
Quoted 10 lines · Borislav Petkov
Quoted 4 lines · york sun

It is uncorrectable. DDR controller can only report the error. I don't believe EDAC driver can do more. For the same reason I said we can leave RXFE as is, even for e500v1 case (with RIO or PCI is enabled). Nothing can be done with uncorrectable error.

Of course it can: it can panic the machine so that it doesn't corrupt data on secondary storage. You might consider whether this is a better course of action instead of only reporting the error.

Boris,

My opinion is the error shouldn't happen at the first place. It usually means wrong configuration or physical error on the hardware. An EDAC driver can report these errors. How far you want to go on the error handling is up for discussion. I don't think we should include those improvement in this patch set.

York

author
#27 lore raw

PATCH v3 4/11 driver/edac/mpc85xx_edac: Replace printk with proper pr_* format

In reply to a message not in the archive

Replace printk with more preferred pr_err/pr_warn/pr_info format.

---
Change log
v3: no change
v2: Reordered patch. Change more printk statement than v1 patch.

 drivers/edac/mpc85xx_edac.c | 72 ++++++++++++++++++++++-----------------------
 1 file changed, 35 insertions(+), 37 deletions(-)
drivers/edac/mpc85xx_edac.c +35 -37
index fdc3d9b..c0b0951 100644
@@ -157,18 +157,18 @@ static void mpc85xx_pci_check(struct edac_pci_ctl_info *pci)
 		return;
 	}
 
-	printk(KERN_ERR "PCI error(s) detected\n");
-	printk(KERN_ERR "PCI/X ERR_DR register: %#08x\n", err_detect);
+	pr_err("PCI error(s) detected\n");
+	pr_err("PCI/X ERR_DR register: %#08x\n", err_detect);
 
-	printk(KERN_ERR "PCI/X ERR_ATTRIB register: %#08x\n",
+	pr_err("PCI/X ERR_ATTRIB register: %#08x\n",
 	       in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ATTRIB));
-	printk(KERN_ERR "PCI/X ERR_ADDR register: %#08x\n",
+	pr_err("PCI/X ERR_ADDR register: %#08x\n",
 	       in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR));
-	printk(KERN_ERR "PCI/X ERR_EXT_ADDR register: %#08x\n",
+	pr_err("PCI/X ERR_EXT_ADDR register: %#08x\n",
 	       in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EXT_ADDR));
-	printk(KERN_ERR "PCI/X ERR_DL register: %#08x\n",
+	pr_err("PCI/X ERR_DL register: %#08x\n",
 	       in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DL));
-	printk(KERN_ERR "PCI/X ERR_DH register: %#08x\n",
+	pr_err("PCI/X ERR_DH register: %#08x\n",
 	       in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DH));
 
 	/* clear error bits */
@@ -294,7 +294,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 	res = of_address_to_resource(of_node, 0, &r);
 	if (res) {
-		printk(KERN_ERR "%s: Unable to get resource for "
+		pr_err("%s: Unable to get resource for "
 		       "PCI err regs\n", __func__);
 		goto err;
 	}
@@ -304,7 +304,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 	if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
 					pdata->name)) {
-		printk(KERN_ERR "%s: Error while requesting mem region\n",
+		pr_err("%s: Error while requesting mem region\n",
 		       __func__);
 		res = -EBUSY;
 		goto err;
@@ -312,7 +312,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 	pdata->pci_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
 	if (!pdata->pci_vbase) {
-		printk(KERN_ERR "%s: Unable to setup PCI err regs\n", __func__);
+		pr_err("%s: Unable to setup PCI err regs\n", __func__);
 		res = -ENOMEM;
 		goto err;
 	}
@@ -353,15 +353,14 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 				       IRQF_SHARED,
 				       "[EDAC] PCI err", pci);
 		if (res < 0) {
-			printk(KERN_ERR
-			       "%s: Unable to request irq %d for "
+			pr_err("%s: Unable to request irq %d for "
 			       "MPC85xx PCI err\n", __func__, pdata->irq);
 			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
 
-		printk(KERN_INFO EDAC_MOD_STR " acquired irq %d for PCI Err\n",
+		pr_info(EDAC_MOD_STR " acquired irq %d for PCI Err\n",
 		       pdata->irq);
 	}
 
@@ -383,7 +382,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 	devres_remove_group(&op->dev, mpc85xx_pci_err_probe);
 	edac_dbg(3, "success\n");
-	printk(KERN_INFO EDAC_MOD_STR " PCI err registered\n");
+	pr_info(EDAC_MOD_STR " PCI err registered\n");
 
 	return 0;
 
@@ -526,17 +525,17 @@ static void mpc85xx_l2_check(struct edac_device_ctl_info *edac_dev)
 	if (!(err_detect & L2_EDE_MASK))
 		return;
 
-	printk(KERN_ERR "ECC Error in CPU L2 cache\n");
-	printk(KERN_ERR "L2 Error Detect Register: 0x%08x\n", err_detect);
-	printk(KERN_ERR "L2 Error Capture Data High Register: 0x%08x\n",
+	pr_err("ECC Error in CPU L2 cache\n");
+	pr_err("L2 Error Detect Register: 0x%08x\n", err_detect);
+	pr_err("L2 Error Capture Data High Register: 0x%08x\n",
 	       in_be32(pdata->l2_vbase + MPC85XX_L2_CAPTDATAHI));
-	printk(KERN_ERR "L2 Error Capture Data Lo Register: 0x%08x\n",
+	pr_err("L2 Error Capture Data Lo Register: 0x%08x\n",
 	       in_be32(pdata->l2_vbase + MPC85XX_L2_CAPTDATALO));
-	printk(KERN_ERR "L2 Error Syndrome Register: 0x%08x\n",
+	pr_err("L2 Error Syndrome Register: 0x%08x\n",
 	       in_be32(pdata->l2_vbase + MPC85XX_L2_CAPTECC));
-	printk(KERN_ERR "L2 Error Attributes Capture Register: 0x%08x\n",
+	pr_err("L2 Error Attributes Capture Register: 0x%08x\n",
 	       in_be32(pdata->l2_vbase + MPC85XX_L2_ERRATTR));
-	printk(KERN_ERR "L2 Error Address Capture Register: 0x%08x\n",
+	pr_err("L2 Error Address Capture Register: 0x%08x\n",
 	       in_be32(pdata->l2_vbase + MPC85XX_L2_ERRADDR));
 
 	/* clear error detect register */
@@ -593,7 +592,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 
 	res = of_address_to_resource(op->dev.of_node, 0, &r);
 	if (res) {
-		printk(KERN_ERR "%s: Unable to get resource for "
+		pr_err("%s: Unable to get resource for "
 		       "L2 err regs\n", __func__);
 		goto err;
 	}
@@ -603,7 +602,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 
 	if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
 				     pdata->name)) {
-		printk(KERN_ERR "%s: Error while requesting mem region\n",
+		pr_err("%s: Error while requesting mem region\n",
 		       __func__);
 		res = -EBUSY;
 		goto err;
@@ -611,7 +610,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 
 	pdata->l2_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
 	if (!pdata->l2_vbase) {
-		printk(KERN_ERR "%s: Unable to setup L2 err regs\n", __func__);
+		pr_err("%s: Unable to setup L2 err regs\n", __func__);
 		res = -ENOMEM;
 		goto err;
 	}
@@ -643,15 +642,14 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 				       mpc85xx_l2_isr, IRQF_SHARED,
 				       "[EDAC] L2 err", edac_dev);
 		if (res < 0) {
-			printk(KERN_ERR
-			       "%s: Unable to request irq %d for "
+			pr_err("%s: Unable to request irq %d for "
 			       "MPC85xx L2 err\n", __func__, pdata->irq);
 			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
 
-		printk(KERN_INFO EDAC_MOD_STR " acquired irq %d for L2 Err\n",
+		pr_info(EDAC_MOD_STR " acquired irq %d for L2 Err\n",
 		       pdata->irq);
 
 		edac_dev->op_state = OP_RUNNING_INTERRUPT;
@@ -662,7 +660,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 	devres_remove_group(&op->dev, mpc85xx_l2_err_probe);
 
 	edac_dbg(3, "success\n");
-	printk(KERN_INFO EDAC_MOD_STR " L2 err registered\n");
+	pr_info(EDAC_MOD_STR " L2 err registered\n");
 
 	return 0;
 
@@ -1064,14 +1062,14 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 
 	res = of_address_to_resource(op->dev.of_node, 0, &r);
 	if (res) {
-		printk(KERN_ERR "%s: Unable to get resource for MC err regs\n",
+		pr_err("%s: Unable to get resource for MC err regs\n",
 		       __func__);
 		goto err;
 	}
 
 	if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
 				     pdata->name)) {
-		printk(KERN_ERR "%s: Error while requesting mem region\n",
+		pr_err("%s: Error while requesting mem region\n",
 		       __func__);
 		res = -EBUSY;
 		goto err;
@@ -1079,7 +1077,7 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 
 	pdata->mc_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
 	if (!pdata->mc_vbase) {
-		printk(KERN_ERR "%s: Unable to setup MC err regs\n", __func__);
+		pr_err("%s: Unable to setup MC err regs\n", __func__);
 		res = -ENOMEM;
 		goto err;
 	}
@@ -1087,7 +1085,7 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 	sdram_ctl = in_be32(pdata->mc_vbase + MPC85XX_MC_DDR_SDRAM_CFG);
 	if (!(sdram_ctl & DSC_ECC_EN)) {
 		/* no ECC */
-		printk(KERN_WARNING "%s: No ECC DIMMs discovered\n", __func__);
+		pr_warn("%s: No ECC DIMMs discovered\n", __func__);
 		res = -ENODEV;
 		goto err;
 	}
@@ -1140,20 +1138,20 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 				       IRQF_SHARED,
 				       "[EDAC] MC err", mci);
 		if (res < 0) {
-			printk(KERN_ERR "%s: Unable to request irq %d for "
+			pr_err("%s: Unable to request irq %d for "
 			       "MPC85xx DRAM ERR\n", __func__, pdata->irq);
 			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
 
-		printk(KERN_INFO EDAC_MOD_STR " acquired irq %d for MC\n",
+		pr_info(EDAC_MOD_STR " acquired irq %d for MC\n",
 		       pdata->irq);
 	}
 
 	devres_remove_group(&op->dev, mpc85xx_mc_err_probe);
 	edac_dbg(3, "success\n");
-	printk(KERN_INFO EDAC_MOD_STR " MC err registered\n");
+	pr_info(EDAC_MOD_STR " MC err registered\n");
 
 	return 0;
 
@@ -1235,7 +1233,7 @@ static int __init mpc85xx_mc_init(void)
 	int res = 0;
 	u32 __maybe_unused pvr = 0;
 
-	printk(KERN_INFO "Freescale(R) MPC85xx EDAC driver, "
+	pr_info("Freescale(R) MPC85xx EDAC driver, "
 	       "(C) 2006 Montavista Software\n");
 
 	/* make sure error reporting method is sane */
@@ -1250,7 +1248,7 @@ static int __init mpc85xx_mc_init(void)
 
 	res = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 	if (res)
-		printk(KERN_WARNING EDAC_MOD_STR "drivers fail to register\n");
+		pr_warn(EDAC_MOD_STR "drivers fail to register\n");
 
 	return 0;
 }
Signature · 1 line
2.7.4
author
#28 lore raw

PATCH v3 5/11 driver/edac/fsl-ddr: Separate FSL DDR EDAC driver from MPC85xx

In reply to a message not in the archive

The mpc85xx compatible DDR controllers are used on ARM-based SoCs. Separate the DDR part from mpc85xx EDAC driver and prepare to support both architecture.

---
Change log
v3: Fix compiling errors and warnings caused by patch ordering
v2: Reordered patch
Separate FSL DDR commont code as shared object, not another driver This patch is generated with "git format-patch -M40 -C40" to show copy-and-delete.

 drivers/edac/Makefile                           |   5 +-
 drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} | 699 +-----------------------
 drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} | 106 +---
 drivers/edac/mpc85xx_edac.c                     | 559 +------------------
 drivers/edac/mpc85xx_edac.h                     |  66 ---
 5 files changed, 22 insertions(+), 1413 deletions(-)
 copy drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} (43%)
 copy drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} (43%)
drivers/edac/Makefile +4 -1
index f9e4a3e..ee047a4 100644
@@ -50,7 +50,10 @@ amd64_edac_mod-$(CONFIG_EDAC_AMD64_ERROR_INJECTION) += amd64_edac_inj.o
 obj-$(CONFIG_EDAC_AMD64)		+= amd64_edac_mod.o
 
 obj-$(CONFIG_EDAC_PASEMI)		+= pasemi_edac.o
-obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac.o
+
+mpc85xx_edac_mod-y			:= fsl_ddr_edac.o mpc85xx_edac.o
+obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac_mod.o
+
 obj-$(CONFIG_EDAC_MV64X60)		+= mv64x60_edac.o
 obj-$(CONFIG_EDAC_CELL)			+= cell_edac.o
 obj-$(CONFIG_EDAC_PPC4XX)		+= ppc4xx_edac.o
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +10 -689

754 lines not on this page · raw message

drivers/edac/fsl_ddr_edac.h renamed from drivers/edac/mpc85xx_edac.h +7 -99

128 lines not on this page · raw message

drivers/edac/mpc85xx_edac.c +1 -558

582 lines not on this page · raw message

drivers/edac/mpc85xx_edac.h +0 -66

78 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#29 lore raw

Re: [Patch v3 05/11] driver/edac/fsl-ddr: Separate FSL DDR EDAC driver from MPC85xx

Quoted 47 lines · York Sun

The mpc85xx compatible DDR controllers are used on ARM-based SoCs. Separate the DDR part from mpc85xx EDAC driver and prepare to support both architecture.

---
Change log
v3: Fix compiling errors and warnings caused by patch ordering
v2: Reordered patch
Separate FSL DDR commont code as shared object, not another driver This patch is generated with "git format-patch -M40 -C40" to show copy-and-delete.

 drivers/edac/Makefile                           |   5 +-
 drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} | 699 +-----------------------
 drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} | 106 +---
 drivers/edac/mpc85xx_edac.c                     | 559 +------------------
 drivers/edac/mpc85xx_edac.h                     |  66 ---
 5 files changed, 22 insertions(+), 1413 deletions(-)
 copy drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} (43%)
 copy drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} (43%)
drivers/edac/Makefile +4 -1
index f9e4a3e..ee047a4 100644
@@ -50,7 +50,10 @@ amd64_edac_mod-$(CONFIG_EDAC_AMD64_ERROR_INJECTION) += amd64_edac_inj.o
 obj-$(CONFIG_EDAC_AMD64)		+= amd64_edac_mod.o
 
 obj-$(CONFIG_EDAC_PASEMI)		+= pasemi_edac.o
-obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac.o
+
+mpc85xx_edac_mod-y			:= fsl_ddr_edac.o mpc85xx_edac.o
+obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac_mod.o
+
 obj-$(CONFIG_EDAC_MV64X60)		+= mv64x60_edac.o
 obj-$(CONFIG_EDAC_CELL)			+= cell_edac.o
 obj-$(CONFIG_EDAC_PPC4XX)		+= ppc4xx_edac.o
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +0 -0
similarity index 43%
copy from drivers/edac/mpc85xx_edac.c
copy to drivers/edac/fsl_ddr_edac.c
index c0b0951..280797e 100644

drivers/edac/fsl_ddr_edac.c line 2

Quoted 3 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * Freescale MPC85xx Memory Controller kernel module
+ * Freescale Memory Controller kernel modul

This should say something like "Layerscape SoC blabla... Originally split out from mpc85xx_edac EDAC driver."

Ditto for the header below.

Quoted 7 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +0 -0
  *
  * Parts Copyrighted (c) 2013 by Freescale Semiconductor, Inc.
  *
@@ -20,33 +20,20 @@
 #include <linux/edac.h>
 #include <linux/smp.h>
 #include <linux/gfp.h>

drivers/edac/fsl_ddr_edac.c line 30

Quoted 10 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +3 -2
-#include <linux/fsl/edac.h>
 
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include "edac_module.h"
 #include "edac_core.h"
-#include "mpc85xx_edac.h"
+#include "fsl_ddr_edac.h"
+
+#define EDAC_MOD_STR	"FSL_DDR_EDAC"

Lowercase please.

Quoted 23 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +0 -14
-static int edac_dev_idx;
-#ifdef CONFIG_PCI
-static int edac_pci_idx;
-#endif
 static int edac_mc_idx;
 
 static u32 orig_ddr_err_disable;
 static u32 orig_ddr_err_sbe;
 
-/*
- * PCI Err defines
- */
-#ifdef CONFIG_PCI
-static u32 orig_pci_err_cap_dr;
-static u32 orig_pci_err_en;
-#endif
-
-static u32 orig_l2_err_disable;
-
 /************************ MC SYSFS parts ***********************************/
 
 #define to_mci(k) container_of(k, struct mem_ctl_info, dev)
Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#30 lore raw

Re: [Patch v3 05/11] driver/edac/fsl-ddr: Separate FSL DDR EDAC driver from MPC85xx

Quoted 55 lines · Borislav Petkov
Quoted 47 lines · York Sun

The mpc85xx compatible DDR controllers are used on ARM-based SoCs. Separate the DDR part from mpc85xx EDAC driver and prepare to support both architecture.

---
Change log
v3: Fix compiling errors and warnings caused by patch ordering
v2: Reordered patch
Separate FSL DDR commont code as shared object, not another driver This patch is generated with "git format-patch -M40 -C40" to show copy-and-delete.

 drivers/edac/Makefile                           |   5 +-
 drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} | 699 +-----------------------
 drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} | 106 +---
 drivers/edac/mpc85xx_edac.c                     | 559 +------------------
 drivers/edac/mpc85xx_edac.h                     |  66 ---
 5 files changed, 22 insertions(+), 1413 deletions(-)
 copy drivers/edac/{mpc85xx_edac.c => fsl_ddr_edac.c} (43%)
 copy drivers/edac/{mpc85xx_edac.h => fsl_ddr_edac.h} (43%)
drivers/edac/Makefile +4 -1
index f9e4a3e..ee047a4 100644
@@ -50,7 +50,10 @@ amd64_edac_mod-$(CONFIG_EDAC_AMD64_ERROR_INJECTION) += amd64_edac_inj.o
 obj-$(CONFIG_EDAC_AMD64)		+= amd64_edac_mod.o
 
 obj-$(CONFIG_EDAC_PASEMI)		+= pasemi_edac.o
-obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac.o
+
+mpc85xx_edac_mod-y			:= fsl_ddr_edac.o mpc85xx_edac.o
+obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac_mod.o
+
 obj-$(CONFIG_EDAC_MV64X60)		+= mv64x60_edac.o
 obj-$(CONFIG_EDAC_CELL)			+= cell_edac.o
 obj-$(CONFIG_EDAC_PPC4XX)		+= ppc4xx_edac.o
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +0 -0
similarity index 43%
copy from drivers/edac/mpc85xx_edac.c
copy to drivers/edac/fsl_ddr_edac.c
index c0b0951..280797e 100644

drivers/edac/fsl_ddr_edac.c line 2

Quoted 3 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * Freescale MPC85xx Memory Controller kernel module
+ * Freescale Memory Controller kernel modul

This should say something like "Layerscape SoC blabla... Originally split out from mpc85xx_edac EDAC driver."

Quoted 1 line

Ditto for the header below.

OK.

Quoted 10 lines
Quoted 10 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +0 -1
  *
  * Parts Copyrighted (c) 2013 by Freescale Semiconductor, Inc.
  *
@@ -20,33 +20,20 @@
 #include <linux/edac.h>
 #include <linux/smp.h>
 #include <linux/gfp.h>
-#include <linux/fsl/edac.h>
 
Quoted 10 lines

drivers/edac/fsl_ddr_edac.c line 30

Quoted 8 lines
drivers/edac/fsl_ddr_edac.c renamed from drivers/edac/mpc85xx_edac.c +3 -1
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include "edac_module.h"
 #include "edac_core.h"
-#include "mpc85xx_edac.h"
+#include "fsl_ddr_edac.h"
+
+#define EDAC_MOD_STR	"FSL_DDR_EDAC"

Lowercase please.

I followed old name style. Will change.

York

author
#31 lore raw

PATCH v3 6/11 driver/edac/fsl_ddr: Rename macros and names

In reply to a message not in the archive

Use generic names for macros, variables and functions.

---
Change log
v3: Absort changes from previous patch after reording
v2: Separated from "House cleaning" patch of v1

 drivers/edac/fsl_ddr_edac.c | 153 ++++++++++++++++++++++----------------------
 drivers/edac/fsl_ddr_edac.h |  43 ++++++-------
 drivers/edac/mpc85xx_edac.c |   4 +-
 3 files changed, 98 insertions(+), 102 deletions(-)
drivers/edac/fsl_ddr_edac.c +76 -77
index 280797e..60761c0 100644
@@ -38,74 +38,74 @@ static u32 orig_ddr_err_sbe;
 
 #define to_mci(k) container_of(k, struct mem_ctl_info, dev)
 
-static ssize_t mpc85xx_mc_inject_data_hi_show(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_data_hi_show(struct device *dev,
 					      struct device_attribute *mattr,
 					      char *data)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	return sprintf(data, "0x%08x",
 		       in_be32(pdata->mc_vbase +
-			       MPC85XX_MC_DATA_ERR_INJECT_HI));
+			       MC_DATA_ERR_INJECT_HI));
 }
 
-static ssize_t mpc85xx_mc_inject_data_lo_show(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_data_lo_show(struct device *dev,
 					      struct device_attribute *mattr,
 					      char *data)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	return sprintf(data, "0x%08x",
 		       in_be32(pdata->mc_vbase +
-			       MPC85XX_MC_DATA_ERR_INJECT_LO));
+			       MC_DATA_ERR_INJECT_LO));
 }
 
-static ssize_t mpc85xx_mc_inject_ctrl_show(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_ctrl_show(struct device *dev,
 					   struct device_attribute *mattr,
 					   char *data)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	return sprintf(data, "0x%08x",
-		       in_be32(pdata->mc_vbase + MPC85XX_MC_ECC_ERR_INJECT));
+		       in_be32(pdata->mc_vbase + MC_ECC_ERR_INJECT));
 }
 
-static ssize_t mpc85xx_mc_inject_data_hi_store(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_data_hi_store(struct device *dev,
 					       struct device_attribute *mattr,
 					       const char *data, size_t count)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	if (isdigit(*data)) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_DATA_ERR_INJECT_HI,
+		out_be32(pdata->mc_vbase + MC_DATA_ERR_INJECT_HI,
 			 simple_strtoul(data, NULL, 0));
 		return count;
 	}
 	return 0;
 }
 
-static ssize_t mpc85xx_mc_inject_data_lo_store(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_data_lo_store(struct device *dev,
 					       struct device_attribute *mattr,
 					       const char *data, size_t count)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	if (isdigit(*data)) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_DATA_ERR_INJECT_LO,
+		out_be32(pdata->mc_vbase + MC_DATA_ERR_INJECT_LO,
 			 simple_strtoul(data, NULL, 0));
 		return count;
 	}
 	return 0;
 }
 
-static ssize_t mpc85xx_mc_inject_ctrl_store(struct device *dev,
+static ssize_t fsl_ddr_mc_inject_ctrl_store(struct device *dev,
 					       struct device_attribute *mattr,
 					       const char *data, size_t count)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	if (isdigit(*data)) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_ECC_ERR_INJECT,
+		out_be32(pdata->mc_vbase + MC_ECC_ERR_INJECT,
 			 simple_strtoul(data, NULL, 0));
 		return count;
 	}
@@ -113,20 +113,20 @@ static ssize_t mpc85xx_mc_inject_ctrl_store(struct device *dev,
 }
 
 DEVICE_ATTR(inject_data_hi, S_IRUGO | S_IWUSR,
-	    mpc85xx_mc_inject_data_hi_show, mpc85xx_mc_inject_data_hi_store);
+	    fsl_ddr_mc_inject_data_hi_show, fsl_ddr_mc_inject_data_hi_store);
 DEVICE_ATTR(inject_data_lo, S_IRUGO | S_IWUSR,
-	    mpc85xx_mc_inject_data_lo_show, mpc85xx_mc_inject_data_lo_store);
+	    fsl_ddr_mc_inject_data_lo_show, fsl_ddr_mc_inject_data_lo_store);
 DEVICE_ATTR(inject_ctrl, S_IRUGO | S_IWUSR,
-	    mpc85xx_mc_inject_ctrl_show, mpc85xx_mc_inject_ctrl_store);
+	    fsl_ddr_mc_inject_ctrl_show, fsl_ddr_mc_inject_ctrl_store);
 
-static struct attribute *mpc85xx_dev_attrs[] = {
+static struct attribute *fsl_ddr_dev_attrs[] = {
 	&dev_attr_inject_data_hi.attr,
 	&dev_attr_inject_data_lo.attr,
 	&dev_attr_inject_ctrl.attr,
 	NULL
 };
 
-ATTRIBUTE_GROUPS(mpc85xx_dev);
+ATTRIBUTE_GROUPS(fsl_ddr_dev);
 
 /**************************** MC Err device ***************************/
 
@@ -237,9 +237,9 @@ static void sbe_ecc_decode(u32 cap_high, u32 cap_low, u32 cap_ecc,
 
 #define make64(high, low) (((u64)(high) << 32) | (low))
 
-static void mpc85xx_mc_check(struct mem_ctl_info *mci)
+static void fsl_ddr_mc_check(struct mem_ctl_info *mci)
 {
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	struct csrow_info *csrow;
 	u32 bus_width;
 	u32 err_detect;
@@ -252,23 +252,23 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
 	int bad_data_bit;
 	int bad_ecc_bit;
 
-	err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT);
+	err_detect = in_be32(pdata->mc_vbase + MC_ERR_DETECT);
 	if (!err_detect)
 		return;
 
-	mpc85xx_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n",
+	fsl_ddr_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n",
 			  err_detect);
 
 	/* no more processing if not ECC bit errors */
 	if (!(err_detect & (DDR_EDE_SBE | DDR_EDE_MBE))) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT, err_detect);
+		out_be32(pdata->mc_vbase + MC_ERR_DETECT, err_detect);
 		return;
 	}
 
-	syndrome = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ECC);
+	syndrome = in_be32(pdata->mc_vbase + MC_CAPTURE_ECC);
 
 	/* Mask off appropriate bits of syndrome based on bus width */
-	bus_width = (in_be32(pdata->mc_vbase + MPC85XX_MC_DDR_SDRAM_CFG) &
+	bus_width = (in_be32(pdata->mc_vbase + MC_DDR_SDRAM_CFG) &
 			DSC_DBW_MASK) ? 32 : 64;
 	if (bus_width == 64)
 		syndrome &= 0xff;
@@ -276,8 +276,8 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
 		syndrome &= 0xffff;
 
 	err_addr = make64(
-		in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_EXT_ADDRESS),
-		in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ADDRESS));
+		in_be32(pdata->mc_vbase + MC_CAPTURE_EXT_ADDRESS),
+		in_be32(pdata->mc_vbase + MC_CAPTURE_ADDRESS));
 	pfn = err_addr >> PAGE_SHIFT;
 
 	for (row_index = 0; row_index < mci->nr_csrows; row_index++) {
@@ -286,8 +286,8 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
 			break;
 	}
 
-	cap_high = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_DATA_HI);
-	cap_low = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_DATA_LO);
+	cap_high = in_be32(pdata->mc_vbase + MC_CAPTURE_DATA_HI);
+	cap_low = in_be32(pdata->mc_vbase + MC_CAPTURE_DATA_LO);
 
 	/*
 	 * Analyze single-bit errors on 64-bit wide buses
@@ -298,28 +298,28 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
 				&bad_data_bit, &bad_ecc_bit);
 
 		if (bad_data_bit != -1)
-			mpc85xx_mc_printk(mci, KERN_ERR,
+			fsl_ddr_mc_printk(mci, KERN_ERR,
 				"Faulty Data bit: %d\n", bad_data_bit);
 		if (bad_ecc_bit != -1)
-			mpc85xx_mc_printk(mci, KERN_ERR,
+			fsl_ddr_mc_printk(mci, KERN_ERR,
 				"Faulty ECC bit: %d\n", bad_ecc_bit);
 
-		mpc85xx_mc_printk(mci, KERN_ERR,
+		fsl_ddr_mc_printk(mci, KERN_ERR,
 			"Expected Data / ECC:\t%#8.8x_%08x / %#2.2x\n",
 			cap_high ^ (1 << (bad_data_bit - 32)),
 			cap_low ^ (1 << bad_data_bit),
 			syndrome ^ (1 << bad_ecc_bit));
 	}
 
-	mpc85xx_mc_printk(mci, KERN_ERR,
+	fsl_ddr_mc_printk(mci, KERN_ERR,
 			"Captured Data / ECC:\t%#8.8x_%08x / %#2.2x\n",
 			cap_high, cap_low, syndrome);
-	mpc85xx_mc_printk(mci, KERN_ERR, "Err addr: %#8.8llx\n", err_addr);
-	mpc85xx_mc_printk(mci, KERN_ERR, "PFN: %#8.8x\n", pfn);
+	fsl_ddr_mc_printk(mci, KERN_ERR, "Err addr: %#8.8llx\n", err_addr);
+	fsl_ddr_mc_printk(mci, KERN_ERR, "PFN: %#8.8x\n", pfn);
 
 	/* we are out of range */
 	if (row_index == mci->nr_csrows)
-		mpc85xx_mc_printk(mci, KERN_ERR, "PFN out of range!\n");
+		fsl_ddr_mc_printk(mci, KERN_ERR, "PFN out of range!\n");
 
 	if (err_detect & DDR_EDE_SBE)
 		edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1,
@@ -333,27 +333,27 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
 				     row_index, 0, -1,
 				     mci->ctl_name, "");
 
-	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT, err_detect);
+	out_be32(pdata->mc_vbase + MC_ERR_DETECT, err_detect);
 }
 
-static irqreturn_t mpc85xx_mc_isr(int irq, void *dev_id)
+static irqreturn_t fsl_ddr_mc_isr(int irq, void *dev_id)
 {
 	struct mem_ctl_info *mci = dev_id;
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	u32 err_detect;
 
-	err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT);
+	err_detect = in_be32(pdata->mc_vbase + MC_ERR_DETECT);
 	if (!err_detect)
 		return IRQ_NONE;
 
-	mpc85xx_mc_check(mci);
+	fsl_ddr_mc_check(mci);
 
 	return IRQ_HANDLED;
 }
 
-static void mpc85xx_init_csrows(struct mem_ctl_info *mci)
+static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 {
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 	struct csrow_info *csrow;
 	struct dimm_info *dimm;
 	u32 sdram_ctl;
@@ -362,7 +362,7 @@ static void mpc85xx_init_csrows(struct mem_ctl_info *mci)
 	u32 cs_bnds;
 	int index;
 
-	sdram_ctl = in_be32(pdata->mc_vbase + MPC85XX_MC_DDR_SDRAM_CFG);
+	sdram_ctl = in_be32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
 
 	sdtype = sdram_ctl & DSC_SDTYPE_MASK;
 	if (sdram_ctl & DSC_RD_EN) {
@@ -404,8 +404,8 @@ static void mpc85xx_init_csrows(struct mem_ctl_info *mci)
 		csrow = mci->csrows[index];
 		dimm = csrow->channels[0]->dimm;
 
-		cs_bnds = in_be32(pdata->mc_vbase + MPC85XX_MC_CS_BNDS_0 +
-				  (index * MPC85XX_MC_CS_BNDS_OFS));
+		cs_bnds = in_be32(pdata->mc_vbase + MC_CS_BNDS_0 +
+				  (index * MC_CS_BNDS_OFS));
 
 		start = (cs_bnds & 0xffff0000) >> 16;
 		end   = (cs_bnds & 0x0000ffff);
@@ -430,16 +430,16 @@ static void mpc85xx_init_csrows(struct mem_ctl_info *mci)
 	}
 }
 
-int mpc85xx_mc_err_probe(struct platform_device *op)
+int fsl_ddr_mc_err_probe(struct platform_device *op)
 {
 	struct mem_ctl_info *mci;
 	struct edac_mc_layer layers[2];
-	struct mpc85xx_mc_pdata *pdata;
+	struct fsl_ddr_mc_pdata *pdata;
 	struct resource r;
 	u32 sdram_ctl;
 	int res;
 
-	if (!devres_open_group(&op->dev, mpc85xx_mc_err_probe, GFP_KERNEL))
+	if (!devres_open_group(&op->dev, fsl_ddr_mc_err_probe, GFP_KERNEL))
 		return -ENOMEM;
 
 	layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
@@ -451,12 +451,12 @@ int mpc85xx_mc_err_probe(struct platform_device *op)
 	mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers,
 			    sizeof(*pdata));
 	if (!mci) {
-		devres_release_group(&op->dev, mpc85xx_mc_err_probe);
+		devres_release_group(&op->dev, fsl_ddr_mc_err_probe);
 		return -ENOMEM;
 	}
 
 	pdata = mci->pvt_info;
-	pdata->name = "mpc85xx_mc_err";
+	pdata->name = "fsl_ddr_mc_err";
 	pdata->irq = NO_IRQ;
 	mci->pdev = &op->dev;
 	pdata->edac_idx = edac_mc_idx++;
@@ -486,7 +486,7 @@ int mpc85xx_mc_err_probe(struct platform_device *op)
 		goto err;
 	}
 
-	sdram_ctl = in_be32(pdata->mc_vbase + MPC85XX_MC_DDR_SDRAM_CFG);
+	sdram_ctl = in_be32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
 	if (!(sdram_ctl & DSC_ECC_EN)) {
 		/* no ECC */
 		pr_warn("%s: No ECC DIMMs discovered\n", __func__);
@@ -502,46 +502,46 @@ int mpc85xx_mc_err_probe(struct platform_device *op)
 	mci->mod_name = EDAC_MOD_STR;
 
 	if (edac_op_state == EDAC_OPSTATE_POLL)
-		mci->edac_check = mpc85xx_mc_check;
+		mci->edac_check = fsl_ddr_mc_check;
 
 	mci->ctl_page_to_phys = NULL;
 
 	mci->scrub_mode = SCRUB_SW_SRC;
 
-	mpc85xx_init_csrows(mci);
+	fsl_ddr_init_csrows(mci);
 
 	/* store the original error disable bits */
 	orig_ddr_err_disable =
-	    in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DISABLE);
-	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DISABLE, 0);
+	    in_be32(pdata->mc_vbase + MC_ERR_DISABLE);
+	out_be32(pdata->mc_vbase + MC_ERR_DISABLE, 0);
 
 	/* clear all error bits */
-	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT, ~0);
+	out_be32(pdata->mc_vbase + MC_ERR_DETECT, ~0);
 
-	if (edac_mc_add_mc_with_groups(mci, mpc85xx_dev_groups)) {
+	if (edac_mc_add_mc_with_groups(mci, fsl_ddr_dev_groups)) {
 		edac_dbg(3, "failed edac_mc_add_mc()\n");
 		goto err;
 	}
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_INT_EN,
+		out_be32(pdata->mc_vbase + MC_ERR_INT_EN,
 			 DDR_EIE_MBEE | DDR_EIE_SBEE);
 
 		/* store the original error management threshold */
 		orig_ddr_err_sbe = in_be32(pdata->mc_vbase +
-					   MPC85XX_MC_ERR_SBE) & 0xff0000;
+					   MC_ERR_SBE) & 0xff0000;
 
 		/* set threshold to 1 error per interrupt */
-		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_SBE, 0x10000);
+		out_be32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
 
 		/* register interrupts */
 		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
 		res = devm_request_irq(&op->dev, pdata->irq,
-				       mpc85xx_mc_isr,
+				       fsl_ddr_mc_isr,
 				       IRQF_SHARED,
 				       "[EDAC] MC err", mci);
 		if (res < 0) {
-			pr_err("%s: Unable to request irq %d for MPC85xx DRAM ERR\n",
+			pr_err("%s: Unable to request irq %d for FSL DDR DRAM ERR\n",
 			       __func__, pdata->irq);
 			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
@@ -552,7 +552,7 @@ int mpc85xx_mc_err_probe(struct platform_device *op)
 		       pdata->irq);
 	}
 
-	devres_remove_group(&op->dev, mpc85xx_mc_err_probe);
+	devres_remove_group(&op->dev, fsl_ddr_mc_err_probe);
 	edac_dbg(3, "success\n");
 	pr_info(EDAC_MOD_STR " MC err registered\n");
 
@@ -561,30 +561,29 @@ int mpc85xx_mc_err_probe(struct platform_device *op)
 err2:
 	edac_mc_del_mc(&op->dev);
 err:
-	devres_release_group(&op->dev, mpc85xx_mc_err_probe);
+	devres_release_group(&op->dev, fsl_ddr_mc_err_probe);
 	edac_mc_free(mci);
 	return res;
 }
-EXPORT_SYMBOL_GPL(mpc85xx_mc_err_probe);
 
-int mpc85xx_mc_err_remove(struct platform_device *op)
+int fsl_ddr_mc_err_remove(struct platform_device *op)
 {
 	struct mem_ctl_info *mci = dev_get_drvdata(&op->dev);
-	struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
+	struct fsl_ddr_mc_pdata *pdata = mci->pvt_info;
 
 	edac_dbg(0, "\n");
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_INT_EN, 0);
+		out_be32(pdata->mc_vbase + MC_ERR_INT_EN, 0);
 		irq_dispose_mapping(pdata->irq);
 	}
 
-	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DISABLE,
+	out_be32(pdata->mc_vbase + MC_ERR_DISABLE,
 		 orig_ddr_err_disable);
-	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_SBE, orig_ddr_err_sbe);
+	out_be32(pdata->mc_vbase + MC_ERR_SBE, orig_ddr_err_sbe);
 
 	edac_mc_del_mc(&op->dev);
 	edac_mc_free(mci);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(mpc85xx_mc_err_remove);
+EXPORT_SYMBOL_GPL(fsl_ddr_mc_err_remove);
drivers/edac/fsl_ddr_edac.h +20 -23

65 lines not on this page · raw message

drivers/edac/mpc85xx_edac.c +2 -2
index af9ce77..351b136 100644
@@ -655,8 +655,8 @@ static const struct of_device_id mpc85xx_mc_err_of_match[] = {
 MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match);
 
 static struct platform_driver mpc85xx_mc_err_driver = {
-	.probe = mpc85xx_mc_err_probe,
-	.remove = mpc85xx_mc_err_remove,
+	.probe = fsl_ddr_mc_err_probe,
+	.remove = fsl_ddr_mc_err_remove,
 	.driver = {
 		.name = "mpc85xx_mc_err",
 		.of_match_table = mpc85xx_mc_err_of_match,
Signature · 1 line
2.7.4
maintainer
#32 lore raw

Re: [Patch v3 06/11] driver/edac/fsl_ddr: Rename macros and names

Quoted 13 lines · York Sun

Use generic names for macros, variables and functions.

---
Change log
v3: Absort changes from previous patch after reording
v2: Separated from "House cleaning" patch of v1

 drivers/edac/fsl_ddr_edac.c | 153 ++++++++++++++++++++++----------------------
 drivers/edac/fsl_ddr_edac.h |  43 ++++++-------
 drivers/edac/mpc85xx_edac.c |   4 +-
 3 files changed, 98 insertions(+), 102 deletions(-)

...

Quoted 43 lines
drivers/edac/fsl_ddr_edac.h +7 -20
index 94c6907..556bac5 100644
@@ -12,7 +12,7 @@
 #ifndef _FSL_DDR_EDAC_H_
 #define _FSL_DDR_EDAC_H_
 
-#define mpc85xx_mc_printk(mci, level, fmt, arg...) \
+#define fsl_ddr_mc_printk(mci, level, fmt, arg...) \
 	edac_mc_chipset_printk(mci, level, "FSL_DDR", fmt, ##arg)
 
 /*
@@ -20,26 +20,23 @@
  */
 
 /* DDR_SDRAM_CFG */
-#define MPC85XX_MC_DDR_SDRAM_CFG	0x0110
-#define MPC85XX_MC_CS_BNDS_0		0x0000
-#define MPC85XX_MC_CS_BNDS_1		0x0008
-#define MPC85XX_MC_CS_BNDS_2		0x0010
-#define MPC85XX_MC_CS_BNDS_3		0x0018
-#define MPC85XX_MC_CS_BNDS_OFS		0x0008
+#define MC_DDR_SDRAM_CFG	0x0110
+#define MC_CS_BNDS_0		0x0000
+#define MC_CS_BNDS_OFS		0x0008
 
-#define MPC85XX_MC_DATA_ERR_INJECT_HI	0x0e00
-#define MPC85XX_MC_DATA_ERR_INJECT_LO	0x0e04
-#define MPC85XX_MC_ECC_ERR_INJECT	0x0e08
-#define MPC85XX_MC_CAPTURE_DATA_HI	0x0e20
-#define MPC85XX_MC_CAPTURE_DATA_LO	0x0e24
-#define MPC85XX_MC_CAPTURE_ECC		0x0e28
-#define MPC85XX_MC_ERR_DETECT		0x0e40
-#define MPC85XX_MC_ERR_DISABLE		0x0e44
-#define MPC85XX_MC_ERR_INT_EN		0x0e48
-#define MPC85XX_MC_CAPTURE_ATRIBUTES	0x0e4c
-#define MPC85XX_MC_CAPTURE_ADDRESS	0x0e50
-#define MPC85XX_MC_CAPTURE_EXT_ADDRESS	0x0e54
-#define MPC85XX_MC_ERR_SBE		0x0e58
+#define MC_DATA_ERR_INJECT_HI	0x0e00
+#define MC_DATA_ERR_INJECT_LO	0x0e04
+#define MC_ECC_ERR_INJECT	0x0e08

drivers/edac/fsl_ddr_edac.h line 39

Quoted 10 lines
drivers/edac/fsl_ddr_edac.h +10 -0
+#define MC_CAPTURE_DATA_HI	0x0e20
+#define MC_CAPTURE_DATA_LO	0x0e24
+#define MC_CAPTURE_ECC		0x0e28
+#define MC_ERR_DETECT		0x0e40
+#define MC_ERR_DISABLE		0x0e44
+#define MC_ERR_INT_EN		0x0e48
+#define MC_CAPTURE_ATRIBUTES	0x0e4c
+#define MC_CAPTURE_ADDRESS	0x0e50
+#define MC_CAPTURE_EXT_ADDRESS	0x0e54
+#define MC_ERR_SBE		0x0e58

You should choose one name prefix for all driver symbols and stick to it. Either "FSL" or "LSC" for "Layerscape" or whatever but please be consistent.

MC_ is too generic.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#33 lore raw

Re: [Patch v3 06/11] driver/edac/fsl_ddr: Rename macros and names

Quoted 66 lines · Borislav Petkov
Quoted 13 lines · York Sun

Use generic names for macros, variables and functions.

---
Change log
v3: Absort changes from previous patch after reording
v2: Separated from "House cleaning" patch of v1

 drivers/edac/fsl_ddr_edac.c | 153 ++++++++++++++++++++++----------------------
 drivers/edac/fsl_ddr_edac.h |  43 ++++++-------
 drivers/edac/mpc85xx_edac.c |   4 +-
 3 files changed, 98 insertions(+), 102 deletions(-)

...

Quoted 49 lines
drivers/edac/fsl_ddr_edac.h +13 -20
index 94c6907..556bac5 100644
@@ -12,7 +12,7 @@
 #ifndef _FSL_DDR_EDAC_H_
 #define _FSL_DDR_EDAC_H_
 
-#define mpc85xx_mc_printk(mci, level, fmt, arg...) \
+#define fsl_ddr_mc_printk(mci, level, fmt, arg...) \
 	edac_mc_chipset_printk(mci, level, "FSL_DDR", fmt, ##arg)
 
 /*
@@ -20,26 +20,23 @@
  */
 
 /* DDR_SDRAM_CFG */
-#define MPC85XX_MC_DDR_SDRAM_CFG	0x0110
-#define MPC85XX_MC_CS_BNDS_0		0x0000
-#define MPC85XX_MC_CS_BNDS_1		0x0008
-#define MPC85XX_MC_CS_BNDS_2		0x0010
-#define MPC85XX_MC_CS_BNDS_3		0x0018
-#define MPC85XX_MC_CS_BNDS_OFS		0x0008
+#define MC_DDR_SDRAM_CFG	0x0110
+#define MC_CS_BNDS_0		0x0000
+#define MC_CS_BNDS_OFS		0x0008
 
-#define MPC85XX_MC_DATA_ERR_INJECT_HI	0x0e00
-#define MPC85XX_MC_DATA_ERR_INJECT_LO	0x0e04
-#define MPC85XX_MC_ECC_ERR_INJECT	0x0e08
-#define MPC85XX_MC_CAPTURE_DATA_HI	0x0e20
-#define MPC85XX_MC_CAPTURE_DATA_LO	0x0e24
-#define MPC85XX_MC_CAPTURE_ECC		0x0e28
-#define MPC85XX_MC_ERR_DETECT		0x0e40
-#define MPC85XX_MC_ERR_DISABLE		0x0e44
-#define MPC85XX_MC_ERR_INT_EN		0x0e48
-#define MPC85XX_MC_CAPTURE_ATRIBUTES	0x0e4c
-#define MPC85XX_MC_CAPTURE_ADDRESS	0x0e50
-#define MPC85XX_MC_CAPTURE_EXT_ADDRESS	0x0e54
-#define MPC85XX_MC_ERR_SBE		0x0e58
+#define MC_DATA_ERR_INJECT_HI	0x0e00
+#define MC_DATA_ERR_INJECT_LO	0x0e04
+#define MC_ECC_ERR_INJECT	0x0e08
+#define MC_CAPTURE_DATA_HI	0x0e20
+#define MC_CAPTURE_DATA_LO	0x0e24
+#define MC_CAPTURE_ECC		0x0e28
+#define MC_ERR_DETECT		0x0e40
+#define MC_ERR_DISABLE		0x0e44
+#define MC_ERR_INT_EN		0x0e48
Quoted 8 lines

drivers/edac/fsl_ddr_edac.h line 39

Quoted 4 lines
drivers/edac/fsl_ddr_edac.h +4 -0
+#define MC_CAPTURE_ATRIBUTES	0x0e4c
+#define MC_CAPTURE_ADDRESS	0x0e50
+#define MC_CAPTURE_EXT_ADDRESS	0x0e54
+#define MC_ERR_SBE		0x0e58

You should choose one name prefix for all driver symbols and stick to it. Either "FSL" or "LSC" for "Layerscape" or whatever but please be consistent.

Will replace MPC85XX with FSL.

York

author
#34 lore raw

PATCH v3 7/11 driver/edac/fsl_ddr: Add DDR4 type

In reply to a message not in the archive

---
Change log
v3: no change
v2: no change

 drivers/edac/fsl_ddr_edac.c | 12 ++++++++++--
 drivers/edac/fsl_ddr_edac.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/edac/fsl_ddr_edac.c +10 -2
index 60761c0..88ecf7d 100644
@@ -376,6 +376,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:
 			mtype = MEM_RDDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_RDDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;
@@ -391,6 +394,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:
 			mtype = MEM_DDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_DDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;
@@ -495,8 +501,10 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	}
 
 	edac_dbg(3, "init mci\n");
-	mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_RDDR2 |
-	    MEM_FLAG_DDR | MEM_FLAG_DDR2;
+	mci->mtype_cap = MEM_FLAG_DDR | MEM_FLAG_RDDR |
+			 MEM_FLAG_DDR2 | MEM_FLAG_RDDR2 |
+			 MEM_FLAG_DDR3 | MEM_FLAG_RDDR3 |
+			 MEM_FLAG_DDR4 | MEM_FLAG_RDDR4;
 	mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
 	mci->edac_cap = EDAC_FLAG_SECDED;
 	mci->mod_name = EDAC_MOD_STR;
drivers/edac/fsl_ddr_edac.h +1 -0
index 556bac5..c7b7dbf 100644
@@ -50,6 +50,7 @@
 #define DSC_SDTYPE_DDR		0x02000000
 #define DSC_SDTYPE_DDR2		0x03000000
 #define DSC_SDTYPE_DDR3		0x07000000
+#define DSC_SDTYPE_DDR4		0x05000000
 #define DSC_X32_EN	0x00000020
 
 /* Err_Int_En */
Signature · 1 line
2.7.4
maintainer
#35 lore raw

Re: [Patch v3 07/11] driver/edac/fsl_ddr: Add DDR4 type

On Thu, Aug 04, 2016 at 03:58:32PM -0700, York Sun wrote:

<--- Missing commit message.

Quoted 16 lines

---
Change log
v3: no change
v2: no change

 drivers/edac/fsl_ddr_edac.c | 12 ++++++++++--
 drivers/edac/fsl_ddr_edac.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/edac/fsl_ddr_edac.c +0 -0
index 60761c0..88ecf7d 100644

drivers/edac/fsl_ddr_edac.c static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) · line 376

Quoted 1 line
drivers/edac/fsl_ddr_edac.c +0 -0
@@ -376,6 +376,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:

Btw, those DSC_SDTYPE_* defines are used only here to map to the MEM_* ones. You can just as well use the naked numbers here and drop the DSC_SDTYPE* ones as it is clear what the naked numbers mean based on how they're being used.

Quoted 19 lines
drivers/edac/fsl_ddr_edac.c +6 -0
 			mtype = MEM_RDDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_RDDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;
@@ -391,6 +394,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:
 			mtype = MEM_DDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_DDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;

drivers/edac/fsl_ddr_edac.c int fsl_ddr_mc_err_probe(struct platform_device *op) · line 506

Quoted 8 lines
drivers/edac/fsl_ddr_edac.c +3 -2
@@ -495,8 +501,10 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	}
 
 	edac_dbg(3, "init mci\n");
-	mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_RDDR2 |
-	    MEM_FLAG_DDR | MEM_FLAG_DDR2;
+	mci->mtype_cap = MEM_FLAG_DDR | MEM_FLAG_RDDR |
+			 MEM_FLAG_DDR2 | MEM_FLAG_RDDR2 |
+			 MEM_FLAG_DDR3 | MEM_FLAG_RDDR3 |

DDR3 is silently added too, you can talk about that in the commit message, for example.

Quoted 20 lines
drivers/edac/fsl_ddr_edac.c +1 -0
+			 MEM_FLAG_DDR4 | MEM_FLAG_RDDR4;
 	mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
 	mci->edac_cap = EDAC_FLAG_SECDED;
 	mci->mod_name = EDAC_MOD_STR;
drivers/edac/fsl_ddr_edac.h +1 -0
index 556bac5..c7b7dbf 100644
@@ -50,6 +50,7 @@
 #define DSC_SDTYPE_DDR		0x02000000
 #define DSC_SDTYPE_DDR2		0x03000000
 #define DSC_SDTYPE_DDR3		0x07000000
+#define DSC_SDTYPE_DDR4		0x05000000
 #define DSC_X32_EN	0x00000020
 
 /* Err_Int_En */
Signature · 1 line
2.7.4
Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
author
#36 lore raw

Re: [Patch v3 07/11] driver/edac/fsl_ddr: Add DDR4 type

Quoted 15 lines · Borislav Petkov

On Thu, Aug 04, 2016 at 03:58:32PM -0700, York Sun wrote:

<--- Missing commit message.

Quoted 11 lines

---
Change log
v3: no change
v2: no change

 drivers/edac/fsl_ddr_edac.c | 12 ++++++++++--
 drivers/edac/fsl_ddr_edac.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)
Quoted 11 lines

drivers/edac/fsl_ddr_edac.c static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) · line 376

Quoted 6 lines
drivers/edac/fsl_ddr_edac.c +0 -0
index 60761c0..88ecf7d 100644
@@ -376,6 +376,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:

Btw, those DSC_SDTYPE_* defines are used only here to map to the MEM_* ones. You can just as well use the naked numbers here and drop the DSC_SDTYPE* ones as it is clear what the naked numbers mean based on how they're being used.

OK. Will drop all DSC_SDTYPE_*.

Quoted 22 lines
Quoted 22 lines
drivers/edac/fsl_ddr_edac.c +6 -0
 			mtype = MEM_RDDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_RDDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;
@@ -391,6 +394,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci)
 		case DSC_SDTYPE_DDR3:
 			mtype = MEM_DDR3;
 			break;
+		case DSC_SDTYPE_DDR4:
+			mtype = MEM_DDR4;
+			break;
 		default:
 			mtype = MEM_UNKNOWN;
 			break;
@@ -495,8 +501,10 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	}
 
Quoted 9 lines

drivers/edac/fsl_ddr_edac.c int fsl_ddr_mc_err_probe(struct platform_device *op) · line 506

Quoted 6 lines
drivers/edac/fsl_ddr_edac.c +3 -2
 	edac_dbg(3, "init mci\n");
-	mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_RDDR2 |
-	    MEM_FLAG_DDR | MEM_FLAG_DDR2;
+	mci->mtype_cap = MEM_FLAG_DDR | MEM_FLAG_RDDR |
+			 MEM_FLAG_DDR2 | MEM_FLAG_RDDR2 |
+			 MEM_FLAG_DDR3 | MEM_FLAG_RDDR3 |

DDR3 is silently added too, you can talk about that in the commit message, for example.

Right. That gives me something to say in the commit message.

York

author
#37 lore raw

PATCH v3 8/11 driver/edac/fsl_ddr: Add support of little endian

In reply to a message not in the archive

Get endianness from device tree. Both big endian and little endian are supported. Default to big endian for backward compatibility to MPC85xx.

---
Change log
v3: no change
v2: Separated from "Add support for ARM-based SoCs" patch

 .../fsl/ddr.txt}                                   |  6 ++
 drivers/edac/fsl_ddr_edac.c                        | 83 ++++++++++++++--------
 2 files changed, 58 insertions(+), 31 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/mem-ctrlr.txt => memory-controllers/fsl/ddr.txt} (74%)
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +6 -0
similarity index 74%
rename from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
rename to Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt
index f87856f..62623f9 100644
@@ -7,6 +7,10 @@ Properties:
 		  "fsl,qoriq-memory-controller".
 - reg		: Address and size of DDR controller registers
 - interrupts	: Error interrupt of DDR controller
+- little-endian	: Specifies little-endian access to registers
+- big-endian	: Specifies big-endian access to registers
+
+If both little-endian and big-endian are omitted, big-endian will be used.
 
 Example 1:
 
@@ -14,6 +18,7 @@ Example 1:
 		compatible = "fsl,bsc9132-memory-controller";
 		reg = <0x2000 0x1000>;
 		interrupts = <16 2 1 8>;
+		big-endian;
 	};
 
 
@@ -24,4 +29,5 @@ Example 2:
 				"fsl,qoriq-memory-controller";
 		reg = <0x8000 0x1000>;
 		interrupts = <16 2 1 23>;
+		big-endian;
 	};
drivers/edac/fsl_ddr_edac.c +52 -31

230 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#38 lore raw
Quoted 43 lines · York Sun

Get endianness from device tree. Both big endian and little endian are supported. Default to big endian for backward compatibility to MPC85xx.

---
Change log
v3: no change
v2: Separated from "Add support for ARM-based SoCs" patch

 .../fsl/ddr.txt}                                   |  6 ++
 drivers/edac/fsl_ddr_edac.c                        | 83 ++++++++++++++--------
 2 files changed, 58 insertions(+), 31 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/mem-ctrlr.txt => memory-controllers/fsl/ddr.txt} (74%)
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +5 -0
similarity index 74%
rename from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
rename to Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt
index f87856f..62623f9 100644
@@ -7,6 +7,10 @@ Properties:
 		  "fsl,qoriq-memory-controller".
 - reg		: Address and size of DDR controller registers
 - interrupts	: Error interrupt of DDR controller
+- little-endian	: Specifies little-endian access to registers
+- big-endian	: Specifies big-endian access to registers
+
+If both little-endian and big-endian are omitted, big-endian will be used.
 
 Example 1:
 
@@ -14,6 +18,7 @@ Example 1:
 		compatible = "fsl,bsc9132-memory-controller";
 		reg = <0x2000 0x1000>;
 		interrupts = <16 2 1 8>;
+		big-endian;
 	};
 
 

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt Example 2: · line 33

Quoted 5 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +1 -0
@@ -24,4 +29,5 @@ Example 2:
 				"fsl,qoriq-memory-controller";
 		reg = <0x8000 0x1000>;
 		interrupts = <16 2 1 23>;
+		big-endian;
 	};

This needs an ACK from DT maintainers. They're on CC.

Quoted 4 lines
drivers/edac/fsl_ddr_edac.c +0 -0
index 88ecf7d..b1b7924 100644

...

drivers/edac/fsl_ddr_edac.c int fsl_ddr_mc_err_probe(struct platform_device *op) · line 491

Quoted 10 lines
drivers/edac/fsl_ddr_edac.c +6 -0
@@ -470,6 +483,13 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	mci->ctl_name = pdata->name;
 	mci->dev_name = pdata->name;
 
+	if (of_find_property(op->dev.of_node, "little-endian", NULL))
+		little_endian = true;
+	else if (of_find_property(op->dev.of_node, "big-endian", NULL))
+		little_endian = false;
+	else
+		little_endian = false;

What happened here?

Considering little_endian is static, this should suffice for its initialization:

	if (of_find_property(op->dev.of_node, "little-endian", NULL))
		little_endian = true;
Quoted 48 lines
drivers/edac/fsl_ddr_edac.c +8 -8
 	res = of_address_to_resource(op->dev.of_node, 0, &r);
 	if (res) {
 		pr_err("%s: Unable to get resource for MC err regs\n",
@@ -492,7 +512,7 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 		goto err;
 	}
 
-	sdram_ctl = in_be32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
+	sdram_ctl = ddr_in32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
 	if (!(sdram_ctl & DSC_ECC_EN)) {
 		/* no ECC */
 		pr_warn("%s: No ECC DIMMs discovered\n", __func__);
@@ -520,11 +540,11 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 
 	/* store the original error disable bits */
 	orig_ddr_err_disable =
-	    in_be32(pdata->mc_vbase + MC_ERR_DISABLE);
-	out_be32(pdata->mc_vbase + MC_ERR_DISABLE, 0);
+	    ddr_in32(pdata->mc_vbase + MC_ERR_DISABLE);
+	ddr_out32(pdata->mc_vbase + MC_ERR_DISABLE, 0);
 
 	/* clear all error bits */
-	out_be32(pdata->mc_vbase + MC_ERR_DETECT, ~0);
+	ddr_out32(pdata->mc_vbase + MC_ERR_DETECT, ~0);
 
 	if (edac_mc_add_mc_with_groups(mci, fsl_ddr_dev_groups)) {
 		edac_dbg(3, "failed edac_mc_add_mc()\n");
@@ -532,15 +552,15 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	}
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		out_be32(pdata->mc_vbase + MC_ERR_INT_EN,
-			 DDR_EIE_MBEE | DDR_EIE_SBEE);
+		ddr_out32(pdata->mc_vbase + MC_ERR_INT_EN,
+			  DDR_EIE_MBEE | DDR_EIE_SBEE);
 
 		/* store the original error management threshold */
-		orig_ddr_err_sbe = in_be32(pdata->mc_vbase +
+		orig_ddr_err_sbe = ddr_in32(pdata->mc_vbase +
 					   MC_ERR_SBE) & 0xff0000;
 
 		/* set threshold to 1 error per interrupt */
-		out_be32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
+		ddr_out32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
 
 		/* register interrupts */
 		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);

drivers/edac/fsl_ddr_edac.c err: · line 596

Quoted 4 lines
drivers/edac/fsl_ddr_edac.c +1 -0
@@ -573,6 +593,7 @@ err:
 	edac_mc_free(mci);
 	return res;
 }
+EXPORT_SYMBOL_GPL(fsl_ddr_mc_err_probe);

What's that export for?

Signature · 9 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#39 lore raw
Quoted 72 lines · Borislav Petkov
Quoted 43 lines · York Sun

Get endianness from device tree. Both big endian and little endian are supported. Default to big endian for backward compatibility to MPC85xx.

---
Change log
v3: no change
v2: Separated from "Add support for ARM-based SoCs" patch

 .../fsl/ddr.txt}                                   |  6 ++
 drivers/edac/fsl_ddr_edac.c                        | 83 ++++++++++++++--------
 2 files changed, 58 insertions(+), 31 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/mem-ctrlr.txt => memory-controllers/fsl/ddr.txt} (74%)
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +5 -0
similarity index 74%
rename from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
rename to Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt
index f87856f..62623f9 100644
@@ -7,6 +7,10 @@ Properties:
 		  "fsl,qoriq-memory-controller".
 - reg		: Address and size of DDR controller registers
 - interrupts	: Error interrupt of DDR controller
+- little-endian	: Specifies little-endian access to registers
+- big-endian	: Specifies big-endian access to registers
+
+If both little-endian and big-endian are omitted, big-endian will be used.
 
 Example 1:
 
@@ -14,6 +18,7 @@ Example 1:
 		compatible = "fsl,bsc9132-memory-controller";
 		reg = <0x2000 0x1000>;
 		interrupts = <16 2 1 8>;
+		big-endian;
 	};
 
 

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt Example 2: · line 33

Quoted 5 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +1 -0
@@ -24,4 +29,5 @@ Example 2:
 				"fsl,qoriq-memory-controller";
 		reg = <0x8000 0x1000>;
 		interrupts = <16 2 1 23>;
+		big-endian;
 	};

This needs an ACK from DT maintainers. They're on CC.

Quoted 4 lines
drivers/edac/fsl_ddr_edac.c +0 -0
index 88ecf7d..b1b7924 100644

...

drivers/edac/fsl_ddr_edac.c int fsl_ddr_mc_err_probe(struct platform_device *op) · line 491

Quoted 10 lines
drivers/edac/fsl_ddr_edac.c +6 -0
@@ -470,6 +483,13 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	mci->ctl_name = pdata->name;
 	mci->dev_name = pdata->name;
 
+	if (of_find_property(op->dev.of_node, "little-endian", NULL))
+		little_endian = true;
+	else if (of_find_property(op->dev.of_node, "big-endian", NULL))
+		little_endian = false;
+	else
+		little_endian = false;

What happened here?

Quoted 7 lines

Considering little_endian is static, this should suffice for its initialization:

	if (of_find_property(op->dev.of_node, "little-endian", NULL))
		little_endian = true;

OK.

Quoted 47 lines
Quoted 47 lines
drivers/edac/fsl_ddr_edac.c +8 -8
 	res = of_address_to_resource(op->dev.of_node, 0, &r);
 	if (res) {
 		pr_err("%s: Unable to get resource for MC err regs\n",
@@ -492,7 +512,7 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 		goto err;
 	}
 
-	sdram_ctl = in_be32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
+	sdram_ctl = ddr_in32(pdata->mc_vbase + MC_DDR_SDRAM_CFG);
 	if (!(sdram_ctl & DSC_ECC_EN)) {
 		/* no ECC */
 		pr_warn("%s: No ECC DIMMs discovered\n", __func__);
@@ -520,11 +540,11 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 
 	/* store the original error disable bits */
 	orig_ddr_err_disable =
-	    in_be32(pdata->mc_vbase + MC_ERR_DISABLE);
-	out_be32(pdata->mc_vbase + MC_ERR_DISABLE, 0);
+	    ddr_in32(pdata->mc_vbase + MC_ERR_DISABLE);
+	ddr_out32(pdata->mc_vbase + MC_ERR_DISABLE, 0);
 
 	/* clear all error bits */
-	out_be32(pdata->mc_vbase + MC_ERR_DETECT, ~0);
+	ddr_out32(pdata->mc_vbase + MC_ERR_DETECT, ~0);
 
 	if (edac_mc_add_mc_with_groups(mci, fsl_ddr_dev_groups)) {
 		edac_dbg(3, "failed edac_mc_add_mc()\n");
@@ -532,15 +552,15 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	}
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		out_be32(pdata->mc_vbase + MC_ERR_INT_EN,
-			 DDR_EIE_MBEE | DDR_EIE_SBEE);
+		ddr_out32(pdata->mc_vbase + MC_ERR_INT_EN,
+			  DDR_EIE_MBEE | DDR_EIE_SBEE);
 
 		/* store the original error management threshold */
-		orig_ddr_err_sbe = in_be32(pdata->mc_vbase +
+		orig_ddr_err_sbe = ddr_in32(pdata->mc_vbase +
 					   MC_ERR_SBE) & 0xff0000;
 
 		/* set threshold to 1 error per interrupt */
-		out_be32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
+		ddr_out32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
 
Quoted 10 lines

drivers/edac/fsl_ddr_edac.c err: · line 596

Quoted 7 lines
drivers/edac/fsl_ddr_edac.c +1 -0
 		/* register interrupts */
 		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
@@ -573,6 +593,7 @@ err:
 	edac_mc_free(mci);
 	return res;
 }
+EXPORT_SYMBOL_GPL(fsl_ddr_mc_err_probe);

What's that export for?

I thought I need to export this symbol so it can be call from a module driver. Actually I don't. Will remove.

York

reviewer Acked-by on v3 8/11
#40 lore raw
In reply to York Sun
Quoted 24 lines · York Sun

Get endianness from device tree. Both big endian and little endian are supported. Default to big endian for backward compatibility to MPC85xx.

---
Change log
v3: no change
v2: Separated from "Add support for ARM-based SoCs" patch

 .../fsl/ddr.txt}                                   |  6 ++
 drivers/edac/fsl_ddr_edac.c                        | 83 ++++++++++++++--------
 2 files changed, 58 insertions(+), 31 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/mem-ctrlr.txt => memory-controllers/fsl/ddr.txt} (74%)
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +0 -0
similarity index 74%
rename from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt
rename to Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt
index f87856f..62623f9 100644

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt Properties: · line 13

Quoted 7 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +4 -0
@@ -7,6 +7,10 @@ Properties:
 		  "fsl,qoriq-memory-controller".
 - reg		: Address and size of DDR controller registers
 - interrupts	: Error interrupt of DDR controller
+- little-endian	: Specifies little-endian access to registers
+- big-endian	: Specifies big-endian access to registers
+
+If both little-endian and big-endian are omitted, big-endian will be used.

The binding looks fine.

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt int fsl_ddr_mc_err_probe(struct platform_device *op) · line 486

Quoted 5 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +1 -0
@@ -470,6 +483,13 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 	mci->ctl_name = pdata->name;
 	mci->dev_name = pdata->name;
 
+	if (of_find_property(op->dev.of_node, "little-endian", NULL))

Use: if (of_property_read_bool(dev.of_node, "little-endian"))

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt int fsl_ddr_mc_err_probe(struct platform_device *op) · line 488

Quoted 2 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +2 -0
+		little_endian = true;
+	else if (of_find_property(op->dev.of_node, "big-endian", NULL))

Use: else if (of_property_read_bool(dev.of_node, "big-endian"))

Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt int fsl_ddr_mc_err_probe(struct platform_device *op) · line 492

Quoted 4 lines
Documentation/devicetree/bindings/memory-controllers/fsl/ddr.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/mem-ctrlr.txt +4 -0
+		little_endian = false;
+	else
+		little_endian = false;
+

With those fixed up:

Thanks,
Mark.

author
#41 lore raw

PATCH v3 9/11 driver/edac/fsl_ddr: Fix kernel warning when module is removed

In reply to a message not in the archive

When compiled as a module, removing this module causes kernel warnings when irq_dispose_mapping() is called. Instead of calling irq_of_parse_and_map(), using platform_get_irq() to acquire the IRQ number.

---
Change log
v3: no change
v2: no change

 drivers/edac/fsl_ddr_edac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/edac/fsl_ddr_edac.c +1 -3
index b1b7924..a3fc8fe 100644
@@ -563,7 +563,7 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 		ddr_out32(pdata->mc_vbase + MC_ERR_SBE, 0x10000);
 
 		/* register interrupts */
-		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+		pdata->irq = platform_get_irq(op, 0);
 		res = devm_request_irq(&op->dev, pdata->irq,
 				       fsl_ddr_mc_isr,
 				       IRQF_SHARED,
@@ -571,7 +571,6 @@ int fsl_ddr_mc_err_probe(struct platform_device *op)
 		if (res < 0) {
 			pr_err("%s: Unable to request irq %d for FSL DDR DRAM ERR\n",
 			       __func__, pdata->irq);
-			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
@@ -603,7 +602,6 @@ int fsl_ddr_mc_err_remove(struct platform_device *op)
 	edac_dbg(0, "\n");
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		irq_dispose_mapping(pdata->irq);
 		ddr_out32(pdata->mc_vbase + MC_ERR_INT_EN, 0);
 	}
 
Signature · 1 line
2.7.4
author
#42 lore raw

PATCH v3 10/11 driver/edac/layerscape_edac: Add Layerscape EDAC support

In reply to a message not in the archive

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67 ++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 12 deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
arch/arm64/Kconfig.platforms +1 -0
index 7ef1d05..185a215 100644
@@ -41,6 +41,7 @@ config ARCH_EXYNOS
 
 config ARCH_LAYERSCAPE
 	bool "ARMv8 based Freescale Layerscape SoC family"
+	select EDAC_SUPPORT
 	help
 	  This enables support for the Freescale Layerscape SoC family.
 
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +9 -12
similarity index 79%
copy from arch/arm/include/asm/edac.h
copy to arch/arm64/include/asm/edac.h
index 5189fa8..36a226c 100644
@@ -18,16 +18,15 @@
 #define ASM_EDAC_H
 /*
  * ECC atomic, DMA, SMP and interrupt safe scrub function.
- * Implements the per arch edac_atomic_scrub() that EDAC use for software
+ * Implements the per arch atomic_scrub() that EDAC use for software
  * ECC scrubbing.  It reads memory and then writes back the original
  * value, allowing the hardware to detect and correct memory errors.
  */
-
-static inline void edac_atomic_scrub(void *va, u32 size)
+static inline void atomic_scrub(void *va, u32 size)
 {
-#if __LINUX_ARM_ARCH__ >= 6
-	unsigned int *virt_addr = va;
-	unsigned int temp, temp2;
+	unsigned long *virt_addr = va;
+	unsigned long temp;
+	unsigned int temp2;
 	unsigned int i;
 
 	for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
@@ -35,15 +34,13 @@ static inline void edac_atomic_scrub(void *va, u32 size)
 		 * so we are interrupt, DMA and SMP safe.
 		 */
 		__asm__ __volatile__("\n"
-			"1:	ldrex	%0, [%2]\n"
-			"	strex	%1, %0, [%2]\n"
-			"	teq	%1, #0\n"
-			"	bne	1b\n"
+			"1:	ldxr	%0, [%2]\n"
+			"	stxr	%w1, %0, [%2]\n"
+			"	cbnz	%w1, 1b\n"
 			: "=&r"(temp), "=&r"(temp2)
 			: "r"(virt_addr)
-			: "cc");
+			: "memory");
 	}
-#endif
 }
 
 #endif
arch/arm64/include/asm/irq.h +4 -0
index b77197d..d09c008 100644
@@ -11,6 +11,10 @@
 #include <asm-generic/irq.h>
 #include <asm/thread_info.h>
 
+#ifndef NO_IRQ
+#define NO_IRQ	((unsigned int)(-1))
+#endif
+
 struct pt_regs;
 
 DECLARE_PER_CPU(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack);
drivers/edac/Kconfig +7 -0
index 6ca7474..f1ac4e2 100644
@@ -258,6 +258,13 @@ config EDAC_MPC85XX
 	  Support for error detection and correction on the Freescale
 	  MPC8349, MPC8560, MPC8540, MPC8548, T4240
 
+config EDAC_LAYERSCAPE
+	tristate "Freescale Layerscape DDR"
+	depends on EDAC_MM_EDAC && ARCH_LAYERSCAPE
+	help
+	  Support for error detection and correction on Freescale memory
+	  controllers on Layerscape SoCs.
+
 config EDAC_MV64X60
 	tristate "Marvell MV64x60"
 	depends on EDAC_MM_EDAC && MV64X60
drivers/edac/Makefile +3 -0
index ee047a4..910dc83 100644
@@ -54,6 +54,9 @@ obj-$(CONFIG_EDAC_PASEMI)		+= pasemi_edac.o
 mpc85xx_edac_mod-y			:= fsl_ddr_edac.o mpc85xx_edac.o
 obj-$(CONFIG_EDAC_MPC85XX)		+= mpc85xx_edac_mod.o
 
+layerscape_edac_mod-y			:= fsl_ddr_edac.o layerscape_edac.o
+obj-$(CONFIG_EDAC_LAYERSCAPE)		+= layerscape_edac_mod.o
+
 obj-$(CONFIG_EDAC_MV64X60)		+= mv64x60_edac.o
 obj-$(CONFIG_EDAC_CELL)			+= cell_edac.o
 obj-$(CONFIG_EDAC_PPC4XX)		+= ppc4xx_edac.o
drivers/edac/fsl_ddr_edac.c +1 -0
index a3fc8fe..d4b910d 100644
@@ -22,6 +22,7 @@
 
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
+#include <linux/of_address.h>
 #include "edac_module.h"
 #include "edac_core.h"
 #include "fsl_ddr_edac.h"
drivers/edac/layerscape_edac.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.7.4
#43 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

Quoted 10 lines · York Sun

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

Quoted 11 lines
 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67
++++++++++++++++++++++++++++++++++ 7 files changed, 92 insertions(+), 12
deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c

This only adds EDAC support for ARM64. What would be necessary for ARM support, e.g. LS1021A?

Best regards,
Alexander

author
#44 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

Quoted 23 lines · Alexander Stein
Quoted 10 lines · York Sun

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

Quoted 11 lines
 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67
++++++++++++++++++++++++++++++++++ 7 files changed, 92 insertions(+), 12
deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
Quoted 3 lines

This only adds EDAC support for ARM64. What would be necessary for ARM support, e.g. LS1021A?

It should be just one step away. I haven't got a chance to verify/debug it on LS1021A.

York

#45 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

In reply to York Sun
Quoted 63 lines · On Thu, 4 Aug 2016 15:58:35 -0700 York Sun <[email protected]> wrote:

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67 ++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 12 deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
arch/arm64/Kconfig.platforms +1 -0
index 7ef1d05..185a215 100644
@@ -41,6 +41,7 @@ config ARCH_EXYNOS
 
 config ARCH_LAYERSCAPE
 	bool "ARMv8 based Freescale Layerscape SoC family"
+	select EDAC_SUPPORT
 	help
 	  This enables support for the Freescale Layerscape SoC family.
 
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +5 -6
similarity index 79%
copy from arch/arm/include/asm/edac.h
copy to arch/arm64/include/asm/edac.h
index 5189fa8..36a226c 100644
@@ -18,16 +18,15 @@
 #define ASM_EDAC_H
 /*
  * ECC atomic, DMA, SMP and interrupt safe scrub function.
- * Implements the per arch edac_atomic_scrub() that EDAC use for software
+ * Implements the per arch atomic_scrub() that EDAC use for software
  * ECC scrubbing.  It reads memory and then writes back the original
  * value, allowing the hardware to detect and correct memory errors.
  */
-
-static inline void edac_atomic_scrub(void *va, u32 size)
+static inline void atomic_scrub(void *va, u32 size)
 {
-#if __LINUX_ARM_ARCH__ >= 6
-	unsigned int *virt_addr = va;
-	unsigned int temp, temp2;
+	unsigned long *virt_addr = va;
+	unsigned long temp;
+	unsigned int temp2;
 	unsigned int i;
 
 	for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {

arch/arm64/include/asm/edac.h static inline void edac_atomic_scrub(void *va, u32 size) · line 39

Quoted 10 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +3 -4
@@ -35,15 +34,13 @@ static inline void edac_atomic_scrub(void *va, u32 size)
 		 * so we are interrupt, DMA and SMP safe.
 		 */
 		__asm__ __volatile__("\n"
-			"1:	ldrex	%0, [%2]\n"
-			"	strex	%1, %0, [%2]\n"
-			"	teq	%1, #0\n"
-			"	bne	1b\n"
+			"1:	ldxr	%0, [%2]\n"
+			"	stxr	%w1, %0, [%2]\n"
+			"	cbnz	%w1, 1b\n"

Hiding architecture code in a driver, are we? Hmmm.

Also, how can this be safe if you have non cache-coherent DMA going on?

Quoted 14 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +1 -2
 			: "=&r"(temp), "=&r"(temp2)
 			: "r"(virt_addr)
-			: "cc");
+			: "memory");
 	}
-#endif
 }
 
 #endif
arch/arm64/include/asm/irq.h +0 -0
index b77197d..d09c008 100644

arch/arm64/include/asm/irq.h line 16

Quoted 6 lines
arch/arm64/include/asm/irq.h +3 -0
@@ -11,6 +11,10 @@
 #include <asm-generic/irq.h>
 #include <asm/thread_info.h>
 
+#ifndef NO_IRQ
+#define NO_IRQ	((unsigned int)(-1))
+#endif

NAK.

NO_IRQ shouldn't exist at all, and if it had to exist, it would have the value 0. This really is a leftover of a distant past that has no real relevance on recent architectures.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny.
author
#46 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

Quoted 64 lines · Marc Zyngier
Quoted 61 lines · On Thu, 4 Aug 2016 15:58:35 -0700 York Sun <[email protected]> wrote:

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67 ++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 12 deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
arch/arm64/Kconfig.platforms +1 -0
index 7ef1d05..185a215 100644
@@ -41,6 +41,7 @@ config ARCH_EXYNOS
 
 config ARCH_LAYERSCAPE
 	bool "ARMv8 based Freescale Layerscape SoC family"
+	select EDAC_SUPPORT
 	help
 	  This enables support for the Freescale Layerscape SoC family.
 
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +5 -6
similarity index 79%
copy from arch/arm/include/asm/edac.h
copy to arch/arm64/include/asm/edac.h
index 5189fa8..36a226c 100644
@@ -18,16 +18,15 @@
 #define ASM_EDAC_H
 /*
  * ECC atomic, DMA, SMP and interrupt safe scrub function.
- * Implements the per arch edac_atomic_scrub() that EDAC use for software
+ * Implements the per arch atomic_scrub() that EDAC use for software
  * ECC scrubbing.  It reads memory and then writes back the original
  * value, allowing the hardware to detect and correct memory errors.
  */
-
-static inline void edac_atomic_scrub(void *va, u32 size)
+static inline void atomic_scrub(void *va, u32 size)
 {
-#if __LINUX_ARM_ARCH__ >= 6
-	unsigned int *virt_addr = va;
-	unsigned int temp, temp2;
+	unsigned long *virt_addr = va;
+	unsigned long temp;
+	unsigned int temp2;
 	unsigned int i;
 
Quoted 14 lines

arch/arm64/include/asm/edac.h static inline void edac_atomic_scrub(void *va, u32 size) · line 39

Quoted 12 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +3 -4
 	for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
@@ -35,15 +34,13 @@ static inline void edac_atomic_scrub(void *va, u32 size)
 		 * so we are interrupt, DMA and SMP safe.
 		 */
 		__asm__ __volatile__("\n"
-			"1:	ldrex	%0, [%2]\n"
-			"	strex	%1, %0, [%2]\n"
-			"	teq	%1, #0\n"
-			"	bne	1b\n"
+			"1:	ldxr	%0, [%2]\n"
+			"	stxr	%w1, %0, [%2]\n"
+			"	cbnz	%w1, 1b\n"

Hiding architecture code in a driver, are we? Hmmm.

This adds atomic_scrub() for arm64. Arm already has this function. Are you suggesting to separate this part as an individual patch?

Quoted 2 lines

Also, how can this be safe if you have non cache-coherent DMA going on?

I am clueless on this topic. What's your suggestion.

Quoted 24 lines
Quoted 15 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +1 -2
 			: "=&r"(temp), "=&r"(temp2)
 			: "r"(virt_addr)
-			: "cc");
+			: "memory");
 	}
-#endif
 }
 
 #endif
arch/arm64/include/asm/irq.h +0 -0
index b77197d..d09c008 100644

arch/arm64/include/asm/irq.h line 16

Quoted 6 lines
arch/arm64/include/asm/irq.h +3 -0
@@ -11,6 +11,10 @@
 #include <asm-generic/irq.h>
 #include <asm/thread_info.h>
 
+#ifndef NO_IRQ
+#define NO_IRQ	((unsigned int)(-1))
+#endif

NAK.

Quoted 4 lines

NO_IRQ shouldn't exist at all, and if it had to exist, it would have the value 0. This really is a leftover of a distant past that has no real relevance on recent architectures.

OK. I will drop the NO_IRQ in the driver.

York

#47 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

Quoted 80 lines · york sun
Quoted 64 lines · Marc Zyngier
Quoted 61 lines · On Thu, 4 Aug 2016 15:58:35 -0700 York Sun <[email protected]> wrote:

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67 ++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 12 deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
arch/arm64/Kconfig.platforms +1 -0
index 7ef1d05..185a215 100644
@@ -41,6 +41,7 @@ config ARCH_EXYNOS
 
 config ARCH_LAYERSCAPE
 	bool "ARMv8 based Freescale Layerscape SoC family"
+	select EDAC_SUPPORT
 	help
 	  This enables support for the Freescale Layerscape SoC family.
 
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +5 -6
similarity index 79%
copy from arch/arm/include/asm/edac.h
copy to arch/arm64/include/asm/edac.h
index 5189fa8..36a226c 100644
@@ -18,16 +18,15 @@
 #define ASM_EDAC_H
 /*
  * ECC atomic, DMA, SMP and interrupt safe scrub function.
- * Implements the per arch edac_atomic_scrub() that EDAC use for software
+ * Implements the per arch atomic_scrub() that EDAC use for software
  * ECC scrubbing.  It reads memory and then writes back the original
  * value, allowing the hardware to detect and correct memory errors.
  */
-
-static inline void edac_atomic_scrub(void *va, u32 size)
+static inline void atomic_scrub(void *va, u32 size)
 {
-#if __LINUX_ARM_ARCH__ >= 6
-	unsigned int *virt_addr = va;
-	unsigned int temp, temp2;
+	unsigned long *virt_addr = va;
+	unsigned long temp;
+	unsigned int temp2;
 	unsigned int i;
 
Quoted 14 lines

arch/arm64/include/asm/edac.h static inline void edac_atomic_scrub(void *va, u32 size) · line 39

Quoted 12 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +3 -4
 	for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
@@ -35,15 +34,13 @@ static inline void edac_atomic_scrub(void *va, u32 size)
 		 * so we are interrupt, DMA and SMP safe.
 		 */
 		__asm__ __volatile__("\n"
-			"1:	ldrex	%0, [%2]\n"
-			"	strex	%1, %0, [%2]\n"
-			"	teq	%1, #0\n"
-			"	bne	1b\n"
+			"1:	ldxr	%0, [%2]\n"
+			"	stxr	%w1, %0, [%2]\n"
+			"	cbnz	%w1, 1b\n"

Hiding architecture code in a driver, are we? Hmmm.

Quoted 6 lines

This adds atomic_scrub() for arm64. Arm already has this function. Are you suggesting to separate this part as an individual patch?

Quoted 2 lines

Also, how can this be safe if you have non cache-coherent DMA going on?

I am clueless on this topic. What's your suggestion.

We've discussed this in the past for ARMv7 and the bottom line is that it's not safe to scrub memory backing non-coherent DMA buffers. You will likely end up with data corruption if you do that.

The two options are:

(1) Restrict scrubbing to non-DMA memory, or
(2) Only enable scrubbing if the system is completely cache-coherent

The problem with (1) is that we can't detect that, particularly when the streaming DMA API is in use.

The problem with (2) is that you can have a coherent system that decides dynamically to drop in and out of coherency as a result of, e.g. PCI NoSnoop transactions.

Will

author
#48 lore raw

Re: [Patch v3 10/11] driver/edac/layerscape_edac: Add Layerscape EDAC support

Quoted 97 lines · Will Deacon
Quoted 80 lines · york sun
Quoted 64 lines · Marc Zyngier
Quoted 61 lines · On Thu, 4 Aug 2016 15:58:35 -0700 York Sun <[email protected]> wrote:

Add DDR EDAC for ARM-based compatible controllers. Both big-endian and little-endian are supported.

---
Change log
v3: no change
v2: Create new driver using shared DDR object

 arch/arm64/Kconfig.platforms           |  1 +
 arch/{arm => arm64}/include/asm/edac.h | 21 +++++------
 arch/arm64/include/asm/irq.h           |  4 ++
 drivers/edac/Kconfig                   |  7 ++++
 drivers/edac/Makefile                  |  3 ++
 drivers/edac/fsl_ddr_edac.c            |  1 +
 drivers/edac/layerscape_edac.c         | 67 ++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 12 deletions(-)
 copy arch/{arm => arm64}/include/asm/edac.h (79%)
 create mode 100644 drivers/edac/layerscape_edac.c
arch/arm64/Kconfig.platforms +1 -0
index 7ef1d05..185a215 100644
@@ -41,6 +41,7 @@ config ARCH_EXYNOS
 
 config ARCH_LAYERSCAPE
 	bool "ARMv8 based Freescale Layerscape SoC family"
+	select EDAC_SUPPORT
 	help
 	  This enables support for the Freescale Layerscape SoC family.
 
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +5 -6
similarity index 79%
copy from arch/arm/include/asm/edac.h
copy to arch/arm64/include/asm/edac.h
index 5189fa8..36a226c 100644
@@ -18,16 +18,15 @@
 #define ASM_EDAC_H
 /*
  * ECC atomic, DMA, SMP and interrupt safe scrub function.
- * Implements the per arch edac_atomic_scrub() that EDAC use for software
+ * Implements the per arch atomic_scrub() that EDAC use for software
  * ECC scrubbing.  It reads memory and then writes back the original
  * value, allowing the hardware to detect and correct memory errors.
  */
-
-static inline void edac_atomic_scrub(void *va, u32 size)
+static inline void atomic_scrub(void *va, u32 size)
 {
-#if __LINUX_ARM_ARCH__ >= 6
-	unsigned int *virt_addr = va;
-	unsigned int temp, temp2;
+	unsigned long *virt_addr = va;
+	unsigned long temp;
+	unsigned int temp2;
 	unsigned int i;
 
Quoted 14 lines

arch/arm64/include/asm/edac.h static inline void edac_atomic_scrub(void *va, u32 size) · line 39

Quoted 12 lines
arch/arm64/include/asm/edac.h renamed from arch/arm/include/asm/edac.h +3 -4
 	for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
@@ -35,15 +34,13 @@ static inline void edac_atomic_scrub(void *va, u32 size)
 		 * so we are interrupt, DMA and SMP safe.
 		 */
 		__asm__ __volatile__("\n"
-			"1:	ldrex	%0, [%2]\n"
-			"	strex	%1, %0, [%2]\n"
-			"	teq	%1, #0\n"
-			"	bne	1b\n"
+			"1:	ldxr	%0, [%2]\n"
+			"	stxr	%w1, %0, [%2]\n"
+			"	cbnz	%w1, 1b\n"

Hiding architecture code in a driver, are we? Hmmm.

Quoted 6 lines

This adds atomic_scrub() for arm64. Arm already has this function. Are you suggesting to separate this part as an individual patch?

Quoted 2 lines

Also, how can this be safe if you have non cache-coherent DMA going on?

I am clueless on this topic. What's your suggestion.

We've discussed this in the past for ARMv7 and the bottom line is that it's not safe to scrub memory backing non-coherent DMA buffers. You will likely end up with data corruption if you do that.

The two options are:

(1) Restrict scrubbing to non-DMA memory, or
(2) Only enable scrubbing if the system is completely cache-coherent

Quoted 7 lines

The problem with (1) is that we can't detect that, particularly when the streaming DMA API is in use.

The problem with (2) is that you can have a coherent system that decides dynamically to drop in and out of coherency as a result of, e.g. PCI NoSnoop transactions.

Good information! I realize I added this code on an older kernel and rebased to the latest one. This code is actually not needed, as long as CONFIG_EDAC_ATOMIC_SCRUB.

You said this has been discussed for ARMv7, what was the conclusion? I see edac_atomic_scrub() is still used for ARM.

York

author
#49 lore raw

PATCH v3 11/11 arm64: Update device tree for Layerscape SoCs

In reply to a message not in the archive

Add DDR memory controller nodes to enable EDAC driver.

---
Change log
v3: no change
v2: no change

 arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi |  7 +++++++
 arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 14 ++++++++++++++
 2 files changed, 21 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +7 -0
index de0323b..cb33f23 100644
@@ -196,6 +196,13 @@
 			bus-width = <4>;
 		};
 
+		ddr: memory-controller at 1080000 {
+			compatible = "fsl,qoriq-memory-controller";
+			reg = <0x0 0x1080000 0x0 0x1000>;
+			interrupts = <0 144 0x4>;
+			big-endian;
+		};
+
 		dspi0: dspi at 2100000 {
 			compatible = "fsl,ls1043a-dspi", "fsl,ls1021a-v1.0-dspi";
 			#address-cells = <1>;
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +14 -0
index 3187c82..3221e5c 100644
@@ -689,4 +689,18 @@
 			interrupts = <0 12 4>;
 		};
 	};
+
+	ddr1: memory-controller at 1080000 {
+		compatible = "fsl,qoriq-memory-controller";
+		reg = <0x0 0x1080000 0x0 0x1000>;
+		interrupts = <0 17 0x4>;
+		little-endian;
+	};
+
+	ddr2: memory-controller at 1090000 {
+		compatible = "fsl,qoriq-memory-controller";
+		reg = <0x0 0x1090000 0x0 0x1000>;
+		interrupts = <0 18 0x4>;
+		little-endian;
+	};
 };
Signature · 1 line
2.7.4