]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
partial omap2430 fixes for musb_hdrc
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 18 Jan 2007 19:40:12 +0000 (11:40 -0800)
committerTony Lindgren <tony@atomide.com>
Thu, 18 Jan 2007 19:40:12 +0000 (11:40 -0800)
Partial build fixes for musb_hdrc on OMAP 2430; plus typedef and CaMeLcAsE
removal in the support for Mentor's DMA engine.

Also re-order the mach-omap2 Kconfig to restore the option hierachy that
was destroyed when the 2430SDP patch was merged into the wrong place.

Someone still needs to provide <asm/arch/hdrc_cnf.h> corresponding to
how the Mentor core is configured on that platform; add some register
and pin mux declarations; and create and register the platform_device.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
arch/arm/mach-omap2/Kconfig
drivers/usb/musb/Kconfig
drivers/usb/musb/Makefile
drivers/usb/musb/musb_host.c
drivers/usb/musb/musbhsdma.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/omap2430.h

index 83608e43c9e675cce04c84d98d99d71b9d34aed7..bb49f0ec69c11daa77b07d5ed7b8fd3baec99bae 100644 (file)
@@ -32,10 +32,6 @@ config MACH_OMAP_H4
        select OMAP_DEBUG_DEVICES
        select GPIOEXPANDER_OMAP
 
-config MACH_OMAP_2430SDP
-       bool "OMAP 2430 SDP board"
-       depends on ARCH_OMAP2 && ARCH_OMAP24XX
-
 config MACH_OMAP_H4_TUSB
        bool "TUSB 6010 EVM board"
        depends on MACH_OMAP_H4
@@ -73,3 +69,8 @@ config MACH_OMAP2_H4_USB1
 config MACH_OMAP_APOLLON
        bool "OMAP 2420 Apollon board"
        depends on ARCH_OMAP2 && ARCH_OMAP24XX
+
+config MACH_OMAP_2430SDP
+       bool "OMAP 2430 SDP board"
+       depends on ARCH_OMAP2 && ARCH_OMAP24XX
+
index 6ef786c75ed6815236f7459840d0682dd0a20d90..a9bcd7e27f97b03cdf48ea280460ffc054a21399 100644 (file)
@@ -29,7 +29,7 @@ config USB_MUSB_SOC
        boolean
        depends on USB_MUSB_HDRC
        default y if ARCH_DAVINCI
-       default y if ARCH_OMAP243X
+       default y if ARCH_OMAP2430
        default y if ARCH_OMAP343X
        help
          Use a static <asm/arch/hdrc_cnf.h> file to describe how the
@@ -40,7 +40,7 @@ comment "DaVinci 644x USB support"
        depends on USB_MUSB_HDRC && ARCH_DAVINCI
 
 comment "OMAP 243x high speed USB support"
-       depends on USB_MUSB_HDRC && ARCH_OMAP243X
+       depends on USB_MUSB_HDRC && ARCH_OMAP2430
 
 comment "OMAP 343x high speed USB support"
        depends on USB_MUSB_HDRC && ARCH_OMAP343X
@@ -145,7 +145,7 @@ config USB_INVENTRA_FIFO
 config USB_INVENTRA_DMA
        bool
        depends on USB_MUSB_HDRC && !USB_INVENTRA_FIFO
-       default ARCH_OMAP243X || ARCH_OMAP343X
+       default ARCH_OMAP2430 || ARCH_OMAP343X
        help
          Enable DMA transfers using Mentor's engine.
 
index efa6e192b7ff027efea3aca9324e17ee0dd2838a..535ba40f773b58f94704d4aac529d0c17e0690da 100644 (file)
@@ -14,7 +14,7 @@ ifeq ($(CONFIG_USB_TUSB6010),y)
        musb_hdrc-objs  += tusb6010.o
 endif
 
