Ejemplo n.º 1
0
static void 
gdb_cmd_read_mem(unsigned long addr, unsigned long length,
                 struct gdb_context *ctx)
{
    int x, r;
    unsigned char val;

    dbg_printk("Memory read starting at %lx, length %lx.\n", addr,
               length);

    for ( x = 0; x < length; x++ )
    {
        r = gdb_arch_copy_from_user(&val, (void *)(addr + x), 1);
        if ( r != 0 )
        {
            dbg_printk("Error reading from %lx.\n", addr + x);
            break;
        }
        gdb_write_to_packet_hex(val, sizeof(val), ctx);
    }

    if ( x == 0 )
        gdb_write_to_packet_str("E05", ctx);

    dbg_printk("Read done.\n");

    gdb_send_packet(ctx);
}
Ejemplo n.º 2
0
static void 
gdb_cmd_write_mem(unsigned long addr, unsigned long length,
                  const char *buf, struct gdb_context *ctx)
{
    int x, r;
    unsigned char val;

    dbg_printk("Memory write starting at %lx, length %lx.\n", addr, length);

    for ( x = 0; x < length; x++, addr++, buf += 2 )
    {
        val = str2ulong(buf, sizeof(val));
        r = gdb_arch_copy_to_user((void*)addr, (void*)&val, 1);
        if ( r != 0 )
        {
            dbg_printk("Error writing to %lx.\n", addr);
            break;
        }
    }

    if (x == length)
        gdb_write_to_packet_str("OK", ctx);
    else
        gdb_write_to_packet_str("E11", ctx);

    dbg_printk("Write done.\n");

    gdb_send_packet(ctx);
}
Ejemplo n.º 3
0
static void sec_report_flip_key(struct sec_flip *flip)
{
#if REPORT_KEY
    if (flip_status) {
        input_report_key(flip->input, KEY_FOLDER_OPEN, 1);
        input_report_key(flip->input, KEY_FOLDER_OPEN, 0);
        input_sync(flip->input);
        dbg_printk("[FLIP] %s: input flip key :  open\n", __FUNCTION__);
    } else {
        input_report_key(flip->input, KEY_FOLDER_CLOSE, 1);
        input_report_key(flip->input, KEY_FOLDER_CLOSE, 0);
        input_sync(flip->input);
        dbg_printk ("[FLIP] %s: input flip key : close\n", __FUNCTION__);
    }
#else
    if (flip_status) {
        input_report_switch(flip->input, SW_LID, 0);
        input_sync(flip->input);
        dbg_printk("[FLIP] %s: input flip key :  open\n", __FUNCTION__);
    } else {
        input_report_switch(flip->input, SW_LID, 1);
        input_sync(flip->input);
        dbg_printk ("[FLIP] %s: input flip key : close\n", __FUNCTION__);
    }
#endif
}
Ejemplo n.º 4
0
static int touch_event_handler(void *arg)
{       
 
	struct sched_param param = { .sched_priority = RTPM_PRIO_TPD };
	struct tp_driver_data * data = (struct tp_driver_data*) arg ;

	if(!data)
		return -ENODEV ;
	
	sched_setscheduler(current, SCHED_RR, &param);

	do
	{	
	
	set_current_state(TASK_INTERRUPTIBLE);
	wait_event_interruptible(waiter, tpd_flag != 0);
	tpd_flag = 0 ;
	set_current_state(TASK_RUNNING);
	if(data->out.report_func&& !exitThread){
		dbg_printk("++++:%pf\n",data->out.report_func);
		data->out.report_func(data->out.driver_data) ;
		dbg_printk("----\n");
	}
	mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM);
   }while (!exitThread);		
	
   dbg_printk("!!!!!!!!!!!!!!kthread exit!!!!!!!!!!!!\n"); 
  return 0;
}
Ejemplo n.º 5
0
/*****************************************************************************
* MODULE   : sizrot2_close
* FUNCTION : close SIZ/ROT device
* RETURN   : 0 :
* NOTE     : none
******************************************************************************/
int sizrot2_close(struct inode *inode, struct file *file)
{
	dbg_printk((_DEBUG_SIZROT2 & 0x01),
	 " @sizrot2: sizrot2_close() <start>");
	dbg_printk((_DEBUG_SIZROT2 & 0x01),
	 "           MINOR(inode->i_rdev): %d\n", MINOR(inode->i_rdev));
	return 0;
}
Ejemplo n.º 6
0
int s5p_dsim_phy_enable(struct mipi_dsim_device *dsim, bool on)
{
    //u32 cfg = (u32)dsim->pd->lcd_panel_info;

    dbg_printk("%s: %d\n", __func__, on);
    return 0;
}
Ejemplo n.º 7
0
void
gdb_write_to_packet_hex(unsigned long x, int int_size, struct gdb_context *ctx)
{
    char buf[sizeof(unsigned long) * 2 + 1];
    int i = sizeof(unsigned long) * 2;
    int width = int_size * 2;

    buf[sizeof(unsigned long) * 2] = 0;

    switch ( int_size )
    {
    case sizeof(u8):
    case sizeof(u16):
    case sizeof(u32):
    case sizeof(u64):
        break;
    default:
        dbg_printk("WARNING: %s x: 0x%lx int_size: %d\n",
                   __func__, x, int_size);
        break;
    }

    do {
        buf[--i] = hex2char(x & 15);
        x >>= 4;
    } while ( x );

    while ( (i + width) > (sizeof(unsigned long) * 2) )
        buf[--i] = '0';

    gdb_write_to_packet(&buf[i], width, ctx);
}
Ejemplo n.º 8
0
static int __devinit usbhsic_probe(struct platform_device *pdev)
{
	int ret;
	struct resource *iomem, *ioarea;

	if (pdev->dev.platform_data == NULL) {
		dev_err(&pdev->dev, "platform_data missing\n");
		ret = -EFAULT;
		goto err_exit;
	}

	memset(&usbh_hsic_data, 0, sizeof(usbh_hsic_data));

	memcpy(&usbh_hsic_data.hw_cfg, pdev->dev.platform_data,
	       sizeof(usbh_hsic_data.hw_cfg));
	usbh_hsic_data.dev = &pdev->dev;

	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!iomem) {
		dev_err(&pdev->dev, "no mem resource\n");
		ret = -ENODEV;
		goto err_exit;
	}
	dbg_printk("%s: HSIC %s %d 0x%08x\n",
		   __func__, pdev->name, pdev->id, iomem->start);

	/* mark the memory region as used */
	ioarea = request_mem_region(iomem->start, resource_size(iomem),
				    pdev->name);
	if (!ioarea) {
		dev_err(&pdev->dev, "memory region already claimed\n");
		ret = -EBUSY;
		goto err_exit;
	}

	/* now map the I/O memory */
	usbh_hsic_data.ctrl_regs = (struct usbh_hsic_ctrl_regs __iomem *)
	    ioremap(iomem->start, sizeof(usbh_hsic_data.ctrl_regs));
	if (!usbh_hsic_data.ctrl_regs) {
		dev_err(&pdev->dev, "failed to remap registers\n");
		ret = -ENOMEM;
		goto err_free_mem_region;
	}

	platform_set_drvdata(pdev, &usbh_hsic_data);

	bcm_usbhsic_init(0);

	printk("Capri USB HSIC Low-Level Driver: Probe completed sucessfully.\n");
	return 0;

 err_free_mem_region:
	release_mem_region(iomem->start, resource_size(iomem));

 err_exit:

	memset(&usbh_hsic_data, 0, sizeof(usbh_hsic_data));

	return ret;
}
Ejemplo n.º 9
0
/* Does not acknowledge. */
static int 
attempt_receive_packet(struct gdb_context *ctx)
{
    u8 csum;
    u8 received_csum;
    u8 ch;

    /* Skip over everything up to the first '$' */
    while ( (ch = gdb_io_read(ctx)) != '$' )
        continue;

    csum = 0;
    for ( ctx->in_bytes = 0;
          ctx->in_bytes < sizeof(ctx->in_buf);
          ctx->in_bytes++ )
    {
        ch = gdb_io_read(ctx);
        if ( ch == '#' )
            break;
        ctx->in_buf[ctx->in_bytes] = ch;
        csum += ch;
    }

    if ( ctx->in_bytes == sizeof(ctx->in_buf) )
    {
        dbg_printk("WARNING: GDB sent a stupidly big packet.\n");
        return -1;
    }

    ctx->in_buf[ctx->in_bytes] = '\0';
    received_csum = char2hex(gdb_io_read(ctx)) * 16 +
        char2hex(gdb_io_read(ctx));

    return (received_csum == csum) ? 0 : -1;
}
Ejemplo n.º 10
0
static int
kgdb_get_blocked_state(struct vcpu *p,
					   struct cpu_user_regs *regs,
					   struct unw_frame_info *unw)
