static __init void m1_init_machine(void)
{
    meson_cache_init();
#ifdef CONFIG_AML_SUSPEND
		pm_power_suspend = meson_power_suspend;
#endif /*CONFIG_AML_SUSPEND*/
    
    power_hold();
//    pm_power_off = power_off;		//Elvis fool
    device_clk_setting();
    device_pinmux_init();
//    LED_PWM_REG0_init();

    platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

#ifdef CONFIG_USB_DWC_OTG_HCD
    printk("***m1_init_machine: usb set mode.\n");
    set_usb_phy_clk(USB_PHY_CLOCK_SEL_XTAL_DIV2);
//	set_usb_phy_id_mode(USB_PHY_PORT_A, USB_PHY_MODE_SW_HOST);
    lm_device_register(&usb_ld_a);
  	set_usb_phy_id_mode(USB_PHY_PORT_B,USB_PHY_MODE_SW_HOST);
    lm_device_register(&usb_ld_b);
#endif
    disable_unused_model();
}
Пример #2
0
int __init usb_devices_init(void)
{
	struct lm_device *lmdev;
	int rc = -1;

	/* Power Up the 48MHz PLL */
	/* REG_CLKPWR_USBPLL_ENABLE |= 1; */

	/* Turn on the output gate of the 48MHz PLL */
	/* REG_CLKPWR_USBPLL_OEN |= 1; */

	/* Turn on the HS USB in the usb control register */
	/* REG_USB_CONTROL_REG |= REG_USB_CONTROL_USB_ON; */

	lmdev = kmalloc(sizeof(struct lm_device), GFP_KERNEL);
	if (lmdev) {
		memset(lmdev, 0, sizeof(struct lm_device));

		lmdev->resource.start = HW_USBOTG_BASE;
		lmdev->resource.end = lmdev->resource.start + SZ_256K - 1;
		lmdev->resource.flags = IORESOURCE_MEM;

		lmdev->irq = IRQ_USBHSOTG;
		lmdev->id = -2;

		rc = lm_device_register(lmdev);
	}

	return rc;
}
Пример #3
0
static void __init ap_init(void)
{
	unsigned long sc_dec;
	int i;

	platform_device_register(&cfi_flash_device);

	sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
	for (i = 0; i < 4; i++) {
		struct lm_device *lmdev;

		if ((sc_dec & (16 << i)) == 0)
			continue;

		lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
		if (!lmdev)
			continue;

		lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
		lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
		lmdev->resource.flags = IORESOURCE_MEM;
		lmdev->irq = IRQ_AP_EXPINT0 + i;
		lmdev->id = i;

		lm_device_register(lmdev);
	}
}
static int __init dwc_hsic_init(void)
{
	dwc_wifi_unreset();
	dwc_hsic_unreset();

    return lm_device_register(&dwc_usb_hsic);
}
Пример #5
0
static void __init ap_init_of(void)
{
	unsigned long sc_dec;
	int i;

	of_platform_populate(NULL, of_default_bus_match_table,
			ap_auxdata_lookup, NULL);

	sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
	for (i = 0; i < 4; i++) {
		struct lm_device *lmdev;

		if ((sc_dec & (16 << i)) == 0)
			continue;

		lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
		if (!lmdev)
			continue;

		lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
		lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
		lmdev->resource.flags = IORESOURCE_MEM;
		lmdev->irq = IRQ_AP_EXPINT0 + i;
		lmdev->id = i;

		lm_device_register(lmdev);
	}
}
static __init void m1_init_machine(void)
{
	meson_cache_init();

	device_clk_setting();
	device_pinmux_init();
	platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

#ifdef CONFIG_USB_DWC_OTG_HCD
	set_usb_phy_clk(USB_PHY_CLOCK_SEL_XTAL_DIV2);
	lm_device_register(&usb_ld_a);
	lm_device_register(&usb_ld_b);
#endif
#ifdef CONFIG_SATA_DWC_AHCI
	set_sata_phy_clk(SATA_PHY_CLOCK_SEL_DEMOD_PLL);
	lm_device_register(&sata_ld);
#endif
}
Пример #7
0
static int dwc_otg_platform_driver_probe(
struct platform_device *_dev
)
{
	int irq;
	irq = _dev->resource[1].start;
	lm_device.irq = irq;
	lm_device.resource = _dev->resource[0];
	lm_device.id = _dev->id;
	return lm_device_register(&lm_device);
}
Пример #8
0
static void __init init_machine(void)
{
	edb_trace(1);

#warning "add some sys ctrl register operation here, such as enable something .etc"
	cache_init();

#warning "don't replace arm_pm_restart funciton if pm.c is built into boot image "
    arm_pm_restart = board_arch_reset;

    lm_device_register(&usb_sft_otg);

    return;
}
Пример #9
0
int __init usb_devices_init( void )
{
	struct lm_device *lmdev;
	uint32_t pll_ctl;
	int rc = -1;

	pll_ctl = readl( IO_ADDRESS( CMU_R_PLA_PLL_CTL0_MEMADDR ) );

	// @KP: 090316: setup for usb device mode
	// bypass PMU for usb device testing; reg 0xb00a8
	// writel(0x6a3, IO_ADDRESS(CMU_R_MODE_CTL_MEMADDR));

	// config usb broadcom phy (8-bit) for otg mode (default to device mode); reset and unreset pair; reg 0xb0244
	writel(0x004069d5, IO_ADDRESS(CMU_R_USB_PHY0_MEMADDR));
	writel(0x0041a9d5, IO_ADDRESS(CMU_R_USB_PHY0_MEMADDR));

	// enable differential pll for usb; reg 0xb0040 bit 9
	pll_ctl |= CMU_F_PLA_EN_CMLBUF6_MASK;
	writel(pll_ctl, IO_ADDRESS(CMU_R_PLA_PLL_CTL0_MEMADDR));

	lmdev = kmalloc(sizeof(struct lm_device), GFP_KERNEL);
	if (lmdev) {
		memset( lmdev, 0 , sizeof(struct lm_device));

		lmdev->resource.start = USB_REG_BASE_ADDR;
		lmdev->resource.end   = lmdev->resource.start + SZ_4K -1;
		lmdev->resource.flags = IORESOURCE_MEM ;

		lmdev->irq = BCM4760_INTR_USB;
		lmdev->id  = -2;

		rc = lm_device_register(lmdev);
		if (rc) {
			printk(KERN_ERR "can't register BCM4760 OTG core device\n");
		}

	}

	return rc;
}
Пример #10
0
static void __init ap_init_of(void)
{
	unsigned long sc_dec;
	struct device_node *root;
	struct device_node *syscon;
	struct device *parent;
	struct soc_device *soc_dev;
	struct soc_device_attribute *soc_dev_attr;
	u32 ap_sc_id;
	int err;
	int i;

	/* Here we create an SoC device for the root node */
	root = of_find_node_by_path("/");
	if (!root)
		return;
	syscon = of_find_node_by_path("/syscon");
	if (!syscon)
		return;

	ap_syscon_base = of_iomap(syscon, 0);
	if (!ap_syscon_base)
		return;

	ap_sc_id = readl(ap_syscon_base);

	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
	if (!soc_dev_attr)
		return;

	err = of_property_read_string(root, "compatible",
				      &soc_dev_attr->soc_id);
	if (err)
		return;
	err = of_property_read_string(root, "model", &soc_dev_attr->machine);
	if (err)
		return;
	soc_dev_attr->family = "Integrator";
	soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
					   'A' + (ap_sc_id & 0x0f));

	soc_dev = soc_device_register(soc_dev_attr);
	if (IS_ERR(soc_dev)) {
		kfree(soc_dev_attr->revision);
		kfree(soc_dev_attr);
		return;
	}

	parent = soc_device_to_device(soc_dev);
	integrator_init_sysfs(parent, ap_sc_id);

	of_platform_populate(root, of_default_bus_match_table,
			ap_auxdata_lookup, parent);

	sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
	for (i = 0; i < 4; i++) {
		struct lm_device *lmdev;

		if ((sc_dec & (16 << i)) == 0)
			continue;

		lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
		if (!lmdev)
			continue;

		lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
		lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
		lmdev->resource.flags = IORESOURCE_MEM;
		lmdev->irq = IRQ_AP_EXPINT0 + i;
		lmdev->id = i;

		lm_device_register(lmdev);
	}
}
Пример #11
0
static void __init cns3xxx_init(void)
{
    int i;

#ifdef CONFIG_CACHE_L2X0
    /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
     * Bits:  .... ...0 0111 1001 0000 .... .... .... */
    cns3xxx_l2x0_init();
#endif

#ifdef CONFIG_CACHE_L2CC
    l2cc_init((void __iomem *) CNS3XXX_L2C_BASE_VIRT);
#endif

#ifdef CONFIG_CNS3XXX_DMAC
    dmac_init();
#endif

#ifdef CONFIG_CNS3XXX_RAID
    cns_rdma_init();
#endif

    show_board_version();

    {
        volatile unsigned long *pciecfg0;

        pciecfg0 = (volatile unsigned long *)CNS3XXX_PCIE0_CFG0_BASE_VIRT;
        pciecfg0[1] |= 7;

        printk("usec at kernel start: 0x%08lX\n", *(volatile unsigned long *)(CNS3XXX_PCIE0_MEM_BASE_VIRT+0x14));

    }

    ts43xx_ahci_init();

    for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
        struct amba_device *d = amba_devs[i];
        int ret;

        cns3xxx_pwr_power_up(CNS3XXX_PWR_PLL(PLL_LCD));
        cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(LCDC));
        cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(LCDC));

        ret = amba_device_register(d, &iomem_resource);
        if(ret)
            printk("%s=>%d: %d\n", __FUNCTION__, __LINE__, ret);
    }

    platform_add_devices(cns3xxx_devs, ARRAY_SIZE(cns3xxx_devs));

    lm_device_register(&cns3xxx_usb_otg_device);
    i2c_register_board_info(0, cns3xxx_i2c_devices, ARRAY_SIZE(cns3xxx_i2c_devices));
    i2c_register_board_info(1, cns3xxx_i2c_gpio_devices, ARRAY_SIZE(cns3xxx_i2c_gpio_devices));
    spi_register_board_info(cns3xxx_spi_devices, ARRAY_SIZE(cns3xxx_spi_devices));


    cns3xxx_proc_dir = proc_mkdir("cns3xxx", NULL);