-ifeq ($(CONFIG_ARCH_OMAP243X),y)
+ifeq ($(CONFIG_ARCH_OMAP2430),y)
        musb_hdrc-objs  += omap2430.o
 endif
 
index 599351c25a569b62abff29609deee99f5029a3fe..f59fd63a0c662d04383e39e19cc092b1569fb3bb 100644 (file)
@@ -803,7 +803,11 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
                                wLoadCount = 0;
                        } else {
                                pDmaController->channel_release(pDmaChannel);
-                               pDmaChannel = pEnd->pDmaChannel = NULL;
+                               if (is_out)
+                                       pEnd->tx_channel = NULL;
+                               else
+                                       pEnd->rx_channel = NULL;
+                               pDmaChannel = NULL;
                        }
                }
 #endif
index da94c156ea3483385c3b383645172db39858467f..4344e898a1f9f7f9de9daa79976021e10688d722 100644 (file)
  ******************************************************************/
 
 /*
- * DMA implementation for high-speed controllers.
+ * Interface to Mentor's DMA engine
  */
 
+#include <linux/platform_device.h>
+
 #include "musbdefs.h"
 
 
 
 /******************************* Types ********************************/
 
-struct _MGC_HsDmaController;
-
-typedef struct {
+struct hsdma_channel {
        struct dma_channel Channel;
-       struct _MGC_HsDmaController *pController;
+       struct hsdma *pController;
        u32 dwStartAddress;
        u32 dwCount;
        u8 bIndex;
        u8 bEnd;
        u8 bTransmit;
-} MGC_HsDmaChannel;
+};
 
 struct hsdma {
        struct dma_controller Controller;
-       MGC_HsDmaChannel aChannel[MGC_HSDMA_CHANNELS];
+       struct hsdma_channel aChannel[MGC_HSDMA_CHANNELS];
        void *pDmaPrivate;
        void __iomem *pCoreBase;
        u8 bChannelCount;
        u8 bmUsedChannels;
 };
 
-/* FIXME remove typedef noise */
-typedef struct hsdma MGC_HsDmaController;
-
 /****************************** FUNCTIONS ********************************/
 
-static int MGC_HsDmaStartController(struct dma_controller *c)
+static int hsdma_start(struct dma_controller *c)
 {
        /* nothing to do */
        return 0;
 }
 
-static int MGC_HsDmaStopController(struct dma_controller *c)
+static int hsdma_stop(struct dma_controller *c)
 {
        /* nothing to do */
        return 0;
 }
 