#endif
{
	unsigned long ip;
	int count = 0;

#ifndef XEN
	unw_init_from_blocked_task(unw, p);
#endif
	ip = 0UL;
	do {
		if (unw_unwind(unw) < 0)
			return -1;
		unw_get_ip(unw, &ip);
#ifndef XEN
		if (!in_sched_functions(ip))
			break;
#else
		dbg_printk("ip 0x%lx cr_iip 0x%lx\n", ip, regs->cr_iip);
		if (ip == regs->cr_iip)
			break;
#endif
	} while (count++ < 16);

	if (!ip)
		return -1;
	else
		return 0;
}
Ejemplo n.º 11
0
void sec_flip_timer(unsigned long data)
{
    struct sec_flip* flip = (struct sec_flip*)data;

    dbg_printk("%s\n", __FUNCTION__);
    queue_work(flip->wq, &flip->flip_id_det);
}
Ejemplo n.º 12
0
/*
 * Function to initialize USB host related low level hardware including PHY,
 * clocks, etc.
 *
 * TODO: expand support for more than one host in the future if needed
 */
static int bcm_usbhsic_init(unsigned int host_index)
{
	int ret;
	struct usbh_hsic_priv *drv_hsic_data = &usbh_hsic_data;
	struct usbh_cfg *hw_cfg;

	dbg_printk("%s: HSIC\n", __func__);
	hw_cfg = &drv_hsic_data->hw_cfg;

	/* enable clocks */
	ret = usbh_hsic_clk_ctrl(drv_hsic_data, 1);
	if (ret) {
		dev_err(drv_hsic_data->dev,
			"unable to enable one of the HSIC clocks\n");
		goto err_exit;
	}

	ret = bcm_usbh_hsic_init(hw_cfg);
	if (ret < 0)
		goto err_free_gpio;

	return 0;

 err_free_gpio:
	usbh_hsic_clk_ctrl(drv_hsic_data, 0);

 err_exit:

	return ret;
}
Ejemplo n.º 13
0
static irqreturn_t sec_flip_irq_handler(int irq, void *_flip)
{
    struct sec_flip *flip = _flip;

    dbg_printk("%s\n", __FUNCTION__);

    /*
    	val = gpio_get_value_cansleep(flip->gpio);

    	if(val){		// OPEN
    		flip_status = 1;
    	} else{			// CLOSE
    		flip_status = 0;
    		samsung_switching_tsp_pre(0, flip_status);
    	}
    	printk("[FLIP] %s: val=%d (1:open, 0:close)\n", __func__, val);

    	wake_lock_timeout(&flip->wlock, 1 * HZ);
    */
    samsung_disable_tspInput(); /* do not accept tsp irq before folder open/close complete */

    if (flip->timer_debounce)
        mod_timer(&flip->flip_timer,
                  jiffies + msecs_to_jiffies(flip->timer_debounce));
    else
        queue_work(flip->wq, &flip->flip_id_det );

    return IRQ_HANDLED;
}
Ejemplo n.º 14
0
void 
gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
                  struct gdb_context *ctx)
{
	struct gdb_callback_arg arg;
	unsigned long reg;
	struct pt_fpreg freg;
	char buf[16 * 2 + 1];

