Skip to content

Commit d7c6dbc

Browse files
committed
Merge tag 'memory-controller-drv-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/drivers
Memory controller drivers for v5.9, part 2 1. Minor cleanups and fixes of multiple memory controller drivers, mostly around code quality and readability, 2. Add Git repository to drivers/memory entry in MAINTAINERS, 3. Allow MIPS jz4780 FUSE driver to probe by removing conflicting memory region with jz4780_nemc. * tag 'memory-controller-drv-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: memory: jz4780_nemc: Only request IO memory the driver will use MAINTAINERS: Add Git repository for memory controller drivers memory: brcmstb_dpfe: Fix language typo memory: samsung: exynos5422-dmc: Correct white space issues memory: samsung: exynos-srom: Correct alignment memory: pl172: Enclose macro argument usage in parenthesis memory: of: Correct kerneldoc memory: omap-gpmc: Fix language typo memory: omap-gpmc: Correct white space issues memory: omap-gpmc: Use 'unsigned int' for consistency memory: omap-gpmc: Enclose macro argument usage in parenthesis memory: omap-gpmc: Correct kerneldoc memory: mvebu-devbus: Align with open parenthesis memory: mvebu-devbus: Add missing braces to all arms of if statement memory: bt1-l2-ctl: Add blank lines after declarations Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 9c52a26 + f046e4a commit d7c6dbc

File tree

10 files changed

+75
-68
lines changed

10 files changed

+75
-68
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11089,6 +11089,7 @@ MEMORY CONTROLLER DRIVERS
1108911089
M: Krzysztof Kozlowski <[email protected]>
1109011090
1109111091
S: Maintained
11092+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl.git
1109211093
F: Documentation/devicetree/bindings/memory-controllers/
1109311094
F: drivers/memory/
1109411095

drivers/memory/brcmstb_dpfe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* - BE kernel + LE firmware image
2424
* - BE kernel + BE firmware image
2525
*
26-
* The DPCU always runs in big endian mode. The firwmare image, however, can
26+
* The DPCU always runs in big endian mode. The firmware image, however, can
2727
* be in either format. Also, communication between host CPU and DCPU is
2828
* always in little endian.
2929
*/

drivers/memory/bt1-l2-ctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct l2_ctl_device_attribute {
6666
struct device_attribute dev_attr;
6767
enum l2_ctl_stall id;
6868
};
69+
6970
#define to_l2_ctl_dev_attr(_dev_attr) \
7071
container_of(_dev_attr, struct l2_ctl_device_attribute, dev_attr)
7172

@@ -242,6 +243,7 @@ static ssize_t l2_ctl_latency_store(struct device *dev,
242243

243244
return count;
244245
}
246+
245247
static L2_CTL_ATTR_RW(l2_ws_latency, l2_ctl_latency, L2_WS_STALL);
246248
static L2_CTL_ATTR_RW(l2_tag_latency, l2_ctl_latency, L2_TAG_STALL);
247249
static L2_CTL_ATTR_RW(l2_data_latency, l2_ctl_latency, L2_DATA_STALL);

drivers/memory/jz4780-nemc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/clk.h>
1010
#include <linux/init.h>
11+
#include <linux/io.h>
1112
#include <linux/math64.h>
1213
#include <linux/of.h>
1314
#include <linux/of_address.h>
@@ -22,6 +23,8 @@
2223
#define NEMC_SMCRn(n) (0x14 + (((n) - 1) * 4))
2324
#define NEMC_NFCSR 0x50
2425

26+
#define NEMC_REG_LEN 0x54
27+
2528
#define NEMC_SMCR_SMT BIT(0)
2629
#define NEMC_SMCR_BW_SHIFT 6
2730
#define NEMC_SMCR_BW_MASK (0x3 << NEMC_SMCR_BW_SHIFT)
@@ -288,7 +291,19 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
288291
nemc->dev = dev;
289292

