Skip to content

Commit 5d9aeaa

Browse files
nxpfranklibp3tk0v
authored andcommitted
EDAC/fsl_ddr: Move global variables into struct fsl_mc_pdata
Move global variables into the struct fsl_mc_pdata to handle systems with multiple DDR controllers. No functional change. Signed-off-by: Frank Li <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6c9748f commit 5d9aeaa

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

drivers/edac/fsl_ddr_edac.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,18 @@
3131

3232
static int edac_mc_idx;
3333

34-
static u32 orig_ddr_err_disable;
35-
static u32 orig_ddr_err_sbe;
36-
static bool little_endian;
37-
3834
static inline u32 ddr_in32(struct fsl_mc_pdata *pdata, unsigned int off)
3935
{
4036
void __iomem *addr = pdata->mc_vbase + off;
4137

42-
return little_endian ? ioread32(addr) : ioread32be(addr);
38+
return pdata->little_endian ? ioread32(addr) : ioread32be(addr);
4339
}
4440

4541
static inline void ddr_out32(struct fsl_mc_pdata *pdata, unsigned int off, u32 value)
4642
{
4743
void __iomem *addr = pdata->mc_vbase + off;
4844

49-
if (little_endian)
45+
if (pdata->little_endian)
5046
iowrite32(value, addr);
5147
else
5248
iowrite32be(value, addr);
@@ -511,7 +507,7 @@ int fsl_mc_err_probe(struct platform_device *op)
511507
* Get the endianness of DDR controller registers.
512508
* Default is big endian.
513509
*/
514-
little_endian = of_property_read_bool(op->dev.of_node, "little-endian");
510+
pdata->little_endian = of_property_read_bool(op->dev.of_node, "little-endian");
515511

516512
res = of_address_to_resource(op->dev.of_node, 0, &r);
517513
if (res) {
@@ -562,7 +558,7 @@ int fsl_mc_err_probe(struct platform_device *op)
562558
fsl_ddr_init_csrows(mci);
563559

564560
/* store the original error disable bits */
565-
orig_ddr_err_disable = ddr_in32(pdata, FSL_MC_ERR_DISABLE);
561+
pdata->orig_ddr_err_disable = ddr_in32(pdata, FSL_MC_ERR_DISABLE);
566562
ddr_out32(pdata, FSL_MC_ERR_DISABLE, 0);
567563

568564
/* clear all error bits */
@@ -579,8 +575,8 @@ int fsl_mc_err_probe(struct platform_device *op)
579575
DDR_EIE_MBEE | DDR_EIE_SBEE);
580576

581577
/* store the original error management threshold */
582-
orig_ddr_err_sbe = ddr_in32(pdata,
583-
FSL_MC_ERR_SBE) & 0xff0000;
578+
pdata->orig_ddr_err_sbe = ddr_in32(pdata,
579+
FSL_MC_ERR_SBE) & 0xff0000;
584580

585581
/* set threshold to 1 error per interrupt */
586582
ddr_out32(pdata, FSL_MC_ERR_SBE, 0x10000);
@@ -628,8 +624,9 @@ void fsl_mc_err_remove(struct platform_device *op)
628624
}
629625

630626
ddr_out32(pdata, FSL_MC_ERR_DISABLE,
631-
orig_ddr_err_disable);
632-
ddr_out32(pdata, FSL_MC_ERR_SBE, orig_ddr_err_sbe);
627+
pdata->orig_ddr_err_disable);
628+
ddr_out32(pdata, FSL_MC_ERR_SBE, pdata->orig_ddr_err_sbe);
629+
633630

634631
edac_mc_del_mc(&op->dev);
635632
edac_mc_free(mci);

drivers/edac/fsl_ddr_edac.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ struct fsl_mc_pdata {
7070
int edac_idx;
7171
void __iomem *mc_vbase;
7272
int irq;
73+
u32 orig_ddr_err_disable;
74+
u32 orig_ddr_err_sbe;
75+
bool little_endian;
7376
};
7477
int fsl_mc_err_probe(struct platform_device *op);
7578
void fsl_mc_err_remove(struct platform_device *op);

0 commit comments

Comments
 (0)