* [RFC][PATCH 0/2] musb init generalization
@ 2008-04-24 13:46 Felipe Balbi
2008-04-24 13:46 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Felipe Balbi
0 siblings, 1 reply; 21+ messages in thread
From: Felipe Balbi @ 2008-04-24 13:46 UTC (permalink / raw)
To: linux-omap, David Brownell; +Cc: Tony Lindgren, khasim, Felipe Balbi
The following two patches allow us to use a common
board file for usb initialization on omap2430 and omap3
boards.
First we introduce cpu_class_is_omap3() and use it to change
resource offsets.
It's should be ok adding cpu_class_is_omap3() now since soon we
already have omap35xx chips and sooner or later we're gonna
have patches for it in linux-omap (??)
Both patches are RFC but they're working on omap3430sdp.
Maybe someone could try on omap2430.
Comments are always welcome.
Felipe Balbi (2):
OMAP: Introduce cpu_class_is_omap3()
USB: Generalize usb initialization for omap hw
arch/arm/mach-omap2/Makefile | 4 +-
arch/arm/mach-omap2/board-2430sdp-usb.c | 96 --------------------
arch/arm/mach-omap2/board-2430sdp.c | 3 +-
arch/arm/mach-omap2/board-3430sdp.c | 3 +-
.../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++---
arch/arm/plat-omap/common.c | 2 +-
arch/arm/plat-omap/dma.c | 58 ++++++------
arch/arm/plat-omap/dmtimer.c | 10 +-
arch/arm/plat-omap/gpio.c | 14 ++--
arch/arm/plat-omap/sram.c | 4 +-
arch/arm/plat-omap/usb.c | 2 +-
include/asm-arm/arch-omap/cpu.h | 3 +-
include/asm-arm/arch-omap/usb-musb.h | 35 +++++++
13 files changed, 108 insertions(+), 158 deletions(-)
delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c
rename arch/arm/mach-omap2/{board-3430sdp-usb.c => usb-musb.c} (91%)
create mode 100644 include/asm-arm/arch-omap/usb-musb.h
^ permalink raw reply [flat|nested] 21+ messages in thread* [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() 2008-04-24 13:46 [RFC][PATCH 0/2] musb init generalization Felipe Balbi @ 2008-04-24 13:46 ` Felipe Balbi 2008-04-24 13:46 ` [PATCH 2/2] USB: Generalize usb initialization for omap hw Felipe Balbi 2008-04-24 17:06 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Tony Lindgren 0 siblings, 2 replies; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 13:46 UTC (permalink / raw) To: linux-omap, David Brownell; +Cc: Tony Lindgren, khasim, Felipe Balbi Add cpu_class_is_omap3(). Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- arch/arm/plat-omap/common.c | 2 +- arch/arm/plat-omap/dma.c | 58 +++++++++++++++++++------------------- arch/arm/plat-omap/dmtimer.c | 10 +++--- arch/arm/plat-omap/gpio.c | 14 +++++----- arch/arm/plat-omap/sram.c | 4 +- arch/arm/plat-omap/usb.c | 2 +- include/asm-arm/arch-omap/cpu.h | 3 +- 7 files changed, 47 insertions(+), 46 deletions(-) diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index fd6f329..d4dfe4c 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c @@ -240,7 +240,7 @@ static int __init omap_init_clocksource_32k(void) static char err[] __initdata = KERN_ERR "%s: can't register clocksource!\n"; - if (cpu_is_omap16xx() || cpu_class_is_omap2()) { + if (cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3()) { struct clk *sync_32k_ick; sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index c00eda5..c16ea64 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -211,7 +211,7 @@ void omap_set_dma_priority(int lch, int dst_port, int priority) omap_writel(l, reg); } - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { if (priority) OMAP_DMA_CCR_REG(lch) |= (1 << 6); else @@ -236,7 +236,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, OMAP1_DMA_CCR2_REG(lch) |= 1 << 2; } - if (cpu_class_is_omap2() && dma_trigger) { + if ((cpu_class_is_omap2() || cpu_class_is_omap3()) && dma_trigger) { u32 val = OMAP_DMA_CCR_REG(lch); val &= ~(3 << 19); @@ -276,7 +276,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) BUG_ON(omap_dma_in_1510_mode()); - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { REVISIT_24XX(); return; } @@ -308,7 +308,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) { - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { OMAP_DMA_CSDP_REG(lch) &= ~(0x3 << 16); OMAP_DMA_CSDP_REG(lch) |= (mode << 16); } @@ -332,7 +332,7 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode, OMAP1_DMA_CSSA_L_REG(lch) = src_start; } - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) OMAP2_DMA_CSSA_REG(lch) = src_start; OMAP_DMA_CSEI_REG(lch) = src_ei; @@ -359,7 +359,7 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) void omap_set_dma_src_index(int lch, int eidx, int fidx) { - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { REVISIT_24XX(); return; } @@ -383,13 +383,13 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) case OMAP_DMA_DATA_BURST_DIS: break; case OMAP_DMA_DATA_BURST_4: - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) burst = 0x1; else burst = 0x2; break; case OMAP_DMA_DATA_BURST_8: - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { burst = 0x2; break; } @@ -398,7 +398,7 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) * fall through */ case OMAP_DMA_DATA_BURST_16: - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { burst = 0x3; break; } @@ -429,7 +429,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, OMAP1_DMA_CDSA_L_REG(lch) = dest_start; } - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) OMAP2_DMA_CDSA_REG(lch) = dest_start; OMAP_DMA_CDEI_REG(lch) = dst_ei; @@ -438,7 +438,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, void omap_set_dma_dest_index(int lch, int eidx, int fidx) { - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { REVISIT_24XX(); return; } @@ -462,19 +462,19 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) case OMAP_DMA_DATA_BURST_DIS: break; case OMAP_DMA_DATA_BURST_4: - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) burst = 0x1; else burst = 0x2; break; case OMAP_DMA_DATA_BURST_8: - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) burst = 0x2; else burst = 0x3; break; case OMAP_DMA_DATA_BURST_16: - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { burst = 0x3; break; } @@ -496,7 +496,7 @@ static inline void omap_enable_channel_irq(int lch) /* Clear CSR */ if (cpu_class_is_omap1()) status = OMAP_DMA_CSR_REG(lch); - else if (cpu_class_is_omap2()) + else if (cpu_class_is_omap2() || cpu_class_is_omap3()) OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; /* Enable some nice interrupts. */ @@ -507,7 +507,7 @@ static inline void omap_enable_channel_irq(int lch) static void omap_disable_channel_irq(int lch) { - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) OMAP_DMA_CICR_REG(lch) = 0; } @@ -547,7 +547,7 @@ static inline void disable_lnk(int lch) OMAP_DMA_CLNK_CTRL_REG(lch) |= 1 << 14; } - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { omap_disable_channel_irq(lch); /* Clear the ENABLE_LNK bit */ OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 15); @@ -560,7 +560,7 @@ static inline void omap2_enable_irq_lch(int lch) { u32 val; - if (!cpu_class_is_omap2()) + if (!cpu_class_is_omap2() || cpu_class_is_omap3()) return; val = omap_readl(OMAP_DMA4_IRQENABLE_L0); @@ -594,7 +594,7 @@ int omap_request_dma(int dev_id, const char *dev_name, if (cpu_class_is_omap1()) clear_lch_regs(free_ch); - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) omap_clear_dma(free_ch); spin_unlock_irqrestore(&dma_chan_lock, flags); @@ -610,7 +610,7 @@ int omap_request_dma(int dev_id, const char *dev_name, if (cpu_class_is_omap1()) chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ; - else if (cpu_class_is_omap2()) + else if (cpu_class_is_omap2() || cpu_class_is_omap3()) chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ | OMAP2_DMA_TRANS_ERR_IRQ; @@ -627,7 +627,7 @@ int omap_request_dma(int dev_id, const char *dev_name, OMAP_DMA_CCR_REG(free_ch) = dev_id; } - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { omap2_enable_irq_lch(free_ch); omap_enable_channel_irq(free_ch); @@ -664,7 +664,7 @@ void omap_free_dma(int lch) OMAP_DMA_CCR_REG(lch) = 0; } - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { u32 val; /* Disable interrupts */ val = omap_readl(OMAP_DMA4_IRQENABLE_L0); @@ -699,7 +699,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) { u32 reg; - if (!cpu_class_is_omap2()) { + if (!cpu_class_is_omap2() && !cpu_class_is_omap3()) { printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__); return; } @@ -763,7 +763,7 @@ void omap_clear_dma(int lch) status = OMAP_DMA_CSR_REG(lch); } - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { int i; u32 lch_base = OMAP_DMA4_BASE + lch * 0x60 + 0x80; for (i = 0; i < 0x44; i += 4) @@ -799,7 +799,7 @@ void omap_start_dma(int lch) cur_lch = next_lch; } while (next_lch != -1); - } else if (cpu_class_is_omap2()) { + } else if (cpu_class_is_omap2() || cpu_class_is_omap3()) { /* Errata: Need to write lch even if not using chaining */ OMAP_DMA_CLNK_CTRL_REG(lch) = lch; } @@ -890,7 +890,7 @@ dma_addr_t omap_get_dma_src_pos(int lch) offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) | (OMAP1_DMA_CSSA_U_REG(lch) << 16)); - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) offset = OMAP_DMA_CSAC_REG(lch); return offset; @@ -912,7 +912,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch) offset = (dma_addr_t) (OMAP1_DMA_CDSA_L_REG(lch) | (OMAP1_DMA_CDSA_U_REG(lch) << 16)); - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) offset = OMAP_DMA_CDAC_REG(lch); return offset; @@ -2140,7 +2140,7 @@ static int __init omap_init_dma(void) w &= ~(1 << 8); omap_writew(w, OMAP1610_DMA_LCD_CTRL); } - } else if (cpu_class_is_omap2()) { + } else if (cpu_class_is_omap2() || cpu_class_is_omap3()) { u8 revision = omap_readb(OMAP_DMA4_REVISION); printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", revision >> 4, revision & 0xf); @@ -2187,7 +2187,7 @@ static int __init omap_init_dma(void) omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, DMA_DEFAULT_FIFO_DEPTH, 0); - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) setup_irq(INT_24XX_SDMA_IRQ0, &omap24xx_dma_irq); /* FIXME: Update LCD DMA to work on 24xx */ diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 822b6bb..e64f3d4 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -309,7 +309,7 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer) { u32 l; - if (!cpu_class_is_omap2() || timer != &dm_timers[0]) { + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) || timer != &dm_timers[0]) { omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06); omap_dm_timer_wait_for_reset(timer); } @@ -324,7 +324,7 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer) * FIXME: All timers should have wake-up enabled and clear * PRCM status. */ - if (cpu_class_is_omap2() && (timer == &dm_timers[0])) + if ((cpu_class_is_omap2() || cpu_class_is_omap3()) && (timer == &dm_timers[0])) l |= 1 << 2; omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l); @@ -650,7 +650,7 @@ int __init omap_dm_timer_init(void) struct omap_dm_timer *timer; int i; - if (!(cpu_is_omap16xx() || cpu_class_is_omap2())) + if (!(cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3())) return -ENODEV; spin_lock_init(&dm_timer_lock); @@ -667,7 +667,7 @@ int __init omap_dm_timer_init(void) dm_source_clocks = (struct clk **)omap3_dm_source_clocks; } - if (cpu_class_is_omap2()) + if (cpu_class_is_omap2() || cpu_class_is_omap3()) for (i = 0; dm_source_names[i] != NULL; i++) dm_source_clocks[i] = clk_get(NULL, dm_source_names[i]); @@ -678,7 +678,7 @@ int __init omap_dm_timer_init(void) timer = &dm_timers[i]; timer->io_base = (void __iomem *)io_p2v(timer->phys_base); #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { char clk_name[16]; sprintf(clk_name, "gpt%d_ick", i + 1); timer->iclk = clk_get(NULL, clk_name); diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 1903a34..70bedcb 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -628,7 +628,7 @@ static int gpio_irq_type(unsigned irq, unsigned type) int retval; unsigned long flags; - if (!cpu_class_is_omap2() && irq > IH_MPUIO_BASE) + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) && irq > IH_MPUIO_BASE) gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); else gpio = irq - IH_GPIO_BASE; @@ -640,7 +640,7 @@ static int gpio_irq_type(unsigned irq, unsigned type) return -EINVAL; /* OMAP1 allows only only edge triggering */ - if (!cpu_class_is_omap2() + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) return -EINVAL; @@ -1026,7 +1026,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) if (cpu_is_omap15xx() && (bank->method == METHOD_MPUIO)) isr &= 0x0000ffff; - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { level_mask = bank->level_mask & enabled; } @@ -1328,7 +1328,7 @@ static int __init _omap_gpio_init(void) } #endif #if defined(CONFIG_ARCH_OMAP2) - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { gpio_ick = clk_get(NULL, "gpios_ick"); if (IS_ERR(gpio_ick)) printk("Could not get gpios_ick\n"); @@ -1532,7 +1532,7 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) { int i; - if (!cpu_class_is_omap2() && !cpu_is_omap16xx()) + if (!cpu_class_is_omap2() && !cpu_class_is_omap3() && !cpu_is_omap16xx()) return 0; for (i = 0; i < gpio_bank_count; i++) { @@ -1727,7 +1727,7 @@ static int __init omap_gpio_sysinit(void) mpuio_init(); #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) - if (cpu_is_omap16xx() || cpu_class_is_omap2()) { + if (cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3()) { if (ret == 0) { ret = sysdev_class_register(&omap_gpio_sysclass); if (ret == 0) @@ -1789,7 +1789,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) if (bank_is_mpuio(bank)) gpio = OMAP_MPUIO(0); - else if (cpu_class_is_omap2() || cpu_is_omap730()) + else if (cpu_class_is_omap2() || cpu_class_is_omap3() || cpu_is_omap730()) bankwidth = 32; for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) { diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 2fc8f61..4596ba5 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c @@ -136,7 +136,7 @@ void __init omap_detect_sram(void) { unsigned long reserved; - if (cpu_class_is_omap2()) { + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { if (is_sram_locked()) { if (cpu_is_omap34xx()) { omap_sram_base = OMAP3_SRAM_PUB_VA; @@ -466,7 +466,7 @@ int __init omap_sram_init(void) omap_detect_sram(); omap_map_sram(); - if (!(cpu_class_is_omap2())) + if (!(cpu_class_is_omap2() || cpu_class_is_omap3())) omap1_sram_init(); else if (cpu_is_omap24xx()) omap24xx_sram_init(); diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c index a619475..b7365c3 100644 --- a/arch/arm/plat-omap/usb.c +++ b/arch/arm/plat-omap/usb.c @@ -170,7 +170,7 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device) } /* internal transceiver (unavailable on 17xx, 24xx) */ - if (!cpu_class_is_omap2() && nwires == 2) { + if (!(cpu_class_is_omap2() || cpu_class_is_omap3()) && nwires == 2) { // omap_cfg_reg(P9_USB_DP); // omap_cfg_reg(R8_USB_DM); diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h index 2626fbd..3b73ad5 100644 --- a/include/asm-arm/arch-omap/cpu.h +++ b/include/asm-arm/arch-omap/cpu.h @@ -317,7 +317,8 @@ IS_OMAP_TYPE(3430, 0x3430) /* Macros to detect if we have OMAP1 or OMAP2 */ #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ cpu_is_omap16xx()) -#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) +#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap243x()) +#define cpu_class_is_omap3() cpu_is_omap34xx() #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) /* -- 1.5.5.1.57.g5909c ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 13:46 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Felipe Balbi @ 2008-04-24 13:46 ` Felipe Balbi 2008-04-24 14:13 ` Gadiyar, Anand 2008-04-24 17:10 ` Tony Lindgren 2008-04-24 17:06 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Tony Lindgren 1 sibling, 2 replies; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 13:46 UTC (permalink / raw) To: linux-omap, David Brownell; +Cc: Tony Lindgren, khasim, Felipe Balbi Create a generic board-file for initializing usb on omap2430 and omap3 boards. Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- arch/arm/mach-omap2/Makefile | 4 +- arch/arm/mach-omap2/board-2430sdp-usb.c | 96 -------------------- arch/arm/mach-omap2/board-2430sdp.c | 3 +- arch/arm/mach-omap2/board-3430sdp.c | 3 +- .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ 6 files changed, 61 insertions(+), 112 deletions(-) delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c rename arch/arm/mach-omap2/{board-3430sdp-usb.c => usb-musb.c} (91%) create mode 100644 include/asm-arm/arch-omap/usb-musb.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index c37df1a..d95f8e9 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -29,11 +29,11 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \ board-2430sdp-flash.o \ board-sdp-hsmmc.o \ - board-2430sdp-usb.o + usb-musb.o obj-$(CONFIG_MACH_OMAP_2430OSK) += board-2430osk.o obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ board-sdp-hsmmc.o \ - board-3430sdp-usb.o \ + usb-musb.o \ board-3430sdp-flash.o obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c deleted file mode 100644 index cfbf73e..0000000 --- a/arch/arm/mach-omap2/board-2430sdp-usb.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * linux/arch/arm/mach-omap2/board-2430sdp-usb.c - * - * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> - * Author: Kevin Hilman - * - * 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. - */ - -#include <linux/types.h> -#include <linux/errno.h> -#include <linux/delay.h> -#include <linux/platform_device.h> -#include <linux/clk.h> -#include <linux/usb/musb.h> - -#include <asm/arch/hardware.h> -#include <asm/arch/pm.h> -#include <asm/arch/usb.h> - -static struct resource musb_resources[] = { - [0] = { - .start = OMAP243X_HS_BASE, - .end = OMAP243X_HS_BASE + SZ_8K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { /* general IRQ */ - .start = INT_243X_HS_USB_MC, - .flags = IORESOURCE_IRQ, - }, - [2] = { /* DMA IRQ */ - .start = INT_243X_HS_USB_DMA, - .flags = IORESOURCE_IRQ, - }, -}; - -static int usbhs_ick_on; - -static int musb_set_clock(struct clk *clk, int state) -{ - if (state) { - if (usbhs_ick_on > 0) - return -ENODEV; - - omap2_block_sleep(); - clk_enable(clk); - usbhs_ick_on = 1; - } else { - if (usbhs_ick_on == 0) - return -ENODEV; - - clk_disable(clk); - usbhs_ick_on = 0; - omap2_allow_sleep(); - } - - return 0; -} - -static struct musb_hdrc_platform_data musb_plat = { -#ifdef CONFIG_USB_MUSB_OTG - .mode = MUSB_OTG, -#elif defined(CONFIG_USB_MUSB_HDRC_HCD) - .mode = MUSB_HOST, -#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) - .mode = MUSB_PERIPHERAL, -#endif - .multipoint = 1, - .clock = "usbhs_ick", - .set_clock = musb_set_clock, -}; - -static u64 musb_dmamask = ~(u32)0; - -static struct platform_device musb_device = { - .name = "musb_hdrc", - .id = 0, - .dev = { - .dma_mask = &musb_dmamask, - .coherent_dma_mask = 0xffffffff, - .platform_data = &musb_plat, - }, - .num_resources = ARRAY_SIZE(musb_resources), - .resource = musb_resources, -}; - -void __init sdp2430_usb_init(void) -{ - if (platform_device_register(&musb_device) < 0) { - printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); - return; - } -} - diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 76bbe06..623c38e 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -35,6 +35,7 @@ #include <asm/arch/gpio.h> #include <asm/arch/mux.h> #include <asm/arch/board.h> +#include <asm/arch/usb-musb.h> #include <asm/arch/common.h> #include <asm/arch/keypad.h> #include <asm/arch/gpmc.h> @@ -390,7 +391,7 @@ static void __init omap_2430sdp_init(void) omap_serial_init(); sdp2430_flash_init(); - sdp2430_usb_init(); + usb_musb_init(); spi_register_board_info(sdp2430_spi_board_info, ARRAY_SIZE(sdp2430_spi_board_info)); diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 1eb84a6..4b400f6 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -33,6 +33,7 @@ #include <asm/arch/gpio.h> #include <asm/arch/mux.h> #include <asm/arch/board.h> +#include <asm/arch/usb-musb.h> #include <asm/arch/common.h> #include <asm/arch/keypad.h> #include <asm/arch/dma.h> @@ -297,7 +298,7 @@ static void __init omap_3430sdp_init(void) ads7846_dev_init(); sdp3430_flash_init(); omap_serial_init(); - sdp3430_usb_init(); + usb_musb_init(); sdp_mmc_init(); } diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/usb-musb.c similarity index 91% rename from arch/arm/mach-omap2/board-3430sdp-usb.c rename to arch/arm/mach-omap2/usb-musb.c index 048f017..0bcc2c9 100644 --- a/arch/arm/mach-omap2/board-3430sdp-usb.c +++ b/arch/arm/mach-omap2/usb-musb.c @@ -1,10 +1,11 @@ /* - * linux/arch/arm/mach-omap2/board-3430sdp-usb.c + * linux/arch/arm/mach-omap2/usb-musb.c * * This file will contain the board specific details for the * MENTOR USB OTG and Synopsys EHCI host controllers on OMAP3430 * - * Copyright (C) 2007 Texas Instruments + * Copyright (C) 2007-2008 Texas Instruments + * Copyright (C) 2008 Nokia Corporation * Author: Vikram Pandita * * This program is free software; you can redistribute it and/or modify @@ -28,8 +29,12 @@ #ifdef CONFIG_USB_MUSB_SOC static struct resource musb_resources[] = { [0] = { - .start = OMAP34XX_HSUSB_OTG_BASE, - .end = OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1, + .start = cpu_class_is_omap3() + ? OMAP34XX_HSUSB_OTG_BASE + : OMAP243X_HS_BASE, + .end = cpu_class_is_omap3() + ? OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1 + : OMAP243X_HS_BASE + SZ_8K -1, .flags = IORESOURCE_MEM, }, [1] = { /* general IRQ */ @@ -42,23 +47,23 @@ static struct resource musb_resources[] = { }, }; -static int hsotgusb_ick_on; +static int clk_on; static int musb_set_clock(struct clk *clk, int state) { if (state) { - if (hsotgusb_ick_on > 0) + if (clk_on > 0) return -ENODEV; omap2_block_sleep(); clk_enable(clk); - hsotgusb_ick_on = 1; + clk_on = 1; } else { - if (hsotgusb_ick_on == 0) + if (clk_on == 0) return -ENODEV; clk_disable(clk); - hsotgusb_ick_on = 0; + clk_on = 0; omap2_allow_sleep(); } @@ -74,7 +79,9 @@ static struct musb_hdrc_platform_data musb_plat = { .mode = MUSB_PERIPHERAL, #endif .multipoint = 1, - .clock = "hsotgusb_ick", + .clock = cpu_class_is_omap3() + ? "hsotgusb_ick" + : "usbhs_ick", .set_clock = musb_set_clock, }; @@ -217,7 +224,7 @@ static void setup_ehci_io_mux(void) #endif /* EHCI specific data */ -void __init sdp3430_usb_init(void) +void __init usb_musb_init(void) { #ifdef CONFIG_USB_MUSB_SOC if (platform_device_register(&musb_device) < 0) { @@ -229,7 +236,8 @@ void __init sdp3430_usb_init(void) #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) /* Setup Pin IO MUX for EHCI */ - setup_ehci_io_mux(); + if (cpu_class_is_omap3()) + setup_ehci_io_mux(); if (platform_device_register(&ehci_device) < 0) { printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n"); diff --git a/include/asm-arm/arch-omap/usb-musb.h b/include/asm-arm/arch-omap/usb-musb.h new file mode 100644 index 0000000..4f0c830 --- /dev/null +++ b/include/asm-arm/arch-omap/usb-musb.h @@ -0,0 +1,35 @@ +/* + * linux/include/asm-arm/arch-omap/usb-musb.h + * + * Hardware definitions for Mentor Graphics MUSBMHDRC. + * + * Initial creation by Felipe Balbi. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ASM_ARCH_OMAP_USB_MUSB_H +#define __ASM_ARCH_OMAP_USB_MUSB_H + +extern void usb_musb_init(void); + +#endif /* __ASM_ARCH_OMAP_USB_MUSB_H */ + -- 1.5.5.1.57.g5909c ^ permalink raw reply related [flat|nested] 21+ messages in thread
* RE: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 13:46 ` [PATCH 2/2] USB: Generalize usb initialization for omap hw Felipe Balbi @ 2008-04-24 14:13 ` Gadiyar, Anand 2008-04-24 14:18 ` Felipe Balbi 2008-04-24 17:12 ` [PATCH 2/2] " Tony Lindgren 2008-04-24 17:10 ` Tony Lindgren 1 sibling, 2 replies; 21+ messages in thread From: Gadiyar, Anand @ 2008-04-24 14:13 UTC (permalink / raw) To: Felipe Balbi, linux-omap, David Brownell Cc: Tony Lindgren, Syed Mohammed, Khasim > -----Original Message----- > From: linux-omap-owner@vger.kernel.org > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Felipe Balbi > Sent: Thursday, April 24, 2008 7:16 PM > To: linux-omap@vger.kernel.org; David Brownell > Cc: Tony Lindgren; Syed Mohammed, Khasim; Felipe Balbi > Subject: [PATCH 2/2] USB: Generalize usb initialization for omap hw > > Create a generic board-file for initializing usb > on omap2430 and omap3 boards. > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > --- > arch/arm/mach-omap2/Makefile | 4 +- > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 > -------------------- > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. > 6 files changed, 61 insertions(+), 112 deletions(-) > delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c > rename arch/arm/mach-omap2/{board-3430sdp-usb.c => usb-musb.c} (91%) > create mode 100644 include/asm-arm/arch-omap/usb-musb.h > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 14:13 ` Gadiyar, Anand @ 2008-04-24 14:18 ` Felipe Balbi 2008-04-24 17:16 ` Tony Lindgren 2008-04-24 17:12 ` [PATCH 2/2] " Tony Lindgren 1 sibling, 1 reply; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 14:18 UTC (permalink / raw) To: ext Gadiyar, Anand Cc: Felipe Balbi, linux-omap, David Brownell, Tony Lindgren, Syed Mohammed, Khasim On Thu, Apr 24, 2008 at 07:43:16PM +0530, ext Gadiyar, Anand wrote: > > -----Original Message----- > > From: linux-omap-owner@vger.kernel.org > > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Felipe Balbi > > Sent: Thursday, April 24, 2008 7:16 PM > > To: linux-omap@vger.kernel.org; David Brownell > > Cc: Tony Lindgren; Syed Mohammed, Khasim; Felipe Balbi > > Subject: [PATCH 2/2] USB: Generalize usb initialization for omap hw > > > > Create a generic board-file for initializing usb > > on omap2430 and omap3 boards. > > > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > --- > > arch/arm/mach-omap2/Makefile | 4 +- > > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 > > -------------------- > > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. that's true, you suggest any other name ? maybe omap-usb.[ch] ? -- - Balbi ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 14:18 ` Felipe Balbi @ 2008-04-24 17:16 ` Tony Lindgren 2008-04-24 18:27 ` Felipe Balbi 2008-04-24 18:29 ` David Brownell 0 siblings, 2 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 17:16 UTC (permalink / raw) To: Felipe Balbi Cc: ext Gadiyar, Anand, linux-omap, David Brownell, Syed Mohammed, Khasim * Felipe Balbi <felipe.balbi@nokia.com> [080424 07:20]: > On Thu, Apr 24, 2008 at 07:43:16PM +0530, ext Gadiyar, Anand wrote: > > > -----Original Message----- > > > From: linux-omap-owner@vger.kernel.org > > > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Felipe Balbi > > > Sent: Thursday, April 24, 2008 7:16 PM > > > To: linux-omap@vger.kernel.org; David Brownell > > > Cc: Tony Lindgren; Syed Mohammed, Khasim; Felipe Balbi > > > Subject: [PATCH 2/2] USB: Generalize usb initialization for omap hw > > > > > > Create a generic board-file for initializing usb > > > on omap2430 and omap3 boards. > > > > > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > > --- > > > arch/arm/mach-omap2/Makefile | 4 +- > > > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 > > > -------------------- > > > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > > > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. > > that's true, you suggest any other name ? > > maybe omap-usb.[ch] ? Sorry, I missed this post. I suggested separating out EHCI stuff to usb-ehci.c as they can be compiled in separately. Tony ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 17:16 ` Tony Lindgren @ 2008-04-24 18:27 ` Felipe Balbi 2008-04-24 18:29 ` David Brownell 1 sibling, 0 replies; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 18:27 UTC (permalink / raw) To: ext Tony Lindgren Cc: Felipe Balbi, ext Gadiyar, Anand, linux-omap, David Brownell, Syed Mohammed, Khasim On Thu, Apr 24, 2008 at 10:16:18AM -0700, Tony Lindgren wrote: > * Felipe Balbi <felipe.balbi@nokia.com> [080424 07:20]: > > On Thu, Apr 24, 2008 at 07:43:16PM +0530, ext Gadiyar, Anand wrote: > > > > -----Original Message----- > > > > From: linux-omap-owner@vger.kernel.org > > > > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Felipe Balbi > > > > Sent: Thursday, April 24, 2008 7:16 PM > > > > To: linux-omap@vger.kernel.org; David Brownell > > > > Cc: Tony Lindgren; Syed Mohammed, Khasim; Felipe Balbi > > > > Subject: [PATCH 2/2] USB: Generalize usb initialization for omap hw > > > > > > > > Create a generic board-file for initializing usb > > > > on omap2430 and omap3 boards. > > > > > > > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > > > --- > > > > arch/arm/mach-omap2/Makefile | 4 +- > > > > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 > > > > -------------------- > > > > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > > > > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > > > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > > > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > > > > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. > > > > that's true, you suggest any other name ? > > > > maybe omap-usb.[ch] ? > > Sorry, I missed this post. I suggested separating out EHCI stuff to > usb-ehci.c as they can be compiled in separately. K, I'll do it :-) -- - Balbi ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 17:16 ` Tony Lindgren 2008-04-24 18:27 ` Felipe Balbi @ 2008-04-24 18:29 ` David Brownell 2008-04-24 18:32 ` Felipe Balbi 2008-04-24 18:51 ` usb generalization Felipe Balbi 1 sibling, 2 replies; 21+ messages in thread From: David Brownell @ 2008-04-24 18:29 UTC (permalink / raw) To: Tony Lindgren Cc: Felipe Balbi, ext Gadiyar, Anand, linux-omap, Syed Mohammed, Khasim On Thursday 24 April 2008, Tony Lindgren wrote: > > > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- Good: so some of the inappropriate sdp_*() names will vanish ... > > > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > > > > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. > > > > that's true, you suggest any other name ? > > > > maybe omap-usb.[ch] ? > > Sorry, I missed this post. I suggested separating out EHCI stuff to > usb-ehci.c as they can be compiled in separately. Sounds right to me. Dis-entange that stuff. - Dave -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 18:29 ` David Brownell @ 2008-04-24 18:32 ` Felipe Balbi 2008-04-24 19:02 ` David Brownell 2008-04-24 18:51 ` usb generalization Felipe Balbi 1 sibling, 1 reply; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 18:32 UTC (permalink / raw) To: ext David Brownell Cc: Tony Lindgren, Felipe Balbi, ext Gadiyar, Anand, linux-omap, Syed Mohammed, Khasim On Thu, Apr 24, 2008 at 11:29:27AM -0700, David Brownell wrote: > On Thursday 24 April 2008, Tony Lindgren wrote: > > > > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > > Good: so some of the inappropriate sdp_*() names will vanish ... > > > > > > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > > > > > > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. > > > > > > that's true, you suggest any other name ? > > > > > > maybe omap-usb.[ch] ? > > > > Sorry, I missed this post. I suggested separating out EHCI stuff to > > usb-ehci.c as they can be compiled in separately. > > Sounds right to me. Dis-entange that stuff. How about the header, introduce usb-musb.h and usb-ehci.h or usb.h is enough ?? -- - Balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 18:32 ` Felipe Balbi @ 2008-04-24 19:02 ` David Brownell 0 siblings, 0 replies; 21+ messages in thread From: David Brownell @ 2008-04-24 19:02 UTC (permalink / raw) To: felipe.balbi Cc: Tony Lindgren, ext Gadiyar, Anand, linux-omap, Syed Mohammed, Khasim On Thursday 24 April 2008, Felipe Balbi wrote: > > > > Sorry, I missed this post. I suggested separating out EHCI stuff to > > > usb-ehci.c as they can be compiled in separately. > > > > Sounds right to me. Dis-entangle that stuff. > > How about the header, introduce usb-musb.h and usb-ehci.h or usb.h is > enough ?? Your call. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* usb generalization 2008-04-24 18:29 ` David Brownell 2008-04-24 18:32 ` Felipe Balbi @ 2008-04-24 18:51 ` Felipe Balbi 2008-04-24 18:51 ` [PATCH] USB: Generalize usb initialization for omap hw Felipe Balbi 1 sibling, 1 reply; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 18:51 UTC (permalink / raw) To: linux-omap, tony; +Cc: david-b Hi all, Here's an updated version of the usb generalization. Please give it a good review, it might be that I missed something in the middle although it seems to be working nice in my 3430sdp. I need someone to test on 2430sdp and give it an ack as well. Here's some output from minicom: ehci-omap ehci-omap.0: new USB bus registered, assigned bus number 1 ehci-omap ehci-omap.0: irq 77, io mem 0x48064800 ehci-omap ehci-omap.0: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 3 ports detected usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1: Product: OMAP-EHCI Host Controller usb usb1: Manufacturer: Linux 2.6.25-omap1-08065-g11978e7 ehci_hcd usb usb1: SerialNumber: ehci-omap.0 zero gadget: Gadget Zero, version: Lughnasadh, 2007 zero gadget: using musb_hdrc, OUT ep1out IN ep1in musb_hdrc musb_hdrc.0: MUSB HDRC host driver musb_hdrc musb_hdrc.0: new USB bus registered, assigned bus number 2 usb usb2: configuration #1 chosen from 1 choice hub 2-0:1.0: USB hub found hub 2-0:1.0: 1 port detected usb usb2: New USB device found, idVendor=1d6b, idProduct=0002 usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb2: Product: MUSB HDRC host driver usb usb2: Manufacturer: Linux 2.6.25-omap1-08065-g11978e7 musb-hcd usb usb2: SerialNumber: musb_hdrc.0 BR, - Balbi ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 18:51 ` usb generalization Felipe Balbi @ 2008-04-24 18:51 ` Felipe Balbi 2008-04-24 19:07 ` David Brownell 2008-04-28 10:59 ` Pandita, Vikram 0 siblings, 2 replies; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 18:51 UTC (permalink / raw) To: linux-omap, tony; +Cc: david-b, Felipe Balbi Create a generic board-file for initializing usb on omap2430 and omap3 boards. Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- arch/arm/mach-omap2/Makefile | 6 +- arch/arm/mach-omap2/board-2430sdp-usb.c | 96 ------------ arch/arm/mach-omap2/board-2430sdp.c | 5 +- arch/arm/mach-omap2/board-3430sdp-usb.c | 241 ------------------------------- arch/arm/mach-omap2/board-3430sdp.c | 5 +- arch/arm/mach-omap2/usb-ehci.c | 162 +++++++++++++++++++++ arch/arm/mach-omap2/usb-musb.c | 116 +++++++++++++++ include/asm-arm/arch-omap/usb-ehci.h | 35 +++++ include/asm-arm/arch-omap/usb-musb.h | 35 +++++ 9 files changed, 360 insertions(+), 341 deletions(-) delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c delete mode 100644 arch/arm/mach-omap2/board-3430sdp-usb.c create mode 100644 arch/arm/mach-omap2/usb-ehci.c create mode 100644 arch/arm/mach-omap2/usb-musb.c create mode 100644 include/asm-arm/arch-omap/usb-ehci.h create mode 100644 include/asm-arm/arch-omap/usb-musb.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index c37df1a..9b6f60e 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -29,11 +29,13 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \ board-2430sdp-flash.o \ board-sdp-hsmmc.o \ - board-2430sdp-usb.o + usb-musb.o \ + usb-ehci.o obj-$(CONFIG_MACH_OMAP_2430OSK) += board-2430osk.o obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ board-sdp-hsmmc.o \ - board-3430sdp-usb.o \ + usb-musb.o \ + usb-ehci.o \ board-3430sdp-flash.o obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c deleted file mode 100644 index cfbf73e..0000000 --- a/arch/arm/mach-omap2/board-2430sdp-usb.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * linux/arch/arm/mach-omap2/board-2430sdp-usb.c - * - * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> - * Author: Kevin Hilman - * - * 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. - */ - -#include <linux/types.h> -#include <linux/errno.h> -#include <linux/delay.h> -#include <linux/platform_device.h> -#include <linux/clk.h> -#include <linux/usb/musb.h> - -#include <asm/arch/hardware.h> -#include <asm/arch/pm.h> -#include <asm/arch/usb.h> - -static struct resource musb_resources[] = { - [0] = { - .start = OMAP243X_HS_BASE, - .end = OMAP243X_HS_BASE + SZ_8K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { /* general IRQ */ - .start = INT_243X_HS_USB_MC, - .flags = IORESOURCE_IRQ, - }, - [2] = { /* DMA IRQ */ - .start = INT_243X_HS_USB_DMA, - .flags = IORESOURCE_IRQ, - }, -}; - -static int usbhs_ick_on; - -static int musb_set_clock(struct clk *clk, int state) -{ - if (state) { - if (usbhs_ick_on > 0) - return -ENODEV; - - omap2_block_sleep(); - clk_enable(clk); - usbhs_ick_on = 1; - } else { - if (usbhs_ick_on == 0) - return -ENODEV; - - clk_disable(clk); - usbhs_ick_on = 0; - omap2_allow_sleep(); - } - - return 0; -} - -static struct musb_hdrc_platform_data musb_plat = { -#ifdef CONFIG_USB_MUSB_OTG - .mode = MUSB_OTG, -#elif defined(CONFIG_USB_MUSB_HDRC_HCD) - .mode = MUSB_HOST, -#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) - .mode = MUSB_PERIPHERAL, -#endif - .multipoint = 1, - .clock = "usbhs_ick", - .set_clock = musb_set_clock, -}; - -static u64 musb_dmamask = ~(u32)0; - -static struct platform_device musb_device = { - .name = "musb_hdrc", - .id = 0, - .dev = { - .dma_mask = &musb_dmamask, - .coherent_dma_mask = 0xffffffff, - .platform_data = &musb_plat, - }, - .num_resources = ARRAY_SIZE(musb_resources), - .resource = musb_resources, -}; - -void __init sdp2430_usb_init(void) -{ - if (platform_device_register(&musb_device) < 0) { - printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); - return; - } -} - diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 76bbe06..2018b5d 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -35,6 +35,8 @@ #include <asm/arch/gpio.h> #include <asm/arch/mux.h> #include <asm/arch/board.h> +#include <asm/arch/usb-musb.h> +#include <asm/arch/usb-ehci.h> #include <asm/arch/common.h> #include <asm/arch/keypad.h> #include <asm/arch/gpmc.h> @@ -390,7 +392,8 @@ static void __init omap_2430sdp_init(void) omap_serial_init(); sdp2430_flash_init(); - sdp2430_usb_init(); + usb_musb_init(); + usb_ehci_init(); spi_register_board_info(sdp2430_spi_board_info, ARRAY_SIZE(sdp2430_spi_board_info)); diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/board-3430sdp-usb.c deleted file mode 100644 index 048f017..0000000 --- a/arch/arm/mach-omap2/board-3430sdp-usb.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * linux/arch/arm/mach-omap2/board-3430sdp-usb.c - * - * This file will contain the board specific details for the - * MENTOR USB OTG and Synopsys EHCI host controllers on OMAP3430 - * - * Copyright (C) 2007 Texas Instruments - * Author: Vikram Pandita - * - * 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. - */ - -#include <linux/types.h> -#include <linux/errno.h> -#include <linux/delay.h> -#include <linux/platform_device.h> -#include <linux/clk.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <linux/usb/musb.h> - -#include <asm/arch/hardware.h> -#include <asm/arch/pm.h> -#include <asm/arch/usb.h> - -#ifdef CONFIG_USB_MUSB_SOC -static struct resource musb_resources[] = { - [0] = { - .start = OMAP34XX_HSUSB_OTG_BASE, - .end = OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { /* general IRQ */ - .start = INT_243X_HS_USB_MC, - .flags = IORESOURCE_IRQ, - }, - [2] = { /* DMA IRQ */ - .start = INT_243X_HS_USB_DMA, - .flags = IORESOURCE_IRQ, - }, -}; - -static int hsotgusb_ick_on; - -static int musb_set_clock(struct clk *clk, int state) -{ - if (state) { - if (hsotgusb_ick_on > 0) - return -ENODEV; - - omap2_block_sleep(); - clk_enable(clk); - hsotgusb_ick_on = 1; - } else { - if (hsotgusb_ick_on == 0) - return -ENODEV; - - clk_disable(clk); - hsotgusb_ick_on = 0; - omap2_allow_sleep(); - } - - return 0; -} - -static struct musb_hdrc_platform_data musb_plat = { -#ifdef CONFIG_USB_MUSB_OTG - .mode = MUSB_OTG, -#elif defined(CONFIG_USB_MUSB_HDRC_HCD) - .mode = MUSB_HOST, -#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) - .mode = MUSB_PERIPHERAL, -#endif - .multipoint = 1, - .clock = "hsotgusb_ick", - .set_clock = musb_set_clock, -}; - -static u64 musb_dmamask = ~(u32)0; - -static struct platform_device musb_device = { - .name = "musb_hdrc", - .id = 0, - .dev = { - .dma_mask = &musb_dmamask, - .coherent_dma_mask = 0xffffffff, - .platform_data = &musb_plat, - }, - .num_resources = ARRAY_SIZE(musb_resources), - .resource = musb_resources, -}; -#endif - - -/* EHCI platform specific data */ - -#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) -static struct resource ehci_resources[] = { - [0] = { - .start = OMAP34XX_HSUSB_HOST_BASE + 0x800, - .end = OMAP34XX_HSUSB_HOST_BASE + 0x800 + SZ_1K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { /* general IRQ */ - .start = INT_34XX_EHCI_IRQ, - .flags = IORESOURCE_IRQ, - } -}; - -static u64 ehci_dmamask = ~(u32)0; -static struct platform_device ehci_device = { - .name = "ehci-omap", - .id = 0, - .dev = { - .dma_mask = &ehci_dmamask, - .coherent_dma_mask = 0xffffffff, - .platform_data = 0x0, - }, - .num_resources = ARRAY_SIZE(ehci_resources), - .resource = ehci_resources, -}; - - -/* MUX settings for EHCI pins */ -/* - * setup_ehci_io_mux - initialize IO pad mux for USBHOST - */ -static void setup_ehci_io_mux(void) -{ -#ifdef CONFIG_OMAP_EHCI_PHY_MODE - /* PHY mode of operation for board: 750-2083-001 - * ISP1504 connected to Port1 and Port2 - * Do Func Mux setting for 12-pin ULPI PHY mode - */ - - /* Port1 */ - omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); - omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); - omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR); - omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT); - omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0); - omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1); - omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2); - omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3); - omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4); - omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5); - omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6); - omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7); - - /* Port2 */ - omap_cfg_reg(AA10_3430_USB2HS_PHY_STP); - omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK); - omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR); - omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT); - omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0); - omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1); - omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2); - omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3); - omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4); - omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5); - omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6); - omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7); - -#else - /* Set Func mux for : - * TLL mode of operation - * 12-pin ULPI SDR TLL mode for Port1/2/3 - */ - - /* Port1 */ - omap_cfg_reg(Y9_3430_USB1HS_TLL_STP); - omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK); - omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR); - omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT); - omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0); - omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1); - omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2); - omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3); - omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4); - omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5); - omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6); - omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7); - - /* Port2 */ - omap_cfg_reg(AA10_3430_USB2HS_TLL_STP); - omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK); - omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR); - omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT); - omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0); - omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1); - omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2); - omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3); - omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4); - omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5); - omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6); - omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7); - - /* Port3 */ - omap_cfg_reg(AB3_3430_USB3HS_TLL_STP); - omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK); - omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR); - omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT); - omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0); - omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1); - omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2); - omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3); - omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4); - omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5); - omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6); - omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7); -#endif /* CONFIG_OMAP_EHCI_PHY_MODE */ - - return; -} - -#endif /* EHCI specific data */ - -void __init sdp3430_usb_init(void) -{ -#ifdef CONFIG_USB_MUSB_SOC - if (platform_device_register(&musb_device) < 0) { - printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); - return; - } -#endif - -#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) - - /* Setup Pin IO MUX for EHCI */ - setup_ehci_io_mux(); - - if (platform_device_register(&ehci_device) < 0) { - printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n"); - return; - } -#endif - -} - diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 1eb84a6..060c976 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -33,6 +33,8 @@ #include <asm/arch/gpio.h> #include <asm/arch/mux.h> #include <asm/arch/board.h> +#include <asm/arch/usb-musb.h> +#include <asm/arch/usb-ehci.h> #include <asm/arch/common.h> #include <asm/arch/keypad.h> #include <asm/arch/dma.h> @@ -297,7 +299,8 @@ static void __init omap_3430sdp_init(void) ads7846_dev_init(); sdp3430_flash_init(); omap_serial_init(); - sdp3430_usb_init(); + usb_musb_init(); + usb_ehci_init(); sdp_mmc_init(); } diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c new file mode 100644 index 0000000..ffd1108 --- /dev/null +++ b/arch/arm/mach-omap2/usb-ehci.c @@ -0,0 +1,162 @@ +/* + * linux/arch/arm/mach-omap2/usb-ehci.c + * + * This file will contain the board specific details for the + * Synopsys EHCI host controller on OMAP3430 + * + * Copyright (C) 2008 Nokia Corporation + * Author: Felipe Balbi <felipe.balbi@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. + */ + +#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <asm/io.h> +#include <asm/arch/mux.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/pm.h> +#include <asm/arch/usb.h> + +#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) +static struct resource ehci_resources[] = { + [0] = { + .start = OMAP34XX_HSUSB_HOST_BASE + 0x800, + .end = OMAP34XX_HSUSB_HOST_BASE + 0x800 + SZ_1K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { /* general IRQ */ + .start = INT_34XX_EHCI_IRQ, + .flags = IORESOURCE_IRQ, + } +}; + +static u64 ehci_dmamask = ~(u32)0; +static struct platform_device ehci_device = { + .name = "ehci-omap", + .id = 0, + .dev = { + .dma_mask = &ehci_dmamask, + .coherent_dma_mask = 0xffffffff, + .platform_data = 0x0, + }, + .num_resources = ARRAY_SIZE(ehci_resources), + .resource = ehci_resources, +}; + + +/* MUX settings for EHCI pins */ +/* + * setup_ehci_io_mux - initialize IO pad mux for USBHOST + */ +static void setup_ehci_io_mux(void) +{ +#ifdef CONFIG_OMAP_EHCI_PHY_MODE + /* PHY mode of operation for board: 750-2083-001 + * ISP1504 connected to Port1 and Port2 + * Do Func Mux setting for 12-pin ULPI PHY mode + */ + + /* Port1 */ + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); + omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR); + omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT); + omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0); + omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1); + omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2); + omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3); + omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4); + omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5); + omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6); + omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7); + + /* Port2 */ + omap_cfg_reg(AA10_3430_USB2HS_PHY_STP); + omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK); + omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR); + omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT); + omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0); + omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1); + omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2); + omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3); + omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4); + omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5); + omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6); + omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7); + +#else + /* Set Func mux for : + * TLL mode of operation + * 12-pin ULPI SDR TLL mode for Port1/2/3 + */ + + /* Port1 */ + omap_cfg_reg(Y9_3430_USB1HS_TLL_STP); + omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK); + omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR); + omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT); + omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0); + omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1); + omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2); + omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3); + omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4); + omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5); + omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6); + omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7); + + /* Port2 */ + omap_cfg_reg(AA10_3430_USB2HS_TLL_STP); + omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK); + omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR); + omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT); + omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0); + omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1); + omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2); + omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3); + omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4); + omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5); + omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6); + omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7); + + /* Port3 */ + omap_cfg_reg(AB3_3430_USB3HS_TLL_STP); + omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK); + omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR); + omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT); + omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0); + omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1); + omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2); + omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3); + omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4); + omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5); + omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6); + omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7); +#endif /* CONFIG_OMAP_EHCI_PHY_MODE */ + + return; +} + +#endif /* EHCI specific data */ + +void __init usb_ehci_init(void) +{ +#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) + /* Setup Pin IO MUX for EHCI */ + if (cpu_is_omap34xx()) + setup_ehci_io_mux(); + + if (platform_device_register(&ehci_device) < 0) { + printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n"); + return; + } +#endif +} + diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c new file mode 100644 index 0000000..cbd59f8 --- /dev/null +++ b/arch/arm/mach-omap2/usb-musb.c @@ -0,0 +1,116 @@ +/* + * linux/arch/arm/mach-omap2/usb-musb.c + * + * This file will contain the board specific details for the + * MENTOR USB OTG controller on OMAP3430 + * + * Copyright (C) 2007-2008 Texas Instruments + * Copyright (C) 2008 Nokia Corporation + * Author: Vikram Pandita + * + * Generalization by: + * Felipe Balbi <felipe.balbi@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. + */ + +#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <asm/io.h> +#include <asm/arch/mux.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/pm.h> +#include <asm/arch/usb.h> + +#ifdef CONFIG_USB_MUSB_SOC +static struct resource musb_resources[] = { + [0] = { + .start = cpu_is_omap34xx() + ? OMAP34XX_HSUSB_OTG_BASE + : OMAP243X_HS_BASE, + .end = cpu_is_omap34xx() + ? OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1 + : OMAP243X_HS_BASE + SZ_8K -1, + .flags = IORESOURCE_MEM, + }, + [1] = { /* general IRQ */ + .start = INT_243X_HS_USB_MC, + .flags = IORESOURCE_IRQ, + }, + [2] = { /* DMA IRQ */ + .start = INT_243X_HS_USB_DMA, + .flags = IORESOURCE_IRQ, + }, +}; + +static int clk_on; + +static int musb_set_clock(struct clk *clk, int state) +{ + if (state) { + if (clk_on > 0) + return -ENODEV; + + omap2_block_sleep(); + clk_enable(clk); + clk_on = 1; + } else { + if (clk_on == 0) + return -ENODEV; + + clk_disable(clk); + clk_on = 0; + omap2_allow_sleep(); + } + + return 0; +} + +static struct musb_hdrc_platform_data musb_plat = { +#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_HDRC_HCD) + .mode = MUSB_HOST, +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) + .mode = MUSB_PERIPHERAL, +#endif + .multipoint = 1, + .clock = cpu_is_omap34xx() + ? "hsotgusb_ick" + : "usbhs_ick", + .set_clock = musb_set_clock, +}; + +static u64 musb_dmamask = ~(u32)0; + +static struct platform_device musb_device = { + .name = "musb_hdrc", + .id = 0, + .dev = { + .dma_mask = &musb_dmamask, + .coherent_dma_mask = 0xffffffff, + .platform_data = &musb_plat, + }, + .num_resources = ARRAY_SIZE(musb_resources), + .resource = musb_resources, +}; +#endif + + +void __init usb_musb_init(void) +{ +#ifdef CONFIG_USB_MUSB_SOC + if (platform_device_register(&musb_device) < 0) { + printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); + return; + } +#endif +} + diff --git a/include/asm-arm/arch-omap/usb-ehci.h b/include/asm-arm/arch-omap/usb-ehci.h new file mode 100644 index 0000000..2ae3eea --- /dev/null +++ b/include/asm-arm/arch-omap/usb-ehci.h @@ -0,0 +1,35 @@ +/* + * linux/include/asm-arm/arch-omap/usb-ehci.h + * + * Hardware definitions for Synopsys EHCI host controller. + * + * Initial creation by Felipe Balbi. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ASM_ARCH_OMAP_USB_EHCI_H +#define __ASM_ARCH_OMAP_USB_EHCI_H + +extern void usb_ehci_init(void); + +#endif /* __ASM_ARCH_OMAP_USB_EHCI_H */ + diff --git a/include/asm-arm/arch-omap/usb-musb.h b/include/asm-arm/arch-omap/usb-musb.h new file mode 100644 index 0000000..4f0c830 --- /dev/null +++ b/include/asm-arm/arch-omap/usb-musb.h @@ -0,0 +1,35 @@ +/* + * linux/include/asm-arm/arch-omap/usb-musb.h + * + * Hardware definitions for Mentor Graphics MUSBMHDRC. + * + * Initial creation by Felipe Balbi. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ASM_ARCH_OMAP_USB_MUSB_H +#define __ASM_ARCH_OMAP_USB_MUSB_H + +extern void usb_musb_init(void); + +#endif /* __ASM_ARCH_OMAP_USB_MUSB_H */ + -- 1.5.5.1.57.g5909c ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 18:51 ` [PATCH] USB: Generalize usb initialization for omap hw Felipe Balbi @ 2008-04-24 19:07 ` David Brownell 2008-04-24 20:48 ` Tony Lindgren 2008-04-28 10:59 ` Pandita, Vikram 1 sibling, 1 reply; 21+ messages in thread From: David Brownell @ 2008-04-24 19:07 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap, tony Looks better to me, but: On Thursday 24 April 2008, Felipe Balbi wrote: > +static void setup_ehci_io_mux(void) > +{ > +#ifdef CONFIG_OMAP_EHCI_PHY_MODE This PHY_MODE thing should probably be provided by the board data not Kconfig, and > + /* PHY mode of operation for board: 750-2083-001 > + * ISP1504 connected to Port1 and Port2 > + * Do Func Mux setting for 12-pin ULPI PHY mode > + */ > + > + /* Port1 */ > + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); > + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); > ... All those MUX options should be driven by the board data too. Unless it's for some reason not possible to configure only one of the three EHCI ports at a time... This patch being cleanup-only, I don't suggest you fix that at this time. - Dave > + > +#else > + /* Set Func mux for : > + * TLL mode of operation > + * 12-pin ULPI SDR TLL mode for Port1/2/3 > + */ > + > + /* Port1 */ > + omap_cfg_reg(Y9_3430_USB1HS_TLL_STP); > + omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK); > + ... > +#endif /* CONFIG_OMAP_EHCI_PHY_MODE */ > + > + return; > +} -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 19:07 ` David Brownell @ 2008-04-24 20:48 ` Tony Lindgren 2008-04-24 21:08 ` Felipe Balbi 0 siblings, 1 reply; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 20:48 UTC (permalink / raw) To: David Brownell; +Cc: Felipe Balbi, linux-omap * David Brownell <david-b@pacbell.net> [080424 12:07]: > Looks better to me, but: > > On Thursday 24 April 2008, Felipe Balbi wrote: > > +static void setup_ehci_io_mux(void) > > +{ > > +#ifdef CONFIG_OMAP_EHCI_PHY_MODE > > This PHY_MODE thing should probably be provided by the board > data not Kconfig, and > > > + /* PHY mode of operation for board: 750-2083-001 > > + * ISP1504 connected to Port1 and Port2 > > + * Do Func Mux setting for 12-pin ULPI PHY mode > > + */ > > + > > + /* Port1 */ > > + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); > > + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); > > ... > > All those MUX options should be driven by the board data too. > > Unless it's for some reason not possible to configure only one > of the three EHCI ports at a time... > > This patch being cleanup-only, I don't suggest you fix that > at this time. OK, I'll push Felipe's patch today. Tony > - Dave > > > > > + > > +#else > > + /* Set Func mux for : > > + * TLL mode of operation > > + * 12-pin ULPI SDR TLL mode for Port1/2/3 > > + */ > > + > > + /* Port1 */ > > + omap_cfg_reg(Y9_3430_USB1HS_TLL_STP); > > + omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK); > > + ... > > +#endif /* CONFIG_OMAP_EHCI_PHY_MODE */ > > + > > + return; > > +} > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 20:48 ` Tony Lindgren @ 2008-04-24 21:08 ` Felipe Balbi 2008-04-24 21:31 ` Tony Lindgren 0 siblings, 1 reply; 21+ messages in thread From: Felipe Balbi @ 2008-04-24 21:08 UTC (permalink / raw) To: Tony Lindgren; +Cc: David Brownell, Felipe Balbi, linux-omap On Thu, Apr 24, 2008 at 01:48:11PM -0700, Tony Lindgren wrote: > * David Brownell <david-b@pacbell.net> [080424 12:07]: > > Looks better to me, but: > > > > On Thursday 24 April 2008, Felipe Balbi wrote: > > > +static void setup_ehci_io_mux(void) > > > +{ > > > +#ifdef CONFIG_OMAP_EHCI_PHY_MODE > > > > This PHY_MODE thing should probably be provided by the board > > data not Kconfig, and > > > > > + /* PHY mode of operation for board: 750-2083-001 > > > + * ISP1504 connected to Port1 and Port2 > > > + * Do Func Mux setting for 12-pin ULPI PHY mode > > > + */ > > > + > > > + /* Port1 */ > > > + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); > > > + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); > > > ... > > > > All those MUX options should be driven by the board data too. > > > > Unless it's for some reason not possible to configure only one > > of the three EHCI ports at a time... > > > > This patch being cleanup-only, I don't suggest you fix that > > at this time. > > OK, I'll push Felipe's patch today. Thanks tony, i'll check dave's comments tomorrow then. Maybe i can come up with some stuff soon. -- Best Regards, Felipe Balbi me@felipebalbi.com http://blog.felipebalbi.com -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 21:08 ` Felipe Balbi @ 2008-04-24 21:31 ` Tony Lindgren 0 siblings, 0 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 21:31 UTC (permalink / raw) To: Felipe Balbi; +Cc: David Brownell, Felipe Balbi, linux-omap * Felipe Balbi <me@felipebalbi.com> [080424 14:07]: > On Thu, Apr 24, 2008 at 01:48:11PM -0700, Tony Lindgren wrote: > > * David Brownell <david-b@pacbell.net> [080424 12:07]: > > > Looks better to me, but: > > > > > > On Thursday 24 April 2008, Felipe Balbi wrote: > > > > +static void setup_ehci_io_mux(void) > > > > +{ > > > > +#ifdef CONFIG_OMAP_EHCI_PHY_MODE > > > > > > This PHY_MODE thing should probably be provided by the board > > > data not Kconfig, and > > > > > > > + /* PHY mode of operation for board: 750-2083-001 > > > > + * ISP1504 connected to Port1 and Port2 > > > > + * Do Func Mux setting for 12-pin ULPI PHY mode > > > > + */ > > > > + > > > > + /* Port1 */ > > > > + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); > > > > + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); > > > > ... > > > > > > All those MUX options should be driven by the board data too. > > > > > > Unless it's for some reason not possible to configure only one > > > of the three EHCI ports at a time... > > > > > > This patch being cleanup-only, I don't suggest you fix that > > > at this time. > > > > OK, I'll push Felipe's patch today. > > Thanks tony, i'll check dave's comments tomorrow then. Maybe i can come > up with some stuff soon. Great. While at it, can you also set the TWL4030_IRQNUM during init based on cpu_is_omap() macros? I already got rid of all the other TWL defines in board-*.h files as you already probably noticed. That way we can remove it from the board-*.h files as it would block compiling in multiple omaps. Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-24 18:51 ` [PATCH] USB: Generalize usb initialization for omap hw Felipe Balbi 2008-04-24 19:07 ` David Brownell @ 2008-04-28 10:59 ` Pandita, Vikram 2008-04-28 11:02 ` Felipe Balbi 1 sibling, 1 reply; 21+ messages in thread From: Pandita, Vikram @ 2008-04-28 10:59 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap@vger.kernel.org Hi Filipe >-----Original Message----- >Create a generic board-file for initializing usb >on omap2430 and omap3 boards. > >Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> >--- > arch/arm/mach-omap2/Makefile | 6 +- > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 ------------ > arch/arm/mach-omap2/board-2430sdp.c | 5 +- > arch/arm/mach-omap2/board-3430sdp-usb.c | 241 ------------------------------- > arch/arm/mach-omap2/board-3430sdp.c | 5 +- > arch/arm/mach-omap2/usb-ehci.c | 162 +++++++++++++++++++++ > arch/arm/mach-omap2/usb-musb.c | 116 +++++++++++++++ > include/asm-arm/arch-omap/usb-ehci.h | 35 +++++ > include/asm-arm/arch-omap/usb-musb.h | 35 +++++ > 9 files changed, 360 insertions(+), 341 deletions(-) > delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c Comment: > delete mode 100644 arch/arm/mach-omap2/board-3430sdp-usb.c You forgot to carry forward the following copyright notice in new files as you code is a copy from the previously deleted file. * Copyright (C) 2007 Texas Instruments * Author: Vikram Pandita > create mode 100644 arch/arm/mach-omap2/usb-ehci.c > create mode 100644 arch/arm/mach-omap2/usb-musb.c > create mode 100644 include/asm-arm/arch-omap/usb-ehci.h > create mode 100644 include/asm-arm/arch-omap/usb-musb.h > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] USB: Generalize usb initialization for omap hw 2008-04-28 10:59 ` Pandita, Vikram @ 2008-04-28 11:02 ` Felipe Balbi 0 siblings, 0 replies; 21+ messages in thread From: Felipe Balbi @ 2008-04-28 11:02 UTC (permalink / raw) To: ext Pandita, Vikram; +Cc: Felipe Balbi, linux-omap@vger.kernel.org On Mon, Apr 28, 2008 at 04:29:19PM +0530, ext Pandita, Vikram wrote: > Hi Filipe > > >-----Original Message----- > >Create a generic board-file for initializing usb > >on omap2430 and omap3 boards. > > > >Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > >--- > > arch/arm/mach-omap2/Makefile | 6 +- > > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 ------------ > > arch/arm/mach-omap2/board-2430sdp.c | 5 +- > > arch/arm/mach-omap2/board-3430sdp-usb.c | 241 ------------------------------- > > arch/arm/mach-omap2/board-3430sdp.c | 5 +- > > arch/arm/mach-omap2/usb-ehci.c | 162 +++++++++++++++++++++ > > arch/arm/mach-omap2/usb-musb.c | 116 +++++++++++++++ > > include/asm-arm/arch-omap/usb-ehci.h | 35 +++++ > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++ > > 9 files changed, 360 insertions(+), 341 deletions(-) > > delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c > > Comment: > > delete mode 100644 arch/arm/mach-omap2/board-3430sdp-usb.c > > You forgot to carry forward the following copyright notice in new files as you code is a copy from the previously deleted file. > > * Copyright (C) 2007 Texas Instruments > * Author: Vikram Pandita Sorry for that, could you please send the patch adding such lines? -- - Balbi ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 14:13 ` Gadiyar, Anand 2008-04-24 14:18 ` Felipe Balbi @ 2008-04-24 17:12 ` Tony Lindgren 1 sibling, 0 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 17:12 UTC (permalink / raw) To: Gadiyar, Anand Cc: Felipe Balbi, linux-omap, David Brownell, Syed Mohammed, Khasim * Gadiyar, Anand <gadiyar@ti.com> [080424 07:17]: > > -----Original Message----- > > From: linux-omap-owner@vger.kernel.org > > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Felipe Balbi > > Sent: Thursday, April 24, 2008 7:16 PM > > To: linux-omap@vger.kernel.org; David Brownell > > Cc: Tony Lindgren; Syed Mohammed, Khasim; Felipe Balbi > > Subject: [PATCH 2/2] USB: Generalize usb initialization for omap hw > > > > Create a generic board-file for initializing usb > > on omap2430 and omap3 boards. > > > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > --- > > arch/arm/mach-omap2/Makefile | 4 +- > > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 > > -------------------- > > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > > usb-musb.{c,h}? EHCI/OHCI has nothing to do with mentor. This is all musb stuff, no? If not, there should be a separate usb-ehci.c. Tony > > 6 files changed, 61 insertions(+), 112 deletions(-) > > delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c > > rename arch/arm/mach-omap2/{board-3430sdp-usb.c => usb-musb.c} (91%) > > create mode 100644 include/asm-arm/arch-omap/usb-musb.h > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] USB: Generalize usb initialization for omap hw 2008-04-24 13:46 ` [PATCH 2/2] USB: Generalize usb initialization for omap hw Felipe Balbi 2008-04-24 14:13 ` Gadiyar, Anand @ 2008-04-24 17:10 ` Tony Lindgren 1 sibling, 0 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 17:10 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap, David Brownell, khasim * Felipe Balbi <felipe.balbi@nokia.com> [080424 06:48]: > Create a generic board-file for initializing usb > on omap2430 and omap3 boards. > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > --- > arch/arm/mach-omap2/Makefile | 4 +- > arch/arm/mach-omap2/board-2430sdp-usb.c | 96 -------------------- > arch/arm/mach-omap2/board-2430sdp.c | 3 +- > arch/arm/mach-omap2/board-3430sdp.c | 3 +- > .../mach-omap2/{board-3430sdp-usb.c => usb-musb.c} | 32 ++++--- > include/asm-arm/arch-omap/usb-musb.h | 35 +++++++ > 6 files changed, 61 insertions(+), 112 deletions(-) > delete mode 100644 arch/arm/mach-omap2/board-2430sdp-usb.c > rename arch/arm/mach-omap2/{board-3430sdp-usb.c => usb-musb.c} (91%) > create mode 100644 include/asm-arm/arch-omap/usb-musb.h > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile > index c37df1a..d95f8e9 100644 > --- a/arch/arm/mach-omap2/Makefile > +++ b/arch/arm/mach-omap2/Makefile > @@ -29,11 +29,11 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o board-h4-mmc.o > obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \ > board-2430sdp-flash.o \ > board-sdp-hsmmc.o \ > - board-2430sdp-usb.o > + usb-musb.o > obj-$(CONFIG_MACH_OMAP_2430OSK) += board-2430osk.o > obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ > board-sdp-hsmmc.o \ > - board-3430sdp-usb.o \ > + usb-musb.o \ > board-3430sdp-flash.o > obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o > obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ > diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c > deleted file mode 100644 > index cfbf73e..0000000 > --- a/arch/arm/mach-omap2/board-2430sdp-usb.c > +++ /dev/null > @@ -1,96 +0,0 @@ > -/* > - * linux/arch/arm/mach-omap2/board-2430sdp-usb.c > - * > - * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> > - * Author: Kevin Hilman > - * > - * 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. > - */ > - > -#include <linux/types.h> > -#include <linux/errno.h> > -#include <linux/delay.h> > -#include <linux/platform_device.h> > -#include <linux/clk.h> > -#include <linux/usb/musb.h> > - > -#include <asm/arch/hardware.h> > -#include <asm/arch/pm.h> > -#include <asm/arch/usb.h> > - > -static struct resource musb_resources[] = { > - [0] = { > - .start = OMAP243X_HS_BASE, > - .end = OMAP243X_HS_BASE + SZ_8K - 1, > - .flags = IORESOURCE_MEM, > - }, > - [1] = { /* general IRQ */ > - .start = INT_243X_HS_USB_MC, > - .flags = IORESOURCE_IRQ, > - }, > - [2] = { /* DMA IRQ */ > - .start = INT_243X_HS_USB_DMA, > - .flags = IORESOURCE_IRQ, > - }, > -}; > - > -static int usbhs_ick_on; > - > -static int musb_set_clock(struct clk *clk, int state) > -{ > - if (state) { > - if (usbhs_ick_on > 0) > - return -ENODEV; > - > - omap2_block_sleep(); > - clk_enable(clk); > - usbhs_ick_on = 1; > - } else { > - if (usbhs_ick_on == 0) > - return -ENODEV; > - > - clk_disable(clk); > - usbhs_ick_on = 0; > - omap2_allow_sleep(); > - } > - > - return 0; > -} > - > -static struct musb_hdrc_platform_data musb_plat = { > -#ifdef CONFIG_USB_MUSB_OTG > - .mode = MUSB_OTG, > -#elif defined(CONFIG_USB_MUSB_HDRC_HCD) > - .mode = MUSB_HOST, > -#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) > - .mode = MUSB_PERIPHERAL, > -#endif > - .multipoint = 1, > - .clock = "usbhs_ick", > - .set_clock = musb_set_clock, > -}; > - > -static u64 musb_dmamask = ~(u32)0; > - > -static struct platform_device musb_device = { > - .name = "musb_hdrc", > - .id = 0, > - .dev = { > - .dma_mask = &musb_dmamask, > - .coherent_dma_mask = 0xffffffff, > - .platform_data = &musb_plat, > - }, > - .num_resources = ARRAY_SIZE(musb_resources), > - .resource = musb_resources, > -}; > - > -void __init sdp2430_usb_init(void) > -{ > - if (platform_device_register(&musb_device) < 0) { > - printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); > - return; > - } > -} > - > diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c > index 76bbe06..623c38e 100644 > --- a/arch/arm/mach-omap2/board-2430sdp.c > +++ b/arch/arm/mach-omap2/board-2430sdp.c > @@ -35,6 +35,7 @@ > #include <asm/arch/gpio.h> > #include <asm/arch/mux.h> > #include <asm/arch/board.h> > +#include <asm/arch/usb-musb.h> > #include <asm/arch/common.h> > #include <asm/arch/keypad.h> > #include <asm/arch/gpmc.h> > @@ -390,7 +391,7 @@ static void __init omap_2430sdp_init(void) > omap_serial_init(); > > sdp2430_flash_init(); > - sdp2430_usb_init(); > + usb_musb_init(); > > spi_register_board_info(sdp2430_spi_board_info, > ARRAY_SIZE(sdp2430_spi_board_info)); > diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c > index 1eb84a6..4b400f6 100644 > --- a/arch/arm/mach-omap2/board-3430sdp.c > +++ b/arch/arm/mach-omap2/board-3430sdp.c > @@ -33,6 +33,7 @@ > #include <asm/arch/gpio.h> > #include <asm/arch/mux.h> > #include <asm/arch/board.h> > +#include <asm/arch/usb-musb.h> > #include <asm/arch/common.h> > #include <asm/arch/keypad.h> > #include <asm/arch/dma.h> > @@ -297,7 +298,7 @@ static void __init omap_3430sdp_init(void) > ads7846_dev_init(); > sdp3430_flash_init(); > omap_serial_init(); > - sdp3430_usb_init(); > + usb_musb_init(); > sdp_mmc_init(); > } > > diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/usb-musb.c > similarity index 91% > rename from arch/arm/mach-omap2/board-3430sdp-usb.c > rename to arch/arm/mach-omap2/usb-musb.c > index 048f017..0bcc2c9 100644 > --- a/arch/arm/mach-omap2/board-3430sdp-usb.c > +++ b/arch/arm/mach-omap2/usb-musb.c > @@ -1,10 +1,11 @@ > /* > - * linux/arch/arm/mach-omap2/board-3430sdp-usb.c > + * linux/arch/arm/mach-omap2/usb-musb.c > * > * This file will contain the board specific details for the > * MENTOR USB OTG and Synopsys EHCI host controllers on OMAP3430 > * > - * Copyright (C) 2007 Texas Instruments > + * Copyright (C) 2007-2008 Texas Instruments > + * Copyright (C) 2008 Nokia Corporation > * Author: Vikram Pandita > * > * This program is free software; you can redistribute it and/or modify > @@ -28,8 +29,12 @@ > #ifdef CONFIG_USB_MUSB_SOC > static struct resource musb_resources[] = { > [0] = { > - .start = OMAP34XX_HSUSB_OTG_BASE, > - .end = OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1, > + .start = cpu_class_is_omap3() > + ? OMAP34XX_HSUSB_OTG_BASE > + : OMAP243X_HS_BASE, > + .end = cpu_class_is_omap3() > + ? OMAP34XX_HSUSB_OTG_BASE + SZ_8K - 1 > + : OMAP243X_HS_BASE + SZ_8K -1, > .flags = IORESOURCE_MEM, > }, > [1] = { /* general IRQ */ > @@ -42,23 +47,23 @@ static struct resource musb_resources[] = { > }, > }; > > -static int hsotgusb_ick_on; > +static int clk_on; > > static int musb_set_clock(struct clk *clk, int state) > { > if (state) { > - if (hsotgusb_ick_on > 0) > + if (clk_on > 0) > return -ENODEV; > > omap2_block_sleep(); > clk_enable(clk); > - hsotgusb_ick_on = 1; > + clk_on = 1; > } else { > - if (hsotgusb_ick_on == 0) > + if (clk_on == 0) > return -ENODEV; > > clk_disable(clk); > - hsotgusb_ick_on = 0; > + clk_on = 0; > omap2_allow_sleep(); > } > > @@ -74,7 +79,9 @@ static struct musb_hdrc_platform_data musb_plat = { > .mode = MUSB_PERIPHERAL, > #endif > .multipoint = 1, > - .clock = "hsotgusb_ick", > + .clock = cpu_class_is_omap3() > + ? "hsotgusb_ick" > + : "usbhs_ick", > .set_clock = musb_set_clock, > }; Can you please check for cpu_is_omap34xx() here instead? Or cpu_is_omap3430() if we don't have omap34xx yet. > @@ -217,7 +224,7 @@ static void setup_ehci_io_mux(void) > > #endif /* EHCI specific data */ > > -void __init sdp3430_usb_init(void) > +void __init usb_musb_init(void) > { > #ifdef CONFIG_USB_MUSB_SOC > if (platform_device_register(&musb_device) < 0) { > @@ -229,7 +236,8 @@ void __init sdp3430_usb_init(void) > #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) > > /* Setup Pin IO MUX for EHCI */ > - setup_ehci_io_mux(); > + if (cpu_class_is_omap3()) > + setup_ehci_io_mux(); Here too. > if (platform_device_register(&ehci_device) < 0) { > printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n"); > diff --git a/include/asm-arm/arch-omap/usb-musb.h b/include/asm-arm/arch-omap/usb-musb.h > new file mode 100644 > index 0000000..4f0c830 > --- /dev/null > +++ b/include/asm-arm/arch-omap/usb-musb.h > @@ -0,0 +1,35 @@ > +/* > + * linux/include/asm-arm/arch-omap/usb-musb.h > + * > + * Hardware definitions for Mentor Graphics MUSBMHDRC. > + * > + * Initial creation by Felipe Balbi. > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License as published by the > + * Free Software Foundation; either version 2 of the License, or (at your > + * option) any later version. > + * > + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED > + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN > + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 675 Mass Ave, Cambridge, MA 02139, USA. > + */ > + > +#ifndef __ASM_ARCH_OMAP_USB_MUSB_H > +#define __ASM_ARCH_OMAP_USB_MUSB_H > + > +extern void usb_musb_init(void); > + > +#endif /* __ASM_ARCH_OMAP_USB_MUSB_H */ > + > -- > 1.5.5.1.57.g5909c > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() 2008-04-24 13:46 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Felipe Balbi 2008-04-24 13:46 ` [PATCH 2/2] USB: Generalize usb initialization for omap hw Felipe Balbi @ 2008-04-24 17:06 ` Tony Lindgren 1 sibling, 0 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-24 17:06 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap, David Brownell, khasim * Felipe Balbi <felipe.balbi@nokia.com> [080424 06:47]: > Add cpu_class_is_omap3(). Well I thinks cpu_class_is_omap2() currently should cover both 24xx and 34xx. This should be only used to differentiate between mach-omap1 and mach-omap2. Tony > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > --- > arch/arm/plat-omap/common.c | 2 +- > arch/arm/plat-omap/dma.c | 58 +++++++++++++++++++------------------- > arch/arm/plat-omap/dmtimer.c | 10 +++--- > arch/arm/plat-omap/gpio.c | 14 +++++----- > arch/arm/plat-omap/sram.c | 4 +- > arch/arm/plat-omap/usb.c | 2 +- > include/asm-arm/arch-omap/cpu.h | 3 +- > 7 files changed, 47 insertions(+), 46 deletions(-) > > diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c > index fd6f329..d4dfe4c 100644 > --- a/arch/arm/plat-omap/common.c > +++ b/arch/arm/plat-omap/common.c > @@ -240,7 +240,7 @@ static int __init omap_init_clocksource_32k(void) > static char err[] __initdata = KERN_ERR > "%s: can't register clocksource!\n"; > > - if (cpu_is_omap16xx() || cpu_class_is_omap2()) { > + if (cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3()) { > struct clk *sync_32k_ick; > > sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); > diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c > index c00eda5..c16ea64 100644 > --- a/arch/arm/plat-omap/dma.c > +++ b/arch/arm/plat-omap/dma.c > @@ -211,7 +211,7 @@ void omap_set_dma_priority(int lch, int dst_port, int priority) > omap_writel(l, reg); > } > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > if (priority) > OMAP_DMA_CCR_REG(lch) |= (1 << 6); > else > @@ -236,7 +236,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, > OMAP1_DMA_CCR2_REG(lch) |= 1 << 2; > } > > - if (cpu_class_is_omap2() && dma_trigger) { > + if ((cpu_class_is_omap2() || cpu_class_is_omap3()) && dma_trigger) { > u32 val = OMAP_DMA_CCR_REG(lch); > > val &= ~(3 << 19); > @@ -276,7 +276,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) > > BUG_ON(omap_dma_in_1510_mode()); > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > REVISIT_24XX(); > return; > } > @@ -308,7 +308,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) > > void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) > { > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > OMAP_DMA_CSDP_REG(lch) &= ~(0x3 << 16); > OMAP_DMA_CSDP_REG(lch) |= (mode << 16); > } > @@ -332,7 +332,7 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode, > OMAP1_DMA_CSSA_L_REG(lch) = src_start; > } > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > OMAP2_DMA_CSSA_REG(lch) = src_start; > > OMAP_DMA_CSEI_REG(lch) = src_ei; > @@ -359,7 +359,7 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) > > void omap_set_dma_src_index(int lch, int eidx, int fidx) > { > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > REVISIT_24XX(); > return; > } > @@ -383,13 +383,13 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) > case OMAP_DMA_DATA_BURST_DIS: > break; > case OMAP_DMA_DATA_BURST_4: > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > burst = 0x1; > else > burst = 0x2; > break; > case OMAP_DMA_DATA_BURST_8: > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > burst = 0x2; > break; > } > @@ -398,7 +398,7 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) > * fall through > */ > case OMAP_DMA_DATA_BURST_16: > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > burst = 0x3; > break; > } > @@ -429,7 +429,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, > OMAP1_DMA_CDSA_L_REG(lch) = dest_start; > } > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > OMAP2_DMA_CDSA_REG(lch) = dest_start; > > OMAP_DMA_CDEI_REG(lch) = dst_ei; > @@ -438,7 +438,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, > > void omap_set_dma_dest_index(int lch, int eidx, int fidx) > { > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > REVISIT_24XX(); > return; > } > @@ -462,19 +462,19 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) > case OMAP_DMA_DATA_BURST_DIS: > break; > case OMAP_DMA_DATA_BURST_4: > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > burst = 0x1; > else > burst = 0x2; > break; > case OMAP_DMA_DATA_BURST_8: > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > burst = 0x2; > else > burst = 0x3; > break; > case OMAP_DMA_DATA_BURST_16: > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > burst = 0x3; > break; > } > @@ -496,7 +496,7 @@ static inline void omap_enable_channel_irq(int lch) > /* Clear CSR */ > if (cpu_class_is_omap1()) > status = OMAP_DMA_CSR_REG(lch); > - else if (cpu_class_is_omap2()) > + else if (cpu_class_is_omap2() || cpu_class_is_omap3()) > OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; > > /* Enable some nice interrupts. */ > @@ -507,7 +507,7 @@ static inline void omap_enable_channel_irq(int lch) > > static void omap_disable_channel_irq(int lch) > { > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > OMAP_DMA_CICR_REG(lch) = 0; > } > > @@ -547,7 +547,7 @@ static inline void disable_lnk(int lch) > OMAP_DMA_CLNK_CTRL_REG(lch) |= 1 << 14; > } > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > omap_disable_channel_irq(lch); > /* Clear the ENABLE_LNK bit */ > OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 15); > @@ -560,7 +560,7 @@ static inline void omap2_enable_irq_lch(int lch) > { > u32 val; > > - if (!cpu_class_is_omap2()) > + if (!cpu_class_is_omap2() || cpu_class_is_omap3()) > return; > > val = omap_readl(OMAP_DMA4_IRQENABLE_L0); > @@ -594,7 +594,7 @@ int omap_request_dma(int dev_id, const char *dev_name, > if (cpu_class_is_omap1()) > clear_lch_regs(free_ch); > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > omap_clear_dma(free_ch); > > spin_unlock_irqrestore(&dma_chan_lock, flags); > @@ -610,7 +610,7 @@ int omap_request_dma(int dev_id, const char *dev_name, > > if (cpu_class_is_omap1()) > chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ; > - else if (cpu_class_is_omap2()) > + else if (cpu_class_is_omap2() || cpu_class_is_omap3()) > chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ | > OMAP2_DMA_TRANS_ERR_IRQ; > > @@ -627,7 +627,7 @@ int omap_request_dma(int dev_id, const char *dev_name, > OMAP_DMA_CCR_REG(free_ch) = dev_id; > } > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > omap2_enable_irq_lch(free_ch); > > omap_enable_channel_irq(free_ch); > @@ -664,7 +664,7 @@ void omap_free_dma(int lch) > OMAP_DMA_CCR_REG(lch) = 0; > } > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > u32 val; > /* Disable interrupts */ > val = omap_readl(OMAP_DMA4_IRQENABLE_L0); > @@ -699,7 +699,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) > { > u32 reg; > > - if (!cpu_class_is_omap2()) { > + if (!cpu_class_is_omap2() && !cpu_class_is_omap3()) { > printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__); > return; > } > @@ -763,7 +763,7 @@ void omap_clear_dma(int lch) > status = OMAP_DMA_CSR_REG(lch); > } > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > int i; > u32 lch_base = OMAP_DMA4_BASE + lch * 0x60 + 0x80; > for (i = 0; i < 0x44; i += 4) > @@ -799,7 +799,7 @@ void omap_start_dma(int lch) > > cur_lch = next_lch; > } while (next_lch != -1); > - } else if (cpu_class_is_omap2()) { > + } else if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > /* Errata: Need to write lch even if not using chaining */ > OMAP_DMA_CLNK_CTRL_REG(lch) = lch; > } > @@ -890,7 +890,7 @@ dma_addr_t omap_get_dma_src_pos(int lch) > offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) | > (OMAP1_DMA_CSSA_U_REG(lch) << 16)); > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > offset = OMAP_DMA_CSAC_REG(lch); > > return offset; > @@ -912,7 +912,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch) > offset = (dma_addr_t) (OMAP1_DMA_CDSA_L_REG(lch) | > (OMAP1_DMA_CDSA_U_REG(lch) << 16)); > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > offset = OMAP_DMA_CDAC_REG(lch); > > return offset; > @@ -2140,7 +2140,7 @@ static int __init omap_init_dma(void) > w &= ~(1 << 8); > omap_writew(w, OMAP1610_DMA_LCD_CTRL); > } > - } else if (cpu_class_is_omap2()) { > + } else if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > u8 revision = omap_readb(OMAP_DMA4_REVISION); > printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", > revision >> 4, revision & 0xf); > @@ -2187,7 +2187,7 @@ static int __init omap_init_dma(void) > omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, > DMA_DEFAULT_FIFO_DEPTH, 0); > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > setup_irq(INT_24XX_SDMA_IRQ0, &omap24xx_dma_irq); > > /* FIXME: Update LCD DMA to work on 24xx */ > diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c > index 822b6bb..e64f3d4 100644 > --- a/arch/arm/plat-omap/dmtimer.c > +++ b/arch/arm/plat-omap/dmtimer.c > @@ -309,7 +309,7 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer) > { > u32 l; > > - if (!cpu_class_is_omap2() || timer != &dm_timers[0]) { > + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) || timer != &dm_timers[0]) { > omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06); > omap_dm_timer_wait_for_reset(timer); > } > @@ -324,7 +324,7 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer) > * FIXME: All timers should have wake-up enabled and clear > * PRCM status. > */ > - if (cpu_class_is_omap2() && (timer == &dm_timers[0])) > + if ((cpu_class_is_omap2() || cpu_class_is_omap3()) && (timer == &dm_timers[0])) > l |= 1 << 2; > omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l); > > @@ -650,7 +650,7 @@ int __init omap_dm_timer_init(void) > struct omap_dm_timer *timer; > int i; > > - if (!(cpu_is_omap16xx() || cpu_class_is_omap2())) > + if (!(cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3())) > return -ENODEV; > > spin_lock_init(&dm_timer_lock); > @@ -667,7 +667,7 @@ int __init omap_dm_timer_init(void) > dm_source_clocks = (struct clk **)omap3_dm_source_clocks; > } > > - if (cpu_class_is_omap2()) > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) > for (i = 0; dm_source_names[i] != NULL; i++) > dm_source_clocks[i] = clk_get(NULL, dm_source_names[i]); > > @@ -678,7 +678,7 @@ int __init omap_dm_timer_init(void) > timer = &dm_timers[i]; > timer->io_base = (void __iomem *)io_p2v(timer->phys_base); > #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > char clk_name[16]; > sprintf(clk_name, "gpt%d_ick", i + 1); > timer->iclk = clk_get(NULL, clk_name); > diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c > index 1903a34..70bedcb 100644 > --- a/arch/arm/plat-omap/gpio.c > +++ b/arch/arm/plat-omap/gpio.c > @@ -628,7 +628,7 @@ static int gpio_irq_type(unsigned irq, unsigned type) > int retval; > unsigned long flags; > > - if (!cpu_class_is_omap2() && irq > IH_MPUIO_BASE) > + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) && irq > IH_MPUIO_BASE) > gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); > else > gpio = irq - IH_GPIO_BASE; > @@ -640,7 +640,7 @@ static int gpio_irq_type(unsigned irq, unsigned type) > return -EINVAL; > > /* OMAP1 allows only only edge triggering */ > - if (!cpu_class_is_omap2() > + if (!(cpu_class_is_omap2() && cpu_class_is_omap3()) > && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) > return -EINVAL; > > @@ -1026,7 +1026,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) > if (cpu_is_omap15xx() && (bank->method == METHOD_MPUIO)) > isr &= 0x0000ffff; > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > level_mask = bank->level_mask & enabled; > } > > @@ -1328,7 +1328,7 @@ static int __init _omap_gpio_init(void) > } > #endif > #if defined(CONFIG_ARCH_OMAP2) > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > gpio_ick = clk_get(NULL, "gpios_ick"); > if (IS_ERR(gpio_ick)) > printk("Could not get gpios_ick\n"); > @@ -1532,7 +1532,7 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) > { > int i; > > - if (!cpu_class_is_omap2() && !cpu_is_omap16xx()) > + if (!cpu_class_is_omap2() && !cpu_class_is_omap3() && !cpu_is_omap16xx()) > return 0; > > for (i = 0; i < gpio_bank_count; i++) { > @@ -1727,7 +1727,7 @@ static int __init omap_gpio_sysinit(void) > mpuio_init(); > > #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) > - if (cpu_is_omap16xx() || cpu_class_is_omap2()) { > + if (cpu_is_omap16xx() || cpu_class_is_omap2() || cpu_class_is_omap3()) { > if (ret == 0) { > ret = sysdev_class_register(&omap_gpio_sysclass); > if (ret == 0) > @@ -1789,7 +1789,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) > > if (bank_is_mpuio(bank)) > gpio = OMAP_MPUIO(0); > - else if (cpu_class_is_omap2() || cpu_is_omap730()) > + else if (cpu_class_is_omap2() || cpu_class_is_omap3() || cpu_is_omap730()) > bankwidth = 32; > > for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) { > diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c > index 2fc8f61..4596ba5 100644 > --- a/arch/arm/plat-omap/sram.c > +++ b/arch/arm/plat-omap/sram.c > @@ -136,7 +136,7 @@ void __init omap_detect_sram(void) > { > unsigned long reserved; > > - if (cpu_class_is_omap2()) { > + if (cpu_class_is_omap2() || cpu_class_is_omap3()) { > if (is_sram_locked()) { > if (cpu_is_omap34xx()) { > omap_sram_base = OMAP3_SRAM_PUB_VA; > @@ -466,7 +466,7 @@ int __init omap_sram_init(void) > omap_detect_sram(); > omap_map_sram(); > > - if (!(cpu_class_is_omap2())) > + if (!(cpu_class_is_omap2() || cpu_class_is_omap3())) > omap1_sram_init(); > else if (cpu_is_omap24xx()) > omap24xx_sram_init(); > diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c > index a619475..b7365c3 100644 > --- a/arch/arm/plat-omap/usb.c > +++ b/arch/arm/plat-omap/usb.c > @@ -170,7 +170,7 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device) > } > > /* internal transceiver (unavailable on 17xx, 24xx) */ > - if (!cpu_class_is_omap2() && nwires == 2) { > + if (!(cpu_class_is_omap2() || cpu_class_is_omap3()) && nwires == 2) { > // omap_cfg_reg(P9_USB_DP); > // omap_cfg_reg(R8_USB_DM); > > diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h > index 2626fbd..3b73ad5 100644 > --- a/include/asm-arm/arch-omap/cpu.h > +++ b/include/asm-arm/arch-omap/cpu.h > @@ -317,7 +317,8 @@ IS_OMAP_TYPE(3430, 0x3430) > /* Macros to detect if we have OMAP1 or OMAP2 */ > #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ > cpu_is_omap16xx()) > -#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) > +#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap243x()) > +#define cpu_class_is_omap3() cpu_is_omap34xx() > > #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) > /* > -- > 1.5.5.1.57.g5909c > ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2008-04-28 11:03 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-24 13:46 [RFC][PATCH 0/2] musb init generalization Felipe Balbi 2008-04-24 13:46 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Felipe Balbi 2008-04-24 13:46 ` [PATCH 2/2] USB: Generalize usb initialization for omap hw Felipe Balbi 2008-04-24 14:13 ` Gadiyar, Anand 2008-04-24 14:18 ` Felipe Balbi 2008-04-24 17:16 ` Tony Lindgren 2008-04-24 18:27 ` Felipe Balbi 2008-04-24 18:29 ` David Brownell 2008-04-24 18:32 ` Felipe Balbi 2008-04-24 19:02 ` David Brownell 2008-04-24 18:51 ` usb generalization Felipe Balbi 2008-04-24 18:51 ` [PATCH] USB: Generalize usb initialization for omap hw Felipe Balbi 2008-04-24 19:07 ` David Brownell 2008-04-24 20:48 ` Tony Lindgren 2008-04-24 21:08 ` Felipe Balbi 2008-04-24 21:31 ` Tony Lindgren 2008-04-28 10:59 ` Pandita, Vikram 2008-04-28 11:02 ` Felipe Balbi 2008-04-24 17:12 ` [PATCH 2/2] " Tony Lindgren 2008-04-24 17:10 ` Tony Lindgren 2008-04-24 17:06 ` [PATCH 1/2] OMAP: Introduce cpu_class_is_omap3() Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox