Esempio n. 1
0
static void tmio_write_pm(struct platform_device *dev)
{
    struct usb_hcd *hcd = platform_get_drvdata(dev);
    struct tmio_hcd *tmio = hcd_to_tmio(hcd);
    u16 pm;
    unsigned long flags;

    spin_lock_irqsave(&tmio->lock, flags);

    pm = CCR_PM_GKEN | CCR_PM_CKRNEN |
         CCR_PM_PMEE | CCR_PM_PMES;

    tmio_iowrite16(pm, tmio->ccr + CCR_PM);
    spin_unlock_irqrestore(&tmio->lock, flags);
}
Esempio n. 2
0
static void tmio_stop_hc(struct platform_device *dev)
{
    struct usb_hcd *hcd = platform_get_drvdata(dev);
    struct ohci_hcd *ohci = hcd_to_ohci(hcd);
    struct tmio_hcd *tmio = hcd_to_tmio(hcd);
    u16 pm;

    pm = CCR_PM_GKEN | CCR_PM_CKRNEN;
    switch (ohci->num_ports) {
    default:
        dev_err(&dev->dev, "Unsupported amount of ports: %d\n", ohci->num_ports);
    case 3:
        pm |= CCR_PM_USBPW3;
    case 2:
        pm |= CCR_PM_USBPW2;
    case 1:
        pm |= CCR_PM_USBPW1;
    }
    tmio_iowrite8(0, tmio->ccr + CCR_INTC);
    tmio_iowrite8(0, tmio->ccr + CCR_ILME);
    tmio_iowrite16(0, tmio->ccr + CCR_BASE);
    tmio_iowrite16(0, tmio->ccr + CCR_BASE + 2);
    tmio_iowrite16(pm, tmio->ccr + CCR_PM);
}
Esempio n. 3
0
static void tmio_start_hc(struct platform_device *dev)
{
    struct usb_hcd *hcd = platform_get_drvdata(dev);
    struct tmio_hcd *tmio = hcd_to_tmio(hcd);
    unsigned long base = hcd->rsrc_start;

    tmio_write_pm(dev);
    tmio_iowrite16(base, tmio->ccr + CCR_BASE);
    tmio_iowrite16(base >> 16, tmio->ccr + CCR_BASE + 2);
    tmio_iowrite8(1, tmio->ccr + CCR_ILME);
    tmio_iowrite8(2, tmio->ccr + CCR_INTC);

    dev_info(&dev->dev, "revision %d @ 0x%08llx, irq %d\n",
             tmio_ioread8(tmio->ccr + CCR_REVID), hcd->rsrc_start, hcd->irq);
}
Esempio n. 4
0
static int tc6393xb_fb_disable(struct platform_device *dev)
{
	struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
	unsigned long flags;
	u16 ccr;

	spin_lock_irqsave(&tc6393xb->lock, flags);

	ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR);
	ccr &= ~SCR_CCR_MCLK_MASK;
	ccr |= SCR_CCR_MCLK_OFF;
	tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);

	spin_unlock_irqrestore(&tc6393xb->lock, flags);

	return 0;
}
Esempio n. 5
0
static int tmio_hw_init(struct platform_device *dev, struct tmio_nand *tmio)
{
	const struct mfd_cell *cell = mfd_get_cell(dev);
	int ret;

	if (cell->enable) {
		ret = cell->enable(dev);
		if (ret)
			return ret;
	}

	/* (4Ch) CLKRUN Enable    1st spcrunc */
	tmio_iowrite8(0x81, tmio->ccr + CCR_ICC);

	/* (10h)BaseAddress    0x1000 spba.spba2 */
	tmio_iowrite16(tmio->fcr_base, tmio->ccr + CCR_BASE);
	tmio_iowrite16(tmio->fcr_base >> 16, tmio->ccr + CCR_BASE + 2);

	/* (04h)Command Register I/O spcmd */
	tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND);

	/* (62h) Power Supply Control ssmpwc */
	/* HardPowerOFF - SuspendOFF - PowerSupplyWait_4MS */
	tmio_iowrite8(0x02, tmio->ccr + CCR_NFPSC);

	/* (63h) Detect Control ssmdtc */
	tmio_iowrite8(0x02, tmio->ccr + CCR_NFDC);

	/* Interrupt status register clear sintst */
	tmio_iowrite8(0x0f, tmio->fcr + FCR_ISR);

	/* After power supply, Media are reset smode */
	tmio_iowrite8(FCR_MODE_POWER_ON, tmio->fcr + FCR_MODE);
	tmio_iowrite8(FCR_MODE_COMMAND, tmio->fcr + FCR_MODE);
	tmio_iowrite8(NAND_CMD_RESET, tmio->fcr + FCR_DATA);

	/* Standby Mode smode */
	tmio_iowrite8(FCR_MODE_STANDBY, tmio->fcr + FCR_MODE);

	mdelay(5);

	return 0;
}
Esempio n. 6
0
static int tmio_hw_init(struct platform_device *dev, struct tmio_nand *tmio)
{
	struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
	int ret;

	if (cell->enable) {
		ret = cell->enable(dev);
		if (ret)
			return ret;
	}

	
	tmio_iowrite8(0x81, tmio->ccr + CCR_ICC);

	
	tmio_iowrite16(tmio->fcr_base, tmio->ccr + CCR_BASE);
	tmio_iowrite16(tmio->fcr_base >> 16, tmio->ccr + CCR_BASE + 2);

	
	tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND);

	
	
	tmio_iowrite8(0x02, tmio->ccr + CCR_NFPSC);

	
	tmio_iowrite8(0x02, tmio->ccr + CCR_NFDC);

	
	tmio_iowrite8(0x0f, tmio->fcr + FCR_ISR);

	
	tmio_iowrite8(FCR_MODE_POWER_ON, tmio->fcr + FCR_MODE);
	tmio_iowrite8(FCR_MODE_COMMAND, tmio->fcr + FCR_MODE);
	tmio_iowrite8(NAND_CMD_RESET, tmio->fcr + FCR_DATA);

	
	tmio_iowrite8(FCR_MODE_STANDBY, tmio->fcr + FCR_MODE);

	mdelay(5);

	return 0;
}
Esempio n. 7
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;
}