	if (regnum >= NUM_REGS) {
		dbg_printk("%s: regnum %ld\n", __func__, regnum);
		goto out_err;
	}

	arg.regs = regs;
	arg.regnum = regnum;
	arg.reg = &reg;
	arg.freg = &freg;
	arg.error = 0;
	unw_init_running(&gdb_get_reg_callback, (void*)&arg);
	if (arg.error < 0) {
		dbg_printk("%s: gdb_get_reg_callback failed\n", __func__);
		goto out_err;
	}

	if (arg.error > 0) {
		// notify gdb that this register is not supported.
		// see fetch_register_using_p() in gdb/remote.c.
		safe_strcpy(buf, "x");
	} else if (IA64_FR0_REGNUM <= regnum && regnum <= IA64_FR0_REGNUM + 127) {
		snprintf(buf, sizeof(buf), "%.016lx", swab64(freg.u.bits[0]));
		snprintf(buf + 16, sizeof(buf) - 16, "%.016lx", swab64(freg.u.bits[1]));
	} else {
		snprintf(buf, sizeof(buf), "%.016lx", swab64(reg));
	}
out:
	return gdb_send_reply(buf, ctx);

out_err:
	dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
	safe_strcpy(buf, "E0");
	goto out;
}
Ejemplo n.º 15
0
void mci_sleep(){
        dbg_printk("[MCI] in %s...\n",__func__);
        mci_dump_structure();
        mci_snoop_en(MCI_DISABLE);
        mci_write_skip_en(MCI_DISABLE);
        mci_write_snoop_early_resp_en(MCI_DISABLE);
        mci_write_snoop_outstanding_en(MCI_DISABLE);
        //asm volatile("LOOP_2:");
        //asm volatile ("mov r0,r0");
        ////asm volatile("b LOOP_2");
}
Ejemplo n.º 16
0
static void
gdb_get_reg_callback(struct unw_frame_info* info, void* __arg)
{
	struct gdb_callback_arg* arg = (struct gdb_callback_arg*)__arg;

	if (kgdb_get_blocked_state(current, arg->regs, info) < 0) {
		dbg_printk("%s: kgdb_get_blocked_state failed\n", __func__);
		arg->error = -1;
		return;
	}
	//XXX struct ia64_fpreg and struct pt_fpreg are same.
	if (kgdb_get_reg(arg->regnum, info, arg->regs, arg->reg, 
					 (struct ia64_fpreg*)arg->freg) < 0) {
		dbg_printk("%s: kgdb_get_reg failed\n", __func__);
		arg->error = 1;
		return;
	}
	arg->error = 0;
	return;
}
Ejemplo n.º 17
0
static void set_flip_status(struct sec_flip *flip)
{
    int val = 0;

    val = gpio_get_value_cansleep(flip->gpio);
    dbg_printk("%s, val:%d, flip_status:%d\n", __FUNCTION__, val, flip_status);
    if (flip_status != val) {
        flip_status_before = flip_status;
        flip_status = val ? FLIP_OPEN : FLIP_CLOSE;
    }

}
Ejemplo n.º 18
0
static void sec_report_flip_key(struct sec_flip *flip)
{
#if 0 //REPORT_KEY  change by yuechun.yao
	if (flip_status) {
		input_report_key(flip->input, KEY_FOLDER_OPEN, 1);
		input_report_key(flip->input, KEY_FOLDER_OPEN, 0);
		input_sync(flip->input);
		dbg_printk("[FLIP] %s: input flip key :  open\n", __FUNCTION__);
	} else {
		input_report_key(flip->input, KEY_FOLDER_CLOSE, 1);
		input_report_key(flip->input, KEY_FOLDER_CLOSE, 0);
		input_sync(flip->input);
		dbg_printk ("[FLIP] %s: input flip key : close\n", __FUNCTION__);
	}
#else
	if (flip_status) {
		if(flip_status_before == flip_status) {
		input_report_switch(flip->input, SW_LID, 1);
		dbg_printk("[FLIP] %s: force 1 upload :  open\n", __FUNCTION__);
		}
		input_report_switch(flip->input, SW_LID, 0);
		input_sync(flip->input);
		dbg_printk("[FLIP] %s: input flip key :  open\n", __FUNCTION__);
	} else {
		if(flip_status_before == flip_status) {
		input_report_switch(flip->input, SW_LID, 0);
		dbg_printk("[FLIP] %s: force 0 upload : close\n", __FUNCTION__);
		}
		input_report_switch(flip->input, SW_LID, 1);
		input_sync(flip->input);
		dbg_printk ("[FLIP] %s: input flip key : close\n", __FUNCTION__);
	}
#endif
}
static
int merge_point_add_check(struct mp_table *mp_table, unsigned long target_pc,
		const struct vstack *stack)
{
	struct mp_node *mp_node;
	unsigned long hash = jhash_1word(target_pc, 0);
	struct hlist_head *head;
	struct mp_node *lookup_node;
	int found = 0;

	dbg_printk("Filter: adding merge point at offset %lu, hash %lu\n",
			target_pc, hash);
	mp_node = kzalloc(sizeof(struct mp_node), GFP_KERNEL);
	if (!mp_node)
		return -ENOMEM;
	mp_node->target_pc = target_pc;
	memcpy(&mp_node->stack, stack, sizeof(mp_node->stack));

	head = &mp_table->mp_head[hash & (MERGE_POINT_TABLE_SIZE - 1)];
	lttng_hlist_for_each_entry(lookup_node, head, node) {
		if (lttng_hash_match(lookup_node, target_pc)) {
			found = 1;
			break;
		}
	}
	if (found) {
		/* Key already present */
		dbg_printk("Filter: compare merge points for offset %lu, hash %lu\n",
				target_pc, hash);
		kfree(mp_node);
		if (merge_points_compare(stack, &lookup_node->stack)) {
			printk(KERN_WARNING "Merge points differ for offset %lu\n",
				target_pc);
			return -EINVAL;
		}
	} else {
		hlist_add_head(&mp_node->node, head);
	}
	return 0;
}
Ejemplo n.º 20
0
static int sec_flip_resume(struct device *dev)
{
    struct sec_flip *flip = dev_get_drvdata(dev);

    dbg_printk("[FLIP]%s:\n", __func__);

    if (device_may_wakeup(dev)) {
        disable_irq_wake(flip->irq);
        printk(KERN_INFO "[FLIP]%s: disable_irq_wake\n", __func__);
    }

    return 0;
}
Ejemplo n.º 21
0
/*****************************************************************************
* MODULE   : sizrot2_ioctl
* FUNCTION : IOCTL main function
* RETURN   :       0  : success
*          : negative : fail
* NOTE     : none
******************************************************************************/
int sizrot2_ioctl(struct inode *inode, struct file *file, unsigned int request,
 unsigned long arg)
{
	int ret = 0;
	unsigned int minor = MINOR(inode->i_rdev);

	dbg_printk((_DEBUG_SIZROT2 & 0x01),
	 " @sizrot2: sizrot2_ioctl() <requset = 0x%x>\n", request);
	dbg_printk((_DEBUG_SIZROT2 & 0x01),
	 "           MINOR(inode->i_rdev): %d\n", MINOR(inode->i_rdev));

	if (minor == DEV_MINOR_SIZ)
		ret = siz_ioctl(inode, file, request, arg);
	else if (minor == DEV_MINOR_ROT0)
		ret = rot2_ioctl(inode, file, request, arg);
	else
		ret = -EINVAL;

	dbg_printk((_DEBUG_SIZROT2 & 0x02),
	 "sizrot2_ioctl() <end> return (%d)\n", ret);
	return ret;
}
Ejemplo n.º 22
0
static void mci_setup(struct MCI_CONF conf){
        dbg_printk("[MCI] in %s...\n",__func__);
        smp_inner_dcache_flush_all();
        mci_conf.mci_write_skip = conf.mci_write_skip;
        mci_conf.mci_write_snoop_early_resp = conf.mci_write_snoop_early_resp;
        mci_conf.mci_write_snoop_outstanding = conf.mci_write_snoop_outstanding;
        mci_conf.mci_bar = conf.mci_bar;
        mci_conf.mci_snoop = conf.mci_snoop;

        mci_write_skip_en(conf.mci_write_skip);
        mci_write_snoop_early_resp_en(conf.mci_write_snoop_early_resp);
        mci_write_snoop_outstanding_en(conf.mci_write_snoop_outstanding);
        mci_snoop_en(conf.mci_snoop);
}
Ejemplo n.º 23
0
void
gdb_write_to_packet_hex(unsigned long x, int int_size, struct gdb_context *ctx)
{
    char buf[sizeof(unsigned long) * 2 + 1];
    int i, width = int_size * 2;

    buf[sizeof(unsigned long) * 2] = 0;

    switch ( int_size )
    {
    case sizeof(u8):
    case sizeof(u16):
    case sizeof(u32):
    case sizeof(u64):
        break;
    default:
        dbg_printk("WARNING: %s x: 0x%lx int_size: %d\n",
                   __func__, x, int_size);
        break;
    }

#ifdef __BIG_ENDIAN
    i = sizeof(unsigned long) * 2
    do {
        buf[--i] = hex2char(x & 15);
        x >>= 4;
    } while ( x );

    while ( (i + width) > (sizeof(unsigned long) * 2) )
        buf[--i] = '0';

    gdb_write_to_packet(&buf[i], width, ctx);
#elif defined(__LITTLE_ENDIAN)
    i = 0;
    while ( i < width )
    {
        buf[i++] = hex2char(x>>4);
        buf[i++] = hex2char(x);
        x >>= 8;
    }
    gdb_write_to_packet(buf, width, ctx);
#else
# error unknown endian
#endif
}
Ejemplo n.º 24
0
/* Return 0 if the reply was successfully received, !0 otherwise. */
void 
gdb_send_packet(struct gdb_context *ctx)
{
    char buf[3];
    int count;

    snprintf(buf, sizeof(buf), "%.02x\n", ctx->out_csum);

    gdb_write_to_packet_char('#', ctx);
    gdb_write_to_packet(buf, 2, ctx);

    count = 0;
    do {
        gdb_io_write(ctx->out_buf, ctx->out_offset, ctx);
    } while ( !gdb_check_ack(ctx) && (count++ < GDB_RETRY_MAX) );

    if ( count == GDB_RETRY_MAX )
        dbg_printk("WARNING: %s reached max retry %d\n",
                   __func__, GDB_RETRY_MAX);
}
Ejemplo n.º 25
0
void dump_a(unsigned long start, unsigned long size)
{
    unsigned long p, n, a, q, ch;
    char tmp[64];

    p = start;
    n = size;
    for (a = 0; a < n ; a++) {
        q = a % 16;
        if (a % 16 == 0) {
            dbg_printk("%08X : ", p + a);
        }
        ch = *((unsigned char*)p + a);
        if (q == 7) {
            dbg_printk("%02X-", ch);
        }
        else {
            dbg_printk("%02X ", ch);
        }
        if ((ch >= 0x20)&&(ch < 0x7F)) {
            tmp[q] = ch;
            tmp[q+1] = 0;
        }
        else {
            tmp[q] = '.';
            tmp[q+1] = 0;
        }
        if (a % 16 == 15) {
            dbg_printk(": %s\n", tmp);
        }
    }
    q = a % 16;
    if (q != 0) {
        q = 16 - q;
        while (q-- > 0) {
            dbg_printk("   ");
        }
        dbg_printk(": %s\n", tmp);
    }
}
Ejemplo n.º 26
0
/*
 * Function to initialize USB host related low level hardware including PHY,
 * clocks, etc.
 *
 * TODO: expand support for more than one host in the future if needed
 */
