Ejemplo n.º 1
0
static int __init omap4_l3_init(void)
{
    int i;
    struct omap_hwmod *oh[3];
    struct platform_device *pdev;
    char oh_name[L3_MODULES_MAX_LEN];

    /* If dtb is there, the devices will be created dynamically */
    if (of_have_populated_dt())
        return -ENODEV;

    /*
     * To avoid code running on other OMAPs in
     * multi-omap builds
     */
    if (!cpu_is_omap44xx() && !soc_is_omap54xx())
        return -ENODEV;

    for (i = 0; i < L3_MODULES; i++) {
        snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);

        oh[i] = omap_hwmod_lookup(oh_name);
        if (!(oh[i]))
            pr_err("could not look up %s\n", oh_name);
    }

    pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, 0);

    WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);

    return PTR_RET(pdev);
}
Ejemplo n.º 2
0
static int __init omap4_l3_init(void)
{
    int l, i;
    struct omap_hwmod *oh[3];
    struct platform_device *pdev;
    char oh_name[L3_MODULES_MAX_LEN];


    if (of_have_populated_dt())
        return -ENODEV;

    if (!(cpu_is_omap44xx()))
        return -ENODEV;

    for (i = 0; i < L3_MODULES; i++) {
        l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);

        oh[i] = omap_hwmod_lookup(oh_name);
        if (!(oh[i]))
            pr_err("could not look up %s\n", oh_name);
    }

    pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
                                0, NULL, 0, 0);

    WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);

    return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
}
Ejemplo n.º 3
0
static int __init omap4_l3_init(void)
{
	int l, i;
	struct omap_hwmod *oh[3];
	struct omap_device *od;
	char oh_name[L3_MODULES_MAX_LEN];

	/*
	 * To avoid code running on other OMAPs in
	 * multi-omap builds
	 */
	if (!(cpu_is_omap44xx()))
		return -ENODEV;

	for (i = 0; i < L3_MODULES; i++) {
		l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);

		oh[i] = omap_hwmod_lookup(oh_name);
		if (!(oh[i]))
			pr_err("could not look up %s\n", oh_name);
	}

	od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
						     0, NULL, 0, 0);

	WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);

	return IS_ERR(od) ? PTR_ERR(od) : 0;
}
static int __init am33xx_register_edma(void)
{
	int i, l;
	struct omap_hwmod *oh[4];
	struct platform_device *pdev;
	struct edma_soc_info *pdata = am33xx_edma_info;
	char oh_name[8];

	if (!cpu_is_am33xx())
		return -ENODEV;

	oh[0] = omap_hwmod_lookup("tpcc");
	if (!oh[0]) {
		pr_err("could not look up %s\n", "tpcc");
		return -ENODEV;
	}

	for (i = 0; i < 3; i++) {
		l = snprintf(oh_name, 8, "tptc%d", i);

		oh[i+1] = omap_hwmod_lookup(oh_name);
		if (!oh[i+1]) {
			pr_err("could not look up %s\n", oh_name);
			return -ENODEV;
		}
	}

	pdev = omap_device_build_ss("edma", 0, oh, 4, pdata, sizeof(*pdata),
								NULL, 0, 0);

	WARN(IS_ERR(pdev), "could not build omap_device for edma\n");

	return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;

}
Ejemplo n.º 5
0
/**
 * omap2_init_pmu - creates and registers PMU platform device
 * @oh_num:	Number of OMAP HWMODs required to create PMU device
 * @oh_names:	Array of OMAP HWMODS names required to create PMU device
 *
 * Uses OMAP HWMOD framework to create and register an ARM PMU device
 * from a list of HWMOD names passed. Currently supports OMAP2, OMAP3
 * and OMAP4 devices.
 */
