2010-10-05 00:09:14 +08:00
|
|
|
/*
|
|
|
|
* TI's OMAP DSP platform device registration
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005-2006 Texas Instruments, Inc.
|
|
|
|
* Copyright (C) 2009 Nokia Corporation
|
|
|
|
*
|
|
|
|
* Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2010-12-22 06:30:55 +08:00
|
|
|
/*
|
|
|
|
* XXX The function pointers to the PRM/CM functions are incorrect and
|
|
|
|
* should be removed. No device driver should be changing PRM/CM bits
|
|
|
|
* directly; that's a layering violation -- those bits are the responsibility
|
|
|
|
* of the OMAP PM core code.
|
|
|
|
*/
|
|
|
|
|
2011-11-08 04:27:10 +08:00
|
|
|
#include <linux/module.h>
|
2010-10-05 00:09:14 +08:00
|
|
|
#include <linux/platform_device.h>
|
2012-06-06 16:42:20 +08:00
|
|
|
|
|
|
|
#include <asm/memblock.h>
|
|
|
|
|
2012-06-19 06:18:10 +08:00
|
|
|
#include "control.h"
|
2010-12-22 06:30:55 +08:00
|
|
|
#include "cm2xxx_3xxx.h"
|
|
|
|
#include "prm2xxx_3xxx.h"
|
2013-03-26 07:30:05 +08:00
|
|
|
#ifdef CONFIG_TIDSPBRIDGE_DVFS
|
2012-10-04 07:36:40 +08:00
|
|
|
#include "omap-pm.h"
|
2010-10-05 00:09:14 +08:00
|
|
|
#endif
|
|
|
|
|
2012-08-24 21:21:06 +08:00
|
|
|
#include <linux/platform_data/dsp-omap.h>
|
2010-10-05 00:09:14 +08:00
|
|
|
|
|
|
|
static struct platform_device *omap_dsp_pdev;
|
|
|
|
|
|
|
|
static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
|
2013-03-26 07:30:05 +08:00
|
|
|
#ifdef CONFIG_TIDSPBRIDGE_DVFS
|
2010-10-05 00:09:14 +08:00
|
|
|
.dsp_set_min_opp = omap_pm_dsp_set_min_opp,
|
|
|
|
.dsp_get_opp = omap_pm_dsp_get_opp,
|
|
|
|
.cpu_set_freq = omap_pm_cpu_set_freq,
|
|
|
|
.cpu_get_freq = omap_pm_cpu_get_freq,
|
|
|
|
#endif
|
2010-12-22 12:05:14 +08:00
|
|
|
.dsp_prm_read = omap2_prm_read_mod_reg,
|
|
|
|
.dsp_prm_write = omap2_prm_write_mod_reg,
|
|
|
|
.dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
|
|
|
|
.dsp_cm_read = omap2_cm_read_mod_reg,
|
|
|
|
.dsp_cm_write = omap2_cm_write_mod_reg,
|
|
|
|
.dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
|
2012-06-19 06:18:10 +08:00
|
|
|
|
|
|
|
.set_bootaddr = omap_ctrl_write_dsp_boot_addr,
|
|
|
|
.set_bootmode = omap_ctrl_write_dsp_boot_mode,
|
2010-10-05 00:09:14 +08:00
|
|
|
};
|
|
|
|
|
2012-05-10 00:59:26 +08:00
|
|
|
static phys_addr_t omap_dsp_phys_mempool_base;
|
|
|
|
|
|
|
|
void __init omap_dsp_reserve_sdram_memblock(void)
|
|
|
|
{
|
|
|
|
phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
|
|
|
|
phys_addr_t paddr;
|
|
|
|
|
|
|
|
if (!size)
|
|
|
|
return;
|
|
|
|
|
|
|
|
paddr = arm_memblock_steal(size, SZ_1M);
|
|
|
|
if (!paddr) {
|
|
|
|
pr_err("%s: failed to reserve %llx bytes\n",
|
|
|
|
__func__, (unsigned long long)size);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
omap_dsp_phys_mempool_base = paddr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static phys_addr_t omap_dsp_get_mempool_base(void)
|
|
|
|
{
|
|
|
|
return omap_dsp_phys_mempool_base;
|
|
|
|
}
|
|
|
|
|
2010-10-05 00:09:14 +08:00
|
|
|
static int __init omap_dsp_init(void)
|
|
|
|
{
|
|
|
|
struct platform_device *pdev;
|
|
|
|
int err = -ENOMEM;
|
|
|
|
struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
|
|
|
|
|
|
|
|
pdata->phys_mempool_base = omap_dsp_get_mempool_base();
|
|
|
|
|
|
|
|
if (pdata->phys_mempool_base) {
|
|
|
|
pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
|
2012-05-09 07:31:12 +08:00
|
|
|
pr_info("%s: %llx bytes @ %llx\n", __func__,
|
|
|
|
(unsigned long long)pdata->phys_mempool_size,
|
|
|
|
(unsigned long long)pdata->phys_mempool_base);
|
2010-10-05 00:09:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pdev = platform_device_alloc("omap-dsp", -1);
|
|
|
|
if (!pdev)
|
|
|
|
goto err_out;
|
|
|
|
|
|
|
|
err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
|
|
|
|
if (err)
|
|
|
|
goto err_out;
|
|
|
|
|
|
|
|
err = platform_device_add(pdev);
|
|
|
|
if (err)
|
|
|
|
goto err_out;
|
|
|
|
|
|
|
|
omap_dsp_pdev = pdev;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_out:
|
|
|
|
platform_device_put(pdev);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
module_init(omap_dsp_init);
|
|
|
|
|
|
|
|
static void __exit omap_dsp_exit(void)
|
|
|
|
{
|
|
|
|
platform_device_unregister(omap_dsp_pdev);
|
|
|
|
}
|
|
|
|
module_exit(omap_dsp_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Hiroshi DOYU");
|
|
|
|
MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
|
|
|
|
MODULE_LICENSE("GPL");
|