Skip to content

Commit ab274a7

Browse files
committed
Merge tag 'memory-controller-drv-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into arm/drivers
Memory controller drivers for v5.9 The drivers/memory directory with memory controller drivers, over the last days grew in numbers but lacked any coordinated care. The generic part (device tree helpers) were pulled in through various trees, depending on driver needs. The patchset is a first try to improve code quality of memory controller drivers. Mostly these are non-intrusive fixes for GCC, checkpatch or sparse warnings. This also fixes missing SPDX tags or improves generic code quality (whitespace, const correctness). Last commit appoints also Krzysztof Kozlowski as a maintainer. * tag 'memory-controller-drv-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: (22 commits) MAINTAINERS: Add Krzysztof Kozlowski as maintainer of memory controllers memory: samsung: exynos-srom: Describe the Kconfig entry memory: Describe the MEMORY Kconfig entry memory: da8xx-ddrctl: Remove unused 'node' variable memory: fsl_ifc: Fix whitespace issues memory: pl172: Add GPLv2 SPDX license header memory: omap-gpmc: Fix whitespace issue memory: omap-gpmc: Include <linux/sizes.h> for SZ_16M memory: mtk-smi: Add argument to function pointer definition memory: brcmstb_dpfe: Remove unneeded braces memory: brcmstb_dpfe: Constify the contents of string memory: ti-emif-pm: Fix cast to iomem pointer memory: ti-aemif: Rename SS to SSTROBE to avoid name conflicts memory: emif: Silence platform_get_irq() error in driver memory: emif: Fix whitespace coding style violations memory: emif: Put constant in comparison on the right side memory: emif-asm-offsets: Add GPLv2 SPDX license header memory: of: Remove unneeded extern from function declarations memory: of: Correct indentation memory: of: Remove __func__ in device related messages ... Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 1d4eada + 8a9ff87 commit ab274a7

16 files changed

+97
-87
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11085,6 +11085,13 @@ F: Documentation/core-api/boot-time-mm.rst
1108511085
F: include/linux/memblock.h
1108611086
F: mm/memblock.c
1108711087

11088+
MEMORY CONTROLLER DRIVERS
11089+
M: Krzysztof Kozlowski <[email protected]>
11090+
11091+
S: Maintained
11092+
F: Documentation/devicetree/bindings/memory-controllers/
11093+
F: drivers/memory/
11094+
1108811095
MEMORY MANAGEMENT
1108911096
M: Andrew Morton <[email protected]>
1109011097

drivers/memory/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
menuconfig MEMORY
77
bool "Memory Controller drivers"
8+
help
9+
This option allows to enable specific memory controller drivers,
10+
useful mostly on embedded systems. These could be controllers
11+
for DRAM (SDR, DDR), ROM, SRAM and others. The drivers features
12+
vary from memory tuning and frequency scaling to enabling
13+
access to attached peripherals through memory bus.
814

915
if MEMORY
1016

drivers/memory/brcmstb_dpfe.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct brcmstb_dpfe_priv {
188188
struct mutex lock;
189189
};
190190

