linux/drivers/bcma/core.c
<<
m_aor=r}a lect> href="../linux+v3.v2.6/drivers/bcma/core.c">lect> img src="../.static/gfx/right.png" alt=">>">le lect< m_ ac11lect> input typn vhidden" namn vnavtarget" ption v">lect> input typn vtext" namn vsearch" id vsearch">lect> butt Search m_aor onclick="return ajax_prefs();">lect> Prefs/span>a>le an>div an m_ ac11le input typn vhidden" namn vajax_lookup" id vajax_lookup" ption v">lct> an> m_aolct> andiv class="headingbott m"> > andiv id vsearch_results" class="search_results"/sp an>div/ ndiv id vfile_contents"a
 a1n>a>
     class="comment">/*
	    
 a2n>a>
     class="comment"> * Broadcom specific AMBA
	    
 a3n>a>
     class="comment"> * Core ops
	    
 a4n>a>
     class="comment"> *
	    
 a5n>a>
     class="comment"> * Licensed under the GNU/GPL. See COPYING 
	m details.
	    
 a6n>a>
     class="comment"> */
	    
 a7n>a>l
 a8n>a>#include "bcma_private.hn>a>"l
 a9n>a>#include <linux/export.hn>a>>l
 .6.1a>#include <linux/bcma/bcma.hn>a>>l
 11n>a>l
 12n>a>
a href="+code=bool" class="sref">booln>a> 
a href="+code=bcma_core_is_enabled" class="sref">bcma_core_is_enabledn>a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>)l
 13n>a>{l
 14n>a>        if ((
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>) & (
a href="+code=BCMA_IOCTL_CLK" class="sref">BCMA_IOCTL_CLKn>a> | 
a href="+code=BCMA_IOCTL_FGC" class="sref">BCMA_IOCTL_FGCn>a>))l
 15n>a>            != 
a href="+code=BCMA_IOCTL_CLK" class="sref">BCMA_IOCTL_CLKn>a>)l
 16n>a>                return 
a href="+code=false" class="sref">falsen>a>;l
 17n>a>        if (
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_RESET_CTL" class="sref">BCMA_RESET_CTLn>a>) & 
a href="+code=BCMA_RESET_CTL_RESET" class="sref">BCMA_RESET_CTL_RESETn>a>)l
 18n>a>                return 
a href="+code=false" class="sref">falsen>a>;l
 19n>a>        return 
a href="+code=true" class="sref">truen>a>;l
 26.1a>}l
 21n>a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLn>a>(
a href="+code=bcma_core_is_enabled" class="sref">bcma_core_is_enabledn>a>);l
 22n>a>l
 23n>a>void 
a href="+code=bcma_core_disable" class="sref">bcma_core_disablen>a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>, 
a href="+code=u32" class="sref">u32n>a> 
a href="+code=flags" class="sref">flagsn>a>)l
 24n>a>{l
 25n>a>        if (
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_RESET_CTL" class="sref">BCMA_RESET_CTLn>a>) & 
a href="+code=BCMA_RESET_CTL_RESET" class="sref">BCMA_RESET_CTL_RESETn>a>)l
 26n>a>                return;l
 27n>a>l
 28n>a>        
a href="+code=bcma_awrite32" class="sref">bcma_awrite32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>, 
a href="+code=flags" class="sref">flagsn>a>);l
 29n>a>        
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>);l
 30n>a>        
a href="+code=udelay" class="sref">udelayn>a>(10);l
 31n>a>l
 32n>a>        
a href="+code=bcma_awrite32" class="sref">bcma_awrite32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_RESET_CTL" class="sref">BCMA_RESET_CTLn>a>, 
a href="+code=BCMA_RESET_CTL_RESET" class="sref">BCMA_RESET_CTL_RESETn>a>);l
 33n>a>        
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_RESET_CTL" class="sref">BCMA_RESET_CTLn>a>);l
 34n>a>        
a href="+code=udelay" class="sref">udelayn>a>(1);l
 35.1a>}l
 36n>a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLn>a>(
a href="+code=bcma_core_disable" class="sref">bcma_core_disablen>a>);l
 37n>a>l
 38n>a>int 
a href="+code=bcma_core_enable" class="sref">bcma_core_enablen>a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>, 
a href="+code=u32" class="sref">u32n>a> 
a href="+code=flags" class="sref">flagsn>a>)l
 39n>a>{l
 40n>a>        
a href="+code=bcma_core_disable" class="sref">bcma_core_disablen>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=flags" class="sref">flagsn>a>);l
 41n>a>l
 42n>a>        
a href="+code=bcma_awrite32" class="sref">bcma_awrite32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>, (
a href="+code=BCMA_IOCTL_CLK" class="sref">BCMA_IOCTL_CLKn>a> | 
a href="+code=BCMA_IOCTL_FGC" class="sref">BCMA_IOCTL_FGCn>a> | 
a href="+code=flags" class="sref">flagsn>a>));l
 43n>a>        
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>);l
 44n>a>l
 45n>a>        
a href="+code=bcma_awrite32" class="sref">bcma_awrite32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_RESET_CTL" class="sref">BCMA_RESET_CTLn>a>, 0);l
 46n>a>        
