Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137499
b: refs/heads/master
c: 18cb7ac
h: refs/heads/master
i:
  137497: 6256115
  137495: 98e630f
v: v3
  • Loading branch information
Felipe Balbi authored and Tony Lindgren committed Mar 24, 2009
1 parent 4b4a567 commit 8456e73
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 828c707e6dbd0ca7882f721a466ff28729376ff0
refs/heads/master: 18cb7aca6f94357d78d99970ec0bd5933ac4495d
4 changes: 4 additions & 0 deletions trunk/arch/arm/mach-omap2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ obj-$(CONFIG_MACH_OVERO) += board-overo.o \
obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \
mmc-twl4030.o

# Platform specific device init code
ifeq ($(CONFIG_USB_MUSB_SOC),y)
obj-y += usb-musb.o
endif
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap2/board-2430sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <mach/board.h>
#include <mach/common.h>
#include <mach/gpmc.h>
#include <mach/usb.h>

#include "mmc-twl4030.h"

Expand Down Expand Up @@ -254,6 +255,7 @@ static void __init omap_2430sdp_init(void)
omap_board_config_size = ARRAY_SIZE(sdp2430_config);
omap_serial_init();
twl4030_mmc_init(mmc);
usb_musb_init();
}

static void __init omap_2430sdp_map_io(void)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap2/board-ldp.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <asm/io.h>
#include <asm/delay.h>
#include <mach/control.h>
#include <mach/usb.h>

#include "mmc-twl4030.h"

Expand Down Expand Up @@ -164,6 +165,7 @@ static void __init omap_ldp_init(void)
omap_board_config_size = ARRAY_SIZE(ldp_config);
omap_serial_init();
twl4030_mmc_init(mmc);
usb_musb_init();
}

static void __init omap_ldp_map_io(void)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap2/board-omap3beagle.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <mach/gpmc.h>
#include <mach/nand.h>
#include <mach/mux.h>
#include <mach/usb.h>

#include "mmc-twl4030.h"

Expand Down Expand Up @@ -313,6 +314,7 @@ static void __init omap3_beagle_init(void)
/* REVISIT leave DVI powered down until it's needed ... */
gpio_direction_output(170, true);

usb_musb_init();
omap3beagle_flash_init();
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap2/board-omap3pandora.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <mach/gpio.h>
#include <mach/hardware.h>
#include <mach/mcspi.h>
#include <mach/usb.h>

#include "mmc-twl4030.h"

Expand Down Expand Up @@ -200,6 +201,7 @@ static void __init omap3pandora_init(void)
spi_register_board_info(omap3pandora_spi_board_info,
ARRAY_SIZE(omap3pandora_spi_board_info));
omap3pandora_ads7846_init();
usb_musb_init();
}

static void __init omap3pandora_map_io(void)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap2/board-overo.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <mach/gpmc.h>
#include <mach/hardware.h>
#include <mach/nand.h>
#include <mach/usb.h>

#include "mmc-twl4030.h"

Expand Down Expand Up @@ -228,6 +229,7 @@ static void __init overo_init(void)
omap_serial_init();
twl4030_mmc_init(mmc);
overo_flash_init();
usb_musb_init();

if ((gpio_request(OVERO_GPIO_W2W_NRESET,
"OVERO_GPIO_W2W_NRESET") == 0) &&
Expand Down
187 changes: 187 additions & 0 deletions trunk/arch/arm/mach-omap2/usb-musb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/*
* 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 <linux/dma-mapping.h>
#include <linux/io.h>

#include <linux/usb/musb.h>

#include <mach/hardware.h>
#include <mach/irqs.h>
#include <mach/pm.h>
#include <mach/mux.h>
#include <mach/usb.h>

static struct resource musb_resources[] = {
[0] = { /* start and end set dynamically */
.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;

clk_enable(clk);
clk_on = 1;
} else {
if (clk_on == 0)
return -ENODEV;

clk_disable(clk);
clk_on = 0;
}

