Hi,
attached is a patch to enable the modem on the e3. The patch should be applied after Jonathans patches. It is then accessable as /dev/ttyS1. I use micrcom to talk to it. So far, I've managed to get it connected to the phone line as a speaker phone, but I can't get any sound through the handset.
Matt
Index: linux-2.6/include/asm-arm/arch-omap/serial.h =================================================================== --- linux-2.6/include/asm-arm/arch-omap/serial.h (revision 370) +++ linux-2.6/include/asm-arm/arch-omap/serial.h (working copy) @@ -34,4 +34,9 @@ __ret; \ })
+#if defined(CONFIG_MACH_AMS_DELTA) +#define AMS_DELTA_MODEM_CLK 1843200 +#define AMS_DELTA_MODEM_LINE 1 #endif + +#endif Index: linux-2.6/arch/arm/mach-omap1/board-ams-delta.c =================================================================== --- linux-2.6/arch/arm/mach-omap1/board-ams-delta.c (revision 379) +++ linux-2.6/arch/arm/mach-omap1/board-ams-delta.c (working copy) @@ -15,7 +15,11 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> +#include <linux/serial.h> +#include <linux/serial_core.h> +#include <asm/arch/gpio.h>
+ #include <asm/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -31,6 +35,23 @@ static u8 ams_delta_latch1_reg; static u16 ams_delta_latch2_reg;
+static struct uart_port delta_serial_ports[] = { + { + .membase = (char*)AMS_DELTA_MODEM_VIRT, // remapped locn + .mapbase = AMS_DELTA_MODEM_PHYS, + .irq = OMAP_GPIO_IRQ(2), + .flags = UPF_SKIP_TEST | + UPF_BOOT_AUTOCONF | + UPF_BUGGY_UART, /* not sure if the UART really is buggy, */ + /* but without this LSR safety check is engaged on 2nd open */ + .iotype = UPIO_MEM, + .regshift = 1, + .uartclk = AMS_DELTA_MODEM_CLK, + .line = AMS_DELTA_MODEM_LINE, + .type = PORT_16550A + } +}; + void ams_delta_latch1_write(u8 mask, u8 value) { ams_delta_latch1_reg &= ~mask; @@ -50,6 +71,8 @@ omap1_init_common_hw(); omap_init_irq(); omap_gpio_init(); + // set IRQ triggering for modem + set_irq_type(OMAP_GPIO_IRQ(2),IRQT_RISING); }
static struct map_desc ams_delta_io_desc[] __initdata = { @@ -98,6 +121,45 @@ { OMAP_TAG_USB, &ams_delta_usb_config }, };
+ +/*--------------------------------------------------------------------------- +** Purpose: +** +** Returns: Nothing. +** +*/ +void AMS_DELTA_MDM_Enable(__u8 state) +{ + if(state) + { + //Enable modem + printk("modem enable %lu\n\r", jiffies); + ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, + AMS_DELTA_LATCH2_MODEM_NRESET); + ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, + AMS_DELTA_LATCH2_MODEM_CODEC); + } + else + { + //Disable Modem + printk("modem disable %lu\n\r", jiffies); + ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 0); + ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); + } +} + +static void __ams_delta_modem_init(void) +{ + + printk("ams_delta_modem_init\n\r"); + + AMS_DELTA_MDM_Enable(1); + + if (early_serial_setup(&delta_serial_ports[0]) != 0) { + panic("Could not register ttyS1/Amstrad Modem!"); + } +} + static void __init ams_delta_init(void) { iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); @@ -108,11 +170,13 @@
/* Clear latch2 (NAND, LCD, modem enable) */ ams_delta_latch2_write(~0, 0); + __ams_delta_modem_init(); } - static void __init ams_delta_map_io(void) { omap1_map_common_io(); + printk("ams_delta_map_io\n\r"); + }
MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") @@ -129,3 +193,5 @@
EXPORT_SYMBOL(ams_delta_latch1_write); EXPORT_SYMBOL(ams_delta_latch2_write); +EXPORT_SYMBOL(AMS_DELTA_MDM_Enable); + Index: linux-2.6/drivers/serial/8250.c =================================================================== --- linux-2.6/drivers/serial/8250.c (revision 374) +++ linux-2.6/drivers/serial/8250.c (working copy) @@ -1529,7 +1529,16 @@ serial_outp(up, UART_EFR, UART_EFR_ECB); serial_outp(up, UART_LCR, 0); } + +#ifdef CONFIG_MACH_AMS_DELTA + if (up->port.line == AMS_DELTA_MODEM_LINE) + { + extern void AMS_DELTA_MDM_Enable(__u8 state); + AMS_DELTA_MDM_Enable(1); + } +#endif
+ #ifdef CONFIG_SERIAL_8250_RSA /* * If this is an RSA port, see if we can kick it up to the @@ -1694,6 +1703,15 @@ serial_out(up, UART_LCR, serial_inp(up, UART_LCR) & ~UART_LCR_SBC); serial8250_clear_fifos(up);
+#if defined(CONFIG_MACH_AMS_DELTA) + if (port->line == AMS_DELTA_MODEM_LINE) + { + extern void AMS_DELTA_MDM_Enable(__u8 state); + AMS_DELTA_MDM_Enable(0); // disable modem + } +#endif + + #ifdef CONFIG_SERIAL_8250_RSA /* * Reset the RSA board back to 115kbps compat mode.
On Tue, Mar 07, 2006 at 07:33:38PM +0000, Matt Callow wrote:
attached is a patch to enable the modem on the e3. The patch should be applied after Jonathans patches.
It is then accessable as /dev/ttyS1. I use micrcom to talk to it.
I get "Division by 0 in kernel" errors with this patch; I think you need to multiply the BASE_BAUD by 16 to get the uart_clk. I've put my patch up at:
http://the.earth.li/pub/e3/2.6.15/06-ams-delta-modem.diff
It only touches the board configuration file, but appears to work fine for me.
So far, I've managed to get it connected to the phone line as a speaker phone, but I can't get any sound through the handset.
Likewise;
AT+FCLASS=8 AT+VSP=1 ATDT123
gives me the speaking clock on the speaker (I think that's all I needed to type).
Have you tried playing with the AT+VLS options at all? I wondered if that might switch between the two.
J.
Jonathan McDowell wrote:
I get "Division by 0 in kernel" errors with this patch; I think you need to multiply the BASE_BAUD by 16 to get the uart_clk. I've put my patch up at:
http://the.earth.li/pub/e3/2.6.15/06-ams-delta-modem.diff
It only touches the board configuration file, but appears to work fine for me.
Mine was basically a re-implementation of the code in the 2.4 kernel. I don't get /0 errors with my patch, but anyway your patch looks much cleaner.
Have you tried playing with the AT+VLS options at all? I wondered if that might switch between the two.
Yes, I've tried various combinations of AT+VLS, but have not managed to switch the output to the handset.
Matt