omap2430.c
来自「omap3 linux 2.6 用nocc去除了冗余代码」· C语言 代码 · 共 183 行
C
183 行
/* * Copyright (C) 2005-2006 by Texas Instruments * * This file is part of the Inventra Controller Driver for Linux. * * The Inventra Controller Driver for Linux 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. * * The Inventra Controller Driver for Linux is distributed in * the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public * License for more details. * * You should have received a copy of the GNU General Public License * along with The Inventra Controller Driver for Linux ; if not, * write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA * */#include <linux/module.h>#include <linux/kernel.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/init.h>#include <linux/list.h>#include <linux/clk.h>#include <asm/io.h>#include <asm/mach-types.h>#include <asm/arch/hardware.h>#include <asm/arch/mux.h>#include "musbdefs.h"#include "omap2430.h"#define get_cpu_rev() 2extern void twl4030_phy_suspend(int controller_off);extern void twl4030_phy_resume(void);void musb_platform_enable(struct musb *musb){}void musb_platform_disable(struct musb *musb){}static void omap_vbus_power(struct musb *musb, int is_on, int sleeping){}static void omap_set_vbus(struct musb *musb, int is_on){ u8 devctl; /* HDRC controls CPEN, but beware current surges during device * connect. They can trigger transient overcurrent conditions * that must be ignored. */ devctl = musb_readb(musb->pRegs, MGC_O_HDRC_DEVCTL); if (is_on) { musb->is_active = 1; musb->xceiv.default_a = 1; musb->xceiv.state = OTG_STATE_A_WAIT_VRISE; devctl |= MGC_M_DEVCTL_SESSION; MUSB_HST_MODE(musb); } else { musb->is_active = 0; /* NOTE: we're skipping A_WAIT_VFALL -> A_IDLE and * jumping right to B_IDLE... */ musb->xceiv.default_a = 0; musb->xceiv.state = OTG_STATE_B_IDLE; devctl &= ~MGC_M_DEVCTL_SESSION; MUSB_DEV_MODE(musb); } musb_writeb(musb->pRegs, MGC_O_HDRC_DEVCTL, devctl); DBG(1, "VBUS %s, devctl %02x " /* otg %3x conf %08x prcm %08x */ "\n", otg_state_string(musb), musb_readb(musb->pRegs, MGC_O_HDRC_DEVCTL));}static int omap_set_power(struct otg_transceiver *x, unsigned mA){ return 0;}int musb_platform_resume(struct musb *musb);int __init musb_platform_init(struct musb *musb){ musb->clock = clk_get((struct device *)musb->controller, "hsusb_ick"); if(IS_ERR(musb->clock)) return PTR_ERR(musb->clock); musb->asleep = 1; /* The i-clk is AUTO gated. Hence there is no need * to disable it until the driver is shutdown */ clk_enable(musb->clock); musb_platform_resume(musb); OTG_SYSCONFIG_REG |= ENABLEWAKEUP; OTG_INTERFSEL_REG |= ULPI_12PIN; pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, " "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n", OTG_REVISION_REG, OTG_SYSCONFIG_REG, OTG_SYSSTATUS_REG, OTG_INTERFSEL_REG, OTG_SIMENABLE_REG); omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1); if (is_host_enabled(musb)) musb->board_set_vbus = omap_set_vbus; if (is_peripheral_enabled(musb)) musb->xceiv.set_power = omap_set_power; return 0;}int musb_platform_suspend(struct musb *musb){ DBG(1, "\n3430-suspend()"); if(!musb->asleep) { OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */ OTG_SYSCONFIG_REG &= FORCESTDBY; /* enable force standby */ OTG_SYSCONFIG_REG &= ~AUTOIDLE; /* disable auto idle */ OTG_SYSCONFIG_REG |= FORCEIDLE; /* enable force idle */ OTG_FORCESTDBY_REG |= ENABLEFORCE; /* enable MSTANDBY */ OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */ twl4030_phy_suspend(1); musb->asleep = 1; } return 0;}int musb_platform_resume(struct musb *musb){ DBG(1, "\n3430-resume()"); twl4030_phy_resume(); OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */ OTG_SYSCONFIG_REG |= SMARTSTDBY; /* enable smart standby */ OTG_SYSCONFIG_REG &= ~AUTOIDLE; /* disable auto idle */ OTG_SYSCONFIG_REG |= SMARTIDLE; /* enable smart idle */ OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */ musb->asleep = 0; return 0;}int musb_platform_exit(struct musb *musb){ omap_vbus_power(musb, 0 /*off*/, 1); musb_platform_suspend(musb); OTG_SYSCONFIG_REG &= ~ENABLEWAKEUP; /* Disable Wakeup */ clk_put(musb->clock); musb->clock = 0; return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?