Commit 78f7d98b authored by Arnd Bergmann's avatar Arnd Bergmann

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: default avatarArnd Bergmann <arnd@arndb.de>
parents 0d583273 22e795b4
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
%YAML 1.2
---
$id: http://devicetree.org/schemas/memory-controllers/baikal,bt1-l2-ctl.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Baikal-T1 L2-cache Control Block
maintainers:
- Serge Semin <fancer.lancer@gmail.com>
description: |
By means of the System Controller Baikal-T1 SoC exposes a few settings to
tune the MIPS P5600 CM2 L2 cache performance up. In particular it's possible
to change the Tag, Data and Way-select RAM access latencies. Baikal-T1
L2-cache controller block is responsible for the tuning. Its DT node is
supposed to be a child of the system controller.
properties:
compatible:
const: baikal,bt1-l2-ctl
reg:
maxItems: 1
baikal,l2-ws-latency:
$ref: /schemas/types.yaml#/definitions/uint32
description: Cycles of latency for Way-select RAM accesses
default: 0
minimum: 0
maximum: 3
baikal,l2-tag-latency:
$ref: /schemas/types.yaml#/definitions/uint32
description: Cycles of latency for Tag RAM accesses
default: 0
minimum: 0
maximum: 3
baikal,l2-data-latency:
$ref: /schemas/types.yaml#/definitions/uint32
description: Cycles of latency for Data RAM accesses
default: 1
minimum: 0
maximum: 3
additionalProperties: false
required:
- compatible
examples:
- |
l2@1f04d028 {
compatible = "baikal,bt1-l2-ctl";
reg = <0x1f04d028 0x004>;
baikal,l2-ws-latency = <1>;
baikal,l2-tag-latency = <1>;
baikal,l2-data-latency = <2>;
};
...
...@@ -30,7 +30,7 @@ config BRCMSTB_GISB_ARB ...@@ -30,7 +30,7 @@ config BRCMSTB_GISB_ARB
and internal bus master decoding. and internal bus master decoding.
config BT1_APB config BT1_APB
tristate "Baikal-T1 APB-bus driver" bool "Baikal-T1 APB-bus driver"
depends on MIPS_BAIKAL_T1 || COMPILE_TEST depends on MIPS_BAIKAL_T1 || COMPILE_TEST
select REGMAP_MMIO select REGMAP_MMIO
help help
...@@ -45,7 +45,7 @@ config BT1_APB ...@@ -45,7 +45,7 @@ config BT1_APB
accessed via corresponding sysfs nodes. accessed via corresponding sysfs nodes.
config BT1_AXI config BT1_AXI
tristate "Baikal-T1 AXI-bus driver" bool "Baikal-T1 AXI-bus driver"
depends on MIPS_BAIKAL_T1 || COMPILE_TEST depends on MIPS_BAIKAL_T1 || COMPILE_TEST
select MFD_SYSCON select MFD_SYSCON
help help
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -163,12 +164,10 @@ static int bt1_apb_request_regs(struct bt1_apb *apb) ...@@ -163,12 +164,10 @@ static int bt1_apb_request_regs(struct bt1_apb *apb)
} }
apb->res = devm_platform_ioremap_resource_byname(pdev, "nodev"); apb->res = devm_platform_ioremap_resource_byname(pdev, "nodev");
if (IS_ERR(apb->res)) { if (IS_ERR(apb->res))
dev_err(apb->dev, "Couldn't map reserved region\n"); dev_err(apb->dev, "Couldn't map reserved region\n");
return PTR_ERR(apb->res);
}
return 0; return PTR_ERR_OR_ZERO(apb->res);
} }
static int bt1_apb_request_rst(struct bt1_apb *apb) static int bt1_apb_request_rst(struct bt1_apb *apb)
...@@ -310,8 +309,8 @@ static ssize_t timeout_store(struct device *dev, ...@@ -310,8 +309,8 @@ static ssize_t timeout_store(struct device *dev,
} }
static DEVICE_ATTR_RW(timeout); static DEVICE_ATTR_RW(timeout);
static ssize_t inject_error_show(struct device *dev, struct device_attribute *attr, static ssize_t inject_error_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n"); return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
} }
...@@ -326,9 +325,9 @@ static ssize_t inject_error_store(struct device *dev, ...@@ -326,9 +325,9 @@ static ssize_t inject_error_store(struct device *dev,
* Either dummy read from the unmapped address in the APB IO area * Either dummy read from the unmapped address in the APB IO area
* or manually set the IRQ status. * or manually set the IRQ status.
*/ */
if (!strncmp(data, "nodev", 5)) if (sysfs_streq(data, "nodev"))
readl(apb->res); readl(apb->res);
else if (!strncmp(data, "irq", 3)) else if (sysfs_streq(data, "irq"))
regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING, regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING,
APB_EHB_ISR_PENDING); APB_EHB_ISR_PENDING);
else else
......
...@@ -124,12 +124,10 @@ static int bt1_axi_request_regs(struct bt1_axi *axi) ...@@ -124,12 +124,10 @@ static int bt1_axi_request_regs(struct bt1_axi *axi)
} }
axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos"); axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos");
if (IS_ERR(axi->qos_regs)) { if (IS_ERR(axi->qos_regs))
dev_err(dev, "Couldn't map AXI-bus QoS registers\n"); dev_err(dev, "Couldn't map AXI-bus QoS registers\n");
return PTR_ERR(axi->qos_regs);
}
return 0; return PTR_ERR_OR_ZERO(axi->qos_regs);
} }
static int bt1_axi_request_rst(struct bt1_axi *axi) static int bt1_axi_request_rst(struct bt1_axi *axi)
...@@ -173,12 +171,10 @@ static int bt1_axi_request_clk(struct bt1_axi *axi) ...@@ -173,12 +171,10 @@ static int bt1_axi_request_clk(struct bt1_axi *axi)
} }
ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi);
if (ret) { if (ret)
dev_err(axi->dev, "Can't add AXI clock disable action\n"); dev_err(axi->dev, "Can't add AXI clock disable action\n");
return ret;
}
return 0; return ret;
} }
static int bt1_axi_request_irq(struct bt1_axi *axi) static int bt1_axi_request_irq(struct bt1_axi *axi)
...@@ -192,12 +188,10 @@ static int bt1_axi_request_irq(struct bt1_axi *axi) ...@@ -192,12 +188,10 @@ static int bt1_axi_request_irq(struct bt1_axi *axi)
ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED, ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED,
"bt1-axi", axi); "bt1-axi", axi);
if (ret) { if (ret)
dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n"); dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n");
return ret;
}
return 0; return ret;
} }
static ssize_t count_show(struct device *dev, static ssize_t count_show(struct device *dev,
...@@ -226,9 +220,9 @@ static ssize_t inject_error_store(struct device *dev, ...@@ -226,9 +220,9 @@ static ssize_t inject_error_store(struct device *dev,
* error while unaligned writing - the AXI bus write error handled * error while unaligned writing - the AXI bus write error handled
* by this driver. * by this driver.
*/ */
if (!strncmp(data, "bus", 3)) if (sysfs_streq(data, "bus"))
readb(axi->qos_regs); readb(axi->qos_regs);
else if (!strncmp(data, "unaligned", 9)) else if (sysfs_streq(data, "unaligned"))
writeb(0, axi->qos_regs); writeb(0, axi->qos_regs);
else else
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment