tty: max310x: Fix external crystal register setup [Linux 5.2]

tty: max310x: Fix external crystal register setup [Linux 5.2]

This Linux kernel change "tty: max310x: Fix external crystal register setup" is included in the Linux 5.2 release. This change is authored by Joe Burmeister <joe.burmeister [at]> on Mon May 13 11:23:57 2019 +0100. The commit for this change in Linux stable tree is 5d24f45 (patch).

tty: max310x: Fix external crystal register setup

The datasheet states:

  Bit 4: ClockEnSet the ClockEn bit high to enable an external clocking
(crystal or clock generator at XIN). Set the ClockEn bit to 0 to disable
  Bit 1: CrystalEnSet the CrystalEn bit high to enable the crystal
oscillator. When using an external clock source at XIN, CrystalEn must
be set low.

The bit 4, MAX310X_CLKSRC_EXTCLK_BIT, should be set and was not.

This was required to make the MAX3107 with an external crystal on our
board able to send or receive data.

Signed-off-by: Joe Burmeister <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/tty/serial/max310x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 450ba6d..e5aebbf 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -581,7 +581,7 @@ static int max310x_set_ref_clk(struct device *dev, struct max310x_port *s,

    /* Configure clock source */
+   clksrc = MAX310X_CLKSRC_EXTCLK_BIT | (xtal ? MAX310X_CLKSRC_CRYST_BIT : 0);

    /* Configure PLL */
    if (pllcfg) {

Leave a Reply

Your email address will not be published. Required fields are marked *