191-
static const char *error_text[] = {
191+
static const char * const error_text[] = {
192192
"Success", "Header code incorrect", "Unknown command or argument",
193193
"Incorrect checksum", "Malformed command", "Timed out",
194194
};
@@ -379,9 +379,8 @@ static void __iomem *get_msg_ptr(struct brcmstb_dpfe_priv *priv, u32 response,
379379
void __iomem *ptr = NULL;
380380

381381
/* There is no need to use this function for API v3 or later. */
382-
if (unlikely(priv->dpfe_api->version >= 3)) {
382+
if (unlikely(priv->dpfe_api->version >= 3))
383383
return NULL;
384-
}
385384

386385
msg_type = (response >> DRAM_MSG_TYPE_OFFSET) & DRAM_MSG_TYPE_MASK;
387386
offset = (response >> DRAM_MSG_ADDR_OFFSET) & DRAM_MSG_ADDR_MASK;

drivers/memory/da8xx-ddrctl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,12 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
102102
{
103103
const struct da8xx_ddrctl_config_knob *knob;
104104
const struct da8xx_ddrctl_setting *setting;
105-
struct device_node *node;
106105
struct resource *res;
107106
void __iomem *ddrctl;
108107
struct device *dev;
109108
u32 reg;
110109

111110
dev = &pdev->dev;
112-
node = dev->of_node;
113111

114112
setting = da8xx_ddrctl_get_board_settings();
115113
if (!setting) {

drivers/memory/emif-asm-offsets.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* TI AM33XX EMIF PM Assembly Offsets
34
*
45
* Copyright (C) 2016-2017 Texas Instruments Inc.
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License as
8-
* published by the Free Software Foundation version 2.
9-
*
10-
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
11-
* kind, whether express or implied; without even the implied warranty
12-
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157
#include <linux/ti-emif-sram.h>
168

drivers/memory/emif.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,9 @@ static void set_lpmode(struct emif_data *emif, u8 lpmode)
282282
* the EMIF_PWR_MGMT_CTRL[10:8] REG_LP_MODE bit field to 0x4.
283283
*/
284284
if ((emif->plat_data->ip_rev == EMIF_4D) &&
285-
(EMIF_LP_MODE_PWR_DN == lpmode)) {
285+
(lpmode == EMIF_LP_MODE_PWR_DN)) {
286286
WARN_ONCE(1,
287-
"REG_LP_MODE = LP_MODE_PWR_DN(4) is prohibited by"
288-
"erratum i743 switch to LP_MODE_SELF_REFRESH(2)\n");
287+
"REG_LP_MODE = LP_MODE_PWR_DN(4) is prohibited by erratum i743 switch to LP_MODE_SELF_REFRESH(2)\n");
289288
/* rollback LP_MODE to Self-refresh mode */
290289
lpmode = EMIF_LP_MODE_SELF_REFRESH;
291290
}
@@ -714,7 +713,7 @@ static u32 get_ext_phy_ctrl_2_intelliphy_4d5(void)
714713
u32 fifo_we_slave_ratio;
715714

716715
fifo_we_slave_ratio = DIV_ROUND_CLOSEST(
717-
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
716+
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
718717

719718
return fifo_we_slave_ratio | fifo_we_slave_ratio << 11 |
720719
fifo_we_slave_ratio << 22;
@@ -725,7 +724,7 @@ static u32 get_ext_phy_ctrl_3_intelliphy_4d5(void)
725724
u32 fifo_we_slave_ratio;
726725

727726
fifo_we_slave_ratio = DIV_ROUND_CLOSEST(
728-
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
727+
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
729728

730729
return fifo_we_slave_ratio >> 10 | fifo_we_slave_ratio << 1 |
731730
fifo_we_slave_ratio << 12 | fifo_we_slave_ratio << 23;
@@ -736,7 +735,7 @@ static u32 get_ext_phy_ctrl_4_intelliphy_4d5(void)
736735
u32 fifo_we_slave_ratio;
737736

738737
fifo_we_slave_ratio = DIV_ROUND_CLOSEST(
739-
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256 , t_ck);
738+
EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS * 256, t_ck);
740739

741740
return fifo_we_slave_ratio >> 9 | fifo_we_slave_ratio << 2 |
742741
fifo_we_slave_ratio << 13;
@@ -975,8 +974,7 @@ static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif)
975974
EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART)) {
976975
if (emif->temperature_level >= SDRAM_TEMP_HIGH_DERATE_REFRESH) {
977976
dev_err(emif->dev,
978-
"%s:NOT Extended temperature capable memory."
979-
"Converting MR4=0x%02x as shutdown event\n",
977+
"%s:NOT Extended temperature capable memory. Converting MR4=0x%02x as shutdown event\n",
980978
__func__, emif->temperature_level);
981979
/*
982980
* Temperature far too high - do kernel_power_off()
@@ -1318,9 +1316,9 @@ static void __init_or_module of_get_ddr_info(struct device_node *np_emif,
13181316
if (of_find_property(np_emif, "cal-resistor-per-cs", &len))
13191317
dev_info->cal_resistors_per_cs = true;
13201318

1321-
if (of_device_is_compatible(np_ddr , "jedec,lpddr2-s4"))
1319+
if (of_device_is_compatible(np_ddr, "jedec,lpddr2-s4"))
13221320
dev_info->type = DDR_TYPE_LPDDR2_S4;
1323-
else if (of_device_is_compatible(np_ddr , "jedec,lpddr2-s2"))
1321+
else if (of_device_is_compatible(np_ddr, "jedec,lpddr2-s2"))
13241322
dev_info->type = DDR_TYPE_LPDDR2_S2;
13251323

13261324
of_property_read_u32(np_ddr, "density", &density);
@@ -1563,11 +1561,8 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
15631561
goto error;
15641562

15651563
irq = platform_get_irq(pdev, 0);
1566-
if (irq < 0) {
1567-
dev_err(emif->dev, "%s: error getting IRQ resource - %d\n",
1568-
__func__, irq);
1564+
if (irq < 0)
15691565
goto error;
1570-
}
15711566

15721567
emif_onetime_settings(emif);
15731568
emif_debugfs_init(emif);

drivers/memory/fsl_ifc.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ int fsl_ifc_find(phys_addr_t addr_base)
5353

5454
for (i = 0; i < fsl_ifc_ctrl_dev->banks; i++) {
5555
u32 cspr = ifc_in32(&fsl_ifc_ctrl_dev->gregs->cspr_cs[i].cspr);
56+
5657
if (cspr & CSPR_V && (cspr & CSPR_BA) ==
5758
convert_ifc_address(addr_base))
5859
return i;
@@ -153,8 +154,8 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
153154
/* read for chip select error */
154155
cs_err = ifc_in32(&ifc->cm_evter_stat);
155156
if (cs_err) {
156-
dev_err(ctrl->dev, "transaction sent to IFC is not mapped to"
157-
"any memory bank 0x%08X\n", cs_err);
157+
dev_err(ctrl->dev, "transaction sent to IFC is not mapped to any memory bank 0x%08X\n",
158+
cs_err);
158159
/* clear the chip select error */
159160
ifc_out32(IFC_CM_EVTER_STAT_CSER, &ifc->cm_evter_stat);
160161

@@ -163,24 +164,24 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
163164
err_addr = ifc_in32(&ifc->cm_erattr1);
164165

165166
if (status & IFC_CM_ERATTR0_ERTYP_READ)
166-
dev_err(ctrl->dev, "Read transaction error"
167-
"CM_ERATTR0 0x%08X\n", status);
167+
dev_err(ctrl->dev, "Read transaction error CM_ERATTR0 0x%08X\n",
168+
status);
168169
else
169-
dev_err(ctrl->dev, "Write transaction error"
170-
"CM_ERATTR0 0x%08X\n", status);
170+
dev_err(ctrl->dev, "Write transaction error CM_ERATTR0 0x%08X\n",
171+
status);
171172

172173
err_axiid = (status & IFC_CM_ERATTR0_ERAID) >>
173174
IFC_CM_ERATTR0_ERAID_SHIFT;
174-
dev_err(ctrl->dev, "AXI ID of the error"
175-
"transaction 0x%08X\n", err_axiid);
175+
dev_err(ctrl->dev, "AXI ID of the error transaction 0x%08X\n",
176+
err_axiid);
176177

177178
err_srcid = (status & IFC_CM_ERATTR0_ESRCID) >>
178179
IFC_CM_ERATTR0_ESRCID_SHIFT;
179-
dev_err(ctrl->dev, "SRC ID of the error"
180-
"transaction 0x%08X\n", err_srcid);
180+
dev_err(ctrl->dev, "SRC ID of the error transaction 0x%08X\n",
181+
err_srcid);
181182

182-
dev_err(ctrl->dev, "Transaction Address corresponding to error"
183-
"ERADDR 0x%08X\n", err_addr);
183+
dev_err(ctrl->dev, "Transaction Address corresponding to error ERADDR 0x%08X\n",
184+
err_addr);
184185

185186
ret = IRQ_HANDLED;
186187
}
@@ -199,7 +200,7 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
199200
* the resources needed for the controller only. The
200201
* resources for the NAND banks themselves are allocated
201202
* in the chip probe function.
202-
*/
203+
*/
203204
static int fsl_ifc_ctrl_probe(struct platform_device *dev)
204205
{
205206
int ret = 0;
@@ -250,8 +251,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
250251
/* get the Controller level irq */
251252
fsl_ifc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
252253
if (fsl_ifc_ctrl_dev->irq == 0) {
253-
dev_err(&dev->dev, "failed to get irq resource "
254-
"for IFC\n");
254+
dev_err(&dev->dev, "failed to get irq resource for IFC\n");
255255
ret = -ENODEV;
256256
goto err;
257257
}

drivers/memory/mtk-smi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct mtk_smi_common_plat {
6060

6161
struct mtk_smi_larb_gen {
6262
int port_in_larb[MTK_LARB_NR_MAX + 1];
63-
void (*config_port)(struct device *);
63+
void (*config_port)(struct device *dev);
6464
unsigned int larb_direct_to_common_mask;
6565
bool has_gals;
6666
};

drivers/memory/of_memory.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
*
55
* Copyright (C) 2012 Texas Instruments, Inc.
66
* Copyright (C) 2019 Samsung Electronics Co., Ltd.
7+
* Copyright (C) 2020 Krzysztof Kozlowski <[email protected]>
78
*/
89

910
#include <linux/device.h>
10-
#include <linux/platform_device.h>
11-
#include <linux/list.h>
1211
#include <linux/of.h>
1312
#include <linux/gfp.h>
1413
#include <linux/export.h>
@@ -27,7 +26,7 @@
2726
* default min timings provided by JEDEC.
2827
*/
2928
const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
30-
struct device *dev)
29+
struct device *dev)
3130
{
3231
int ret = 0;
3332
struct lpddr2_min_tck *min;
@@ -56,13 +55,13 @@ const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
5655
return min;
5756

5857
default_min_tck:
59-
dev_warn(dev, "%s: using default min-tck values\n", __func__);
58+
dev_warn(dev, "Using default min-tck values\n");
6059
return &lpddr2_jedec_min_tck;
6160
}
6261
EXPORT_SYMBOL(of_get_min_tck);
6362

6463
static int of_do_get_timings(struct device_node *np,
65-
struct lpddr2_timings *tim)
64+
struct lpddr2_timings *tim)
6665
{
6766
int ret;
6867

@@ -84,7 +83,7 @@ static int of_do_get_timings(struct device_node *np,
8483
ret |= of_property_read_u32(np, "tZQinit", &tim->tZQinit);
8584
ret |= of_property_read_u32(np, "tRAS-max-ns", &tim->tRAS_max_ns);
8685
ret |= of_property_read_u32(np, "tDQSCK-max-derated",
87-
&tim->tDQSCK_max_derated);
86+
&tim->tDQSCK_max_derated);
8887

8988
return ret;
9089
}
@@ -103,7 +102,9 @@ static int of_do_get_timings(struct device_node *np,
103102
* while populating, returns default timings provided by JEDEC.
104103
*/
105104
const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
106-
struct device *dev, u32 device_type, u32 *nr_frequencies)
105+
struct device *dev,
106+
u32 device_type,
107+
u32 *nr_frequencies)
107108
{
108109
struct lpddr2_timings *timings = NULL;
109110
u32 arr_sz = 0, i = 0;
@@ -116,7 +117,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
116117
tim_compat = "jedec,lpddr2-timings";
117118
break;
118119
default:
119-
dev_warn(dev, "%s: un-supported memory type\n", __func__);
120+
dev_warn(dev, "Unsupported memory type\n");
120121
}
121122

122123
for_each_child_of_node(np_ddr, np_tim)
@@ -145,7 +146,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
145146
return timings;
146147

147148
default_timings:
148-
dev_warn(dev, "%s: using default timings\n", __func__);
149+
dev_warn(dev, "Using default memory timings\n");
149150
*nr_frequencies = ARRAY_SIZE(lpddr2_jedec_timings);
150151
return lpddr2_jedec_timings;
151152
}
@@ -193,16 +194,15 @@ const struct lpddr3_min_tck *of_lpddr3_get_min_tck(struct device_node *np,
193194
ret |= of_property_read_u32(np, "tMRD-min-tck", &min->tMRD);
194195

195196
if (ret) {
196-
dev_warn(dev, "%s: errors while parsing min-tck values\n",
197-
__func__);
197+
dev_warn(dev, "Errors while parsing min-tck values\n");
198198
devm_kfree(dev, min);
199199
goto default_min_tck;
200200
}
201201

202202
return min;
203203

204204
default_min_tck:
205-
dev_warn(dev, "%s: using default min-tck values\n", __func__);
205+
dev_warn(dev, "Using default min-tck values\n");
206206
return NULL;
207207
}
208208
EXPORT_SYMBOL(of_lpddr3_get_min_tck);
@@ -264,7 +264,7 @@ const struct lpddr3_timings
264264
tim_compat = "jedec,lpddr3-timings";
265265
break;
266266
default:
267-
dev_warn(dev, "%s: un-supported memory type\n", __func__);
267+
dev_warn(dev, "Unsupported memory type\n");
268268
}
269269

