Commit ad406341 authored by Rahul Tanwar's avatar Rahul Tanwar Committed by Greg Kroah-Hartman
Browse files

serial: lantiq: Make driver modular

parent ea7d3fd8
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1034,11 +1034,13 @@ config SERIAL_SIFIVE_CONSOLE
	  boot time.)
	  boot time.)


config SERIAL_LANTIQ
config SERIAL_LANTIQ
	bool "Lantiq serial driver"
	tristate "Lantiq serial driver"
	depends on (LANTIQ || X86) || COMPILE_TEST
	depends on (LANTIQ || X86) || COMPILE_TEST
	select SERIAL_CORE
	select SERIAL_CORE
	help
	help
	  Support for UART on Lantiq and Intel SoCs.
	  Support for UART on Lantiq and Intel SoCs.
	  To compile this driver as a module, select M here. The
	  module will be called lantiq.


config SERIAL_LANTIQ_CONSOLE
config SERIAL_LANTIQ_CONSOLE
	bool "Console on Lantiq UART"
	bool "Console on Lantiq UART"
+25 −4
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/io.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/ioport.h>
#include <linux/lantiq.h>
#include <linux/lantiq.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/of_platform.h>
@@ -823,8 +824,7 @@ static void free_irq_intel(struct uart_port *port)
	free_irq(ltq_port->common_irq, port);
	free_irq(ltq_port->common_irq, port);
}
}


static int __init
static int lqasc_probe(struct platform_device *pdev)
lqasc_probe(struct platform_device *pdev)
{
{
	struct device_node *node = pdev->dev.of_node;
	struct device_node *node = pdev->dev.of_node;
	struct ltq_uart_port *ltq_port;
	struct ltq_uart_port *ltq_port;
@@ -908,6 +908,13 @@ lqasc_probe(struct platform_device *pdev)
	return ret;
	return ret;
}
}


static int lqasc_remove(struct platform_device *pdev)
{
	struct uart_port *port = platform_get_drvdata(pdev);

	return uart_remove_one_port(&lqasc_reg, port);
}

static const struct ltq_soc_data soc_data_lantiq = {
static const struct ltq_soc_data soc_data_lantiq = {
	.fetch_irq = fetch_irq_lantiq,
	.fetch_irq = fetch_irq_lantiq,
	.request_irq = request_irq_lantiq,
	.request_irq = request_irq_lantiq,
@@ -925,8 +932,11 @@ static const struct of_device_id ltq_asc_match[] = {
	{ .compatible = "intel,lgm-asc", .data = &soc_data_intel },
	{ .compatible = "intel,lgm-asc", .data = &soc_data_intel },
	{},
	{},
};
};
MODULE_DEVICE_TABLE(of, ltq_asc_match);


static struct platform_driver lqasc_driver = {
static struct platform_driver lqasc_driver = {
	.probe		= lqasc_probe,
	.remove		= lqasc_remove,
	.driver		= {
	.driver		= {
		.name	= DRVNAME,
		.name	= DRVNAME,
		.of_match_table = ltq_asc_match,
		.of_match_table = ltq_asc_match,
@@ -942,10 +952,21 @@ init_lqasc(void)
	if (ret != 0)
	if (ret != 0)
		return ret;
		return ret;


	ret = platform_driver_probe(&lqasc_driver, lqasc_probe);
	ret = platform_driver_register(&lqasc_driver);
	if (ret != 0)
	if (ret != 0)
		uart_unregister_driver(&lqasc_reg);
		uart_unregister_driver(&lqasc_reg);


	return ret;
	return ret;
}
}
device_initcall(init_lqasc);

static void __exit exit_lqasc(void)
{
	platform_driver_unregister(&lqasc_driver);
	uart_unregister_driver(&lqasc_reg);
}

module_init(init_lqasc);
module_exit(exit_lqasc);

MODULE_DESCRIPTION("Serial driver for Lantiq & Intel gateway SoCs");
MODULE_LICENSE("GPL v2");