Skip to content

Commit 57cf663

Browse files
committed
Merge tag 'memory-controller-drv-6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into soc/drivers
Memory controller drivers for v6.5 1. Renesas RPC IF: correct the Strobe Timing Adjustment. 2. Broadcom DPFE: fix smatch warning for testing array offset after use. 3. Atmel SDRAMC: drop driver because it was just a wrapper over enabling clock which is not handled by its clock controller. 4. Minor bindings cleanup. * tag 'memory-controller-drv-6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: dt-bindings: memory-controllers: drop unneeded quotes memory: atmel-sdramc: remove the driver memory: brcmstb_dpfe: fix testing array offset after use memory: renesas-rpc-if: Fix PHYCNT.STRTIM setting Link: https://lore.kernel.org/r/20230612175508.288775-1-krzysztof.kozlowski@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 2d0d3a1 + 6a66fb9 commit 57cf663

8 files changed

Lines changed: 44 additions & 107 deletions

File tree

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra20-emc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ patternProperties:
165165
const: 0
166166

167167
lpddr2:
168-
$ref: "ddr/jedec,lpddr2.yaml#"
168+
$ref: ddr/jedec,lpddr2.yaml#
169169
type: object
170170

171171
patternProperties:

Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ patternProperties:
129129
The child device node represents the device connected to the GPMC
130130
bus. The device can be a NAND chip, SRAM device, NOR device
131131
or an ASIC.
132-
$ref: "ti,gpmc-child.yaml"
132+
$ref: ti,gpmc-child.yaml
133133

134134

135135
required:

arch/arm/mach-at91/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ config SOC_AT91SAM9
9797
depends on ARCH_MULTI_V5
9898
select ATMEL_AIC_IRQ
9999
select ATMEL_PM if PM
100-
select ATMEL_SDRAMC
101100
select CPU_ARM926T
102101
select HAVE_AT91_SMD
103102
select HAVE_AT91_USB_CLK
@@ -131,7 +130,6 @@ config SOC_SAM9X60
131130
depends on ARCH_MULTI_V5
132131
select ATMEL_AIC5_IRQ
133132
select ATMEL_PM if PM
134-
select ATMEL_SDRAMC
135133
select CPU_ARM926T
136134
select HAVE_AT91_USB_CLK
137135
select HAVE_AT91_GENERATED_CLK
@@ -213,7 +211,6 @@ config SOC_SAMA5
213211
bool
214212
select ATMEL_AIC5_IRQ
215213
select ATMEL_PM if PM
216-
select ATMEL_SDRAMC
217214
select MEMORY
218215
select SOC_SAM_V7
219216
select SRAM if PM
@@ -234,7 +231,6 @@ config SOC_SAMA7
234231
bool
235232
select ARM_GIC
236233
select ATMEL_PM if PM
237-
select ATMEL_SDRAMC
238234
select MEMORY
239235
select SOC_SAM_V7
240236
select SRAM if PM

drivers/memory/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ config ARM_PL172_MPMC
3030
If you have an embedded system with an AMBA bus and a PL172
3131
controller, say Y or M here.
3232

33-
config ATMEL_SDRAMC
34-
bool "Atmel (Multi-port DDR-)SDRAM Controller"
35-
default y if ARCH_AT91
36-
depends on ARCH_AT91 || COMPILE_TEST
37-
depends on OF
38-
help
39-
This driver is for Atmel SDRAM Controller or Atmel Multi-port
40-
DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs.
41-
Starting with the at91sam9g45, this controller supports SDR, DDR and
42-
LP-DDR memories.
43-
4433
config ATMEL_EBI
4534
bool "Atmel EBI driver"
4635
default y if ARCH_AT91

drivers/memory/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ifeq ($(CONFIG_DDR),y)
88
obj-$(CONFIG_OF) += of_memory.o
99
endif
1010
obj-$(CONFIG_ARM_PL172_MPMC) += pl172.o
11-
obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o
1211
obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o
1312
obj-$(CONFIG_BRCMSTB_DPFE) += brcmstb_dpfe.o
1413
obj-$(CONFIG_BRCMSTB_MEMC) += brcmstb_memc.o

drivers/memory/atmel-sdramc.c

Lines changed: 0 additions & 74 deletions
This file was deleted.

