From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Wenrui Li <wenrui.li-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Brian Norris
<briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v2 01/15] Remove unused symbols, unnecessary parens, other minor comments from
Date: Fri, 2 Sep 2016 14:42:56 -0700 [thread overview]
Message-ID: <20160902214256.GC31011@roeck-us.net> (raw)
In-Reply-To: <20160902155358.8650.64973.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
On Fri, Sep 02, 2016 at 10:53:58AM -0500, Bjorn Helgaas wrote:
> Guenter.
Kind of an odd patch description ;-)
Guenter
> ---
> drivers/pci/host/pcie-rockchip.c | 69 ++++++++++++--------------------------
> 1 file changed, 21 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index e77aec3..a7006be 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -38,7 +38,6 @@
> #include <linux/regmap.h>
>
> #define PCIE_CLIENT_BASE 0x0
> -#define PCIE_RC_CONFIG_NORMAL_BASE 0x800000
> #define PCIE_RC_CONFIG_BASE 0xa00000
> #define PCIE_RC_CONFIG_L1_SUBSTATE_CTRL2 0x90c
> #define PCIE_RC_CONFIG_LCSR 0xd0
> @@ -126,9 +125,6 @@
> #define RC_REGION_0_ADDR_TRANS_H 0x00000000
> #define RC_REGION_0_ADDR_TRANS_L 0x00000000
> #define RC_REGION_0_PASS_BITS (25 - 1)
> -#define RC_REGION_1_ADDR_TRANS_H 0x00000000
> -#define RC_REGION_1_ADDR_TRANS_L 0x00400000
> -#define RC_REGION_1_PASS_BITS (20 - 1)
> #define MAX_AXI_WRAPPER_REGION_NUM 33
> #define PCIE_CORE_LCSR_RETRAIN_LINK BIT(5)
> #define PCIE_CLIENT_CONF_ENABLE BIT(0)
> @@ -147,15 +143,12 @@
> #define PCIE_CLIENT_MODE_SHIFT 6
> #define PCIE_CLIENT_MODE_MASK 0x1
> #define PCIE_CLIENT_GEN_SEL_2 1
> -#define PCIE_CLIENT_GEN_SEL_1 0
> #define PCIE_CLIENT_GEN_SEL_SHIFT 7
> #define PCIE_CLIENT_GEN_SEL_MASK 0x1
> #define PCIE_CLIENT_LINK_STATUS_UP 0x3
> #define PCIE_CLIENT_LINK_STATUS_SHIFT 20
> #define PCIE_CLIENT_LINK_STATUS_MASK 0x3
> -#define PCIE_CORE_PL_CONF_SPEED_2_5G 0x0
> #define PCIE_CORE_PL_CONF_SPEED_5G 0x1
> -#define PCIE_CORE_PL_CONF_SPEED_8G 0x2
> #define PCIE_CORE_PL_CONF_SPEED_SHIFT 3
> #define PCIE_CORE_PL_CONF_SPEED_MASK 0x3
> #define PCIE_CORE_PL_CONF_LANE_SHIFT 1
> @@ -174,11 +167,6 @@
> PCIE_CORE_INT_CT | PCIE_CORE_INT_UTC | \
> PCIE_CORE_INT_MMVC)
>
> -#define PCIE_CLIENT_INT_SUBSYSTEM \
> - (PCIE_CLIENT_INT_PWR_STCG | PCIE_CLIENT_INT_HOT_PLUG | \
> - PCIE_CLIENT_INT_PHY | PCIE_CLIENT_INT_UDMA | \
> - PCIE_CLIENT_INT_LOCAL)
> -
> #define PCIE_CLIENT_INT_LEGACY \
> (PCIE_CLIENT_INT_INTA | PCIE_CLIENT_INT_INTB | \
> PCIE_CLIENT_INT_INTC | PCIE_CLIENT_INT_INTD)
> @@ -191,8 +179,8 @@
> PCIE_CLIENT_INT_PHY)
>
> struct rockchip_pcie_port {
> - void __iomem *reg_base;
> - void __iomem *apb_base;
> + void __iomem *reg_base; /* DT axi-base */
> + void __iomem *apb_base; /* DT apb-base */
> struct phy *phy;
> struct reset_control *core_rst;
> struct reset_control *mgmt_rst;
> @@ -240,7 +228,7 @@ static void rockchip_pcie_clr_bw_int(struct rockchip_pcie_port *port)
> pcie_write(port, status, PCIE_RC_CONFIG_BASE + PCIE_RC_CONFIG_LCSR);
> }
>
> -static int rockchip_pcie_valid_config(struct rockchip_pcie_port *pp,
> +static int rockchip_pcie_valid_device(struct rockchip_pcie_port *pp,
> struct pci_bus *bus, int dev)
> {
> /* access only one slot on each root port */
> @@ -286,7 +274,7 @@ static int rockchip_pcie_wr_own_conf(struct rockchip_pcie_port *pp,
> {
> u32 mask, tmp, offset;
>
> - offset = (where & (~0x3));
> + offset = where & ~0x3;
>
> if (size == 4) {
> writel(val, pp->apb_base + PCIE_RC_CONFIG_BASE + offset);
> @@ -357,7 +345,7 @@ static int rockchip_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
> {
> struct rockchip_pcie_port *pp = bus->sysdata;
>
> - if (!rockchip_pcie_valid_config(pp, bus, PCI_SLOT(devfn))) {
> + if (!rockchip_pcie_valid_device(pp, bus, PCI_SLOT(devfn))) {
> *val = 0xffffffff;
> return PCIBIOS_DEVICE_NOT_FOUND;
> }
> @@ -366,7 +354,6 @@ static int rockchip_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
> return rockchip_pcie_rd_own_conf(pp, where, size, val);
>
> return rockchip_pcie_rd_other_conf(pp, bus, devfn, where, size, val);
> -
> }
>
> static int rockchip_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
> @@ -374,7 +361,7 @@ static int rockchip_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
> {
> struct rockchip_pcie_port *pp = bus->sysdata;
>
> - if (!rockchip_pcie_valid_config(pp, bus, PCI_SLOT(devfn)))
> + if (!rockchip_pcie_valid_device(pp, bus, PCI_SLOT(devfn)))
> return PCIBIOS_DEVICE_NOT_FOUND;
>
> if (bus->number == pp->root_bus_nr)
> @@ -516,7 +503,6 @@ static int rockchip_pcie_init_port(struct rockchip_pcie_port *port)
> err = -ETIMEDOUT;
> break;
> }
> -
> }
>
> /* Double check gen1 training */
> @@ -744,11 +730,6 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie_port *port)
> regs = platform_get_resource_byname(pdev,
> IORESOURCE_MEM,
> "axi-base");
> - if (!regs) {
> - dev_err(dev, "missing axi-base property\n");
> - return -ENODEV;
> - }
> -
> port->reg_base = devm_ioremap_resource(dev, regs);
> if (IS_ERR(port->reg_base))
> return PTR_ERR(port->reg_base);
> @@ -756,11 +737,6 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie_port *port)
> regs = platform_get_resource_byname(pdev,
> IORESOURCE_MEM,
> "apb-base");
> - if (!regs) {
> - dev_err(dev, "missing apb-base property\n");
> - return -ENODEV;
> - }
> -
> port->apb_base = devm_ioremap_resource(dev, regs);
> if (IS_ERR(port->apb_base))
> return PTR_ERR(port->apb_base);
> @@ -774,38 +750,38 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie_port *port)
>
> port->lanes = 1;
> err = of_property_read_u32(node, "num-lanes", &port->lanes);
> - if (!err && ((port->lanes == 0) ||
> - (port->lanes == 3) ||
> - (port->lanes > 4))) {
> - dev_warn(dev, "invalid num-lanes, default use one lane\n");
> + if (!err && (port->lanes == 0 ||
> + port->lanes == 3 ||
> + port->lanes > 4)) {
> + dev_warn(dev, "invalid num-lanes, default to use one lane\n");
> port->lanes = 1;
> }
>
> port->core_rst = devm_reset_control_get(dev, "core");
> if (IS_ERR(port->core_rst)) {
> if (PTR_ERR(port->core_rst) != -EPROBE_DEFER)
> - dev_err(dev, "missing core rst property in node\n");
> + dev_err(dev, "missing core reset property in node\n");
> return PTR_ERR(port->core_rst);
> }
>
> port->mgmt_rst = devm_reset_control_get(dev, "mgmt");
> if (IS_ERR(port->mgmt_rst)) {
> if (PTR_ERR(port->mgmt_rst) != -EPROBE_DEFER)
> - dev_err(dev, "missing mgmt rst property in node\n");
> + dev_err(dev, "missing mgmt reset property in node\n");
> return PTR_ERR(port->mgmt_rst);
> }
>
> port->mgmt_sticky_rst = devm_reset_control_get(dev, "mgmt-sticky");
> if (IS_ERR(port->mgmt_sticky_rst)) {
> if (PTR_ERR(port->mgmt_sticky_rst) != -EPROBE_DEFER)
> - dev_err(dev, "missing mgmt-sticky rst property in node\n");
> + dev_err(dev, "missing mgmt-sticky reset property in node\n");
> return PTR_ERR(port->mgmt_sticky_rst);
> }
>
> port->pipe_rst = devm_reset_control_get(dev, "pipe");
> if (IS_ERR(port->pipe_rst)) {
> if (PTR_ERR(port->pipe_rst) != -EPROBE_DEFER)
> - dev_err(dev, "missing pipe rst property in node\n");
> + dev_err(dev, "missing pipe reset property in node\n");
> return PTR_ERR(port->pipe_rst);
> }
>
> @@ -991,7 +967,7 @@ static int rockchip_pcie_prog_ob_atu(struct rockchip_pcie_port *pp,
>
> if (region_no >= MAX_AXI_WRAPPER_REGION_NUM)
> return -EINVAL;
> - if ((num_pass_bits + 1) < 8)
> + if (num_pass_bits + 1 < 8)
> return -EINVAL;
> if (num_pass_bits > 63)
> return -EINVAL;
> @@ -1030,7 +1006,7 @@ static int rockchip_pcie_prog_ib_atu(struct rockchip_pcie_port *pp,
>
> if (region_no > MAX_AXI_IB_ROOTPORT_REGION_NUM)
> return -EINVAL;
> - if ((num_pass_bits + 1) < MIN_AXI_ADDR_BITS_PASSED)
> + if (num_pass_bits + 1 < MIN_AXI_ADDR_BITS_PASSED)
> return -EINVAL;
> if (num_pass_bits > 63)
> return -EINVAL;
> @@ -1055,7 +1031,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> struct pci_bus *bus, *child;
> struct resource_entry *win;
> resource_size_t io_base;
> - struct resource *busn = NULL;
> struct resource *mem;
> struct resource *io;
> phys_addr_t io_bus_addr = 0;
> @@ -1154,14 +1129,14 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> mem_bus_addr = mem->start - win->offset;
> break;
> case IORESOURCE_BUS:
> - busn = win->res;
> + port->root_bus_nr = win->res->start;
> break;
> default:
> continue;
> }
> }
>
> - if (mem_size)
> + if (mem_size) {
> for (reg_no = 0; reg_no < (mem_size >> 20); reg_no++) {
> err = rockchip_pcie_prog_ob_atu(port, reg_no + 1,
> AXI_WRAPPER_MEM_WRITE,
> @@ -1174,6 +1149,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> goto err_vpcie;
> }
> }
> + }
>
> err = rockchip_pcie_prog_ib_atu(port, 2, 32 - 1, 0x0, 0);
> if (err) {
> @@ -1183,7 +1159,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
>
> offset = mem_size >> 20;
>
> - if (io_size)
> + if (io_size) {
> for (reg_no = 0; reg_no < (io_size >> 20); reg_no++) {
> err = rockchip_pcie_prog_ob_atu(port,
> reg_no + 1 + offset,
> @@ -1197,12 +1173,9 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> goto err_vpcie;
> }
> }
> -
> - if (busn)
> - port->root_bus_nr = busn->start;
> + }
>
> bus = pci_scan_root_bus(&pdev->dev, 0, &rockchip_pcie_ops, port, &res);
> -
> if (!bus) {
> err = -ENOMEM;
> goto err_vpcie;
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-09-02 21:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 15:53 [PATCH v2 00/15] PCI: rockchip: Cleanups against v10 Bjorn Helgaas
2016-09-02 15:53 ` [PATCH v2 01/15] Remove unused symbols, unnecessary parens, other minor comments from Bjorn Helgaas
[not found] ` <20160902155358.8650.64973.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2016-09-02 21:42 ` Guenter Roeck [this message]
2016-09-02 22:15 ` Bjorn Helgaas
2016-09-02 15:54 ` [PATCH v2 02/15] Rename pcie_read() and pcie_write() to rockchip_pcie_read() and Bjorn Helgaas
[not found] ` <20160902154501.8650.99790.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2016-09-02 15:54 ` [PATCH v2 03/15] Always use "rockchip" as the pointer to per-device struct Bjorn Helgaas
2016-09-02 15:54 ` [PATCH v2 04/15] Rename struct rockchip_pcie_port to struct rockchip_pcie Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 10/15] Group related CSR definitions together Bjorn Helgaas
[not found] ` <20160902155518.8650.89467.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2016-09-02 21:40 ` Guenter Roeck
2016-09-02 15:55 ` [PATCH v2 11/15] Rename PCIE_CORE_RC_CONF_SCC_SHIFT to match similar definitions Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 12/15] Rename ROCKCHIP_PCIE_RPIFR1_INTR_MASK and ROCKCHIP_PCIE_RPIFR1_INTR_SHIFT Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 13/15] The register at PCIE_CLIENT_BASE presumably has a name of its own. Add a Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 14/15] Simplify testing of link status and speed testing Bjorn Helgaas
2016-09-02 15:56 ` [PATCH v2 15/15] Move msleeps to address Guenter's comments Bjorn Helgaas
2016-09-02 15:54 ` [PATCH v2 05/15] Use a local "dev" to avoid repetition of "rockchip->dev" Bjorn Helgaas
2016-09-02 15:54 ` [PATCH v2 06/15] Add comment about why 32-bit read/modify/write isn't safe Bjorn Helgaas
2016-09-02 15:54 ` [PATCH v2 07/15] Simplify the confusing HIWORD_UPDATE scheme Bjorn Helgaas
[not found] ` <20160902155453.8650.29613.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2016-09-02 21:38 ` Guenter Roeck
2016-09-02 22:09 ` Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 08/15] Remove duplicate CSR definition Bjorn Helgaas
2016-09-02 15:55 ` [PATCH v2 09/15] Move CSR bases into definition Bjorn Helgaas
2016-09-03 2:37 ` [PATCH v2 00/15] PCI: rockchip: Cleanups against v10 Shawn Lin
[not found] ` <5d1e6d5f-c8d9-8fcd-41dd-cabc3027f66a-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-03 16:34 ` Bjorn Helgaas
2016-09-03 17:17 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160902214256.GC31011@roeck-us.net \
--to=linux-0h96xk9xttrk1umjsbkqmq@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=wenrui.li-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).