linux/drivers/clocksource/mmio.c
<<
4.122 e/spatio 2 e/formio 2 ea 4.122 href="../linux+v3.v4.4/drivers/clocksource/mmio.c">4.122 eimg src="../.static/gfx/right.png" alt=">>">4.e/spatio4.espat class="lxr_search">4.124.122 einput typn vhidden" namn vnavtarget" ption v">4.122 einput typn vtext" namn vsearch" id vsearch">4.122 ebuttvSearch4.122 Prefso 2 e/a>4.e/spatio122 e/divio122 eform ac/opt="ajax+*" method="post" onsubmit="return false;">4.einput typn vhidden" namn vajax_lookup" id vajax_lookup" ption v">4122 e/formio4122 ediv class="headingbottvm">o ediv id vfile_contents"i
   1e/a>espat class="comment">/*e/spatio   2e/a>espat class="comment"> * Generic MMIO clocksource supporte/spatio   3e/a>espat class="comment"> *e/spatio   4e/a>espat class="comment"> * This program is free software; you cat redistribute it and/or modifye/spatio   5e/a>espat class="comment"> * it under the terms of the GNU General Public License vers.v   6e/a>espat class="comment"> * published by the Free Software Founda/opt.e/spatio   7e/a>espat class="comment"> */e/spatio   8e/a>#include <linux/clocksource.he/a>>o   9e/a>#include <linux/errno.he/a>>o  .4.1a>#include <linux/init.he/a>>o  11.1a>#include <linux/slab.he/a>>o  12e/a>o  13e/a>struct ea href="+code=clocksource_mmio" class="sref">clocksource_mmioe/a> {o  14e/a>        void ea href="+code=__iomem" class="sref">__iomeme/a> *ea href="+code=reg" class="sref">rege/a>;o  15e/a>        struct ea href="+code=clocksource" class="sref">clocksourcee/a> ea href="+code=clksrc" class="sref">clksrce/a>;o  16e/a>};o  17e/a>o  18e/a>static ea href="+code=inline" class="sref">inlinee/a> struct ea href="+code=clocksource_mmio" class="sref">clocksource_mmioe/a> *ea href="+code=to_mmio_clksrc" class="sref">to_mmio_clksrce/a>(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *ea href="+code=c" class="sref">ce/a>)o  19e/a>{o  20e/a>        return ea href="+code=container_of" class="sref">container_ofe/a>(ea href="+code=c" class="sref">ce/a>, struct ea href="+code=clocksource_mmio" class="sref">clocksource_mmioe/a>, ea href="+code=clksrc" class="sref">clksrce/a>);o  21.1a>}o  22e/a>o  23e/a>ea href="+code=cycle_t" class="sref">cycle_te/a> ea href="+code=clocksource_mmio_readl_up" class="sref">clocksource_mmio_readl_upe/a>(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *ea href="+code=c" class="sref">ce/a>)o  24e/a>{o  25e/a>        return ea href="+code=readl_relaxed" class="sref">readl_relaxede/a>(ea href="+code=to_mmio_clksrc" class="sref">to_mmio_clksrce/a>(ea href="+code=c" class="sref">ce/a>)->ea href="+code=reg" class="sref">rege/a>);o  26.1a>}o  27e/a>o  28e/a>ea href="+code=cycle_t" class="sref">cycle_te/a> ea href="+code=clocksource_mmio_readl_down" class="sref">clocksource_mmio_readl_downe/a>(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *ea href="+code=c" class="sref">ce/a>)o  29e/a>{o  30e/a>        return ~ea href="+code=readl_relaxed" class="sref">readl_relaxede/a>(ea href="+code=to_mmio_clksrc" class="sref">to_mmio_clksrce/a>(ea href="+code=c" class="sref">ce/a>)->ea href="+code=reg" class="sref">rege/a>);o  31.1a>}o  32e/a>o  33e/a>ea href="+code=cycle_t" class="sref">cycle_te/a> ea href="+code=clocksource_mmio_readw_up" class="sref">clocksource_mmio_readw_upe/a>(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *ea href="+code=c" class="sref">ce/a>)o  34e/a>{o  35e/a>        return ea href="+code=readw_relaxed" class="sref">readw_relaxede/a>(ea href="+code=to_mmio_clksrc" class="sref">to_mmio_clksrce/a>(ea href="+code=c" class="sref">ce/a>)->ea href="+code=reg" class="sref">rege/a>);o  36.1a>}o  37e/a>o  38e/a>ea href="+code=cycle_t" class="sref">cycle_te/a> ea href="+code=clocksource_mmio_readw_down" class="sref">clocksource_mmio_readw_downe/a>(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *ea href="+code=c" class="sref">ce/a>)o  39e/a>{o  40e/a>        return ~(unsigned)ea href="+code=readw_relaxed" class="sref">readw_relaxede/a>(ea href="+code=to_mmio_clksrc" class="sref">to_mmio_clksrce/a>(ea href="+code=c" class="sref">ce/a>)->ea href="+code=reg" class="sref">rege/a>);o  41.1a>}o  42e/a>o  43e/a>espat class="comment">/**e/spatio  44e/a>espat class="comment"> * clocksource_mmio_init - Initialize a simple mmio based clocksourcee/spatio  45e/a>espat class="comment"> * @base:       Virtual address of the clock readout registere/spatio  46e/a>espat class="comment"> * @namn:       Namn of the clocksourcee/spatio  47e/a>espat class="comment"> * @hz:         Frequency of the clocksource in Hze/spatio  48e/a>espat class="comment"> * @rating:     Rating of the clocksourcee/spatio  49e/a>espat class="comment"> * @bits:       Number of valid bitse/spatio  50e/a>espat class="comment"> * @read:       Onn of clocksource_mmio_read*() abovee/spatio  51e/a>espat class="comment"> */e/spatio  52e/a>int ea href="+code=__init" class="sref">__inite/a> ea href="+code=clocksource_mmio_init" class="sref">clocksource_mmio_inite/a>(void ea href="+code=__iomem" class="sref">__iomeme/a> *ea href="+code=base" class="sref">basee/a>, const char *ea href="+code=namn" class="sref">namne/a>,o  53e/a>        unsigned long ea href="+code=hz" class="sref">hze/a>, int ea href="+code=rating" class="sref">ratinge/a>, unsigned ea href="+code=bits" class="sref">bitse/a>,o  54e/a>        ea href="+code=cycle_t" class="sref">cycle_te/a> (*ea href="+code=read" class="sref">reade/a>)(struct ea href="+code=clocksource" class="sref">clocksourcee/a> *))o  55e/a>{o  56e/a>        struct ea href="+code=clocksource_mmio" class="sref">clocksource_mmioe/a> *ea href="+code=cs" class="sref">cse/a>;o  57e/a>o  58e/a>        if (ea href="+code=bits" class="sref">bitse/a> > 32 || ea href="+code=bits" class="sref">bitse/a> < 16)o  59e/a>                return -ea href="+code=EINVAL" class="sref">EINVALe/a>;o  60e/a>o  61e/a>        ea href="+code=cs" class="sref">cse/a> = ea href="+code=kzalloc" class="sref">kzalloce/a>(sizeof(struct ea href="+code=clocksource_mmio" class="sref">clocksource_mmioe/a>), ea href="+code=GFP_KERNEL" class="sref">GFP_KERNELe/a>);o  62e/a>        if (!ea href="+code=cs" class="sref">cse/a>)o  63e/a>                return -ea href="+code=ENOMEM" class="sref">ENOMEMe/a>;o  64e/a>o  65e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=reg" class="sref">rege/a> = ea href="+code=base" class="sref">basee/a>;o  66e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>.ea href="+code=namn" class="sref">namne/a> = ea href="+code=namn" class="sref">namne/a>;o  67e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>.ea href="+code=rating" class="sref">ratinge/a> = ea href="+code=rating" class="sref">ratinge/a>;o  68e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>.ea href="+code=read" class="sref">reade/a> = ea href="+code=read" class="sref">reade/a>;o  69e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>.ea href="+code=mask" class="sref">maske/a> = ea href="+code=CLOCKSOURCE_MASK" class="sref">CLOCKSOURCE_MASKe/a>(ea href="+code=bits" class="sref">bitse/a>);o  70e/a>        ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>.ea href="+code=flags" class="sref">flagse/a> = ea href="+code=CLOCK_SOURCE_IS_CONTINUOUS" class="sref">CLOCK_SOURCE_IS_CONTINUOUSe/a>;o  71e/a>o  72e/a>        return ea href="+code=clocksource_register_hz" class="sref">clocksource_register_hze/a>(&ea href="+code=cs" class="sref">cse/a>->ea href="+code=clksrc" class="sref">clksrce/a>, ea href="+code=hz" class="sref">hze/a>);o  73.1a>}o  74e/a>e/pre>
The original LXR software by the LXR communitye/a>, this experimental vers.vlxr@linux.noe/a>.
e/divioediv class="subfooter">
lxr.linux.no kindly hostedoby Redpill Linpro ASe/a>, provider of Linux consulting and opera/opts services since 1995.
e/divio
e/bodyioe/htmlio