290293
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
291-
nemc->base = devm_ioremap_resource(dev, res);
294+
295+
/*
296+
* The driver currently only uses the registers up to offset
297+
* NEMC_REG_LEN. Since the EFUSE registers are in the middle of the
298+
* NEMC registers, we only request the registers we will use for now;
299+
* that way the EFUSE driver can probe too.
300+
*/
301+
if (!devm_request_mem_region(dev, res->start, NEMC_REG_LEN, dev_name(dev))) {
302+
dev_err(dev, "unable to request I/O memory region\n");
303+
return -EBUSY;
304+
}
305+
306+
nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN);
292307
if (IS_ERR(nemc->base)) {
293308
dev_err(dev, "failed to get I/O memory\n");
294309
return PTR_ERR(nemc->base);

drivers/memory/mvebu-devbus.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,32 +124,32 @@ static int devbus_get_timing_params(struct devbus *devbus,
124124
* The bus width is encoded into the register as 0 for 8 bits,
125125
* and 1 for 16 bits, so we do the necessary conversion here.
126126
*/
127-
if (r->bus_width == 8)
127+
if (r->bus_width == 8) {
128128
r->bus_width = 0;
129-
else if (r->bus_width == 16)
129+
} else if (r->bus_width == 16) {
130130
r->bus_width = 1;
131-
else {
131+
} else {
132132
dev_err(devbus->dev, "invalid bus width %d\n", r->bus_width);
133133
return -EINVAL;
134134
}
135135

136136
err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps",
137-
&r->badr_skew);
137+
&r->badr_skew);
138138
if (err < 0)
139139
return err;
140140

141141
err = get_timing_param_ps(devbus, node, "devbus,turn-off-ps",
142-
&r->turn_off);
142+
&r->turn_off);
143143
if (err < 0)
144144
return err;
145145

146146
err = get_timing_param_ps(devbus, node, "devbus,acc-first-ps",
147-
&r->acc_first);
147+
&r->acc_first);
148148
if (err < 0)
149149
return err;
150150

151151
err = get_timing_param_ps(devbus, node, "devbus,acc-next-ps",
152-
&r->acc_next);
152+
&r->acc_next);
153153
if (err < 0)
154154
return err;
155155

@@ -175,17 +175,17 @@ static int devbus_get_timing_params(struct devbus *devbus,
175175
}
176176

177177
err = get_timing_param_ps(devbus, node, "devbus,ale-wr-ps",
178-
&w->ale_wr);
178+
&w->ale_wr);
179179
if (err < 0)
180180
return err;
181181

182182
err = get_timing_param_ps(devbus, node, "devbus,wr-low-ps",
183-
&w->wr_low);
183+
&w->wr_low);
184184
if (err < 0)
185185
return err;
186186

187187
err = get_timing_param_ps(devbus, node, "devbus,wr-high-ps",
188-
&w->wr_high);
188+
&w->wr_high);
189189
if (err < 0)
190190
return err;
191191

