From a23ecd92a42a4b378e2d53d6c69dccb4b180392f Mon Sep 17 00:00:00 2001 From: Noe Rubinstein Date: Thu, 13 Jan 2011 12:15:50 +0100 Subject: misc --- xivovp/base.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'xivovp') diff --git a/xivovp/base.c b/xivovp/base.c index 9036cc8..684639f 100644 --- a/xivovp/base.c +++ b/xivovp/base.c @@ -1,12 +1,15 @@ #include #include #include +#include #include #include #include #include +#include + #ifdef AUDIO #include @@ -53,9 +56,13 @@ static int alawoverride = 1; /* It's named like that in every DAHDI driver except I prefer it to be 1 so the name doesn't make much sense. */ static int reverse_polarity = false; +static int wait_port0 = false; +static uint reset_gpio = 21; module_param(init_dbg, uint, 0444); +module_param(reset_gpio, uint, 0444); module_param(traces_vanish, int, 0444); +module_param(wait_port0, int, 0444); module_param(alawoverride, int, 0600); module_param(reverse_polarity, int, 0600); @@ -116,6 +123,17 @@ static void xivovp_txrx(void *data) } #endif +void reset_ve890(void) +{ + gpio_set_direction(reset_gpio, GPIO_OUTPUT); + gpio_set_to_gpio(reset_gpio); + gpio_set_level(reset_gpio, GPIO_HIGH); + msleep(1); + gpio_set_level(reset_gpio, GPIO_LOW); + msleep(1); + gpio_set_level(reset_gpio, GPIO_HIGH); +} + /* Returns the xivovp_line which line is the same as the VpLineCtxType */ static struct xivovp_line* xivovp_line_from_ctx(VpLineCtxType* line_ctx) { @@ -736,7 +754,6 @@ vp_init(void) } else { printk(KERN_INFO DRV_NAME ": VpMakeLineObject (FXO) done.\n"); } -#endif vpst = VpInitDevice( &xivovp.dev_ctx, @@ -779,6 +796,8 @@ test_evb_ve890_init(void) int rc; printk(KERN_INFO DRV_NAME ": entering %s\n", __func__); + reset_ve890(); + rc = tlp_spidev_init(); if (rc < 0) { printk(KERN_ERR DRV_NAME ": tlp_spidev_init failed (%d)\n", rc); @@ -796,11 +815,16 @@ test_evb_ve890_init(void) } #ifdef AUDIO - /* UGLY EVIL HACK -1 */ - xivo_tdm_register_port0_configured( - xivovp.tdm_port, - xivovp_port0_configured_cb, - NULL); + if(wait_port0) + /* UGLY EVIL HACK -1 */ + xivo_tdm_register_port0_configured( + xivovp.tdm_port, + xivovp_port0_configured_cb, + NULL); + else { + xivovp_port0_configured_cb(NULL); + xivovp_port0_started_cb(NULL); + } return 0; #else @@ -832,9 +856,11 @@ xivovp_port0_configured_cb(void *data) printk(KERN_ERR "%s START\n", __func__); if ((rc = xivo_tdm_config_port(xivovp.tdm_port, - LE89316_MEGREZ_PROTO_XIVO_CONFIG)) < 0) { + LE89316_ASYNC_MEGREZ_PROTO_XIVO_CONFIG)) + < 0) { printk(KERN_CRIT "%s: xivo_tdm_config_port returned %d\n", __func__, rc); + msleep(999); goto err_config_port; } -- cgit v1.2.3