diff options
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 6d230164b4f9..d598d9fd65ac 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -229,6 +229,69 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) | |||
229 | } | 229 | } |
230 | EXPORT_SYMBOL(omap_mcbsp_config); | 230 | EXPORT_SYMBOL(omap_mcbsp_config); |
231 | 231 | ||
232 | /** | ||
233 | * omap_mcbsp_dma_params - returns the dma channel number | ||
234 | * @id - mcbsp id | ||
235 | * @stream - indicates the direction of data flow (rx or tx) | ||
236 | * | ||
237 | * Returns the dma channel number for the rx channel or tx channel | ||
238 | * based on the value of @stream for the requested mcbsp given by @id | ||
239 | */ | ||
240 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream) | ||
241 | { | ||
242 | struct omap_mcbsp *mcbsp; | ||
243 | |||
244 | if (!omap_mcbsp_check_valid_id(id)) { | ||
245 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
246 | return -ENODEV; | ||
247 | } | ||
248 | mcbsp = id_to_mcbsp_ptr(id); | ||
249 | |||
250 | if (stream) | ||
251 | return mcbsp->dma_rx_sync; | ||
252 | else | ||
253 | return mcbsp->dma_tx_sync; | ||
254 | } | ||
255 | EXPORT_SYMBOL(omap_mcbsp_dma_ch_params); | ||
256 | |||
257 | /** | ||
258 | * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register | ||
259 | * @id - mcbsp id | ||
260 | * @stream - indicates the direction of data flow (rx or tx) | ||
261 | * | ||
262 | * Returns the address of mcbsp data transmit register or data receive register | ||
263 | * to be used by DMA for transferring/receiving data based on the value of | ||
264 | * @stream for the requested mcbsp given by @id | ||
265 | */ | ||
266 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream) | ||
267 | { | ||
268 | struct omap_mcbsp *mcbsp; | ||
269 | int data_reg; | ||
270 | |||
271 | if (!omap_mcbsp_check_valid_id(id)) { | ||
272 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
273 | return -ENODEV; | ||
274 | } | ||
275 | mcbsp = id_to_mcbsp_ptr(id); | ||
276 | |||
277 | data_reg = mcbsp->phys_dma_base; | ||
278 | |||
279 | if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE2) { | ||
280 | if (stream) | ||
281 | data_reg += OMAP_MCBSP_REG_DRR1; | ||
282 | else | ||
283 | data_reg += OMAP_MCBSP_REG_DXR1; | ||
284 | } else { | ||
285 | if (stream) | ||
286 | data_reg += OMAP_MCBSP_REG_DRR; | ||
287 | else | ||
288 | data_reg += OMAP_MCBSP_REG_DXR; | ||
289 | } | ||
290 | |||
291 | return data_reg; | ||
292 | } | ||
293 | EXPORT_SYMBOL(omap_mcbsp_dma_reg_params); | ||
294 | |||
232 | #ifdef CONFIG_ARCH_OMAP3 | 295 | #ifdef CONFIG_ARCH_OMAP3 |
233 | static struct omap_device *find_omap_device_by_dev(struct device *dev) | 296 | static struct omap_device *find_omap_device_by_dev(struct device *dev) |
234 | { | 297 | { |
@@ -1835,6 +1898,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
1835 | mcbsp->pdata = pdata; | 1898 | mcbsp->pdata = pdata; |
1836 | mcbsp->dev = &pdev->dev; | 1899 | mcbsp->dev = &pdev->dev; |
1837 | mcbsp_ptr[id] = mcbsp; | 1900 | mcbsp_ptr[id] = mcbsp; |
1901 | mcbsp->mcbsp_config_type = pdata->mcbsp_config_type; | ||
1838 | platform_set_drvdata(pdev, mcbsp); | 1902 | platform_set_drvdata(pdev, mcbsp); |
1839 | pm_runtime_enable(mcbsp->dev); | 1903 | pm_runtime_enable(mcbsp->dev); |
1840 | 1904 | ||