drivers/memory/of_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* of_get_min_tck() - extract min timing values for ddr
2020
* @np: pointer to ddr device tree node
21-
* @device: device requesting for min timing values
21+
* @dev: device requesting for min timing values
2222
*
2323
* Populates the lpddr2_min_tck structure by extracting data
2424
* from device tree node. Returns a pointer to the populated
@@ -155,7 +155,7 @@ EXPORT_SYMBOL(of_get_ddr_timings);
155155
/**
156156
* of_lpddr3_get_min_tck() - extract min timing values for lpddr3
157157
* @np: pointer to ddr device tree node
158-
* @device: device requesting for min timing values
158+
* @dev: device requesting for min timing values
159159
*
160160
* Populates the lpddr3_min_tck structure by extracting data
161161
* from device tree node. Returns a pointer to the populated

drivers/memory/omap-gpmc.c

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
#define ENABLE_PREFETCH (0x1 << 7)
110110
#define DMA_MPU_MODE 2
111111

112-
#define GPMC_REVISION_MAJOR(l) ((l >> 4) & 0xf)
113-
#define GPMC_REVISION_MINOR(l) (l & 0xf)
112+
#define GPMC_REVISION_MAJOR(l) (((l) >> 4) & 0xf)
113+
#define GPMC_REVISION_MINOR(l) ((l) & 0xf)
114114

115115
#define GPMC_HAS_WR_ACCESS 0x1
116116
#define GPMC_HAS_WR_DATA_MUX_BUS 0x2
@@ -141,27 +141,27 @@
141141
#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28)
142142
#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
143143
#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
144-
#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
144+
#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) (((val) & 3) << 25)
145145
/** CLKACTIVATIONTIME Max Ticks */
146146
#define GPMC_CONFIG1_CLKACTIVATIONTIME_MAX 2
147-
#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
147+
#define GPMC_CONFIG1_PAGE_LEN(val) (((val) & 3) << 23)
148148
/** ATTACHEDDEVICEPAGELENGTH Max Value */
149149
#define GPMC_CONFIG1_ATTACHEDDEVICEPAGELENGTH_MAX 2
150150
#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
151151
#define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21)
152-
#define GPMC_CONFIG1_WAIT_MON_TIME(val) ((val & 3) << 18)
152+
#define GPMC_CONFIG1_WAIT_MON_TIME(val) (((val) & 3) << 18)
153153
/** WAITMONITORINGTIME Max Ticks */
154154
#define GPMC_CONFIG1_WAITMONITORINGTIME_MAX 2
155-
#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
156-
#define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12)
155+
#define GPMC_CONFIG1_WAIT_PIN_SEL(val) (((val) & 3) << 16)
156+
#define GPMC_CONFIG1_DEVICESIZE(val) (((val) & 3) << 12)
157157
#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
158158
/** DEVICESIZE Max Value */
159159
#define GPMC_CONFIG1_DEVICESIZE_MAX 1
160-
#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
160+
#define GPMC_CONFIG1_DEVICETYPE(val) (((val) & 3) << 10)
161161
#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
162-
#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8)
162+
#define GPMC_CONFIG1_MUXTYPE(val) (((val) & 3) << 8)
163163
#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
164-
#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
164+
#define GPMC_CONFIG1_FCLK_DIV(val) ((val) & 3)
165165
#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
166166
#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
167167
#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
@@ -246,7 +246,7 @@ static DEFINE_SPINLOCK(gpmc_mem_lock);
246246
static unsigned int gpmc_cs_num = GPMC_CS_NUM;
247247
static unsigned int gpmc_nr_waitpins;
248248
static resource_size_t phys_base, mem_size;
249-
static unsigned gpmc_capability;
249+
static unsigned int gpmc_capability;
250250
static void __iomem *gpmc_base;
251251

252252
static struct clk *gpmc_l3_clk;
@@ -292,15 +292,14 @@ static unsigned long gpmc_get_fclk_period(void)
292292

293293
/**
294294
* gpmc_get_clk_period - get period of selected clock domain in ps
295-
* @cs Chip Select Region.
296-
* @cd Clock Domain.
295+
* @cs: Chip Select Region.
296+
* @cd: Clock Domain.
297297
*
298298
* GPMC_CS_CONFIG1 GPMCFCLKDIVIDER for cs has to be setup
299299
* prior to calling this function with GPMC_CD_CLK.
300300
*/
301301
static unsigned long gpmc_get_clk_period(int cs, enum gpmc_clk_domain cd)
302302
{
303-
304303
unsigned long tick_ps = gpmc_get_fclk_period();
305304
u32 l;
306305
int div;
@@ -320,7 +319,6 @@ static unsigned long gpmc_get_clk_period(int cs, enum gpmc_clk_domain cd)
320319
}
321320

322321
return tick_ps;
323-
324322
}
325323

