Commit bed25ac0 authored by Michal Simek's avatar Michal Simek Committed by Greg Kroah-Hartman

serial: uartps: Move Port ID to device data structure

Record port ID in device data structure to be have it connected to
certain instance.
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 024ca329
...@@ -181,6 +181,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); ...@@ -181,6 +181,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
* @pclk: APB clock * @pclk: APB clock
* @cdns_uart_driver: Pointer to UART driver * @cdns_uart_driver: Pointer to UART driver
* @baud: Current baud rate * @baud: Current baud rate
* @id: Port ID
* @clk_rate_change_nb: Notifier block for clock changes * @clk_rate_change_nb: Notifier block for clock changes
* @quirks: Flags for RXBS support. * @quirks: Flags for RXBS support.
*/ */
...@@ -190,6 +191,7 @@ struct cdns_uart { ...@@ -190,6 +191,7 @@ struct cdns_uart {
struct clk *pclk; struct clk *pclk;
struct uart_driver *cdns_uart_driver; struct uart_driver *cdns_uart_driver;
unsigned int baud; unsigned int baud;
int id;
struct notifier_block clk_rate_change_nb; struct notifier_block clk_rate_change_nb;
u32 quirks; u32 quirks;
}; };
...@@ -1377,7 +1379,7 @@ MODULE_DEVICE_TABLE(of, cdns_uart_of_match); ...@@ -1377,7 +1379,7 @@ MODULE_DEVICE_TABLE(of, cdns_uart_of_match);
*/ */
static int cdns_uart_probe(struct platform_device *pdev) static int cdns_uart_probe(struct platform_device *pdev)
{ {
int rc, id, irq; int rc, irq;
struct uart_port *port; struct uart_port *port;
struct resource *res; struct resource *res;
struct cdns_uart *cdns_uart_data; struct cdns_uart *cdns_uart_data;
...@@ -1403,18 +1405,18 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1403,18 +1405,18 @@ static int cdns_uart_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
/* Look for a serialN alias */ /* Look for a serialN alias */
id = of_alias_get_id(pdev->dev.of_node, "serial"); cdns_uart_data->id = of_alias_get_id(pdev->dev.of_node, "serial");
if (id < 0) if (cdns_uart_data->id < 0)
id = 0; cdns_uart_data->id = 0;
if (id >= CDNS_UART_NR_PORTS) { if (cdns_uart_data->id >= CDNS_UART_NR_PORTS) {
dev_err(&pdev->dev, "Cannot get uart_port structure\n"); dev_err(&pdev->dev, "Cannot get uart_port structure\n");
return -ENODEV; return -ENODEV;
} }
/* There is a need to use unique driver name */ /* There is a need to use unique driver name */
driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d", driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d",
CDNS_UART_NAME, id); CDNS_UART_NAME, cdns_uart_data->id);
if (!driver_name) if (!driver_name)
return -ENOMEM; return -ENOMEM;
...@@ -1422,7 +1424,7 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1422,7 +1424,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
cdns_uart_uart_driver->driver_name = driver_name; cdns_uart_uart_driver->driver_name = driver_name;
cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME; cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME;
cdns_uart_uart_driver->major = CDNS_UART_MAJOR; cdns_uart_uart_driver->major = CDNS_UART_MAJOR;
cdns_uart_uart_driver->minor = id; cdns_uart_uart_driver->minor = cdns_uart_data->id;
cdns_uart_uart_driver->nr = 1; cdns_uart_uart_driver->nr = 1;
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
...@@ -1433,7 +1435,7 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1433,7 +1435,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME, strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME,
sizeof(cdns_uart_console->name)); sizeof(cdns_uart_console->name));
cdns_uart_console->index = id; cdns_uart_console->index = cdns_uart_data->id;
cdns_uart_console->write = cdns_uart_console_write; cdns_uart_console->write = cdns_uart_console_write;
cdns_uart_console->device = uart_console_device; cdns_uart_console->device = uart_console_device;
cdns_uart_console->setup = cdns_uart_console_setup; cdns_uart_console->setup = cdns_uart_console_setup;
...@@ -1455,7 +1457,7 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1455,7 +1457,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
* registration because tty_driver structure is not filled. * registration because tty_driver structure is not filled.
* name_base is 0 by default. * name_base is 0 by default.
*/ */
cdns_uart_uart_driver->tty_driver->name_base = id; cdns_uart_uart_driver->tty_driver->name_base = cdns_uart_data->id;
match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
if (match && match->data) { if (match && match->data) {
......
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