Skip to content

Commit 78f7d98

Browse files
committed
Merge branch 'baikal/drivers' into arm/drivers
These are mainly fixups for comments that collided with me already merging v3 of the series, and one patch that I had forgotten to pick up. * baikal/drivers: bus: bt1-axi: Build the driver into the kernel bus: bt1-apb: Build the driver into the kernel bus: bt1-axi: Use sysfs_streq instead of strncmp bus: bt1-axi: Optimize the return points in the driver bus: bt1-apb: Use sysfs_streq instead of strncmp bus: bt1-apb: Use PTR_ERR_OR_ZERO to return from request-regs method bus: bt1-apb: Fix show/store callback identations bus: bt1-apb: Include linux/io.h dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 0d58327 + 22e795b commit 78f7d98

File tree

4 files changed

+82
-26
lines changed

4 files changed

+82
-26
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/memory-controllers/baikal,bt1-l2-ctl.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Baikal-T1 L2-cache Control Block
9+
10+
maintainers:
11+
- Serge Semin <[email protected]>
12+
13+
description: |
14+
By means of the System Controller Baikal-T1 SoC exposes a few settings to
15+
tune the MIPS P5600 CM2 L2 cache performance up. In particular it's possible
16+
to change the Tag, Data and Way-select RAM access latencies. Baikal-T1
17+
L2-cache controller block is responsible for the tuning. Its DT node is
18+
supposed to be a child of the system controller.
19+
20+
properties:
21+
compatible:
22+
const: baikal,bt1-l2-ctl
23+
24+
reg:
25+
maxItems: 1
26+
27+
baikal,l2-ws-latency:
28+
$ref: /schemas/types.yaml#/definitions/uint32
29+
description: Cycles of latency for Way-select RAM accesses
30+
default: 0
31+
minimum: 0
32+
maximum: 3
33+
34+
baikal,l2-tag-latency:
35+
$ref: /schemas/types.yaml#/definitions/uint32
36+
description: Cycles of latency for Tag RAM accesses
37+
default: 0
38+
minimum: 0
39+
maximum: 3
40+
41+
baikal,l2-data-latency:
42+
$ref: /schemas/types.yaml#/definitions/uint32
43+
description: Cycles of latency for Data RAM accesses
44+
default: 1
45+
minimum: 0
46+
maximum: 3
47+
48+
additionalProperties: false
49+
50+
required:
51+
- compatible
52+
53+
examples:
54+
- |
55+
l2@1f04d028 {
56+
compatible = "baikal,bt1-l2-ctl";
57+
reg = <0x1f04d028 0x004>;
58+
59+
baikal,l2-ws-latency = <1>;
60+
baikal,l2-tag-latency = <1>;
61+
baikal,l2-data-latency = <2>;
62+
};
63+
...

drivers/bus/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ config BRCMSTB_GISB_ARB
3030
and internal bus master decoding.
3131

3232
config BT1_APB
33-
tristate "Baikal-T1 APB-bus driver"
33+
bool "Baikal-T1 APB-bus driver"
3434
depends on MIPS_BAIKAL_T1 || COMPILE_TEST
3535
select REGMAP_MMIO
3636
help
@@ -45,7 +45,7 @@ config BT1_APB
4545
accessed via corresponding sysfs nodes.
4646

4747
config BT1_AXI
48-
tristate "Baikal-T1 AXI-bus driver"
48+
bool "Baikal-T1 AXI-bus driver"
4949
depends on MIPS_BAIKAL_T1 || COMPILE_TEST
5050
select MFD_SYSCON
5151
help

drivers/bus/bt1-apb.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/atomic.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/interrupt.h>
18+
#include <linux/io.h>
1819
#include <linux/nmi.h>
1920
#include <linux/of.h>
2021
#include <linux/regmap.h>
@@ -163,12 +164,10 @@ static int bt1_apb_request_regs(struct bt1_apb *apb)
163164
}
164165

165166
apb->res = devm_platform_ioremap_resource_byname(pdev, "nodev");
166-
if (IS_ERR(apb->res)) {
167+
if (IS_ERR(apb->res))
167168
dev_err(apb->dev, "Couldn't map reserved region\n");
168-
return PTR_ERR(apb->res);
169-
}
170169

171-
return 0;
170+
return PTR_ERR_OR_ZERO(apb->res);
172171
}
173172

174173
static int bt1_apb_request_rst(struct bt1_apb *apb)
@@ -310,25 +309,25 @@ static ssize_t timeout_store(struct device *dev,
310309
}
311310
static DEVICE_ATTR_RW(timeout);
312311

313-
static ssize_t inject_error_show(struct device *dev, struct device_attribute *attr,
314-
char *buf)
312+
static ssize_t inject_error_show(struct device *dev,
313+
struct device_attribute *attr, char *buf)
315314
{
316315
return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
317316
}
318317

319318
static ssize_t inject_error_store(struct device *dev,
320-
struct device_attribute *attr,
321-
const char *data, size_t count)
319+
struct device_attribute *attr,
320+
const char *data, size_t count)
322321
{
323322
struct bt1_apb *apb = dev_get_drvdata(dev);
324323

325324
/*
326325
* Either dummy read from the unmapped address in the APB IO area
327326
* or manually set the IRQ status.
328327
*/
329-
if (!strncmp(data, "nodev", 5))
328+
if (sysfs_streq(data, "nodev"))
330329
readl(apb->res);
331-
else if (!strncmp(data, "irq", 3))
330+
else if (sysfs_streq(data, "irq"))
332331
regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING,
333332
APB_EHB_ISR_PENDING);
334333
else

drivers/bus/bt1-axi.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ static int bt1_axi_request_regs(struct bt1_axi *axi)
124124
}
125125

126126
axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos");
127-
if (IS_ERR(axi->qos_regs)) {
127+
if (IS_ERR(axi->qos_regs))
128128
dev_err(dev, "Couldn't map AXI-bus QoS registers\n");
129-
return PTR_ERR(axi->qos_regs);
130-
}
131129

132-
return 0;
130+
return PTR_ERR_OR_ZERO(axi->qos_regs);
133131
}
134132

135133
static int bt1_axi_request_rst(struct bt1_axi *axi)
@@ -173,12 +171,10 @@ static int bt1_axi_request_clk(struct bt1_axi *axi)
173171
}
174172

175173
ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi);
176-
if (ret) {
174+
if (ret)
177175
dev_err(axi->dev, "Can't add AXI clock disable action\n");
178-
return ret;
179-
}
180176

181-
return 0;
177+
return ret;
182178
}
183179

184180
static int bt1_axi_request_irq(struct bt1_axi *axi)
@@ -192,12 +188,10 @@ static int bt1_axi_request_irq(struct bt1_axi *axi)
192188

193189
ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED,
194190
"bt1-axi", axi);
195-
if (ret) {
191+
if (ret)
196192
dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n");
197-
return ret;
198-
}
199193

200-
return 0;
194+
return ret;
201195
}
202196

203197
static ssize_t count_show(struct device *dev,
@@ -226,9 +220,9 @@ static ssize_t inject_error_store(struct device *dev,
226220
* error while unaligned writing - the AXI bus write error handled
227221
* by this driver.
228222
*/
229-
if (!strncmp(data, "bus", 3))
223+
if (sysfs_streq(data, "bus"))
230224
readb(axi->qos_regs);
231-
else if (!strncmp(data, "unaligned", 9))
225+
else if (sysfs_streq(data, "unaligned"))
232226
writeb(0, axi->qos_regs);
233227
else
234228
return -EINVAL;

0 commit comments

Comments
 (0)