drivers/memory/brcmstb_dpfe.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,17 @@ static void __finalize_command(struct brcmstb_dpfe_priv *priv)
434434
static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd,
435435
u32 result[])
436436
{
437-
const u32 *msg = priv->dpfe_api->command[cmd];
438437
void __iomem *regs = priv->regs;
439438
unsigned int i, chksum, chksum_idx;
439+
const u32 *msg;
440440
int ret = 0;
441441
u32 resp;
442442

443443
if (cmd >= DPFE_CMD_MAX)
444444
return -1;
445445

446+
msg = priv->dpfe_api->command[cmd];
447+
446448
mutex_lock(&priv->lock);
447449

448450
/* Wait for DCPU to become ready */

drivers/memory/renesas-rpc-if.c

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (C) 2019-2020 Cogent Embedded, Inc.
88
*/
99

10+
#include <linux/bitops.h>
1011
#include <linux/clk.h>
1112
#include <linux/io.h>
1213
#include <linux/module.h>
@@ -163,6 +164,11 @@ static const struct regmap_access_table rpcif_volatile_table = {
163164
.n_yes_ranges = ARRAY_SIZE(rpcif_volatile_ranges),
164165
};
165166

167+
struct rpcif_info {
168+
enum rpcif_type type;
169+
u8 strtim;
170+
};
171+
166172
struct rpcif_priv {
167173
struct device *dev;
168174
void __iomem *base;
@@ -171,7 +177,7 @@ struct rpcif_priv {
171177
struct reset_control *rstc;
172178
struct platform_device *vdev;
173179
size_t size;
174-
enum rpcif_type type;
180+
const struct rpcif_info *info;
175181
enum rpcif_data_dir dir;
176182
u8 bus_size;
177183
u8 xfer_size;
@@ -186,6 +192,26 @@ struct rpcif_priv {
186192
u32 ddr; /* DRDRENR or SMDRENR */
187193
};
188194

195+
static const struct rpcif_info rpcif_info_r8a7796 = {
196+
.type = RPCIF_RCAR_GEN3,
197+
.strtim = 6,
198+
};
199+
200+
static const struct rpcif_info rpcif_info_gen3 = {
201+
.type = RPCIF_RCAR_GEN3,
202+
.strtim = 7,
203+
};
204+
205+
static const struct rpcif_info rpcif_info_rz_g2l = {
206+
.type = RPCIF_RZ_G2L,
207+
.strtim = 7,
208+
};
209+
210+
static const struct rpcif_info rpcif_info_gen4 = {
211+
.type = RPCIF_RCAR_GEN4,
212+
.strtim = 15,
213+
};
214+
189215
/*
190216
* Custom accessor functions to ensure SM[RW]DR[01] are always accessed with
191217
* proper width. Requires rpcif_priv.xfer_size to be correctly set before!
@@ -310,7 +336,7 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
310336
if (ret)
311337
return ret;
312338

313-
if (rpc->type == RPCIF_RZ_G2L) {
339+
if (rpc->info->type == RPCIF_RZ_G2L) {
314340
ret = reset_control_reset(rpc->rstc);
315341
if (ret)
316342
return ret;
@@ -324,12 +350,10 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
324350
/* DMA Transfer is not supported */
325351
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_HS, 0);
326352

327-
if (rpc->type == RPCIF_RCAR_GEN3)
328-
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
329-
RPCIF_PHYCNT_STRTIM(7), RPCIF_PHYCNT_STRTIM(7));
330-
else if (rpc->type == RPCIF_RCAR_GEN4)
331-
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
332-
RPCIF_PHYCNT_STRTIM(15), RPCIF_PHYCNT_STRTIM(15));
353+
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
354+
/* create mask with all affected bits set */
355+
RPCIF_PHYCNT_STRTIM(BIT(fls(rpc->info->strtim)) - 1),
356+
RPCIF_PHYCNT_STRTIM(rpc->info->strtim));
333357

334358
regmap_update_bits(rpc->regmap, RPCIF_PHYOFFSET1, RPCIF_PHYOFFSET1_DDRTMG(3),
335359
RPCIF_PHYOFFSET1_DDRTMG(3));
@@ -340,7 +364,7 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
340364
regmap_update_bits(rpc->regmap, RPCIF_PHYINT,
341365
RPCIF_PHYINT_WPVAL, 0);
342366

343-
if (rpc->type == RPCIF_RZ_G2L)
367+
if (rpc->info->type == RPCIF_RZ_G2L)
344368
regmap_update_bits(rpc->regmap, RPCIF_CMNCR,
345369
RPCIF_CMNCR_MOIIO(3) | RPCIF_CMNCR_IOFV(3) |
346370
RPCIF_CMNCR_BSZ(3),
@@ -729,9 +753,9 @@ static int rpcif_probe(struct platform_device *pdev)
729753
rpc->dirmap = devm_ioremap_resource(dev, res);
730754
if (IS_ERR(rpc->dirmap))
731755
return PTR_ERR(rpc->dirmap);
732-
rpc->size = resource_size(res);
733756

734-
rpc->type = (uintptr_t)of_device_get_match_data(dev);
757+
rpc->size = resource_size(res);
758+
rpc->info = of_device_get_match_data(dev);
735759
rpc->rstc = devm_reset_control_get_exclusive(dev, NULL);
736760
if (IS_ERR(rpc->rstc))
737761
return PTR_ERR(rpc->rstc);
@@ -764,9 +788,10 @@ static int rpcif_remove(struct platform_device *pdev)
764788
}
765789

766790
static const struct of_device_id rpcif_of_match[] = {
767-
{ .compatible = "renesas,rcar-gen3-rpc-if", .data = (void *)RPCIF_RCAR_GEN3 },
768-
{ .compatible = "renesas,rcar-gen4-rpc-if", .data = (void *)RPCIF_RCAR_GEN4 },
769-
{ .compatible = "renesas,rzg2l-rpc-if", .data = (void *)RPCIF_RZ_G2L },
791+
{ .compatible = "renesas,r8a7796-rpc-if", .data = &rpcif_info_r8a7796 },
792+
{ .compatible = "renesas,rcar-gen3-rpc-if", .data = &rpcif_info_gen3 },
793+
{ .compatible = "renesas,rcar-gen4-rpc-if", .data = &rpcif_info_gen4 },
794+
{ .compatible = "renesas,rzg2l-rpc-if", .data = &rpcif_info_rz_g2l },
770795
{},
771796
};
772797
MODULE_DEVICE_TABLE(of, rpcif_of_match);

0 commit comments

Comments
 (0)