int bcm_usbh_init(unsigned int host_index)
{
	int i, ret;
	u32 tmp;
	struct usbh_priv *drv_data = &usbh_data;
	struct usbh_cfg *hw_cfg = &drv_data->hw_cfg;

	if (atomic_read(&drv_data->probe_done) == 0)
		return -ENODEV;

	BUG_ON(drv_data->init_cnt < 0);

	mutex_lock(&drv_data->lock);

	if (++drv_data->init_cnt > 1) {
		mutex_unlock(&drv_data->lock);
		return 0;
	}

	/* enable clocks */
	ret = usbh_clk_ctrl(drv_data, 1);
	if (ret) {
		dev_err(drv_data->dev, "unable to enable one of the USBH clocks\n");
		goto err_exit;
	}

	for (i = 0; i < hw_cfg->num_ports; i++) {
		struct usbh_port_cfg *port = &hw_cfg->port[i];

		if (port->pwr_gpio >= 0) {
			ret = gpio_request(port->pwr_gpio, "usbh power");
			if (ret < 0)
				goto err_free_gpio;
			gpio_direction_output(port->pwr_gpio, 0);
			/* power enable */
			gpio_set_value(port->pwr_gpio, 1);
		}

		if (port->pwr_flt_gpio >= 0) {
			ret = gpio_request(port->pwr_flt_gpio, "usbh power fault");
			if (ret < 0)
				goto err_free_gpio;
			gpio_direction_input(port->pwr_flt_gpio);
		}

		if (port->reset_gpio >= 0) {
			ret = gpio_request(port->reset_gpio, "usbh ulpi reset");
			if (ret < 0)
				goto err_free_gpio;
			gpio_direction_output(port->reset_gpio, 1);

			/* now reset the ULPI interface */
			mdelay(10);
			gpio_set_value(port->reset_gpio, 0);
			mdelay(10);
			gpio_set_value(port->reset_gpio, 1);
			mdelay(10);
		}
	}

	/* configure each port to be in ULPI PHY mode */
	tmp = 0;
	for (i = 0; i < hw_cfg->num_ports; i++)
		tmp |= MODE_PORT_CFG(i, MODE_ULPI_PHY);
	writel(tmp, &drv_data->ctrl_regs->mode);

	writel(MISC_RESUME_R23_ENABLE | MISC_RESUME_R23_UTMI_PLUS_DISABLE,
			&drv_data->ctrl_regs->misc);
	writel(STRAP_PWR_STATE_VALID, &drv_data->ctrl_regs->strap_q);

	mutex_unlock(&drv_data->lock);

	dbg_printk("reg info:\n");
	dbg_printk(" Mode: 0x%08x", readl(&drv_data->ctrl_regs->mode));
	dbg_printk(" Strap: 0x%08x", readl(&drv_data->ctrl_regs->strap_q));
	dbg_printk(" Misc: 0x%08x", readl(&drv_data->ctrl_regs->misc));

	return 0;

err_free_gpio:
	for (i = 0; i < hw_cfg->num_ports; i++) {
		struct usbh_port_cfg *port = &hw_cfg->port[i];

		if (port->pwr_gpio >= 0) {
			/* disable port power */
			gpio_set_value(port->pwr_gpio, 0);
			gpio_free(port->pwr_gpio);
		}

		if (port->pwr_flt_gpio >= 0)
			gpio_free(port->pwr_flt_gpio);

		if (port->reset_gpio >= 0)
			gpio_free(port->reset_gpio);
	}

//err_disable_clk:
	usbh_clk_ctrl(drv_data, 0);

err_exit:
	drv_data->init_cnt--;
	mutex_unlock(&drv_data->lock);
	return ret;
}
Ejemplo n.º 27
0
/* trap handler: main entry point */
int 
__trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie)
{
    int rc = 0;
    unsigned long flags;

    if ( gdb_ctx->serhnd < 0 )
    {
        printk("Debugging connection not set up.\n");
        return -EBUSY;
    }

    /* We rely on our caller to ensure we're only on one processor
     * at a time... We should probably panic here, but given that
     * we're a debugger we should probably be a little tolerant of
     * things going wrong. */
    /* We don't want to use a spin lock here, because we're doing
       two distinct things:

       1 -- we don't want to run on more than one processor at a time,
            and
       2 -- we want to do something sensible if we re-enter ourselves.

       Spin locks are good for 1, but useless for 2. */
    if ( !atomic_dec_and_test(&gdb_ctx->running) )
    {
        printk("WARNING WARNING WARNING: Avoiding recursive gdb.\n");
        atomic_inc(&gdb_ctx->running);
        return -EBUSY;
    }

    if ( !gdb_ctx->connected )
    {
        printk("GDB connection activated.\n");
        gdb_arch_print_state(regs);
        gdb_ctx->connected = 1;
    }

    gdb_smp_pause();

    local_irq_save(flags);

    watchdog_disable();
    console_start_sync();

    /* Shouldn't really do this, but otherwise we stop for no
       obvious reason, which is Bad */
    printk("Waiting for GDB to attach...\n");

    gdb_arch_enter(regs);
    gdb_ctx->signum = gdb_arch_signal_num(regs, cookie);

    /* If gdb is already attached, tell it we've stopped again. */
    if ( gdb_ctx->currently_attached )
    {
        gdb_start_packet(gdb_ctx);
        gdb_cmd_signum(gdb_ctx);
    }

    do {
        if ( receive_command(gdb_ctx) < 0 )
        {
            dbg_printk("Error in GDB session...\n");
            rc = -EIO;
            break;
        }
    } while ( process_command(regs, gdb_ctx) == 0 );

    gdb_smp_resume();

    gdb_arch_exit(regs);
    console_end_sync();
    watchdog_enable();
    atomic_inc(&gdb_ctx->running);

    local_irq_restore(flags);

    return rc;
}
Ejemplo n.º 28
0
void mci_dump_structure(){
    dbg_printk("[MCI] mci_confi:%d,%d,%d,%d,%d\n",mci_conf.mci_write_skip,mci_conf.mci_write_snoop_early_resp,mci_conf.mci_write_snoop_outstanding,mci_conf.mci_bar,mci_conf.mci_snoop);

}
Ejemplo n.º 29
0
static void tpd_eint_handler(void)
{
	tpd_flag = 1 ;
	dbg_printk("+++\n");
	wake_up_interruptible(&waiter);
}
Ejemplo n.º 30
0
void 
gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
                  struct gdb_context *ctx)
{
	unsigned long reg = IA64_IP_REGNUM;
	char buf[9];
	int i;

	dbg_printk("Register read regnum = 0x%lx\n", regnum);
	if (IA64_GR0_REGNUM <= regnum && regnum <= IA64_GR0_REGNUM + 31) {
		for (i = 0; i < gr_reg_to_cpu_user_regs_index_max; i++) {
			if (gr_reg_to_cpu_user_regs_index[i].reg == regnum) {
				reg = *(unsigned long*)(((char*)regs) + gr_reg_to_cpu_user_regs_index[i].ptregoff);
				break;
			}
		}
		if (i == gr_reg_to_cpu_user_regs_index_max) {
			goto out_err;
		}
	} else if (IA64_BR0_REGNUM <= regnum && regnum <= IA64_BR0_REGNUM + 7) {
		for (i = 0; i < br_reg_to_cpu_user_regs_index_max; i++) {
			if (br_reg_to_cpu_user_regs_index[i].reg == regnum) {
				reg = *(unsigned long*)(((char*)regs) + br_reg_to_cpu_user_regs_index[i].ptregoff);
				break;
			}
		}
		if (i == br_reg_to_cpu_user_regs_index_max) {
			goto out_err;
		}
	} else if (IA64_FR0_REGNUM + 6 <= regnum && regnum <= IA64_FR0_REGNUM + 11) {
		for (i = 0; i < fr_reg_to_cpu_user_regs_index_max; i++) {
			if (fr_reg_to_cpu_user_regs_index[i].reg == regnum) {
				reg = *(unsigned long*)(((char*)regs) + fr_reg_to_cpu_user_regs_index[i].ptregoff);
				break;
			}
		}
		if (i == fr_reg_to_cpu_user_regs_index_max) {
			goto out_err;
		}
	} else if (regnum == IA64_CSD_REGNUM) {
		reg = regs->ar_csd;
	} else if (regnum == IA64_SSD_REGNUM) {
		reg = regs->ar_ssd;
	} else if (regnum == IA64_PSR_REGNUM) {
		reg = regs->cr_ipsr;
	} else if (regnum == IA64_IP_REGNUM) {
		reg = regs->cr_iip;
	} else if (regnum == IA64_CFM_REGNUM) {
		reg = regs->cr_ifs;
	} else if (regnum == IA64_UNAT_REGNUM) {
		reg = regs->ar_unat;
	} else if (regnum == IA64_PFS_REGNUM) {
		reg = regs->ar_pfs;
	} else if (regnum == IA64_RSC_REGNUM) {
		reg = regs->ar_rsc;
	} else if (regnum == IA64_RNAT_REGNUM) {
		reg = regs->ar_rnat;
	} else if (regnum == IA64_BSPSTORE_REGNUM) {
		reg = regs->ar_bspstore;
	} else if (regnum == IA64_PR_REGNUM) {
		reg = regs->pr;
	} else if (regnum == IA64_FPSR_REGNUM) {
		reg = regs->ar_fpsr;
	} else if (regnum == IA64_CCV_REGNUM) {
		reg = regs->ar_ccv;
	} else {
		// emul_unat, rfi_pfs
		goto out_err;
	}

	dbg_printk("Register read regnum = 0x%lx, val = 0x%lx\n", regnum, reg);	
	snprintf(buf, sizeof(buf), "%.08lx", swab64(reg));
out:
	return gdb_send_reply(buf, ctx);

out_err:
	dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
	safe_strcpy(buf, "x");
	goto out;
}