Skip to content

Commit bac9bd9

Browse files
committed
Merge tag 'memory-controller-drv-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/drivers
Memory controller drivers for v5.10 1. Fixes in several drivers for GCC warnings, including kerneldoc fixes and issues discovered while compile testing. 2. Enable compile testing of most of the drivers. 3. Use dev_err_probe() to simplify the code. 4. omap-gpmc: fix off by one errors, code cleanups and improvements. 5. tegra: remove the GPU from DRM IOMMU group so it would use its own; few minor fixes. 6. brcmstb_dpfe: fix memory leak and array index out of bounds. * tag 'memory-controller-drv-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: (26 commits) memory: fsl-corenet-cf: Fix handling of platform_get_irq() error memory: omap-gpmc: Fix -Wunused-function warnings memory: tegra: Remove GPU from DRM IOMMU group memory: tegra186-emc: Simplify with dev_err_probe() memory: brcmstb_dpfe: Simplify with dev_err_probe() memory: samsung: exynos5422-dmc: add missing and fix kerneldoc memory: samsung: exynos5422-dmc: remove unused exynos5_dmc members memory: samsung: exynos5422-dmc: rename timing register fields variables memory: emif: Remove bogus debugfs error handling memory: omap-gpmc: Fix build error without CONFIG_OF memory: omap-gpmc: Fix a couple off by ones memory: brcmstb_dpfe: fix array index out of bounds memory: brcmstb_dpfe: Fix memory leak memory: tegra: Correct shift value of apew memory: Enable compile testing for most of the drivers memory: brcmstb_dpfe: add separate entry for compile test memory: tegra: tegra210-emc: fix indentation memory: renesas-rpc-if: simplify with PTR_ERR_OR_ZERO memory: omap-gpmc: consistently use !res for NULL checks memory: omap-gpmc: use WARN() instead of BUG() on wrong free ... Link: https://lore.kernel.org/r/20200907150611.11267-1-krzk@kernel.org Signed-off-by: Olof Johansson <olof@lixom.net>
2 parents 21a8fa6 + dd85345 commit bac9bd9

12 files changed

Lines changed: 305 additions & 232 deletions

File tree

drivers/memory/Kconfig

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ config ARM_PL172_MPMC
3232

3333
config ATMEL_SDRAMC
3434
bool "Atmel (Multi-port DDR-)SDRAM Controller"
35-
default y
36-
depends on ARCH_AT91 && OF
35+
default y if ARCH_AT91
36+
depends on ARCH_AT91 || COMPILE_TEST
37+
depends on OF
3738
help
3839
This driver is for Atmel SDRAM Controller or Atmel Multi-port
3940
DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs.
@@ -42,8 +43,9 @@ config ATMEL_SDRAMC
4243

4344
config ATMEL_EBI
4445
bool "Atmel EBI driver"
45-
default y
46-
depends on ARCH_AT91 && OF
46+
default y if ARCH_AT91
47+
depends on ARCH_AT91 || COMPILE_TEST
48+
depends on OF
4749
select MFD_SYSCON
4850
select MFD_ATMEL_SMC
4951
help
@@ -52,6 +54,18 @@ config ATMEL_EBI
5254
tree is used. This bus supports NANDs, external ethernet controller,
5355
SRAMs, ATA devices, etc.
5456

57+
config BRCMSTB_DPFE
58+
bool "Broadcom STB DPFE driver" if COMPILE_TEST
59+
default y if ARCH_BRCMSTB
60+
depends on ARCH_BRCMSTB || COMPILE_TEST
61+
help
62+
This driver provides access to the DPFE interface of Broadcom
63+
STB SoCs. The firmware running on the DCPU inside the DDR PHY can
64+
provide current information about the system's RAM, for instance
65+
the DRAM refresh rate. This can be used as an indirect indicator
66+
for the DRAM's temperature. Slower refresh rate means cooler RAM,
67+
higher refresh rate means hotter RAM.
68+
5569
config BT1_L2_CTL
5670
bool "Baikal-T1 CM2 L2-RAM Cache Control Block"
5771
depends on MIPS_BAIKAL_T1 || COMPILE_TEST
@@ -65,7 +79,8 @@ config BT1_L2_CTL
6579

6680
config TI_AEMIF
6781
tristate "Texas Instruments AEMIF driver"
68-
depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
82+
depends on ARCH_DAVINCI || ARCH_KEYSTONE || COMPILE_TEST
83+
depends on OF
6984
help
7085
This driver is for the AEMIF module available in Texas Instruments
7186
SoCs. AEMIF stands for Asynchronous External Memory Interface and
@@ -76,7 +91,7 @@ config TI_AEMIF
7691

7792
config TI_EMIF
7893
tristate "Texas Instruments EMIF driver"
79-
depends on ARCH_OMAP2PLUS
94+
depends on ARCH_OMAP2PLUS || COMPILE_TEST
8095
select DDR
8196
help
8297
This driver is for the EMIF module available in Texas Instruments
@@ -88,7 +103,7 @@ config TI_EMIF
88103
temperature changes
89104