#ifdef CONFIG_DEBUG_FS
    cns3xxx_debugfs_dir = debugfs_create_dir("cns3xxx", NULL);
#endif

#ifdef CONFIG_CACHE_L2CC
    l2cc_proc_init();
#endif

    pm_power_off = cns3xxx_power_off;

}
Пример #12
0
/**
 * of_lm_device_create - Alloc, initialize and register an of_device
 * @np: pointer to node to create device for
 * @bus_id: name to assign device
 * @parent: Linux device model parent device.
 *
 * Returns pointer to created lm device, or NULL if a device was not
 * registered.  Unavailable devices will not get registered.
 */
static struct lm_device *of_lm_device_create(struct device_node *node,
						 const char *bus_id,
						 void *platform_data,
						 struct device *parent)
{
	struct lm_device *dev;
	const void *prop;
//	struct resource *res, temp_res;
	//int ret,id,irq;
	int ret,id;

	pr_debug("Creating of lm device %s\n", node->full_name);
	if (!of_device_is_available(node))
		return NULL;

	/* Allow the HW Peripheral ID to be overridden */
	prop = of_get_property(node, "lm-periph-id", NULL);
	if (prop)
		id = of_read_ulong(prop, 1);
	else
		id = -1; // root dev

	dev = kzalloc(sizeof(struct lm_device),GFP_KERNEL);
	if (!dev){
		printk(KERN_ERR "out of memory to alloc lm device\n");
		return NULL;
	}
/*
	prop = of_get_property(node, "irq", NULL);
	if (prop)
		irq = of_read_ulong(prop, 1);
	else{
		irq = 0;
	}
	printk(KERN_ERR "  --- irq: %d\n",irq);
*/	
	/* setup generic device info */
	dev->id = id;
//	dev->irq = irq;
	dev->dev.coherent_dma_mask = ~0;
	dev->dev.of_node = of_node_get(node);
	dev->dev.parent = parent;
	dev->dev.platform_data = platform_data;
	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
	if(id >= 0)
		dev_set_name(&dev->dev,"lm%d", dev->id);
	else
		dev_set_name(&dev->dev,"lm-root");


	/* setup lm-specific device info */
	dev->dma_mask_room = DMA_BIT_MASK(32);


//	ret = of_address_to_resource(node, 0, &dev->resource);
//	if (ret)
//		goto err_free;

	ret = lm_device_register(dev);
	if (ret)
		goto err_free;

	return dev;

err_free:
	put_device(&dev->dev);
	return NULL;
}