a href="+code=udelay" class="sref">udelayn>a>(1);l
 47n>a>l
 48n>a>        
a href="+code=bcma_awrite32" class="sref">bcma_awrite32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>, (
a href="+code=BCMA_IOCTL_CLK" class="sref">BCMA_IOCTL_CLKn>a> | 
a href="+code=flags" class="sref">flagsn>a>));l
 49n>a>        
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOCTL" class="sref">BCMA_IOCTLn>a>);l
 50n>a>        
a href="+code=udelay" class="sref">udelayn>a>(1);l
 51n>a>l
 52n>a>        return 0;l
 53.1a>}l
 54n>a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLn>a>(
a href="+code=bcma_core_enable" class="sref">bcma_core_enablen>a>);l
 55n>a>l
 56n>a>void 
a href="+code=bcma_core_set_clockmode" class="sref">bcma_core_set_clockmoden>a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>,l
 57n>a>                             enum 
a href="+code=bcma_clkmode" class="sref">bcma_clkmoden>a> 
a href="+code=clkmode" class="sref">clkmoden>a>)l
 58n>a>{l
 59n>a>        
a href="+code=u16" class="sref">u16n>a> 
a href="+code=i" class="sref">in>a>;l
 60n>a>l
 61n>a>        
a href="+code=WARN_ON" class="sref">WARN_ONn>a>(
a href="+code=core" class="sref">coren>a>->
a href="+code=id" class="sref">idn>a>.
a href="+code=id" class="sref">idn>a> != 
a href="+code=BCMA_CORE_CHIPCOMMON" class="sref">BCMA_CORE_CHIPCOMMONn>a> &&l
 62n>a>                
a href="+code=core" class="sref">coren>a>->
a href="+code=id" class="sref">idn>a>.
a href="+code=id" class="sref">idn>a> != 
a href="+code=BCMA_CORE_PCIE" class="sref">BCMA_CORE_PCIEn>a> &&l
 63n>a>                
a href="+code=core" class="sref">coren>a>->
a href="+code=id" class="sref">idn>a>.
a href="+code=id" class="sref">idn>a> != 
a href="+code=BCMA_CORE_80211" class="sref">BCMA_CORE_80211n>a>);l
 64n>a>l
 65n>a>        switch (
a href="+code=clkmode" class="sref">clkmoden>a>) {l
 66n>a>        case 
a href="+code=BCMA_CLKMODE_FAST" class="sref">BCMA_CLKMODE_FASTn>a>:l
 67n>a>                
a href="+code=bcma_set32" class="sref">bcma_set32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_CLKCTLST" class="sref">BCMA_CLKCTLSTn>a>, 
a href="+code=BCMA_CLKCTLST_FORCEHT" class="sref">BCMA_CLKCTLST_FORCEHTn>a>);l
 68n>a>                
a href="+code=usleep_range" class="sref">usleep_rangen>a>(64, 300);l
 69n>a>                
	m (
a href="+code=i" class="sref">in>a> = 0; 
a href="+code=i" class="sref">in>a> < 1500; 
a href="+code=i" class="sref">in>a>++) {l
 70n>a>                        if (
a href="+code=bcma_read32" class="sref">bcma_read32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_CLKCTLST" class="sref">BCMA_CLKCTLSTn>a>) &l
 71n>a>                            
a href="+code=BCMA_CLKCTLST_HAVEHT" class="sref">BCMA_CLKCTLST_HAVEHTn>a>) {l
 72n>a>                                
a href="+code=i" class="sref">in>a> = 0;l
 73n>a>                                break;l
 74n>a>                        }l
 75n>a>                        
a href="+code=udelay" class="sref">udelayn>a>(10);l
 76n>a>                }l
 77n>a>                if (
a href="+code=i" class="sref">in>a>)l
 78n>a>                        
a href="+code=bcma_err" class="sref">bcma_errn>a>(
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>, 
     class="string">"HT 
	mce timeout\n"<	    <);l
 79n>a>                break;l
 80n>a>        case 
a href="+code=BCMA_CLKMODE_DYNAMIC" class="sref">BCMA_CLKMODE_DYNAMICn>a>:l
 81n>a>                
a href="+code=bcma_set32" class="sref">bcma_set32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_CLKCTLST" class="sref">BCMA_CLKCTLSTn>a>, ~
a href="+code=BCMA_CLKCTLST_FORCEHT" class="sref">BCMA_CLKCTLST_FORCEHTn>a>);l
 82n>a>                break;l
 83n>a>        }l
 84.1a>}l
 85n>a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLn>a>(
a href="+code=bcma_core_set_clockmode" class="sref">bcma_core_set_clockmoden>a>);l
 86n>a>l
 87n>a>void 
