Skip to content

Commit f674aac

Browse files
Chunyan Zhangbroonie
authored andcommitted
spi: sprd: fill offset only to RD_CMD register for reading from slave device
RD_CMD can accept slave address offset only, higher bits are reserved. Writing the whole slave address including slave base seems unnecessary. Signed-off-by: Chunyan Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2b961c5 commit f674aac

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/spi/spi-sprd-adi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg, u32 *read_val)
159159
{
160160
int read_timeout = ADI_READ_TIMEOUT;
161161
unsigned long flags;
162-
u32 val, rd_addr, paddr;
162+
u32 val, rd_addr;
163163
int ret = 0;
164164

165165
if (sadi->hwlock) {
@@ -177,11 +177,10 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg, u32 *read_val)
177177
goto out;
178178

179179
/*
180-
* Set the physical register address need to read into RD_CMD register,
180+
* Set the slave address offset need to read into RD_CMD register,
181181
* then ADI controller will start to transfer automatically.
182182
*/
183-
paddr = sadi->slave_pbase + reg;
184-
writel_relaxed(paddr, sadi->base + REG_ADI_RD_CMD);
183+
writel_relaxed(reg, sadi->base + REG_ADI_RD_CMD);
185184

186185
/*
187186
* Wait read operation complete, the BIT_RD_CMD_BUSY will be set
@@ -211,9 +210,9 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg, u32 *read_val)
211210
*/
212211
rd_addr = (val & RD_ADDR_MASK) >> RD_ADDR_SHIFT;
213212

214-
if (rd_addr != (paddr & REG_ADDR_LOW_MASK)) {
213+
if (rd_addr != (reg & REG_ADDR_LOW_MASK)) {
215214
dev_err(sadi->dev, "read error, reg addr = 0x%x, val = 0x%x\n",
216-
paddr, val);
215+
reg, val);
217216
ret = -EIO;
218217
goto out;
219218
}

0 commit comments

Comments
 (0)