diff options
Diffstat (limited to 'drivers/tty/serial')
| -rw-r--r-- | drivers/tty/serial/8250/8250.c | 2 | ||||
| -rw-r--r-- | drivers/tty/serial/amba-pl011.c | 45 | ||||
| -rw-r--r-- | drivers/tty/serial/serial_txx9.c | 2 | ||||
| -rw-r--r-- | drivers/tty/serial/sh-sci.c | 38 | 
4 files changed, 67 insertions, 20 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 47d061b9ad4..6e1958a325b 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c @@ -3113,7 +3113,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *  /**   *	serial8250_register_8250_port - register a serial port - *	@port: serial port template + *	@up: serial port template   *   *	Configure the serial port specified by the request. If the   *	port exists and is in use, it is hung up and unregistered diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 4ad721fb840..c17923ec6e9 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -133,6 +133,10 @@ struct pl011_dmatx_data {  struct uart_amba_port {  	struct uart_port	port;  	struct clk		*clk; +	/* Two optional pin states - default & sleep */ +	struct pinctrl		*pinctrl; +	struct pinctrl_state	*pins_default; +	struct pinctrl_state	*pins_sleep;  	const struct vendor_data *vendor;  	unsigned int		dmacr;		/* dma control reg */  	unsigned int		im;		/* interrupt mask */ @@ -1312,6 +1316,14 @@ static int pl011_startup(struct uart_port *port)  	unsigned int cr;  	int retval; +	/* Optionaly enable pins to be muxed in and configured */ +	if (!IS_ERR(uap->pins_default)) { +		retval = pinctrl_select_state(uap->pinctrl, uap->pins_default); +		if (retval) +			dev_err(port->dev, +				"could not set default pins\n"); +	} +  	retval = clk_prepare(uap->clk);  	if (retval)  		goto out; @@ -1420,6 +1432,7 @@ static void pl011_shutdown(struct uart_port *port)  {  	struct uart_amba_port *uap = (struct uart_amba_port *)port;  	unsigned int cr; +	int retval;  	/*  	 * disable all interrupts @@ -1462,6 +1475,14 @@ static void pl011_shutdown(struct uart_port *port)  	 */  	clk_disable(uap->clk);  	clk_unprepare(uap->clk); +	/* Optionally let pins go into sleep states */ +	if (!IS_ERR(uap->pins_sleep)) { +		retval = pinctrl_select_state(uap->pinctrl, uap->pins_sleep); +		if (retval) +			dev_err(port->dev, +				"could not set pins to sleep state\n"); +	} +  	if (uap->port.dev->platform_data) {  		struct amba_pl011_data *plat; @@ -1792,6 +1813,14 @@ static int __init pl011_console_setup(struct console *co, char *options)  	if (!uap)  		return -ENODEV; +	/* Allow pins to be muxed in and configured */ +	if (!IS_ERR(uap->pins_default)) { +		ret = pinctrl_select_state(uap->pinctrl, uap->pins_default); +		if (ret) +			dev_err(uap->port.dev, +				"could not set default pins\n"); +	} +  	ret = clk_prepare(uap->clk);  	if (ret)  		return ret; @@ -1844,7 +1873,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)  {  	struct uart_amba_port *uap;  	struct vendor_data *vendor = id->data; -	struct pinctrl *pinctrl;  	void __iomem *base;  	int i, ret; @@ -1869,11 +1897,20 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)  		goto free;  	} -	pinctrl = devm_pinctrl_get_select_default(&dev->dev); -	if (IS_ERR(pinctrl)) { -		ret = PTR_ERR(pinctrl); +	uap->pinctrl = devm_pinctrl_get(&dev->dev); +	if (IS_ERR(uap->pinctrl)) { +		ret = PTR_ERR(uap->pinctrl);  		goto unmap;  	} +	uap->pins_default = pinctrl_lookup_state(uap->pinctrl, +						 PINCTRL_STATE_DEFAULT); +	if (IS_ERR(uap->pins_default)) +		dev_err(&dev->dev, "could not get default pinstate\n"); + +	uap->pins_sleep = pinctrl_lookup_state(uap->pinctrl, +					       PINCTRL_STATE_SLEEP); +	if (IS_ERR(uap->pins_sleep)) +		dev_dbg(&dev->dev, "could not get sleep pinstate\n");  	uap->clk = clk_get(&dev->dev, NULL);  	if (IS_ERR(uap->clk)) { diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 34bd345da77..6ae2a58d62f 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -466,7 +466,7 @@ static void serial_txx9_break_ctl(struct uart_port *port, int break_state)  	spin_unlock_irqrestore(&up->port.lock, flags);  } -#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || (CONFIG_CONSOLE_POLL) +#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || defined(CONFIG_CONSOLE_POLL)  /*   *	Wait for transmitter & holding register to empty   */ diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 4604153b795..1bd9163bc11 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2179,6 +2179,16 @@ static int __devinit sci_init_single(struct platform_device *dev,  	return 0;  } +static void sci_cleanup_single(struct sci_port *port) +{ +	sci_free_gpios(port); + +	clk_put(port->iclk); +	clk_put(port->fclk); + +	pm_runtime_disable(port->port.dev); +} +  #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE  static void serial_console_putchar(struct uart_port *port, int ch)  { @@ -2360,14 +2370,10 @@ static int sci_remove(struct platform_device *dev)  	cpufreq_unregister_notifier(&port->freq_transition,  				    CPUFREQ_TRANSITION_NOTIFIER); -	sci_free_gpios(port); -  	uart_remove_one_port(&sci_uart_driver, &port->port); -	clk_put(port->iclk); -	clk_put(port->fclk); +	sci_cleanup_single(port); -	pm_runtime_disable(&dev->dev);  	return 0;  } @@ -2385,14 +2391,20 @@ static int __devinit sci_probe_single(struct platform_device *dev,  			   index+1, SCI_NPORTS);  		dev_notice(&dev->dev, "Consider bumping "  			   "CONFIG_SERIAL_SH_SCI_NR_UARTS!\n"); -		return 0; +		return -EINVAL;  	}  	ret = sci_init_single(dev, sciport, index, p);  	if (ret)  		return ret; -	return uart_add_one_port(&sci_uart_driver, &sciport->port); +	ret = uart_add_one_port(&sci_uart_driver, &sciport->port); +	if (ret) { +		sci_cleanup_single(sciport); +		return ret; +	} + +	return 0;  }  static int __devinit sci_probe(struct platform_device *dev) @@ -2413,24 +2425,22 @@ static int __devinit sci_probe(struct platform_device *dev)  	ret = sci_probe_single(dev, dev->id, p, sp);  	if (ret) -		goto err_unreg; +		return ret;  	sp->freq_transition.notifier_call = sci_notifier;  	ret = cpufreq_register_notifier(&sp->freq_transition,  					CPUFREQ_TRANSITION_NOTIFIER); -	if (unlikely(ret < 0)) -		goto err_unreg; +	if (unlikely(ret < 0)) { +		sci_cleanup_single(sp); +		return ret; +	}  #ifdef CONFIG_SH_STANDARD_BIOS  	sh_bios_gdb_detach();  #endif  	return 0; - -err_unreg: -	sci_remove(dev); -	return ret;  }  static int sci_suspend(struct device *dev)  |