Commit 90b0032b authored by Russell King's avatar Russell King Committed by Tony Lindgren

[ARM] omap: convert mcbsp to use ioremap()

Modified version of Russell's mcbsp ioremap patch
11a44b851134a30788195a01f91ea428272d2783 for linux-omap.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 3db369c2
...@@ -135,7 +135,6 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = { ...@@ -135,7 +135,6 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = {
static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = { static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
{ {
.phys_base = OMAP730_MCBSP1_BASE, .phys_base = OMAP730_MCBSP1_BASE,
.virt_base = io_p2v(OMAP730_MCBSP1_BASE),
.dma_rx_sync = OMAP_DMA_MCBSP1_RX, .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP_DMA_MCBSP1_TX, .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
.rx_irq = INT_730_McBSP1RX, .rx_irq = INT_730_McBSP1RX,
...@@ -144,7 +143,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = { ...@@ -144,7 +143,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP730_MCBSP2_BASE, .phys_base = OMAP730_MCBSP2_BASE,
.virt_base = io_p2v(OMAP730_MCBSP2_BASE),
.dma_rx_sync = OMAP_DMA_MCBSP3_RX, .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP_DMA_MCBSP3_TX, .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
.rx_irq = INT_730_McBSP2RX, .rx_irq = INT_730_McBSP2RX,
...@@ -162,7 +160,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = { ...@@ -162,7 +160,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
{ {
.phys_base = OMAP1510_MCBSP1_BASE, .phys_base = OMAP1510_MCBSP1_BASE,
.virt_base = OMAP1510_MCBSP1_BASE,
.dma_rx_sync = OMAP_DMA_MCBSP1_RX, .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP_DMA_MCBSP1_TX, .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
.rx_irq = INT_McBSP1RX, .rx_irq = INT_McBSP1RX,
...@@ -172,7 +169,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { ...@@ -172,7 +169,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP1510_MCBSP2_BASE, .phys_base = OMAP1510_MCBSP2_BASE,
.virt_base = io_p2v(OMAP1510_MCBSP2_BASE),
.dma_rx_sync = OMAP_DMA_MCBSP2_RX, .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP_DMA_MCBSP2_TX, .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
.rx_irq = INT_1510_SPI_RX, .rx_irq = INT_1510_SPI_RX,
...@@ -181,7 +177,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { ...@@ -181,7 +177,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP1510_MCBSP3_BASE, .phys_base = OMAP1510_MCBSP3_BASE,
.virt_base = OMAP1510_MCBSP3_BASE,
.dma_rx_sync = OMAP_DMA_MCBSP3_RX, .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP_DMA_MCBSP3_TX, .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
.rx_irq = INT_McBSP3RX, .rx_irq = INT_McBSP3RX,
...@@ -200,7 +195,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { ...@@ -200,7 +195,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
{ {
.phys_base = OMAP1610_MCBSP1_BASE, .phys_base = OMAP1610_MCBSP1_BASE,
.virt_base = OMAP1610_MCBSP1_BASE,
.dma_rx_sync = OMAP_DMA_MCBSP1_RX, .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP_DMA_MCBSP1_TX, .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
.rx_irq = INT_McBSP1RX, .rx_irq = INT_McBSP1RX,
...@@ -210,7 +204,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { ...@@ -210,7 +204,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP1610_MCBSP2_BASE, .phys_base = OMAP1610_MCBSP2_BASE,
.virt_base = io_p2v(OMAP1610_MCBSP2_BASE),
.dma_rx_sync = OMAP_DMA_MCBSP2_RX, .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP_DMA_MCBSP2_TX, .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
.rx_irq = INT_1610_McBSP2_RX, .rx_irq = INT_1610_McBSP2_RX,
...@@ -219,7 +212,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { ...@@ -219,7 +212,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP1610_MCBSP3_BASE, .phys_base = OMAP1610_MCBSP3_BASE,
.virt_base = OMAP1610_MCBSP3_BASE,
.dma_rx_sync = OMAP_DMA_MCBSP3_RX, .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP_DMA_MCBSP3_TX, .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
.rx_irq = INT_McBSP3RX, .rx_irq = INT_McBSP3RX,
......
...@@ -149,7 +149,6 @@ static struct omap_mcbsp_ops omap2_mcbsp_ops = { ...@@ -149,7 +149,6 @@ static struct omap_mcbsp_ops omap2_mcbsp_ops = {
static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = { static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
{ {
.phys_base = OMAP24XX_MCBSP1_BASE, .phys_base = OMAP24XX_MCBSP1_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
.rx_irq = INT_24XX_MCBSP1_IRQ_RX, .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
...@@ -159,7 +158,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = { ...@@ -159,7 +158,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP24XX_MCBSP2_BASE, .phys_base = OMAP24XX_MCBSP2_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
.rx_irq = INT_24XX_MCBSP2_IRQ_RX, .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
...@@ -178,7 +176,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = { ...@@ -178,7 +176,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
{ {
.phys_base = OMAP34XX_MCBSP1_BASE, .phys_base = OMAP34XX_MCBSP1_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP34XX_MCBSP1_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
.rx_irq = INT_24XX_MCBSP1_IRQ_RX, .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
...@@ -188,7 +185,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { ...@@ -188,7 +185,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP34XX_MCBSP2_BASE, .phys_base = OMAP34XX_MCBSP2_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP34XX_MCBSP2_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
.rx_irq = INT_24XX_MCBSP2_IRQ_RX, .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
...@@ -198,7 +194,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { ...@@ -198,7 +194,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP34XX_MCBSP3_BASE, .phys_base = OMAP34XX_MCBSP3_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP34XX_MCBSP3_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP3_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP3_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP3_TX,
.ops = &omap2_mcbsp_ops, .ops = &omap2_mcbsp_ops,
...@@ -206,7 +201,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { ...@@ -206,7 +201,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP34XX_MCBSP4_BASE, .phys_base = OMAP34XX_MCBSP4_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP34XX_MCBSP4_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP4_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP4_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP4_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP4_TX,
.ops = &omap2_mcbsp_ops, .ops = &omap2_mcbsp_ops,
...@@ -214,7 +208,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { ...@@ -214,7 +208,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
}, },
{ {
.phys_base = OMAP34XX_MCBSP5_BASE, .phys_base = OMAP34XX_MCBSP5_BASE,
.virt_base = OMAP2_IO_ADDRESS(OMAP34XX_MCBSP5_BASE),
.dma_rx_sync = OMAP24XX_DMA_MCBSP5_RX, .dma_rx_sync = OMAP24XX_DMA_MCBSP5_RX,
.dma_tx_sync = OMAP24XX_DMA_MCBSP5_TX, .dma_tx_sync = OMAP24XX_DMA_MCBSP5_TX,
.ops = &omap2_mcbsp_ops, .ops = &omap2_mcbsp_ops,
......
...@@ -327,7 +327,6 @@ struct omap_mcbsp_ops { ...@@ -327,7 +327,6 @@ struct omap_mcbsp_ops {
struct omap_mcbsp_platform_data { struct omap_mcbsp_platform_data {
unsigned long phys_base; unsigned long phys_base;
u32 virt_base;
u8 dma_rx_sync, dma_tx_sync; u8 dma_rx_sync, dma_tx_sync;
u16 rx_irq, tx_irq; u16 rx_irq, tx_irq;
struct omap_mcbsp_ops *ops; struct omap_mcbsp_ops *ops;
...@@ -337,7 +336,7 @@ struct omap_mcbsp_platform_data { ...@@ -337,7 +336,7 @@ struct omap_mcbsp_platform_data {
struct omap_mcbsp { struct omap_mcbsp {
struct device *dev; struct device *dev;
unsigned long phys_base; unsigned long phys_base;
u32 io_base; void __iomem *io_base;
u8 id; u8 id;
u8 free; u8 free;
omap_mcbsp_word_length rx_word_length; omap_mcbsp_word_length rx_word_length;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
struct omap_mcbsp **mcbsp_ptr; struct omap_mcbsp **mcbsp_ptr;
int omap_mcbsp_count; int omap_mcbsp_count;
void omap_mcbsp_write(u32 io_base, u16 reg, u32 val) void omap_mcbsp_write(void __iomem *io_base, u16 reg, u32 val)
{ {
if (cpu_class_is_omap1() || cpu_is_omap2420()) if (cpu_class_is_omap1() || cpu_is_omap2420())
__raw_writew((u16)val, io_base + reg); __raw_writew((u16)val, io_base + reg);
...@@ -38,7 +38,7 @@ void omap_mcbsp_write(u32 io_base, u16 reg, u32 val) ...@@ -38,7 +38,7 @@ void omap_mcbsp_write(u32 io_base, u16 reg, u32 val)
__raw_writel(val, io_base + reg); __raw_writel(val, io_base + reg);
} }
int omap_mcbsp_read(u32 io_base, u16 reg) int omap_mcbsp_read(void __iomem *io_base, u16 reg)
{ {
if (cpu_class_is_omap1() || cpu_is_omap2420()) if (cpu_class_is_omap1() || cpu_is_omap2420())
return __raw_readw(io_base + reg); return __raw_readw(io_base + reg);
...@@ -149,7 +149,7 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data) ...@@ -149,7 +149,7 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
...@@ -158,8 +158,8 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) ...@@ -158,8 +158,8 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
mcbsp = id_to_mcbsp_ptr(id); mcbsp = id_to_mcbsp_ptr(id);
io_base = mcbsp->io_base; io_base = mcbsp->io_base;
dev_dbg(mcbsp->dev, "Configuring McBSP%d io_base: 0x%8x\n", dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
mcbsp->id, io_base); mcbsp->id, mcbsp->phys_base);
/* We write the given config */ /* We write the given config */
OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
...@@ -306,7 +306,7 @@ EXPORT_SYMBOL(omap_mcbsp_free); ...@@ -306,7 +306,7 @@ EXPORT_SYMBOL(omap_mcbsp_free);
void omap_mcbsp_start(unsigned int id) void omap_mcbsp_start(unsigned int id)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
u16 w; u16 w;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
...@@ -344,7 +344,7 @@ EXPORT_SYMBOL(omap_mcbsp_start); ...@@ -344,7 +344,7 @@ EXPORT_SYMBOL(omap_mcbsp_start);
void omap_mcbsp_stop(unsigned int id) void omap_mcbsp_stop(unsigned int id)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
u16 w; u16 w;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
...@@ -373,7 +373,7 @@ EXPORT_SYMBOL(omap_mcbsp_stop); ...@@ -373,7 +373,7 @@ EXPORT_SYMBOL(omap_mcbsp_stop);
int omap_mcbsp_pollwrite(unsigned int id, u16 buf) int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 base; void __iomem *base;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
...@@ -418,7 +418,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollwrite); ...@@ -418,7 +418,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollwrite);
int omap_mcbsp_pollread(unsigned int id, u16 *buf) int omap_mcbsp_pollread(unsigned int id, u16 *buf)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 base; void __iomem *base;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
...@@ -465,7 +465,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollread); ...@@ -465,7 +465,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollread);
void omap_mcbsp_xmit_word(unsigned int id, u32 word) void omap_mcbsp_xmit_word(unsigned int id, u32 word)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
omap_mcbsp_word_length word_length; omap_mcbsp_word_length word_length;
if (!omap_mcbsp_check_valid_id(id)) { if (!omap_mcbsp_check_valid_id(id)) {
...@@ -488,7 +488,7 @@ EXPORT_SYMBOL(omap_mcbsp_xmit_word); ...@@ -488,7 +488,7 @@ EXPORT_SYMBOL(omap_mcbsp_xmit_word);
u32 omap_mcbsp_recv_word(unsigned int id) u32 omap_mcbsp_recv_word(unsigned int id)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
u16 word_lsb, word_msb = 0; u16 word_lsb, word_msb = 0;
omap_mcbsp_word_length word_length; omap_mcbsp_word_length word_length;
...@@ -514,7 +514,7 @@ EXPORT_SYMBOL(omap_mcbsp_recv_word); ...@@ -514,7 +514,7 @@ EXPORT_SYMBOL(omap_mcbsp_recv_word);
int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base; void __iomem *io_base;
omap_mcbsp_word_length tx_word_length; omap_mcbsp_word_length tx_word_length;
omap_mcbsp_word_length rx_word_length; omap_mcbsp_word_length rx_word_length;
u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
...@@ -580,7 +580,8 @@ EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll); ...@@ -580,7 +580,8 @@ EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word) int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
{ {
struct omap_mcbsp *mcbsp; struct omap_mcbsp *mcbsp;
u32 io_base, clock_word = 0; u32 clock_word = 0;
void __iomem *io_base;
omap_mcbsp_word_length tx_word_length; omap_mcbsp_word_length tx_word_length;
omap_mcbsp_word_length rx_word_length; omap_mcbsp_word_length rx_word_length;
u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
...@@ -893,7 +894,12 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev) ...@@ -893,7 +894,12 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
mcbsp->dma_rx_lch = -1; mcbsp->dma_rx_lch = -1;
mcbsp->phys_base = pdata->phys_base; mcbsp->phys_base = pdata->phys_base;
mcbsp->io_base = pdata->virt_base; mcbsp->io_base = ioremap(pdata->phys_base, SZ_4K);
if (!mcbsp->io_base) {
ret = -ENOMEM;
goto err_ioremap;
}
/* Default I/O is IRQ based */ /* Default I/O is IRQ based */
mcbsp->io_type = OMAP_MCBSP_IRQ_IO; mcbsp->io_type = OMAP_MCBSP_IRQ_IO;
mcbsp->tx_irq = pdata->tx_irq; mcbsp->tx_irq = pdata->tx_irq;
...@@ -904,18 +910,22 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev) ...@@ -904,18 +910,22 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
if (pdata->clk_name) if (pdata->clk_name)
mcbsp->clk = clk_get(&pdev->dev, pdata->clk_name); mcbsp->clk = clk_get(&pdev->dev, pdata->clk_name);
if (IS_ERR(mcbsp->clk)) { if (IS_ERR(mcbsp->clk)) {
mcbsp->free = 0;
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Invalid clock configuration for McBSP%d.\n", "Invalid clock configuration for McBSP%d.\n",
mcbsp->id); mcbsp->id);
ret = -EINVAL; ret = PTR_ERR(mcbsp->clk);
goto exit; goto err_clk;
} }
mcbsp->pdata = pdata; mcbsp->pdata = pdata;
mcbsp->dev = &pdev->dev; mcbsp->dev = &pdev->dev;
platform_set_drvdata(pdev, mcbsp); platform_set_drvdata(pdev, mcbsp);
return 0;
err_clk:
iounmap(mcbsp->io_base);
err_ioremap:
mcbsp->free = 0;
exit: exit:
return ret; return ret;
} }
...@@ -934,6 +944,8 @@ static int omap_mcbsp_remove(struct platform_device *pdev) ...@@ -934,6 +944,8 @@ static int omap_mcbsp_remove(struct platform_device *pdev)
clk_disable(mcbsp->clk); clk_disable(mcbsp->clk);
clk_put(mcbsp->clk); clk_put(mcbsp->clk);
iounmap(mcbsp->io_base);
mcbsp->clk = NULL; mcbsp->clk = NULL;
mcbsp->free = 0; mcbsp->free = 0;
mcbsp->dev = NULL; mcbsp->dev = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment