コード例 #1
0
/*
 * ip7500iap_portf_sd_init
 */
static void ip7500iap_portf_sd_init(void)
{
	/*
	 * Check the device tree for the sd_tio
	 */
	struct sd_tio_node *sd_node = (struct sd_tio_node *)devtree_find_node("portf_sd");
	if (!sd_node) {
		printk(KERN_INFO "PortF SDTIO not found\n");
		return;
	}

	/*
	 * For IP7500IAP, if we have Port F SDTIO, we need to reclaim RF_4 which
	 * is otherwise used as ethernet phy reset.
	 */
	UBICOM32_GPIO_DISABLE(GPIO_RF_4);

	/*
	 * Fill in the resources and platform data from devtree information
	 */
	ip7500iap_portf_sd_resources[0].start = sd_node->dn.sendirq;
	ip7500iap_portf_sd_resources[1].start = sd_node->dn.recvirq;
	ip7500iap_portf_sd_resources[2].start = (u32_t)&(sd_node->regs);
	ip7500iap_portf_sd_resources[2].end = (u32_t)&(sd_node->regs) + sizeof(sd_node->regs);

	platform_device_register(&ip7500iap_portf_sd_device);
}
コード例 #2
0
ファイル: profile.c プロジェクト: 7LK/McWRT
/*
 * oprofile_arch_init()
 *
 * Attach to Oprofile after qualify the availability of the backend
 * profiler support.
 */
int __init oprofile_arch_init(struct oprofile_operations *ops)
{
	int r = -ENODEV;

	profile_node = (struct profilenode *)devtree_find_node("profiler");

	if (profile_node == NULL) {
		printk(KERN_WARNING "Cannot find profiler node\n");
		return r;
	}

	r = request_irq(profile_node->dn.recvirq, profile_interrupt,
			IRQF_DISABLED, "profiler", NULL);

	if (r < 0) {
		profile_node = NULL;
		printk(KERN_WARNING "Cannot get profiler IRQ\n");
		return r;
	}

	ops->start = profile_start;
	ops->stop = profile_stop;
	ops->cpu_type = "timer";

	memset(cpu_map, 0, sizeof(cpu_map));

	on_each_cpu(ubicom32_build_cpu_th_mask, &th_all_mask, 1);

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

	return r;
}
コード例 #3
0
ファイル: vdc_tio.c プロジェクト: kizukukoto/WDN900_GPL
/*
 * vdc_tio_init
 *	Checks the device tree and instantiates the driver if found
 */
void __init vdc_tio_init(struct ubicom32fb_platform_data *pd)
{
	/*
	 * Check the device tree for the vdc_tio
	 */
	struct vdc_tio_node *vdc_node =
		(struct vdc_tio_node *)devtree_find_node("vdctio");
	if (!vdc_node) {
		printk(KERN_WARNING "No vdc_tio found\n");
		return;
	}

	vdc_tio_platform_device.dev.platform_data = pd;

	/*
	 * Fill in the resources and platform data from devtree information
	 */
	vdc_tio_resources[0].start = vdc_node->dn.sendirq;
	vdc_tio_resources[1].start = vdc_node->dn.recvirq;
	vdc_tio_resources[2].start = (u32_t)vdc_node->regs;
	vdc_tio_resources[2].end = (u32_t)vdc_node->regs +
		sizeof(struct vdc_tio_vp_regs);

#ifdef CONFIG_VDC_LCD_AUTO_REFRESH_RATE
	pd->fclk = CONFIG_VDC_LCD_AUTO_REFRESH_RATE;
#endif

	/*
	 * Try to get the device registered
	 */
	if (platform_device_register(&vdc_tio_platform_device) < 0) {
		printk(KERN_WARNING "VDC failed to register\n");
	}
}
コード例 #4
0
/*
 * ubicom32_videopassthrough_probe
 */
static __init int ubicom32_videopassthrough_probe(void)
{
	struct proc_dir_entry *proc_root;
	struct proc_dir_entry *proc_entry;
	void *buffer;
	u32_t align;

	printk(KERN_INFO "VideoPassthrough: Init\n");

	vp_node = (struct video_passthrough_node *)devtree_find_node("videopassthrough");
	if (!vp_node) {
		printk(KERN_WARNING "VideoPassthrough: VP not found\n");
		return -ENODEV;
	}

	if (vp_node->version != VIDEO_PASSTHROUGH_NODE_VERSION) {
		printk(KERN_WARNING "VideoPassthrough: node not compatible\n");
		return -ENODEV;
	}

	if (vp_node->regs->version != VIDEO_PASSTHROUGH_REGS_VERSION) {
		printk(KERN_WARNING "VideoPassthrough: VP not compatible\n");
		return -ENODEV;
	}

	buffer = kmalloc(vp_node->regs->minimum_buffer_size + vp_node->regs->buffer_alignment, GFP_KERNEL);
	if (!buffer) {
		printk(KERN_WARNING "VideoPassthrough: Could not allocate buffer\n");
		return -ENOMEM;
	}
	align = vp_node->regs->buffer_alignment - 1;
	vp_node->regs->buffer = (void *)(((u32_t)buffer + align) & ~align);

	proc_root = proc_mkdir("videopassthrough", NULL);
	if (!proc_root) {
		printk(KERN_WARNING "VideoPassthrough: Could not create proc node\n");
		return -ENOMEM;
	}

	proc_entry = create_proc_entry("enabled", S_IRUGO, proc_root);
	if (proc_entry) {
		proc_entry->data = (void *)vp_node;
		proc_entry->proc_fops = &ubicom32_videopassthrough_enable_proc_fops;
	}

	proc_entry = create_proc_entry("command", S_IWUGO, proc_root);
	if (proc_entry) {
		proc_entry->data = (void *)vp_node;
		proc_entry->proc_fops = &ubicom32_videopassthrough_command_proc_fops;
	}

	printk(KERN_INFO "VideoPassthrough: Allocated, buffer: %p\n", vp_node->regs->buffer);

	return 0;
}
コード例 #5
0
/*
 * ubicom32_audiopassthrough_probe
 */
static __init int ubicom32_audiopassthrough_probe(void)
{
	struct proc_dir_entry *proc_root;
	struct proc_dir_entry *proc_entry;

	printk(KERN_INFO "AudioPassthrough: Init proc node\n");

	ap_node = (struct audio_passthrough_node *)devtree_find_node("audiopassthrough");
	if (!ap_node) {
		printk(KERN_WARNING "AudioPassthrough: not found\n");
		return -ENODEV;
	}

	if (ap_node->version != AUDIO_PASSTHROUGH_NODE_VERSION) {
		printk(KERN_WARNING "AudioPassthrough: node not compatible\n");
		return -ENODEV;
	}

	if (ap_node->regs->version != AUDIO_PASSTHROUGH_REGS_VERSION) {
		printk(KERN_WARNING "AudioPassthrough: ap not compatible\n");
		return -ENODEV;
	}

	proc_root = proc_mkdir("audiopassthrough", NULL);
	if (!proc_root) {
		printk(KERN_WARNING "AudioPassthrough: Could not create proc node\n");
		return -ENOMEM;
	}

	proc_entry = create_proc_entry("enabled", S_IRUGO, proc_root);
	if (proc_entry) {
		proc_entry->data = (void *)ap_node;
		proc_entry->proc_fops = &ubicom32_audiopassthrough_enable_proc_fops;
	}

	proc_entry = create_proc_entry("sample_rate", S_IWUGO, proc_root);
	if (proc_entry) {
		proc_entry->data = (void *)ap_node;
		proc_entry->proc_fops = &ubicom32_audiopassthrough_sample_rate_proc_fops;
	}

	proc_entry = create_proc_entry("command", S_IWUGO, proc_root);
	if (proc_entry) {
		proc_entry->data = (void *)ap_node;
		proc_entry->proc_fops = &ubicom32_audiopassthrough_command_proc_fops;
	}

	return 0;
}
コード例 #6
0
/*
 * ip7145dpf_portb_sd_init
 */
static void ip7145dpf_portb_sd_init(void)
{
	/*
	 * Check the device tree for the sd_tio
	 */
	struct sd_tio_node *sd_node = (struct sd_tio_node *)devtree_find_node("portb_sd");
	if (!sd_node) {
		printk(KERN_INFO "PortB SDTIO not found\n");
		return;
	}

	/*
	 * Fill in the resources and platform data from devtree information
	 */
	ip7145dpf_portb_sd_resources[0].start = sd_node->dn.sendirq;
	ip7145dpf_portb_sd_resources[1].start = sd_node->dn.recvirq;
	ip7145dpf_portb_sd_resources[2].start = (u32_t)&(sd_node->regs);
	ip7145dpf_portb_sd_resources[2].end = (u32_t)&(sd_node->regs) + sizeof(sd_node->regs);

	platform_device_register(&ip7145dpf_portb_sd_device);
}
コード例 #7
0
ファイル: ubi32-eth.c プロジェクト: 7LK/McWRT
int ubi32_eth_init_module(void)
{
	struct ethtionode *eth_node;
	struct net_device *dev;
	struct ubi32_eth_private *priv;
	int i, err;

	/*
	 * Device allocation.
	 */
	err = 0;
	for (i = 0; i < UBI32_ETH_NUM_OF_DEVICES; i++) {
		/*
		 * See if the eth_vp is in the device tree.
		 */
		eth_node = (struct ethtionode *)devtree_find_node(eth_if_name[i]);
		if (!eth_node) {
			printk(KERN_INFO "%s does not exist\n", eth_if_name[i]);
			continue;
		}

		eth_node->tx_dma_ring = (struct ubi32_eth_dma_desc **)kmalloc(
				sizeof(struct ubi32_eth_dma_desc *) *
				(TX_DMA_RING_SIZE + RX_DMA_RING_SIZE),
				GFP_ATOMIC | __GFP_NOWARN | __GFP_NORETRY | GFP_DMA);

		if (eth_node->tx_dma_ring == NULL) {
			eth_node->tx_dma_ring = (struct ubi32_eth_dma_desc **)kmalloc(
				sizeof(struct ubi32_eth_dma_desc *) *
				(TX_DMA_RING_SIZE + RX_DMA_RING_SIZE), GFP_KERNEL);
			printk(KERN_INFO "fail to allocate from OCM\n");
		}

		if (!eth_node->tx_dma_ring) {
			err = -ENOMEM;
			break;
		}
		eth_node->rx_dma_ring = eth_node->tx_dma_ring + TX_DMA_RING_SIZE;
		eth_node->tx_sz = TX_DMA_RING_SIZE - 1;
		eth_node->rx_sz = RX_DMA_RING_SIZE - 1;

		dev = alloc_etherdev(sizeof(struct ubi32_eth_private));
		if (!dev) {
			kfree(eth_node->tx_dma_ring);
			err = -ENOMEM;
			break;
		}
		priv = netdev_priv(dev);
		priv->dev = dev;

		/*
		 * This just fill in some default Ubicom MAC address
		 */
		memcpy(dev->dev_addr, mac_addr[i], ETH_ALEN);
		memset(dev->broadcast, 0xff, ETH_ALEN);

		priv->regs = eth_node;
		priv->regs->command = 0;
		priv->regs->int_mask = 0;
		priv->regs->int_status = 0;
		priv->regs->tx_out = 0;
		priv->regs->rx_out = 0;
		priv->regs->tx_in = 0;
		priv->regs->rx_in = 0;
		priv->rx_tail = 0;
		priv->tx_tail = 0;

		priv->vp_int_bit = eth_node->dn.sendirq;
		dev->irq = eth_node->dn.recvirq;

		spin_lock_init(&priv->lock);

		dev->netdev_ops = &ubi32_netdev_ops;

		dev->watchdog_timeo	= UBI32_ETH_VP_TX_TIMEOUT;
#ifdef UBICOM32_USE_NAPI
		netif_napi_add(dev, &priv->napi, ubi32_eth_napi_poll, UBI32_ETH_NAPI_WEIGHT);
#endif
		err = register_netdev(dev);
		if (err) {
			printk(KERN_WARNING "Failed to register netdev %s\n", eth_if_name[i]);
			//release_region();
			free_netdev(dev);
			kfree(eth_node->tx_dma_ring);
			break;
		}

		ubi32_eth_devices[i] = dev;
		printk(KERN_INFO "%s vp_base:0x%p, tio_int:%d irq:%d feature:0x%lx\n",
			dev->name, priv->regs, eth_node->dn.sendirq, dev->irq, dev->features);
	}

	if (err) {
		ubi32_eth_cleanup();
		return err;
	}

	if (!ubi32_eth_devices[0] && !ubi32_eth_devices[1]) {
		return -ENODEV;
	}

#if defined(UBICOM32_USE_POLLING)
	init_timer(&eth_poll_timer);
	eth_poll_timer.function = ubi32_eth_poll;
	eth_poll_timer.data = (unsigned long)0;
	eth_poll_timer.expires = jiffies + 2;
	add_timer(&eth_poll_timer);
#endif

	return 0;
}