326324
static unsigned int gpmc_ns_to_clk_ticks(unsigned int time_ns, int cs,
@@ -412,7 +410,7 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
412410
* @reg: GPMC_CS_CONFIGn register offset.
413411
* @st_bit: Start Bit
414412
* @end_bit: End Bit. Must be >= @st_bit.
415-
* @ma:x Maximum parameter value (before optional @shift).
413+
* @max: Maximum parameter value (before optional @shift).
416414
* If 0, maximum is as high as @st_bit and @end_bit allow.
417415
* @name: DTS node name, w/o "gpmc,"
418416
* @cd: Clock Domain of timing parameter.
@@ -512,7 +510,7 @@ static void gpmc_cs_show_timings(int cs, const char *desc)
512510
GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 4, 4, "time-para-granularity");
513511
GPMC_GET_RAW(GPMC_CS_CONFIG1, 8, 9, "mux-add-data");
514512
GPMC_GET_RAW_SHIFT_MAX(GPMC_CS_CONFIG1, 12, 13, 1,
515-
GPMC_CONFIG1_DEVICESIZE_MAX, "device-width");
513+
GPMC_CONFIG1_DEVICESIZE_MAX, "device-width");
516514
GPMC_GET_RAW(GPMC_CS_CONFIG1, 16, 17, "wait-pin");
517515
GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 21, 21, "wait-on-write");
518516
GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 22, 22, "wait-on-read");
@@ -626,9 +624,8 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max
626624

627625
l = gpmc_cs_read_reg(cs, reg);
628626
#ifdef CONFIG_OMAP_GPMC_DEBUG
629-
pr_info(
630-
"GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
631-
cs, name, ticks, gpmc_get_clk_period(cs, cd) * ticks / 1000,
627+
pr_info("GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
628+
cs, name, ticks, gpmc_get_clk_period(cs, cd) * ticks / 1000,
632629
(l >> st_bit) & mask, time);
633630
#endif
634631
l &= ~(mask << st_bit);
@@ -663,7 +660,6 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max
663660
*/
664661
static int gpmc_calc_waitmonitoring_divider(unsigned int wait_monitoring)
665662
{
666-
667663
int div = gpmc_ns_to_ticks(wait_monitoring);
668664

669665
div += GPMC_CONFIG1_WAITMONITORINGTIME_MAX - 1;
@@ -675,7 +671,6 @@ static int gpmc_calc_waitmonitoring_divider(unsigned int wait_monitoring)
675671
div = 1;
676672

677673
return div;
678-
679674
}
680675

681676
/**
@@ -729,7 +724,6 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
729724
if (!s->sync_read && !s->sync_write &&
730725
(s->wait_on_read || s->wait_on_write)
731726
) {
732-
733727
div = gpmc_calc_waitmonitoring_divider(t->wait_monitoring);
734728
if (div < 0) {
735729
pr_err("%s: waitmonitoringtime %3d ns too large for greatest gpmcfclkdivider.\n",
@@ -1088,7 +1082,7 @@ static struct gpmc_nand_ops nand_ops = {
10881082

10891083
/**
10901084
* gpmc_omap_get_nand_ops - Get the GPMC NAND interface
1091-
* @regs: the GPMC NAND register map exclusive for NAND use.
1085+
* @reg: the GPMC NAND register map exclusive for NAND use.
10921086
* @cs: GPMC chip select number on which the NAND sits. The
10931087
* register map returned will be specific to this chip select.
10941088
*
@@ -1243,7 +1237,7 @@ int gpmc_omap_onenand_set_timings(struct device *dev, int cs, int freq,
12431237
}
12441238
EXPORT_SYMBOL_GPL(gpmc_omap_onenand_set_timings);
12451239

1246-
int gpmc_get_client_irq(unsigned irq_config)
1240+
int gpmc_get_client_irq(unsigned int irq_config)
12471241
{
12481242
if (!gpmc_irq_domain) {
12491243
pr_warn("%s called before GPMC IRQ domain available\n",
@@ -1466,7 +1460,6 @@ static void gpmc_mem_exit(void)
14661460
continue;
14671461
gpmc_cs_delete_mem(cs);
14681462
}
1469-
14701463
}
14711464

14721465
static void gpmc_mem_init(void)
@@ -1635,17 +1628,14 @@ static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t,
16351628
/* oe_on */
16361629
temp = dev_t->t_oeasu;
16371630
if (mux)
1638-
temp = max_t(u32, temp,
1639-
gpmc_t->adv_rd_off + dev_t->t_aavdh);
1631+
temp = max_t(u32, temp, gpmc_t->adv_rd_off + dev_t->t_aavdh);
16401632
gpmc_t->oe_on = gpmc_round_ps_to_ticks(temp);
16411633

16421634
/* access */
16431635
temp = max_t(u32, dev_t->t_iaa, /* XXX: remove t_iaa in async ? */
1644-
gpmc_t->oe_on + dev_t->t_oe);
1645-
temp = max_t(u32, temp,
1646-
gpmc_t->cs_on + dev_t->t_ce);
1647-
temp = max_t(u32, temp,
1648-
gpmc_t->adv_on + dev_t->t_aa);
1636+
gpmc_t->oe_on + dev_t->t_oe);
1637+
temp = max_t(u32, temp, gpmc_t->cs_on + dev_t->t_ce);
1638+
temp = max_t(u32, temp, gpmc_t->adv_on + dev_t->t_aa);
16491639
gpmc_t->access = gpmc_round_ps_to_ticks(temp);
16501640

