~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-davinci/mux.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm/mach-davinci/mux.c (Version linux-6.12-rc7) and /arch/sparc64/mach-davinci/mux.c (Version linux-4.14.336)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Utility to set the DAVINCI MUX register fro    
  4  *                                                
  5  * Author: Vladimir Barinov, MontaVista Softwa    
  6  *                                                
  7  * Based on linux/arch/arm/plat-omap/mux.c:       
  8  * Copyright (C) 2003 - 2005 Nokia Corporation    
  9  *                                                
 10  * Written by Tony Lindgren                       
 11  *                                                
 12  * 2007 (c) MontaVista Software, Inc.             
 13  *                                                
 14  * Copyright (C) 2008 Texas Instruments.          
 15  */                                               
 16                                                   
 17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt       
 18                                                   
 19 #include <linux/io.h>                             
 20 #include <linux/module.h>                         
 21 #include <linux/spinlock.h>                       
 22                                                   
 23 #include "mux.h"                                  
 24 #include "common.h"                               
 25                                                   
 26 static void __iomem *pinmux_base;                 
 27                                                   
 28 /*                                                
 29  * Sets the DAVINCI MUX register based on the     
 30  */                                               
 31 int davinci_cfg_reg(const unsigned long index)    
 32 {                                                 
 33         static DEFINE_SPINLOCK(mux_spin_lock);    
 34         struct davinci_soc_info *soc_info = &d    
 35         unsigned long flags;                      
 36         const struct mux_config *cfg;             
 37         unsigned int reg_orig = 0, reg = 0;       
 38         unsigned int mask, warn = 0;              
 39                                                   
 40         if (WARN_ON(!soc_info->pinmux_pins))      
 41                 return -ENODEV;                   
 42                                                   
 43         if (!pinmux_base) {                       
 44                 pinmux_base = ioremap(soc_info    
 45                 if (WARN_ON(!pinmux_base))        
 46                         return -ENOMEM;           
 47         }                                         
 48                                                   
 49         if (index >= soc_info->pinmux_pins_num    
 50                 pr_err("Invalid pin mux index:    
 51                        index, soc_info->pinmux    
 52                 dump_stack();                     
 53                 return -ENODEV;                   
 54         }                                         
 55                                                   
 56         cfg = &soc_info->pinmux_pins[index];      
 57                                                   
 58         if (cfg->name == NULL) {                  
 59                 pr_err("No entry for the speci    
 60                 return -ENODEV;                   
 61         }                                         
 62                                                   
 63         /* Update the mux register in question    
 64         if (cfg->mask) {                          
 65                 unsigned        tmp1, tmp2;       
 66                                                   
 67                 spin_lock_irqsave(&mux_spin_lo    
 68                 reg_orig = __raw_readl(pinmux_    
 69                                                   
 70                 mask = (cfg->mask << cfg->mask    
 71                 tmp1 = reg_orig & mask;           
 72                 reg = reg_orig & ~mask;           
 73                                                   
 74                 tmp2 = (cfg->mode << cfg->mask    
 75                 reg |= tmp2;                      
 76                                                   
 77                 if (tmp1 != tmp2)                 
 78                         warn = 1;                 
 79                                                   
 80                 __raw_writel(reg, pinmux_base     
 81                 spin_unlock_irqrestore(&mux_sp    
 82         }                                         
 83                                                   
 84         if (warn) {                               
 85 #ifdef CONFIG_DAVINCI_MUX_WARNINGS                
 86                 pr_warn("initialized %s\n", cf    
 87 #endif                                            
 88         }                                         
 89                                                   
 90 #ifdef CONFIG_DAVINCI_MUX_DEBUG                   
 91         if (cfg->debug || warn) {                 
 92                 pr_warn("Setting register %s\n    
 93                 pr_warn("   %s (0x%08x) = 0x%0    
 94                         cfg->mux_reg_name, cfg    
 95         }                                         
 96 #endif                                            
 97                                                   
 98         return 0;                                 
 99 }                                                 
100                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php