Re: 2.6.26-rc3-omap vs N810 and Xomap
Radoslaw Szkodzinski wrote: Hello, I've managed to get 2.6.26-rc3-omap booting (was quite easy actually). Now I hit a road block - I get everything to start, it boots nicely (checked with SSH), but fails to display anything except a white screen. Looks like Xomap can't (re)init framebuffer, or focus isn't transferred to it. Any known possible reasons? Maybe your Xomap is built with older omapfb.h? I don't know about 2.6.2x kernels but I was bitten by this when trying Xomap binary built for N800 with 2.6.18 on 770 with 2.6.16 kernel. There was change in OMAPFB_UPDATE_WINDOW ioctl and the symptomps were similar. Frantisek -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] Added sleep support to UART
UART usage (e.g. serial console) now denies sleep for 5 seconds. This makes it possible to use serial console when dynamic idle is enabled. Also moved code from pm-debug.c to serial.c, and made pm24xx.c use this new implementation. Signed-off-by: Tero Kristo [EMAIL PROTECTED] --- arch/arm/mach-omap2/pm-debug.c | 132 arch/arm/mach-omap2/pm.h |8 -- arch/arm/mach-omap2/pm24xx.c | 53 ++- arch/arm/mach-omap2/pm34xx.c |8 ++- arch/arm/mach-omap2/serial.c | 118 include/asm-arm/arch-omap/common.h |3 + 6 files changed, 163 insertions(+), 159 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 8a9f3c4..c20fa3b 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -34,138 +34,6 @@ #ifdef CONFIG_PM_DEBUG int omap2_pm_debug = 0; -static int serial_console_clock_disabled; -static int serial_console_uart; -static unsigned int serial_console_next_disable; - -static struct clk *console_iclk, *console_fclk; - -static void serial_console_kick(void) -{ - serial_console_next_disable = omap2_read_32k_sync_counter(); - /* Keep the clocks on for 4 secs */ - serial_console_next_disable += 4 * 32768; -} - -static void serial_wait_tx(void) -{ - static const unsigned long uart_bases[3] = { - 0x4806a000, 0x4806c000, 0x4806e000 - }; - unsigned long lsr_reg; - int looped = 0; - - /* Wait for TX FIFO and THR to get empty */ - lsr_reg = IO_ADDRESS(uart_bases[serial_console_uart - 1] + (5 2)); - while ((__raw_readb(lsr_reg) 0x60) != 0x60) - looped = 1; - if (looped) - serial_console_kick(); -} - -u32 omap2_read_32k_sync_counter(void) -{ -return omap_readl(OMAP2_32KSYNCT_BASE + 0x0010); -} - -void serial_console_fclk_mask(u32 *f1, u32 *f2) -{ - switch (serial_console_uart) { - case 1: - *f1 = ~(1 21); - break; - case 2: - *f1 = ~(1 22); - break; - case 3: - *f2 = ~(1 2); - break; - } -} - -void serial_console_sleep(int enable) -{ - if (console_iclk == NULL || console_fclk == NULL) - return; - - if (enable) { - BUG_ON(serial_console_clock_disabled); - if (clk_get_usecount(console_fclk) == 0) - return; - if ((int) serial_console_next_disable - (int) omap2_read_32k_sync_counter() = 0) - return; - serial_wait_tx(); - clk_disable(console_iclk); - clk_disable(console_fclk); - serial_console_clock_disabled = 1; - } else { - int serial_wakeup = 0; - u32 l; - - switch (serial_console_uart) { - case 1: - l = prm_read_mod_reg(CORE_MOD, PM_WKST1); - if (l OMAP24XX_ST_UART1) - serial_wakeup = 1; - break; - case 2: - l = prm_read_mod_reg(CORE_MOD, PM_WKST1); - if (l OMAP24XX_ST_UART2) - serial_wakeup = 1; - break; - case 3: - l = prm_read_mod_reg(CORE_MOD, OMAP24XX_PM_WKST2); - if (l OMAP24XX_ST_UART3) - serial_wakeup = 1; - break; - } - if (serial_wakeup) - serial_console_kick(); - if (!serial_console_clock_disabled) - return; - clk_enable(console_iclk); - clk_enable(console_fclk); - serial_console_clock_disabled = 0; - } -} - -void pm_init_serial_console(void) -{ - const struct omap_serial_console_config *conf; - char name[16]; - - conf = omap_get_config(OMAP_TAG_SERIAL_CONSOLE, - struct omap_serial_console_config); - if (conf == NULL) - return; - if (conf-console_uart 3 || conf-console_uart 1) - return; - serial_console_uart = conf-console_uart; - sprintf(name, uart%d_fck, conf-console_uart); - console_fclk = clk_get(NULL, name); - if (IS_ERR(console_fclk)) - console_fclk = NULL; - name[6] = 'i'; - console_iclk = clk_get(NULL, name); - if (IS_ERR(console_fclk)) - console_iclk = NULL; - if (console_fclk == NULL || console_iclk == NULL) { - serial_console_uart = 0; - return; - } - switch (serial_console_uart) { - case 1: - prm_set_mod_reg_bits(OMAP24XX_ST_UART1, CORE_MOD, PM_WKEN1); - break; -
Dynamic idle support for UART
This hack will most importantly allow serial console usage when dynamic idle is enabled. Note! Functionality under 24xx configuration has not been verified! There may be some problems with CONFIG_PM_DEBUG flag enabled, most likely during the PM debug information dumps after / before sleep. Without this debugging flag this patch should not affect 24xx devices. Todo: Someone to check functionality under 24xx configuration and to enable functionality by default on that platform also. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] PLAT-OMAP: MCBSP: Tranform into platform driver
Hi Tony and Trilok, I was out of office this last week due to some trainings and brazilian holidays, so that's why this message is delayed. I'm sending a version of this series including your patch and your comments. Please review them as usual. I think that Chandra can still put his work on top of this as the change is not that big. On Tue, May 20, 2008 at 7:44 PM, Tony Lindgren [EMAIL PROTECTED] wrote: Hi, Some comments below. snip You need to check for the errors with clk_get here. Also, I needed the attached patch to keep asoc working on 24xx. Ok. Including your patch to the series. Forgot to change this to 24xx clocks. In general, how about create a custom clock for each mcbsp that handles all the other clocks? That way you can have just one struct clk * for each mcbsp and you can use standard clk_enable/disable calls instead of the hard to read macros. You can add the custom clocks to clock fwk with clk_register() during the omap specific mcbsp init depending on which mcbsp's are in use from board-*.c files. Then the custom clock defines it's own enable/disable function that just calls the clk_enable/disable on the right mcbsp clocks. snip These macros make things hard to read.. It would be best to have things set up in a way so you can just call clk_enable/disable in mcbsp.c. I thought to do it as you describe above but I made it different to avoid duplicated code into mach-omap1 and mach-omap2. However, as you said the code became too hard to understand, I believe it is better to make it simple. I'm going to send a new version of this series including: 1. your patch to 24xx 2. clock changes for mach-omap1 and mach-omap2 3. module release for mach-omap1 and mach-omap2 as recommended by Trilok Tony +int omap_mcbsp_init(void); +void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, + int size); void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); int omap_mcbsp_request(unsigned int id); void omap_mcbsp_free(unsigned int id); -- 1.5.5.1.67.gbdb8.dirty -- Eduardo Bezerra Valentin -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1
From: Eduardo Valentin [EMAIL PROTECTED] This patch adds support for mach-omap1 based on current mcbsp platform driver. Signed-off-by: Eduardo Valentin [EMAIL PROTECTED] --- arch/arm/mach-omap1/Makefile |2 + arch/arm/mach-omap1/mcbsp.c | 249 ++ 2 files changed, 251 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/mcbsp.c diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index c524511..d8b7e1c 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -5,6 +5,8 @@ # Common support obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o +obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o + obj-$(CONFIG_OMAP_MPU_TIMER) += time.o obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c new file mode 100644 index 000..7d40f43 --- /dev/null +++ b/arch/arm/mach-omap1/mcbsp.c @@ -0,0 +1,249 @@ +/* + * linux/arch/arm/mach-omap1/mcbsp.c + * + * Copyright (C) 2008 Instituto Nokia de Tecnologia + * Contact: Eduardo Valentin [EMAIL PROTECTED] + * + * 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. + * + * Multichannel mode not supported. + */ +#include linux/module.h +#include linux/init.h +#include linux/clk.h +#include linux/err.h +#include linux/io.h +#include linux/platform_device.h + +#include asm/arch/dma.h +#include asm/arch/mux.h +#include asm/arch/cpu.h +#include asm/arch/mcbsp.h +#include asm/arch/dsp_common.h + +#define DPS_RSTCT2_PER_EN (1 0) +#define DSP_RSTCT2_WD_PER_EN (1 1) + +struct mcbsp_internal_clk { + struct clk clk; + struct clk **childs; + int n_childs; +}; + +#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) +static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) +{ + const char *clk_names[] = { dsp_ck, api_ck, dspxor_ck }; + int i; + + mclk-n_childs = ARRAY_SIZE(clk_names); + mclk-childs = kzalloc(mclk-n_childs * sizeof(struct clk *), + GFP_KERNEL); + + for (i = 0; i mclk-n_childs; i++) { + /* We fake a platform device to get correct device id */ + struct platform_device pdev; + + pdev.dev.bus = platform_bus_type; + pdev.id = mclk-clk.id; + mclk-childs[i] = clk_get(pdev.dev, clk_names[i]); + if (IS_ERR(mclk-childs[i])) + printk(KERN_ERR Could not get clock %s (%d).\n, + clk_names[i], mclk-clk.id); + } +} + +static int omap_mcbsp_clk_enable(struct clk *clk) +{ + struct mcbsp_internal_clk *mclk = container_of(clk, + struct mcbsp_internal_clk, clk); + int i; + + for (i = 0; i mclk-n_childs; i++) + clk_enable(mclk-childs[i]); + return 0; +} + +static void omap_mcbsp_clk_disable(struct clk *clk) +{ + struct mcbsp_internal_clk *mclk = container_of(clk, + struct mcbsp_internal_clk, clk); + int i; + + for (i = 0; i mclk-n_childs; i++) + clk_disable(mclk-childs[i]); +} + +static struct mcbsp_internal_clk omap_mcbsp_clks[] = { + { + .clk = { + .name = mcbsp_clk, + .id = 1, + .enable = omap_mcbsp_clk_enable, + .disable= omap_mcbsp_clk_disable, + }, + }, + { + .clk = { + .name = mcbsp_clk, + .id = 3, + .enable = omap_mcbsp_clk_enable, + .disable= omap_mcbsp_clk_disable, + }, + }, +}; + +#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks) +#else +#define omap_mcbsp_clksNULL +#define omap_mcbsp_clks_size 0 +#endif + +static int omap1_mcbsp_check(unsigned int id) +{ + /* REVISIT: Check correctly for number of registered McBSPs */ + if (cpu_is_omap730()) { + if (id OMAP_MAX_MCBSP_COUNT - 2) { + printk(KERN_ERR OMAP-McBSP: McBSP%d doesn't exist\n, + id + 1); + return -ENODEV; + } + return 0; + } + + if (cpu_is_omap15xx() || cpu_is_omap16xx()) { + if (id OMAP_MAX_MCBSP_COUNT - 1) { + printk(KERN_ERR OMAP-McBSP: McBSP%d doesn't exist\n, + id + 1); + return -ENODEV; + } + return 0; + } + + return -ENODEV; +} + +static void omap1_mcbsp_request(unsigned int id) +{ + /* +* On
Re: [PATCH 2/5] MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1
Hiya, On 29/05/2008, Eduardo Valentin [EMAIL PROTECTED] wrote: +static struct omap_mcbsp_platform_data omap1_mcbsp_pdata[] = { +#ifdef CONFIG_ARCH_OMAP730 + { + .virt_base = io_p2v(OMAP730_MCBSP1_BASE), + .dma_rx_sync= OMAP_DMA_MCBSP1_RX, + .dma_tx_sync= OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_730_McBSP1RX, + .tx_irq = INT_730_McBSP1TX, + .ops= omap1_mcbsp_ops, + }, + { + .virt_base = io_p2v(OMAP730_MCBSP2_BASE), + .dma_rx_sync= OMAP_DMA_MCBSP3_RX, + .dma_tx_sync= OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_730_McBSP2RX, + .tx_irq = INT_730_McBSP2TX + .ops= omap1_mcbsp_ops, + }, +#endif +#ifdef CONFIG_ARCH_OMAP15XX + { + .virt_base = OMAP1510_MCBSP1_BASE, + .dma_rx_sync= OMAP_DMA_MCBSP1_RX, + .dma_tx_sync= OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_McBSP1RX, + .tx_irq = INT_McBSP1TX, + .ops= omap1_mcbsp_ops, + .clk_name = mcbsp_clk, + }, + { + .virt_base = io_p2v(OMAP1510_MCBSP2_BASE), + .dma_rx_sync= OMAP_DMA_MCBSP2_RX, + .dma_tx_sync= OMAP_DMA_MCBSP2_TX, + .rx_irq = INT_1510_SPI_RX, + .tx_irq = INT_1510_SPI_TX, + .ops= omap1_mcbsp_ops, + }, + { + .virt_base = OMAP1510_MCBSP3_BASE, + .dma_rx_sync= OMAP_DMA_MCBSP3_RX, + .dma_tx_sync= OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_McBSP3RX, + .tx_irq = INT_McBSP3TX, + .ops= omap1_mcbsp_ops, + .clk_name = mcbsp_clk, + }, +#endif +#ifdef CONFIG_ARCH_OMAP16XX + { + .virt_base = OMAP1610_MCBSP1_BASE, + .dma_rx_sync= OMAP_DMA_MCBSP1_RX, + .dma_tx_sync= OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_McBSP1RX, + .tx_irq = INT_McBSP1TX, + .ops= omap1_mcbsp_ops, + .clk_name = mcbsp_clk, + }, + { + .virt_base = io_p2v(OMAP1610_MCBSP2_BASE), + .dma_rx_sync= OMAP_DMA_MCBSP2_RX, + .dma_tx_sync= OMAP_DMA_MCBSP2_TX, + .rx_irq = INT_1610_McBSP2_RX, + .tx_irq = INT_1610_McBSP2_TX, + .ops= omap1_mcbsp_ops, + }, + { + .virt_base = OMAP1610_MCBSP3_BASE, + .dma_rx_sync= OMAP_DMA_MCBSP3_RX, + .dma_tx_sync= OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_McBSP3RX, + .tx_irq = INT_McBSP3TX, + .ops= omap1_mcbsp_ops, + .clk_name = mcbsp_clk, + }, +#endif +}; I think you need a runtime omap model check here. Otherwise if you have all three models enabled in the config (I don't remember if that is supported but that's not the point) you'll get eight platform_devices. That will not Oops because there's a sanity check in omap_mcbsp_register_board_cfg() but only the first three will get registered. There is a runtime check in the original version. Same applies to PATCH 5/5 for omap2. Cheers, Andrew -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 5/5] MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2
+ +static struct omap_mcbsp_platform_data omap2_mcbsp_pdata[] = { +#ifdef CONFIG_ARCH_OMAP24XX + { + .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE), + .dma_rx_sync= OMAP24XX_DMA_MCBSP1_RX, + .dma_tx_sync= OMAP24XX_DMA_MCBSP1_TX, + .rx_irq = INT_24XX_MCBSP1_IRQ_RX, + .tx_irq = INT_24XX_MCBSP1_IRQ_TX, + .ops= omap2_mcbsp_ops, + .clk_name = mcbsp_clk, + }, + { + .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE), + .dma_rx_sync= OMAP24XX_DMA_MCBSP2_RX, + .dma_tx_sync= OMAP24XX_DMA_MCBSP2_TX, + .rx_irq = INT_24XX_MCBSP2_IRQ_RX, + .tx_irq = INT_24XX_MCBSP2_IRQ_TX, + .ops= omap2_mcbsp_ops, + .clk_name = mcbsp_clk, + }, +#endif +#ifdef CONFIG_ARCH_OMAP34XX + { + .virt_base = IO_ADDRESS(OMAP34XX_MCBSP1_BASE), + .dma_rx_sync= OMAP24XX_DMA_MCBSP1_RX, + .dma_tx_sync= OMAP24XX_DMA_MCBSP1_TX, + .rx_irq = INT_24XX_MCBSP1_IRQ_RX, + .tx_irq = INT_24XX_MCBSP1_IRQ_TX, + .ops= omap2_mcbsp_ops, + .clk_name = mcbsp_clk, + }, + { + .virt_base = IO_ADDRESS(OMAP34XX_MCBSP2_BASE), + .dma_rx_sync= OMAP24XX_DMA_MCBSP2_RX, + .dma_tx_sync= OMAP24XX_DMA_MCBSP2_TX, + .rx_irq = INT_24XX_MCBSP2_IRQ_RX, + .tx_irq = INT_24XX_MCBSP2_IRQ_TX, + .ops= omap2_mcbsp_ops, + .clk_name = mcbsp_clk, + }, +#endif +}; I guess Tony won't like this as it will break support for multi-omap. Regards, Anand -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] ARM: OMAP: Fix 24xx mcbsp clocks
From: Tony Lindgren [EMAIL PROTECTED] Fix 24xx mcbsp clocks Signed-off-by: Tony Lindgren [EMAIL PROTECTED] --- arch/arm/mach-omap2/clock24xx.h | 30 -- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h index ee39794..00ca071 100644 --- a/arch/arm/mach-omap2/clock24xx.h +++ b/arch/arm/mach-omap2/clock24xx.h @@ -1820,7 +1820,8 @@ static struct clk gpt12_fck = { }; static struct clk mcbsp1_ick = { - .name = mcbsp1_ick, + .name = mcbsp_ick, + .id = 1, .parent = l4_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1830,7 +1831,8 @@ static struct clk mcbsp1_ick = { }; static struct clk mcbsp1_fck = { - .name = mcbsp1_fck, + .name = mcbsp_fck, + .id = 1, .parent = func_96m_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1840,7 +1842,8 @@ static struct clk mcbsp1_fck = { }; static struct clk mcbsp2_ick = { - .name = mcbsp2_ick, + .name = mcbsp_ick, + .id = 2, .parent = l4_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1850,7 +1853,8 @@ static struct clk mcbsp2_ick = { }; static struct clk mcbsp2_fck = { - .name = mcbsp2_fck, + .name = mcbsp_fck, + .id = 2, .parent = func_96m_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1860,7 +1864,8 @@ static struct clk mcbsp2_fck = { }; static struct clk mcbsp3_ick = { - .name = mcbsp3_ick, + .name = mcbsp_ick, + .id = 3, .parent = l4_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1870,7 +1875,8 @@ static struct clk mcbsp3_ick = { }; static struct clk mcbsp3_fck = { - .name = mcbsp3_fck, + .name = mcbsp_fck, + .id = 3, .parent = func_96m_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1880,7 +1886,8 @@ static struct clk mcbsp3_fck = { }; static struct clk mcbsp4_ick = { - .name = mcbsp4_ick, + .name = mcbsp_ick, + .id = 4, .parent = l4_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1890,7 +1897,8 @@ static struct clk mcbsp4_ick = { }; static struct clk mcbsp4_fck = { - .name = mcbsp4_fck, + .name = mcbsp_fck, + .id = 4, .parent = func_96m_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1900,7 +1908,8 @@ static struct clk mcbsp4_fck = { }; static struct clk mcbsp5_ick = { - .name = mcbsp5_ick, + .name = mcbsp_ick, + .id = 5, .parent = l4_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, @@ -1910,7 +1919,8 @@ static struct clk mcbsp5_ick = { }; static struct clk mcbsp5_fck = { - .name = mcbsp5_fck, + .name = mcbsp_fck, + .id = 5, .parent = func_96m_ck, .flags = CLOCK_IN_OMAP243X, .clkdm_name = core_l4_clkdm, -- 1.5.5.GIT -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1
From: Eduardo Valentin [EMAIL PROTECTED] This patch adds support for mach-omap1 based on current mcbsp platform driver. Signed-off-by: Eduardo Valentin [EMAIL PROTECTED] --- arch/arm/mach-omap1/Makefile |2 + arch/arm/mach-omap1/mcbsp.c | 280 ++ 2 files changed, 282 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/mcbsp.c diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index c524511..d8b7e1c 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -5,6 +5,8 @@ # Common support obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o +obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o + obj-$(CONFIG_OMAP_MPU_TIMER) += time.o obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c new file mode 100644 index 000..2d2c252 --- /dev/null +++ b/arch/arm/mach-omap1/mcbsp.c @@ -0,0 +1,280 @@ +/* + * linux/arch/arm/mach-omap1/mcbsp.c + * + * Copyright (C) 2008 Instituto Nokia de Tecnologia + * Contact: Eduardo Valentin [EMAIL PROTECTED] + * + * 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. + * + * Multichannel mode not supported. + */ +#include linux/module.h +#include linux/init.h +#include linux/clk.h +#include linux/err.h +#include linux/io.h +#include linux/platform_device.h + +#include asm/arch/dma.h +#include asm/arch/mux.h +#include asm/arch/cpu.h +#include asm/arch/mcbsp.h +#include asm/arch/dsp_common.h + +#define DPS_RSTCT2_PER_EN (1 0) +#define DSP_RSTCT2_WD_PER_EN (1 1) + +struct mcbsp_internal_clk { + struct clk clk; + struct clk **childs; + int n_childs; +}; + +#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) +static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) +{ + const char *clk_names[] = { dsp_ck, api_ck, dspxor_ck }; + int i; + + mclk-n_childs = ARRAY_SIZE(clk_names); + mclk-childs = kzalloc(mclk-n_childs * sizeof(struct clk *), + GFP_KERNEL); + + for (i = 0; i mclk-n_childs; i++) { + /* We fake a platform device to get correct device id */ + struct platform_device pdev; + + pdev.dev.bus = platform_bus_type; + pdev.id = mclk-clk.id; + mclk-childs[i] = clk_get(pdev.dev, clk_names[i]); + if (IS_ERR(mclk-childs[i])) + printk(KERN_ERR Could not get clock %s (%d).\n, + clk_names[i], mclk-clk.id); + } +} + +static int omap_mcbsp_clk_enable(struct clk *clk) +{ + struct mcbsp_internal_clk *mclk = container_of(clk, + struct mcbsp_internal_clk, clk); + int i; + + for (i = 0; i mclk-n_childs; i++) + clk_enable(mclk-childs[i]); + return 0; +} + +static void omap_mcbsp_clk_disable(struct clk *clk) +{ + struct mcbsp_internal_clk *mclk = container_of(clk, + struct mcbsp_internal_clk, clk); + int i; + + for (i = 0; i mclk-n_childs; i++) + clk_disable(mclk-childs[i]); +} + +static struct mcbsp_internal_clk omap_mcbsp_clks[] = { + { + .clk = { + .name = mcbsp_clk, + .id = 1, + .enable = omap_mcbsp_clk_enable, + .disable= omap_mcbsp_clk_disable, + }, + }, + { + .clk = { + .name = mcbsp_clk, + .id = 3, + .enable = omap_mcbsp_clk_enable, + .disable= omap_mcbsp_clk_disable, + }, + }, +}; + +#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks) +#else +#define omap_mcbsp_clks_size 0 +static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks; +static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) +{ } +#endif + +static int omap1_mcbsp_check(unsigned int id) +{ + /* REVISIT: Check correctly for number of registered McBSPs */ + if (cpu_is_omap730()) { + if (id OMAP_MAX_MCBSP_COUNT - 2) { + printk(KERN_ERR OMAP-McBSP: McBSP%d doesn't exist\n, + id + 1); + return -ENODEV; + } + return 0; + } + + if (cpu_is_omap15xx() || cpu_is_omap16xx()) { + if (id OMAP_MAX_MCBSP_COUNT - 1) { + printk(KERN_ERR OMAP-McBSP: McBSP%d doesn't exist\n, + id + 1); + return -ENODEV; + } + return 0; + } + +