- * initialise a single serial port from the platform device given
- */
-
-static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
- struct s3c24xx_uart_info *info,
- struct platform_device *platdev)
-{
- struct uart_port *port = &ourport->port;
- struct s3c2410_uartcfg *cfg;
- struct resource *res;
-
- dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);
-
- if (platdev == NULL)
- return -ENODEV;
-
- cfg = s3c24xx_dev_to_cfg(&platdev->dev);
-
- if (port->mapbase != 0)
- return 0;
-
- if (cfg->hwport > 3)
- return -EINVAL;
-
- /* setup info for port */
- port->dev = &platdev->dev;
- ourport->info = info;
-
- /* copy the info in from provided structure */
- ourport->port.fifosize = info->fifosize;
-
- dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport);
-
- port->uartclk = 1;
-
- if (cfg->uart_flags & UPF_CONS_FLOW) {
- dbg("s3c24xx_serial_init_port: enabling flow control\n");
- port->flags |= UPF_CONS_FLOW;
- }
-
- /* sort our the physical and virtual addresses for each UART */
-
- res = platform_get_resource(platdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- printk(KERN_ERR "failed to find memory resource for uart\n");
- return -EINVAL;
- }
-
- dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
-
- port->mapbase = res->start;
- port->membase = (void __iomem *)(res->start - S3C2410_PA_UART);
- port->membase += S3C2410_VA_UART;
- port->irq = platform_get_irq(platdev, 0);
-
- ourport->clk = clk_get(&platdev->dev, "uart");
-
- if (ourport->clk != NULL && !IS_ERR(ourport->clk))
- clk_use(ourport->clk);
-
- dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
- port->mapbase, port->membase, port->irq, port->uartclk);
-
- /* reset the fifos (and setup the uart) */
- s3c24xx_serial_resetport(port, cfg);
- return 0;
-}
-
-/* Device driver serial port probe */
-
-static int probe_index = 0;
-
-int s3c24xx_serial_probe(struct device *_dev,
- struct s3c24xx_uart_info *info)
-{
- struct s3c24xx_uart_port *ourport;
- struct platform_device *dev = to_platform_device(_dev);
- int ret;
-
- dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index);
-
- ourport = &s3c24xx_serial_ports[probe_index];
- probe_index++;
-
- dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
-
- ret = s3c24xx_serial_init_port(ourport, info, dev);
- if (ret < 0)
- goto probe_err;
-
- dbg("%s: adding port\n", __FUNCTION__);
- uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
- dev_set_drvdata(_dev, &ourport->port);
-
- return 0;
-
- probe_err:
- return ret;
-}
-
-int s3c24xx_serial_remove(struct device *_dev)
-{
- struct uart_port *port = s3c24xx_dev_to_port(_dev);
-
- if (port)
- uart_remove_one_port(&s3c24xx_uart_drv, port);
-
- return 0;
-}
-
-/* UART power management code */
-
-#ifdef CONFIG_PM
-
-int s3c24xx_serial_suspend(struct device *dev, u32 state, u32 level)
-{
- struct uart_port *port = s3c24xx_dev_to_port(dev);
-
- if (port && level == SUSPEND_DISABLE)
- uart_suspend_port(&s3c24xx_uart_drv, port);
-
- return 0;
-}
-
-int s3c24xx_serial_resume(struct device *dev, u32 level)
-{
- struct uart_port *port = s3c24xx_dev_to_port(dev);
- struct s3c24xx_uart_port *ourport = to_ourport(port);
-
- if (port && level == RESUME_ENABLE) {
- clk_enable(ourport->clk);
- s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
- clk_disable(ourport->clk);
-
- uart_resume_port(&s3c24xx_uart_drv, port);
- }
-
- return 0;
-}
-
-#else
-#define s3c24xx_serial_suspend NULL
-#define s3c24xx_serial_resume NULL
-#endif
-
-int s3c24xx_serial_init(struct device_driver *drv,
- struct s3c24xx_uart_info *info)
-{
- dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
- return driver_register(drv);
-}
-
-
-/* now comes the code to initialise either the s3c2410 or s3c2440 serial
- * port information