Commit f233ea43 authored by Alexander Shiyan's avatar Alexander Shiyan Committed by Greg Kroah-Hartman
Browse files

serial: max310x: Correction of the initial setting of the MODE1 bits for various supported ICs.



The MODE1 register bits have different values for different ICs.
This patch corrects the initial setting of this register in accordance
with the datasheets, which will allow you to get the expected values
when debugging the driver.

Signed-off-by: default avatarAlexander Shiyan <shc_work@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c6a2583
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -248,6 +248,7 @@
struct max310x_devtype {
struct max310x_devtype {
	char	name[9];
	char	name[9];
	int	nr;
	int	nr;
	u8	mode1;
	int	(*detect)(struct device *);
	int	(*detect)(struct device *);
	void	(*power)(struct uart_port *, int);
	void	(*power)(struct uart_port *, int);
};
};
@@ -410,6 +411,7 @@ static void max14830_power(struct uart_port *port, int on)
static const struct max310x_devtype max3107_devtype = {
static const struct max310x_devtype max3107_devtype = {
	.name	= "MAX3107",
	.name	= "MAX3107",
	.nr	= 1,
	.nr	= 1,
	.mode1	= MAX310X_MODE1_AUTOSLEEP_BIT | MAX310X_MODE1_IRQSEL_BIT,
	.detect	= max3107_detect,
	.detect	= max3107_detect,
	.power	= max310x_power,
	.power	= max310x_power,
};
};
@@ -417,6 +419,7 @@ static const struct max310x_devtype max3107_devtype = {
static const struct max310x_devtype max3108_devtype = {
static const struct max310x_devtype max3108_devtype = {
	.name	= "MAX3108",
	.name	= "MAX3108",
	.nr	= 1,
	.nr	= 1,
	.mode1	= MAX310X_MODE1_AUTOSLEEP_BIT,
	.detect	= max3108_detect,
	.detect	= max3108_detect,
	.power	= max310x_power,
	.power	= max310x_power,
};
};
@@ -424,6 +427,7 @@ static const struct max310x_devtype max3108_devtype = {
static const struct max310x_devtype max3109_devtype = {
static const struct max310x_devtype max3109_devtype = {
	.name	= "MAX3109",
	.name	= "MAX3109",
	.nr	= 2,
	.nr	= 2,
	.mode1	= MAX310X_MODE1_AUTOSLEEP_BIT,
	.detect	= max3109_detect,
	.detect	= max3109_detect,
	.power	= max310x_power,
	.power	= max310x_power,
};
};
@@ -431,6 +435,7 @@ static const struct max310x_devtype max3109_devtype = {
static const struct max310x_devtype max14830_devtype = {
static const struct max310x_devtype max14830_devtype = {
	.name	= "MAX14830",
	.name	= "MAX14830",
	.nr	= 4,
	.nr	= 4,
	.mode1	= MAX310X_MODE1_IRQSEL_BIT,
	.detect	= max14830_detect,
	.detect	= max14830_detect,
	.power	= max14830_power,
	.power	= max14830_power,
};
};
@@ -1257,9 +1262,8 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
				    MAX310X_BRGDIVLSB_REG + offs, &ret);
				    MAX310X_BRGDIVLSB_REG + offs, &ret);
		} while (ret != 0x01);
		} while (ret != 0x01);


		regmap_update_bits(s->regmap, MAX310X_MODE1_REG + offs,
		regmap_write(s->regmap, MAX310X_MODE1_REG + offs,
				   MAX310X_MODE1_AUTOSLEEP_BIT,
			     devtype->mode1);
				   MAX310X_MODE1_AUTOSLEEP_BIT);
	}
	}


	uartclk = max310x_set_ref_clk(dev, s, freq, xtal);
	uartclk = max310x_set_ref_clk(dev, s, freq, xtal);
@@ -1293,10 +1297,6 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
		max310x_port_write(&s->p[i].port, MAX310X_IRQEN_REG, 0);
		max310x_port_write(&s->p[i].port, MAX310X_IRQEN_REG, 0);
		/* Clear IRQ status register */
		/* Clear IRQ status register */
		max310x_port_read(&s->p[i].port, MAX310X_IRQSTS_REG);
		max310x_port_read(&s->p[i].port, MAX310X_IRQSTS_REG);
		/* Enable IRQ pin */
		max310x_port_update(&s->p[i].port, MAX310X_MODE1_REG,
				    MAX310X_MODE1_IRQSEL_BIT,
				    MAX310X_MODE1_IRQSEL_BIT);
		/* Initialize queue for start TX */
		/* Initialize queue for start TX */
		INIT_WORK(&s->p[i].tx_work, max310x_wq_proc);
		INIT_WORK(&s->p[i].tx_work, max310x_wq_proc);
		/* Initialize queue for changing LOOPBACK mode */
		/* Initialize queue for changing LOOPBACK mode */