Skip to contentSkip to conversation

mips: decrease size of au1xxx_dbdma_pm_regs[][]

PATCH In review Roel Kluin 2 participants 3 messages Jul 21, 2009 MIPS

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 mips: decrease size of au1xxx_dbdma_pm_regs[][]

Only registers [0-DDMA_CHANNEL_BASE][0-6] are used by the suspend and resume routines.

---
These routines are on the bottom of the file. Only used are registers:

au1xxx_dbdma_pm_regs[0][0-3]

and

au1xxx_dbdma_pm_regs[1-NUM_DBDMA_CHANS][0-6]

Is my patch right, that assumes that the array can be smaller, or should the storage and recovery of other registers be added?

Roel

arch/mips/alchemy/common/dbdma.c +1 -1
index 3ab6d80..bf48a21 100644
@@ -175,7 +175,7 @@ static dbdev_tab_t dbdev_tab[] = {
 #define DBDEV_TAB_SIZE	ARRAY_SIZE(dbdev_tab)
 
 #ifdef CONFIG_PM
-static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS + 1][8];
+static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS][7];
 #endif
 
 
#1 lore raw

Hi Roel,

Quoted 8 lines · Roel Kluin

Only registers [0-DDMA_CHANNEL_BASE][0-6] are used by the suspend and resume routines.

---
These routines are on the bottom of the file. Only used are registers:

Quoted 8 lines

au1xxx_dbdma_pm_regs[0][0-3]

and

au1xxx_dbdma_pm_regs[1-NUM_DBDMA_CHANS][0-6]

Is my patch right, that assumes that the array can be smaller, or should the storage and recovery of other registers be added?

Actually, I think there's a bug in the save/restore functions.

This:
for (i = 1, addr = DDMA_CHANNEL_BASE; i < NUM_DBDMA_CHANS; i++) {

should be changed to
for (i = 1, addr = DDMA_CHANNEL_BASE; i <= NUM_DBDMA_CHANS; i++)

as there are 16 individual channels (NUM_DBDMA_CHANS) to save/restore plus the global ddma block config (the +1).
And looking closer at it, the last register in a channel can be skipped since it's
read-only (at offset 0x18).

So, 6 slots per channel for 16 channels plus one row for the ddma global config are enough:

static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS + 1][6];

Thanks!
Manuel Lauss

#2 lore raw
In reply to Roel Kluin

Hi Roel,

Quoted 8 lines · Roel Kluin

Only registers [0-DDMA_CHANNEL_BASE][0-6] are used by the suspend and resume routines.

---
These routines are on the bottom of the file. Only used are registers:

Quoted 8 lines

au1xxx_dbdma_pm_regs[0][0-3]

and

au1xxx_dbdma_pm_regs[1-NUM_DBDMA_CHANS][0-6]

Is my patch right, that assumes that the array can be smaller, or should the storage and recovery of other registers be added?

Actually, I think there's a bug in the save/restore functions.

This:
for (i = 1, addr = DDMA_CHANNEL_BASE; i < NUM_DBDMA_CHANS; i++) {

should be changed to
for (i = 1, addr = DDMA_CHANNEL_BASE; i <= NUM_DBDMA_CHANS; i++)

as there are 16 individual channels (NUM_DBDMA_CHANS) to save/restore plus the global ddma block config (the +1).
And looking closer at it, the last register in a channel can be skipped since it's
read-only (at offset 0x18).

So, 6 slots per channel for 16 channels plus one row for the ddma global config are enough:

static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS + 1][6];

Thanks!
Manuel Lauss