-static struct dma_channel *MGC_HsDmaAllocateChannel(
-               struct dma_controller *c,
+static struct dma_channel *
+hsdma_channel_alloc(struct dma_controller *c,
                struct musb_hw_ep *hw_ep,
                u8 bTransmit)
 {
        u8 bBit;
        struct dma_channel *pChannel = NULL;
-       MGC_HsDmaChannel *pImplChannel = NULL;
-       MGC_HsDmaController *pController;
+       struct hsdma_channel *pImplChannel = NULL;
+       struct hsdma *pController;
 
-       pcontroller = container_of(c, struct hsdma, Controller);
+       pController = container_of(c, struct hsdma, Controller);
        for (bBit = 0; bBit < MGC_HSDMA_CHANNELS; bBit++) {
                if (!(pController->bmUsedChannels & (1 << bBit))) {
                        pController->bmUsedChannels |= (1 << bBit);
@@ -138,10 +135,9 @@ static struct dma_channel *MGC_HsDmaAllocateChannel(
        return pChannel;
 }
 
-static void MGC_HsDmaReleaseChannel(struct dma_channel *pChannel)
+static void hsdma_channel_release(struct dma_channel *pChannel)
 {
-       MGC_HsDmaChannel *pImplChannel =
-           (MGC_HsDmaChannel *) pChannel->pPrivateData;
+       struct hsdma_channel *pImplChannel = pChannel->pPrivateData;
 
        pImplChannel->pController->bmUsedChannels &=
            ~(1 << pImplChannel->bIndex);
@@ -150,9 +146,8 @@ static void MGC_HsDmaReleaseChannel(struct dma_channel *pChannel)
 
 static void clear_state(struct dma_channel *pChannel)
 {
-       MGC_HsDmaChannel *pImplChannel =
-           (MGC_HsDmaChannel *) pChannel->pPrivateData;
-       MGC_HsDmaController *pController = pImplChannel->pController;
+       struct hsdma_channel *pImplChannel = pChannel->pPrivateData;
+       struct hsdma *pController = pImplChannel->pController;
        u8 *pBase = pController->pCoreBase;
        u8 bChannel = pImplChannel->bIndex;
 
@@ -175,9 +170,8 @@ static u8 configure_channel(struct dma_channel *pChannel,
                                  u16 wPacketSize, u8 bMode,
                                  dma_addr_t dma_addr, u32 dwLength)
 {
-       MGC_HsDmaChannel *pImplChannel =
-           (MGC_HsDmaChannel *) pChannel->pPrivateData;
-       MGC_HsDmaController *pController = pImplChannel->pController;
+       struct hsdma_channel *pImplChannel = pChannel->pPrivateData;
+       struct hsdma *pController = pImplChannel->pController;
        u8 *pBase = pController->pCoreBase;
        u8 bChannel = pImplChannel->bIndex;
        u16 wCsr = 0;
@@ -223,12 +217,11 @@ static u8 configure_channel(struct dma_channel *pChannel,
        return TRUE;
 }
 
-static int MGC_HsDmaProgramChannel(struct dma_channel * pChannel,
+static int hsdma_channel_program(struct dma_channel * pChannel,
                                  u16 wPacketSize, u8 bMode,
                                  dma_addr_t dma_addr, u32 dwLength)
 {
-       MGC_HsDmaChannel *pImplChannel =
-           (MGC_HsDmaChannel *) pChannel->pPrivateData;
+       struct hsdma_channel *pImplChannel = pChannel->pPrivateData;
 
        DBG(2, "pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
               wPacketSize, dma_addr, dwLength, bMode);
@@ -267,7 +260,7 @@ static int MGC_HsDmaProgramChannel(struct dma_channel * pChannel,
 }
 
 // REVISIT...
-static int MGC_HsDmaAbortChannel(struct dma_channel *pChannel)
+static int hsdma_channel_abort(struct dma_channel *pChannel)
 {
        clear_state(pChannel);
        pChannel->bStatus = MGC_DMA_STATUS_FREE;
@@ -279,8 +272,8 @@ static irqreturn_t hsdma_irq(int irq, void *pPrivateData)
        u8 bChannel;
        u16 wCsr;
        u32 dwAddress;
-       MGC_HsDmaChannel *pImplChannel;
-       MGC_HsDmaController *pController = pPrivateData;
+       struct hsdma_channel *pImplChannel;
+       struct hsdma *pController = pPrivateData;
        u8 *pBase = pController->pCoreBase;
        struct dma_channel *pChannel;
        u8 bIntr = musb_readb(pBase, MGC_O_HSDMA_INTR);
@@ -291,8 +284,7 @@ static irqreturn_t hsdma_irq(int irq, void *pPrivateData)
        for (bChannel = 0; bChannel < MGC_HSDMA_CHANNELS; bChannel++) {
                if (bIntr & (1 << bChannel)) {
 
-                       pImplChannel = (MGC_HsDmaChannel *)
-                                       &(pController->aChannel[bChannel]);
+                       pImplChannel = &pController->aChannel[bChannel];
                        pChannel = &pImplChannel->Channel;
 
                        wCsr = musb_readw(pBase,
@@ -356,7 +348,7 @@ static irqreturn_t hsdma_irq(int irq, void *pPrivateData)
 
 static void hsdma_controller_destroy(struct dma_controller *pController)
 {
-       MGC_HsDmaController *pHsController = pController->pPrivateData;
+       struct hsdma *pHsController = pController->pPrivateData;
 
        if (pHsController) {
                pHsController->Controller.pPrivateData = NULL;
@@ -367,7 +359,7 @@ static void hsdma_controller_destroy(struct dma_controller *pController)
 static struct dma_controller *
 hsdma_controller_new(struct musb *pThis, void __iomem *pCoreBase)
 {
-       MGC_HsDmaController *pController;
+       struct hsdma *pController;
        struct device *dev = pThis->controller;
        struct platform_device *pdev = to_platform_device(dev);
        int irq = platform_get_irq(pdev, 1);
@@ -377,7 +369,7 @@ hsdma_controller_new(struct musb *pThis, void __iomem *pCoreBase)
                return NULL;
        }
 
-       if (!(pController = kzalloc(sizeof(MGC_HsDmaController), GFP_KERNEL)))
+       if (!(pController = kzalloc(sizeof *pController, GFP_KERNEL)))
                return NULL;
 
        pController->bChannelCount = MGC_HSDMA_CHANNELS;
@@ -385,12 +377,12 @@ hsdma_controller_new(struct musb *pThis, void __iomem *pCoreBase)
        pController->pCoreBase = pCoreBase;
 
        pController->Controller.pPrivateData = pController;
-       pController->Controller.start = MGC_HsDmaStartController;
-       pController->Controller.stop = MGC_HsDmaStopController;
-       pController->Controller.channel_alloc = MGC_HsDmaAllocateChannel;
-       pController->Controller.channel_release = MGC_HsDmaReleaseChannel;
-       pController->Controller.channel_program = MGC_HsDmaProgramChannel;
-       pController->Controller.channel_abort = MGC_HsDmaAbortChannel;
+       pController->Controller.start = hsdma_start;
+       pController->Controller.stop = hsdma_stop;
+       pController->Controller.channel_alloc = hsdma_channel_alloc;
+       pController->Controller.channel_release = hsdma_channel_release;
+       pController->Controller.channel_program = hsdma_channel_program;
+       pController->Controller.channel_abort = hsdma_channel_abort;
 
        if (request_irq(irq, hsdma_irq, SA_INTERRUPT,
                        pThis->controller->bus_id, &pController->Controller)) {
index d8d5feb560d1b09d9eaa14bcfd992d2c4ef50f28..87a7014663ad54e094f24c5a9d00a78ed223330d 100644 (file)
@@ -65,11 +65,11 @@ int __init musb_platform_init(struct musb *musb)
 {
        /* Erratum - reset value of STP has pull-down.
           Change it to pull-up. */
-       omap2_cfg_reg(AE5_2430_USB0HS_STP);
+       omap_cfg_reg(AE5_2430_USB0HS_STP);
 
        /* start clock */
        musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
-       clk_use(musb->clock);
+       clk_enable(musb->clock);
 
        omap_writel(omap_readl(OTG_INTERFSEL) | (1<<0), OTG_INTERFSEL);
        omap_writel(omap_readl(OTG_SYSCONFIG) |
@@ -90,11 +90,7 @@ int __init musb_platform_init(struct musb *musb)
 int __exit musb_platform_exit(struct musb *musb)
 {
        omap_vbus_power(musb, 0 /*off*/, 1);
-
-       /* REVISIT older omap trees need "unuse", more current
-        * ones just have disable()
-        */
-       clk_unuse(musb->clock);
+       clk_disable(musb->clock);
 
        return 0;
 }
index cb5f84bb346d1dfbb2958fdc7e1044518b83a325..e6348080df8756e228b5737088d6e6622ce299ed 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __MUSB_OMAP243X_H__
 #define __MUSB_OMAP243X_H__
 
-#ifdef CONFIG_ARCH_OMAP243X
+#ifdef CONFIG_ARCH_OMAP2430
 /*
  * OMAP2430-specific definitions
  */