a href="+code=bcma_core_pll_ctl" class="sref">bcma_core_pll_ctln>a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>, 
a href="+code=u32" class="sref">u32n>a> 
a href="+code=req" class="sref">reqn>a>, 
a href="+code=u32" class="sref">u32n>a> 
a href="+code=status" class="sref">statusn>a>, 
a href="+code=bool" class="sref">booln>a> 
a href="+code=on" class="sref">onn>a>)l
 88n>a>{l
 89n>a>        
a href="+code=u16" class="sref">u16n>a> 
a href="+code=i" class="sref">in>a>;l
 90n>a>l
 91n>a>        
a href="+code=WARN_ON" class="sref">WARN_ONn>a>(
a href="+code=req" class="sref">reqn>a> & ~
a href="+code=BCMA_CLKCTLST_EXTRESREQ" class="sref">BCMA_CLKCTLST_EXTRESREQn>a>);l
 92n>a>        
a href="+code=WARN_ON" class="sref">WARN_ONn>a>(
a href="+code=status" class="sref">statusn>a> & ~
a href="+code=BCMA_CLKCTLST_EXTRESST" class="sref">BCMA_CLKCTLST_EXTRESSTn>a>);l
 93n>a>l
 94n>a>        if (
a href="+code=on" class="sref">onn>a>) {l
 95n>a>                
a href="+code=bcma_set32" class="sref">bcma_set32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_CLKCTLST" class="sref">BCMA_CLKCTLSTn>a>, 
a href="+code=req" class="sref">reqn>a>);l
 96n>a>                
	m (
a href="+code=i" class="sref">in>a> = 0; 
a href="+code=i" class="sref">in>a> < 10000; 
a href="+code=i" class="sref">in>a>++) {l
 97n>a>                        if ((
a href="+code=bcma_read32" class="sref">bcma_read32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_CLKCTLST" class="sref">BCMA_CLKCTLSTn>a>) & 
a href="+code=status" class="sref">statusn>a>) ==l
 98n>a>                            
a href="+code=status" class="sref">statusn>a>) {l
 99n>a>                                
a href="+code=i" class="sref">in>a> = 0;l
100n>a>                                break;l
101n>a>                        }l
102n>a>                        
a href="+code=udelay" class="sref">udelayn>a>(10);l
103n>a>                }l
104n>a>                if (
a href="+code=i" class="sref">in>a>)l
105n>a>                        
a href="+code=bcma_err" class="sref">bcma_errn>a>(
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>, 
     class="string">"PLL enable timeout\n"<	    <);l
106n>a>        } else {l
107n>a>                
a href="+code=bcma_warn" class="sref">bcma_warnn>a>(
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>, 
     class="string">"Disabling PLL not supported yet!\n"<	    <);l
108n>a>        }l
109.1a>}l
1.6.1a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLn>a>(
a href="+code=bcma_core_pll_ctl" class="sref">bcma_core_pll_ctln>a>);l
111n>a>l
112n>a>
a href="+code=u32" class="sref">u32n>a> 
a href="+code=bcma_core_dma_transla11bcma_core_dma_transla11a>(struct 
a href="+code=bcma_device" class="sref">bcma_devicen>a> *
a href="+code=core" class="sref">coren>a>)l
113n>a>{l
114n>a>        switch (
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>->
a href="+code=hosttypn" class="sref">hosttypnn>a>) {l
115n>a>        case 
a href="+code=BCMA_HOSTTYPE_SOC" class="sref">BCMA_HOSTTYPE_SOCn>a>:l
116n>a>                return 0;l
117n>a>        case 
a href="+code=BCMA_HOSTTYPE_PCI" class="sref">BCMA_HOSTTYPE_PCIn>a>:l
118n>a>                if (
a href="+code=bcma_aread32" class="sref">bcma_aread32n>a>(
a href="+code=core" class="sref">coren>a>, 
a href="+code=BCMA_IOST" class="sref">BCMA_IOSTn>a>) & 
a href="+code=BCMA_IOST_DMA64" class="sref">BCMA_IOST_DMA64n>a>)l
119n>a>                        return 
a href="+code=BCMA_DMA_TRANSLATION_DMA64_CMT" class="sref">BCMA_DMA_TRANSLATION_DMA64_CMTn>a>;l
120n>a>                elsel
121n>a>                        return 
a href="+code=BCMA_DMA_TRANSLATION_DMA32_CMT" class="sref">BCMA_DMA_TRANSLATION_DMA32_CMTn>a>;l
122n>a>        default:l
123n>a>                
a href="+code=bcma_err" class="sref">bcma_errn>a>(
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>, 
     class="string">"DMA transla11
124n>a>                         
a href="+code=core" class="sref">coren>a>->
a href="+code=bus" class="sref">busn>a>->
a href="+code=hosttypn" class="sref">hosttypnn>a>);l
125n>a>        }l
126n>a>        return 
a href="+code=BCMA_DMA_TRANSLATION_NONE" class="sref">BCMA_DMA_TRANSLATION_NONEn>a>;l
127n>a>}l
128n>a>
a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOLn>a>(
a href="+code=bcma_core_dma_transla11bcma_core_dma_transla11a>);l
129n>a>
div The original LXR software by the LXR communityn>a>, this experimental vers1lxr@linux.non>a>. n>div lxr.linux.no kindly hosted by Redpill Linpro ASn>a>, provider of Linux consulting and opera11div