Commit e5c5c8d2 authored by Valentin Longchamp's avatar Valentin Longchamp Committed by Scott Wood

soc/fsl/qe: only apply QE_General4 workaround on affected SoCs

The QE_General4 workaround is only valid for the MPC832x and MPC836x
SoCs. The other SoCs that embed a QUICC engine are not affected by this
hardware bug and thus can use the computed divisors (this was
successfully tested on the T1040).

Similalry to what was done in commit 8ce795cb ("i2c: mpc: assign the
correct prescaler from SVR") in order to avoid changes in
the device tree nodes of the QE (with maybe a variant of the compatible
property), the PVR reg is read out to find out if the workaround must be
applied or not.
Signed-off-by: default avatarValentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: default avatarScott Wood <oss@buserror.net>
parent 2ccf80b7
...@@ -200,6 +200,9 @@ unsigned int qe_get_brg_clk(void) ...@@ -200,6 +200,9 @@ unsigned int qe_get_brg_clk(void)
} }
EXPORT_SYMBOL(qe_get_brg_clk); EXPORT_SYMBOL(qe_get_brg_clk);
#define PVR_VER_836x 0x8083
#define PVR_VER_832x 0x8084
/* Program the BRG to the given sampling rate and multiplier /* Program the BRG to the given sampling rate and multiplier
* *
* @brg: the BRG, QE_BRG1 - QE_BRG16 * @brg: the BRG, QE_BRG1 - QE_BRG16
...@@ -226,8 +229,9 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) ...@@ -226,8 +229,9 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)
/* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says
that the BRG divisor must be even if you're not using divide-by-16 that the BRG divisor must be even if you're not using divide-by-16
mode. */ mode. */
if (!div16 && (divisor & 1) && (divisor > 3)) if (pvr_version_is(PVR_VER_836x) || pvr_version_is(PVR_VER_832x))
divisor++; if (!div16 && (divisor & 1) && (divisor > 3))
divisor++;
tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
QE_BRGC_ENABLE | div16; QE_BRGC_ENABLE | div16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment