Skip to content

Commit

Permalink
memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
Browse files Browse the repository at this point in the history
RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
which is already part of struct rpcif.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20211025205631.21151-7-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
  • Loading branch information
Lad Prabhakar authored and Krzysztof Kozlowski committed Nov 16, 2021
1 parent 818fdfa commit 5da9b59
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/memory/renesas-rpc-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@
#define RPCIF_PHYINT 0x0088 /* R/W */
#define RPCIF_PHYINT_WPVAL BIT(1)

#define RPCIF_DIRMAP_SIZE 0x4000000

static const struct regmap_range rpcif_volatile_ranges[] = {
regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
Expand Down Expand Up @@ -588,8 +586,8 @@ static void memcpy_fromio_readw(void *to,

ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
{
loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
size_t size = RPCIF_DIRMAP_SIZE - from;
loff_t from = offs & (rpc->size - 1);
size_t size = rpc->size - from;

if (len > size)
len = size;
Expand Down

0 comments on commit 5da9b59

Please sign in to comment.