]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mfd: add OHCI cell to tc6393xb
authorDmitry Baryshkov <dbaryshkov@gmail.com>
Fri, 3 Oct 2008 18:11:36 +0000 (20:11 +0200)
committerSamuel Ortiz <samuel@sortiz.org>
Sun, 19 Oct 2008 20:54:10 +0000 (22:54 +0200)
Add information regarding OHCI cell of the tc6393xb

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Ian Molton <spyro@f2s.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
drivers/mfd/tc6393xb.c
include/linux/mfd/tc6393xb.h

index c3c64aeeb12ae4746bd014cba881a3e0919a2888..6197db7d48598e3d153395c9be15587933cf4cde 100644 (file)
@@ -113,6 +113,7 @@ struct tc6393xb {
 enum {
        TC6393XB_CELL_NAND,
        TC6393XB_CELL_MMC,
+       TC6393XB_CELL_OHCI,
 };
 
 /*--------------------------------------------------------------------------*/
@@ -170,6 +171,78 @@ static struct resource __devinitdata tc6393xb_mmc_resources[] = {
        },
 };
 
+const static struct resource tc6393xb_ohci_resources[] = {
+       {
+               .start  = 0x3000,
+               .end    = 0x31ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = 0x0300,
+               .end    = 0x03ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = 0x010000,
+               .end    = 0x017fff,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = 0x018000,
+               .end    = 0x01ffff,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TC6393_OHCI,
+               .end    = IRQ_TC6393_OHCI,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static int tc6393xb_ohci_enable(struct platform_device *dev)
+{
+       struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
+       unsigned long flags;
+       u16 ccr;
+       u8 fer;
+
+       spin_lock_irqsave(&tc6393xb->lock, flags);
+
+       ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
+       ccr |= SCR_CCR_USBCK;
+       tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
+
+       fer = tmio_ioread8(tc6393xb->scr + SCR_FER);
+       fer |= SCR_FER_USBEN;
+       tmio_iowrite8(fer, tc6393xb->scr + SCR_FER);
+
+       spin_unlock_irqrestore(&tc6393xb->lock, flags);
+
+       return 0;
+}
+
+static int tc6393xb_ohci_disable(struct platform_device *dev)
+{
+       struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
+       unsigned long flags;
+       u16 ccr;
+       u8 fer;
+
+       spin_lock_irqsave(&tc6393xb->lock, flags);
+
+       fer = tmio_ioread8(tc6393xb->scr + SCR_FER);
+       fer &= ~SCR_FER_USBEN;
+       tmio_iowrite8(fer, tc6393xb->scr + SCR_FER);
+
+       ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
+       ccr &= ~SCR_CCR_USBCK;
+       tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
+
+       spin_unlock_irqrestore(&tc6393xb->lock, flags);
+
+       return 0;
+}
+
 static struct mfd_cell __devinitdata tc6393xb_cells[] = {
        [TC6393XB_CELL_NAND] = {
                .name = "tmio-nand",
@@ -182,6 +255,15 @@ static struct mfd_cell __devinitdata tc6393xb_cells[] = {
                .num_resources = ARRAY_SIZE(tc6393xb_mmc_resources),
                .resources = tc6393xb_mmc_resources,
        },
+       [TC6393XB_CELL_OHCI] = {
+               .name = "tmio-ohci",
+               .num_resources = ARRAY_SIZE(tc6393xb_ohci_resources),
+               .resources = tc6393xb_ohci_resources,
+               .enable = tc6393xb_ohci_enable,
+               .suspend = tc6393xb_ohci_disable,
+               .resume = tc6393xb_ohci_enable,
+               .disable = tc6393xb_ohci_disable,
+       },
 };
 
 /*--------------------------------------------------------------------------*/
@@ -470,6 +552,11 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
        tc6393xb_cells[TC6393XB_CELL_MMC].data_size =
                sizeof(tc6393xb_cells[TC6393XB_CELL_MMC]);
 
+       tc6393xb_cells[TC6393XB_CELL_OHCI].platform_data =
+               &tc6393xb_cells[TC6393XB_CELL_OHCI];
+       tc6393xb_cells[TC6393XB_CELL_OHCI].data_size =
+               sizeof(tc6393xb_cells[TC6393XB_CELL_OHCI]);
+
 
        ret = mfd_add_devices(&dev->dev, dev->id,
                        tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
index 3ce10ae0f3975d1aa5fe87d172e630d70c04af77..4437736ebe1944a6bfd3adcaaa1ecffa95a02b42 100644 (file)
@@ -44,6 +44,7 @@ struct tc6393xb_platform_data {
  */
 #define        IRQ_TC6393_NAND         0
 #define        IRQ_TC6393_MMC          1
+#define        IRQ_TC6393_OHCI         2
 
 #define        TC6393XB_NR_IRQS        8