/* Configure ELM module based on BCH level. Set mode as continuous mode. Currently we are using only syndrome 0 and syndromes 1 to 6 are not used. Also, the mode is set only for syndrome 0  */
int elm_config(enum bch_level level)
/* Configure ELM module based on BCH level. Set mode as continuous mode. Currently we are using only syndrome 0 and syndromes 1 to 6 are not used. Also, the mode is set only for syndrome 0  */
int elm_config(enum bch_level level)
{
	u32 val;
	u8 poly = ELM_DEFAULT_POLY;
	u32 buffer_size = 0x7FF;
	val = (u32)(level) & ELM_LOCATION_CONFIG_ECC_BCH_LEVEL_MASK;
	val |= ((buffer_size << ELM_LOCATION_CONFIG_ECC_SIZE_POS) &
				ELM_LOCATION_CONFIG_ECC_SIZE_MASK);
	writel(val, &elm_cfg->location_config);
	writel((readl(&elm_cfg->irqenable) | (0x1 << poly)),
			&elm_cfg->irqenable);
	writel((readl(&elm_cfg->page_ctrl) & ~(0x1 << poly)),
			&elm_cfg->page_ctrl);
	return 0;
}