16511641
gpmc_t->oe_off = gpmc_t->access + gpmc_ticks_to_ps(1);
@@ -2091,7 +2081,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
20912081
gpmc_cs_disable_mem(cs);
20922082

20932083
/*
2094-
* FIXME: gpmc_cs_request() will map the CS to an arbitary
2084+
* FIXME: gpmc_cs_request() will map the CS to an arbitrary
20952085
* location in the gpmc address space. When booting with
20962086
* device-tree we want the NOR flash to be mapped to the
20972087
* location specified in the device-tree blob. So remap the

drivers/memory/pl172.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <linux/of_platform.h>
2222
#include <linux/time.h>
2323

24-
#define MPMC_STATIC_CFG(n) (0x200 + 0x20 * n)
24+
#define MPMC_STATIC_CFG(n) (0x200 + 0x20 * (n))
2525
#define MPMC_STATIC_CFG_MW_8BIT 0x0
2626
#define MPMC_STATIC_CFG_MW_16BIT 0x1
2727
#define MPMC_STATIC_CFG_MW_32BIT 0x2
@@ -31,17 +31,17 @@
3131
#define MPMC_STATIC_CFG_EW BIT(8)
3232
#define MPMC_STATIC_CFG_B BIT(19)
3333
#define MPMC_STATIC_CFG_P BIT(20)
34-
#define MPMC_STATIC_WAIT_WEN(n) (0x204 + 0x20 * n)
34+
#define MPMC_STATIC_WAIT_WEN(n) (0x204 + 0x20 * (n))
3535
#define MPMC_STATIC_WAIT_WEN_MAX 0x0f
36-
#define MPMC_STATIC_WAIT_OEN(n) (0x208 + 0x20 * n)
36+
#define MPMC_STATIC_WAIT_OEN(n) (0x208 + 0x20 * (n))
3737
#define MPMC_STATIC_WAIT_OEN_MAX 0x0f
38-
#define MPMC_STATIC_WAIT_RD(n) (0x20c + 0x20 * n)
38+
#define MPMC_STATIC_WAIT_RD(n) (0x20c + 0x20 * (n))
3939
#define MPMC_STATIC_WAIT_RD_MAX 0x1f
40-
#define MPMC_STATIC_WAIT_PAGE(n) (0x210 + 0x20 * n)
40+
#define MPMC_STATIC_WAIT_PAGE(n) (0x210 + 0x20 * (n))
4141
#define MPMC_STATIC_WAIT_PAGE_MAX 0x1f
42-
#define MPMC_STATIC_WAIT_WR(n) (0x214 + 0x20 * n)
42+
#define MPMC_STATIC_WAIT_WR(n) (0x214 + 0x20 * (n))
4343
#define MPMC_STATIC_WAIT_WR_MAX 0x1f
44-
#define MPMC_STATIC_WAIT_TURN(n) (0x218 + 0x20 * n)
44+
#define MPMC_STATIC_WAIT_TURN(n) (0x218 + 0x20 * (n))
4545
#define MPMC_STATIC_WAIT_TURN_MAX 0x0f
4646

4747
/* Maximum number of static chip selects */

0 commit comments

Comments
 (0)