public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] OMAP1: AMS_DELTA: add modem support
@ 2009-07-04  0:06 Janusz Krzysztofik
  2009-07-04  8:57 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-07-04  0:06 UTC (permalink / raw)
  To: Jonathan McDowell
  Cc: Tony Lindgren, linux-omap@vger.kernel.org, linux-serial,
	linux-arm-kernel, linux-kernel@vger.kernel.org

This patch adds support for modem device found on Amstrad E3 (Delta) board.

Patch created against linux-2.6.31-rc1.

Based on earlier patch by Jonathan McDowell, available at 
http://the.earth.li/pub/e3/2.6.19/ams-delta-modem.patch.
Modified after Ladislav Michl's arch/arm/mach-omap1/board-voiceblue.c.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
Registering the modem platform device from a separate arch_initcall (and not from machine_init() callback) preserves serial console port 
at ttyS0.

--- linux-2.6.31-rc1/arch/arm/mach-omap1/board-ams-delta.c.orig	2009-06-27 20:19:50.000000000 +0200
+++ linux-2.6.31-rc1/arch/arm/mach-omap1/board-ams-delta.c	2009-07-04 00:50:46.000000000 +0200
@@ -15,8 +15,11 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
+#include <linux/irq.h>
 #include <linux/platform_device.h>
+#include <linux/serial_8250.h>
 
+#include <asm/serial.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -233,7 +236,39 @@ static void __init ams_delta_init(void)
 
 	omap_usb_init(&ams_delta_usb_config);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
+
+}
+
+static struct plat_serial8250_port ams_delta_modem_ports[] = {
+	{
+		.membase	= (void *) AMS_DELTA_MODEM_VIRT,
+		.mapbase	= AMS_DELTA_MODEM_PHYS,
+		.irq		= OMAP_GPIO_IRQ(2),
+		.flags		= UPF_BOOT_AUTOCONF,
+		.iotype		= UPIO_MEM,
+		.regshift	= 1,
+		.uartclk	= BASE_BAUD * 16,
+	},
+	{ },
+};
+
+static struct platform_device ams_delta_modem_device = {
+	.name	= "serial8250",
+	.id	= PLAT8250_DEV_PLATFORM1,
+	.dev		= {
+		.platform_data = ams_delta_modem_ports,
+	},
+};
+
+static int __init ams_delta_modem_init(void)
+{
+	set_irq_type(OMAP_GPIO_IRQ(2), IRQ_TYPE_EDGE_RISING);
+	ams_delta_latch2_write(
+		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
+		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
+	return platform_device_register(&ams_delta_modem_device);
 }
+arch_initcall(ams_delta_modem_init);
 
 static void __init ams_delta_map_io(void)
 {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [RFC] OMAP1: AMS_DELTA: add modem support
  2009-07-04  0:06 [PATCH] [RFC] OMAP1: AMS_DELTA: add modem support Janusz Krzysztofik
@ 2009-07-04  8:57 ` Felipe Balbi
  2009-07-04 10:03   ` Janusz Krzysztofik
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2009-07-04  8:57 UTC (permalink / raw)
  To: ext Janusz Krzysztofik
  Cc: Jonathan McDowell, Tony Lindgren, linux-omap@vger.kernel.org,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-kernel@vger.kernel.org

Hi,

On Sat, Jul 04, 2009 at 02:06:42AM +0200, ext Janusz Krzysztofik wrote:
> This patch adds support for modem device found on Amstrad E3 (Delta) board.
> 
> Patch created against linux-2.6.31-rc1.
> 
> Based on earlier patch by Jonathan McDowell, available at 
> http://the.earth.li/pub/e3/2.6.19/ams-delta-modem.patch.
> Modified after Ladislav Michl's arch/arm/mach-omap1/board-voiceblue.c.
> 
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> ---
> Registering the modem platform device from a separate arch_initcall (and not from machine_init() callback) preserves serial console port 
> at ttyS0.
> 
> --- linux-2.6.31-rc1/arch/arm/mach-omap1/board-ams-delta.c.orig	2009-06-27 20:19:50.000000000 +0200
> +++ linux-2.6.31-rc1/arch/arm/mach-omap1/board-ams-delta.c	2009-07-04 00:50:46.000000000 +0200
> @@ -15,8 +15,11 @@
>  #include <linux/kernel.h>
>  #include <linux/init.h>
>  #include <linux/input.h>
> +#include <linux/irq.h>
>  #include <linux/platform_device.h>
> +#include <linux/serial_8250.h>
>  
> +#include <asm/serial.h>
>  #include <mach/hardware.h>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -233,7 +236,39 @@ static void __init ams_delta_init(void)
>  
>  	omap_usb_init(&ams_delta_usb_config);
>  	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
> +
> +}
> +
> +static struct plat_serial8250_port ams_delta_modem_ports[] = {
> +	{
> +		.membase	= (void *) AMS_DELTA_MODEM_VIRT,
> +		.mapbase	= AMS_DELTA_MODEM_PHYS,
> +		.irq		= OMAP_GPIO_IRQ(2),

you should avoid OMAP_GPIO_IRQ() and use gpio_to_irq(), but for that
you're gonna need to change ams_delta_modem_init as well:

ams_delta_modem_ports[] = {
	{
		...
		.irq = -EINVAL; /* changed later */
		...
	},

};

> +static int __init ams_delta_modem_init(void)
> +{

	ams_delta_modem_ports[0].irq = gpio_to_irq(2);

> +	set_irq_type(OMAP_GPIO_IRQ(2), IRQ_TYPE_EDGE_RISING);

gpio_to_irq(2);

> +	ams_delta_latch2_write(
> +		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
> +		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
> +	return platform_device_register(&ams_delta_modem_device);
>  }
> +arch_initcall(ams_delta_modem_init);

-- 
balbi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [RFC] OMAP1: AMS_DELTA: add modem support
  2009-07-04  8:57 ` Felipe Balbi
@ 2009-07-04 10:03   ` Janusz Krzysztofik
  0 siblings, 0 replies; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-07-04 10:03 UTC (permalink / raw)
  To: felipe.balbi
  Cc: Jonathan McDowell, Tony Lindgren, linux-omap@vger.kernel.org,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-kernel@vger.kernel.org

Hi,

Saturday 04 July 2009 10:57:21 Felipe Balbi wrote:
> you should avoid OMAP_GPIO_IRQ() and use gpio_to_irq(), but for that

Thanks, I'll change that and resubmit.

Janusz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-04 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-04  0:06 [PATCH] [RFC] OMAP1: AMS_DELTA: add modem support Janusz Krzysztofik
2009-07-04  8:57 ` Felipe Balbi
2009-07-04 10:03   ` Janusz Krzysztofik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox