From: Adrian Hunter <adrian.hunter@intel.com>
To: Piyush Malgujar <pmalgujar@marvell.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
ulf.hansson@linaro.org, p.zabel@pengutronix.de,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, yamada.masahiro@socionext.com,
devicetree@vger.kernel.org
Cc: jannadurai@marvell.com, cchavva@marvell.com
Subject: Re: [PATCH v4 4/6] mmc: sdhci-cadence: enable MMC_SDHCI_IO_ACCESSORS support
Date: Wed, 26 Jul 2023 15:42:39 +0300 [thread overview]
Message-ID: <dfc72fd8-0b4a-71bc-ee0c-9ad97f8de6dc@intel.com> (raw)
In-Reply-To: <20230717125146.16791-5-pmalgujar@marvell.com>
On 17/07/23 15:51, Piyush Malgujar wrote:
> From: Jayanthi Annadurai <jannadurai@marvell.com>
>
> Add support of CONFIG_MMC_SDHCI_IO_ACCESSORS to allow Marvell
> SoC ops for SD6 controller to overwrite the SDHCI IO memory
> accessors.
>
> Signed-off-by: Jayanthi Annadurai <jannadurai@marvell.com>
> Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com>
> ---
> drivers/mmc/host/sdhci-cadence.c | 59 ++++++++++++++++++++++++++++++++
> 1 file changed, 59 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index 8bcf585185053b0afaff2625d62316cec1824fa3..f1e597219c603f3921439cedb22dcb2884abe68d 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -448,6 +448,59 @@ static u32 read_dqs_cmd_delay, clk_wrdqs_delay, clk_wr_delay, read_dqs_delay;
>
> static u32 sdhci_cdns_sd6_get_mode(struct sdhci_host *host, unsigned int timing);
>
> +static u32 sdhci_cdns_sd6_readl(struct sdhci_host *host, int reg)
> +{
> + return readl(host->ioaddr + reg);
> +}
Doesn't need to be implemented if it is the same as the
default behaviour
> +
> +static void sdhci_cdns_sd6_writel(struct sdhci_host *host, u32 val, int reg)
> +{
> + writel(val, host->ioaddr + reg);
> +}
Doesn't need to be implemented if it is the same as the
default behaviour
> +
> +static u16 sdhci_cdns_sd6_readw(struct sdhci_host *host, int reg)
> +{
> + u32 val, regoff;
> +
> + regoff = reg & ~3;
> +
> + val = readl(host->ioaddr + regoff);
> + if ((reg & 0x3) == 0)
> + return (val & 0xFFFF);
> + else
> + return ((val >> 16) & 0xFFFF);
> +}
You can use upper_16_bits() etc e.g.
static u16 sdhci_cdns_sd6_readw(struct sdhci_host *host, int reg)
{
u32 val = readl(host->ioaddr + (reg & ~3));
return reg & 0x3 ? upper_16_bits(val) : lower_16_bits(val);
}
> +
> +static void sdhci_cdns_sd6_writew(struct sdhci_host *host, u16 val, int reg)
> +{
> + writew(val, host->ioaddr + reg);
> +}
Doesn't need to be implemented if it is the same as the
default behaviour
> +
> +static u8 sdhci_cdns_sd6_readb(struct sdhci_host *host, int reg)
> +{
> + u32 val, regoff;
> +
> + regoff = reg & ~3;
> +
> + val = readl(host->ioaddr + regoff);
> + switch (reg & 3) {
> + case 0:
> + return (val & 0xFF);
> + case 1:
> + return ((val >> 8) & 0xFF);
> + case 2:
> + return ((val >> 16) & 0xFF);
> + case 3:
> + return ((val >> 24) & 0xFF);
> + }
> + return 0;
> +}
Probably could just be:
static u8 sdhci_cdns_sd6_readb(struct sdhci_host *host, int reg)
{
u32 val = readl(host->ioaddr + (reg & ~3));
return val >> (8 * (reg & 3)));
}
> +
> +static void sdhci_cdns_sd6_writeb(struct sdhci_host *host, u8 val, int reg)
> +{
> + writeb(val, host->ioaddr + reg);
> +}
Doesn't need to be implemented if it is the same as the
default behaviour
> +
> static int sdhci_cdns_sd6_phy_lock_dll(struct sdhci_cdns_sd6_phy *phy)
> {
> u32 delay_element = phy->d.delay_element_org;
> @@ -1666,6 +1719,12 @@ static const struct sdhci_ops sdhci_cdns_sd4_ops = {
> };
>
> static const struct sdhci_ops sdhci_cdns_sd6_ops = {
> + .read_l = sdhci_cdns_sd6_readl,
> + .write_l = sdhci_cdns_sd6_writel,
> + .read_w = sdhci_cdns_sd6_readw,
> + .write_w = sdhci_cdns_sd6_writew,
> + .read_b = sdhci_cdns_sd6_readb,
> + .write_b = sdhci_cdns_sd6_writeb,
> .get_max_clock = sdhci_cdns_get_max_clock,
> .set_clock = sdhci_cdns_sd6_set_clock,
> .get_timeout_clock = sdhci_cdns_get_timeout_clock,
next prev parent reply other threads:[~2023-07-26 12:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 12:51 [PATCH v4 0/6] mmc: sdhci-cadence: SD6 controller support Piyush Malgujar
2023-07-17 12:51 ` [PATCH v4 1/6] mmc: sdhci-cadence: Rename functions/structures to SD4 specific Piyush Malgujar
2023-07-26 12:41 ` Adrian Hunter
2023-07-17 12:51 ` [PATCH v4 2/6] mmc: sdhci-cadence: Restructure the code Piyush Malgujar
2023-07-26 12:41 ` Adrian Hunter
2023-07-17 12:51 ` [PATCH v4 3/6] mmc: sdhci-cadence: SD6 controller support Piyush Malgujar
2023-07-17 20:04 ` Krzysztof Kozlowski
2023-07-26 12:41 ` Adrian Hunter
2023-07-17 12:51 ` [PATCH v4 4/6] mmc: sdhci-cadence: enable MMC_SDHCI_IO_ACCESSORS support Piyush Malgujar
2023-07-26 12:42 ` Adrian Hunter [this message]
2023-07-17 12:51 ` [PATCH v4 5/6] dt-bindings: mmc: sdhci-cadence: SD6 support Piyush Malgujar
2023-07-17 18:31 ` Conor Dooley
2023-07-17 20:06 ` Krzysztof Kozlowski
2023-07-17 12:51 ` [PATCH v4 6/6] mmc: sdhci-cadence: Add debug option for SD6 controller Piyush Malgujar
2023-07-18 16:10 ` kernel test robot
2023-07-26 12:42 ` Adrian Hunter
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=dfc72fd8-0b4a-71bc-ee0c-9ad97f8de6dc@intel.com \
--to=adrian.hunter@intel.com \
--cc=cchavva@marvell.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jannadurai@marvell.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pmalgujar@marvell.com \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=yamada.masahiro@socionext.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).