270270
for_each_child_of_node(np_ddr, np_tim)
@@ -293,7 +293,7 @@ const struct lpddr3_timings
293293
return timings;
294294

295295
default_timings:
296-
dev_warn(dev, "%s: failed to get timings\n", __func__);
296+
dev_warn(dev, "Failed to get timings\n");
297297
*nr_frequencies = 0;
298298
return NULL;
299299
}

drivers/memory/of_memory.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@
33
* OpenFirmware helpers for memory drivers
44
*
55
* Copyright (C) 2012 Texas Instruments, Inc.
6+
* Copyright (C) 2020 Krzysztof Kozlowski <[email protected]>
67
*/
78

89
#ifndef __LINUX_MEMORY_OF_REG_H
910
#define __LINUX_MEMORY_OF_REG_H
1011

1112
#if defined(CONFIG_OF) && defined(CONFIG_DDR)
12-
extern const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
13-
struct device *dev);
14-
extern const struct lpddr2_timings
15-
*of_get_ddr_timings(struct device_node *np_ddr, struct device *dev,
16-
u32 device_type, u32 *nr_frequencies);
17-
extern const struct lpddr3_min_tck
18-
*of_lpddr3_get_min_tck(struct device_node *np, struct device *dev);
19-
extern const struct lpddr3_timings
20-
*of_lpddr3_get_ddr_timings(struct device_node *np_ddr,
21-
struct device *dev, u32 device_type, u32 *nr_frequencies);
13+
const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
14+
struct device *dev);
15+
const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
16+
struct device *dev,
17+
u32 device_type, u32 *nr_frequencies);
18+
const struct lpddr3_min_tck *of_lpddr3_get_min_tck(struct device_node *np,
19+
struct device *dev);
20+
const struct lpddr3_timings *
21+
of_lpddr3_get_ddr_timings(struct device_node *np_ddr,
22+
struct device *dev, u32 device_type, u32 *nr_frequencies);
2223
#else
2324
static inline const struct lpddr2_min_tck
2425
*of_get_min_tck(struct device_node *np, struct device *dev)

0 commit comments

Comments
 (0)