mux.c

来自「Linux Kernel 2.6.9 for OMAP1710」· C语言 代码 · 共 82 行

C
82
字号
/*  * linux/arch/arm/mach-omap2/mux.c *  * Support functions for Mux interface * * Copyright (C) 2004 Texas Instruments, Inc.  * * Copied from: * linux/arch/arm/mach-omap/mux-omap16xx.c * Copyright (C) 2003 Nokia Corporation *  * This package 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.  *  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.  */#include <linux/module.h>#include <asm/system.h>#include <asm/io.h>#include <asm/arch/platform.h>#define __MUX_C__#include <asm/arch/mux.h>/* * Sets the Omap MUX and PULL_DWN registers based on the table */int omap2_cfg_reg(const reg_cfg_t reg_cfg){	reg_cfg_set *cfg;	u8 reg_orig = 0, reg = 0;	cfg = &reg_cfg_table[reg_cfg];	/* Check the mux register in question */	if (cfg->pad_config_reg_offset) {		reg_orig =		    readb(OMAP24XX_VA_SYSTEM_CONTROL_BASE +			  cfg->pad_config_reg_offset);		/* clearing MuxMode bits */		reg = reg_orig & ~(MUXMODE_MASK);		/*configuring the new Mux Mode */		reg |= (cfg->mux_mode & MUXMODE_MASK);		/*configure Pull enable/disable */		if (cfg->pull_val) {			reg |= (PULL_UD_ENABLE_MASK);		} else {			reg &= ~(PULL_UD_ENABLE_MASK);		}		/*configure for Pull Up/Down */		if (cfg->pu_pd_val) {			reg |= PULLTYPE_SELECT_MASK;		} else {			reg &= ~(PULLTYPE_SELECT_MASK);		}		writeb(reg,		       OMAP24XX_VA_SYSTEM_CONTROL_BASE +		       cfg->pad_config_reg_offset);	}#ifdef CONFIG_OMAP_MUX_DEBUG	if (cfg->debug) {		printk("Omap: Setting register %s\n", cfg->name);		printk("      (0x%08x) = 0x%01x -> 0x%01x\n",		       (OMAP24XX_VA_SYSTEM_CONTROL_BASE +			cfg->pad_config_reg_offset), reg_orig, reg);	}#endif	return 0;}EXPORT_SYMBOL(omap2_cfg_reg);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?