return 0;
}

static struct musb_hdrc_eps_bits musb_eps[] = {
{ "ep1_tx", 10, },
{ "ep1_rx", 10, },
{ "ep2_tx", 9, },
{ "ep2_rx", 9, },
{ "ep3_tx", 3, },
{ "ep3_rx", 3, },
{ "ep4_tx", 3, },
{ "ep4_rx", 3, },
{ "ep5_tx", 3, },
{ "ep5_rx", 3, },
{ "ep6_tx", 3, },
{ "ep6_rx", 3, },
{ "ep7_tx", 3, },
{ "ep7_rx", 3, },
{ "ep8_tx", 2, },
{ "ep8_rx", 2, },
{ "ep9_tx", 2, },
{ "ep9_rx", 2, },
{ "ep10_tx", 2, },
{ "ep10_rx", 2, },
{ "ep11_tx", 2, },
{ "ep11_rx", 2, },
{ "ep12_tx", 2, },
{ "ep12_rx", 2, },
{ "ep13_tx", 2, },
{ "ep13_rx", 2, },
{ "ep14_tx", 2, },
{ "ep14_rx", 2, },
{ "ep15_tx", 2, },
{ "ep15_rx", 2, },
};

static struct musb_hdrc_config musb_config = {
.multipoint = 1,
.dyn_fifo = 1,
.soft_con = 1,
.dma = 1,
.num_eps = 16,
.dma_channels = 7,
.dma_req_chan = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
.ram_bits = 12,
.eps_bits = musb_eps,
};

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
/* .clock is set dynamically */
.set_clock = musb_set_clock,
.config = &musb_config,

/* REVISIT charge pump on TWL4030 can supply up to
* 100 mA ... but this value is board-specific, like
* "mode", and should be passed to usb_musb_init().
*/
.power = 50, /* up to 100 mA */
};

static u64 musb_dmamask = DMA_32BIT_MASK;

static struct platform_device musb_device = {
.name = "musb_hdrc",
.id = -1,
.dev = {
.dma_mask = &musb_dmamask,
.coherent_dma_mask = DMA_32BIT_MASK,
.platform_data = &musb_plat,
},
.num_resources = ARRAY_SIZE(musb_resources),
.resource = musb_resources,
};

#ifdef CONFIG_NOP_USB_XCEIV
static u64 nop_xceiv_dmamask = DMA_32BIT_MASK;

static struct platform_device nop_xceiv_device = {
.name = "nop_usb_xceiv",
.id = -1,
.dev = {
.dma_mask = &nop_xceiv_dmamask,
.coherent_dma_mask = DMA_32BIT_MASK,
.platform_data = NULL,
},
};
#endif

void __init usb_musb_init(void)
{
if (cpu_is_omap243x())
musb_resources[0].start = OMAP243X_HS_BASE;
else
musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
musb_resources[0].end = musb_resources[0].start + SZ_8K - 1;

/*
* REVISIT: This line can be removed once all the platforms using
* musb_core.c have been converted to use use clkdev.
*/
musb_plat.clock = "ick";

#ifdef CONFIG_NOP_USB_XCEIV
if (platform_device_register(&nop_xceiv_device) < 0) {
printk(KERN_ERR "Unable to register NOP-XCEIV device\n");
return;
}
#endif

if (platform_device_register(&musb_device) < 0) {
printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
return;
}
}
8 changes: 8 additions & 0 deletions trunk/arch/arm/plat-omap/include/mach/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
#define UDC_BASE OMAP2_UDC_BASE
#define OMAP_OHCI_BASE OMAP2_OHCI_BASE

#ifdef CONFIG_USB_MUSB_SOC
extern void usb_musb_init(void);
#else
static inline void usb_musb_init(void)
{
}
#endif

#endif

void omap_usb_init(struct omap_usb_config *pdata);
Expand Down

0 comments on commit 8456e73

Please sign in to comment.