From: Florian Fainelli <f.fainelli@gmail.com>
To: Pawel Dembicki <paweldembicki@gmail.com>
Cc: linus.walleij@linaro.org, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] net: dsa: vsc73xx: add support for parallel mode
Date: Mon, 1 Jul 2019 09:45:10 -0700 [thread overview]
Message-ID: <b7afaf2e-ca4e-2795-658d-2f0289203833@gmail.com> (raw)
In-Reply-To: <20190701152723.624-3-paweldembicki@gmail.com>
On 7/1/19 8:27 AM, Pawel Dembicki wrote:
> This patch add platform part of vsc73xx driver.
> It allows to use chip connected by PI interface.
>
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
> ---
[snip]
> + struct vsc73xx_platform *vsc_platform = vsc->priv;
> + u32 offset;
> +
> + if (!vsc73xx_is_addr_valid(block, subblock))
> + return -EINVAL;
> +
> + offset = vsc73xx_make_addr(block, subblock, reg);
> +
> + mutex_lock(&vsc->lock);
> + iowrite32be(val, vsc_platform->base_addr + offset);
> + mutex_unlock(&vsc->lock);
Similar question from Andrew, why is the locking done in the platform
layer, should not that be done in the core I/O operation instead?
> +
> + return 0;
> +}
> +
> +static int vsc73xx_platform_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct vsc73xx_platform *vsc_platform;
> + struct resource *res = NULL;
> + int ret;
> +
> + vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL);
> + if (!vsc_platform)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, vsc_platform);
> + vsc_platform->pdev = pdev;
> + vsc_platform->vsc.dev = dev;
> + vsc_platform->vsc.priv = vsc_platform;
> + vsc_platform->vsc.ops = &vsc73xx_platform_ops;
> +
> + /* obtain I/O memory space */
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(&pdev->dev, "cannot obtain I/O memory space\n");
> + ret = -ENXIO;
> + return ret;
> + }
> +
> + vsc_platform->base_addr = devm_ioremap_resource(&pdev->dev, res);
devm_ioremap_resource takes care of checking that the resource pointer
is valid, no need to do that here.
> + if (!vsc_platform->base_addr) {
if (IS_ERR(vsc_platform->base_addr))
--
Florian
next prev parent reply other threads:[~2019-07-01 16:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 15:27 [PATCH 1/4] net: dsa: Change DT bindings for Vitesse VSC73xx switches Pawel Dembicki
2019-07-01 15:27 ` [PATCH 2/4] net: dsa: vsc73xx: Split vsc73xx driver Pawel Dembicki
2019-07-01 16:03 ` Andrew Lunn
2019-07-03 9:02 ` [PATCH v2 " Pawel Dembicki
2019-07-01 15:27 ` [PATCH 3/4] net: dsa: vsc73xx: add support for parallel mode Pawel Dembicki
2019-07-01 16:11 ` Andrew Lunn
2019-07-01 16:45 ` Florian Fainelli [this message]
2019-07-03 9:07 ` [PATCH v2 " Pawel Dembicki
2019-07-01 15:27 ` [PATCH 4/4] net: dsa: vsc73xx: Assert reset if iCPU is enabled Pawel Dembicki
2019-07-03 9:10 ` [PATCH v2 " Pawel Dembicki
2019-07-01 15:55 ` [PATCH 1/4] net: dsa: Change DT bindings for Vitesse VSC73xx switches Andrew Lunn
2019-07-01 16:44 ` Florian Fainelli
2019-07-01 20:23 ` Linus Walleij
2019-07-03 8:57 ` [PATCH v2 " Pawel Dembicki
2019-07-03 12:41 ` Linus Walleij
2019-07-03 15:26 ` Florian Fainelli
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=b7afaf2e-ca4e-2795-658d-2f0289203833@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=paweldembicki@gmail.com \
--cc=robh+dt@kernel.org \
--cc=vivien.didelot@gmail.com \
/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