From: Arnd Bergmann <arnd@arndb.de>
To: Michal Simek <michal.simek@xilinx.com>
Cc: linux-arm-kernel@lists.infradead.org,
Soren Brinkmann <soren.brinkmann@xilinx.com>,
Olof Johansson <olof@lixom.net>,
monstr@monstr.eu, Josh Cartwright <josh.cartwright@ni.com>,
Steffen Trumtrar <s.trumtrar@pengutronix.de>,
Rob Herring <robherring2@gmail.com>,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joe Perches <joe@perches.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Antti Palosaari <crope@iki.fi>, Jingoo Han <jg1.han@samsung.com>,
Sandeep Nair <sandeep_n@ti.com>,
Kumar Gala <galak@codeaurora.org>,
Santosh Shilimkar <santosh.shilimkar@gmail.com>,
Andy Gross <agross@codeaurora.org>,
Linus Walleij <linus.walleij@linaro.org>Thierry Reding <t>
Subject: Re: [PATCH v5 6/7] ARM: zynq: Add OCM controller driver
Date: Mon, 01 Dec 2014 16:31:19 +0100 [thread overview]
Message-ID: <4151221.1fPmelvPbd@wuerfel> (raw)
In-Reply-To: <4788755d350890d81f1bac4bf237c5ddfb68b795.1417440250.git.michal.simek@xilinx.com>
On Monday 01 December 2014 14:24:57 Michal Simek wrote:
> The driver provide memory allocator which can
> be used by others drivers to allocate memory inside OCM.
> All locations for 64kB blocks are supported
> and driver is trying to allocate the largest continuous
> block of memory.
>
> Checking mpcore addressing filterring is not done here
> but could be added in future.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
The driver doesn't actually have any interface as far as I can tell,
so I wonder how you expect it to be used.
Do you have a list of drivers that would be using it?
How does it relate to the generic "mmio-sram" binding? Is this
meant as a specialization?
> +/**
> + * zynq_ocmc_irq_handler - Interrupt service routine of the OCM controller
> + * @irq: IRQ number
> + * @data: Pointer to the zynq_ocmc_dev structure
> + *
> + * Return: IRQ_HANDLED always
> + */
> +static irqreturn_t zynq_ocmc_irq_handler(int irq, void *data)
> +{
> + u32 sts;
> + u32 err_addr;
> + struct zynq_ocmc_dev *zynq_ocmc = data;
> +
> + /* check status */
> + sts = readl(zynq_ocmc->base + ZYNQ_OCMC_IRQ_STS);
> + if (sts & ZYNQ_OCMC_IRQ_STS_ERR_MASK) {
> + /* check error address */
> + err_addr = readl(zynq_ocmc->base + ZYNQ_OCMC_PARITY_ERRADDRESS);
> + pr_err("%s: OCM err intr generated at 0x%04x (stat: 0x%08x).",
> + __func__, err_addr, sts & ZYNQ_OCMC_IRQ_STS_ERR_MASK);
> + }
> + pr_warn("%s: Interrupt generated by OCM, but no error is found.",
> + __func__);
> +
> + return IRQ_HANDLED;
> +}
I'm also puzzled by this: you don't really do anything here but print
a message. What is the purpose of this interrupt? As this looks unrelated
to the rest of the driver, maybe this should be part of drivers/edac
instead?
> +static int zynq_ocmc_probe(struct platform_device *pdev)
> +{
> + int ret;
> + struct zynq_ocmc_dev *zynq_ocmc;
> + u32 i, ocm_config, curr;
> + struct resource *res;
> +
> + ocm_config = zynq_slcr_get_ocm_config();
> +
> + zynq_ocmc = devm_kzalloc(&pdev->dev, sizeof(*zynq_ocmc),
> GFP_KERNEL);
> + if (!zynq_ocmc)
> + return -ENOMEM;
> +
> + zynq_ocmc->pool = devm_gen_pool_create(&pdev->dev,
> + ilog2(ZYNQ_OCMC_GRANULARITY),
> + -1);
> + if (!zynq_ocmc->pool)
> + return -ENOMEM;
> +
> + curr = 0; /* For storing current struct resource for OCM */
> + for (i = 0; i < ZYNQ_OCMC_BLOCKS; i++) {
> + u32 base, start, end;
> +
> + /* Setup base address for 64kB OCM block */
> + if (ocm_config & BIT(i))
> + base = ZYNQ_OCMC_HIGHADDR;
> + else
> + base = ZYNQ_OCMC_LOWADDR;
You write in the introductory mail that you want to support detecting the
address from the slcr, and possibly even allow changing it at runtime,
but I don't understand what that would be good for.
It's not uncommon to describe in DT settings that one can also find
out from hardware but that are set up by the boot loader in a particular
way. Why not this one? For all I can tell, that would let you simply
use one driver for the EDAC and the generic mmio-sram from the memory,
without the need to do anything further.
Arnd
next prev parent reply other threads:[~2014-12-01 15:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 13:24 [PATCH v5 0/7] Xilinx Zynq OCM support Michal Simek
2014-12-01 13:24 ` [PATCH v5 5/7] devicetree: bindings: Add zynq ocmc node description Michal Simek
2014-12-01 13:24 ` [PATCH v5 6/7] ARM: zynq: Add OCM controller driver Michal Simek
2014-12-01 15:31 ` Arnd Bergmann [this message]
2014-12-02 10:52 ` Michal Simek
2014-12-01 13:24 ` [PATCH v5 7/7] ARM: zynq: DT: Add OCM controller node Michal Simek
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=4151221.1fPmelvPbd@wuerfel \
--to=arnd@arndb.de \
--cc=agross@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=crope@iki.fi \
--cc=davem@davemloft.net \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jg1.han@samsung.com \
--cc=joe@perches.com \
--cc=josh.cartwright@ni.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mchehab@osg.samsung.com \
--cc=michal.simek@xilinx.com \
--cc=monstr@monstr.eu \
--cc=olof@lixom.net \
--cc=peter.crosthwaite@xilinx.com \
--cc=robh+dt@kernel.org \
--cc=robherring2@gmail.com \
--cc=s.trumtrar@pengutronix.de \
--cc=sandeep_n@ti.com \
--cc=santosh.shilimkar@gmail.com \
--cc=soren.brinkmann@xilinx.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;
as well as URLs for NNTP newsgroup(s).