90105
config OMAP_GPMC
91-
bool
106+
bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST
92107
select GPIOLIB
93108
help
94109
This driver is for the General Purpose Memory Controller (GPMC)
@@ -112,7 +127,8 @@ config OMAP_GPMC_DEBUG
112127

113128
config TI_EMIF_SRAM
114129
tristate "Texas Instruments EMIF SRAM driver"
115-
depends on (SOC_AM33XX || SOC_AM43XX) && SRAM
130+
depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST)
131+
depends on SRAM
116132
help
117133
This driver is for the EMIF module available on Texas Instruments
118134
AM33XX and AM43XX SoCs and is required for PM. Certain parts of
@@ -122,8 +138,9 @@ config TI_EMIF_SRAM
122138

123139
config MVEBU_DEVBUS
124140
bool "Marvell EBU Device Bus Controller"
125-
default y
126-
depends on PLAT_ORION && OF
141+
default y if PLAT_ORION
142+
depends on PLAT_ORION || COMPILE_TEST
143+
depends on OF
127144
help
128145
This driver is for the Device Bus controller available in some
129146
Marvell EBU SoCs such as Discovery (mv78xx0), Orion (88f5xxx) and
@@ -132,7 +149,7 @@ config MVEBU_DEVBUS
132149

133150
config FSL_CORENET_CF
134151
tristate "Freescale CoreNet Error Reporting"
135-
depends on FSL_SOC_BOOKE
152+
depends on FSL_SOC_BOOKE || COMPILE_TEST
136153
help
137154
Say Y for reporting of errors from the Freescale CoreNet
138155
Coherency Fabric. Errors reported include accesses to
@@ -141,7 +158,7 @@ config FSL_CORENET_CF
141158
represents a coherency violation.
142159

143160
config FSL_IFC
144-
bool
161+
bool "Freescale IFC driver" if COMPILE_TEST
145162
depends on FSL_SOC || ARCH_LAYERSCAPE || SOC_LS1021A || COMPILE_TEST
146163
depends on HAS_IOMEM
147164

@@ -155,7 +172,7 @@ config JZ4780_NEMC
155172
memory devices such as NAND and SRAM.
156173

157174
config MTK_SMI
158-
bool
175+
bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
159176
depends on ARCH_MEDIATEK || COMPILE_TEST
160177
help
161178
This driver is for the Memory Controller module in MediaTek SoCs,
@@ -164,24 +181,24 @@ config MTK_SMI
164181

165182
config DA8XX_DDRCTL
166183
bool "Texas Instruments da8xx DDR2/mDDR driver"
167-
depends on ARCH_DAVINCI_DA8XX
184+
depends on ARCH_DAVINCI_DA8XX || COMPILE_TEST
168185
help
169186
This driver is for the DDR2/mDDR Memory Controller present on
170187
Texas Instruments da8xx SoCs. It's used to tweak various memory
171188
controller configuration options.
172189

173190
config PL353_SMC
174191
tristate "ARM PL35X Static Memory Controller(SMC) driver"
175-
default y
192+
default y if ARM
176193
depends on ARM
177-
depends on ARM_AMBA
194+
depends on ARM_AMBA || COMPILE_TEST
178195
help
179196
This driver is for the ARM PL351/PL353 Static Memory
180197
Controller(SMC) module.
181198

182199
config RENESAS_RPCIF
183200
tristate "Renesas RPC-IF driver"
184-
depends on ARCH_RENESAS
201+
depends on ARCH_RENESAS || COMPILE_TEST
185202
select REGMAP_MMIO
186203
help
187204
This supports Renesas R-Car Gen3 RPC-IF which provides either SPI

drivers/memory/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif
1010
obj-$(CONFIG_ARM_PL172_MPMC) += pl172.o
1111
obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o
1212
obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o
13-
obj-$(CONFIG_ARCH_BRCMSTB) += brcmstb_dpfe.o
13+
obj-$(CONFIG_BRCMSTB_DPFE) += brcmstb_dpfe.o
1414
obj-$(CONFIG_BT1_L2_CTL) += bt1-l2-ctl.o
1515
obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
1616
obj-$(CONFIG_TI_EMIF) += emif.o

drivers/memory/brcmstb_dpfe.c

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,6 @@ struct brcmstb_dpfe_priv {
188188
struct mutex lock;
189189
};
190190

