I have been following up on this problem, and nothing seems to change the values of PHAFLTREN and PHBFLTREN, below is how my initialization of the FTM module is done in the kernel driver at boot time. I verify the settings of the FTM_SC registers and the FTM_FILTER to this:
ftm-quaddec QDCTRL register: PHAFLTREN=0 PHBFLTREN=0 PHAPOL=0 PHBPOL=0 QUADMODE=0 QUADDIR=0 TOFDIR=0 QUADEN=1 flag=1
ftm-quaddec C0SC=85 C1SC=85 ftm_filter=ffff
static int initialize_ftm_quaddec(void __iomem *ftm_base)
{
uint8_t flag = 0x0;
clear_write_protection(ftm_base);
/* Do not write in the region from the CNTIN register through the
PWMLOAD register when FTMEN = 0. */
ftm_write(ftm_base,FTM_MODE, FTM_MODE_FTMEN);
/* Set the CTNIN - MOD range 0x0000-0xFFFF */
ftm_write(ftm_base,FTM_CNTIN, 0x0);
ftm_write(ftm_base,FTM_MOD, 0xffff);
/* Reset CNT to CNTIN by writing any value */
ftm_write(ftm_base,FTM_CNT, 0x0);
flag = 0x0;
/* interrupts not used; */
/* Prescale divide by 1 => 0 */
/* Stop the clock CLKS */
flag |= FTM_SC_PS_1;
ftm_write(ftm_base,FTM_SC, flag);
/* Set channels 0, 1, 2, and 3 to output compare mode */
ftm_write(ftm_base, FTM_C0SC, 0x14); /* channel 0 as output compare */
ftm_write(ftm_base, FTM_C1SC, 0x14); /* channel 1 as output compare */
ftm_write(ftm_base, FTM_C2SC, 0x14); /* channel 1 as output compare */
ftm_write(ftm_base, FTM_C3SC, 0x14); /* channel 1 as output compare */
ftm_write(ftm_base, FTM_FILTER, 0xffff); /* max filter on PHA and PHB */
flag = 0x0;
/* input filters not used */
/* use normal polarity */
/* Phase A and Phase B encoding mode */
flag |= FTM_QDCTRL_QUADEN; /* QUADEN Enable Quadrature Decode mode */
flag |= FTM_QDCTRL_PHAFLTREN; /* enable PHA filter */
flag |= FTM_QDCTRL_PHBFLTREN; /* enable PHB filter */
ftm_write(ftm_base,FTM_QDCTRL, flag);
decode_QDCTRL(ftm_base,NULL);
/* Reset channels 0, 1, 2, and 3 to input mode */
ftm_write(ftm_base, FTM_C0SC, 5); /* channel 0 as input */
ftm_write(ftm_base, FTM_C1SC, 5); /* channel 1 as input */
ftm_write(ftm_base, FTM_C2SC, 5); /* channel 1 as input */
ftm_write(ftm_base, FTM_C3SC, 5); /* channel 1 as input */
decode_QDCTRL(ftm_base,NULL);
decode_filters(ftm_base,NULL);
/* Unused features and reset to default section */
ftm_write(ftm_base,FTM_POL, 0x0); /* Define the POL bits. */
/* all channels active high */
ftm_write(ftm_base,FTM_FLTCTRL, 0x0); /* all faults disabled */
ftm_write(ftm_base,FTM_SYNCONF, 0x0); /* disable all sync */
ftm_write(ftm_base,FTM_SYNC, 0xffff);
/* lock the FTM */
set_write_protection(ftm_base);
return 0;
}