devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Loc Ho <lho@apm.com>
Cc: olof@lixom.net, tj@kernel.org, linux-scsi@vger.kernel.org,
	linux-ide@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, jcm@redhat.com,
	Tuan Phan <tphan@apm.com>, Suman Tripathi <stripathi@apm.com>
Subject: Re: [PATCH 2/3] ata: Add APM X-Gene SoC 6.0Gbps SATA PHY driver
Date: Fri, 15 Nov 2013 13:46:16 +0100	[thread overview]
Message-ID: <201311151346.17231.arnd@arndb.de> (raw)
In-Reply-To: <1384457519-21335-3-git-send-email-lho@apm.com>

On Thursday 14 November 2013, Loc Ho wrote:
> +
> +/* SATA port 4 - 5 force power down VCO */
> +static void xgene_phy_sata45_macro_pdwn_force_vco(struct xgene_ahci_phy_ctx
> +						     *ctx)
> +{
> +	sds_pcie_toggle1to0(ctx->pcie_base, KC_CLKMACRO_CMU_REGS_CMU_REG0_ADDR,
> +			    CMU_REG0_PDOWN_MASK);
> +	sds_pcie_toggle1to0(ctx->pcie_base,
> +			    KC_CLKMACRO_CMU_REGS_CMU_REG32_ADDR,
> +			    CMU_REG32_FORCE_VCOCAL_START_MASK);
> +}

I think it's bad to have knowledge of specific port numbers in the driver.
Can you change this so that the driver treats all PHYs the same way but
gets the differences between sata/eth/pcie mode from DT properties?


> +void xgene_ahci_serdes_reset_rxa_rxd(struct xgene_ahci_phy_ctx *ctx, int chan)

All functions in the driver should be 'static'. You are not calling these
directly from the SATA driver, are you?

> +	/* Select SATA mux for SATA port 0 - 3 which shared with SGMII ETH */
> +	if (ctx->id < 2) {
> +		if (xgene_phy_host_sata_select(ctx) != 0) {
> +			dev_err(ctx->dev, "SATA%d can not select SATA MUX\n",
> +				ctx->id);
> +			return -1;
> +		}
> +	}

I think all checks for the "id" field are to find out what kind of PHY you
are talking to, the driver itself does not need to know the id, and the
field can be removed if you find that out in a different way.

> +	if (ctx->id == 2) {
> +		/* For 3rd controller, we must also program another resource */
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +		if (!res) {
> +			dev_err(&pdev->dev,
> +				"no SATA/PCIE PHY resource address\n");
> +			goto error;
> +		}
> +		ctx->pcie_base = devm_ioremap(&pdev->dev, res->start,
> +					      resource_size(res));
> +		if (!ctx->pcie_base) {
> +			dev_err(&pdev->dev,
> +				"can't map SATA/PCIe PHY resource\n");
> +			rc = -ENOMEM;
> +			goto error;
> +		}
> +	}

If you need a second memory resource, I take that as a hint that
the device is actually different from the others, so using a separate
"compatible" string in DT might be more appropriate.

	Arnd

  parent reply	other threads:[~2013-11-15 12:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 19:31 [PATCH 0/3] ata: Add APM X-Gene SoC 6.0Gbps SATA PHY support Loc Ho
2013-11-14 19:31 ` [PATCH 1/3] Documentation: Add APM X-Gene SoC 6.0Gbps SATA PHY driver binding documentation Loc Ho
2013-11-14 19:31   ` [PATCH 2/3] ata: Add APM X-Gene SoC 6.0Gbps SATA PHY driver Loc Ho
2013-11-14 19:31     ` [PATCH 3/3] arm64: Add APM X-Gene SoC 6.0Gbps SATA PHY DTS entries Loc Ho
2013-11-15 12:46     ` Arnd Bergmann [this message]
2013-11-15 16:14       ` [PATCH 2/3] ata: Add APM X-Gene SoC 6.0Gbps SATA PHY driver Loc Ho
     [not found]   ` <1384457519-21335-2-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>
2013-11-15 12:35     ` [PATCH 1/3] Documentation: Add APM X-Gene SoC 6.0Gbps SATA PHY driver binding documentation Arnd Bergmann
2013-11-15 12:52       ` Arnd Bergmann
2013-11-15 16:22       ` Loc Ho
2013-11-15 19:26         ` Arnd Bergmann
2013-11-15 19:33           ` Loc Ho
2013-11-15 19:54             ` Arnd Bergmann
2013-11-15 20:00               ` Loc Ho
2013-11-15 20:19                 ` Arnd Bergmann
2013-11-15 20:52                   ` Loc Ho
2013-11-15 12:31 ` [PATCH 0/3] ata: Add APM X-Gene SoC 6.0Gbps SATA PHY support Arnd Bergmann

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=201311151346.17231.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jcm@redhat.com \
    --cc=lho@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=stripathi@apm.com \
    --cc=tj@kernel.org \
    --cc=tphan@apm.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).