191-
static const char * const error_text[] = {
192-
"Success", "Header code incorrect", "Unknown command or argument",
193-
"Incorrect checksum", "Malformed command", "Timed out",
194-
};
195-
196191
/*
197192
* Forward declaration of our sysfs attribute functions, so we can declare the
198193
* attribute data structures early.
@@ -307,6 +302,20 @@ static const struct dpfe_api dpfe_api_v3 = {
307302
},
308303
};
309304

305+
static const char *get_error_text(unsigned int i)
306+
{
307+
static const char * const error_text[] = {
308+
"Success", "Header code incorrect",
309+
"Unknown command or argument", "Incorrect checksum",
310+
"Malformed command", "Timed out", "Unknown error",
311+
};
312+
313+
if (unlikely(i >= ARRAY_SIZE(error_text)))
314+
i = ARRAY_SIZE(error_text) - 1;
315+
316+
return error_text[i];
317+
}
318+
310319
static bool is_dcpu_enabled(struct brcmstb_dpfe_priv *priv)
311320
{
312321
u32 val;
@@ -445,7 +454,7 @@ static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd,
445454
}
446455
if (resp != 0) {
447456
mutex_unlock(&priv->lock);
448-
return -ETIMEDOUT;
457+
return -ffs(DCPU_RET_ERR_TIMEDOUT);
449458
}
450459

451460
/* Compute checksum over the message */
@@ -647,8 +656,10 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
647656
return (ret == -ENOENT) ? -EPROBE_DEFER : ret;
648657

649658
ret = __verify_firmware(&init, fw);
650-
if (ret)
651-
return -EFAULT;
659+
if (ret) {
660+
ret = -EFAULT;
661+
goto release_fw;
662+
}
652663

653664
__disable_dcpu(priv);
654665

@@ -667,18 +678,20 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
667678

668679
ret = __write_firmware(priv->dmem, dmem, dmem_size, is_big_endian);
669680
if (ret)
670-
return ret;
681+
goto release_fw;
671682
ret = __write_firmware(priv->imem, imem, imem_size, is_big_endian);
672683
if (ret)
673-
return ret;
684+
goto release_fw;
674685

675686
ret = __verify_fw_checksum(&init, priv, header, init.chksum);
676687
if (ret)
677-
return ret;
688+
goto release_fw;
678689

679690
__enable_dcpu(priv);
680691

681-
return 0;
692+
release_fw:
693+
release_firmware(fw);
694+
return ret;
682695
}
683696

684697
static ssize_t generic_show(unsigned int command, u32 response[],
@@ -691,7 +704,7 @@ static ssize_t generic_show(unsigned int command, u32 response[],
691704

692705
ret = __send_command(priv, command, response);
693706
if (ret < 0)
694-
return sprintf(buf, "ERROR: %s\n", error_text[-ret]);
707+
return sprintf(buf, "ERROR: %s\n", get_error_text(-ret));
695708

696709
return 0;
697710
}
@@ -888,11 +901,8 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
888901
}
889902

890903
ret = brcmstb_dpfe_download_firmware(priv);
891-
if (ret) {
892-
if (ret != -EPROBE_DEFER)
893-
dev_err(dev, "Couldn't download firmware -- %d\n", ret);
894-
return ret;
895-
}
904+
if (ret)
905+
return dev_err_probe(dev, ret, "Couldn't download firmware\n");
896906

897907
ret = sysfs_create_groups(&pdev->dev.kobj, priv->dpfe_api->sysfs_attrs);
898908
if (!ret)

drivers/memory/emif.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -163,35 +163,12 @@ static const struct file_operations emif_mr4_fops = {
163163

164164
static int __init_or_module emif_debugfs_init(struct emif_data *emif)
165165
{
166-
struct dentry *dentry;
167-
int ret;
168-
169-
dentry = debugfs_create_dir(dev_name(emif->dev), NULL);
170-
if (!dentry) {
171-
ret = -ENOMEM;
172-
goto err0;
173-
}
174-
emif->debugfs_root = dentry;
175-
176-
dentry = debugfs_create_file("regcache_dump", S_IRUGO,
177-
emif->debugfs_root, emif, &emif_regdump_fops);
178-
if (!dentry) {
179-
ret = -ENOMEM;
180-
goto err1;
181-
}
182-
183-
dentry = debugfs_create_file("mr4", S_IRUGO,
184-
emif->debugfs_root, emif, &emif_mr4_fops);
185-
if (!dentry) {
186-
ret = -ENOMEM;
187-
goto err1;
188-
}
189-
166+
emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL);
167+
debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif,
168+
&emif_regdump_fops);
169+
debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif,
170+
&emif_mr4_fops);
190171
return 0;
191-
err1:
192-
debugfs_remove_recursive(emif->debugfs_root);
193-
err0:
194-
return ret;
195172
}
196173

197174
static void __exit emif_debugfs_exit(struct emif_data *emif)

drivers/memory/fsl-corenet-cf.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,8 @@ static int ccf_probe(struct platform_device *pdev)
211211
dev_set_drvdata(&pdev->dev, ccf);
212212

213213
irq = platform_get_irq(pdev, 0);
214-
if (!irq) {
215-
dev_err(&pdev->dev, "%s: no irq\n", __func__);
216-
return -ENXIO;
217-
}
214+
if (irq < 0)
215+
return irq;
218216

219217
ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf);
220218
if (ret) {

0 commit comments

Comments
 (0)