linux/drivers/clk/clk-ls1x.c
<<
/o2i.12/spaue= .12/forme= .12a /o2i.1 href="../linux+v3.8 1p/drivers/clk/clk-ls1x.c">/o2i.12img src="../.static/gfx/right.png" alt=">>">/o2/spaue=/o2spau class="lxr_search">/o2i/o2i.12input typ> >hidden" nam> >navtarget" 2in> >">/o2i.12input typ> >text" nam> >search" id >search">/o2i.12butt typ> >submit">Search/o2i.1Prefs= .12/a>/o2/spaue=2i.1 12/dive=2i.1 12form acvalu="ajax+*" method="post" onsubmit="return false;">/o2input typ> >hidden" nam> >ajax_lookup" id >ajax_lookup" 2in> >">/2i.1 12/forme=/2i.1 12div class="headingbott m">search_results" class="search_results"= .e=2i.1 12/dive= 2div id >content">= 2div id >file_contents"e
aa/48/fdb3f84bc2047e46760ffa6c1a19ec74ffc7_3/0"eL1" class="line" nam>
>L1">1 112/a>2spau class="comment">/*2/spaue=L2" class="line" nam>
>L2">1 122/a>2spau class="comment"> * Copyright (c) 2012 Zhang, Keguang <keguang.zhang@gmail.com>2/spaue=L3" class="line" nam>
>L3">1 132/a>2spau class="comment"> *2/spaue=L4" class="line" nam>
>L4">1 142/a>2spau class="comment"> * This program is free software; you cau redistribute  it and/or modify it2/spaue=L5" class="line" nam>
>L5">1 152/a>2spau class="comment"> * under  the terms of  the GNU General.1Public License as published by the2/spaue=L6" class="line" nam>
>L6">1 162/a>2spau class="comment"> * Free Software Foundavalu;  either vers"
	 2 of the  License, or (at your2/spaue=L7" class="line" nam>
>L7">1 172/a>2spau class="comment"> * n valu) any later vers"
	.2/spaue=L8" class="line" nam>
>L8">1 182/a>2spau class="comment"> */2/spaue=L9" class="line" nam>
>L9">1 192/a>/L10" class="line" nam>
>L10">1 ptioa>#include <linux/clkdev.hioa>>/L11" class="line" nam>
>L11">1 11ioa>#include <linux/clk-provider.hioa>>/L12" class="line" nam>
>L12">1 12ioa>#include <linux/io.hioa>>/L13" class="line" nam>
>L13">1 13ioa>#include <linux/slab.hioa>>/L14" class="line" nam>
>L14">1 14ioa>#include <linux/err.hioa>>/L15" class="line" nam>
>L15">1 152/a>/L16" class="line" nam>
>L16">1 16ioa>#include <loongson1.hioa>>/L17" class="line" nam>
>L17">1 172/a>/L18" class="line" nam>
>L18">1 182/a>#define12a href="+code=OSC" class="sref">OSC2/a>i.1 133/L19" class="line" nam>
>L19">1 192/a>/L20" class="line" nam>
>L20">1 2tioa>static12a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCKioa>(2a href="+code=_lock" class="sref">_lockioa>);/L21" class="line" nam>
>L21">1 212/a>/L22" class="line" nam>
>L22">1 22ioa>static1int12a href="+code=ls1x_pll_clk_enajle" class="sref">>>/>>"drihw.1 13*ef="+code=ls1x_hwss="sref">>>hw.1 1)ref="drivers/clk/clk-ls1x.c#L22" id
>L13" c2ass="line" nam>
>L13">1213ioa2#incl{ref="drivers/clk/clk-ls1x.c#L22" id
>L14" c2ass="line" nam>
>L14">1214ioa24.1 133/L15" c2ass="line" nam>
>L15">12152/a2/L16" c2ass="line" nam>
>L16">1216ioa26L17" c2ass="line" nam>
>L17">12172/a27tatic1int12voidref="+code=ls1x_pll_clk_enajlibu class="sref">>>/>>"drihw.1 13*ef="+code=ls1x_hwss="sref">>>hw.1 1)ref="drivers/clk/clk-ls1x.c#L22" id
>L18" c2ass="line" nam>
>L18">12182/a28incl{ref="drivers/clk/clk-ls1x.c#L22" id
>L19" c2ass="line" nam>
>L19">12192/a29L20" c3ass="line" nam>
>L20">132tioa30L21" c3ass="line" nam>
>L21">13212/a31tatic1int12unsign thln1.ref="+code=ls1x_pll_clk_erecalc_rverss="sref">>>/>>"drihw.1 13*ef="+code=ls1x_hwss="sref">>>hw.1 1,ref="drivers/clk/clk-ls1x.c#L22" i3
>L22" c3ass="line" nam>
>L22">1322ioa32.1 133/>>pounnt_rver.1 1)ref="drivers/clk/clk-ls1x.c#L22" i3
>L3" claass="line" nam>
>L3">1 113ioa3#incl{ref="drivers/clk/clk-ls1x.c#L22" i3
>L14" c3ass="line" nam>
>L14">1314ioa34.1 133/>>u32.1 13ef="+code=ls1x_pllss="sref">>>pll.1 1,3ef="+code=ls1x_rverss="sref">>>rver.1 1href="drivers/clk/clk-ls1x.c#L21" i3
>L15" c3ass="line" nam>
>L15">13152/a3/L16" c3ass="line" nam>
>L16">1316ioa36.1 133/>>pll.1 1 =aef="+code=ls1x___rvw=readlss="sref">>>__rvw=readl2a href="+code=_lockLS1X_CLK_PLL_FREQss="sref">>>LS1X_CLK_PLL_FREQ;/L17" c3ass="line" nam>
>L17">13172/a37.1 133/>>rver.1 1 =a((12 + ref="+code=_lockpllss="sref">>>pll.1 1 & 0x3f)) *a>######) +ref="drivers/clk/clk-ls1x.c#L21" i3
>L18" c3ass="line" nam>
>L18">13182/a38.1 133/>>pll.1 1 &t;">######) &t;">L19" c3ass="line" nam>
>L19">13192/a39.1 133/>>rver.1 1 *=aef="+code=ls1x_class="sref">OSC2/a>i.1 1href="drivers/clk/clk-ls1x.c#L21" i4
>L20" c4ass="line" nam>
>L20">142tioa40.1 133/>>rver.1 1 &t;">L21" c4ass="line" nam>
>L21">14212/a4/L22" c4ass="line" nam>
>L22">1422ioa42.1 133/>>rver.1 1href="drivers/clk/clk-ls1x.c#L21" i4
>L3" cl4ass="line" nam>
>L3">1 413ioa43L4" claass="line" nam>
>L4">1 114ioa44L15" c4ass="line" nam>
>L15">14152/a45tatic1int12const alue>>"driops.1 13ef="+code=ls1x_/>>/L16" c4ass="line" nam>
>L16">1416ioa46.1 133/>>v"'option  =aef="+code=ls1x_pll_clk_enajle" class="sref">>>/L17" c4ass="line" nam>
>L17">14172/a47.1 133/>>ibu claion  =aef="+code=ls1x_pll_clk_enajlibu class="sref">>>/L18" c4ass="line" nam>
>L18">14182/a48.1 133/>>recalc_rverion  =aef="+code=ls1x_pll_clk_erecalc_rverss="sref">>>/L19" c4ass="line" nam>
>L19">14192/a49L20" c5ass="line" nam>
>L20">152tioa50L21" c5ass="line" nam>
>L21">15212/a51tatic1int12alue>>"dr.1 1 *aef="+code=ls1x___initss="sref">>>__init.1 13ef="+code=ls1x_"driregister_pllss="sref">>>"driregister_pllion value>>ievica.1 13*ef="+code=ls1x_ievss="sref">>>ievion ,ref="drivers/clk/clk-ls1x.c#L22" i5
>L22" c5ass="line" nam>
>L22">1522ioa52.1 133/>>>L22.1 1,3const char3*ef="+code=ls1x_pounnt_>L22ss="sref">>>pounnt_>L22.1 1,3unsign thln1.ref="+code=ls1x_flagsss="sref">>>flags.1 1)ref="drivers/clk/clk-ls1x.c#L22" i5
>L3" cl5ass="line" nam>
>L3">1 513ioa5#incl{ref="drivers/clk/clk-ls1x.c#L22" i5
>L4" cl5ass="line" nam>
>L4">1 514ioa54.1 133/>>"drihw.1 13*ef="+code=ls1x_hwss="sref">>>hw.1 1href="drivers/clk/clk-ls1x.c#L21" i5
>L5" claass="line" nam>
>L5">1 1152/a55.1 133/>>"dr.1 1 *ef="+code=ls1x_"drss="sref">>>"dr.1 1href="drivers/clk/clk-ls1x.c#L21" i5
>L16" c5ass="line" nam>
>L16">1516ioa56.1 133/>>"driinit_data.1 13ef="+code=ls1x_initss="sref">>>init.1 1href="drivers/clk/clk-ls1x.c#L21" i5
>L17" c5ass="line" nam>
>L17">15172/a5/L18" c5ass="line" nam>
>L18">15182/a58.1 133//*2/spa allocver Licedi.hioaspaue=L19" c5ass="line" nam>
>L19">15192/a59.1 133/>>hw.1 1 =aef="+code=ls1x_kzallocss="sref">>>kzallocion vaizeofvalue>>"drihw.1 1),3ef="+code=ls1x_GFP_KERNELss="sref">>>GFP_KERNEL;/L20" c6ass="line" nam>
>L20">162tioa60.1 133/>>hw.1 1)a{ref="drivers/clk/clk-ls1x.c#L22" i6
>L21" c6ass="line" nam>
>L21">16212/a61.1 133/>>pr_err2a hreclass="commeute ng">&quo;">#37;s:3could not allocver "drihw\n&quo;"ue=>>__func__;/L22" c6ass="line" nam>
>L22">1622ioa62.1 133/>>ERR_PTR2a hr-ef="+code=ls1x_ENOMEMss="sref">>>ENOMEM;/L3" cl6ass="line" nam>
>L3">1 613ioa63.1 133/L4" cl6ass="line" nam>
>L4">1 614ioa64L5" cl6ass="line" nam>
>L5">1 6152/a65.1 133/>>init.1 1.ef="+code=ls1x_>L22ss="sref">>>>L22.1 1 =aef="+code=ls1x_>L22ss="sref">>>>L22.1 1href="drivers/clk/clk-ls1x.c#L21" i6
>L6" claass="line" nam>
>L6">1 116ioa66.1 133/>>init.1 1.ef="+code=ls1x_opsss="sref">>>ops.1 1 =a&ef="+code=ls1x_/>>/L17" c6ass="line" nam>
>L17">16172/a67.1 133/>>init.1 1.ef="+code=ls1x_flagsss="sref">>>flags.1 1 =aef="+code=ls1x_flagsss="sref">>>flags.1 1 |aef="+code=ls1x_CLK_IS_BASIass="sref">OSC2/CLK_IS_BASIa.1 1href="drivers/clk/clk-ls1x.c#L21" i6
>L18" c6ass="line" nam>
>L18">16182/a68.1 133/>>init.1 1.ef="+code=ls1x_pounnt_>L22sss="sref">>>pounnt_>L22s.1 1 =a(ef="+code=ls1x_pounnt_>L22ss="sref">>>pounnt_>L22.1 1 ?a&ef="+code=ls1x_pounnt_>L22ss="sref">>>pounnt_>L22.1 1 :aef="+code=ls1x_NULLss="sref">>>NULL;/L19" c6ass="line" nam>
>L19">16192/a69.1 133/>>init.1 1.ef="+code=ls1x_>um_pounntsss="sref">>>>um_pounnts.1 1 =a(ef="+code=ls1x_pounnt_>L22ss="sref">>>pounnt_>L22.1 1 ?a1 :a0 href="drivers/clk/clk-ls1x.c#L21" i7
>L20" c7ass="line" nam>
>L20">172tioa70.1 133/>>hw.1 1-/spauf="+code=ls1x_initss="sref">>>init.1 1 =a&ef="+code=ls1x_initss="sref">>>init.1 1href="drivers/clk/clk-ls1x.c#L21" i7
>L21" c7ass="line" nam>
>L21">17212/a7/L22" c7ass="line" nam>
>L22">1722ioa72.1 133//*2/spa register Licecoa>)spaue=L3" cl7ass="line" nam>
>L3">1 713ioa73.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregisterss="sref">>>"driregister2a href="+code=_lockievss="sref">>>ievion ,aef="+code=ls1x_hwss="sref">>>hw.1 1 href="drivers/clk/clk-ls1x.c#L21" i7
>L4" cl7ass="line" nam>
>L4">1 714ioa74L5" cl7ass="line" nam>
>L5">1 7152/a75.1 133/>>IS_ERR2a href="+code=_lock"drss="sref">>>"dr.1 1))ref="drivers/clk/clk-ls1x.c#L22" i7
>L6" cl7ass="line" nam>
>L6">1 716ioa76.1 133/>>ksoft2a href="+code=_lockhwss="sref">>>hw.1 1 href="drivers/clk/clk-ls1x.c#L21" i7
>L7" claass="line" nam>
>L7">1 1172/a7/L18" c7ass="line" nam>
>L18">17182/a78.1 133/>>"dr.1 1href="drivers/clk/clk-ls1x.c#L21" i7
>L19" c7ass="line" nam>
>L19">17192/a79L20" c8ass="line" nam>
>L20">182tioa80L21" c8ass="line" nam>
>L21">18212/a8/>>__init.1 13ef="+code=ls1x_/>>/L22" c8ass="line" nam>
>L22">1822ioa82incl{ref="drivers/clk/clk-ls1x.c#L22" i8
>L3" cl8ass="line" nam>
>L3">1 813ioa83.1 133/>>"dr.1 1 *ef="+code=ls1x_"drss="sref">>>"dr.1 1href="drivers/clk/clk-ls1x.c#L21" i8
>L4" cl8ass="line" nam>
>L4">1 814ioa84L5" cl8ass="line" nam>
>L5">1 8152/a85.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregister_pllss="sref">>>"driregister_pllion vef="+code=ls1x_NULLss="sref">>>NULL;/&quo;"ref="dr&quo;"ue=>>NULL;/OSC2/CLK_IS_ROOT.1 1 href="drivers/clk/clk-ls1x.c#L21" i8
>L6" cl8ass="line" nam>
>L6">1 816ioa86.1 133/>>"driprepounle" cla2a href="+code=_lock"drss="sref">>>"dr.1 1)href="drivers/clk/clk-ls1x.c#L21" i8
>L7" cl8ass="line" nam>
>L7">1 8172/a8/L8" claass="line" nam>
>L8">1 1182/a88.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregister_di.hioass="sref">>>"driregister_di.hioaion vef="+code=ls1x_NULLss="sref">>>NULL;/&quo;"cpu="dr&quo;"ue=&quo;"ref="dr&quo;"ue=L19" c8ass="line" nam>
>L19">18192/a89.1 133/OSC2/CLK_SET_RATE_PARENT;/OSC2/LS1X_CLK_PLL_DIV;/OSC2/DIV_CPU_SHIFTion ,ref="drivers/clk/clk-ls1x.c#L22" i9
>L20" c9ass="line" nam>
>L20">192tioa90.1 133/OSC2/DIV_CPU_WIDTH;/OSC2/CLK_DIVIDER_ONE_BASED;/_lockioa>);/L21" c9ass="line" nam>
>L21">19212/a91.1 133/>>"driprepounle" cla2a href="+code=_lock"drss="sref">>>"dr.1 1)href="drivers/clk/clk-ls1x.c#L21" i9
>L22" c9ass="line" nam>
>L22">1922ioa92.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"cpu&quo;"ue=>>NULL;/L3" cl9ass="line" nam>
>L3">1 913ioa93L4" cl9ass="line" nam>
>L4">1 914ioa94.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregister_di.hioass="sref">>>"driregister_di.hioaion vef="+code=ls1x_NULLss="sref">>>NULL;/&quo;"dc="dr&quo;"ue=&quo;"ref="dr&quo;"ue=L5" cl9ass="line" nam>
>L5">1 9152/a95.1 133/OSC2/CLK_SET_RATE_PARENT;/OSC2/LS1X_CLK_PLL_DIV;/OSC2/DIV_DC_SHIFTion ,ref="drivers/clk/clk-ls1x.c#L22" i9
>L6" cl9ass="line" nam>
>L6">1 916ioa96.1 133/OSC2/DIV_DC_WIDTH;/OSC2/CLK_DIVIDER_ONE_BASED;/_lockioa>);/L7" cl9ass="line" nam>
>L7">1 9172/a97.1 133/>>"driprepounle" cla2a href="+code=_lock"drss="sref">>>"dr.1 1)href="drivers/clk/clk-ls1x.c#L21" i9
>L8" cl9ass="line" nam>
>L8">1 9182/a98.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"dc&quo;"ue=>>NULL;/L9" claass="line" nam>
>L9">1 1192/a9/L10" claass="line" nam>
>L10">1 p2tio p2.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregister_di.hioass="sref">>>"driregister_di.hioaion vef="+code=ls1x_NULLss="sref">>>NULL;/&quo;"ahb="dr&quo;"ue=&quo;"ref="dr&quo;"ue=L11" cl0ass="line" nam>
>L11">1 01tio p1.1 133/OSC2/CLK_SET_RATE_PARENT;/OSC2/LS1X_CLK_PLL_DIV;/OSC2/DIV_DDR_SHIFTion ,ref="drivers/clk/clk-ls1x.c#L22" i10
>L12" cl0ass="line" nam>
>L12">1 02tio p2.1 133/OSC2/DIV_DDR_WIDTH;/OSC2/CLK_DIVIDER_ONE_BASED;/_lockioa>);/L13" cl0ass="line" nam>
>L13">1 03tio p3.1 133/>>"driprepounle" cla2a href="+code=_lock"drss="sref">>>"dr.1 1)href="drivers/clk/clk-ls1x.c#L21" i10
>L14" cl0ass="line" nam>
>L14">1 04tio p4.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"ahb&quo;"ue=>>NULL;/L14" cl0ass="line" nam>
>L5">1 l0asio p5.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"stmmaceth&quo;"ue=>>NULL;/L16" cl0ass="line" nam>
>L16">1 06sio p6L17" cl0ass="line" nam>
>L17">1 07sio p7.1 133/>>"dr.1 1 =aef="+code=ls1x_"driregister_fixed_factoass="sref">>>"driregister_fixed_factoaion vef="+code=ls1x_NULLss="sref">>>NULL;/&quo;"apb="dr&quo;"ue=&quo;"ahb="dr&quo;"ue=L18" cl0ass="line" nam>
>L18">1 08sio p8.1 133/>>"driprepounle" cla2a href="+code=_lock"drss="sref">>>"dr.1 1)href="drivers/clk/clk-ls1x.c#L21" i10
>L19" cl0ass="line" nam>
>L19">1 09sio p9.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"apb&quo;"ue=>>NULL;/L10" cllass="line" nam>
>L10">1  ptio112.1 133/>>"driregister_c.hioa2a href="+code=_lock"drss="sref">>>"dr.1 1, eclass="commeute ng">&quo;"serial8250&quo;"ue=>>NULL;/L11" claass="line" nam>
>L11">1 11tio >#incl}ref="drivers/clk/clk-ls1x.c#L21" i1d
>L12" cllass="line" nam>
>L12">1  12io1>#inclc="line"footers>
The original LXRware; youhe2/spa3ef="+codehttp://sourceforge.net/projects/lxrs>LXRwnt">unity.1 1, ;">/ experi>/*2al 
	 2 of e2/ef="+codecom&to:lxr@/err..no">lxr@/err..no.1 1.
e=
2divid
>c="line"subfooters>
lxr./err..no kindly hosted e2/ef="+codehttp://www.redpill-/erpro.no">Redpill Lerpro AS.1 1, der.hioahe  Lerr.3consult ngor m oper;  eis servicas since 1995.
e=
2div i/bodyivi/html1<