39#define MEMSCRUB_ERR_OK 0
40#define MEMSCRUB_ERR_EINVAL -1
41#define MEMSCRUB_ERR_ERROR -2
43extern void memscrub_register_drv(
void);
48#define CONFIG_DELAY_BIT 8
49#define CONFIG_IRQD_BIT 7
50#define CONFIG_SERA_BIT 5
51#define CONFIG_LOOP_BIT 4
52#define CONFIG_MODE_BIT 2
53#define CONFIG_ES_BIT 1
54#define CONFIG_SCEN_BIT 0
56#define CONFIG_DELAY (0xff << CONFIG_DELAY_BIT)
57#define CONFIG_IRQD (0x1 << CONFIG_IRQD_BIT)
58#define CONFIG_SERA (0x1 << CONFIG_SERA_BIT)
59#define CONFIG_LOOP (0x1 << CONFIG_LOOP_BIT)
60#define CONFIG_MODE (0x3 << CONFIG_MODE_BIT)
61#define CONFIG_ES (0x1 << CONFIG_ES_BIT)
62#define CONFIG_SCEN (0x1 << CONFIG_SCEN_BIT)
63#define CONFIG_MODE_SCRUB (0x0 << CONFIG_MODE_BIT)
64#define CONFIG_MODE_REGEN (0x1 << CONFIG_MODE_BIT)
65#define CONFIG_MODE_INIT (0x2 << CONFIG_MODE_BIT)
67#define MEMSCRUB_OPTIONS_INTERRUPTDONE_ENABLE CONFIG_IRQD
68#define MEMSCRUB_OPTIONS_INTERRUPTDONE_DISABLE 0
69#define MEMSCRUB_OPTIONS_EXTERNALSTART_ENABLE CONFIG_ES
70#define MEMSCRUB_OPTIONS_EXTERNALSTART_DISABLE 0
71#define MEMSCRUB_OPTIONS_LOOPMODE_ENABLE CONFIG_LOOP
72#define MEMSCRUB_OPTIONS_LOOPMODE_DISABLE 0
73#define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_ENABLE CONFIG_SERA
74#define MEMSCRUB_OPTIONS_SECONDARY_MEMRANGE_DISABLE 0
77extern int memscrub_init_start(uint32_t value, uint8_t delay,
int options);
78extern int memscrub_scrub_start(uint8_t delay,
int options);
79extern int memscrub_regen_start(uint8_t delay,
int options);
80extern int memscrub_stop(
void);
81extern int memscrub_active(
void);
84extern int memscrub_range_set(uint32_t start, uint32_t end);
85extern int memscrub_range_get(uint32_t * start, uint32_t * end);
86extern int memscrub_secondary_range_set(uint32_t start, uint32_t end);
87extern int memscrub_secondary_range_get(uint32_t * start, uint32_t * end);
97typedef void (*memscrub_isr_t)(
void *arg, uint32_t ahbaccess,
98 uint32_t ahbstatus, uint32_t scrubstatus);
99extern int memscrub_isr_register(memscrub_isr_t isr,
void * data);
100extern int memscrub_isr_unregister(
void);
102extern int memscrub_error_status(uint32_t *ahbaccess, uint32_t *ahbstatus,
103 uint32_t *scrubstatus);
110#define AHBS_CECNT_BIT 22
111#define AHBS_UECNT_BIT 14
112#define AHBS_DONE_BIT 13
113#define AHBS_SEC_BIT 11
114#define AHBS_SBC_BIT 10
121#define AHBS_CECNT (0x3ff << AHBS_CECNT_BIT)
122#define AHBS_UECNT (0xff << AHBS_UECNT_BIT)
123#define AHBS_DONE (1 << AHBS_DONE_BIT)
124#define AHBS_SEC (1 << AHBS_SEC_BIT)
125#define AHBS_SBC (1 << AHBS_SBC_BIT)
126#define AHBS_CE (1 << AHBS_CE_BIT)
127#define AHBS_NE (1 << AHBS_NE_BIT)
128#define AHBS_HW (1 << AHBS_HW_BIT)
129#define AHBS_HM (0xf << AHBS_HM_BIT)
130#define AHBS_HS (0x7 << AHBS_HS_BIT)
135#define STAT_RUNCOUNT_BIT 22
136#define STAT_BLKCOUNT_BIT 14
137#define STAT_DONE_BIT 13
138#define STAT_BURSTLEN_BIT 1
139#define STAT_ACTIVE_BIT 0
141#define STAT_RUNCOUNT (0x3ff << STAT_RUNCOUNT_BIT)
142#define STAT_BLKCOUNT (0xff << STAT_BLKCOUNT_BIT)
143#define STAT_DONE (0x1 << STAT_DONE_BIT)
144#define STAT_BURSTLEN (0xf << STAT_BURSTLEN_BIT)
145#define STAT_ACTIVE (0x1 << STAT_ACTIVE_BIT)
150#define AHBERC_CECNTT_BIT 22
151#define AHBERC_UECNTT_BIT 14
152#define AHBERC_CECTE_BIT 1
153#define AHBERC_UECTE_BIT 0
155#define AHBERC_CECNTT (0x3ff << AHBERC_CECNTT_BIT)
156#define AHBERC_UECNTT (0xff << AHBERC_UECNTT_BIT)
157#define AHBERC_CECTE (0x1 << AHBERC_CECTE_BIT)
158#define AHBERC_UECTE (0x1 << AHBERC_UECTE_BIT)
163#define ETHRES_RECT_BIT 22
164#define ETHRES_BECT_BIT 14
165#define ETHRES_RECTE_BIT 1
166#define ETHRES_BECTE_BIT 0
168#define ETHRES_RECT (0x3ff << ETHRES_RECT_BIT)
169#define ETHRES_BECT (0xff << ETHRES_BECT_BIT)
170#define ETHRES_RECTE (0x1 << ETHRES_RECTE_BIT)
171#define ETHRES_BECTE (0x1 << ETHRES_BECTE_BIT)
173#define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_ENABLE AHBERC_CECTE
174#define MEMSCRUB_OPTIONS_AHBERROR_CORTHRES_DISABLE 0
175#define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_ENABLE AHBERC_UECTE
176#define MEMSCRUB_OPTIONS_AHBERROR_UNCORTHRES_DISABLE 0
177#define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_ENABLE ETHRES_RECTE
178#define MEMSCRUB_OPTIONS_SCRUBERROR_RUNTHRES_DISABLE 0
179#define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_ENABLE ETHRES_BECTE
180#define MEMSCRUB_OPTIONS_SCRUBERROR_BLOCKTHRES_DISABLE 0
181extern int memscrub_ahberror_setup(
int uethres,
int cethres,
int options);
182extern int memscrub_scruberror_setup(
int blkthres,
int runthres,
185extern int memscrub_scrub_position(uint32_t * position);