static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
{
	int i;
	struct omap_hwmod *oh[3];
	char *dev_name = "arm-pmu";

	if ((!oh_num) || (oh_num > 3))
		return -EINVAL;

	for (i = 0; i < oh_num; i++) {
		oh[i] = omap_hwmod_lookup(oh_names[i]);
		if (!oh[i]) {
			pr_err("Could not look up %s hwmod\n", oh_names[i]);
			return -ENODEV;
		}
	}

	omap_pmu_dev = omap_device_build_ss(dev_name, -1, oh, oh_num, NULL, 0,
					    NULL, 0, 0);
	WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n",
	     dev_name);

	if (IS_ERR(omap_pmu_dev))
		return PTR_ERR(omap_pmu_dev);

	return 0;
}
Ejemplo n.º 6
0
static int __init omap_rproc_init(void)
{
	const char *pdev_name = "omap-rproc";
	struct omap_hwmod *oh[2];
	struct omap_device *od;
	int i, ret = 0, oh_count;

	/* names like ipu_cx/dsp_cx might show up on other OMAPs, too */
	if (!cpu_is_omap44xx())
		return 0;

	for (i = 0; i < ARRAY_SIZE(omap4_rproc_data); i++) {
		const char *oh_name = omap4_rproc_data[i].oh_name;
		const char *oh_name_opt = omap4_rproc_data[i].oh_name_opt;
		oh_count = 0;

		if (omap_total_ram_size() == SZ_512M) {
			if (!strcmp("ipu", omap4_rproc_data[i].name))
				omap4_rproc_data[i].firmware =
					"ducati-m3.512MB.bin";
			else if (!strcmp("dsp", omap4_rproc_data[i].name))
				omap4_rproc_data[i].firmware =
					"tesla-dsp.512MB.bin";
		}

		oh[0] = omap_hwmod_lookup(oh_name);

		if (!oh[0]) {
			pr_err("could not look up %s\n", oh_name);
			continue;
		}
		oh_count++;

		if (oh_name_opt) {
			oh[1] = omap_hwmod_lookup(oh_name_opt);
			if (!oh[1]) {
				pr_err("could not look up %s\n", oh_name_opt);
				continue;
			}
			oh_count++;
		}

		omap4_rproc_data[i].memory_pool =
				omap_rproc_get_pool(omap4_rproc_data[i].name);
		od = omap_device_build_ss(pdev_name, i, oh, oh_count,
					&omap4_rproc_data[i],
					sizeof(struct omap_rproc_pdata),
					omap_rproc_latency,
					ARRAY_SIZE(omap_rproc_latency),
					false);
		if (IS_ERR(od)) {
			pr_err("Could not build omap_device for %s:%s\n",
							pdev_name, oh_name);
			ret = PTR_ERR(od);
		}
	}

	return ret;
}
Ejemplo n.º 7
0
/**
 * omap_device_build - build and register an omap_device with one omap_hwmod
 * @pdev_name: name of the platform_device driver to use
 * @pdev_id: this platform_device's connection ID
 * @oh: ptr to the single omap_hwmod that backs this omap_device
 * @pdata: platform_data ptr to associate with the platform_device
 * @pdata_len: amount of memory pointed to by @pdata
 *
 * Convenience function for building and registering a single
 * omap_device record, which in turn builds and registers a
 * platform_device record.  See omap_device_build_ss() for more
 * information.  Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
 * passes along the return value of omap_device_build_ss().
 */
struct platform_device __init *omap_device_build(const char *pdev_name,
        int pdev_id,
        struct omap_hwmod *oh,
        void *pdata, int pdata_len)
{
    struct omap_hwmod *ohs[] = { oh };

    if (!oh)
        return ERR_PTR(-EINVAL);

    return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata,
                                pdata_len);
}
Ejemplo n.º 8
0
/**
 * omap_device_build - build and register an omap_device with one omap_hwmod
 * @pdev_name: name of the platform_device driver to use
 * @pdev_id: this platform_device's connection ID
 * @oh: ptr to the single omap_hwmod that backs this omap_device
 * @pdata: platform_data ptr to associate with the platform_device
 * @pdata_len: amount of memory pointed to by @pdata
 * @pm_lats: pointer to a omap_device_pm_latency array for this device
 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
 *
 * Convenience function for building and registering a single
 * omap_device record, which in turn builds and registers a
 * platform_device record.  See omap_device_build_ss() for more
 * information.  Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
 * passes along the return value of omap_device_build_ss().
 */
struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
				      struct omap_hwmod *oh, void *pdata,
				      int pdata_len,
				      struct omap_device_pm_latency *pm_lats,
				      int pm_lats_cnt)
{
	struct omap_hwmod *ohs[] = { oh };

	if (!oh)
		return ERR_PTR(-EINVAL);

	return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata,
				    pdata_len, pm_lats, pm_lats_cnt);
}
Ejemplo n.º 9
0
void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
{
	struct omap_hwmod	*oh[2];
	struct platform_device	*pdev;
	int			bus_id = -1;
	int			i;

	for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
		usbhs_data.port_mode[i] = pdata->port_mode[i];
		ohci_data.port_mode[i] = pdata->port_mode[i];
		ehci_data.port_mode[i] = pdata->port_mode[i];
		ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
		ehci_data.regulator[i] = pdata->regulator[i];
	}
	ehci_data.phy_reset = pdata->phy_reset;
	ohci_data.es2_compatibility = pdata->es2_compatibility;
	usbhs_data.ehci_data = &ehci_data;
	usbhs_data.ohci_data = &ohci_data;

	if (cpu_is_omap34xx()) {
		setup_ehci_io_mux(pdata->port_mode);
		setup_ohci_io_mux(pdata->port_mode);
	} else if (cpu_is_omap44xx()) {
		setup_4430ehci_io_mux(pdata->port_mode);
		setup_4430ohci_io_mux(pdata->port_mode);
	}

	oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
	if (!oh[0]) {
		pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
		return;
	}

	oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
	if (!oh[1]) {
		pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
		return;
	}

	pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
				(void *)&usbhs_data, sizeof(usbhs_data),
				omap_uhhtll_latency,
				ARRAY_SIZE(omap_uhhtll_latency), false);
	if (IS_ERR(pdev)) {
		pr_err("Could not build hwmod devices %s,%s\n",
			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
		return;
	}
}
Ejemplo n.º 10
0
static int __init omap_rproc_init(void)
{
	const char *pdev_name = "omap-rproc";
	struct omap_hwmod *oh[2];
	struct omap_device *od;
	int i, ret = 0, oh_count;

	/* names like ipu_cx/dsp_cx might show up on other OMAPs, too */
	if (!cpu_is_omap44xx())
		return 0;

	for (i = 0; i < ARRAY_SIZE(omap4_rproc_data); i++) {
		const char *oh_name = omap4_rproc_data[i].oh_name;
		const char *oh_name_opt = omap4_rproc_data[i].oh_name_opt;
		oh_count = 0;

// WORKAROUND_CODE: replace ducati binary at run-time not build time.
// TODO: This code must be removed.
#ifdef CONFIG_MACH_LGE_U2_P769
		// if HW revsion is not latest then system must be other ducati as following rull
		if(!strcmp(oh_name, "ipu_c0")) {
			if (system_rev < LGE_PCB_C)
				omap4_rproc_data[i].firmware = "ducati-m3_revB.bin" ;	// for rev A and B
			// add here more mapping rull between HW revision and ducati binary name.

			printk("%s ducati name %s \n", __FUNCTION__,omap4_rproc_data[i].firmware);
		}
#elif defined (CONFIG_MACH_LGE_U2_P760)
		// if HW revsion is not latest then system must be other ducati as following rull
		if(!strcmp(oh_name, "ipu_c0")) {
			if (system_rev < LGE_PCB_B)
				omap4_rproc_data[i].firmware = "ducati-m3_revA.bin" ;	// for rev A and B
			// add here more mapping rull between HW revision and ducati binary name.

			printk("%s ducati name %s \n", __FUNCTION__,omap4_rproc_data[i].firmware);
		}
#endif
		if (omap_total_ram_size() == SZ_512M) {
			if (!strcmp("ipu", omap4_rproc_data[i].name))
				omap4_rproc_data[i].firmware =
					"ducati-m3.512MB.bin";
			else if (!strcmp("dsp", omap4_rproc_data[i].name))
				omap4_rproc_data[i].firmware =
					"tesla-dsp.512MB.bin";
		}

		oh[0] = omap_hwmod_lookup(oh_name);

		if (!oh[0]) {
			pr_err("could not look up %s\n", oh_name);
			continue;
		}
		oh_count++;

		if (oh_name_opt) {
			oh[1] = omap_hwmod_lookup(oh_name_opt);
			if (!oh[1]) {
				pr_err("could not look up %s\n", oh_name_opt);
				continue;
			}
			oh_count++;
		}

		omap4_rproc_data[i].memory_pool =
				omap_rproc_get_pool(omap4_rproc_data[i].name);
		od = omap_device_build_ss(pdev_name, i, oh, oh_count,
					&omap4_rproc_data[i],
					sizeof(struct omap_rproc_pdata),
					omap_rproc_latency,
					ARRAY_SIZE(omap_rproc_latency),
					false);
		if (IS_ERR(od)) {
			pr_err("Could not build omap_device for %s:%s\n",
							pdev_name, oh_name);
			ret = PTR_ERR(od);
		}
	}

	return ret;
}
Ejemplo n.º 11
0
void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
{
	struct omap_hwmod	*oh[4];
	struct omap_device	*od;
	int			bus_id = -1;
	int			i;

	for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
		usbhs_data.port_mode[i] = pdata->port_mode[i];
		ohci_data.port_mode[i] = pdata->port_mode[i];
		ehci_data.port_mode[i] = pdata->port_mode[i];
		ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
		ehci_data.regulator[i] = pdata->regulator[i];
		ehci_data.transceiver_clk[i] = pdata->transceiver_clk[i];
	}
	ehci_data.phy_reset = pdata->phy_reset;
	ohci_data.es2_compatibility = pdata->es2_compatibility;
	usbhs_data.ehci_data = &ehci_data;
	usbhs_data.ohci_data = &ohci_data;

	oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
	if (!oh[0]) {
		pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
		return;
	}

	oh[1] = omap_hwmod_lookup(USBHS_OHCI_HWMODNAME);
	if (!oh[1]) {
		pr_err("Could not look up %s\n", USBHS_OHCI_HWMODNAME);
		return;
	}

	oh[2] = omap_hwmod_lookup(USBHS_EHCI_HWMODNAME);
	if (!oh[2]) {
		pr_err("Could not look up %s\n", USBHS_EHCI_HWMODNAME);
		return;
	}

	oh[3] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
	if (!oh[3]) {
		pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
		return;
	}

	if (cpu_is_omap34xx()) {
		setup_ehci_io_mux(pdata->port_mode);
		setup_ohci_io_mux(pdata->port_mode);
	} else if (cpu_is_omap44xx()) {
		oh[2]->mux = setup_4430ehci_io_mux(pdata->port_mode);
		if (oh[2]->mux)
			omap_hwmod_mux(oh[2]->mux, _HWMOD_STATE_ENABLED);
		oh[1]->mux = setup_4430ohci_io_mux(pdata->port_mode);
		if (oh[1]->mux)
			omap_hwmod_mux(oh[1]->mux, _HWMOD_STATE_ENABLED);
	}

	od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 4,
				(void *)&usbhs_data, sizeof(usbhs_data),
				omap_uhhtll_latency,
				ARRAY_SIZE(omap_uhhtll_latency), false);

	if (IS_ERR(od)) {
		pr_err("Could not build hwmod devices %s, %s\n",
			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
		return;
	}

	usbhs_wake = kmalloc(sizeof(*usbhs_wake), GFP_KERNEL);
	if (!usbhs_wake) {
		pr_err("Could not allocate usbhs_wake\n");
		return;
	}

	INIT_WORK(&usbhs_wake->wakeup_work, usbhs_resume_work);
	usbhs_wake->oh_ehci = oh[2];
	usbhs_wake->oh_ohci = oh[1];
	usbhs_wake->dev = &od->pdev.dev;
}
Ejemplo n.º 12
0
static int omap_init_mcbsp(struct omap_hwmod *oh, void *user)
{
	int id, count = 1, i;
	char *name = "omap-mcbsp";
	char dev_name[16];
	struct omap_hwmod *oh_device[2];
	struct omap_mcbsp_platform_data *pdata;
	struct omap_device *od;

	if (!oh) {
		pr_err("%s:NULL hwmod pointer (oh)\n", __func__);
		return -EINVAL;
	}

	pdata = kzalloc(sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL);
	if (!pdata) {
		pr_err("%s: No memory for mcbsp\n", __func__);
		return -ENOMEM;
	}
	pdata->ops = &omap2_mcbsp_ops;
	pdata->fclk = omap_hwmod_get_clk(oh);

	if (cpu_is_omap34xx()) {
		pdata->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
		if (id == 2)
			pdata->buffer_size = 0x500;
		else
			pdata->buffer_size = 0x80;
	} else {
		pdata->dma_op_mode = -EINVAL;
		pdata->buffer_size = 0;
	}

	sscanf(oh->name, "mcbsp%d", &id);
	sprintf(dev_name, "mcbsp%d_sidetone", id);
	oh_device[0] = oh;

	for (i = 0; i < no_of_st ; i++) {
		if (!strcmp(dev_name, oh_st_device[i]->name)) {
			oh_device[1] = oh_st_device[i];
			count++;
		}
	}

	pdata->oh = kzalloc(sizeof(struct omap_mcbsp_platform_data) * count,
				GFP_KERNEL);
	if (!pdata->oh) {
		pr_err("%s: No memory for mcbsp pdata oh\n", __func__);
		return -ENOMEM;
	}
	memcpy(pdata->oh, oh_device, sizeof(struct omap_hwmod *) * count);

	od = omap_device_build_ss(name, id - 1, oh_device, count, pdata,
				sizeof(*pdata), omap2_mcbsp_latency,
				ARRAY_SIZE(omap2_mcbsp_latency), false);
	if (IS_ERR(od))  {
		pr_err("%s: Cant build omap_device for %s:%s.\n", __func__,
					name, oh->name);
		kfree(pdata);
		return PTR_ERR(od);
	}
	omap_mcbsp_count++;
	return 0;
}