[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fd349801-0ca1-7f89-f110-513a2cd4fc0f@linaro.org>
Date: Mon, 27 Mar 2023 18:04:13 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Florian Fainelli <f.fainelli@...il.com>,
linux-kernel@...r.kernel.org
Cc: Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
"moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 3/3] memory: brcmstb_memc: Add new DDR attributes
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@...il.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
Powered by blists - more mailing lists