20#define MEMSCRUB_ERR_OK 0
21#define MEMSCRUB_ERR_EINVAL -1
22#define MEMSCRUB_ERR_ERROR -2
24extern void memscrub_register_drv(
void);
29#define CONFIG_DELAY_BIT 8
30#define CONFIG_IRQD_BIT 7
31#define CONFIG_SERA_BIT 5
32#define CONFIG_LOOP_BIT 4
33#define CONFIG_MODE_BIT 2
34#define CONFIG_ES_BIT 1
35#define CONFIG_SCEN_BIT 0
37#define CONFIG_DELAY (0xff << CONFIG_DELAY_BIT)
38#define CONFIG_IRQD (0x1 << CONFIG_IRQD_BIT)
39#define CONFIG_SERA (0x1 << CONFIG_SERA_BIT)
40#define CONFIG_LOOP (0x1 << CONFIG_LOOP_BIT)
41#define CONFIG_MODE (0x3 << CONFIG_MODE_BIT)
42#define CONFIG_ES (0x1 << CONFIG_ES_BIT)
43#define CONFIG_SCEN (0x1 << CONFIG_SCEN_BIT)
44#define CONFIG_MODE_SCRUB (0x0 << CONFIG_MODE_BIT)
45#define CONFIG_MODE_REGEN (0x1 << CONFIG_MODE_BIT)
46#define CONFIG_MODE_INIT (0x2 << CONFIG_MODE_BIT)
48#define MEMSCRUB_OPTIONS_INTERRUPTDONE_ENABLE CONFIG_IRQD
49#define MEMSCRUB_OPTIONS_INTERRUPTDONE_DISABLE 0
50#define MEMSCRUB_OPTIONS_EXTERNALSTART_ENABLE CONFIG_ES
51#define MEMSCRUB_OPTIONS_EXTERNALSTART_DISABLE 0
52#define MEMSCRUB_OPTIONS_LOOPMODE_ENABLE CONFIG_LOOP
53#define MEMSCRUB_OPTIONS_LOOPMODE_DISABLE 0
54#define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_ENABLE CONFIG_SERA
55#define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_DISABLE 0
58extern int memscrub_init_start(uint32_t value, uint8_t delay,
int options);
59extern int memscrub_scrub_start(uint8_t delay,
int options);
60extern int memscrub_regen_start(uint8_t delay,
int options);
61extern int memscrub_stop(
void);
62extern int memscrub_active(
void);
65extern int memscrub_range_set(uint32_t start, uint32_t end);
66extern int memscrub_range_get(uint32_t * start, uint32_t * end);
67extern int memscrub_secondary_range_set(uint32_t start, uint32_t end);
68extern int memscrub_secondary_range_get(uint32_t * start, uint32_t * end);
78typedef void (*memscrub_isr_t)(
void *arg, uint32_t ahbaccess,
79 uint32_t ahbstatus, uint32_t scrubstatus);
80extern int memscrub_isr_register(memscrub_isr_t isr,
void * data);
81extern int memscrub_isr_unregister(
void);
83extern int memscrub_error_status(uint32_t *ahbaccess, uint32_t *ahbstatus,
84 uint32_t *scrubstatus);
91#define AHBS_CECNT_BIT 22
92#define AHBS_UECNT_BIT 14
93#define AHBS_DONE_BIT 13
94#define AHBS_SEC_BIT 11
95#define AHBS_SBC_BIT 10
102#define AHBS_CECNT (0x3ff << AHBS_CECNT_BIT)
103#define AHBS_UECNT (0xff << AHBS_UECNT_BIT)
104#define AHBS_DONE (1 << AHBS_DONE_BIT)
105#define AHBS_SEC (1 << AHBS_SEC_BIT)
106#define AHBS_SBC (1 << AHBS_SBC_BIT)
107#define AHBS_CE (1 << AHBS_CE_BIT)
108#define AHBS_NE (1 << AHBS_NE_BIT)
109#define AHBS_HW (1 << AHBS_HW_BIT)
110#define AHBS_HM (0xf << AHBS_HM_BIT)
111#define AHBS_HS (0x7 << AHBS_HS_BIT)
116#define STAT_RUNCOUNT_BIT 22
117#define STAT_BLKCOUNT_BIT 14
118#define STAT_DONE_BIT 13
119#define STAT_BURSTLEN_BIT 1
120#define STAT_ACTIVE_BIT 0
122#define STAT_RUNCOUNT (0x3ff << STAT_RUNCOUNT_BIT)
123#define STAT_BLKCOUNT (0xff << STAT_BLKCOUNT_BIT)
124#define STAT_DONE (0x1 << STAT_DONE_BIT)
125#define STAT_BURSTLEN (0xf << STAT_BURSTLEN_BIT)
126#define STAT_ACTIVE (0x1 << STAT_ACTIVE_BIT)
131#define AHBERC_CECNTT_BIT 22
132#define AHBERC_UECNTT_BIT 14
133#define AHBERC_CECTE_BIT 1
134#define AHBERC_UECTE_BIT 0
136#define AHBERC_CECNTT (0x3ff << AHBERC_CECNTT_BIT)
137#define AHBERC_UECNTT (0xff << AHBERC_UECNTT_BIT)
138#define AHBERC_CECTE (0x1 << AHBERC_CECTE_BIT)
139#define AHBERC_UECTE (0x1 << AHBERC_UECTE_BIT)
144#define ETHRES_RECT_BIT 22
145#define ETHRES_BECT_BIT 14
146#define ETHRES_RECTE_BIT 1
147#define ETHRES_BECTE_BIT 0
149#define ETHRES_RECT (0x3ff << ETHRES_RECT_BIT)
150#define ETHRES_BECT (0xff << ETHRES_BECT_BIT)
151#define ETHRES_RECTE (0x1 << ETHRES_RECTE_BIT)
152#define ETHRES_BECTE (0x1 << ETHRES_BECTE_BIT)
154#define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_ENABLE AHBERC_CECTE
155#define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_DISABLE 0
156#define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_ENABLE AHBERC_UECTE
157#define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_DISABLE 0
158#define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_ENABLE ETHRES_RECTE
159#define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_DISABLE 0
160#define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_ENABLE ETHRES_BECTE
161#define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_DISABLE 0
162extern int memscrub_ahberror_setup(
int uethres,
int cethres,
int options);
163extern int memscrub_scruberror_setup(
int blkthres,
int runthres,
166extern int memscrub_scrub_position(uint32_t * position);