mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Florian Fainelli <f.fainelli@gmail.com>, linux-kernel@vger.kernel.org
Cc: Broadcom internal kernel review list 
	<bcm-kernel-feedback-list@broadcom.com>,
	"moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] memory: brcmstb_memc: Add new DDR attributes
Date: Mon, 27 Mar 2023 18:04:13 +0200	[thread overview]
Message-ID: <fd349801-0ca1-7f89-f110-513a2cd4fc0f@linaro.org> (raw)
In-Reply-To: <20230324165231.3468069-4-f.fainelli@gmail.com>

On 24/03/2023 17:52, Florian Fainelli wrote:
> Provide information about the DDR size, type, width, total width,
> dual/single rank. This is useful for reporting purposes and inventory of
> the system(s).
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/memory/brcmstb_memc.c | 80 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 79 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c
> index 67c75e21c95e..032567dfd6e2 100644
> --- a/drivers/memory/brcmstb_memc.c
> +++ b/drivers/memory/brcmstb_memc.c
> @@ -13,7 +13,14 @@
>  
>  #define REG_MEMC_CNTRLR_CONFIG		0x00
>  #define  CNTRLR_CONFIG_LPDDR4_SHIFT	5
> -#define  CNTRLR_CONFIG_MASK		0xf
> +#define  CNTRLR_CONFIG_MASK		GENMASK(3, 0)
> +#define  CNTRLR_CONFIG_SIZE_SHIFT	4
> +#define  CNTRLR_CONFIG_SIZE_MASK	GENMASK(7, 4)
> +#define  CNTRLR_CONFIG_WIDTH_SHIFT	8
> +#define  CNTRLR_CONFIG_WIDTH_MASK	GENMASK(9, 8)
> +#define  CNTRLR_CONFIG_TOT_WIDTH_SHIFT	10
> +#define  CNTRLR_CONFIG_TOT_WIDTH_MASK	GENMASK(11, 10)
> +#define  CNTRLR_CONFIG_RANK_SHIFT	16
>  #define REG_MEMC_SRPD_CFG_21		0x20
>  #define REG_MEMC_SRPD_CFG_20		0x34
>  #define REG_MEMC_SRPD_CFG_1x		0x3c
> @@ -63,6 +70,67 @@ static int brcmstb_memc_srpd_config(struct brcmstb_memc *memc,
>  	return 0;
>  }
>  
> +static ssize_t ddr_rank_show(struct device *dev,
> +			     struct device_attribute *attr, char *buf)
> +{
> +	struct brcmstb_memc *memc = dev_get_drvdata(dev);
> +
> +	return sprintf(buf, "%s\n",
> +		       memc->config_reg & CNTRLR_CONFIG_RANK_SHIFT ?
> +		       "dual" : "single");

Why all these are not sysfs_emit()? I think it is the preferred (safer)
interface.

Best regards,
Krzysztof


      reply	other threads:[~2023-03-27 16:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 16:52 [PATCH 0/3] memory: brcmstb_memc: Report more DDR information Florian Fainelli
2023-03-24 16:52 ` [PATCH 1/3] memory: brcmstb_memc: Cache configuration register value Florian Fainelli
2023-03-24 16:52 ` [PATCH 2/3] Documentation: sysfs: brcmstb-memc: Document new attributes Florian Fainelli
2023-03-27 16:01   ` Krzysztof Kozlowski
2023-03-24 16:52 ` [PATCH 3/3] memory: brcmstb_memc: Add new DDR attributes Florian Fainelli
2023-03-27 16:04   ` Krzysztof Kozlowski [this message]

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=fd349801-0ca1-7f89-f110-513a2cd4fc0f@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®