commit 77bb5901aa535dcba477c2cc082f2196752382fd Author: Philipp Zabel Date: Tue Jun 10 08:33:59 2008 +0200 PXA: support platform hook for serial_pxa_pm Some platforms may need to power up/down devices attached to the serial port. Provide them hooks to be called via serial_pxa_pm. Signed-off-by: Dmitry Baryshkov diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index abc161d..da3889c 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "devices.h" #include "generic.h" @@ -229,6 +230,26 @@ struct platform_device pxa_device_hwuart = { .num_resources = ARRAY_SIZE(pxa_resource_hwuart), }; +void __init pxa_set_ffuart_info(struct pxa_serial_platform_data *info) +{ + pxa_device_ffuart.dev.platform_data = info; +} + +void __init pxa_set_btuart_info(struct pxa_serial_platform_data *info) +{ + pxa_device_btuart.dev.platform_data = info; +} + +void __init pxa_set_stuart_info(struct pxa_serial_platform_data *info) +{ + pxa_device_stuart.dev.platform_data = info; +} + +void __init pxa_set_hwuart_info(struct pxa_serial_platform_data *info) +{ + pxa_device_hwuart.dev.platform_data = info; +} + static struct resource pxai2c_resources[] = { { .start = 0x40301680, diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index b4f7ffb..49323ec 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c @@ -48,7 +48,7 @@ #include #include #include - +#include struct uart_pxa_port { struct uart_port port; @@ -549,11 +549,15 @@ serial_pxa_pm(struct uart_port *port, unsigned int state, unsigned int oldstate) { struct uart_pxa_port *up = (struct uart_pxa_port *)port; + struct pxa_serial_platform_data *info = port->dev->platform_data; if (!state) clk_enable(up->clk); else clk_disable(up->clk); + + if (info && info->pm) + info->pm(to_platform_device(port->dev), oldstate, state); } static void serial_pxa_release_port(struct uart_port *port) diff --git a/include/asm-arm/arch-pxa/serial.h b/include/asm-arm/arch-pxa/serial.h new file mode 100644 index 0000000..1cae3e9 --- /dev/null +++ b/include/asm-arm/arch-pxa/serial.h @@ -0,0 +1,23 @@ +#ifndef PXA_SERIAL_H +#define PXA_SERIAL_H +/* + * Copyright (C) 2008 Dmitry Baryshkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +struct pxa_serial_platform_data { + void (*pm)(struct platform_device *dev, unsigned int oldstate, + unsigned int state); +}; + +extern void pxa_set_ffuart_info(struct pxa_serial_platform_data *info); +extern void pxa_set_btuart_info(struct pxa_serial_platform_data *info); +extern void pxa_set_stuart_info(struct pxa_serial_platform_data *info); +extern void pxa_set_hwuart_info(struct pxa_serial_platform_data *info); + +#endif +