linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Charles Perry <charles.perry@savoirfairelinux.com>, mdf@kernel.org
Cc: hao.wu@intel.com, yilun.xu@intel.com, trix@redhat.com,
	krzysztof.kozlowski+dt@linaro.org, bcody@markem-imaje.com,
	avandiver@markem-imaje.com, linux-fpga@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] fpga: xilinx-selectmap: add new driver
Date: Tue, 30 Jan 2024 08:56:01 +0100	[thread overview]
Message-ID: <4c6a7898-d300-468c-9e2f-13f639ca4407@linaro.org> (raw)
In-Reply-To: <20240129225602.3832449-3-charles.perry@savoirfairelinux.com>

On 29/01/2024 23:56, Charles Perry wrote:
> Xilinx 7 series FPGA can be programmed using a slave parallel port named
> the SelectMAP interface in the datasheet. This slave interface is
> compatible with the i.MX6 EIM bus controller but other types of external
> memory mapped parallel bus might work.
> 
> xilinx-selectmap currently only supports the x8 mode where data is loaded
> at one byte per rising edge of the clock, with the MSb of each byte
> presented to the D0 pin.
> 
> The following DT fragment shows a valid configuration on a custom i.MX6
> board (pinctrl not shown for readability):
> 
> &weim {
>     status = "okay";
>     ranges = <0 0 0x08000000 0x04000000>;
> 
>     fpga_mgr: fpga_programmer@0,0 {
>         compatible = "xlnx,fpga-slave-selectmap";
>         reg = <0 0 0x4000000>;
>         fsl,weim-cs-timing = <0x00070031 0x00000142
>                               0x00020000 0x00000000
>                               0x0c000645 0x00000000>;
>         prog_b-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>;
>         init-b-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>;
>         done-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
>         csi-b-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
>         rdwr-b-gpios = <&gpio3 10 GPIO_ACTIVE_LOW>;
>     };
> };

Drop that example. First, it is not correct. Second, a correct one in
bindings is enough.

> 
> Signed-off-by: Charles Perry <charles.perry@savoirfairelinux.com>
> ---

...

> +static int xilinx_selectmap_probe(struct platform_device *pdev)
> +{
> +	struct xilinx_selectmap_conf *conf;
> +	struct resource *r;
> +	void __iomem *base;
> +
> +	conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL);
> +	if (!conf)
> +		return -ENOMEM;
> +
> +	base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
> +	if (IS_ERR(base))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(base), "ioremap error\n");
> +	conf->base = base;
> +
> +	/* CSI_B is active low */
> +	conf->csi_b = devm_gpiod_get_optional(&pdev->dev, "csi-b", GPIOD_OUT_HIGH);
> +	if (IS_ERR(conf->csi_b))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(conf->csi_b),
> +				     "Failed to get CSI_B gpio\n");
> +
> +	/* RDWR_B is active low */
> +	conf->rdwr_b = devm_gpiod_get_optional(&pdev->dev, "rdwr-b", GPIOD_OUT_HIGH);
> +	if (IS_ERR(conf->rdwr_b))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(conf->rdwr_b),
> +				     "Failed to get RDWR_B gpio\n");
> +
> +	return xilinx_core_probe(&conf->core, &pdev->dev,
> +							xilinx_selectmap_write,
> +							xilinx_selectmap_apply_padding);

Totally messed indentation. Please run scripts/checkpatch.pl and fix
reported warnings. Some warnings can be ignored, but the code here looks
like it needs a fix. Feel free to get in touch if the warning is not clear.

> +}
> +
> +static const struct of_device_id xlnx_selectmap_of_match[] = {
> +		{ .compatible = "xlnx,fpga-slave-selectmap", },
> +		{}
> +};
> +MODULE_DEVICE_TABLE(of, xlnx_selectmap_of_match);
> +
> +static struct platform_driver xilinx_slave_selectmap_driver = {
> +	.driver = {
> +		.name = "xilinx-slave-selectmap",
> +		.of_match_table = of_match_ptr(xlnx_selectmap_of_match),

Drop of_match_ptr, it leads to warnings.

> +	},
> +	.probe  = xilinx_selectmap_probe,
> +};

Best regards,
Krzysztof


  reply	other threads:[~2024-01-30  7:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 22:56 [PATCH 1/3] fpga: xilinx-spi: extract a common driver core Charles Perry
2024-01-29 22:56 ` [PATCH 2/3] dt-bindings: fpga: xlnx,fpga-slave-selectmap: add DT schema Charles Perry
2024-01-30  0:21   ` Rob Herring
2024-01-30  7:52   ` Krzysztof Kozlowski
2024-01-30  7:53     ` Krzysztof Kozlowski
2024-01-30 15:45     ` Charles Perry
2024-01-30 16:05       ` Krzysztof Kozlowski
2024-01-30 17:05         ` Charles Perry
2024-01-30 17:58           ` Krzysztof Kozlowski
2024-01-30 23:32             ` Charles Perry
2024-01-30 16:09   ` Krzysztof Kozlowski
2024-01-31 11:03     ` Kris Chaplin
2024-02-04  8:30       ` Xu Yilun
2024-02-13 21:54         ` Charles Perry
2024-01-29 22:56 ` [PATCH 3/3] fpga: xilinx-selectmap: add new driver Charles Perry
2024-01-30  7:56   ` Krzysztof Kozlowski [this message]
2024-01-31 23:05 ` [PATCH 0/3] " Charles Perry
2024-01-31 23:05   ` [PATCH 1/3] fpga: xilinx-spi: extract a common driver core Charles Perry
2024-02-04  8:22     ` Xu Yilun
2024-02-06 15:39       ` Charles Perry
2024-01-31 23:05   ` [PATCH 2/3] dt-bindings: fpga: xlnx,fpga-slave-selectmap: add DT schema Charles Perry
2024-02-01  8:07     ` Krzysztof Kozlowski
2024-02-01 18:24       ` Charles Perry
2024-02-02 10:49         ` Krzysztof Kozlowski
2024-02-02 19:52           ` Charles Perry
2024-01-31 23:05   ` [PATCH 3/3] fpga: xilinx-selectmap: add new driver Charles Perry
2024-02-04  8:10     ` Xu Yilun
2024-02-06 15:48       ` Charles Perry
2024-02-02 20:16   ` [PATCH 0/3] " Rob Herring
2024-02-02 20:53     ` Charles Perry

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=4c6a7898-d300-468c-9e2f-13f639ca4407@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=avandiver@markem-imaje.com \
    --cc=bcody@markem-imaje.com \
    --cc=charles.perry@savoirfairelinux.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hao.wu@intel.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.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).